]> git.puffer.fish Git - matthieu/frr.git/commitdiff
topotests: isis-lfa add a switchover test after hello timeout
authorLouis Scalbert <louis.scalbert@6wind.com>
Fri, 20 May 2022 09:37:27 +0000 (11:37 +0200)
committerLouis Scalbert <louis.scalbert@6wind.com>
Tue, 24 May 2022 08:06:05 +0000 (10:06 +0200)
Add a switchover test that consists in:
- Setting no link-detect on rt1 eth-rt2 so that zebra does not take
  account linkdown events on this interface.
- Shutting down rt1 eth-rt2 from the switch side
- Wait for the hello timer expiration

Check that the switchover between primary and backup happens before the
SPF re-computation.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
tests/topotests/isis_lfa_topo1/test_isis_lfa_topo1.py

index fe92c9a52cc0558a4825e4302be1e64c03f00339..3a1d0b951485a1a9b39a7f9949b2915d897a49be 100755 (executable)
@@ -55,6 +55,7 @@ import os
 import sys
 import pytest
 import json
+import time
 import tempfile
 from functools import partial
 
@@ -703,6 +704,116 @@ def test_rib_ipv6_step16():
         )
 
 
+#
+# Step 17
+#
+# 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_step17():
+    logger.info("Test (step 17): 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(
+        "Unshut the interface to rt2 from the switch side and check fast-reroute"
+    )
+    tgen.net.cmd_raises("ip link set %s up" % tgen.net["s1"].intfs[0])
+
+    logger.info("Unset link-detect on rt1 eth-rt2")
+    # Unset link detection. We want zebra to consider linkdow as operationaly up
+    # in order that BFD triggers LFA instead of the interface down
+    tgen.net["rt1"].cmd('vtysh -c "conf t" -c "int eth-rt2" -c "no link-detect"')
+
+    for rname in ["rt1"]:
+        router_compare_json_output(
+            rname,
+            "show ipv6 route isis json",
+            outputs[rname][14]["show_ipv6_route.ref"],
+        )
+
+
+#
+# Step 18
+#
+# Action(s):
+# - shut the eth-rt2 interface on rt1
+#
+# Expected changes:
+# - Route switchover of routes via eth-rt2
+#
+def test_rib_ipv6_step18():
+    logger.info("Test (step 18): 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])
+
+    rname = "rt1"
+
+    retry = 200 + 1
+
+    while retry:
+        retry -= 1
+        output = tgen.gears[rname].vtysh_cmd("show isis neighbor json")
+        output_json = json.loads(output)
+        found = False
+        for neighbor in output_json["areas"][0]["circuits"]:
+            if "adj" in neighbor and neighbor["adj"] == "rt2":
+                found = True
+                break
+        if not found:
+            break
+        time.sleep(0.05)
+
+    assert not found, "rt2 neighbor is still present"
+
+    router_compare_json_output(
+        rname,
+        "show ipv6 route isis json",
+        outputs[rname][15]["show_ipv6_route.ref"],
+        count=2,
+        wait=0.05,
+    )
+
+
+#
+# Step 19
+#
+# Action(s): wait for the convergence and SPF computation on rt1
+#
+# Expected changes:
+# - convergence of IPv6 RIB
+#
+def test_rib_ipv6_step19():
+    logger.info("Test (step 19): 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."