diff --git a/tests/topotests/isis_lfa_topo1/rt1/step14/show_ipv6_route.ref.diff b/tests/topotests/isis_lfa_topo1/rt1/step14/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/topotests/isis_lfa_topo1/rt1/step15/show_ipv6_route.ref.diff b/tests/topotests/isis_lfa_topo1/rt1/step15/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..a00d2d3b62 --- /dev/null +++ b/tests/topotests/isis_lfa_topo1/rt1/step15/show_ipv6_route.ref.diff @@ -0,0 +1,50 @@ +--- a/rt1/step14/show_ipv6_route.ref ++++ b/rt1/step15/show_ipv6_route.ref +@@ -6,22 +6,12 @@ + "selected":true, + "destSelected":true, + "distance":115, +- "metric":20, ++ "metric":25, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", +- "interfaceName":"eth-rt2", +- "active":true, +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "afi":"ipv6", + "interfaceName":"eth-rt3", + "active":true + } +@@ -151,22 +141,12 @@ + "selected":true, + "destSelected":true, + "distance":115, +- "metric":25, ++ "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", +- "interfaceName":"eth-rt2", +- "active":true, +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "afi":"ipv6", + "interfaceName":"eth-rt6", + "active":true + } diff --git a/tests/topotests/isis_lfa_topo1/rt1/step16/show_ipv6_route.ref.diff b/tests/topotests/isis_lfa_topo1/rt1/step16/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..5e48511ba5 --- /dev/null +++ b/tests/topotests/isis_lfa_topo1/rt1/step16/show_ipv6_route.ref.diff @@ -0,0 +1,53 @@ +--- a/rt1/step15/show_ipv6_route.ref ++++ b/rt1/step16/show_ipv6_route.ref +@@ -32,16 +32,6 @@ + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt3", +- "active":true, +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "afi":"ipv6", +- "interfaceName":"eth-rt2", + "active":true + } + ] +@@ -90,16 +80,6 @@ + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5", +- "active":true, +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "afi":"ipv6", +- "interfaceName":"eth-rt2", + "active":true + } + ] +@@ -119,16 +99,6 @@ + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt6", +- "active":true, +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "afi":"ipv6", +- "interfaceName":"eth-rt2", + "active":true + } + ] diff --git a/tests/topotests/isis_lfa_topo1/test_isis_lfa_topo1.py b/tests/topotests/isis_lfa_topo1/test_isis_lfa_topo1.py index 7e902213e7..fe92c9a52c 100755 --- a/tests/topotests/isis_lfa_topo1/test_isis_lfa_topo1.py +++ b/tests/topotests/isis_lfa_topo1/test_isis_lfa_topo1.py @@ -128,7 +128,7 @@ def build_topo(tgen): files = ["show_ipv6_route.ref", "show_yang_interface_isis_adjacencies.ref"] for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6", "rt7"]: outputs[rname] = {} - for step in range(1, 13 + 1): + for step in range(1, 16 + 1): outputs[rname][step] = {} for file in files: if step == 1: @@ -186,7 +186,7 @@ def teardown_module(mod): tgen.stop_topology() -def router_compare_json_output(rname, command, reference): +def router_compare_json_output(rname, command, reference, wait=0.5, count=120): "Compare router JSON output" logger.info('Comparing router "%s" "%s" output', rname, command) @@ -196,7 +196,7 @@ def router_compare_json_output(rname, command, reference): # Run test function until we get an result. Wait at most 60 seconds. test_func = partial(topotest.router_json_cmp, tgen.gears[rname], command, expected) - _, diff = topotest.run_and_expect(test_func, None, count=120, wait=0.5) + _, diff = topotest.run_and_expect(test_func, None, count=count, wait=wait) assertmsg = '"{}" JSON output mismatches the expected result'.format(rname) assert diff is None, assertmsg @@ -616,6 +616,93 @@ def test_rib_ipv6_step13(): ) +# +# Step 14 +# +# Action(s): +# - Setting spf-delay-ietf init-delay of 15s +# +# Expected changes: +# - No routing table change +# - At the end of test, SPF reacts to a failure in 15s +# +def test_rib_ipv6_step14(): + logger.info("Test (step 14): verify IPv6 RIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + logger.info("Setting spf-delay-ietf init-delay of 15s") + tgen.net["rt1"].cmd( + 'vtysh -c "conf t" -c "router isis 1" -c "spf-delay-ietf init-delay 15000 short-delay 0 long-delay 0 holddown 0 time-to-learn 0"' + ) + + for rname in ["rt1"]: + router_compare_json_output( + rname, + "show ipv6 route isis json", + outputs[rname][14]["show_ipv6_route.ref"], + ) + + +# +# Step 15 +# +# Action(s): +# - shut the eth-rt2 interface on rt1 +# +# Expected changes: +# - Route switchover of routes via eth-rt2 +# +def test_rib_ipv6_step15(): + logger.info("Test (step 15): verify IPv6 RIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + logger.info("Shut the interface to rt2 from the switch side and check fast-reroute") + tgen.net.cmd_raises("ip link set %s down" % tgen.net["s1"].intfs[0]) + + for rname in ["rt1"]: + router_compare_json_output( + rname, + "show ipv6 route isis json", + outputs[rname][15]["show_ipv6_route.ref"], + count=2, + wait=0.05, + ) + + +# +# Step 16 +# +# Action(s): wait for the convergence and SPF computation on rt1 +# +# Expected changes: +# - convergence of IPv6 RIB +# +def test_rib_ipv6_step16(): + logger.info("Test (step 16): verify IPv6 RIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + logger.info("Check SPF convergence") + + for rname in ["rt1"]: + router_compare_json_output( + rname, + "show ipv6 route isis json", + outputs[rname][16]["show_ipv6_route.ref"], + ) + + # Memory leak test template def test_memory_leak(): "Run the memory leak test and report results."