Skip to content

Commit

Permalink
topotests: add bgp mpls allocation per next-hop test
Browse files Browse the repository at this point in the history
A new test suite checks for the mpls label allocation
per nexthop mode. This test checks that:
- The labels are correctly allocated per connected
next-hop.
- The default label is used for non connected prefixes
- The withdraw operation frees the mpls entry.
- If a recursive route is redistributed by BGP, then the nexthop
tracking will find the appropriate nexthop entry, and the associated
label will be found out.
- When a prefix moves from one peer to one another behind the vrf,
then the MPLS switching operation for return traffic is changing
the outgoing interface to use.
- When the 'label vpn export <value>' MPLS label value is changed,
then the modification is propagated to prefixes which use that value.
- When unconfiguring the per-nexthop allocation mode, check
that the MPLS entries and the VPNv4 entries of r1 are changed
accordingly.
- Reversely, when re-configuring the per-nexthop allocation mode,
check that the allocation mode reuses the other label values.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
  • Loading branch information
pguibert6WIND committed Mar 22, 2023
1 parent 084b317 commit 3596a77
Show file tree
Hide file tree
Showing 18 changed files with 1,351 additions and 0 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
{
"vrfName": "vrf1",
"localAS": 65500,
"routes":
{
"10.200.0.0/24": [
{
"valid": true,
"bestpath": true,
"prefix": "10.200.0.0",
"prefixLen": 24,
"network": "10.200.0.0\/24",
"nexthops": [
{
"ip": "192.168.0.2",
"afi": "ipv4",
"used": true
}
]
}

],
"172.31.0.11/32": [
{
"valid":true,
"bestpath":true,
"prefix":"172.31.0.11",
"prefixLen":32,
"network":"172.31.0.11/32",
"peerId":"192.0.2.100",
"nexthops":[
{
"ip":"192.0.2.11",
"afi":"ipv4",
"used":true
}
]
}
],
"172.31.0.12/32": [
{
"valid":true,
"bestpath":true,
"prefix":"172.31.0.12",
"prefixLen":32,
"network":"172.31.0.12/32",
"peerId":"192.0.2.100",
"nexthops":[
{
"ip":"192.0.2.12",
"afi":"ipv4",
"used":true
}
]
}
],
"172.31.0.13/32": [
{
"valid":true,
"bestpath":true,
"prefix":"172.31.0.13",
"prefixLen":32,
"network":"172.31.0.13/32",
"peerId":"192.168.255.13",
"nexthops":[
{
"ip":"192.168.255.13",
"afi":"ipv4",
"used":true
}
]
}
],
"172.31.0.14/32": [
{
"valid":true,
"bestpath":true,
"prefix":"172.31.0.14",
"prefixLen":32,
"network":"172.31.0.14/32",
"peerId":"(unspec)",
"nexthops":[
{
"ip":"192.0.2.14",
"afi":"ipv4",
"used":true
}
]
}
],
"172.31.0.15/32": [
{
"valid":true,
"bestpath":true,
"prefix":"172.31.0.15",
"prefixLen":32,
"network":"172.31.0.15/32",
"peerId":"(unspec)",
"nexthops":[
{
"ip":"192.0.2.12",
"afi":"ipv4",
"used":true
}
]
}
],
"172.31.0.20/32": [
{
"valid":true,
"bestpath":true,
"prefix":"172.31.0.20",
"prefixLen":32,
"network":"172.31.0.20/32",
"peerId":"192.0.2.100",
"nexthops":[
{
"ip":"192.0.2.11",
"afi":"ipv4",
"used":true
}
]
}
],
"172.31.0.111/32": [
{
"valid":true,
"bestpath":true,
"prefix":"172.31.0.111",
"prefixLen":32,
"network":"172.31.0.111/32",
"peerId":"192.0.2.100",
"nexthops":[
{
"ip":"192.0.2.11",
"afi":"ipv4",
"used":true
}
]
}
]
}
}
30 changes: 30 additions & 0 deletions tests/topotests/bgp_vpnv4_per_nexthop_label/r1/bgpd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
router bgp 65500
bgp router-id 192.168.0.1
no bgp ebgp-requires-policy
neighbor 192.168.0.2 remote-as 65501
address-family ipv4 unicast
no neighbor 192.168.0.2 activate
exit-address-family
address-family ipv4 vpn
neighbor 192.168.0.2 activate
neighbor 192.168.0.2 soft-reconfiguration inbound
exit-address-family
!
router bgp 65500 vrf vrf1
bgp router-id 192.168.0.1
neighbor 192.0.2.100 remote-as 65500
neighbor 192.168.255.13 remote-as 65500
address-family ipv4 unicast
redistribute connected
redistribute static
label vpn export allocation-mode per-nexthop
label vpn export auto
rd vpn export 444:1
rt vpn both 52:100
export vpn
import vpn
exit-address-family
!
interface r1-eth0
mpls bgp forwarding
!
50 changes: 50 additions & 0 deletions tests/topotests/bgp_vpnv4_per_nexthop_label/r1/ipv4_routes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"10.200.0.0/24": [
{
"prefix": "10.200.0.0/24",
"prefixLen": 24,
"protocol": "bgp",
"vrfName": "vrf1",
"selected": true,
"destSelected": true,
"distance": 20,
"metric": 0,
"nexthops": [
{
"flags": 3,
"fib": true,
"ip": "10.125.0.2",
"afi": "ipv4",
"interfaceName": "r1-eth0",
"vrf": "default",
"active": true,
"labels":[
102
]
}
]
}
],
"10.201.0.0/24": [
{
"prefix": "10.201.0.0/24",
"prefixLen": 24,
"protocol": "connected",
"vrfName": "vrf1",
"selected": true,
"destSelected": true,
"distance": 0,
"metric": 0,
"installed": true,
"nexthops":[
{
"flags": 3,
"fib": true,
"directlyConnected": true,
"interfaceName": "r1-eth1",
"active": true
}
]
}
]
}
18 changes: 18 additions & 0 deletions tests/topotests/bgp_vpnv4_per_nexthop_label/r1/zebra.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
log stdout
debug zebra nht
!debug zebra kernel msgdump recv
!debug zebra dplane detailed
!debug zebra packet recv
interface r1-eth1 vrf vrf1
ip address 192.0.2.1/24
!
interface r1-eth2 vrf vrf1
ip address 192.168.255.1/24
!
interface r1-eth0
ip address 192.168.0.1/24
!
vrf vrf1
ip route 172.31.0.14/32 192.0.2.14
ip route 172.31.0.15/32 192.0.2.12
exit-vrf
11 changes: 11 additions & 0 deletions tests/topotests/bgp_vpnv4_per_nexthop_label/r11/bgpd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
router bgp 65500
bgp router-id 192.0.2.11
no bgp network import-check
neighbor 192.0.2.100 remote-as 65500
address-family ipv4 unicast
network 172.31.0.11/32
network 172.31.0.111/32
network 172.31.0.20/32
exit-address-family
!

4 changes: 4 additions & 0 deletions tests/topotests/bgp_vpnv4_per_nexthop_label/r11/zebra.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
log stdout
interface r11-eth0
ip address 192.0.2.11/24
!
9 changes: 9 additions & 0 deletions tests/topotests/bgp_vpnv4_per_nexthop_label/r12/bgpd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
router bgp 65500
bgp router-id 192.0.2.12
no bgp network import-check
neighbor 192.0.2.100 remote-as 65500
address-family ipv4 unicast
network 172.31.0.12/32
exit-address-family
!

4 changes: 4 additions & 0 deletions tests/topotests/bgp_vpnv4_per_nexthop_label/r12/zebra.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
log stdout
interface r12-eth0
ip address 192.0.2.12/24
!
9 changes: 9 additions & 0 deletions tests/topotests/bgp_vpnv4_per_nexthop_label/r13/bgpd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
router bgp 65500
bgp router-id 192.168.255.13
no bgp network import-check
address-family ipv4 unicast
neighbor 192.168.255.1 remote-as 65500
network 172.31.0.13/32
exit-address-family
!

4 changes: 4 additions & 0 deletions tests/topotests/bgp_vpnv4_per_nexthop_label/r13/zebra.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
log stdout
interface r13-eth0
ip address 192.168.255.13/24
!
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"vrfName": "vrf1",
"localAS": 65501,
"routes":
{
"10.201.0.0/24": [
{
"prefix": "10.201.0.0",
"prefixLen": 24,
"network": "10.201.0.0\/24",
"nhVrfName": "default",
"nexthops": [
{
"ip": "192.168.0.1",
"afi": "ipv4",
"used": true
}
]
}
],
"10.200.0.0/24": [
{
"valid": true,
"bestpath": true,
"prefix": "10.200.0.0",
"prefixLen": 24,
"network": "10.200.0.0\/24",
"nexthops": [
{
"ip": "0.0.0.0",
"afi": "ipv4",
"used": true
}
]
}
]
}
}
Loading

0 comments on commit 3596a77

Please sign in to comment.