Skip to content

Conversation

@MaheshGSLAB
Copy link
Contributor

Change Summary

Added the support to enable or disable bgp peer validation in vrf

Related Issue(s)

Fixes #

Component(s) name

arista.avd.eos_designs

Proposed changes

Introduce a knob to enable or disable BGP peer state validation on a per-VRF basis.

eos_designs Additions:

network_services_key[].vrfs[].validate_bgp_peers: <bool; default=false>

eos_cli_config_gen Additions:

router_bgp.neighbors[].metadata.validate_state: <bool>
router_bgp.vrfs[].neighbors[].metadata.validate_state: <bool>
router_bgp.neighbor_interfaces[].metadata.validate_state: <bool>
router_bgp.vrfs[].neighbor_interfaces[].metadata.validate_state: <bool>

How to test

Run molecule

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)

@MaheshGSLAB MaheshGSLAB self-assigned this Oct 28, 2025
@github-actions
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-6071
# Activate the virtual environment
source test-avd-pr-6071/bin/activate
# Install all requirements including PyAVD
pip install "pyavd[ansible] @ git+https://github.com/MaheshGSLAB/ansible-avd.git@bgp-peer-validation#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/MaheshGSLAB/ansible-avd.git#/ansible_collections/arista/avd/,bgp-peer-validation --force
# Optional: Install AVD examples
cd test-avd-pr-6071
ansible-playbook arista.avd.install_examples

@github-actions github-actions bot added role: eos_cli_config_gen issue related to eos_cli_config_gen role 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 Oct 28, 2025
mlag_peer=self.shared_utils.mlag_peer,
interface=interface_name,
peer_interface=interface_name,
if isinstance(bgp_vrf, EosCliConfigGen.RouterBgp.VrfsItem):
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess you are doing this for type checking - lets do this in another PR (and think if can find a better way as this looks like a lot of code suddenly)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The other way i can see is using the obtain method which dont require much if else for type check also not much complex.

Copy link
Contributor

Choose a reason for hiding this comment

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

you dont' need obtain cf suggestions

@sonarqubecloud
Copy link

@MaheshGSLAB MaheshGSLAB marked this pull request as ready for review October 30, 2025 08:31
@MaheshGSLAB MaheshGSLAB requested review from a team as code owners October 30, 2025 08:31
@MaheshGSLAB MaheshGSLAB requested a review from gmuloc October 30, 2025 08:31
Comment on lines +328 to +340
bgp_vrf.neighbor_interfaces.append_new(
name=interface_name,
peer_group=self.shared_utils.mlag_vrfs_peer_group_name,
remote_as=self.shared_utils.formatted_bgp_as,
description=AvdStringFormatter().format(
self.inputs.mlag_bgp_peer_description,
mlag_peer=self.shared_utils.mlag_peer,
interface=interface_name,
peer_interface=interface_name,
)
or None,
)
bgp_vrf.neighbor_interfaces.obtain(interface_name).metadata.validate_state = vrf.validate_bgp_peers
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
bgp_vrf.neighbor_interfaces.obtain(interface_name).metadata.validate_state = vrf.validate_bgp_peers
neighbor_interface = bgp_vrf.neighbor_interfaces.append_new(
name=interface_name,
peer_group=self.shared_utils.mlag_vrfs_peer_group_name,
remote_as=self.shared_utils.formatted_bgp_as,
description=AvdStringFormatter().format(
self.inputs.mlag_bgp_peer_description,
mlag_peer=self.shared_utils.mlag_peer,
interface=interface_name,
peer_interface=interface_name,
)
or None,
)
neighbor_interface.metadata.validate_state = vrf.validate_bgp_peers

Copy link
Contributor

Choose a reason for hiding this comment

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

the diff is messed up but you get the gist (thanks Github UI...)

Copy link
Contributor

@gmuloc gmuloc left a comment

Choose a reason for hiding this comment

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

adjust code to use the return value from append_new

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

Labels

role: eos_cli_config_gen issue related to eos_cli_config_gen role 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.

3 participants