From: Louis Scalbert Date: Fri, 20 May 2022 09:37:27 +0000 (+0200) Subject: topotests: isis-lfa add a switchover test after hello timeout X-Git-Tag: base_8.4~257^2~2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=c99ef489629ffa057b312756771693e417309995;p=matthieu%2Ffrr.git topotests: isis-lfa add a switchover test after hello timeout 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 --- 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 fe92c9a52c..3a1d0b9514 100755 --- a/tests/topotests/isis_lfa_topo1/test_isis_lfa_topo1.py +++ b/tests/topotests/isis_lfa_topo1/test_isis_lfa_topo1.py @@ -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."