From: Louis Scalbert Date: Fri, 30 Aug 2024 09:23:42 +0000 (+0200) Subject: tests: rename router variables in nhrp_redundancy X-Git-Tag: docker/10.1.1~6^2~7 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=551c3290eddd2eab5c5727941a384b748a2bf632;p=matthieu%2Ffrr.git tests: rename router variables in nhrp_redundancy Rename router variables in nhrp_redundancy to match the actual name. Cosmetic change to help debugging. Signed-off-by: Louis Scalbert --- diff --git a/tests/topotests/nhrp_redundancy/test_nhrp_redundancy.py b/tests/topotests/nhrp_redundancy/test_nhrp_redundancy.py index c0d7312102..606df0e133 100644 --- a/tests/topotests/nhrp_redundancy/test_nhrp_redundancy.py +++ b/tests/topotests/nhrp_redundancy/test_nhrp_redundancy.py @@ -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