Updated BGP Template for Chassis/Multi-asic (#9291)

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
This commit is contained in:
abdosi 2021-12-06 09:36:24 -08:00 committed by Abhishek Dosi
parent 6bffcb9e71
commit e34c2e4a22
11 changed files with 152 additions and 24 deletions

View File

@ -34,6 +34,18 @@ ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq {{ loop.index * 5 }} permit {{ prefi
{% set multi_asic = True %} {% set multi_asic = True %}
{% endif %} {% 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 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 route-map HIDE_INTERNAL permit 10
set community no-export 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 %} {% if constants.bgp.peers is defined and constants.bgp.peers.internal is defined and constants.bgp.peers.internal.community is defined %}
@ -71,7 +83,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
! !
{# advertise loopback #} {# advertise loopback #}
network {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}/32 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 network {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }}/32 route-map HIDE_INTERNAL
{% endif %} {% endif %}
! !
@ -80,7 +92,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
network {{ get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}/64 network {{ get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}/64
exit-address-family exit-address-family
{% endif %} {% 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' %} {% if get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") != 'None' %}
address-family ipv6 address-family ipv6
network {{ get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }}/128 route-map HIDE_INTERNAL network {{ get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }}/128 route-map HIDE_INTERNAL
@ -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' %} {% 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 address-family ipv4
redistribute connected route-map HIDE_INTERNAL redistribute connected route-map V4_CONNECTED_ROUTES
exit-address-family exit-address-family
address-family ipv6 address-family ipv6
redistribute connected route-map HIDE_INTERNAL redistribute connected route-map V6_CONNECTED_ROUTES
exit-address-family exit-address-family
{% endif %} {% endif %}
! !

View File

@ -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 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 route-map HIDE_INTERNAL permit 10
set community no-export set community no-export
on-match next on-match next
@ -71,10 +83,10 @@ router bgp 55555
exit-address-family exit-address-family
! !
address-family ipv4 address-family ipv4
redistribute connected route-map HIDE_INTERNAL redistribute connected route-map V4_CONNECTED_ROUTES
exit-address-family exit-address-family
address-family ipv6 address-family ipv6
redistribute connected route-map HIDE_INTERNAL redistribute connected route-map V6_CONNECTED_ROUTES
exit-address-family exit-address-family
! !
address-family ipv4 address-family ipv4

View File

@ -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 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 route-map HIDE_INTERNAL permit 10
set community no-export set community no-export
! !
@ -50,10 +62,10 @@ router bgp 55555
exit-address-family exit-address-family
! !
address-family ipv4 address-family ipv4
redistribute connected route-map HIDE_INTERNAL redistribute connected route-map V4_CONNECTED_ROUTES
exit-address-family exit-address-family
address-family ipv6 address-family ipv6
redistribute connected route-map HIDE_INTERNAL redistribute connected route-map V6_CONNECTED_ROUTES
exit-address-family exit-address-family
! !
address-family ipv4 address-family ipv4

View File

@ -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 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 route-map HIDE_INTERNAL permit 10
set community no-export set community no-export
! !
@ -50,10 +62,10 @@ router bgp 55555
exit-address-family exit-address-family
! !
address-family ipv4 address-family ipv4
redistribute connected route-map HIDE_INTERNAL redistribute connected route-map V4_CONNECTED_ROUTES
exit-address-family exit-address-family
address-family ipv6 address-family ipv6
redistribute connected route-map HIDE_INTERNAL redistribute connected route-map V6_CONNECTED_ROUTES
exit-address-family exit-address-family
! !
address-family ipv4 address-family ipv4

View File

@ -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 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 route-map HIDE_INTERNAL permit 10
set community no-export set community no-export
! !
@ -35,14 +47,10 @@ router bgp 55555
bgp router-id 55.55.55.56 bgp router-id 55.55.55.56
! !
network 55.55.55.55/32 network 55.55.55.55/32
network 55.55.55.56/32 route-map HIDE_INTERNAL
! !
address-family ipv6 address-family ipv6
network fc00::1/64 network fc00::1/64
exit-address-family exit-address-family
address-family ipv6
network fc00::2/128 route-map HIDE_INTERNAL
exit-address-family
! !
network 10.10.10.1/24 network 10.10.10.1/24
address-family ipv6 address-family ipv6
@ -50,10 +58,10 @@ router bgp 55555
exit-address-family exit-address-family
! !
address-family ipv4 address-family ipv4
redistribute connected route-map HIDE_INTERNAL redistribute connected route-map V4_CONNECTED_ROUTES
exit-address-family exit-address-family
address-family ipv6 address-family ipv6
redistribute connected route-map HIDE_INTERNAL redistribute connected route-map V6_CONNECTED_ROUTES
exit-address-family exit-address-family
! !
address-family ipv4 address-family ipv4

View File

@ -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 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 route-map HIDE_INTERNAL permit 10
set community no-export set community no-export
! !
@ -50,10 +62,10 @@ router bgp 55555
exit-address-family exit-address-family
! !
address-family ipv4 address-family ipv4
redistribute connected route-map HIDE_INTERNAL redistribute connected route-map V4_CONNECTED_ROUTES
exit-address-family exit-address-family
address-family ipv6 address-family ipv6
redistribute connected route-map HIDE_INTERNAL redistribute connected route-map V6_CONNECTED_ROUTES
exit-address-family exit-address-family
! !
address-family ipv4 address-family ipv4

View File

@ -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 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 route-map HIDE_INTERNAL permit 10
set community no-export set community no-export
! !
@ -86,10 +98,10 @@ router bgp 55555
exit-address-family exit-address-family
! !
address-family ipv4 address-family ipv4
redistribute connected route-map HIDE_INTERNAL redistribute connected route-map V4_CONNECTED_ROUTES
exit-address-family exit-address-family
address-family ipv6 address-family ipv6
redistribute connected route-map HIDE_INTERNAL redistribute connected route-map V6_CONNECTED_ROUTES
exit-address-family exit-address-family
! !
address-family ipv4 address-family ipv4

View File

@ -34,6 +34,18 @@ ip prefix-list PL_LoopbackV4 permit 10.1.0.32/32
ipv6 prefix-list PL_LoopbackV6 permit fc00:1::/64 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 route-map HIDE_INTERNAL permit 10
set community no-export set community no-export
! !

View File

@ -34,6 +34,18 @@ ip prefix-list PL_LoopbackV4 permit 10.1.0.32/32
ipv6 prefix-list PL_LoopbackV6 permit fc00:1::/64 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 route-map HIDE_INTERNAL permit 10
set community no-export set community no-export
! !
@ -66,10 +78,10 @@ router bgp 65100
! !
! !
address-family ipv4 address-family ipv4
redistribute connected route-map HIDE_INTERNAL redistribute connected route-map V4_CONNECTED_ROUTES
exit-address-family exit-address-family
address-family ipv6 address-family ipv6
redistribute connected route-map HIDE_INTERNAL redistribute connected route-map V6_CONNECTED_ROUTES
exit-address-family exit-address-family
! !
address-family ipv4 address-family ipv4

View File

@ -34,6 +34,18 @@ ip prefix-list PL_LoopbackV4 permit 10.1.0.32/32
ipv6 prefix-list PL_LoopbackV6 permit fc00:1::/64 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 route-map HIDE_INTERNAL permit 10
set community no-export set community no-export
! !

View File

@ -34,6 +34,18 @@ ip prefix-list PL_LoopbackV4 permit 10.1.0.32/32
ipv6 prefix-list PL_LoopbackV6 permit fc00:1::/64 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 route-map HIDE_INTERNAL permit 10
set community no-export set community no-export
! !
@ -66,10 +78,10 @@ router bgp 65100
! !
! !
address-family ipv4 address-family ipv4
redistribute connected route-map HIDE_INTERNAL redistribute connected route-map V4_CONNECTED_ROUTES
exit-address-family exit-address-family
address-family ipv6 address-family ipv6
redistribute connected route-map HIDE_INTERNAL redistribute connected route-map V6_CONNECTED_ROUTES
exit-address-family exit-address-family
! !
address-family ipv4 address-family ipv4