Skip to content
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

Open
wants to merge 12 commits into
base: devel
Choose a base branch
from

Conversation

jrecchia1029
Copy link
Contributor

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

  • N/A

Repository Checklist

  • My code has been rebased from devel before I start
  • I have read the CONTRIBUTING document.
  • My change requires a change to the documentation and documentation have been updated accordingly.
  • I have updated molecule CI testing accordingly. (check the box if not applicable)

Copy link

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

@github-actions github-actions bot added the state: CI Updated CI scenario have been updated in the PR label Jul 31, 2024
@jrecchia1029 jrecchia1029 changed the title initial l3 inband ztp commit Feat(eos_designs): Support for L3 Inband ZTP Aug 1, 2024
@github-actions github-actions bot added the state: conflict PR with conflict label Aug 5, 2024
Copy link

github-actions bot commented Aug 5, 2024

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot added type: documentation Improvements or additions to documentation role: eos_cli_config_gen issue related to eos_cli_config_gen role module: inventory_to_container issue related to inventory_to_container module module: configlet_build_config issue related to configlet_build_config module filter: is_in_filter issue related to is_in_filter plugin filter: list_compress issue related to list_compress filter plugin filter: natural_sort issue related to natural_sort filter plugin type: code quality CI and development toolset role: eos_validate_state role: dhcp_provisioner state: Documentation role Updated type: Python filters role: eos_designs issue related to eos_designs role labels Aug 14, 2024
@github-actions github-actions bot removed type: documentation Improvements or additions to documentation role: eos_cli_config_gen issue related to eos_cli_config_gen role module: inventory_to_container issue related to inventory_to_container module module: configlet_build_config issue related to configlet_build_config module filter: is_in_filter issue related to is_in_filter plugin filter: list_compress issue related to list_compress filter plugin labels Aug 14, 2024
@github-actions github-actions bot added state: conflict PR with conflict state: Documentation role Updated role: eos_designs issue related to eos_designs role and removed state: conflict PR with conflict labels Oct 3, 2024
Copy link

sonarcloud bot commented Oct 3, 2024

Copy link
Contributor

@emilarista emilarista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@github-actions github-actions bot removed the state: conflict PR with conflict label Oct 3, 2024
Copy link

github-actions bot commented Oct 3, 2024

Conflicts have been resolved. A maintainer will review the pull request shortly.

@github-actions github-actions bot added the state: conflict PR with conflict label Oct 7, 2024
Copy link

github-actions bot commented Oct 7, 2024

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@ClausHolbechArista
Copy link
Contributor

Please rebase and resolve conflicts

Copy link

Conflicts have been resolved. A maintainer will review the pull request shortly.

@github-actions github-actions bot removed state: Documentation role Updated role: eos_designs issue related to eos_designs role labels Nov 13, 2024
Copy link

sonarcloud bot commented Nov 13, 2024


@cached_property
def _ntp_servers(self) -> list | None:
"""Returns the list of name servers."""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"""Returns the list of name servers."""
"""Returns the list of NTP servers."""

Comment on lines +60 to +63
if "arista.io" in cvp_instance_ips[0]:
return "https://www.arista.io/ztp/bootstrap"

return f"https://{cvp_instance_ips[0]}/ztp/bootstrap"
Copy link
Contributor

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?

Suggested change
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"

Comment on lines +84 to +88
try:
ntp_server_ip = IPv4Address(ntp_server["name"])
except AddressValueError:
continue
ntp_servers.append(str(ntp_server_ip))
Copy link
Contributor

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:
Copy link
Contributor

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:
Copy link
Contributor

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]}",
Copy link
Contributor

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']?

Copy link
Contributor

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)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: CI Updated CI scenario have been updated in the PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants