mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-05 01:14:48 +00:00
topotests: add VRF leak tests in bgp_l3vpn_to_bgp_vrf
Check that route leaking between VRF within a router works properly. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
This commit is contained in:
parent
90bdefa094
commit
a1d9f6f2f2
@ -4,6 +4,8 @@ hostname ce1
|
||||
!
|
||||
interface lo
|
||||
ip address 99.0.0.1/32
|
||||
ip address 5.1.0.1/24
|
||||
ip address 6.0.2.1/24
|
||||
!
|
||||
interface ce1-eth0
|
||||
description to r1
|
||||
|
@ -4,6 +4,8 @@ hostname ce2
|
||||
!
|
||||
interface lo
|
||||
ip address 99.0.0.2/32
|
||||
ip address 5.1.0.1/24
|
||||
ip address 6.0.2.1/24
|
||||
!
|
||||
interface ce2-eth0
|
||||
description to r3
|
||||
|
@ -19,6 +19,7 @@ router bgp 5227
|
||||
network 5.1.3.0/24 route-map rm-nh
|
||||
network 6.0.1.0/24 route-map rm-nh
|
||||
network 6.0.2.0/24 route-map rm-nh-same
|
||||
network 6.0.3.0/24 route-map rm-nh-same
|
||||
neighbor 192.168.1.1 activate
|
||||
exit-address-family
|
||||
!
|
||||
|
@ -4,6 +4,7 @@ hostname ce3
|
||||
!
|
||||
interface lo
|
||||
ip address 99.0.0.3/32
|
||||
ip address 6.0.3.1/24
|
||||
!
|
||||
interface ce3-eth0
|
||||
description to r4
|
||||
|
@ -19,6 +19,7 @@ router bgp 5228 vrf ce4-cust2
|
||||
network 5.4.3.0/24 route-map rm-nh
|
||||
network 6.0.1.0/24 route-map rm-nh
|
||||
network 6.0.2.0/24 route-map rm-nh-same
|
||||
network 6.0.3.0/24 route-map rm-nh-same
|
||||
neighbor 192.168.2.1 activate
|
||||
exit-address-family
|
||||
!
|
||||
|
@ -4,6 +4,7 @@ hostname ce4
|
||||
!
|
||||
interface ce4-cust2
|
||||
ip address 99.0.0.4/32
|
||||
ip address 6.0.3.1/24
|
||||
!
|
||||
interface ce4-eth0
|
||||
description to r4
|
||||
|
@ -175,6 +175,20 @@ def ltemplatePreRouterStartHook():
|
||||
"setup {0} vrf {0}-cust1, {0}-eth4. enabled mpls input.".format(rtr)
|
||||
)
|
||||
# configure cust2 VRFs & MPLS
|
||||
rtrs = ["r1"]
|
||||
cmds = [
|
||||
"ip link add {0}-cust3 type vrf table 20",
|
||||
"ip link set dev {0}-cust3 up",
|
||||
"ip link add {0}-cust4 type vrf table 30",
|
||||
"ip link set dev {0}-cust4 up",
|
||||
"ip link add {0}-cust5 type vrf table 40",
|
||||
"ip link set dev {0}-cust5 up",
|
||||
]
|
||||
for rtr in rtrs:
|
||||
for cmd in cmds:
|
||||
cc.doCmd(tgen, rtr, cmd.format(rtr))
|
||||
logger.info("setup {0} vrf {0}-cust3 and{0}-cust4.".format(rtr))
|
||||
# configure cust2 VRFs & MPLS
|
||||
rtrs = ["r4"]
|
||||
cmds = [
|
||||
"ip link add {0}-cust2 type vrf table 20",
|
||||
|
@ -11,6 +11,7 @@ log file bgpd.log debugging
|
||||
#debug bgp vpn leak-from-vrf
|
||||
#debug bgp vpn label
|
||||
#debug bgp updates out
|
||||
#debug bgp nht
|
||||
|
||||
router bgp 5226
|
||||
bgp router-id 1.1.1.1
|
||||
@ -39,6 +40,11 @@ router bgp 5227 vrf r1-cust1
|
||||
neighbor 192.168.1.2 timers 3 10
|
||||
|
||||
address-family ipv4 unicast
|
||||
network 10.2.3.4/32
|
||||
network 192.0.0.0/24
|
||||
|
||||
redistribute connected
|
||||
|
||||
neighbor 192.168.1.2 activate
|
||||
neighbor 192.168.1.2 next-hop-self
|
||||
|
||||
@ -51,5 +57,47 @@ router bgp 5227 vrf r1-cust1
|
||||
exit-address-family
|
||||
|
||||
|
||||
router bgp 5228 vrf r1-cust3
|
||||
bgp router-id 192.168.1.1
|
||||
|
||||
address-family ipv4 unicast
|
||||
rd vpn export 10:13
|
||||
rt vpn import 52:100
|
||||
|
||||
import vpn
|
||||
export vpn
|
||||
exit-address-family
|
||||
|
||||
|
||||
router bgp 5227 vrf r1-cust4
|
||||
no bgp network import-check
|
||||
|
||||
bgp router-id 192.168.1.1
|
||||
|
||||
address-family ipv4 unicast
|
||||
network 28.0.0.0/24
|
||||
|
||||
rd vpn export 10:14
|
||||
rt vpn export 52:100
|
||||
|
||||
import vpn
|
||||
export vpn
|
||||
exit-address-family
|
||||
|
||||
|
||||
router bgp 5227 vrf r1-cust5
|
||||
bgp router-id 192.168.1.1
|
||||
|
||||
address-family ipv4 unicast
|
||||
redistribute connected
|
||||
|
||||
label vpn export 105
|
||||
rd vpn export 10:15
|
||||
rt vpn both 52:100
|
||||
|
||||
import vpn
|
||||
export vpn
|
||||
exit-address-family
|
||||
|
||||
!
|
||||
end
|
||||
|
6
tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/staticd.conf
Normal file
6
tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/staticd.conf
Normal file
@ -0,0 +1,6 @@
|
||||
hostname r1
|
||||
log file staticd.log
|
||||
!
|
||||
vrf r1-cust1
|
||||
ip route 192.0.0.0/24 192.168.1.2
|
||||
exit-vrf
|
@ -4,6 +4,9 @@ hostname r1
|
||||
password zebra
|
||||
|
||||
#debug zebra packet
|
||||
#debug zebra rib detailed
|
||||
#debug zebra dplane detailed
|
||||
#debug zebra nexthop detail
|
||||
|
||||
interface lo
|
||||
ip address 1.1.1.1/32
|
||||
@ -18,6 +21,14 @@ interface r1-eth4
|
||||
ip address 192.168.1.1/24
|
||||
no link-detect
|
||||
|
||||
interface r1-cust1
|
||||
ip address 10.4.5.6/24
|
||||
no link-detect
|
||||
|
||||
interface r1-cust5
|
||||
ip address 29.0.0.1/32
|
||||
no link-detect
|
||||
|
||||
ip forwarding
|
||||
|
||||
|
||||
|
@ -81,3 +81,24 @@ if ret != False and found != None:
|
||||
"wait",
|
||||
"CE3->CE4 (loopback) ping",
|
||||
)
|
||||
luCommand(
|
||||
"r1",
|
||||
"ip vrf exec r1-cust1 ping 6.0.3.1 -I 10.4.5.6 -c 1",
|
||||
" 0. packet loss",
|
||||
"wait",
|
||||
"R1(r1-cust1)->CE3/4 (loopback) ping",
|
||||
)
|
||||
luCommand(
|
||||
"r1",
|
||||
"ip vrf exec r1-cust1 ping 6.0.3.1 -I 10.4.5.6 -c 1",
|
||||
" 0. packet loss",
|
||||
"pass",
|
||||
"R1(r1-cust1)->CE3/4 (loopback) ping",
|
||||
)
|
||||
luCommand(
|
||||
"r1",
|
||||
"ip vrf exec r1-cust5 ping 6.0.3.1 -I 29.0.0.1 -c 1",
|
||||
" 0. packet loss",
|
||||
"pass",
|
||||
"R1(r1-cust5)->CE3/4 ( (loopback) ping",
|
||||
)
|
||||
|
@ -72,3 +72,46 @@ luCommand(
|
||||
"wait",
|
||||
"CE4->PE4 ping",
|
||||
)
|
||||
luCommand(
|
||||
"r1",
|
||||
"ip vrf exec r1-cust5 ping 192.168.1.1 -I 29.0.0.1 -c 1",
|
||||
" 0. packet loss",
|
||||
"pass",
|
||||
"R1(r1-cust5)->R1(r1-cust1 - r1-eth4) ping",
|
||||
)
|
||||
luCommand(
|
||||
"r1",
|
||||
"ip vrf exec r1-cust5 ping 192.168.1.2 -I 29.0.0.1 -c 1",
|
||||
" 0. packet loss",
|
||||
"wait",
|
||||
"R1(r1-cust5)->CE1 ping",
|
||||
)
|
||||
luCommand(
|
||||
"r1",
|
||||
"ip vrf exec r1-cust5 ping 192.168.1.2 -I 29.0.0.1 -c 1",
|
||||
" 0. packet loss",
|
||||
"pass",
|
||||
"R1(r1-cust5)->CE1 ping",
|
||||
)
|
||||
luCommand(
|
||||
"r1",
|
||||
"ip vrf exec r1-cust5 ping 99.0.0.1 -I 29.0.0.1 -c 1",
|
||||
" 0. packet loss",
|
||||
"pass",
|
||||
"R1(r1-cust5)->CE1 (loopback) ping",
|
||||
)
|
||||
luCommand(
|
||||
"r1",
|
||||
"ip vrf exec r1-cust5 ping 5.1.0.1 -I 29.0.0.1 -c 1",
|
||||
" 0. packet loss",
|
||||
"wait",
|
||||
"R1(r1-cust5)->CE1 (loopback) ping",
|
||||
time=30,
|
||||
)
|
||||
luCommand(
|
||||
"r1",
|
||||
"ip vrf exec r1-cust5 ping 5.1.0.1 -I 29.0.0.1 -c 1",
|
||||
" 0. packet loss",
|
||||
"pass",
|
||||
"R1(r1-cust5)->CE1 (loopback) ping",
|
||||
)
|
||||
|
@ -54,15 +54,44 @@ bgpribRequireUnicastRoutes("ce4", "ipv4", "ce4-cust2", "Cust 4 routes in ce1", w
|
||||
#
|
||||
# r1 vtysh -c "show bgp vrf r1-cust1 ipv4"
|
||||
#
|
||||
want_r1_cust1_routes = [
|
||||
want_r1_cust1_3_5_routes = [
|
||||
{"p": "5.1.0.0/24", "n": "99.0.0.1"},
|
||||
{"p": "5.1.1.0/24", "n": "99.0.0.1"},
|
||||
{"p": "6.0.1.0/24", "n": "99.0.0.1"},
|
||||
{"p": "6.0.2.0/24", "n": "99.0.0.1"},
|
||||
{"p": "10.2.3.4/32", "n": "0.0.0.0", "bp": False},
|
||||
{"p": "10.4.5.0/24", "n": "0.0.0.0", "bp": True},
|
||||
{"p": "28.0.0.0/24", "n": "0.0.0.0", "bp": True},
|
||||
{"p": "29.0.0.1/32", "n": "0.0.0.0", "bp": True},
|
||||
{"p": "99.0.0.1/32", "n": "192.168.1.2"},
|
||||
{"p": "192.0.0.0/24", "n": "0.0.0.0", "bp": True},
|
||||
{"p": "192.168.1.0/24", "n": "0.0.0.0", "bp": True},
|
||||
]
|
||||
bgpribRequireUnicastRoutes(
|
||||
"r1", "ipv4", "r1-cust1", "Customer 1 routes in r1 vrf", want_r1_cust1_routes
|
||||
"r1", "ipv4", "r1-cust1", "Customer 1 routes in r1 vrf", want_r1_cust1_3_5_routes
|
||||
)
|
||||
bgpribRequireUnicastRoutes(
|
||||
"r1", "ipv4", "r1-cust3", "Customer 3 routes in r1 vrf", want_r1_cust1_3_5_routes
|
||||
)
|
||||
bgpribRequireUnicastRoutes(
|
||||
"r1", "ipv4", "r1-cust5", "Customer 5 routes in r1 vrf", want_r1_cust1_3_5_routes
|
||||
)
|
||||
|
||||
want_r1_cust4_routes = [
|
||||
{"p": "5.1.0.0/24", "n": "99.0.0.1", "exist": False},
|
||||
{"p": "5.1.1.0/24", "n": "99.0.0.1", "exist": False},
|
||||
{"p": "6.0.1.0/24", "n": "99.0.0.1", "exist": False},
|
||||
{"p": "6.0.2.0/24", "n": "99.0.0.1", "exist": False},
|
||||
{"p": "10.2.3.4/32", "n": "0.0.0.0", "exist": False},
|
||||
{"p": "10.4.5.0/24", "n": "0.0.0.0", "exist": False},
|
||||
{"p": "28.0.0.0/24", "n": "0.0.0.0", "bp": True},
|
||||
{"p": "29.0.0.1/32", "n": "0.0.0.0", "exist": False},
|
||||
{"p": "99.0.0.1/32", "n": "192.168.1.2", "exist": False},
|
||||
{"p": "192.0.0.0/24", "n": "0.0.0.0", "exist": False},
|
||||
{"p": "192.168.1.0/24", "n": "0.0.0.0", "exist": False},
|
||||
]
|
||||
bgpribRequireUnicastRoutes(
|
||||
"r1", "ipv4", "r1-cust4", "Customer 4 routes in r1 vrf", want_r1_cust4_routes
|
||||
)
|
||||
|
||||
want_r3_cust1_routes = [
|
||||
@ -70,10 +99,20 @@ want_r3_cust1_routes = [
|
||||
{"p": "5.1.1.0/24", "n": "99.0.0.2"},
|
||||
{"p": "6.0.1.0/24", "n": "99.0.0.2"},
|
||||
{"p": "6.0.2.0/24", "n": "99.0.0.2"},
|
||||
{"p": "10.2.3.4/32", "n": "0.0.0.0", "exist": False},
|
||||
{"p": "28.0.0.0/24", "n": "1.1.1.1", "bp": True},
|
||||
{"p": "29.0.0.1/32", "n": "1.1.1.1", "bp": True},
|
||||
{"p": "99.0.0.2/32", "n": "192.168.1.2"},
|
||||
{"p": "192.0.0.0/24", "n": "1.1.1.1", "bp": True},
|
||||
{"p": "192.168.1.0/24", "n": "1.1.1.1", "bp": True},
|
||||
]
|
||||
bgpribRequireUnicastRoutes(
|
||||
"r3", "ipv4", "r3-cust1", "Customer 1 routes in r3 vrf", want_r3_cust1_routes
|
||||
"r3",
|
||||
"ipv4",
|
||||
"r3-cust1",
|
||||
"Customer 1 routes in r3 vrf",
|
||||
want_r3_cust1_routes,
|
||||
retry=30,
|
||||
)
|
||||
|
||||
want_r4_cust1_routes = [
|
||||
@ -81,10 +120,20 @@ want_r4_cust1_routes = [
|
||||
{"p": "5.1.3.0/24", "n": "99.0.0.3"},
|
||||
{"p": "6.0.1.0/24", "n": "99.0.0.3"},
|
||||
{"p": "6.0.2.0/24", "n": "99.0.0.3"},
|
||||
{"p": "10.2.3.4/32", "n": "0.0.0.0", "exist": False},
|
||||
{"p": "28.0.0.0/24", "n": "1.1.1.1", "bp": True},
|
||||
{"p": "29.0.0.1/32", "n": "1.1.1.1", "bp": True},
|
||||
{"p": "99.0.0.3/32", "n": "192.168.1.2"},
|
||||
{"p": "192.0.0.0/24", "n": "1.1.1.1", "bp": True},
|
||||
{"p": "192.168.1.0/24", "n": "1.1.1.1", "bp": True},
|
||||
]
|
||||
bgpribRequireUnicastRoutes(
|
||||
"r4", "ipv4", "r4-cust1", "Customer 1 routes in r4 vrf", want_r4_cust1_routes
|
||||
"r4",
|
||||
"ipv4",
|
||||
"r4-cust1",
|
||||
"Customer 1 routes in r4 vrf",
|
||||
want_r4_cust1_routes,
|
||||
retry=30,
|
||||
)
|
||||
|
||||
want_r4_cust2_routes = [
|
||||
@ -92,10 +141,20 @@ want_r4_cust2_routes = [
|
||||
{"p": "5.4.3.0/24", "n": "99.0.0.4"},
|
||||
{"p": "6.0.1.0/24", "n": "99.0.0.4"},
|
||||
{"p": "6.0.2.0/24", "n": "99.0.0.4"},
|
||||
{"p": "10.2.3.4/32", "n": "0.0.0.0", "exist": False},
|
||||
{"p": "28.0.0.0/24", "n": "1.1.1.1", "bp": True},
|
||||
{"p": "29.0.0.1/32", "n": "1.1.1.1", "bp": True},
|
||||
{"p": "99.0.0.4/32", "n": "192.168.2.2"},
|
||||
{"p": "192.0.0.0/24", "n": "1.1.1.1", "bp": True},
|
||||
{"p": "192.168.1.0/24", "n": "1.1.1.1", "bp": True},
|
||||
]
|
||||
bgpribRequireUnicastRoutes(
|
||||
"r4", "ipv4", "r4-cust2", "Customer 2 routes in r4 vrf", want_r4_cust2_routes
|
||||
"r4",
|
||||
"ipv4",
|
||||
"r4-cust2",
|
||||
"Customer 2 routes in r4 vrf",
|
||||
want_r4_cust2_routes,
|
||||
retry=30,
|
||||
)
|
||||
|
||||
########################################################################
|
||||
|
Loading…
Reference in New Issue
Block a user