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): Add option to disable default 'redistribute connected' in VRF. #4220

Open
wants to merge 17 commits into
base: devel
Choose a base branch
from

Conversation

laxmikantchintakindi
Copy link
Contributor

@laxmikantchintakindi laxmikantchintakindi commented Jul 16, 2024

Change Summary

Add option to disable default 'redistribute connected ' in VRF.

Related Issue(s)

Fixes #4091

Component(s) name

arista.avd.eos_designs

Proposed changes

Add option to disable default 'redistribute connected ' in VRF. MPLS topology . Customer does not want to see connected routes in RT.

How to test

Checklist

User 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)

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

@laxmikantchintakindi laxmikantchintakindi changed the title Feat(eos_designs): Add option to disable default 'redistribute connected ' in VRF. Feat(eos_designs): Add option to disable default 'redistribute connected' in VRF. Jul 16, 2024
@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 Jul 16, 2024
@laxmikantchintakindi laxmikantchintakindi marked this pull request as ready for review July 25, 2024 07:00
@ClausHolbechArista ClausHolbechArista added the one approval This PR has one approval and is only missing one more. label Jul 26, 2024
@ClausHolbechArista ClausHolbechArista requested a review from a team July 26, 2024 07:05
@gmuloc gmuloc added this to the v4.10.0 milestone Jul 26, 2024
Comment on lines 306 to 308
if get(vrf, "redistribute_connected", default=True):
if not self._mlag_ibgp_peering_redistribute(vrf, tenant):
bgp_vrf["redistribute_routes"][0]["route_map"] = "RM-CONN-2-BGP-VRFS"
Copy link
Contributor

Choose a reason for hiding this comment

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

Guillaume meant to move the check for get(vrf, "redistribute_connected", default=True) into the method def _mlag_ibgp_peering_redistribute(...) So anything else using this method will honor the same.

Copy link
Contributor

Choose a reason for hiding this comment

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

Note that you must return True from that method in the case redistribute-connected is set to false since the check here has the NOT. Maybe we should reverse the logic and rename the method to _exclude_mlag_ibgp_peering_from_redistribute. Please analyze the logic and search for other uses of the method to see that you retain the current behavior.

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

There is a bug in the new logic. If you try to set the new value to false on the VRF Tenant_A_WEB_ZONE you should see an error around the line mentioned above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

_exclude_mlag_ibgp_peering_redistribute was returning True when redistribute_connected was false. Now changed it to return false. This is not giving the error for Tenant_A_WEB_ZONE when redistribute_connected is set to false.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a new vrf in network services to test this condition.

@ClausHolbechArista ClausHolbechArista removed this from the v4.10.0 milestone Jul 26, 2024
@laxmikantchintakindi laxmikantchintakindi marked this pull request as draft July 26, 2024 12:23
@ClausHolbechArista ClausHolbechArista removed the one approval This PR has one approval and is only missing one more. label Jul 29, 2024
@github-actions github-actions bot added type: documentation Improvements or additions to documentation role: eos_cli_config_gen issue related to eos_cli_config_gen role labels Jul 29, 2024
@github-actions github-actions bot removed type: documentation Improvements or additions to documentation role: eos_cli_config_gen issue related to eos_cli_config_gen role labels Jul 29, 2024
Copy link

github-actions bot commented Aug 5, 2024

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Copy link

github-actions bot commented Aug 5, 2024

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

@github-actions github-actions bot removed the state: conflict PR with conflict label Aug 5, 2024
@@ -162,15 +162,18 @@ def _mlag_ibgp_peering_vlan_vrf(self: AvdStructuredConfigNetworkServices, vrf: d

return vlan_id

def _mlag_ibgp_peering_redistribute(self: AvdStructuredConfigNetworkServices, vrf: dict, tenant: dict) -> bool:
def _exclude_mlag_ibgp_peering_from_redistribute(self: AvdStructuredConfigNetworkServices, vrf: dict, tenant: dict) -> bool:
"""
Returns True if MLAG IBGP Peering subnet should be redistributed for the given vrf/tenant.
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
Returns True if MLAG IBGP Peering subnet should be redistributed for the given vrf/tenant.
Returns True if MLAG IBGP Peering subnet should be _excluded_ from redistribution for the given vrf/tenant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Corrected the docstring.

Comment on lines 306 to 308
if get(vrf, "redistribute_connected", default=True):
if not self._mlag_ibgp_peering_redistribute(vrf, tenant):
bgp_vrf["redistribute_routes"][0]["route_map"] = "RM-CONN-2-BGP-VRFS"
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a bug in the new logic. If you try to set the new value to false on the VRF Tenant_A_WEB_ZONE you should see an error around the line mentioned above.

@laxmikantchintakindi laxmikantchintakindi marked this pull request as ready for review August 13, 2024 05:29
redistribute_connected:
type: bool
default: true
description: Non-selectively enabling or disabling redistribution of connected routes to BGP inside the VRF.
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
description: Non-selectively enabling or disabling redistribution of connected routes to BGP inside the VRF.
description: Enable or disable the redistribution of all connected routes to BGP in the VRF.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added this in latest commit.

@@ -892,7 +892,11 @@ $defs:
type: str
redistribute_static:
type: bool
description: Non-selectively enabling or disabling redistribute static inside the VRF.
description: Non-selectively enabling or disabling redistribute static to BGP inside the VRF.
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
description: Non-selectively enabling or disabling redistribute static to BGP inside the VRF.
description: Enable or disable the redistribution of all static routes to BGP in the VRF.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added this in latest commit.

Copy link

sonarcloud bot commented Aug 29, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

Add option to disable default 'redistribute connected ' in VRF.
5 participants