-
Notifications
You must be signed in to change notification settings - Fork 239
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
Refactor(eos_designs): Refactor structured_config code for dhcp_servers.py #5084
base: devel
Are you sure you want to change the base?
Refactor(eos_designs): Refactor structured_config code for dhcp_servers.py #5084
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-5084
# Activate the virtual environment
source test-avd-pr-5084/bin/activate
# Install all requirements including PyAVD
pip install "pyavd[ansible] @ git+https://github.com/laxmikantchintakindi/avd.git@refactor/underlay/dhcp-servers#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/laxmikantchintakindi/avd.git#/ansible_collections/arista/avd/,refactor/underlay/dhcp-servers --force
# Optional: Install AVD examples
cd test-avd-pr-5084
ansible-playbook arista.avd.install_examples |
d30c553
to
48635d6
Compare
48635d6
to
b116eda
Compare
python-avd/pyavd/_eos_designs/structured_config/underlay/dhcp_servers.py
Outdated
Show resolved
Hide resolved
2981872
to
0a5a215
Compare
python-avd/pyavd/_eos_designs/structured_config/underlay/dhcp_servers.py
Outdated
Show resolved
Hide resolved
for more information, see https://pre-commit.ci
…servers.py Co-authored-by: Vibhu-gslab <[email protected]>
497e922
to
97b5a20
Compare
@cached_property | ||
def _ipv4_ztp_boot_file(self: AvdStructuredConfigUnderlayProtocol) -> str | None: | ||
"""Returns the file name to allow for ZTP to CV. TODO: Add inband_ztp_bootstrap_file to schema.""" | ||
dhcp_server.vrf = "default" |
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.
I would probably keep this in the main function rather than hiding it in the middle of the servers. Move it after the check for if len(dhcp_server.subnets) == 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.
Fixed.
dhcp_server.subnets.append(subnet_item) | ||
|
||
def _set_ipv4_ztp_boot_file(self: AvdStructuredConfigUnderlayProtocol, dhcp_server: EosCliConfigGen.DhcpServersItem) -> None: | ||
"""Set the file name to allow for ZTP to CV. TODO: Add inband_ztp_bootstrap_file to schema.""" |
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.
@laxmikantchintakindi can you please add the inband_ztp_bootstrap_file to the schema? shoud be a string
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.
Added.
if ntp_servers := self._ntp_servers: | ||
dhcp_server["ipv4_vendor_options"] = [ntp_servers] | ||
dhcp_servers.append(dhcp_server) | ||
return |
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.
don't think you need this return, instead do a:
if not ntp_servers:
raise
Do the subotoptions stuff
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.
Done.
|
Change Summary
Refactor structured_config code for dhcp_servers.py
Related Issue(s)
Fixes #
Component(s) name
arista.avd.eos_designs
Proposed changes
Refactor structured_config code for dhcp_servers.py
How to test
Checklist
User Checklist
Repository Checklist