-
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 eos_designs structured_config code for router_path_selection.py #5002
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-5002
# Activate the virtual environment
source test-avd-pr-5002/bin/activate
# Install all requirements including PyAVD
pip install "pyavd[ansible] @ git+https://github.com/laxmikantchintakindi/avd.git@refactor/router-path-selection#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/router-path-selection --force
# Optional: Install AVD examples
cd test-avd-pr-5002
ansible-playbook arista.avd.install_examples |
@@ -19,15 +20,13 @@ class RouterPathSelectionMixin(Protocol): | |||
Class should only be used as Mixin to a AvdStructuredConfig class. | |||
""" | |||
|
|||
@cached_property | |||
def router_path_selection(self: AvdStructuredConfigNetworkServicesProtocol) -> dict | None: | |||
@structured_config_contributor |
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.
Can you update the overlay as well in the same PR
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.
Updated
lb_policy = EosCliConfigGen.RouterPathSelection.LoadBalancePoliciesItem() | ||
lb_policy._update( | ||
name=get(match["load_balance_policy"], "name", None), | ||
lowest_hop_count=get(match["load_balance_policy"], "lowest_hop_count", None), | ||
jitter=get(match["load_balance_policy"], "jitter", None), | ||
latency=get(match["load_balance_policy"], "latency", None), | ||
loss_rate=get(match["load_balance_policy"], "loss_rate", 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.
lb_policy = EosCliConfigGen.RouterPathSelection.LoadBalancePoliciesItem() | |
lb_policy._update( | |
name=get(match["load_balance_policy"], "name", None), | |
lowest_hop_count=get(match["load_balance_policy"], "lowest_hop_count", None), | |
jitter=get(match["load_balance_policy"], "jitter", None), | |
latency=get(match["load_balance_policy"], "latency", None), | |
loss_rate=get(match["load_balance_policy"], "loss_rate", None), | |
) | |
lb_policy = EosCliConfigGen.RouterPathSelection.LoadBalancePoliciesItem( | |
name=get(match["load_balance_policy"], "name", None), | |
lowest_hop_count=get(match["load_balance_policy"], "lowest_hop_count", None), | |
jitter=get(match["load_balance_policy"], "jitter", None), | |
latency=get(match["load_balance_policy"], "latency", None), | |
loss_rate=get(match["load_balance_policy"], "loss_rate", 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.
Also am not sure we should provide the static keys and values. Check if we can update the the match["load_balance_policy"] as object instead of dict from the helper functions
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.
Applied suggestion in commit.
…r router_path_selection.py
for more information, see https://pre-commit.ci
0c85f19
to
751ba2d
Compare
|
Change Summary
Refactor eos_designs structured_config code for router_path_selection.py.
Related Issue(s)
Fixes #
Component(s) name
arista.avd.eos_designs
Proposed changes
Refactor eos_designs structured_config code for router_path_selection.py.
How to test
Checklist
User Checklist
Repository Checklist