Skip to content

Refactor(eos_designs): Refactor the method of route map RM-CONN-2-BGP generation#6779

Draft
laxmikantchintakindi wants to merge 9 commits intoaristanetworks:develfrom
laxmikantchintakindi:refactor/rm-conn-bgp
Draft

Refactor(eos_designs): Refactor the method of route map RM-CONN-2-BGP generation#6779
laxmikantchintakindi wants to merge 9 commits intoaristanetworks:develfrom
laxmikantchintakindi:refactor/rm-conn-bgp

Conversation

@laxmikantchintakindi
Copy link
Copy Markdown
Contributor

@laxmikantchintakindi laxmikantchintakindi commented Mar 31, 2026

Change Summary

Refactor the logic for route map RM-CONN-2_BGP generation. Removed some structured_config_contributors from inband_mgmt/init and moved the logic for generating the route map to structured_config_utils.py.
Also generation of RM-CONN-2-BGP route map in network services is now handled in structured_config_utils.

Related Issue(s)

Fixes #

Component(s) name

arista.avd.eos_designs

Proposed changes

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)

@laxmikantchintakindi laxmikantchintakindi self-assigned this Mar 31, 2026
@github-actions
Copy link
Copy Markdown

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-6779
# Activate the virtual environment
source test-avd-pr-6779/bin/activate
# Install all requirements including PyAVD
pip install "pyavd[ansible] @ git+https://github.com/laxmikantchintakindi/avd.git@refactor/rm-conn-bgp#subdirectory=python-avd" --force
# Point Ansible collections path to the Python virtual environment
export ANSIBLE_COLLECTIONS_PATH=$VIRTUAL_ENV/ansible_collections
# Install Ansible collection
python -m ansible.cli.galaxy collection install git+https://github.com/laxmikantchintakindi/avd.git#/ansible_collections/arista/avd/,refactor/rm-conn-bgp --force
cd test-avd-pr-6779
# Run your playbook using `python -m ansible.cli.playbook path/to/playbook.yml ...`

You can also test this PR using AVD playground:

  • Rebase your branch to makes sure it is up-to-date and has latest lab topologies for example inventories
  • Authenticate on labs.arista.com. Use your email! Not login.
  • Start the playground
  • In the lab selector UI pick "I want to use a specific AVD fork"
  • Enter following parameters:
GitHub org: laxmikantchintakindi
Repository name: avd
Branch: refactor/rm-conn-bgp
  • Select an example inventory to test the PR
  • Once the AVD Playground setup will be finished, type make start and test anything once the lab is up

@github-actions github-actions bot added the state: CI Updated CI scenario have been updated in the PR label Mar 31, 2026
@laxmikantchintakindi laxmikantchintakindi changed the title Refactor(eos_designs): Refactor the logic for route map RM-CONN-2_BGP generation Refactor(eos_designs): Refactor the method of route map RM-CONN-2_BGP generation Mar 31, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 31, 2026

Codecov Report

❌ Patch coverage is 98.71795% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.33%. Comparing base (d668056) to head (81e5a3a).

Files with missing lines Patch % Lines
...avd/_eos_designs/shared_utils/inband_management.py 85.71% 0 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##            devel    #6779      +/-   ##
==========================================
- Coverage   87.36%   87.33%   -0.03%     
==========================================
  Files         351      350       -1     
  Lines       19358    19314      -44     
  Branches     3619     3612       -7     
==========================================
- Hits        16912    16868      -44     
  Misses       1884     1884              
  Partials      562      562              
Files with missing lines Coverage Δ
python-avd/pyavd/_eos_designs/shared_utils/misc.py 94.11% <100.00%> (+0.53%) ⬆️
...ns/structured_config/inband_management/__init__.py 95.00% <ø> (-0.32%) ⬇️
...structured_config/network_services/prefix_lists.py 100.00% <ø> (ø)
...s/structured_config/network_services/route_maps.py 98.73% <100.00%> (-0.21%) ⬇️
...s/structured_config/network_services/router_bgp.py 96.40% <100.00%> (ø)
...esigns/structured_config/network_services/utils.py 87.93% <100.00%> (-1.68%) ⬇️
...signs/structured_config/structured_config_utils.py 100.00% <100.00%> (ø)
...eos_designs/structured_config/underlay/__init__.py 100.00% <ø> (ø)
...designs/structured_config/underlay/dhcp_servers.py 95.31% <100.00%> (ø)
...s_designs/structured_config/underlay/route_maps.py 100.00% <ø> (ø)
... and 3 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@laxmikantchintakindi laxmikantchintakindi changed the title Refactor(eos_designs): Refactor the method of route map RM-CONN-2_BGP generation Refactor(eos_designs): Refactor the method of route map RM-CONN-2-BGP generation Mar 31, 2026
@@ -1,92 +0,0 @@
# Copyright (c) 2023-2026 Arista Networks, Inc.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we should not remove the mixin completely for prefix_lists

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As all the methods are moved, removed this file.


self.structured_config.prefix_lists.append_new(name="PL-LOOPBACKS-EVPN-OVERLAY", sequence_numbers=sequence_numbers)

def set_once_prefix_list_loopbacks_pim_rp(self: StructuredConfigUtils) -> None:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

missed to add @run_once_method decorator?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

all these prefix_lists methods are called for underlay route-maps only, so we should not move them to structured_config_utils, its better to keep them as they are in the mixin

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes but the main method to set the route map RM-CONN-2BGP is called from inband_management and underlay. So moved the methods here. Methods like set_once_prefix_list_loopbacks_pim_rp which are not run_once_methods are called from run_once_method. So without the decorator too they will be called once.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This way the structured_config_utils would become very large

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 3, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state: CI Updated CI scenario have been updated in the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants