-
Notifications
You must be signed in to change notification settings - Fork 197
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
base: devel
Are you sure you want to change the base?
Feat(eos_designs): Add option to disable default 'redistribute connected' in VRF. #4220
Conversation
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 |
python-avd/pyavd/_eos_designs/structured_config/network_services/router_bgp.py
Outdated
Show resolved
Hide resolved
python-avd/pyavd/_eos_designs/structured_config/network_services/router_ospf.py
Outdated
Show resolved
Hide resolved
python-avd/pyavd/_eos_designs/structured_config/network_services/router_ospf.py
Outdated
Show resolved
Hide resolved
python-avd/pyavd/_eos_designs/schema/schema_fragments/defs_network_services.schema.yml
Outdated
Show resolved
Hide resolved
python-avd/pyavd/_eos_designs/schema/schema_fragments/defs_network_services.schema.yml
Outdated
Show resolved
Hide resolved
python-avd/pyavd/_eos_designs/structured_config/network_services/router_ospf.py
Outdated
Show resolved
Hide resolved
f0b1eb7
to
d8650dc
Compare
python-avd/pyavd/_eos_designs/structured_config/network_services/router_bgp.py
Outdated
Show resolved
Hide resolved
python-avd/pyavd/_eos_designs/structured_config/network_services/router_bgp.py
Outdated
Show resolved
Hide resolved
python-avd/pyavd/_eos_designs/schema/schema_fragments/defs_network_services.schema.yml
Outdated
Show resolved
Hide resolved
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" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
There was a problem hiding this comment.
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.
python-avd/pyavd/_eos_designs/structured_config/network_services/router_bgp.py
Outdated
Show resolved
Hide resolved
1bb67dd
to
d912e44
Compare
d912e44
to
1f68379
Compare
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
0ab2b39
to
270010e
Compare
Conflicts have been resolved. A maintainer will review the pull request shortly. |
@@ -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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected the docstring.
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" |
There was a problem hiding this comment.
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.
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
1902e7f
to
fd3406a
Compare
redistribute_connected: | ||
type: bool | ||
default: true | ||
description: Non-selectively enabling or disabling redistribution of connected routes to BGP inside the VRF. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
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.
Quality Gate passedIssues Measures |
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