-
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 |
python-avd/pyavd/_eos_designs/structured_config/network_services/router_path_selection.py
Show resolved
Hide resolved
python-avd/pyavd/_eos_designs/structured_config/network_services/router_path_selection.py
Outdated
Show resolved
Hide resolved
0c85f19
to
751ba2d
Compare
66b7227
to
30eb016
Compare
…r router_path_selection.py
for more information, see https://pre-commit.ci
30eb016
to
f548021
Compare
context_keys=["name"], | ||
) | ||
if "load_balance_policy" in match: | ||
lb_policy = EosCliConfigGen.RouterPathSelection.LoadBalancePoliciesItem( |
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 think we can update the _generate_wan_load_balance_policy method in utils_wan.py for return exactly what we formed here or may be we can generate the structure config directly there, but lets discuss with @ClausHolbechArista and @gmuloc before to make any changes
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.
yeah I have this somewhere in a PR - let me see if I can contribute it here.
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 pushed one commit to your branch - should be passing now.
@MaheshGSLAB please take a round of review as it touches a bit more than just the load balance policies (because of how we are using the output of filtered_wan_policies) I will take care of the TODOs in my refactoring of utils_wan.py
router_path_selection = EosCliConfigGen.RouterPathSelection() | ||
router_path_selection.tcp_mss_ceiling.ipv4_segment_size = self.shared_utils.node_config.dps_mss_ipv4 | ||
self._get_path_groups(router_path_selection) |
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.
router_path_selection = EosCliConfigGen.RouterPathSelection() | |
router_path_selection.tcp_mss_ceiling.ipv4_segment_size = self.shared_utils.node_config.dps_mss_ipv4 | |
self._get_path_groups(router_path_selection) | |
self.structured_config.router_path_selection.tcp_mss_ceiling.ipv4_segment_size = self.shared_utils.node_config.dps_mss_ipv4 | |
self._set_path_groups() |
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.
|
||
if self.shared_utils.is_wan_server: | ||
router_path_selection["peer_dynamic_source"] = "stun" | ||
router_path_selection.peer_dynamic_source = "stun" |
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.
router_path_selection.peer_dynamic_source = "stun" | |
self.structured_config.router_path_selection.peer_dynamic_source = "stun" |
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.
|
||
return strip_empties_from_dict(router_path_selection) | ||
self.structured_config.router_path_selection = router_path_selection |
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.
self.structured_config.router_path_selection = router_path_selection |
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.
@@ -46,87 +46,75 @@ def _dp_ipsec_profile_name(self: AvdStructuredConfigOverlayProtocol) -> str: | |||
return self.inputs.wan_ipsec_profiles.data_plane.profile_name | |||
return self.inputs.wan_ipsec_profiles.control_plane.profile_name | |||
|
|||
def _get_path_groups(self: AvdStructuredConfigOverlayProtocol) -> list: | |||
def _get_path_groups(self: AvdStructuredConfigOverlayProtocol, router_path_selection: EosCliConfigGen.RouterPathSelection) -> 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.
def _get_path_groups(self: AvdStructuredConfigOverlayProtocol, router_path_selection: EosCliConfigGen.RouterPathSelection) -> None: | |
def _set_path_groups(self: AvdStructuredConfigOverlayProtocol) -> 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.
Fixed
@@ -46,87 +46,75 @@ def _dp_ipsec_profile_name(self: AvdStructuredConfigOverlayProtocol) -> str: | |||
return self.inputs.wan_ipsec_profiles.data_plane.profile_name | |||
return self.inputs.wan_ipsec_profiles.control_plane.profile_name | |||
|
|||
def _get_path_groups(self: AvdStructuredConfigOverlayProtocol) -> list: | |||
def _get_path_groups(self: AvdStructuredConfigOverlayProtocol, router_path_selection: EosCliConfigGen.RouterPathSelection) -> None: | |||
"""Generate the required path-groups locally.""" |
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.
"""Generate the required path-groups locally.""" | |
"""Set the required path-groups for router path-selection.""" |
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.
return path_groups | ||
path_group_item = EosCliConfigGen.RouterPathSelection.PathGroupsItem() | ||
self._generate_ha_path_group(path_group_item=path_group_item) | ||
router_path_selection.path_groups.append(path_group_item) |
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.
router_path_selection.path_groups.append(path_group_item) | |
self.structured_config.router_path_selection.path_groups.append(path_group_item) |
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.
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. |
|
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