-
Notifications
You must be signed in to change notification settings - Fork 234
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): structured_config for network_services router_ospf #4981
base: devel
Are you sure you want to change the base?
Refactor(eos_designs): structured_config for network_services router_ospf #4981
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-4981
# Activate the virtual environment
source test-avd-pr-4981/bin/activate
# Install all requirements including PyAVD
pip install "pyavd[ansible] @ git+https://github.com/Vibhu-gslab/avd.git@refactor_router_ospf#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/Vibhu-gslab/avd.git#/ansible_collections/arista/avd/,refactor_router_ospf --force
# Optional: Install AVD examples
cd test-avd-pr-4981
ansible-playbook arista.avd.install_examples |
7e76803
to
4234dda
Compare
python-avd/pyavd/_eos_designs/structured_config/network_services/router_ospf.py
Outdated
Show resolved
Hide resolved
python-avd/pyavd/_eos_designs/structured_config/network_services/router_ospf.py
Outdated
Show resolved
Hide resolved
python-avd/pyavd/_eos_designs/structured_config/network_services/router_ospf.py
Outdated
Show resolved
Hide resolved
python-avd/pyavd/_eos_designs/structured_config/network_services/router_ospf.py
Outdated
Show resolved
Hide resolved
4234dda
to
f068a51
Compare
f068a51
to
6a256da
Compare
2e26dd2
to
0bfdb32
Compare
0bfdb32
to
191ec4a
Compare
python-avd/pyavd/_eos_designs/structured_config/network_services/router_ospf.py
Outdated
Show resolved
Hide resolved
python-avd/pyavd/_eos_designs/structured_config/network_services/router_ospf.py
Outdated
Show resolved
Hide resolved
python-avd/pyavd/_eos_designs/structured_config/network_services/router_ospf.py
Outdated
Show resolved
Hide resolved
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Conflicts have been resolved. A maintainer will review the pull request shortly. |
a6d1ee0
to
96712ad
Compare
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Conflicts have been resolved. A maintainer will review the pull request shortly. |
|
process.router_id = vrf_router_id | ||
if vrf.ospf.bfd: | ||
process.bfd_enable = vrf.ospf.bfd | ||
process.max_lsa = vrf.ospf.max_lsa |
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 can be moved to the process creation.
context_keys=["id"], | ||
) | ||
|
||
process._update(id=process_id, passive_interface_default=True) |
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.
Move the process creation here so you can set these directly, and then call the _update_ospf_interface
after.
if vrf_router_id := self.get_vrf_router_id(vrf, tenant, vrf.ospf.router_id): | ||
process.router_id = vrf_router_id |
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.
The new classes can accept a None value, so you don't need all these if
s
if vrf.ospf.redistribute_bgp.enabled: | ||
process.redistribute.bgp.enabled = True | ||
if route_map := vrf.ospf.redistribute_bgp.route_map: | ||
process.redistribute.bgp.route_map = route_map |
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 could possibly be done with a _cast_as since the keys are 1:1. If you do that, it ends up with two lines and no "if` so it would be easier done directly in the process creation so remove this function.
Change Summary
Refactor eos_designs structured_config code for network_services router_ospf
Related Issue(s)
Fixes #
Component(s) name
arista.avd.eos_designs
Proposed changes
Refactor eos_designs structured_config code for network_services router_ospf to use classes
How to test
Checklist
Repository Checklist