Skip to content

Commit

Permalink
Updated BGP Template for Chassis/Multi-asic (#9291)
Browse files Browse the repository at this point in the history
 Updated BGP Template for the case:
    
   1. For Packet Chassis do not advertise Loopback4096 address into BGP as there is Static Route for same. 
       Having this route in BGP causes two level of recursion in Zebra and cause assert in Zebra 
       when there are many nexthop involved
 
   2. Advertise only P2P Connected IP's into BGP (External Peers). For Packet chassis we have backend IP Interface subnet and if 
        they get advertised into BGP then it also causes recursion
  • Loading branch information
abdosi committed Dec 6, 2021
1 parent 1fce3eb commit f501311
Show file tree
Hide file tree
Showing 11 changed files with 152 additions and 24 deletions.
20 changes: 16 additions & 4 deletions dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq {{ loop.index * 5 }} permit {{ prefi
{% set multi_asic = True %}
{% endif %}
{% if multi_asic is defined or DEVICE_METADATA['localhost']['switch_type'] == 'voq' or DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %}
ip prefix-list V4_P2P_IP permit 0.0.0.0/0 ge 31 le 31
!
ipv6 prefix-list V6_P2P_IP permit ::/0 ge 126 le 126
!
route-map V4_CONNECTED_ROUTES permit 10
match ip address prefix-list V4_P2P_IP
call HIDE_INTERNAL
!
route-map V6_CONNECTED_ROUTES permit 10
match ipv6 address prefix-list V6_P2P_IP
call HIDE_INTERNAL
!
route-map HIDE_INTERNAL permit 10
set community no-export
{% if constants.bgp.peers is defined and constants.bgp.peers.internal is defined and constants.bgp.peers.internal.community is defined %}
Expand Down Expand Up @@ -71,7 +83,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
!
{# advertise loopback #}
network {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}/32
{% if multi_asic is defined or DEVICE_METADATA['localhost']['switch_type'] == 'voq' or DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %}
{% if ((multi_asic is defined and DEVICE_METADATA['localhost']['switch_type'] != 'chassis-packet') or (DEVICE_METADATA['localhost']['switch_type'] == 'voq')) %}
network {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }}/32 route-map HIDE_INTERNAL
{% endif %}
!
Expand All @@ -80,7 +92,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
network {{ get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}/64
exit-address-family
{% endif %}
{% if multi_asic is defined or DEVICE_METADATA['localhost']['switch_type'] == 'voq' or DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %}
{% if ((multi_asic is defined and DEVICE_METADATA['localhost']['switch_type'] != 'chassis-packet') or (DEVICE_METADATA['localhost']['switch_type'] == 'voq')) %}
{% if get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") != 'None' %}
address-family ipv6
network {{ get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }}/128 route-map HIDE_INTERNAL
Expand All @@ -104,10 +116,10 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
!
{% if DEVICE_METADATA['localhost']['sub_role'] == 'FrontEnd' or DEVICE_METADATA['localhost']['switch_type'] == 'voq' or DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %}
address-family ipv4
redistribute connected route-map HIDE_INTERNAL
redistribute connected route-map V4_CONNECTED_ROUTES
exit-address-family
address-family ipv6
redistribute connected route-map HIDE_INTERNAL
redistribute connected route-map V6_CONNECTED_ROUTES
exit-address-family
{% endif %}
!
Expand Down
16 changes: 14 additions & 2 deletions src/sonic-bgpcfgd/tests/data/sonic-cfggen/bgpd.conf.j2/all.conf
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 5 permit 10.10.10.0/24
!
ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq 10 permit fc01::/64
!
ip prefix-list V4_P2P_IP permit 0.0.0.0/0 ge 31 le 31
!
ipv6 prefix-list V6_P2P_IP permit ::/0 ge 126 le 126
!
route-map V4_CONNECTED_ROUTES permit 10
match ip address prefix-list V4_P2P_IP
call HIDE_INTERNAL
!
route-map V6_CONNECTED_ROUTES permit 10
match ipv6 address prefix-list V6_P2P_IP
call HIDE_INTERNAL
!
route-map HIDE_INTERNAL permit 10
set community no-export
on-match next
Expand Down Expand Up @@ -71,10 +83,10 @@ router bgp 55555
exit-address-family
!
address-family ipv4
redistribute connected route-map HIDE_INTERNAL
redistribute connected route-map V4_CONNECTED_ROUTES
exit-address-family
address-family ipv6
redistribute connected route-map HIDE_INTERNAL
redistribute connected route-map V6_CONNECTED_ROUTES
exit-address-family
!
address-family ipv4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 5 permit 10.10.10.0/24
!
ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq 10 permit fc01::/64
!
ip prefix-list V4_P2P_IP permit 0.0.0.0/0 ge 31 le 31
!
ipv6 prefix-list V6_P2P_IP permit ::/0 ge 126 le 126
!
route-map V4_CONNECTED_ROUTES permit 10
match ip address prefix-list V4_P2P_IP
call HIDE_INTERNAL
!
route-map V6_CONNECTED_ROUTES permit 10
match ipv6 address prefix-list V6_P2P_IP
call HIDE_INTERNAL
!
route-map HIDE_INTERNAL permit 10
set community no-export
!
Expand Down Expand Up @@ -50,10 +62,10 @@ router bgp 55555
exit-address-family
!
address-family ipv4
redistribute connected route-map HIDE_INTERNAL
redistribute connected route-map V4_CONNECTED_ROUTES
exit-address-family
address-family ipv6
redistribute connected route-map HIDE_INTERNAL
redistribute connected route-map V6_CONNECTED_ROUTES
exit-address-family
!
address-family ipv4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 5 permit 10.10.10.0/24
!
ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq 10 permit fc01::/64
!
ip prefix-list V4_P2P_IP permit 0.0.0.0/0 ge 31 le 31
!
ipv6 prefix-list V6_P2P_IP permit ::/0 ge 126 le 126
!
route-map V4_CONNECTED_ROUTES permit 10
match ip address prefix-list V4_P2P_IP
call HIDE_INTERNAL
!
route-map V6_CONNECTED_ROUTES permit 10
match ipv6 address prefix-list V6_P2P_IP
call HIDE_INTERNAL
!
route-map HIDE_INTERNAL permit 10
set community no-export
!
Expand Down Expand Up @@ -50,10 +62,10 @@ router bgp 55555
exit-address-family
!
address-family ipv4
redistribute connected route-map HIDE_INTERNAL
redistribute connected route-map V4_CONNECTED_ROUTES
exit-address-family
address-family ipv6
redistribute connected route-map HIDE_INTERNAL
redistribute connected route-map V6_CONNECTED_ROUTES
exit-address-family
!
address-family ipv4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 5 permit 10.10.10.0/24
!
ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq 10 permit fc01::/64
!
ip prefix-list V4_P2P_IP permit 0.0.0.0/0 ge 31 le 31
!
ipv6 prefix-list V6_P2P_IP permit ::/0 ge 126 le 126
!
route-map V4_CONNECTED_ROUTES permit 10
match ip address prefix-list V4_P2P_IP
call HIDE_INTERNAL
!
route-map V6_CONNECTED_ROUTES permit 10
match ipv6 address prefix-list V6_P2P_IP
call HIDE_INTERNAL
!
route-map HIDE_INTERNAL permit 10
set community no-export
!
Expand All @@ -35,25 +47,21 @@ router bgp 55555
bgp router-id 55.55.55.56
!
network 55.55.55.55/32
network 55.55.55.56/32 route-map HIDE_INTERNAL
!
address-family ipv6
network fc00::1/64
exit-address-family
address-family ipv6
network fc00::2/128 route-map HIDE_INTERNAL
exit-address-family
!
network 10.10.10.1/24
address-family ipv6
network fc01::1/64
exit-address-family
!
address-family ipv4
redistribute connected route-map HIDE_INTERNAL
redistribute connected route-map V4_CONNECTED_ROUTES
exit-address-family
address-family ipv6
redistribute connected route-map HIDE_INTERNAL
redistribute connected route-map V6_CONNECTED_ROUTES
exit-address-family
!
address-family ipv4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 5 permit 10.10.10.0/24
!
ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq 10 permit fc01::/64
!
ip prefix-list V4_P2P_IP permit 0.0.0.0/0 ge 31 le 31
!
ipv6 prefix-list V6_P2P_IP permit ::/0 ge 126 le 126
!
route-map V4_CONNECTED_ROUTES permit 10
match ip address prefix-list V4_P2P_IP
call HIDE_INTERNAL
!
route-map V6_CONNECTED_ROUTES permit 10
match ipv6 address prefix-list V6_P2P_IP
call HIDE_INTERNAL
!
route-map HIDE_INTERNAL permit 10
set community no-export
!
Expand Down Expand Up @@ -50,10 +62,10 @@ router bgp 55555
exit-address-family
!
address-family ipv4
redistribute connected route-map HIDE_INTERNAL
redistribute connected route-map V4_CONNECTED_ROUTES
exit-address-family
address-family ipv6
redistribute connected route-map HIDE_INTERNAL
redistribute connected route-map V6_CONNECTED_ROUTES
exit-address-family
!
address-family ipv4
Expand Down
16 changes: 14 additions & 2 deletions src/sonic-bgpcfgd/tests/data/sonic-cfggen/frr.conf.j2/all.conf
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@ ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq 5 permit 10.10.10.0/24
!
ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq 10 permit fc01::/64
!
ip prefix-list V4_P2P_IP permit 0.0.0.0/0 ge 31 le 31
!
ipv6 prefix-list V6_P2P_IP permit ::/0 ge 126 le 126
!
route-map V4_CONNECTED_ROUTES permit 10
match ip address prefix-list V4_P2P_IP
call HIDE_INTERNAL
!
route-map V6_CONNECTED_ROUTES permit 10
match ipv6 address prefix-list V6_P2P_IP
call HIDE_INTERNAL
!
route-map HIDE_INTERNAL permit 10
set community no-export
!
Expand Down Expand Up @@ -86,10 +98,10 @@ router bgp 55555
exit-address-family
!
address-family ipv4
redistribute connected route-map HIDE_INTERNAL
redistribute connected route-map V4_CONNECTED_ROUTES
exit-address-family
address-family ipv6
redistribute connected route-map HIDE_INTERNAL
redistribute connected route-map V6_CONNECTED_ROUTES
exit-address-family
!
address-family ipv4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ ip prefix-list PL_LoopbackV4 permit 10.1.0.32/32
ipv6 prefix-list PL_LoopbackV6 permit fc00:1::/64
!
!
ip prefix-list V4_P2P_IP permit 0.0.0.0/0 ge 31 le 31
!
ipv6 prefix-list V6_P2P_IP permit ::/0 ge 126 le 126
!
route-map V4_CONNECTED_ROUTES permit 10
match ip address prefix-list V4_P2P_IP
call HIDE_INTERNAL
!
route-map V6_CONNECTED_ROUTES permit 10
match ipv6 address prefix-list V6_P2P_IP
call HIDE_INTERNAL
!
route-map HIDE_INTERNAL permit 10
set community no-export
!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ ip prefix-list PL_LoopbackV4 permit 10.1.0.32/32
ipv6 prefix-list PL_LoopbackV6 permit fc00:1::/64
!
!
ip prefix-list V4_P2P_IP permit 0.0.0.0/0 ge 31 le 31
!
ipv6 prefix-list V6_P2P_IP permit ::/0 ge 126 le 126
!
route-map V4_CONNECTED_ROUTES permit 10
match ip address prefix-list V4_P2P_IP
call HIDE_INTERNAL
!
route-map V6_CONNECTED_ROUTES permit 10
match ipv6 address prefix-list V6_P2P_IP
call HIDE_INTERNAL
!
route-map HIDE_INTERNAL permit 10
set community no-export
!
Expand Down Expand Up @@ -66,10 +78,10 @@ router bgp 65100
!
!
address-family ipv4
redistribute connected route-map HIDE_INTERNAL
redistribute connected route-map V4_CONNECTED_ROUTES
exit-address-family
address-family ipv6
redistribute connected route-map HIDE_INTERNAL
redistribute connected route-map V6_CONNECTED_ROUTES
exit-address-family
!
address-family ipv4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ ip prefix-list PL_LoopbackV4 permit 10.1.0.32/32
ipv6 prefix-list PL_LoopbackV6 permit fc00:1::/64
!
!
ip prefix-list V4_P2P_IP permit 0.0.0.0/0 ge 31 le 31
!
ipv6 prefix-list V6_P2P_IP permit ::/0 ge 126 le 126
!
route-map V4_CONNECTED_ROUTES permit 10
match ip address prefix-list V4_P2P_IP
call HIDE_INTERNAL
!
route-map V6_CONNECTED_ROUTES permit 10
match ipv6 address prefix-list V6_P2P_IP
call HIDE_INTERNAL
!
route-map HIDE_INTERNAL permit 10
set community no-export
!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ ip prefix-list PL_LoopbackV4 permit 10.1.0.32/32
ipv6 prefix-list PL_LoopbackV6 permit fc00:1::/64
!
!
ip prefix-list V4_P2P_IP permit 0.0.0.0/0 ge 31 le 31
!
ipv6 prefix-list V6_P2P_IP permit ::/0 ge 126 le 126
!
route-map V4_CONNECTED_ROUTES permit 10
match ip address prefix-list V4_P2P_IP
call HIDE_INTERNAL
!
route-map V6_CONNECTED_ROUTES permit 10
match ipv6 address prefix-list V6_P2P_IP
call HIDE_INTERNAL
!
route-map HIDE_INTERNAL permit 10
set community no-export
!
Expand Down Expand Up @@ -66,10 +78,10 @@ router bgp 65100
!
!
address-family ipv4
redistribute connected route-map HIDE_INTERNAL
redistribute connected route-map V4_CONNECTED_ROUTES
exit-address-family
address-family ipv6
redistribute connected route-map HIDE_INTERNAL
redistribute connected route-map V6_CONNECTED_ROUTES
exit-address-family
!
address-family ipv4
Expand Down

0 comments on commit f501311

Please sign in to comment.