From c0fa628e995b1eac223ef936ba2d9427962586a9 Mon Sep 17 00:00:00 2001 From: Mark Stapp Date: Wed, 6 Oct 2021 13:49:52 -0400 Subject: [PATCH] tests: clean up all_proto_startup a bit Remove references to the deprecated "CLI()" function; clean up a couple of string escapes; make one test-case sensitive to previous failures. Signed-off-by: Mark Stapp --- .../test_all_protocol_startup.py | 55 ++++--------------- 1 file changed, 12 insertions(+), 43 deletions(-) diff --git a/tests/topotests/all_protocol_startup/test_all_protocol_startup.py b/tests/topotests/all_protocol_startup/test_all_protocol_startup.py index 1b99fcea1f..5e1d95c00b 100644 --- a/tests/topotests/all_protocol_startup/test_all_protocol_startup.py +++ b/tests/topotests/all_protocol_startup/test_all_protocol_startup.py @@ -115,7 +115,7 @@ def setup_module(module): tgen.gears["r%s" % i].start() # For debugging after starting FRR daemons, uncomment the next line - # CLI(net) + # tgen.mininet_cli() def teardown_module(module): @@ -127,7 +127,8 @@ def teardown_module(module): def test_router_running(): global fatal_error - net = get_topogen().net + tgen = get_topogen() + net = tgen.net # Skip if previous fatal error condition is raised if fatal_error != "": @@ -143,7 +144,7 @@ def test_router_running(): assert fatal_error == "", fatal_error # For debugging after starting FRR daemons, uncomment the next line - # CLI(net) + # tgen.mininet_cli() def test_error_messages_vtysh(): @@ -198,9 +199,6 @@ def test_error_messages_vtysh(): fatal_error = net["r%s" % i].checkRouterRunning() assert fatal_error == "", fatal_error - # For debugging after starting FRR daemons, uncomment the next line - # CLI(net) - def test_error_messages_daemons(): global fatal_error @@ -289,9 +287,6 @@ def test_error_messages_daemons(): assert error_logs == "", "Daemons report errors to StdErr" - # For debugging after starting FRR daemons, uncomment the next line - # CLI(net) - def test_converge_protocols(): global fatal_error @@ -325,7 +320,7 @@ def test_converge_protocols(): actual = ( net["r%s" % i] .cmd( - "vtysh -c \"show ip route\" | sed -e '/^Codes: /,/^\s*$/d' | sort 2> /dev/null" + "vtysh -c \"show ip route\" | sed -e '/^Codes: /,/^\\s*$/d' | sort 2> /dev/null" ) .rstrip() ) @@ -358,7 +353,7 @@ def test_converge_protocols(): actual = ( net["r%s" % i] .cmd( - "vtysh -c \"show ipv6 route\" | sed -e '/^Codes: /,/^\s*$/d' | sort 2> /dev/null" + "vtysh -c \"show ipv6 route\" | sed -e '/^Codes: /,/^\\s*$/d' | sort 2> /dev/null" ) .rstrip() ) @@ -379,9 +374,6 @@ def test_converge_protocols(): assert failures == 0, "IPv6 Routing table failed for r%s\n%s" % (i, diff) - # For debugging after starting FRR daemons, uncomment the next line - ## CLI(net) - def route_get_nhg_id(route_str): net = get_topogen().net @@ -567,8 +559,6 @@ def test_nexthop_groups(): % nhg_id ) - ##CLI(net) - ## Remove all NHG routes net["r1"].cmd('vtysh -c "sharp remove routes 2.2.2.1 1"') @@ -638,9 +628,6 @@ def test_rip_status(): fatal_error = net["r%s" % i].checkRouterRunning() assert fatal_error == "", fatal_error - # For debugging after starting FRR daemons, uncomment the next line - # CLI(net) - def test_ripng_status(): global fatal_error @@ -705,9 +692,6 @@ def test_ripng_status(): fatal_error = net["r%s" % i].checkRouterRunning() assert fatal_error == "", fatal_error - # For debugging after starting FRR daemons, uncomment the next line - # CLI(net) - def test_ospfv2_interfaces(): global fatal_error @@ -790,9 +774,6 @@ def test_ospfv2_interfaces(): fatal_error = net["r%s" % i].checkRouterRunning() assert fatal_error == "", fatal_error - # For debugging after starting FRR daemons, uncomment the next line - # CLI(net) - def test_isis_interfaces(): global fatal_error @@ -856,9 +837,6 @@ def test_isis_interfaces(): fatal_error = net["r%s" % i].checkRouterRunning() assert fatal_error == "", fatal_error - # For debugging after starting FRR daemons, uncomment the next line - # CLI(net) - def test_bgp_summary(): global fatal_error @@ -1037,9 +1015,6 @@ def test_bgp_summary(): fatal_error = net["r%s" % i].checkRouterRunning() assert fatal_error == "", fatal_error - # For debugging after starting FRR daemons, uncomment the next line - # CLI(net) - def test_bgp_ipv6_summary(): global fatal_error @@ -1138,12 +1113,15 @@ def test_bgp_ipv6_summary(): fatal_error = net["r%s" % i].checkRouterRunning() assert fatal_error == "", fatal_error - # For debugging after starting FRR daemons, uncomment the next line - # CLI(net) - def test_nht(): + global fatal_error net = get_topogen().net + + # Skip if previous fatal error condition is raised + if fatal_error != "": + pytest.skip(fatal_error) + print("\n\n**** Test that nexthop tracking is at least nominally working ****\n") thisDir = os.path.dirname(os.path.realpath(__file__)) @@ -1256,9 +1234,6 @@ def test_bgp_ipv4(): fatal_error = net["r%s" % i].checkRouterRunning() assert fatal_error == "", fatal_error - # For debugging after starting FRR daemons, uncomment the next line - # CLI(net) - def test_bgp_ipv6(): global fatal_error @@ -1325,9 +1300,6 @@ def test_bgp_ipv6(): fatal_error = net["r%s" % i].checkRouterRunning() assert fatal_error == "", fatal_error - # For debugging after starting FRR daemons, uncomment the next line - # CLI(net) - def test_route_map(): global fatal_error @@ -1567,9 +1539,6 @@ def test_mpls_interfaces(): fatal_error = net["r%s" % i].checkRouterRunning() assert fatal_error == "", fatal_error - # For debugging after starting FRR daemons, uncomment the next line - # CLI(net) - def test_shutdown_check_stderr(): global fatal_error -- 2.39.5