]> git.puffer.fish Git - matthieu/frr.git/commitdiff
tests: rename router variables in nhrp_redundancy
authorLouis Scalbert <louis.scalbert@6wind.com>
Fri, 30 Aug 2024 09:23:42 +0000 (11:23 +0200)
committerLouis Scalbert <louis.scalbert@6wind.com>
Fri, 30 Aug 2024 14:24:00 +0000 (16:24 +0200)
Rename router variables in nhrp_redundancy to match the actual name.
Cosmetic change to help debugging.

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

index c0d7312102d84a2db6b02c9c26169fe64a9b1cb8..606df0e133bf30713bb0ca95cade307aa38b234c 100644 (file)
@@ -240,9 +240,9 @@ def test_protocols_convergence():
         assert result is None, assertmsg
 
     # Test connectivity from 1 NHRP server to all clients
-    pingrouter = tgen.gears["nhs1"]
+    nhs1 = tgen.gears["nhs1"]
     logger.info("Check Ping IPv4 from  nhs1 to nhc1 = 176.16.1.4)")
-    output = pingrouter.run("ping 176.16.1.4 -f -c 1000")
+    output = nhs1.run("ping 176.16.1.4 -f -c 1000")
     logger.info(output)
     if "1000 packets transmitted, 1000 received" not in output:
         assertmsg = "expected ping IPv4 from nhs1 to nhc1 should be ok"
@@ -251,7 +251,7 @@ def test_protocols_convergence():
         logger.info("Check Ping IPv4 from nhs1 to nhc1 OK")
 
     logger.info("Check Ping IPv4 from  nhs1 to nhc2 = 176.16.1.5)")
-    output = pingrouter.run("ping 176.16.1.5 -f -c 1000")
+    output = nhs1.run("ping 176.16.1.5 -f -c 1000")
     logger.info(output)
     if "1000 packets transmitted, 1000 received" not in output:
         assertmsg = "expected ping IPv4 from nhs1 to nhc2 should be ok"
@@ -260,9 +260,9 @@ def test_protocols_convergence():
         logger.info("Check Ping IPv4 from nhs1 to nhc2 OK")
 
     # Test connectivity from 1 NHRP client to all servers
-    pingrouter = tgen.gears["nhc1"]
+    nhc1 = tgen.gears["nhc1"]
     logger.info("Check Ping IPv4 from  nhc1 to nhs1 = 176.16.1.1)")
-    output = pingrouter.run("ping 176.16.1.1 -f -c 1000")
+    output = nhc1.run("ping 176.16.1.1 -f -c 1000")
     logger.info(output)
     if "1000 packets transmitted, 1000 received" not in output:
         assertmsg = "expected ping IPv4 from nhc1 to nhs1 should be ok"
@@ -271,7 +271,7 @@ def test_protocols_convergence():
         logger.info("Check Ping IPv4 from nhc1 to nhs1 OK")
 
     logger.info("Check Ping IPv4 from  nhc1 to nhs2 = 176.16.1.2)")
-    output = pingrouter.run("ping 176.16.1.2 -f -c 1000")
+    output = nhc1.run("ping 176.16.1.2 -f -c 1000")
     logger.info(output)
     if "1000 packets transmitted, 1000 received" not in output:
         assertmsg = "expected ping IPv4 from nhc1 to nhs2 should be ok"
@@ -280,7 +280,7 @@ def test_protocols_convergence():
         logger.info("Check Ping IPv4 from nhc1 to nhs2 OK")
 
     logger.info("Check Ping IPv4 from  nhc1 to nhs3 = 176.16.1.3)")
-    output = pingrouter.run("ping 176.16.1.3 -f -c 1000")
+    output = nhc1.run("ping 176.16.1.3 -f -c 1000")
     logger.info(output)
     if "1000 packets transmitted, 1000 received" not in output:
         assertmsg = "expected ping IPv4 from nhc1 to nhs3 should be ok"
@@ -295,10 +295,10 @@ def verify_shortcut_path():
     Verifying that traffic flows through shortcut path
     """
     tgen = get_topogen()
-    pingrouter = tgen.gears["host"]
+    host = tgen.gears["host"]
     logger.info("Check Ping IPv4 from  host to nhc2 = 5.5.5.5")
 
-    output = pingrouter.run("ping 5.5.5.5 -f -c 1000")
+    output = host.run("ping 5.5.5.5 -f -c 1000")
     logger.info(output)
     if "1000 packets transmitted, 1000 received" not in output:
         assertmsg = "expected ping IPv4 from host to nhc2 should be ok"
@@ -322,28 +322,28 @@ def test_redundancy_shortcut():
     logger.info("Testing NHRP shortcuts with redundant servers")
 
     # Verify nhc1 nhrp routes before shortcut creation
-    router = tgen.gears["nhc1"]
-    json_file = "{}/{}/nhrp_route.json".format(CWD, router.name)
+    nhc1 = tgen.gears["nhc1"]
+    json_file = "{}/{}/nhrp_route.json".format(CWD, nhc1.name)
     assertmsg = "No nhrp_route file found"
     assert os.path.isfile(json_file), assertmsg
 
     expected = json.loads(open(json_file).read())
     test_func = partial(
-        topotest.router_json_cmp, router, "show ip route nhrp json", expected
+        topotest.router_json_cmp, nhc1, "show ip route nhrp json", expected
     )
     _, result = topotest.run_and_expect(test_func, None, count=40, wait=0.5)
 
-    output = router.vtysh_cmd("show ip route nhrp")
+    output = nhc1.vtysh_cmd("show ip route nhrp")
     logger.info(output)
 
-    assertmsg = '"{}" JSON output mismatches'.format(router.name)
+    assertmsg = '"{}" JSON output mismatches'.format(nhc1.name)
     assert result is None, assertmsg
 
     # Initiate shortcut by pinging between clients
-    pingrouter = tgen.gears["host"]
+    host = tgen.gears["host"]
     logger.info("Check Ping IPv4 from  host to nhc2 via shortcut = 5.5.5.5")
 
-    output = pingrouter.run("ping 5.5.5.5 -f -c 1000")
+    output = host.run("ping 5.5.5.5 -f -c 1000")
     logger.info(output)
     if "1000 packets transmitted, 1000 received" not in output:
         assertmsg = "expected ping IPv4 from host to nhc2 via shortcut should be ok"
@@ -352,20 +352,20 @@ def test_redundancy_shortcut():
         logger.info("Check Ping IPv4 from host to nhc2 via shortcut OK")
 
     # Now check that NHRP shortcut route installed
-    json_file = "{}/{}/nhrp_route_shortcut.json".format(CWD, router.name)
+    json_file = "{}/{}/nhrp_route_shortcut.json".format(CWD, nhc1.name)
     assertmsg = "No nhrp_route file found"
     assert os.path.isfile(json_file), assertmsg
 
     expected = json.loads(open(json_file).read())
     test_func = partial(
-        topotest.router_json_cmp, router, "show ip route nhrp json", expected
+        topotest.router_json_cmp, nhc1, "show ip route nhrp json", expected
     )
     _, result = topotest.run_and_expect(test_func, None, count=40, wait=0.5)
 
-    output = router.vtysh_cmd("show ip route nhrp")
+    output = nhc1.vtysh_cmd("show ip route nhrp")
     logger.info(output)
 
-    assertmsg = '"{}" JSON output mismatches'.format(router.name)
+    assertmsg = '"{}" JSON output mismatches'.format(nhc1.name)
     assert result is None, assertmsg
 
     # Bring down primary GRE interface and verify shortcut is not disturbed
@@ -373,10 +373,10 @@ def test_redundancy_shortcut():
     shutdown_bringup_interface(tgen, "nhs1", "nhs1-gre0", False)
 
     # Verify shortcut is still active
-    pingrouter = tgen.gears["host"]
+    host = tgen.gears["host"]
     logger.info("Check Ping IPv4 from  host to nhc2 via shortcut = 5.5.5.5")
 
-    output = pingrouter.run("ping 5.5.5.5 -f -c 1000")
+    output = host.run("ping 5.5.5.5 -f -c 1000")
     logger.info(output)
     if "1000 packets transmitted, 1000 received" not in output:
         assertmsg = "expected ping IPv4 from host to nhc2 via shortcut should be ok"
@@ -385,20 +385,20 @@ def test_redundancy_shortcut():
         logger.info("Check Ping IPv4 from host to nhc2 via shortcut OK")
 
     # Now verify shortcut is purged with lack of traffic
-    json_file = "{}/{}/nhrp_route.json".format(CWD, router.name)
+    json_file = "{}/{}/nhrp_route.json".format(CWD, nhc1.name)
     assertmsg = "No nhrp_route file found"
     assert os.path.isfile(json_file), assertmsg
 
     expected = json.loads(open(json_file).read())
     test_func = partial(
-        topotest.router_json_cmp, router, "show ip route nhrp json", expected
+        topotest.router_json_cmp, nhc1, "show ip route nhrp json", expected
     )
     _, result = topotest.run_and_expect(test_func, None, count=40, wait=0.5)
 
-    output = router.vtysh_cmd("show ip route nhrp")
+    output = nhc1.vtysh_cmd("show ip route nhrp")
     logger.info(output)
 
-    assertmsg = '"{}" JSON output mismatches'.format(router.name)
+    assertmsg = '"{}" JSON output mismatches'.format(nhc1.name)
     assert result is None, assertmsg