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 core_interfaces_and_l3_edge router_bgp #5063

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

Conversation

Vibhu-gslab
Copy link
Contributor

@Vibhu-gslab Vibhu-gslab commented Feb 19, 2025

Change Summary

Refactor eos_designs structured_config for core_interfaces_and_l3_edge router_bgp

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 19, 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-5063
# Activate the virtual environment
source test-avd-pr-5063/bin/activate
# Install all requirements including PyAVD
pip install "pyavd[ansible] @ git+https://github.com/Vibhu-gslab/avd.git@refactor_core_interfaces_router_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
ansible-galaxy collection install git+https://github.com/Vibhu-gslab/avd.git#/ansible_collections/arista/avd/,refactor_core_interfaces_router_bgp --force
# Optional: Install AVD examples
cd test-avd-pr-5063
ansible-playbook arista.avd.install_examples

@Vibhu-gslab Vibhu-gslab force-pushed the refactor_core_interfaces_router_bgp branch from 7d63ac8 to 606d57e Compare February 19, 2025 10:18
@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 force-pushed the refactor_core_interfaces_router_bgp branch from bfb05ee to 03b70e4 Compare February 19, 2025 13:08
@Vibhu-gslab Vibhu-gslab force-pushed the refactor_core_interfaces_router_bgp branch from cbd8c4b to 01a08ec Compare February 20, 2025 07:30
@laxmikantchintakindi laxmikantchintakindi force-pushed the refactor_core_interfaces_router_bgp branch from 8d08efb to 5b846d1 Compare February 20, 2025 10:49
@laxmikantchintakindi laxmikantchintakindi marked this pull request as ready for review February 20, 2025 10:49
@laxmikantchintakindi laxmikantchintakindi requested review from a team as code owners February 20, 2025 10:49
@Vibhu-gslab Vibhu-gslab changed the title Refactor(eos_designs): structured_config for core_interfaces_and_l3_edge route_bgp Refactor(eos_designs): structured_config for core_interfaces_and_l3_edge router_bgp Feb 20, 2025
@Vibhu-gslab Vibhu-gslab force-pushed the refactor_core_interfaces_router_bgp branch from 5b846d1 to e3e1a27 Compare February 20, 2025 12:39
Found duplicate objects with conflicting data while generating configuration for Ethernet Interfaces defined under l3_edge p2p_link.
{'name': 'ethernet1', 'peer': 'peer2', 'peer_interface': 'ethernet2', 'description': 'P2P_peer2_ethernet2'} conflicts with
{'name': 'ethernet1', 'peer': 'peer1', 'peer_interface': 'ethernet1', 'description': 'P2P_peer1_ethernet1'}.
Found duplicate objects with conflicting data while generating configuration for Neighbors. {'ip_address': '192.168.0.3',
Copy link
Contributor

Choose a reason for hiding this comment

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

This is detecting duplicate BGP neighbors now, where before it was checking for duplicate interfaces. Please revert and add another test for duplicate neighbors. Thanks.

Copy link
Contributor

Choose a reason for hiding this comment

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

same for core-interface variant

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 error message.

@@ -33,6 +33,7 @@ core_interfaces:
interfaces: [ Ethernet1, Ethernet2 ]
profile: isis_bb_profile
ip: ["unnumbered loopback0", "unnumbered loopback0"]
as: [65000, 65002]
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need to add AS and IP info here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We were getting the below errors and molecule was failing

{"changed": false, "msg": "core_interfaces.p2p_links.[].as or core_interfaces.p2p_links_profiles.[].as”}
{"changed": false, "msg": "core_interfaces.p2p_links.[].ip, .subnet or .ip_pool"}

Copy link
Contributor

Choose a reason for hiding this comment

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

it should be possible to not set AS so lets make sure the behavior is not changing


# RFC5549
if self.inputs.underlay_rfc5549 and p2p_link.routing_protocol != "ebgp":
neighbor_interfaces.append({"name": p2p_link_data["interface"], **neighbor})
self.structured_config.router_bgp.neighbor_interfaces.append_new(name=p2p_link_data["interface"], **neighbor._as_dict())
Copy link
Contributor

Choose a reason for hiding this comment

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

We should avoid going to dict at all.
It will be simpler to just build the full neighbor interface here setting the 5 arguments directly.
And then remove the neighbor = stuff below this if so it only runs when building a regular neighbor.

Alternative is to use _cast_as

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!

@Vibhu-gslab Vibhu-gslab marked this pull request as draft February 24, 2025 09:35
@Vibhu-gslab Vibhu-gslab force-pushed the refactor_core_interfaces_router_bgp branch from 36e83d2 to b79f7f1 Compare February 24, 2025 10:07
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.

4 participants