tests: pbr topotest verifying vrf functionality

Creates a VRF in the kernel and tests areas of pbrd not covered before

Signed-off-by: Wesley Coakley <wcoakley@cumulusnetworks.com>
This commit is contained in:
Wesley Coakley 2020-06-08 13:39:04 -04:00
parent b046dc8716
commit 11e33e0075
5 changed files with 30 additions and 7 deletions

View File

@ -81,6 +81,14 @@
},
"matchSrc":"1.2.0.0\/16",
"matchDst":"3.4.5.0\/24"
},
{
"sequenceNumber":10,
"vrfUnchanged":true,
"installed":false,
"installedReason":"Valid",
"matchSrc":"1.2.0.0\/16",
"matchDst":"3.4.5.0\/24"
}
]
},

View File

@ -55,14 +55,17 @@
"nexthops":[
{
"nexthop":"192.168.4.3",
"targetVrf":"vrf-chiyoda",
"valid":true
},
{
"nexthop":"192.168.4.2",
"targetVrf":"vrf-chiyoda",
"valid":true
},
{
"nexthop":"192.168.4.1",
"targetVrf":"vrf-chiyoda",
"valid":true
}
]

View File

@ -18,9 +18,9 @@ nexthop-group B
nexthop 192.168.50.1
!
nexthop-group C
nexthop 192.168.4.1
nexthop 192.168.4.2
nexthop 192.168.4.3
nexthop 192.168.4.1 nexthop-vrf vrf-chiyoda
nexthop 192.168.4.2 nexthop-vrf vrf-chiyoda
nexthop 192.168.4.3 nexthop-vrf vrf-chiyoda
!
nexthop-group D
nexthop c0ff:ee::1
@ -40,7 +40,13 @@ pbr-map DONNA seq 5
match src-ip 1.2.0.0/16
set nexthop-group B
!
pbr-map DONNA seq 10
match dst-ip 3.4.5.0/24
match src-ip 1.2.0.0/16
set vrf unchanged
!
pbr-map AKIHABARA seq 5
no set vrf unchanged
match dst-ip 192.168.4.0/24
set nexthop-group C
!
@ -50,6 +56,7 @@ pbr-map AKIHABARA seq 10
set nexthop-group C
!
pbr-map AKIHABARA seq 15
set vrf noexist-vrf
match dst-ip 192.168.4.0/24
set nexthop-group C
no set nexthop-group C

View File

@ -7,7 +7,7 @@ int r1-eth1
int r1-eth2
ip address 192.168.3.1/24
interface r1-eth3
int r1-eth3 vrf vrf-chiyoda
ip address 192.168.4.1/24
int r1-eth4

View File

@ -86,6 +86,11 @@ def setup_module(module):
router_list = tgen.routers()
for rname, router in router_list.iteritems():
# Install vrf into the kernel and slave eth3
router.run("ip link add vrf-chiyoda type vrf table 1000")
router.run("ip link set dev {}-eth3 master vrf-chiyoda".format(rname))
router.run("ip link set vrf-chiyoda up")
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
@ -179,13 +184,13 @@ def test_pbr_flap():
for router in router_list:
# Flap interface to see if route-map properties are intact
# Shutdown interface
dut = "r1"
for i in range(5):
intf = "r1-eth{}".format(i)
# Down and back again
shutdown_bringup_interface(tgen, dut, intf, False)
shutdown_bringup_interface(tgen, dut, intf, True)
shutdown_bringup_interface(tgen, router.name, intf, False)
shutdown_bringup_interface(tgen, router.name, intf, True)
intf_file = "{}/{}/pbr-interface.json".format(CWD, router.name)
logger.info(intf_file)