]> git.puffer.fish Git - mirror/frr.git/commitdiff
tests: Modify topotests to include write-multiplier config 8725/head
authorPat Ruddy <pat@voltanet.io>
Tue, 25 May 2021 09:39:03 +0000 (10:39 +0100)
committerPat Ruddy <pat@voltanet.io>
Fri, 18 Jun 2021 08:40:42 +0000 (09:40 +0100)
Modify both the default and vrf ospf6 topologies to include a test
where write-multiplier is configured to a non-default value and
the ospf6 neighbors are reset then checked.
Run black on both test files.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
tests/topotests/ospf6_topo1/test_ospf6_topo1.py
tests/topotests/ospf6_topo1_vrf/test_ospf6_topo1_vrf.py

index f8c3476e18ff37cc5a235a473e9ad2e33c56d194..bbd18a57ff4adb6d12b77339007735cbf78abd13 100644 (file)
@@ -360,6 +360,36 @@ def test_linux_ipv6_kernel_routingTable():
             )
 
 
+def test_ospfv3_routingTable_write_multiplier():
+
+    tgen = get_topogen()
+    if tgen.routers_have_failure():
+        pytest.skip("skipped because of router(s) failure")
+
+    # For debugging, uncomment the next line
+    # tgen.mininet_cli()
+
+    # Modify R1 write muliplier and reset the interfaces
+    r1 = tgen.gears["r1"]
+
+    r1.vtysh_cmd("conf t\nrouter ospf6\n write-multiplier 100")
+    r1.vtysh_cmd("clear ipv6 ospf interface r1-stubnet")
+    r1.vtysh_cmd("clear ipv6 ospf interface r1-sw5")
+
+    # Verify OSPFv3 Routing Table
+    for router, rnode in tgen.routers().items():
+        logger.info('Waiting for router "%s" convergence', router)
+
+        # Load expected results from the command
+        reffile = os.path.join(CWD, "{}/show_ipv6_route.ref".format(router))
+        expected = open(reffile).read()
+
+        # Run test function until we get an result. Wait at most 60 seconds.
+        test_func = partial(compare_show_ipv6, router, expected)
+        result, diff = topotest.run_and_expect(test_func, "", count=120, wait=0.5)
+        assert result, "OSPFv3 did not converge on {}:\n{}".format(router, diff)
+
+
 def test_shutdown_check_stderr():
 
     tgen = get_topogen()
index e1857abc4f509da49371c7e9d102bc9dd8ab44be..b158099d9a7373073394e4c482294c89c26576ba 100755 (executable)
@@ -5,7 +5,7 @@
 # Part of NetDEF Topology Tests
 #
 # Copyright (c) 2021 by Niral Networks, Inc. ("Niral Networks")
-# Used Copyright (c) 2016 by Network Device Education Foundation, 
+# Used Copyright (c) 2016 by Network Device Education Foundation,
 # Inc. ("NetDEF") in this file.
 #
 # Permission to use, copy, modify, and/or distribute this software
@@ -179,13 +179,9 @@ def setup_module(mod):
         "ip link set {0}-stubnet master {0}-cust1",
     ]
 
-    cmds1 = [
-        "ip link set {0}-sw5 master {0}-cust1",
-    ]
+    cmds1 = ["ip link set {0}-sw5 master {0}-cust1"]
 
-    cmds2 = [
-        "ip link set {0}-sw6 master {0}-cust1",
-    ]
+    cmds2 = ["ip link set {0}-sw6 master {0}-cust1"]
 
     # For all registered routers, load the zebra configuration file
     for rname, router in tgen.routers().items():
@@ -219,6 +215,7 @@ def teardown_module(mod):
     tgen = get_topogen()
     tgen.stop_topology()
 
+
 def test_wait_protocol_convergence():
     "Wait for OSPFv3 to converge"
     tgen = get_topogen()
@@ -261,7 +258,7 @@ def compare_show_ipv6_vrf(rname, expected):
     # Use the vtysh output, with some masking to make comparison easy
     vrf_name = "{0}-cust1".format(rname)
     current = topotest.ip6_route_zebra(tgen.gears[rname], vrf_name)
-    
+
     # Use just the 'O'spf lines of the output
     linearr = []
     for line in current.splitlines():
@@ -331,7 +328,11 @@ def test_linux_ipv6_kernel_routingTable():
 
     for i in range(1, 5):
         # Actual output from router
-        actual = tgen.gears["r{}".format(i)].run("ip -6 route show vrf r{}-cust1".format(i)).rstrip()
+        actual = (
+            tgen.gears["r{}".format(i)]
+            .run("ip -6 route show vrf r{}-cust1".format(i))
+            .rstrip()
+        )
         if "nhid" in actual:
             refTableFile = os.path.join(CWD, "r{}/ip_6_address.nhg.ref".format(i))
         else:
@@ -362,9 +363,9 @@ def test_linux_ipv6_kernel_routingTable():
                     "unreachable fe80::/64 "
                 ):
                     continue
-                if 'anycast' in line:
+                if "anycast" in line:
                     continue
-                if 'multicast' in line:
+                if "multicast" in line:
                     continue
                 filtered_lines.append(line)
             actual = "\n".join(filtered_lines).splitlines(1)
@@ -398,6 +399,35 @@ def test_linux_ipv6_kernel_routingTable():
             )
 
 
+def test_ospfv3_routingTable_write_multiplier():
+
+    tgen = get_topogen()
+    if tgen.routers_have_failure():
+        pytest.skip("skipped because of router(s) failure")
+
+    # For debugging, uncomment the next line
+    # tgen.mininet_cli()
+    # Modify R1 write muliplier and reset the interfaces
+    r1 = tgen.gears["r1"]
+
+    r1.vtysh_cmd("conf t\nrouter ospf6 vrf r1-cust1 \n write-multiplier 100")
+    r1.vtysh_cmd("clear ipv6 ospf interface r1-stubnet")
+    r1.vtysh_cmd("clear ipv6 ospf interface r1-sw5")
+
+    # Verify OSPFv3 Routing Table
+    for router, rnode in tgen.routers().iteritems():
+        logger.info('Waiting for router "%s" convergence', router)
+
+        # Load expected results from the command
+        reffile = os.path.join(CWD, "{}/show_ipv6_vrf_route.ref".format(router))
+        expected = open(reffile).read()
+
+        # Run test function until we get an result. Wait at most 60 seconds.
+        test_func = partial(compare_show_ipv6_vrf, router, expected)
+        result, diff = topotest.run_and_expect(test_func, "", count=120, wait=0.5)
+        assert result, "OSPFv3 did not converge on {}:\n{}".format(router, diff)
+
+
 def test_shutdown_check_stderr():
 
     tgen = get_topogen()