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

Fix(eos_designs): Add redistribute connected under BGP for VRF default if no underlay #4522

Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ router bgp 65001
neighbor 10.10.1.2 peer group MYPEERGROUP
neighbor 10.10.20.1 peer group MLAG-IPv4-UNDERLAY-PEER
neighbor 10.10.20.1 description bgp-from-network-services-2_Vlan3099
redistribute connected
!
address-family ipv4
neighbor MLAG-IPv4-UNDERLAY-PEER activate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ router_bgp:
maximum_routes: 12000
send_community: all
route_map_in: RM-MLAG-PEER-IN
redistribute_routes:
- source_protocol: connected
neighbors:
- ip_address: 10.10.20.1
peer_group: MLAG-IPv4-UNDERLAY-PEER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,20 +176,26 @@ def _router_bgp_vrfs(self: AvdStructuredConfigNetworkServices) -> dict:
if (bgp_vrf_redistribute_static := vrf.get("redistribute_static")) is True or (
vrf["static_routes"] and bgp_vrf_redistribute_static is not False
):
bgp_vrf.setdefault("redistribute_routes", []).append({"source_protocol": "static"})
bgp_vrf["redistribute_routes"].append({"source_protocol": "static"})

elif bgp_vrf:
# VRF default with RD/RT and eos_cli/struct_cfg which should go under the vrf default context.
# Any peers added later will be put directly under router_bgp
append_if_not_duplicate(
list_of_dicts=router_bgp["vrfs"],
primary_key="name",
new_dict={"name": vrf_name, **bgp_vrf},
context="BGP VRFs defined under network services",
context_keys=["name"],
)
# Resetting bgp_vrf so we only add global keys if there are any neighbors for VRF default
bgp_vrf = {}
else:
# VRF default
if bgp_vrf:
# RD/RT and/or eos_cli/struct_cfg which should go under the vrf default context.
# Any peers added later will be put directly under router_bgp
append_if_not_duplicate(
list_of_dicts=router_bgp["vrfs"],
primary_key="name",
new_dict={"name": vrf_name, **bgp_vrf},
context="BGP VRFs defined under network services",
context_keys=["name"],
)
# Resetting bgp_vrf so we only add global keys if there are any neighbors for VRF default
bgp_vrf = {}

if self.shared_utils.underlay_routing_protocol == "none":
# We need to add redistribute connected for the default VRF when underlay_routing_protocol is "none"
bgp_vrf["redistribute_routes"] = [{"source_protocol": "connected"}]

# MLAG IBGP Peering VLANs per VRF
# Will only be configured for VRF default if underlay_routing_protocol == "none".
Expand Down
Loading