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

Refactor(eos_designs): Refactor eos_designs structured_config code for router_path_selection.py #5002

Draft
wants to merge 10 commits into
base: devel
Choose a base branch
from

Conversation

laxmikantchintakindi
Copy link
Contributor

@laxmikantchintakindi laxmikantchintakindi commented Feb 10, 2025

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

  • 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-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

@github-actions github-actions bot added state: CI Updated CI scenario have been updated in the PR and removed state: CI Updated CI scenario have been updated in the PR labels Feb 18, 2025
@laxmikantchintakindi laxmikantchintakindi force-pushed the refactor/router-path-selection branch from 0c85f19 to 751ba2d Compare February 19, 2025 12:37
@Vibhu-gslab Vibhu-gslab force-pushed the refactor/router-path-selection branch from 66b7227 to 30eb016 Compare February 24, 2025 05:29
@laxmikantchintakindi laxmikantchintakindi force-pushed the refactor/router-path-selection branch from 30eb016 to f548021 Compare February 25, 2025 14:55
context_keys=["name"],
)
if "load_balance_policy" in match:
lb_policy = EosCliConfigGen.RouterPathSelection.LoadBalancePoliciesItem(
Copy link
Contributor

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

Copy link
Contributor

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.

Copy link
Contributor

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

Comment on lines 30 to 32
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)
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
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()

Copy link
Contributor Author

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"
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
router_path_selection.peer_dynamic_source = "stun"
self.structured_config.router_path_selection.peer_dynamic_source = "stun"

Copy link
Contributor Author

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
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
self.structured_config.router_path_selection = router_path_selection

Copy link
Contributor Author

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:
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
def _get_path_groups(self: AvdStructuredConfigOverlayProtocol, router_path_selection: EosCliConfigGen.RouterPathSelection) -> None:
def _set_path_groups(self: AvdStructuredConfigOverlayProtocol) -> None:

Copy link
Contributor Author

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."""
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
"""Generate the required path-groups locally."""
"""Set the required path-groups for router path-selection."""

Copy link
Contributor Author

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)
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
router_path_selection.path_groups.append(path_group_item)
self.structured_config.router_path_selection.path_groups.append(path_group_item)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@github-actions github-actions bot added the state: conflict PR with conflict label Feb 27, 2025
Copy link

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

@github-actions github-actions bot removed the state: conflict PR with conflict label Feb 28, 2025
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants