]> git.puffer.fish Git - mirror/frr.git/commitdiff
tests: pbr topotest verifying vrf functionality 6532/head
authorWesley Coakley <wcoakley@cumulusnetworks.com>
Mon, 8 Jun 2020 17:39:04 +0000 (13:39 -0400)
committerWesley Coakley <wcoakley@cumulusnetworks.com>
Mon, 8 Jun 2020 18:27:29 +0000 (14:27 -0400)
Creates a VRF in the kernel and tests areas of pbrd not covered before

Signed-off-by: Wesley Coakley <wcoakley@cumulusnetworks.com>
tests/topotests/pbr-topo1/r1/pbr-map.json
tests/topotests/pbr-topo1/r1/pbr-nexthop-groups.json
tests/topotests/pbr-topo1/r1/pbrd.conf
tests/topotests/pbr-topo1/r1/zebra.conf
tests/topotests/pbr-topo1/test_pbr_topo1.py

index c0a40afc7c52d2b2c86f7e4118de4ac2e92d511b..f0738dc5408ddac46996dfac936a01758afb85fd 100644 (file)
         },
         "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"
       }
     ]
   },
index 2402293865450b3dc8c7816fa97407622a949f46..540ea281582b40697d219906d312ef8c4b6f3001 100644 (file)
     "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
       }
     ]
index b73d678e8eb8879638d8132420c4ed0d6e7ee749..4a126151b09291898c9f5155f1bbf212c598876f 100644 (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
index b9c6dc1bb21495440a4b8b7a81e2d0ecee26a701..2ec947c275f3b21c44c50fd1cdc7fd749bc5bbd3 100644 (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
index d0c3d3d8f4d8d10c2458ae7822637e19fd395da5..aedc9ca3fc950e82e455909ebaf4f4ba5531d70a 100755 (executable)
@@ -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)