[multiasic][voq][bgpconf] Fix for the issue of same BGP router id in all asics (#8049)

For multiasic, the back end asics use ip addresss of Loopback4096 for BGP router id. In VOQ multi-asic chassis there are no back end asics. All the asics are front end and the iBGP connections are established via Ethernet-IB of asics. Since these asics are not designated as BackEnd, the ip address of interface Loopback0 is used as BGP router id. Since the ip address of Loopback0 is same for all the asics in the line card, same router id is used for voq iBGP configurations and hence the iBGP connections are not established. Changes are done to fix this
This commit is contained in:
vganesan-nokia 2021-07-26 15:54:52 -04:00 committed by GitHub
parent d78382b47c
commit f9231723f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 114 additions and 5 deletions

View File

@ -31,6 +31,9 @@ ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq {{ loop.index * 5 }} permit {{ prefi
{% endfor %}
!
{% if DEVICE_METADATA['localhost']['sub_role'] == 'FrontEnd' or DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %}
{% set multi_asic = True %}
{% endif %}
{% if multi_asic is defined or DEVICE_METADATA['localhost']['switch_type'] == 'voq' %}
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 %}
@ -38,7 +41,6 @@ route-map HIDE_INTERNAL permit 10
route-map HIDE_INTERNAL permit 20
set community {{ constants.bgp.peers.internal.community }} additive
{% endif %}
{% set multi_asic = True %}
!
{% endif %}
!
@ -61,7 +63,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
{% endif %}
!
{# set router-id #}
{% if DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %}
{% if DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' or DEVICE_METADATA['localhost']['switch_type'] == 'voq' %}
bgp router-id {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }}
{% else %}
bgp router-id {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}
@ -69,7 +71,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 %}
{% if multi_asic is defined or DEVICE_METADATA['localhost']['switch_type'] == 'voq' %}
network {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }}/32 route-map HIDE_INTERNAL
{% endif %}
!
@ -78,7 +80,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 %}
{% if multi_asic is defined 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
@ -100,7 +102,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
{% endblock vlan_advertisement %}
!
!
{% if DEVICE_METADATA['localhost']['sub_role'] == 'FrontEnd' %}
{% if DEVICE_METADATA['localhost']['sub_role'] == 'FrontEnd' or DEVICE_METADATA['localhost']['switch_type'] == 'voq' %}
address-family ipv4
redistribute connected route-map HIDE_INTERNAL
exit-address-family

View File

@ -0,0 +1,66 @@
!
! template: bgpd/bgpd.main.conf.j2
!
! bgp multiple-instance
!
! BGP configuration
!
! TSA configuration
!
ip prefix-list PL_LoopbackV4 permit 55.55.55.55/32
!
ipv6 prefix-list PL_LoopbackV6 permit fc00::/64
!
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
!
route-map HIDE_INTERNAL permit 10
set community no-export
!
!
router bgp 55555
!
bgp log-neighbor-changes
no bgp default ipv4-unicast
no bgp ebgp-requires-policy
!
bgp bestpath as-path multipath-relax
!
bgp graceful-restart restart-time 240
bgp graceful-restart
bgp graceful-restart preserve-fw-state
!
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
exit-address-family
address-family ipv6
redistribute connected route-map HIDE_INTERNAL
exit-address-family
!
address-family ipv4
maximum-paths 64
exit-address-family
address-family ipv6
maximum-paths 64
exit-address-family
!
! end of template: bgpd/bgpd.main.conf.j2
!

View File

@ -0,0 +1,35 @@
{
"DEVICE_METADATA": {
"localhost": {
"bgp_asn": "55555",
"sub_role": "",
"switch_type": "voq"
}
},
"LOOPBACK_INTERFACE": {
"Loopback0|55.55.55.55/32": {},
"Loopback0|fc00::1/128": {},
"Loopback4096|55.55.55.56/32": {},
"Loopback4096|fc00::2/128": {}
},
"VLAN_INTERFACE": {
"Vlan10|10.10.10.1/24": {},
"Vlan10|fc01::1/64": {},
"Vlan20": {"vnet_name": "Vnet1"},
"Vlan20|20.20.20.1/24": {},
"Vlan20|fd01::1/64": {}
},
"constants": {
"bgp": {
"multipath_relax": {
"enabled": true
},
"graceful_restart": {
"enabled": true
},
"maximum_paths": {
"enabled": true
}
}
}
}

View File

@ -45,6 +45,12 @@ def test_bgpd_main_conf_defaults():
"bgpd.main.conf.j2/defaults.json",
"bgpd.main.conf.j2/defaults.conf")
def test_bgpd_main_conf_voq_chassis():
run_test("VOQ bgpd.main.conf.j2",
"bgpd/bgpd.main.conf.j2",
"bgpd.main.conf.j2/voq_chassis.json",
"bgpd.main.conf.j2/voq_chassis.conf")
def test_tsa_isolate():
run_test("tsa/bgpd.tsa.isolate.conf.j2",
"bgpd/tsa/bgpd.tsa.isolate.conf.j2",