]> git.puffer.fish Git - matthieu/frr.git/commitdiff
tests: simplify nhrp_redundancy convergence
authorLouis Scalbert <louis.scalbert@6wind.com>
Fri, 30 Aug 2024 12:14:17 +0000 (14:14 +0200)
committerLouis Scalbert <louis.scalbert@6wind.com>
Fri, 30 Aug 2024 12:59:22 +0000 (14:59 +0200)
Simplify nhrp_redundancy convergence code. Cosmetic change.

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

index e6f0bc7dba7fb26910c6a92b5f3243807b6e578f..891a3cb8c37fc1623000fc0c7a2d63ca8ac99d25 100644 (file)
@@ -195,16 +195,15 @@ def test_protocols_convergence():
     if tgen.routers_have_failure():
         pytest.skip(tgen.errors)
 
-    logger.info("Checking NHRP cache and IPv4 routes for convergence")
+    logger.info("Checking NHRP cache for convergence")
     router_list = tgen.routers()
 
     # Check NHRP cache on servers and clients
-    for _, router in router_list.items():
-        json_file = "{}/{}/nhrp_cache.json".format(CWD, router.name)
-        if not os.path.isfile(json_file):
-            logger.info("skipping file {}".format(json_file))
+    for rname, router in router_list.items():
+        if 'nh' not in rname:
             continue
 
+        json_file = "{}/{}/nhrp_cache.json".format(CWD, router.name)
         expected = json.loads(open(json_file).read())
         test_func = partial(
             topotest.router_json_cmp, router, "show ip nhrp cache json", expected
@@ -218,12 +217,12 @@ def test_protocols_convergence():
         assert result is None, assertmsg
 
     # Check NHRP IPV4 routes on servers and clients
+    logger.info("Checking IPv4 routes for convergence")
     for rname, router in router_list.items():
-        json_file = "{}/{}/nhrp_route.json".format(CWD, router.name)
-        if not os.path.isfile(json_file):
-            logger.info("skipping file {}".format(json_file))
+        if 'nh' not in rname:
             continue
 
+        json_file = "{}/{}/nhrp_route.json".format(CWD, router.name)
         expected = json.loads(open(json_file).read())
         test_func = partial(
             topotest.router_json_cmp, router, "show ip route nhrp json", expected