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

Feat(eos_designs): Allow reuse of cross-device BGP peer ip #4050

Conversation

laxmikantchintakindi
Copy link
Contributor

@laxmikantchintakindi laxmikantchintakindi commented May 29, 2024

Change Summary

Currently if a given BGP peer IP is used on device A and reused on device B, validation fails. However, although not a recommended design, this is a valid config. This PR will relax the BGP peer ip reuse.

Related Issue(s)

Fixes #3914

Component(s) name

arista.avd.eos_designs

Proposed changes

Today, if a given bgp peer IP is used on device A and reused on device B, validation fails.

[WARNING]: [SJC13EXTLF01-A]: 'Validation Error: Marr-Managed-WAN[0].vrfs[0].bgp_peers': Values of Primary key 'ip_address'
are not unique as required.
[WARNING]: [SJC13EXTLF01-B]: 'Validation Error: Marr-Managed-WAN[0].vrfs[0].bgp_peers': Values of Primary key 'ip_address'

However, although not a recommended design, this is a valid config.
Currently, validation has to be run set to 'warning' and the user just ignores those messages increasing margin for errors.
Allow IP reuse for BGP peerings across different devices.

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)

@github-actions github-actions bot added state: CI Updated CI scenario have been updated in the PR state: Documentation role Updated role: eos_designs issue related to eos_designs role labels May 29, 2024
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-4050
# Activate the virtual environment
source test-avd-pr-4050/bin/activate
# Install all requirements including PyAVD
pip install "pyavd[ansible] @ git+https://github.com/laxmikantchintakindi/avd.git@bgp_peer_ip_use_validation#subdirectory=python-avd" --force
# Install Ansible collection
ansible-galaxy collection install git+https://github.com/laxmikantchintakindi/avd.git#/ansible_collections/arista/avd/,bgp_peer_ip_use_validation --force
# Optional: Install AVD examples
cd test-avd-pr-4050
ansible-playbook arista.avd.install_examples

@laxmikantchintakindi laxmikantchintakindi changed the title Fix(eos_designs): Relax cross-device BGP peer IP reuse validation Fix(eos_designs): Add support for cross-device BGP peer IP reuse May 29, 2024
@laxmikantchintakindi laxmikantchintakindi changed the title Fix(eos_designs): Add support for cross-device BGP peer IP reuse Fix(eos_designs): Relax cross-device BGP peer IP reuse validation May 29, 2024
@laxmikantchintakindi laxmikantchintakindi changed the title Fix(eos_designs): Relax cross-device BGP peer IP reuse validation Fix(eos_designs): Allow reuse of cross-device BGP peer ip May 29, 2024
@MaheshGSLAB MaheshGSLAB marked this pull request as ready for review May 30, 2024 10:14
@MaheshGSLAB MaheshGSLAB requested review from a team as code owners May 30, 2024 10:14
@pmprado
Copy link
Contributor

pmprado commented May 31, 2024

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

Feedback - it should be "python3" instead of "python"

@pmprado
Copy link
Contributor

pmprado commented May 31, 2024

I've tested it and it does not warn anymore for when we have repeated IPs across devices. It builds correctly.
However, shouldn't it warn on this? In my testing it didn't warn at all:

        bgp_peers:
          - ip_address: 1.2.3.4 
            nodes: [EXTLF01-B]
          - ip_address: 1.2.3.4 
            nodes: [EXTLF01-B]

That's IP reuse on the same VRF and on the same device, not sure that's a valid config that we should warn or not.

Copy link
Contributor

@pmprado pmprado left a comment

Choose a reason for hiding this comment

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

The code now allows duplicates in general and does not warn.
While this does address the problem of duplicates across devices, it is blindly allowing duplicates on the same device, and when that happens, it will create a single entry in the resulting config.
If the duplicates have different data, I believe only the lastly defined will be considered.
IMHO duplicates on the same device and same VRF are an error, likely due to a typo or copy/paste error... @ClausHolbechArista what do you think?

@ClausHolbechArista
Copy link
Contributor

ClausHolbechArista commented Jun 3, 2024

This code should not allow duplicates. Have you tested? Your example above had the same exact info twice. Such duplication is silently ignored. Only one peering will be added to the structured config. Please confirm.
@pmprado

@Shivani-gslab Shivani-gslab marked this pull request as draft June 3, 2024 14:18
@Shivani-gslab Shivani-gslab marked this pull request as ready for review June 3, 2024 14:20
@pmprado
Copy link
Contributor

pmprado commented Jun 4, 2024

This code should not allow duplicates. Have you tested? Your example above had the same exact info twice. Such duplication is silently ignored. Only one peering will be added to the structured config. Please confirm. @pmprado

Yes I did test. Indeed it was an exact duplicate, to simulate a typo on a situation where we have 2 peers that are basically identical except for the IP. Do you mean that if they are not exact duplicates they won't be silently ignored? Still, shouldn't any duplicate be warned about?

@ClausHolbechArista
Copy link
Contributor

ClausHolbechArista commented Jun 4, 2024

This code should not allow duplicates. Have you tested? Your example above had the same exact info twice. Such duplication is silently ignored. Only one peering will be added to the structured config. Please confirm. @pmprado

Yes I did test. Indeed it was an exact duplicate, to simulate a typo on a situation where we have 2 peers that are basically identical except for the IP. Do you mean that if they are not exact duplicates they won't be silently ignored?

Correct

Still, shouldn't any duplicate be warned about?

No, since you may have situations where you define the VRF in multiple tenants, and they get merged, possibly leading to the same peers being repeated (it is a very complicated corner case). There is no reason to error out when there is no conflict.

@ClausHolbechArista ClausHolbechArista requested a review from a team June 5, 2024 08:08
@ClausHolbechArista ClausHolbechArista added the one approval This PR has one approval and is only missing one more. label Jun 5, 2024
@ClausHolbechArista ClausHolbechArista changed the title Fix(eos_designs): Allow reuse of cross-device BGP peer ip Feat(eos_designs): Allow reuse of cross-device BGP peer ip Jun 6, 2024
@laxmikantchintakindi laxmikantchintakindi marked this pull request as ready for review June 7, 2024 09:49
@ClausHolbechArista ClausHolbechArista dismissed gmuloc’s stale review June 7, 2024 11:07

Requested changes has been implemented.

Copy link

sonarcloud bot commented Jun 7, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@ClausHolbechArista ClausHolbechArista merged commit 6d09d8b into aristanetworks:devel Jun 7, 2024
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
one approval This PR has one approval and is only missing one more. rn: Feat(eos_designs) role: eos_designs issue related to eos_designs role state: CI Updated CI scenario have been updated in the PR state: Documentation role Updated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug(eos_designs): Relax cross-device BGP peer IP reuse validation
5 participants