Skip to content

Commit

Permalink
Fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
Laxmikant Chintakindi authored and Laxmikant Chintakindi committed Aug 5, 2024
1 parent 4530bc0 commit 270010e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def _mlag_ibgp_peering_subnets_without_redistribution(self: AvdStructuredConfigN
if self._mlag_ibgp_peering_vlan_vrf(vrf, tenant) is None:
continue

if self._mlag_ibgp_peering_redistribute(vrf, tenant):
if not self._exclude_mlag_ibgp_peering_from_redistribute(vrf, tenant):
# By default the BGP peering is redistributed, so we only need the prefix-list for the false case.
continue

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,8 @@ def _update_router_bgp_vrf_mlag_neighbor_cfg(self: AvdStructuredConfigNetworkSer
"""
In-place update MLAG neighbor part of structured config for *one* VRF under router_bgp.vrfs
"""
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"
if self._exclude_mlag_ibgp_peering_from_redistribute(vrf, tenant):
bgp_vrf["redistribute_routes"][0]["route_map"] = "RM-CONN-2-BGP-VRFS"

if self.shared_utils.underlay_rfc5549 and self.shared_utils.overlay_mlag_rfc5549:
interface_name = f"Vlan{vlan_id}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,19 @@ 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, tenant) -> bool:
"""
Returns True if MLAG IBGP Peering subnet should be redistributed for the given vrf/tenant.
False otherwise.
Does _not_ include checks if the peering is enabled at all, so that should be checked first.
"""
return default(vrf.get("redistribute_mlag_ibgp_peering_vrfs"), tenant.get("redistribute_mlag_ibgp_peering_vrfs"), True) is True # noqa: FBT003

if get(vrf, "redistribute_connected", True) is True:
return default(vrf.get("redistribute_mlag_ibgp_peering_vrfs"), tenant.get("redistribute_mlag_ibgp_peering_vrfs"), True) is False

return True

@cached_property
def _configure_bgp_mlag_peer_group(self: AvdStructuredConfigNetworkServices) -> bool:
Expand Down

0 comments on commit 270010e

Please sign in to comment.