[chassis][bgp] create v4 and v6 peer group for VoQ internal neighbors (#9693)

Why I did it
In the recent minigraph changes we add separate BGP session configuration for V4 and V6 internal VoQ neighbors.
This PR is adding different Peer groups for V4 and V6 neighbors

How I did it
Add VOQ_CHASSIS_V4_PEER and VOQ_CHASSIS_V6_PEER groups
Add extra Unit tests

How to verify it

Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
This commit is contained in:
arlakshm 2022-02-24 11:21:26 -08:00 committed by Judy Joseph
parent c6774ad683
commit b58a42a8d4
30 changed files with 330 additions and 32 deletions

View File

@ -4,7 +4,11 @@
bgp bestpath as-path multipath-relax bgp bestpath as-path multipath-relax
bgp bestpath peer-type multipath-relax bgp bestpath peer-type multipath-relax
! !
neighbor {{ neighbor_addr }} peer-group VOQ_CHASSIS_PEER {% if neighbor_addr | ipv4 %}
neighbor {{ neighbor_addr }} peer-group VOQ_CHASSIS_V4_PEER
{% elif neighbor_addr | ipv6 %}
neighbor {{ neighbor_addr }} peer-group VOQ_CHASSIS_V6_PEER
{% endif %}
neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }} neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }}
neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }} neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }}
neighbor {{ neighbor_addr }} timers 3 10 neighbor {{ neighbor_addr }} timers 3 10

View File

@ -1,22 +1,27 @@
! !
! template: bgpd/templates/voq_chassis/peer-group.conf.j2 ! template: bgpd/templates/voq_chassis/peer-group.conf.j2
! !
neighbor VOQ_CHASSIS_PEER peer-group neighbor VOQ_CHASSIS_V4_PEER peer-group
neighbor VOQ_CHASSIS_V6_PEER peer-group
address-family ipv4 address-family ipv4
{% if CONFIG_DB__DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} {% if CONFIG_DB__DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %}
neighbor VOQ_CHASSIS_PEER allowas-in 1 neighbor VOQ_CHASSIS_V4_PEER allowas-in 1
{% endif %} {% endif %}
neighbor VOQ_CHASSIS_PEER activate neighbor VOQ_CHASSIS_V4_PEER activate
neighbor VOQ_CHASSIS_PEER addpath-tx-all-paths neighbor VOQ_CHASSIS_V4_PEER addpath-tx-all-paths
neighbor VOQ_CHASSIS_PEER soft-reconfiguration inbound neighbor VOQ_CHASSIS_V4_PEER soft-reconfiguration inbound
neighbor VOQ_CHASSIS_V4_PEER route-map FROM_VOQ_CHASSIS_V4_PEER in
neighbor VOQ_CHASSIS_V4_PEER route-map TO_VOQ_CHASSIS_V4_PEER out
exit-address-family exit-address-family
address-family ipv6 address-family ipv6
{% if CONFIG_DB__DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} {% if CONFIG_DB__DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %}
neighbor VOQ_CHASSIS_PEER allowas-in 1 neighbor VOQ_CHASSIS_V6_PEER allowas-in 1
{% endif %} {% endif %}
neighbor VOQ_CHASSIS_PEER activate neighbor VOQ_CHASSIS_V6_PEER activate
neighbor VOQ_CHASSIS_PEER addpath-tx-all-paths neighbor VOQ_CHASSIS_V6_PEER addpath-tx-all-paths
neighbor VOQ_CHASSIS_PEER soft-reconfiguration inbound neighbor VOQ_CHASSIS_V6_PEER soft-reconfiguration inbound
neighbor VOQ_CHASSIS_V4_PEER route-map FROM_VOQ_CHASSIS_V6_PEER in
neighbor VOQ_CHASSIS_V4_PEER route-map TO_VOQ_CHASSIS_V6_PEER out
exit-address-family exit-address-family
! !
! end of template: bgpd/templates/voq_chassis/peer-group.conf.j2 ! end of template: bgpd/templates/voq_chassis/peer-group.conf.j2

View File

@ -1,7 +1,18 @@
! !
! template: bgpd/templates/voq_chassis/policies.conf.j2 ! template: bgpd/templates/voq_chassis/policies.conf.j2
! !
route-map FROM_VOQ_CHASSIS_V4_PEER permit 100
! !
route-map TO_VOQ_CHASSIS_V4_PEER permit 100
!
!
route-map FROM_VOQ_CHASSIS_V6_PEER permit 1
set ipv6 next-hop prefer-global
on-match next
!
route-map FROM_VOQ_CHASSIS_V6_PEER permit 100
!
route-map TO_VOQ_CHASSIS_V6_PEER permit 100
! !
! end of template: bgpd/templates/voq_chassis/policies.conf.j2 ! end of template: bgpd/templates/voq_chassis/policies.conf.j2
! !

View File

@ -0,0 +1,22 @@
{
"CONFIG_DB__DEVICE_METADATA": {
"localhost": {}
},
"neighbor_addr": "fc00::01",
"bgp_session": {
"asn": "555",
"name": "internal1",
"keepalive": "5",
"holdtime": "30",
"admin_status": "down"
},
"constants": {
"bgp": {
"maximum_paths": {
"enabled": "true",
"ipv4": "32",
"ipv6": "24"
}
}
}
}

View File

@ -0,0 +1,17 @@
{
"CONFIG_DB__DEVICE_METADATA": {
"localhost": {}
},
"neighbor_addr": "fc00::01",
"bgp_session": {
"asn": "555",
"name": "internal1"
},
"constants": {
"bgp": {
"maximum_paths": {
"enabled": "true"
}
}
}
}

View File

@ -0,0 +1,19 @@
{
"CONFIG_DB__DEVICE_METADATA": {
"localhost": {
"default_bgp_status": "down"
}
},
"neighbor_addr": "fc00::01",
"bgp_session": {
"asn": "555",
"name": "internal1"
},
"constants": {
"bgp": {
"maximum_paths": {
"enabled": "true"
}
}
}
}

View File

@ -0,0 +1,19 @@
{
"CONFIG_DB__DEVICE_METADATA": {
"localhost": {
"default_bgp_status": "up"
}
},
"neighbor_addr": "fc00::01",
"bgp_session": {
"asn": "555",
"name": "internal1"
},
"constants": {
"bgp": {
"maximum_paths": {
"enabled": "true"
}
}
}
}

View File

@ -0,0 +1,18 @@
{
"CONFIG_DB__DEVICE_METADATA": {
"localhost": {}
},
"neighbor_addr": "fc00::01",
"bgp_session": {
"asn": "555",
"name": "internal1",
"keepalive": "5"
},
"constants": {
"bgp": {
"maximum_paths": {
"enabled": "true"
}
}
}
}

View File

@ -0,0 +1,18 @@
{
"CONFIG_DB__DEVICE_METADATA": {
"localhost": {}
},
"neighbor_addr": "fc00::01",
"bgp_session": {
"asn": "555",
"name": "internal1",
"holdtime": "240"
},
"constants": {
"bgp": {
"maximum_paths": {
"enabled": "true"
}
}
}
}

View File

@ -4,12 +4,13 @@
bgp bestpath as-path multipath-relax bgp bestpath as-path multipath-relax
bgp bestpath peer-type multipath-relax bgp bestpath peer-type multipath-relax
! !
neighbor 10.10.10.10 peer-group VOQ_CHASSIS_PEER neighbor 10.10.10.10 peer-group VOQ_CHASSIS_V4_PEER
neighbor 10.10.10.10 remote-as 555 neighbor 10.10.10.10 remote-as 555
neighbor 10.10.10.10 description internal1 neighbor 10.10.10.10 description internal1
neighbor 10.10.10.10 timers 3 10 neighbor 10.10.10.10 timers 3 10
neighbor 10.10.10.10 timers connect 10 neighbor 10.10.10.10 timers connect 10
neighbor 10.10.10.10 shutdown neighbor 10.10.10.10 shutdown
!
address-family ipv4 address-family ipv4
maximum-paths ibgp 32 maximum-paths ibgp 32
! !

View File

@ -0,0 +1,25 @@
!
! template: bgpd/templates/voq_chassis/instance.conf.j2
!
bgp bestpath as-path multipath-relax
bgp bestpath peer-type multipath-relax
!
neighbor fc00::01 peer-group VOQ_CHASSIS_V6_PEER
neighbor fc00::01 remote-as 555
neighbor fc00::01 description internal1
neighbor fc00::01 timers 3 10
neighbor fc00::01 timers connect 10
neighbor fc00::01 shutdown
!
address-family ipv4
maximum-paths ibgp 32
!
exit-address-family
!
address-family ipv6
maximum-paths ibgp 24
!
exit-address-family
!
! end of template: bgpd/templates/voq_chassis/instance.conf.j2
!

View File

@ -4,7 +4,7 @@
bgp bestpath as-path multipath-relax bgp bestpath as-path multipath-relax
bgp bestpath peer-type multipath-relax bgp bestpath peer-type multipath-relax
! !
neighbor 10.10.10.10 peer-group VOQ_CHASSIS_PEER neighbor 10.10.10.10 peer-group VOQ_CHASSIS_V4_PEER
neighbor 10.10.10.10 remote-as 555 neighbor 10.10.10.10 remote-as 555
neighbor 10.10.10.10 description internal1 neighbor 10.10.10.10 description internal1
neighbor 10.10.10.10 timers 3 10 neighbor 10.10.10.10 timers 3 10

View File

@ -0,0 +1,23 @@
!
! template: bgpd/templates/voq_chassis/instance.conf.j2
!
bgp bestpath as-path multipath-relax
bgp bestpath peer-type multipath-relax
!
neighbor fc00::01 peer-group VOQ_CHASSIS_V6_PEER
neighbor fc00::01 remote-as 555
neighbor fc00::01 description internal1
neighbor fc00::01 timers 3 10
neighbor fc00::01 timers connect 10
address-family ipv4
maximum-paths ibgp 64
!
exit-address-family
!
address-family ipv6
maximum-paths ibgp 64
!
exit-address-family
!
! end of template: bgpd/templates/voq_chassis/instance.conf.j2
!

View File

@ -4,12 +4,13 @@
bgp bestpath as-path multipath-relax bgp bestpath as-path multipath-relax
bgp bestpath peer-type multipath-relax bgp bestpath peer-type multipath-relax
! !
neighbor 10.10.10.10 peer-group VOQ_CHASSIS_PEER neighbor 10.10.10.10 peer-group VOQ_CHASSIS_V4_PEER
neighbor 10.10.10.10 remote-as 555 neighbor 10.10.10.10 remote-as 555
neighbor 10.10.10.10 description internal1 neighbor 10.10.10.10 description internal1
neighbor 10.10.10.10 timers 3 10 neighbor 10.10.10.10 timers 3 10
neighbor 10.10.10.10 timers connect 10 neighbor 10.10.10.10 timers connect 10
neighbor 10.10.10.10 shutdown neighbor 10.10.10.10 shutdown
!
address-family ipv4 address-family ipv4
maximum-paths ibgp 64 maximum-paths ibgp 64
! !

View File

@ -4,7 +4,7 @@
bgp bestpath as-path multipath-relax bgp bestpath as-path multipath-relax
bgp bestpath peer-type multipath-relax bgp bestpath peer-type multipath-relax
! !
neighbor 10.10.10.10 peer-group VOQ_CHASSIS_PEER neighbor 10.10.10.10 peer-group VOQ_CHASSIS_V4_PEER
neighbor 10.10.10.10 remote-as 555 neighbor 10.10.10.10 remote-as 555
neighbor 10.10.10.10 description internal1 neighbor 10.10.10.10 description internal1
neighbor 10.10.10.10 timers 3 10 neighbor 10.10.10.10 timers 3 10

View File

@ -0,0 +1,25 @@
!
! template: bgpd/templates/voq_chassis/instance.conf.j2
!
bgp bestpath as-path multipath-relax
bgp bestpath peer-type multipath-relax
!
neighbor fc00::01 peer-group VOQ_CHASSIS_V6_PEER
neighbor fc00::01 remote-as 555
neighbor fc00::01 description internal1
neighbor fc00::01 timers 3 10
neighbor fc00::01 timers connect 10
neighbor fc00::01 shutdown
!
address-family ipv4
maximum-paths ibgp 64
!
exit-address-family
!
address-family ipv6
maximum-paths ibgp 64
!
exit-address-family
!
! end of template: bgpd/templates/voq_chassis/instance.conf.j2
!

View File

@ -0,0 +1,23 @@
!
! template: bgpd/templates/voq_chassis/instance.conf.j2
!
bgp bestpath as-path multipath-relax
bgp bestpath peer-type multipath-relax
!
neighbor fc00::01 peer-group VOQ_CHASSIS_V6_PEER
neighbor fc00::01 remote-as 555
neighbor fc00::01 description internal1
neighbor fc00::01 timers 3 10
neighbor fc00::01 timers connect 10
address-family ipv4
maximum-paths ibgp 64
!
exit-address-family
!
address-family ipv6
maximum-paths ibgp 64
!
exit-address-family
!
! end of template: bgpd/templates/voq_chassis/instance.conf.j2
!

View File

@ -4,7 +4,7 @@
bgp bestpath as-path multipath-relax bgp bestpath as-path multipath-relax
bgp bestpath peer-type multipath-relax bgp bestpath peer-type multipath-relax
! !
neighbor 10.10.10.10 peer-group VOQ_CHASSIS_PEER neighbor 10.10.10.10 peer-group VOQ_CHASSIS_V4_PEER
neighbor 10.10.10.10 remote-as 555 neighbor 10.10.10.10 remote-as 555
neighbor 10.10.10.10 description internal1 neighbor 10.10.10.10 description internal1
neighbor 10.10.10.10 timers 3 10 neighbor 10.10.10.10 timers 3 10

View File

@ -4,7 +4,7 @@
bgp bestpath as-path multipath-relax bgp bestpath as-path multipath-relax
bgp bestpath peer-type multipath-relax bgp bestpath peer-type multipath-relax
! !
neighbor 10.10.10.10 peer-group VOQ_CHASSIS_PEER neighbor 10.10.10.10 peer-group VOQ_CHASSIS_V4_PEER
neighbor 10.10.10.10 remote-as 555 neighbor 10.10.10.10 remote-as 555
neighbor 10.10.10.10 description internal1 neighbor 10.10.10.10 description internal1
neighbor 10.10.10.10 timers 3 10 neighbor 10.10.10.10 timers 3 10

View File

@ -0,0 +1,23 @@
!
! template: bgpd/templates/voq_chassis/instance.conf.j2
!
bgp bestpath as-path multipath-relax
bgp bestpath peer-type multipath-relax
!
neighbor fc00::01 peer-group VOQ_CHASSIS_V6_PEER
neighbor fc00::01 remote-as 555
neighbor fc00::01 description internal1
neighbor fc00::01 timers 3 10
neighbor fc00::01 timers connect 10
address-family ipv4
maximum-paths ibgp 64
!
exit-address-family
!
address-family ipv6
maximum-paths ibgp 64
!
exit-address-family
!
! end of template: bgpd/templates/voq_chassis/instance.conf.j2
!

View File

@ -0,0 +1,23 @@
!
! template: bgpd/templates/voq_chassis/instance.conf.j2
!
bgp bestpath as-path multipath-relax
bgp bestpath peer-type multipath-relax
!
neighbor fc00::01 peer-group VOQ_CHASSIS_V6_PEER
neighbor fc00::01 remote-as 555
neighbor fc00::01 description internal1
neighbor fc00::01 timers 3 10
neighbor fc00::01 timers connect 10
address-family ipv4
maximum-paths ibgp 64
!
exit-address-family
!
address-family ipv6
maximum-paths ibgp 64
!
exit-address-family
!
! end of template: bgpd/templates/voq_chassis/instance.conf.j2
!

View File

@ -1,18 +1,23 @@
! !
! template: bgpd/templates/voq_chassis/peer-group.conf.j2 ! template: bgpd/templates/voq_chassis/peer-group.conf.j2
! !
neighbor VOQ_CHASSIS_PEER peer-group neighbor VOQ_CHASSIS_V4_PEER peer-group
neighbor VOQ_CHASSIS_V6_PEER peer-group
address-family ipv4 address-family ipv4
neighbor VOQ_CHASSIS_PEER allowas-in 1 neighbor VOQ_CHASSIS_V4_PEER allowas-in 1
neighbor VOQ_CHASSIS_PEER activate neighbor VOQ_CHASSIS_V4_PEER activate
neighbor VOQ_CHASSIS_PEER addpath-tx-all-paths neighbor VOQ_CHASSIS_V4_PEER addpath-tx-all-paths
neighbor VOQ_CHASSIS_PEER soft-reconfiguration inbound neighbor VOQ_CHASSIS_V4_PEER soft-reconfiguration inbound
neighbor VOQ_CHASSIS_V4_PEER route-map FROM_VOQ_CHASSIS_V4_PEER in
neighbor VOQ_CHASSIS_V4_PEER route-map TO_VOQ_CHASSIS_V4_PEER out
exit-address-family exit-address-family
address-family ipv6 address-family ipv6
neighbor VOQ_CHASSIS_PEER allowas-in 1 neighbor VOQ_CHASSIS_V6_PEER allowas-in 1
neighbor VOQ_CHASSIS_PEER activate neighbor VOQ_CHASSIS_V6_PEER activate
neighbor VOQ_CHASSIS_PEER addpath-tx-all-paths neighbor VOQ_CHASSIS_V6_PEER addpath-tx-all-paths
neighbor VOQ_CHASSIS_PEER soft-reconfiguration inbound neighbor VOQ_CHASSIS_V6_PEER soft-reconfiguration inbound
neighbor VOQ_CHASSIS_V4_PEER route-map FROM_VOQ_CHASSIS_V6_PEER in
neighbor VOQ_CHASSIS_V4_PEER route-map TO_VOQ_CHASSIS_V6_PEER out
exit-address-family exit-address-family
! !
! end of template: bgpd/templates/voq_chassis/peer-group.conf.j2 ! end of template: bgpd/templates/voq_chassis/peer-group.conf.j2

View File

@ -1,16 +1,21 @@
! !
! template: bgpd/templates/voq_chassis/peer-group.conf.j2 ! template: bgpd/templates/voq_chassis/peer-group.conf.j2
! !
neighbor VOQ_CHASSIS_PEER peer-group neighbor VOQ_CHASSIS_V4_PEER peer-group
neighbor VOQ_CHASSIS_V6_PEER peer-group
address-family ipv4 address-family ipv4
neighbor VOQ_CHASSIS_PEER activate neighbor VOQ_CHASSIS_V4_PEER activate
neighbor VOQ_CHASSIS_PEER addpath-tx-all-paths neighbor VOQ_CHASSIS_V4_PEER addpath-tx-all-paths
neighbor VOQ_CHASSIS_PEER soft-reconfiguration inbound neighbor VOQ_CHASSIS_V4_PEER soft-reconfiguration inbound
neighbor VOQ_CHASSIS_V4_PEER route-map FROM_VOQ_CHASSIS_V4_PEER in
neighbor VOQ_CHASSIS_V4_PEER route-map TO_VOQ_CHASSIS_V4_PEER out
exit-address-family exit-address-family
address-family ipv6 address-family ipv6
neighbor VOQ_CHASSIS_PEER activate neighbor VOQ_CHASSIS_V6_PEER activate
neighbor VOQ_CHASSIS_PEER addpath-tx-all-paths neighbor VOQ_CHASSIS_V6_PEER addpath-tx-all-paths
neighbor VOQ_CHASSIS_PEER soft-reconfiguration inbound neighbor VOQ_CHASSIS_V6_PEER soft-reconfiguration inbound
neighbor VOQ_CHASSIS_V4_PEER route-map FROM_VOQ_CHASSIS_V6_PEER in
neighbor VOQ_CHASSIS_V4_PEER route-map TO_VOQ_CHASSIS_V6_PEER out
exit-address-family exit-address-family
! !
! end of template: bgpd/templates/voq_chassis/peer-group.conf.j2 ! end of template: bgpd/templates/voq_chassis/peer-group.conf.j2

View File

@ -1,7 +1,18 @@
! !
! template: bgpd/templates/voq_chassis/policies.conf.j2 ! template: bgpd/templates/voq_chassis/policies.conf.j2
! !
route-map FROM_VOQ_CHASSIS_V4_PEER permit 100
! !
route-map TO_VOQ_CHASSIS_V4_PEER permit 100
!
!
route-map FROM_VOQ_CHASSIS_V6_PEER permit 1
set ipv6 next-hop prefer-global
on-match next
!
route-map FROM_VOQ_CHASSIS_V6_PEER permit 100
!
route-map TO_VOQ_CHASSIS_V6_PEER permit 100
! !
! end of template: bgpd/templates/voq_chassis/policies.conf.j2 ! end of template: bgpd/templates/voq_chassis/policies.conf.j2
! !