import sys
import pytest
import json
-import time
import tempfile
from functools import partial
)
-#
-# 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."