-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat(eos_designs): Support for L3 Inband ZTP #4304
base: devel
Are you sure you want to change the base?
Conversation
Review docs on Read the Docs To test this pull request: # Create virtual environment for this testing below the current directory
python -m venv test-avd-pr-4304
# Activate the virtual environment
source test-avd-pr-4304/bin/activate
# Install all requirements including PyAVD
pip install "pyavd[ansible] @ git+https://github.com/jrecchia1029/ansible-avd.git@l3_inband_ztp#subdirectory=python-avd" --force
# Point Ansible collections path to the Python virtual environment
export ANSIBLE_COLLECTIONS_PATH=$VIRTUAL_ENV/ansible_collections
# Install Ansible collection
ansible-galaxy collection install git+https://github.com/jrecchia1029/ansible-avd.git#/ansible_collections/arista/avd/,l3_inband_ztp --force
# Optional: Install AVD examples
cd test-avd-pr-4304
ansible-playbook arista.avd.install_examples |
python-avd/pyavd/_eos_designs/structured_config/base/dhcp_server.py
Outdated
Show resolved
Hide resolved
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
728ac45
to
dcf65e7
Compare
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Conflicts have been resolved. A maintainer will review the pull request shortly. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Please rebase and resolve conflicts |
for more information, see https://pre-commit.ci
cbda064
to
6783837
Compare
Conflicts have been resolved. A maintainer will review the pull request shortly. |
for more information, see https://pre-commit.ci
Quality Gate passedIssues Measures |
|
||
@cached_property | ||
def _ntp_servers(self) -> list | None: | ||
"""Returns the list of name servers.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""Returns the list of name servers.""" | |
"""Returns the list of NTP servers.""" |
if "arista.io" in cvp_instance_ips[0]: | ||
return "https://www.arista.io/ztp/bootstrap" | ||
|
||
return f"https://{cvp_instance_ips[0]}/ztp/bootstrap" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redirection of the EoS running <4.30.0F to US-1A CVaaS (www.arista.io) would fail if switch is mapped to another region (only EOS >=4.30.0F has embedded support for redirector service). It might be better just to send it to whatever first CV FQDN/IP is configured under cvp_instance_ips
?
if "arista.io" in cvp_instance_ips[0]: | |
return "https://www.arista.io/ztp/bootstrap" | |
return f"https://{cvp_instance_ips[0]}/ztp/bootstrap" | |
return f"https://{cvp_instance_ips[0]}/ztp/bootstrap" |
try: | ||
ntp_server_ip = IPv4Address(ntp_server["name"]) | ||
except AddressValueError: | ||
continue | ||
ntp_servers.append(str(ntp_server_ip)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would only append item if it is set as an IP and not an FQDN. In case of FQDN - what if we try to resolve it (on a runner) into an IP and append resolved IP (if we succeeded)? Lack of NTP sync during CVaaS onbording may not be super critical anymore as this gets synced over TA
return dns_servers | ||
|
||
@cached_property | ||
def _ntp_servers(self) -> list | None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function returns a dict | None
return None | ||
|
||
@cached_property | ||
def dhcp_servers(self) -> dict | None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function is returning a list | None
"subnet": str(ip_network(f"{uplink['peer_ip_address']}/{uplink['prefix_length']}", strict=False)), | ||
"ranges": [{"start": str(uplink["ip_address"]), "end": str(uplink["ip_address"])}], | ||
"name": f"inband ztp for {peer}-{uplink['interface']}", | ||
"default_gateway": f"{uplink['peer_ip_address'].split('/')[0]}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we expect /<prefix_length>
to be returned inside uplink['peer_ip_address']
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ClausHolbechArista should file name 1to1 match the name of the returned/set variable? aka dhcp_servers (plural)?
Change Summary
Adding L3 In band ZTP functionality
Component(s) name
arista.avd.eos_designs
Proposed changes
Enable L3 In Band ZTP by making the network device upstream of the ZTP a dhcp server that will allocate the appropriate IP address on the connected p2p interface.
How to test
Updated eos_designs_unit_tests for the INBAND_MGMT_TESTS group
Checklist
User Checklist
Repository Checklist