Skip to content

Commit

Permalink
Fix(eos_designs): Add redistribute connected under BGP for VRF defaul…
Browse files Browse the repository at this point in the history
…t if no underlay (#4522)
  • Loading branch information
ClausHolbechArista authored Sep 30, 2024
1 parent 0b5d9d7 commit f055823
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
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

0 comments on commit f055823

Please sign in to comment.