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): structured_config for network_services route_maps #5037

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

Conversation

Vibhu-gslab
Copy link
Contributor

Change Summary

Refactor eos_designs structured_config for network_services route_maps

Related Issue(s)

Fixes #

Component(s) name

arista.avd.eos_designs

Proposed changes

How to test

Checklist

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)

@Vibhu-gslab Vibhu-gslab self-assigned this Feb 13, 2025
@Vibhu-gslab Vibhu-gslab changed the title Refactor(eos_designs): structured_config for network_services route_maps Refactor(eos_designs): structured_config for network_services route_maps (WIP) Feb 13, 2025
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-5037
# Activate the virtual environment
source test-avd-pr-5037/bin/activate
# Install all requirements including PyAVD
pip install "pyavd[ansible] @ git+https://github.com/Vibhu-gslab/avd.git@refactor_networkservices_route_maps#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_networkservices_route_maps --force
# Optional: Install AVD examples
cd test-avd-pr-5037
ansible-playbook arista.avd.install_examples

@Vibhu-gslab Vibhu-gslab changed the title Refactor(eos_designs): structured_config for network_services route_maps (WIP) Refactor(eos_designs): structured_config for network_services route_maps Feb 13, 2025
@Vibhu-gslab Vibhu-gslab force-pushed the refactor_networkservices_route_maps branch from 370bf8a to 647ea9b Compare February 14, 2025 05:09
Copy link
Contributor

@Shivani-gslab Shivani-gslab left a comment

Choose a reason for hiding this comment

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

you can remove the usage of strip_empties_from_list here - https://github.com/aristanetworks/avd/pull/5037/files#diff-d2355de0048a356757c66aa448770e31b41c3347735338110535c1c1587c850cL99

and update the methods to append to structured_config.route_maps directly.

route_maps = strip_empties_from_list(
           [
               self._evpn_export_vrf_default_route_map(),
               self._bgp_underlay_peers_route_map(),
               self._redistribute_connected_to_bgp_route_map(),
               self._redistribute_static_to_bgp_route_map(),
           ],
       )

@Vibhu-gslab Vibhu-gslab force-pushed the refactor_networkservices_route_maps branch from 647ea9b to daabcf8 Compare February 18, 2025 05:37
@Vibhu-gslab
Copy link
Contributor Author

you can remove the usage of strip_empties_from_list here - https://github.com/aristanetworks/avd/pull/5037/files#diff-d2355de0048a356757c66aa448770e31b41c3347735338110535c1c1587c850cL99

and update the methods to append to structured_config.route_maps directly.

route_maps = strip_empties_from_list(
           [
               self._evpn_export_vrf_default_route_map(),
               self._bgp_underlay_peers_route_map(),
               self._redistribute_connected_to_bgp_route_map(),
               self._redistribute_static_to_bgp_route_map(),
           ],
       )

We are using the function _route_maps_vrf_default in router_bgp.py which is expecting a return, if we append it then router_bgp.py code breaks.

@ClausHolbechArista
Copy link
Contributor

you can remove the usage of strip_empties_from_list here - https://github.com/aristanetworks/avd/pull/5037/files#diff-d2355de0048a356757c66aa448770e31b41c3347735338110535c1c1587c850cL99
and update the methods to append to structured_config.route_maps directly.

route_maps = strip_empties_from_list(
           [
               self._evpn_export_vrf_default_route_map(),
               self._bgp_underlay_peers_route_map(),
               self._redistribute_connected_to_bgp_route_map(),
               self._redistribute_static_to_bgp_route_map(),
           ],
       )

We are using the function _route_maps_vrf_default in router_bgp.py which is expecting a return, if we append it then router_bgp.py code breaks.

Maybe we can try to build a small helper function with the "decider logic" which we can call from multiple places, but then insert the route-maps directly into structured config instead of returning.

@Vibhu-gslab Vibhu-gslab force-pushed the refactor_networkservices_route_maps branch from daabcf8 to 5dbe4ed Compare February 18, 2025 13:22
@Vibhu-gslab Vibhu-gslab force-pushed the refactor_networkservices_route_maps branch from 607fc32 to 2404885 Compare February 19, 2025 07:01
@github-actions github-actions bot added the state: conflict PR with conflict label Feb 19, 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 19, 2025
Copy link

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

@github-actions github-actions bot added the state: CI Updated CI scenario have been updated in the PR label Feb 19, 2025
@Vibhu-gslab Vibhu-gslab changed the title Refactor(eos_designs): structured_config for network_services route_maps Refactor(eos_designs): structured_config for network_services route_maps (WIP) Feb 20, 2025
@Vibhu-gslab Vibhu-gslab force-pushed the refactor_networkservices_route_maps branch from 6deb954 to ebc8780 Compare February 20, 2025 05:51
@github-actions github-actions bot added the state: conflict PR with conflict label Feb 20, 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: CI Updated CI scenario have been updated in the PR label Feb 20, 2025
@github-actions github-actions bot removed the state: conflict PR with conflict label Feb 20, 2025
Copy link

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

@Vibhu-gslab Vibhu-gslab changed the title Refactor(eos_designs): structured_config for network_services route_maps (WIP) Refactor(eos_designs): structured_config for network_services route_maps Feb 20, 2025
@Vibhu-gslab
Copy link
Contributor Author

you can remove the usage of strip_empties_from_list here - https://github.com/aristanetworks/avd/pull/5037/files#diff-d2355de0048a356757c66aa448770e31b41c3347735338110535c1c1587c850cL99
and update the methods to append to structured_config.route_maps directly.

route_maps = strip_empties_from_list(
           [
               self._evpn_export_vrf_default_route_map(),
               self._bgp_underlay_peers_route_map(),
               self._redistribute_connected_to_bgp_route_map(),
               self._redistribute_static_to_bgp_route_map(),
           ],
       )

We are using the function _route_maps_vrf_default in router_bgp.py which is expecting a return, if we append it then router_bgp.py code breaks.

Maybe we can try to build a small helper function with the "decider logic" which we can call from multiple places, but then insert the route-maps directly into structured config instead of returning.

Built a helper function with the decider logic and append rest of the config.

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
75.7% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

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