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 Jul 30, 2024
1 parent 50e0f8b commit 0ab2b39
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 @@ -84,7 +84,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 @@ -303,9 +303,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 @@ -161,14 +161,18 @@ def _mlag_ibgp_peering_vlan_vrf(self: AvdStructuredConfigNetworkServices, vrf, t

return vlan_id

def _mlag_ibgp_peering_redistribute(self: AvdStructuredConfigNetworkServices, vrf, tenant) -> 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

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 0ab2b39

Please sign in to comment.