Skip to content

Commit

Permalink
topotests: add bgp_nhg_topo2 test to check for bgp nhg cases
Browse files Browse the repository at this point in the history
When not used by default, bgp nexthop group are not tested
against the following route entry added:
- route entry resolved over default route
- route entry resolved over itself
- route entry resolved over blackhole route
- route entry connected (case mplsvpn)
- route entry using ipv4 mapped ipv6 address

This test suite covers the above use cases.

Signed-off-by: Philippe Guibert <[email protected]>
  • Loading branch information
pguibert6WIND committed May 17, 2024
1 parent 5ae269c commit ec14152
Show file tree
Hide file tree
Showing 16 changed files with 851 additions and 0 deletions.
Empty file.
141 changes: 141 additions & 0 deletions tests/topotests/bgp_nhg_topo2/r1/bgp_ipv4.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
{
"vrfId": 0,
"routerId": "192.0.2.1",
"defaultLocPrf": 100,
"localAS": 65500,
"routes": {
"0.0.0.0/0": [
{
"valid": true,
"bestpath": true,
"pathFrom": "external",
"prefix":"0.0.0.0",
"prefixLen": 0,
"network": "0.0.0.0/0",
"metric": 0,
"weight": 0,
"peerId": "172.31.0.2",
"path": "65501",
"origin": "IGP",
"nexthops": [
{
"ip": "172.31.0.2",
"afi": "ipv4",
"used": true
}
]
}
],
"172.31.1.0/24": [
{
"valid": true,
"bestpath": true,
"pathFrom": "external",
"prefix": "172.31.1.0",
"prefixLen": 24,
"network": "172.31.1.0/24",
"metric": 0,
"weight": 0,
"peerId": "172.31.0.2",
"path": "65501",
"origin": "IGP",
"nexthops": [
{
"ip": "172.31.0.2",
"afi": "ipv4",
"used": true
}
]
}
],
"192.168.1.0/24": [
{
"valid": true,
"bestpath": true,
"prefix": "192.168.1.0",
"prefixLen": 24,
"network": "192.168.1.0/24",
"metric": 0,
"locPrf": 100,
"weight": 0,
"peerId": "172.31.0.3",
"path": "",
"origin": "IGP",
"nexthops": [
{
"ip": "172.31.2.4",
"afi": "ipv4",
"used": true
}
]
}
],
"192.168.2.0/24": [
{
"valid": true,
"bestpath": true,
"pathFrom": "internal",
"prefix": "192.168.2.0",
"prefixLen": 24,
"network": "192.168.2.0/24",
"metric": 0,
"locPrf": 100,
"weight": 0,
"peerId": "172.31.0.3",
"path": "",
"origin": "IGP",
"nexthops": [
{
"ip":"172.31.3.4",
"afi": "ipv4",
"used": true
}
]
}
],
"192.168.3.0/24": [
{
"valid": true,
"bestpath": true,
"pathFrom": "internal",
"prefix": "192.168.3.0",
"prefixLen": 24,
"network": "192.168.3.0/24",
"metric": 0,
"locPrf": 100,
"weight": 0,
"peerId": "172.31.0.3",
"path": "",
"origin": "IGP",
"nexthops": [
{
"ip": "192.168.3.3",
"afi": "ipv4",
"used": true
}
]
}
],
"192.168.4.0/24": [
{
"valid": true,
"bestpath": true,
"prefix": "192.168.4.0",
"prefixLen": 24,
"network": "192.168.4.0/24",
"metric": 0,
"weight": 32768,
"path": "",
"announceNexthopSelf": true,
"nhVrfName": "vrf1",
"nexthops": [
{
"ip": "0.0.0.0",
"afi": "ipv4",
"used": true
}
]
}
]
}
}
42 changes: 42 additions & 0 deletions tests/topotests/bgp_nhg_topo2/r1/bgpd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
bgp nexthop-group
route-map rmap_ipv6 permit 1
set ipv6 next-hop prefer-global
exit
router bgp 65500
bgp router-id 192.0.2.1
no bgp ebgp-requires-policy
bgp labeled-unicast ipv4-explicit-null
neighbor 172.31.0.2 remote-as 65501
neighbor 172.31.0.3 remote-as 65500
neighbor 172.31.0.4 remote-as 65500
neighbor 192.0.2.4 remote-as 65500
neighbor 192.0.2.4 update-source lo
neighbor 192.0.2.4 capability extended-nexthop
neighbor 192.0.2.4 timers connect 1
address-family ipv4 unicast
import vrf vrf1
import vpn
no neighbor 192.0.2.4 activate
no neighbor 172.31.0.4 activate
network 192.0.2.1/32
exit-address-family
!
address-family ipv4 labeled-unicast
neighbor 172.31.0.4 activate
exit-address-family
!
address-family ipv6 unicast
neighbor 192.0.2.4 activate
neighbor 192.0.2.4 route-map rmap_ipv6 in
exit-address-family
!
exit
router bgp 65500 vrf vrf1
address-family ipv4 unicast
redistribute connected
export vpn
exit-address-family
!
exit


37 changes: 37 additions & 0 deletions tests/topotests/bgp_nhg_topo2/r1/ip_route_192_168_1_0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"192.168.1.0/24":[
{
"prefix":"192.168.1.0/24",
"prefixLen":24,
"protocol":"bgp",
"vrfId":0,
"vrfName":"default",
"selected":true,
"destSelected":true,
"distance":200,
"metric":0,
"installed":true,
"table":254,
"internalNextHopNum":2,
"internalNextHopActiveNum":2,
"nexthops":[
{
"ip":"172.31.2.4",
"afi":"ipv4",
"active":true,
"recursive":true,
"weight":1
},
{
"fib":true,
"ip":"172.31.0.2",
"afi":"ipv4",
"interfaceName":"r1-eth0",
"resolver":true,
"active":true,
"weight":1
}
]
}
]
}
34 changes: 34 additions & 0 deletions tests/topotests/bgp_nhg_topo2/r1/ip_route_192_168_2_0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"192.168.2.0/24":[
{
"prefix":"192.168.2.0/24",
"prefixLen":24,
"protocol":"bgp",
"vrfId":0,
"vrfName":"default",
"selected":true,
"destSelected":true,
"distance":200,
"metric":0,
"installed":true,
"table":254,
"nexthops":[
{
"ip":"172.31.3.4",
"afi":"ipv4",
"active":true,
"recursive":true,
"weight":1
},
{
"fib":true,
"unreachable":true,
"blackhole":true,
"resolver":true,
"active":true,
"weight":1
}
]
}
]
}
44 changes: 44 additions & 0 deletions tests/topotests/bgp_nhg_topo2/r1/ip_route_192_168_3_0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"192.168.3.0/24":[
{
"prefix":"192.168.3.0/24",
"prefixLen":24,
"protocol":"bgp",
"vrfId":0,
"vrfName":"default",
"distance":200,
"metric":0,
"table":254,
"nexthops":[
{
"ip":"192.168.3.3",
"afi":"ipv4",
"weight":1
}
]
},
{
"prefix":"192.168.3.0/24",
"prefixLen":24,
"protocol":"static",
"vrfId":0,
"vrfName":"default",
"selected":true,
"destSelected":true,
"distance":1,
"metric":0,
"installed":true,
"table":254,
"nexthops":[
{
"fib":true,
"ip":"192.168.5.10",
"afi":"ipv4",
"interfaceName":"r1-eth2",
"active":true,
"weight":1
}
]
}
]
}
24 changes: 24 additions & 0 deletions tests/topotests/bgp_nhg_topo2/r1/ip_route_192_168_4_0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"192.168.4.0/24":[
{
"prefix":"192.168.4.0/24",
"prefixLen":24,
"protocol":"bgp",
"vrfName":"default",
"selected":true,
"destSelected":true,
"distance":20,
"metric":0,
"installed":true,
"table":254,
"nexthops":[
{
"fib":true,
"directlyConnected":true,
"interfaceName":"vrf1",
"active":true
}
]
}
]
}
33 changes: 33 additions & 0 deletions tests/topotests/bgp_nhg_topo2/r1/ipv6_route_1001_64.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"1001::/64":[
{
"prefix":"1001::/64",
"prefixLen":64,
"protocol":"bgp",
"vrfId":0,
"vrfName":"default",
"selected":true,
"destSelected":true,
"distance":200,
"metric":0,
"table":254,
"nexthops":[
{
"ip":"::ffff:c000:204",
"afi":"ipv6",
"active":true,
"recursive":true,
"weight":1
},
{
"ip":"172.31.0.4",
"afi":"ipv4",
"interfaceName":"r1-eth0",
"resolver":true,
"active":true,
"weight":1
}
]
}
]
}
20 changes: 20 additions & 0 deletions tests/topotests/bgp_nhg_topo2/r1/zebra.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
ip route 172.31.3.4/32 blackhole
ip route 192.168.3.0/24 192.168.5.10
ipv6 route 1010::/64 1003::10
interface r1-eth0
ip address 172.31.0.1/24
ipv6 address ::ffff:172.31.0.1/24
!
interface r1-eth1
ip address 192.168.0.1/24
!
interface r1-eth2
ip address 192.168.5.1/24
ipv6 address 1003::1/64
!
interface r1-eth3 vrf vrf1
ip address 192.168.4.1/24
!
interface lo
ip address 192.0.2.1/32
!
10 changes: 10 additions & 0 deletions tests/topotests/bgp_nhg_topo2/r2/bgpd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
router bgp 65501
bgp router-id 192.0.2.2
no bgp ebgp-requires-policy
neighbor 172.31.0.1 remote-as 65500
address-family ipv4 unicast
neighbor 172.31.0.1 activate
neighbor 172.31.0.1 default-originate
network 172.31.1.0/24
exit-address-family
!
Loading

0 comments on commit ec14152

Please sign in to comment.