From 5cbb02ebde5deb71f9db5a23697087d79507a3f2 Mon Sep 17 00:00:00 2001 From: Kuldeep Kashyap Date: Mon, 1 Mar 2021 19:22:25 -0800 Subject: [PATCH] tests: Improve error/assert message logging 1. Improved error meesage logging. 2. No functionality changes only put some meaningfull error messages. Signed-off-by: Kuldeep Kashyap --- .../test_bgp_gr_functionality_topo1.py | 115 +++++---- .../test_bgp_gr_functionality_topo2.py | 146 ++++++----- .../test_bgp_large_community_topo_2.py | 15 +- .../test_bgp_multi_vrf_topo1.py | 15 +- .../test_bgp_multi_vrf_topo2.py | 10 +- ...test_bgp_recursive_route_ebgp_multi_hop.py | 72 +++--- .../test_evpn_type5_topo1.py | 4 +- .../test_mcast_pim_bsmp_01.py | 45 +++- .../test_mcast_pim_bsmp_02.py | 10 +- .../test_multicast_pim_sm_topo3.py | 12 +- .../test_multicast_pim_sm_topo4.py | 40 ++-- .../test_multicast_pim_static_rp.py | 226 +++++++++++------- .../test_ospf_chaos.py | 30 +-- .../test_ospf_ecmp.py | 30 ++- .../test_ospf_ecmp_lan.py | 10 +- .../ospf_basic_functionality/test_ospf_lan.py | 5 +- .../test_ospf_routemaps.py | 70 +++--- .../test_ospf_rte_calc.py | 24 +- .../test_static_routes_topo4_ebgp.py | 5 +- .../test_static_routes_topo4_ibgp.py | 5 +- 20 files changed, 544 insertions(+), 345 deletions(-) diff --git a/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1.py b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1.py index 3a2d283025..a6338d0c70 100644 --- a/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1.py +++ b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1.py @@ -1317,18 +1317,20 @@ def test_BGP_GR_TC_4_p0(request): result = verify_bgp_rib( tgen, addr_type, dut, input_topo, next_hop, expected=False ) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are still present in BGP RIB\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) # Verifying RIB routes result = verify_rib( tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False ) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are still present in ZEBRA\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) logger.info("[Phase 5] : R2 is about to come up now ") @@ -1788,9 +1790,10 @@ def test_BGP_GR_TC_6_1_2_p1(request): result = verify_r_bit( tgen, topo, addr_type, input_dict, dut="r2", peer="r1", expected=False ) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r2: R-bit is set to True\n Error: {}".format( tc_name, result - ) + )) logger.info("Restart BGPd on R2 ") kill_router_daemons(tgen, "r2", ["bgpd"]) @@ -1808,9 +1811,10 @@ def test_BGP_GR_TC_6_1_2_p1(request): result = verify_r_bit( tgen, topo, addr_type, input_dict, dut="r2", peer="r1", expected=False ) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r2: R-bit is set to True\n Error: {}".format( tc_name, result - ) + )) write_test_footer(tc_name) @@ -2092,18 +2096,20 @@ def test_BGP_GR_TC_17_p1(request): result = verify_bgp_rib( tgen, addr_type, dut, input_topo, next_hop, expected=False ) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are still present in BGP RIB\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) # Verifying RIB routes result = verify_rib( tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False ) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are still present in ZEBRA\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) logger.info("[Phase 5] : R2 is about to come up now ") @@ -2122,9 +2128,10 @@ def test_BGP_GR_TC_17_p1(request): result = verify_r_bit( tgen, topo, addr_type, input_dict, dut="r1", peer="r2", expected=False ) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: R-bit is set to True\n Error: {}".format( tc_name, result - ) + )) # Verifying BGP RIB routes next_hop = next_hop_per_address_family( @@ -2450,18 +2457,20 @@ def test_BGP_GR_TC_20_p1(request): result = verify_bgp_rib( tgen, addr_type, dut, input_topo, next_hop, expected=False ) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are still present in BGP RIB\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) # Verifying RIB routes result = verify_rib( tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False ) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are still present in ZEBRA\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) logger.info("[Phase 5] : R2 is about to come up now ") @@ -2734,9 +2743,10 @@ def test_BGP_GR_TC_31_1_p1(request): result = verify_rib( tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False ) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are still present in ZEBRA\n Error: {}".format( tc_name, result - ) + )) logger.info("[Phase 4] : R1 is about to come up now ") start_router_daemons(tgen, "r1", ["bgpd"]) @@ -3215,9 +3225,10 @@ def test_BGP_GR_TC_9_p1(request): result = verify_bgp_rib( tgen, addr_type, dut, input_topo, next_hop, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are still present in BGP RIB\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) # Verifying RIB routes @@ -3225,9 +3236,10 @@ def test_BGP_GR_TC_9_p1(request): result = verify_rib( tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are still present in ZEBRA\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) logger.info("[Phase 5] : R2 is about to come up now ") @@ -3257,9 +3269,10 @@ def test_BGP_GR_TC_9_p1(request): result = verify_f_bit( tgen, topo, addr_type, input_dict, dut="r1", peer="r2", expected=False ) - assert result is not True, "Testcase {} :Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: F-bit is set to True\n Error: {}".format( tc_name, result - ) + )) write_test_footer(tc_name) @@ -3391,9 +3404,10 @@ def test_BGP_GR_TC_17_p1(request): result = verify_bgp_rib( tgen, addr_type, dut, input_topo, next_hop, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are still present in BGP RIB\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) # Verifying RIB routes @@ -3401,9 +3415,10 @@ def test_BGP_GR_TC_17_p1(request): result = verify_rib( tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are still present in ZEBRA\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) logger.info("[Phase 5] : R2 is about to come up now ") @@ -3425,9 +3440,10 @@ def test_BGP_GR_TC_17_p1(request): result = verify_r_bit( tgen, topo, addr_type, input_dict, dut="r1", peer="r2", expected=False ) - assert result is not True, "Testcase {} :Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: R-bit is set to True\n Error: {}".format( tc_name, result - ) + )) # Verifying BGP RIB routes next_hop = next_hop_per_address_family( @@ -3647,9 +3663,10 @@ def test_BGP_GR_TC_43_p1(request): result = verify_bgp_rib( tgen, addr_type, dut, input_topo, next_hop, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r2: routes are still present in BGP RIB\n Error: {}".format( tc_name, result - ) + )) protocol = "bgp" result = verify_rib( tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False @@ -3954,9 +3971,10 @@ def test_BGP_GR_TC_44_p1(request): result = verify_bgp_rib( tgen, addr_type, dut, input_topo, next_hop, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are still present in BGP RIB\n Error: {}".format( tc_name, result - ) + )) result = verify_rib( tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False ) @@ -4981,9 +4999,10 @@ def test_BGP_GR_TC_48_p1(request): result = verify_rib( tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are still present in ZEBRA\n Error: {}".format( tc_name, result - ) + )) dut = "r2" peer = "r1" @@ -4994,15 +5013,17 @@ def test_BGP_GR_TC_48_p1(request): result = verify_bgp_rib( tgen, addr_type, dut, input_topo, next_hop, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r2: routes are still present in BGP RIB\n Error: {}".format( tc_name, result - ) + )) result = verify_rib( tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r2: routes are still present in ZEBRA\n Error: {}".format( tc_name, result - ) + )) step("Bring up BGP on R1 and remove Peer-level GR config from R1") @@ -5361,15 +5382,17 @@ def test_BGP_GR_TC_52_p1(request): result = verify_bgp_rib( tgen, addr_type, dut, input_topo, next_hop, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are still present in BGP RIB\n Error: {}".format( tc_name, result - ) + )) result = verify_rib( tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are still present in ZEBRA\n Error: {}".format( tc_name, result - ) + )) step("Bring up BGP on R2 and remove Peer-level GR config from R1") diff --git a/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2.py b/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2.py index 2ddeab13f6..2c5dd92f54 100644 --- a/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2.py +++ b/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2.py @@ -555,9 +555,10 @@ def test_BGP_GR_TC_3_p0(request): result = verify_eor( tgen, topo, addr_type, input_dict, dut="r2", peer="r1", expected=False ) - assert result is not True, ( - "Testcase " + tc_name + " : Failed \n Error: {}".format(result) - ) + assert result is not True, ("Testcase {} : Failed \n " + "r2: EOR is set to True\n Error: {}".format( + tc_name, result + )) logger.info( "Waiting for selection deferral timer({} sec)..".format(GR_SELECT_DEFER_TIMER) @@ -700,9 +701,10 @@ def test_BGP_GR_TC_11_p0(request): result = verify_eor( tgen, topo, addr_type, input_dict, dut="r1", peer="r3", expected=False ) - assert result is not True, ( - "Testcase " + tc_name + " : Failed \n Error: {}".format(result) - ) + assert result is not True, ("Testcase {} : Failed \n " + "r1: EOR is set to True\n Error: {}".format( + tc_name, result + )) logger.info( "Waiting for selection deferral timer({} sec).. ".format( @@ -729,9 +731,10 @@ def test_BGP_GR_TC_11_p0(request): result = verify_eor( tgen, topo, addr_type, input_dict, dut="r3", peer="r1", expected=False ) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r3: EOR is set to True\n Error: {}".format( tc_name, result - ) + )) write_test_footer(tc_name) @@ -1465,31 +1468,35 @@ def test_BGP_GR_18_p1(request): dut = "r6" input_dict_1 = {key: topo["routers"][key] for key in ["r1"]} result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1, expected=False) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r6: routes are still present in BGP RIB\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) # Verifying RIB routes before shutting down BGPd daemon result = verify_rib(tgen, addr_type, dut, input_dict_1, expected=False) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r6: routes are still present in ZEBRA\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) # Verifying BGP RIB routes dut = "r2" result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1, expected=False) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r2: routes are still present in BGP RIB\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) # Verifying RIB routes before shutting down BGPd daemon result = verify_rib(tgen, addr_type, dut, input_dict_1, expected=False) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r6: routes are still present in ZEBRA\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) write_test_footer(tc_name) @@ -1950,16 +1957,18 @@ def test_BGP_GR_chaos_29_p1(request): # Verifying BGP RIB routes before shutting down BGPd daemon input_dict = {key: topo["routers"][key] for key in ["r1"]} result = verify_bgp_rib(tgen, addr_type, dut, input_dict, expected=False) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r3: routes are still present in BGP RIB\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) # Verifying RIB routes before shutting down BGPd daemon result = verify_rib(tgen, addr_type, dut, input_dict, expected=False) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r3: routes are still present in ZEBRA\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) logger.info("[Step 4] : Start BGPd daemon on R1..") @@ -2201,9 +2210,10 @@ def test_BGP_GR_chaos_33_p1(request): result = verify_rib( tgen, addr_type, dut, input_dict_2, next_hop_4, expected=False ) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r3: routes are still present in BGP RIB\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) if addr_type == "ipv6": @@ -2215,9 +2225,10 @@ def test_BGP_GR_chaos_33_p1(request): result = verify_rib( tgen, addr_type, dut, input_dict_2, next_hop_6, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r3: routes are still present in ZEBRA\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) logger.info("[Step 4] : Start BGPd daemon on R1 and R4..") @@ -2398,24 +2409,27 @@ def test_BGP_GR_chaos_34_2_p1(request): result = verify_f_bit( tgen, topo, addr_type, input_dict, "r3", "r1", expected=False ) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r3: F-bit is set to True\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) # Verifying BGP RIB routes after starting BGPd daemon input_dict_1 = {key: topo["routers"][key] for key in ["r1"]} result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1, expected=False) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r3: routes are still present in BGP RIB\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) # Verifying RIB routes result = verify_rib(tgen, addr_type, dut, input_dict_1, expected=False) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r3: routes are still present in ZEBRA\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) write_test_footer(tc_name) @@ -2552,9 +2566,10 @@ def test_BGP_GR_chaos_34_1_p1(request): result = verify_f_bit( tgen, topo, addr_type, input_dict_2, "r3", "r1", expected=False ) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r3: F-bit is set to True\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) logger.info("[Step 3] : Kill BGPd daemon on R1..") @@ -2570,16 +2585,18 @@ def test_BGP_GR_chaos_34_1_p1(request): # Verifying BGP RIB routes input_dict = {key: topo["routers"][key] for key in ["r1"]} result = verify_bgp_rib(tgen, addr_type, dut, input_dict, expected=False) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r3: routes are still present in BGP RIB\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) # Verifying RIB routes result = verify_rib(tgen, addr_type, dut, input_dict, expected=False) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r3: routes are still present in ZEBRA\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) # Start BGPd daemon on R1 @@ -2753,24 +2770,27 @@ def test_BGP_GR_chaos_32_p1(request): result = verify_eor( tgen, topo, addr_type, input_dict_3, dut="r5", peer="r1", expected=False ) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r5: EOR is set to TRUE\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) # Verifying BGP RIB routes after starting BGPd daemon input_dict_1 = {key: topo["routers"][key] for key in ["r5"]} result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1, expected=False) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r3: routes are still present in BGP RIB\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) # Verifying RIB routes result = verify_rib(tgen, addr_type, dut, input_dict_1, expected=False) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r3: routes are still present in ZEBRA\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) write_test_footer(tc_name) @@ -2876,9 +2896,10 @@ def test_BGP_GR_chaos_37_p1(request): result = verify_eor( tgen, topo, addr_type, input_dict, dut="r3", peer="r1", expected=False ) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r3: EOR is set to True\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) # Verifying BGP RIB routes after starting BGPd daemon @@ -2941,9 +2962,10 @@ def test_BGP_GR_chaos_37_p1(request): result = verify_eor( tgen, topo, addr_type, input_dict_3, dut="r1", peer="r3", expected=False ) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: EOR is set to True\n Error: {}".format( tc_name, result - ) + )) write_test_footer(tc_name) @@ -3095,16 +3117,18 @@ def test_BGP_GR_chaos_30_p1(request): # Verifying BGP RIB routes before shutting down BGPd daemon input_dict = {key: topo["routers"][key] for key in ["r3"]} result = verify_bgp_rib(tgen, addr_type, dut, input_dict, expected=False) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are still present in BGP RIB\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) # Verifying RIB routes before shutting down BGPd daemon result = verify_rib(tgen, addr_type, dut, input_dict, expected=False) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are still present in ZEBRA\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) write_test_footer(tc_name) @@ -3506,9 +3530,10 @@ def BGP_GR_TC_7_p1(request): dut = "r1" input_dict_1 = {key: topo["routers"][key] for key in ["r3"]} result = verify_rib(tgen, addr_type, dut, input_dict_1, expected=False) - assert result is not True, "Testcase {} :Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are still present in ZEBRA\n Error: {}".format( tc_name, result - ) + )) write_test_footer(tc_name) @@ -3682,9 +3707,10 @@ def test_BGP_GR_TC_23_p1(request): result = verify_eor( tgen, topo, addr_type, input_dict, dut="r1", peer="r2", expected=False ) - assert result is not True, ( - "Testcase " + tc_name + " :Failed \n Error: {}".format(result) - ) + assert result is not True, ("Testcase {} : Failed \n " + "r1: EOR is set to True\n Error: {}".format( + tc_name, result + )) # Verifying BGP RIB routes received from router R1 dut = "r1" @@ -3805,16 +3831,18 @@ def test_BGP_GR_20_p1(request): dut = "r3" input_dict_1 = {key: topo["routers"][key] for key in ["r1"]} result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1, expected=False) - assert result is not True, "Testcase {} :Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r3: routes are still present in BGP RIB\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) # Verifying RIB routes before shutting down BGPd daemon result = verify_rib(tgen, addr_type, dut, input_dict_1, expected=False) - assert result is not True, "Testcase {} :Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r3: routes are still present in ZEBRA\n Error: {}".format( tc_name, result - ) + )) logger.info(" Expected behavior: {}".format(result)) # Start BGPd daemon on R1 diff --git a/tests/topotests/bgp_large_community/test_bgp_large_community_topo_2.py b/tests/topotests/bgp_large_community/test_bgp_large_community_topo_2.py index c2858a4bd0..8e5ffe10be 100644 --- a/tests/topotests/bgp_large_community/test_bgp_large_community_topo_2.py +++ b/tests/topotests/bgp_large_community/test_bgp_large_community_topo_2.py @@ -598,9 +598,10 @@ def test_large_community_lists_with_rmap_apply_and_remove(request): result = verify_bgp_community( tgen, adt, dut, NETWORKS[adt], input_dict_4, expected=False ) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "largeCommunity is still present after deleting route-map \n Error: {}".format( tc_name, result - ) + )) write_test_footer(tc_name) @@ -898,9 +899,10 @@ def test_large_community_lists_with_rmap_set_none(request): dut = "r6" for adt in ADDR_TYPES: result = verify_bgp_community(tgen, adt, dut, NETWORKS[adt], expected=False) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "Community-list is still present \n Error: {}".format( tc_name, result - ) + )) write_test_footer(tc_name) @@ -2236,9 +2238,10 @@ def test_large_community_lists_with_rmap_match_regex(request): result = verify_bgp_community( tgen, adt, dut, NETWORKS[adt], input_dict_7, expected=False ) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "largeCommunity is still present \n Error: {}".format( tc_name, result - ) + )) write_test_footer(tc_name) diff --git a/tests/topotests/bgp_multi_vrf_topo1/test_bgp_multi_vrf_topo1.py b/tests/topotests/bgp_multi_vrf_topo1/test_bgp_multi_vrf_topo1.py index cf6b7cc53f..ac7ee44b25 100644 --- a/tests/topotests/bgp_multi_vrf_topo1/test_bgp_multi_vrf_topo1.py +++ b/tests/topotests/bgp_multi_vrf_topo1/test_bgp_multi_vrf_topo1.py @@ -504,9 +504,10 @@ def test_ambiguous_overlapping_addresses_in_different_vrfs_p0(request): ) result = verify_rib(tgen, addr_type, dut, input_dict_1, tag=500, expected=False) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "Routes are present with tag value 500 \n Error: {}".format( tc_name, result - ) + )) logger.info("Expected Behavior: {}".format(result)) step( @@ -1142,9 +1143,10 @@ def test_prefixes_leaking_p0(request): result = verify_rib( tgen, addr_type, dut, input_dict_1, metric=123, expected=False ) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "Routes are present with metric value 123 \n Error: {}".format( tc_name, result - ) + )) logger.info("Expected Behavior: {}".format(result)) result = verify_rib(tgen, addr_type, dut, input_dict_2, metric=123) @@ -1155,9 +1157,10 @@ def test_prefixes_leaking_p0(request): result = verify_rib( tgen, addr_type, dut, input_dict_2, metric=0, expected=False ) - assert result is not True, "Testcase {} : Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "Routes are present with metric value 0 \n Error: {}".format( tc_name, result - ) + )) logger.info("Expected Behavior: {}".format(result)) write_test_footer(tc_name) diff --git a/tests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py b/tests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py index 19a9140c13..c6e1792e84 100644 --- a/tests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py +++ b/tests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py @@ -2214,14 +2214,16 @@ def test_restart_bgpd_daemon_p1(request): } result = verify_rib(tgen, addr_type, dut, input_dict_1, expected=False) - assert result is not True, "Testcase {} :Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "Routes are still present in VRF RED_A and RED_B \n Error: {}".format( tc_name, result - ) + )) result = verify_rib(tgen, addr_type, dut, input_dict_2, expected=False) - assert result is not True, "Testcase {} :Failed \n Error {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "Routes are still present in VRF BLUE_A and BLUE_B \n Error: {}".format( tc_name, result - ) + )) step("Bring up BGPd daemon on R1.") start_router_daemons(tgen, "r1", ["bgpd"]) diff --git a/tests/topotests/bgp_recursive_route_ebgp_multi_hop/test_bgp_recursive_route_ebgp_multi_hop.py b/tests/topotests/bgp_recursive_route_ebgp_multi_hop/test_bgp_recursive_route_ebgp_multi_hop.py index 3f9009967d..4764ff8945 100644 --- a/tests/topotests/bgp_recursive_route_ebgp_multi_hop/test_bgp_recursive_route_ebgp_multi_hop.py +++ b/tests/topotests/bgp_recursive_route_ebgp_multi_hop/test_bgp_recursive_route_ebgp_multi_hop.py @@ -20,7 +20,7 @@ # """ -Following tests are covered to test bgp recursive route and ebgp +Following tests are covered to test bgp recursive route and ebgp multi-hop functionality: 1. Verify that BGP routes are installed in iBGP peer, only when there @@ -365,9 +365,10 @@ def test_recursive_routes_iBGP_peer_p1(request): protocol="bgp", expected=False, ) - assert result is not True, "Testcase : Failed \n Error : {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "Routes are still present \n Error: {}".format( tc_name, result - ) + )) step("Reconfigure the same static route on R2 again") dut = "r2" @@ -485,9 +486,10 @@ def test_recursive_routes_iBGP_peer_p1(request): result = verify_rib( tgen, addr_type, "r2", input_dict_4, protocol="bgp", expected=False ) - assert result is not True, "Testcase {} : Failed \n Error : {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "Routes are still present \n Error: {}".format( tc_name, result - ) + )) write_test_footer(tc_name) @@ -596,9 +598,10 @@ def test_next_hop_as_self_ip_p1(request): next_hop=topo["routers"]["r2"]["links"]["r4"][addr_type].split("/")[0], expected=False, ) - assert result is not True, "Testcase : Failed \n Error : {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "Routes are still present \n Error: {}".format( tc_name, result - ) + )) step("Shut interface on R2 that has IP from the subnet as BGP next-hop") intf_r2_r4 = topo["routers"]["r2"]["links"]["r4"]["interface"] @@ -673,9 +676,10 @@ def test_next_hop_as_self_ip_p1(request): next_hop=topo["routers"]["r2"]["links"]["r4"][addr_type].split("/")[0], expected=False, ) - assert result is not True, "Testcase : Failed \n Error : {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "Routes are still present \n Error: {}".format( tc_name, result - ) + )) write_test_footer(tc_name) @@ -1618,9 +1622,10 @@ def test_BGP_peering_bw_loopback_and_physical_p1(request): step("Verify that once eBGP multi-hop is removed, BGP session goes down") result = verify_bgp_convergence_from_running_config(tgen, expected=False) - assert result is not True, "Testcase {} : Failed \n Error : {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "BGP is converged \n Error: {}".format( tc_name, result - ) + )) step("Add ebgp-multihop command on R3 again") for addr_type in ADDR_TYPES: @@ -1658,9 +1663,10 @@ def test_BGP_peering_bw_loopback_and_physical_p1(request): step("Verify that BGP session goes down, when update-source is removed") result = verify_bgp_convergence_from_running_config(tgen, expected=False) - assert result is not True, "Testcase {} : Failed \n Error : {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "BGP is converged \n Error: {}".format( tc_name, result - ) + )) step("Add update-source command on R1 again") for addr_type in ADDR_TYPES: @@ -1709,16 +1715,18 @@ def test_BGP_peering_bw_loopback_and_physical_p1(request): next_hop=topo["routers"]["r1"]["links"]["r3"][addr_type].split("/")[0], expected=False, ) - assert result is not True, "Testcase {} : Failed \n Error : {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "Routes are still present \n Error: {}".format( tc_name, result - ) + )) sleep(3) step("Verify that BGP session goes down, when static route is removed") result = verify_bgp_convergence_from_running_config(tgen, expected=False) - assert result is not True, "Testcase {} : Failed \n Error : {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "BGP is converged \n Error: {}".format( tc_name, result - ) + )) step("Add static route on R3 again") for addr_type in ADDR_TYPES: @@ -1760,9 +1768,10 @@ def test_BGP_peering_bw_loopback_and_physical_p1(request): sleep(3) step("Verify that BGP neighborship between R1 and R3 goes down") result = verify_bgp_convergence_from_running_config(tgen, expected=False) - assert result is not True, "Testcase {} : Failed \n Error : {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "BGP is converged \n Error: {}".format( tc_name, result - ) + )) intf_r1_r3 = topo["routers"]["r1"]["links"]["r3"]["interface"] shutdown_bringup_interface(tgen, "r1", intf_r1_r3, True) @@ -2078,9 +2087,10 @@ def test_BGP_active_standby_preemption_and_ecmp_p1(request): ], expected=False, ) - assert result is not True, "Testcase {} : Failed \n Error : {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "Routes are still present \n Error: {}".format( tc_name, result - ) + )) step("Reconfigure multipath-relax command on R4") result = create_router_bgp(tgen, topo, maxpath_relax) @@ -2137,9 +2147,10 @@ def test_BGP_active_standby_preemption_and_ecmp_p1(request): ], expected=False, ) - assert result is not True, "Testcase {} : Failed \n Error : {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "Routes are still present \n Error: {}".format( tc_name, result - ) + )) step("Re-configure maximum-path 2 command on R4") input_dict_8 = { @@ -2327,9 +2338,10 @@ def test_password_authentication_for_eBGP_and_iBGP_peers_p1(request): "configured but not peer routers" ) result = verify_bgp_convergence(tgen, topo, expected=False) - assert result is not True, "Testcase {} : Failed \n Error : {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "BGP is converged \n Error: {}".format( tc_name, result - ) + )) step("configure same password on R2 and R3") for routerN in ["r2", "r3"]: @@ -2356,9 +2368,10 @@ def test_password_authentication_for_eBGP_and_iBGP_peers_p1(request): "strings are in CAPs on R2 and R3" ) result = verify_bgp_convergence(tgen, topo, expected=False) - assert result is not True, "Testcase {} : Failed \n Error : {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "BGP is converged \n Error: {}".format( tc_name, result - ) + )) step("Configure same password on R2 and R3 without CAPs") for routerN in ["r2", "r3"]: @@ -2382,9 +2395,10 @@ def test_password_authentication_for_eBGP_and_iBGP_peers_p1(request): step("Verify if password is removed from R1, both sessions go down again") result = verify_bgp_convergence(tgen, topo, expected=False) - assert result is not True, "Testcase {} : Failed \n Error : {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "BGP is converged \n Error: {}".format( tc_name, result - ) + )) step("Configure alphanumeric password on R1 and peer routers R2,R3") for bgp_neighbor in ["r2", "r3"]: diff --git a/tests/topotests/evpn_type5_test_topo1/test_evpn_type5_topo1.py b/tests/topotests/evpn_type5_test_topo1/test_evpn_type5_topo1.py index 036277411f..1a399ab32e 100644 --- a/tests/topotests/evpn_type5_test_topo1/test_evpn_type5_topo1.py +++ b/tests/topotests/evpn_type5_test_topo1/test_evpn_type5_topo1.py @@ -1312,14 +1312,14 @@ def test_evpn_routes_from_VNFs_p1(request): ) for addr_type in ADDR_TYPES: input_routes = {key: topo["routers"][key] for key in ["r1"]} - result = verify_rib(tgen, addr_type, "d2", input_routes, expected=True) + result = verify_rib(tgen, addr_type, "d2", input_routes) assert result is True, "Testcase {} :Failed \n Error: {}".format( tc_name, result ) for addr_type in ADDR_TYPES: input_routes = {key: topo["routers"][key] for key in ["r2"]} - result = verify_rib(tgen, addr_type, "d2", input_routes, expected=True) + result = verify_rib(tgen, addr_type, "d2", input_routes) assert result is True, "Testcase {} :Failed \n Error: {}".format( tc_name, result ) diff --git a/tests/topotests/multicast-pim-bsm-topo1/test_mcast_pim_bsmp_01.py b/tests/topotests/multicast-pim-bsm-topo1/test_mcast_pim_bsmp_01.py index 96c4ea3646..6b7180978e 100644 --- a/tests/topotests/multicast-pim-bsm-topo1/test_mcast_pim_bsmp_01.py +++ b/tests/topotests/multicast-pim-bsm-topo1/test_mcast_pim_bsmp_01.py @@ -692,7 +692,10 @@ def test_BSR_CRP_with_blackhole_address_p1(request): step("Verify if b1 chosen as BSR in l1") result = verify_pim_bsr(tgen, topo, "l1", BSR_IP_1, expected=False) - assert result is not True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + assert result is not True, ("Testcase {} : Failed \n " + "b1 is not chosen as BSR in l1 \n Error: {}".format( + tc_name, result + )) state_after = verify_pim_interface_traffic(tgen, state_dict) assert isinstance( @@ -838,7 +841,10 @@ def test_new_router_fwd_p0(request): # Verify bsr state in l1 step("Verify no BSR in l1 as i1 would not forward the no-forward bsm") result = verify_pim_bsr(tgen, topo, "l1", bsr_ip, expected=False) - assert result is not True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + assert result is not True, ("Testcase {} : Failed \n " + "BSR data is present after no-forward bsm also \n Error: {}".format( + tc_name, result + )) # unconfigure unicast bsm on f1-i1-eth2 step("unconfigure unicast bsm on f1-i1-eth2, will forward with only mcast") @@ -960,7 +966,10 @@ def test_int_bsm_config_p1(request): result = verify_ip_mroutes( tgen, "i1", src_addr, GROUP_ADDRESS, iif, oil, expected=False ) - assert result is not True, "Testcase {}:Failed \n Error: {}".format(tc_name, result) + assert result is not True, ("Testcase {} : Failed \n " + "Mroutes are still present \n Error: {}".format( + tc_name, result + )) # unconfigure bsm processing on f1 on f1-i1-eth2 step("unconfigure bsm processing on f1 in f1-i1-eth2, will drop bsm") @@ -980,14 +989,20 @@ def test_int_bsm_config_p1(request): # Verify bsr state in i1 step("Verify if b1 is not chosen as BSR in i1") result = verify_pim_bsr(tgen, topo, "i1", bsr_ip, expected=False) - assert result is not True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + assert result is not True, ("Testcase {} : Failed \n " + "b1 is chosen as BSR in i1 \n Error: {}".format( + tc_name, result + )) # check if mroute still not installed because of rp not available step("check if mroute still not installed because of rp not available") result = verify_ip_mroutes( tgen, "i1", src_addr, GROUP_ADDRESS, iif, oil, expected=False ) - assert result is not True, "Testcase {}:Failed \n Error: {}".format(tc_name, result) + assert result is not True, ("Testcase {} : Failed \n " + "mroute installed but rp not available \n Error: {}".format( + tc_name, result + )) # configure bsm processing on i1 on f1-i1-eth2 step("configure bsm processing on f1 in f1-i1-eth2, will accept bsm") @@ -1449,7 +1464,10 @@ def test_BSM_timeout_p0(request): tgen, topo, "f1", group, rp_source="BSR", expected=False ) - assert result is not True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + assert result is not True, ("Testcase {} : Failed \n " + "bsr has not aged out in f1 \n Error: {}".format( + tc_name, result + )) # Verify RP mapping removed after hold timer expires group = "225.1.1.1/32" @@ -1473,14 +1491,20 @@ def test_BSM_timeout_p0(request): result = verify_join_state_and_timer( tgen, dut, iif, src_addr, GROUP_ADDRESS, expected=False ) - assert result is not True, "Testcase {}:Failed \n Error: {}".format(tc_name, result) + assert result is not True, ("Testcase {} : Failed \n " + "join state is up and join timer is running in l1 \n Error: {}".format( + tc_name, result + )) # Verify ip mroute is not installed step("Verify mroute not installed in l1") result = verify_ip_mroutes( tgen, dut, src_addr, GROUP_ADDRESS, iif, oil, expected=False ) - assert result is not True, "Testcase {}:Failed \n Error: {}".format(tc_name, result) + assert result is not True, ("Testcase {} : Failed \n " + "mroute installed in l1 \n Error: {}".format( + tc_name, result + )) step("clear BSM database before moving to next case") clear_bsrp_data(tgen, topo) @@ -1633,7 +1657,10 @@ def test_iif_join_state_p0(request): result = verify_ip_mroutes( tgen, dut, src_addr, GROUP_ADDRESS, iif, oil, expected=False ) - assert result is not True, "Testcase {}:Failed \n Error: {}".format(tc_name, result) + assert result is not True, ("Testcase {} : Failed \n " + "mroute installed in l1 \n Error: {}".format( + tc_name, result + )) # Add back route for RP to make it reachable step("Add back route for RP to make it reachable") diff --git a/tests/topotests/multicast-pim-bsm-topo2/test_mcast_pim_bsmp_02.py b/tests/topotests/multicast-pim-bsm-topo2/test_mcast_pim_bsmp_02.py index 8bd91401c3..5fc5e52518 100644 --- a/tests/topotests/multicast-pim-bsm-topo2/test_mcast_pim_bsmp_02.py +++ b/tests/topotests/multicast-pim-bsm-topo2/test_mcast_pim_bsmp_02.py @@ -454,7 +454,10 @@ def test_starg_mroute_p0(request): result = verify_ip_mroutes( tgen, dut, src_addr, GROUP_ADDRESS, iif, oil, wait=20, expected=False ) - assert result is not True, "Testcase {}:Failed \n Error: {}".format(tc_name, result) + assert result is not True, ("Testcase {} : Failed \n " + "mroute installed in l1 \n Error: {}".format( + tc_name, result + )) # Send BSM again to configure rp step("Add back RP by sending BSM from b1") @@ -804,7 +807,10 @@ def test_BSR_election_p0(request): # Verify bsr state in FHR step("Verify if b2 is not chosen as bsr in f1") result = verify_pim_bsr(tgen, topo, "f1", bsr_ip2, expected=False) - assert result is not True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + assert result is not True, ("Testcase {} : Failed \n " + "b2 is chosen as bsr in f1 \n Error: {}".format( + tc_name, result + )) # Verify if b1 is still chosen as bsr step("Verify if b1 is still chosen as bsr in f1") diff --git a/tests/topotests/multicast-pim-sm-topo3/test_multicast_pim_sm_topo3.py b/tests/topotests/multicast-pim-sm-topo3/test_multicast_pim_sm_topo3.py index ad9a2fefde..1c22654541 100755 --- a/tests/topotests/multicast-pim-sm-topo3/test_multicast_pim_sm_topo3.py +++ b/tests/topotests/multicast-pim-sm-topo3/test_multicast_pim_sm_topo3.py @@ -3487,9 +3487,11 @@ def test_prune_sent_to_LHR_and_FHR_when_PIMnbr_down_p2(request): IGMP_JOIN_RANGE_1, expected=False, ) - assert result is not True, "Testcase {} : Failed Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "upstream is still present after shut the link from " + "FHR to RP from RP node \n Error: {}".format( tc_name, result - ) + )) step(" No shut the link from FHR to RP from RP node") @@ -3636,9 +3638,11 @@ def test_prune_sent_to_LHR_and_FHR_when_PIMnbr_down_p2(request): IGMP_JOIN_RANGE_1, expected=False, ) - assert result is not True, "Testcase {} : Failed Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "upstream is still present after shut the link from " + "FHR to RP from FHR node \n Error: {}".format( tc_name, result - ) + )) step(" No shut the link from FHR to RP from FHR node") diff --git a/tests/topotests/multicast-pim-sm-topo3/test_multicast_pim_sm_topo4.py b/tests/topotests/multicast-pim-sm-topo3/test_multicast_pim_sm_topo4.py index bb2971842b..68b7849c2b 100755 --- a/tests/topotests/multicast-pim-sm-topo3/test_multicast_pim_sm_topo4.py +++ b/tests/topotests/multicast-pim-sm-topo3/test_multicast_pim_sm_topo4.py @@ -490,9 +490,10 @@ def test_mroute_when_RP_reachable_default_route_p2(request): data["oil"], expected=False, ) - assert result is not True, "Testcase {} : Failed Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "mroutes(S,G) are present after delete of static routes on c1 \n Error: {}".format( tc_name, result - ) + )) result = verify_upstream_iif( tgen, @@ -502,9 +503,10 @@ def test_mroute_when_RP_reachable_default_route_p2(request): IGMP_JOIN_RANGE_1, expected=False, ) - assert result is not True, "Testcase {} : Failed Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "upstream is present after delete of static routes on c1 \n Error: {}".format( tc_name, result - ) + )) for data in input_dict_starg: result = verify_ip_mroutes( @@ -516,9 +518,10 @@ def test_mroute_when_RP_reachable_default_route_p2(request): data["oil"], expected=False, ) - assert result is not True, "Testcase {} : Failed Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "mroutes(*,G) are present after delete of static routes on c1 \n Error: {}".format( tc_name, result - ) + )) result = verify_upstream_iif( tgen, @@ -528,9 +531,10 @@ def test_mroute_when_RP_reachable_default_route_p2(request): IGMP_JOIN_RANGE_1, expected=False, ) - assert result is not True, "Testcase {} : Failed Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "upstream is present after delete of static routes on c1 \n Error: {}".format( tc_name, result - ) + )) step("Configure default routes on c2") @@ -553,9 +557,10 @@ def test_mroute_when_RP_reachable_default_route_p2(request): result = verify_pim_rp_info( tgen, topo, dut, GROUP_RANGE_1, "Unknown", rp_address, SOURCE, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "RP info is unknown after removing static route from c2 \n Error: {}".format( tc_name, result - ) + )) step("Verify (s,g) populated after adding default route ") @@ -782,9 +787,10 @@ def test_mroute_with_RP_default_route_all_nodes_p2(request): data["oil"], expected=False, ) - assert result is not True, "Testcase {} : Failed Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "mroutes are still present \n Error: {}".format( tc_name, result - ) + )) result = verify_upstream_iif( tgen, @@ -794,9 +800,10 @@ def test_mroute_with_RP_default_route_all_nodes_p2(request): IGMP_JOIN_RANGE_1, expected=False, ) - assert result is not True, "Testcase {} : Failed Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "upstream is still present \n Error: {}".format( tc_name, result - ) + )) step("Configure default routes on all the nodes") @@ -833,9 +840,10 @@ def test_mroute_with_RP_default_route_all_nodes_p2(request): result = verify_pim_rp_info( tgen, topo, dut, GROUP_RANGE_1, "Unknown", rp_address, SOURCE, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "RP info is unknown after removing static route from c2 \n Error: {}".format( tc_name, result - ) + )) step("Verify (s,g) populated after adding default route ") diff --git a/tests/topotests/multicast-pim-static-rp-topo1/test_multicast_pim_static_rp.py b/tests/topotests/multicast-pim-static-rp-topo1/test_multicast_pim_static_rp.py index f01f57d1eb..1317ec67b4 100755 --- a/tests/topotests/multicast-pim-static-rp-topo1/test_multicast_pim_static_rp.py +++ b/tests/topotests/multicast-pim-static-rp-topo1/test_multicast_pim_static_rp.py @@ -423,9 +423,10 @@ def test_add_delete_static_RP_p0(request): dut = "r1" interface = "r1-r0-eth0" result = verify_igmp_groups(tgen, dut, interface, GROUP_ADDRESS, expected=False) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: igmp group present without any IGMP join \n Error: {}".format( tc_name, result - ) + )) step("r1: Verify show ip pim interface traffic without any IGMP join") state_dict = {"r1": {"r1-r2-eth1": ["pruneTx"]}} @@ -491,23 +492,26 @@ def test_add_delete_static_RP_p0(request): result = verify_pim_rp_info( tgen, topo, dut, GROUP_RANGE_ALL, iif, rp_address, SOURCE, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: RP info present \n Error: {}".format( tc_name, result - ) + )) step("r1: Verify upstream IIF interface") result = verify_upstream_iif(tgen, dut, iif, STAR, GROUP_ADDRESS, expected=False) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: upstream IIF interface present \n Error: {}".format( tc_name, result - ) + )) step("r1: Verify upstream join state and join timer") result = verify_join_state_and_timer( tgen, dut, iif, STAR, GROUP_ADDRESS, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: upstream join state is up and join timer is running \n Error: {}".format( tc_name, result - ) + )) step("r1: Verify PIM state") result = verify_pim_state(tgen, dut, iif, oif, GROUP_ADDRESS, expected=False) @@ -517,9 +521,10 @@ def test_add_delete_static_RP_p0(request): step("r1: Verify ip mroutes") result = verify_ip_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif, expected=False) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: mroutes are still present \n Error: {}".format( tc_name, result - ) + )) step("r1: Verify show ip pim interface traffic without any IGMP join") state_after = verify_pim_interface_traffic(tgen, state_dict) @@ -676,9 +681,10 @@ def test_SPT_RPT_path_same_p1(request): result = verify_join_state_and_timer( tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r3: (S, G) upstream join state is up and join timer is running\n Error: {}".format( tc_name, result - ) + )) step("r3: Verify (S, G) ip mroutes") oif = "r3-r2-eth1" @@ -805,15 +811,17 @@ def test_not_reachable_static_RP_p0(request): "using show ip pim state" ) result = verify_pim_state(tgen, dut, iif, oif, GROUP_ADDRESS, expected=False) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "OIL is not same and IIF is not cleared on R1 \n Error: {}".format( tc_name, result - ) + )) step("r1: upstream IIF should be unknown , verify using show ip pim" "upstream") result = verify_upstream_iif(tgen, dut, iif, STAR, GROUP_ADDRESS, expected=False) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: upstream IIF is not unknown \n Error: {}".format( tc_name, result - ) + )) step( "r1: join state should not be joined and join timer should stop," @@ -822,9 +830,10 @@ def test_not_reachable_static_RP_p0(request): result = verify_join_state_and_timer( tgen, dut, iif, STAR, GROUP_ADDRESS, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: join state is joined and timer is not stopped \n Error: {}".format( tc_name, result - ) + )) step( "r1: (*,G) prune is sent towards the RP interface, verify using" @@ -841,9 +850,10 @@ def test_not_reachable_static_RP_p0(request): step("r1: (*, G) cleared from mroute table using show ip mroute") result = verify_ip_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif, expected=False) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: (*, G) are not cleared from mroute table \n Error: {}".format( tc_name, result - ) + )) logger.info("Expected behavior: {}".format(result)) # Uncomment next line for debugging @@ -910,9 +920,10 @@ def test_add_RP_after_join_received_p1(request): result = verify_pim_rp_info( tgen, topo, dut, GROUP_RANGE_ALL, iif, rp_address, SOURCE, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: rp-info is present \n Error: {}".format( tc_name, result - ) + )) step("joinTx value before join sent") state_dict = {"r1": {"r1-r2-eth1": ["joinTx"]}} @@ -933,30 +944,34 @@ def test_add_RP_after_join_received_p1(request): step("r1: Verify upstream IIF interface") result = verify_upstream_iif(tgen, dut, iif, STAR, GROUP_ADDRESS, expected=False) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: upstream IFF interface is present \n Error: {}".format( tc_name, result - ) + )) step("r1: Verify upstream join state and join timer") result = verify_join_state_and_timer( tgen, dut, iif, STAR, GROUP_ADDRESS, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: upstream join state is joined and timer is running \n Error: {}".format( tc_name, result - ) + )) step("r1: Verify PIM state") result = verify_pim_state(tgen, dut, iif, oif, GROUP_ADDRESS, expected=False) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: PIM state is up\n Error: {}".format( tc_name, result - ) + )) step("r1: Verify ip mroutes") result = verify_ip_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif, expected=False) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: mroutes are still present\n Error: {}".format( tc_name, result - ) + )) step("r1: Configure static RP") input_dict = { @@ -1080,29 +1095,33 @@ def test_reachable_static_RP_after_join_p0(request): step("r1 : Verify upstream IIF interface") iif = "r1-r2-eth1" result = verify_upstream_iif(tgen, dut, iif, STAR, GROUP_ADDRESS, expected=False) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: upstream IIF interface is present\n Error: {}".format( tc_name, result - ) + )) step("r1 : Verify upstream join state and join timer") result = verify_join_state_and_timer( tgen, dut, iif, STAR, GROUP_ADDRESS, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: upstream join state is joined and timer is running\n Error: {}".format( tc_name, result - ) + )) step("r1 : Verify PIM state") result = verify_pim_state(tgen, dut, iif, oif, GROUP_ADDRESS, expected=False) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: PIM state is up\n Error: {}".format( tc_name, result - ) + )) step("r1 : Verify ip mroutes") result = verify_ip_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif, expected=False) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: mroutes are still present\n Error: {}".format( tc_name, result - ) + )) step("r1: Make RP reachable") intf = "r1-r2-eth1" @@ -1343,9 +1362,10 @@ def test_send_join_on_higher_preffered_rp_p1(request): result = verify_pim_rp_info( tgen, topo, dut, GROUP_RANGE, oif, rp_address_2, SOURCE, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: rp-info is present for group 225.1.1.1 \n Error: {}".format( tc_name, result - ) + )) step( "r1 : Verify RPF interface updated in mroute when higher preferred" @@ -1599,9 +1619,11 @@ def test_RP_configured_as_LHR_1_p1(request): result = verify_join_state_and_timer( tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r3: (S, G) upstream join state is joined and join" + " timer is running \n Error: {}".format( tc_name, result - ) + )) step("r3: Verify (S, G) ip mroutes") oif = "r3-r1-eth0" @@ -1806,9 +1828,10 @@ def test_RP_configured_as_LHR_2_p1(request): result = verify_join_state_and_timer( tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format( tc_name, result - ) + )) step("r3: Verify (S, G) ip mroutes") oif = "r3-r1-eth0" @@ -2013,9 +2036,10 @@ def test_RP_configured_as_FHR_1_p1(request): result = verify_join_state_and_timer( tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format( tc_name, result - ) + )) step("r3: Verify (S, G) ip mroutes") oif = "r3-r1-eth0" @@ -2221,9 +2245,10 @@ def test_RP_configured_as_FHR_2_p2(request): result = verify_join_state_and_timer( tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format( tc_name, result - ) + )) step("r3: Verify (S, G) ip mroutes") oif = "r3-r1-eth0" @@ -2347,9 +2372,10 @@ def test_SPT_RPT_path_different_p1(request): result = verify_join_state_and_timer( tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format( tc_name, result - ) + )) step("r3: Verify (S, G) ip mroutes") oif = "r3-r1-eth0" @@ -2368,9 +2394,10 @@ def test_SPT_RPT_path_different_p1(request): result = verify_join_state_and_timer( tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r2: (S,G) upstream state is joined and join timer is running\n Error: {}".format( tc_name, result - ) + )) step("r2: Verify (S, G) ip mroutes") oif = "none" @@ -2596,9 +2623,10 @@ def test_restart_pimd_process_p2(request): result = verify_join_state_and_timer( tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format( tc_name, result - ) + )) step("r3: Verify (S, G) ip mroutes") oif = "r3-r1-eth0" @@ -2763,9 +2791,10 @@ def test_multiple_groups_same_RP_address_p2(request): result = verify_join_state_and_timer( tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format( tc_name, result - ) + )) step("r3: Verify (S, G) ip mroutes") oif = "r3-r1-eth0" @@ -2784,9 +2813,10 @@ def test_multiple_groups_same_RP_address_p2(request): result = verify_join_state_and_timer( tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r2: (S,G) upstream state is joined and join timer is running\n Error: {}".format( tc_name, result - ) + )) step("r2: Verify (S, G) ip mroutes") oif = "none" @@ -2902,9 +2932,10 @@ def test_multiple_groups_same_RP_address_p2(request): result = verify_join_state_and_timer( tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r2: (S,G) upstream state is joined and join timer is running\n Error: {}".format( tc_name, result - ) + )) step("r2: Verify (S, G) ip mroutes") oif = "none" @@ -2921,9 +2952,10 @@ def test_multiple_groups_same_RP_address_p2(request): result = verify_join_state_and_timer( tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format( tc_name, result - ) + )) step("r3: Verify (S, G) ip mroutes") oif = "r3-r1-eth0" @@ -3100,9 +3132,10 @@ def test_multiple_groups_different_RP_address_p2(request): result = verify_join_state_and_timer( tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_1, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r2: (S,G) upstream state is joined and join timer is running\n Error: {}".format( tc_name, result - ) + )) step("r2: Verify (S, G) ip mroutes") oif = "none" @@ -3121,9 +3154,10 @@ def test_multiple_groups_different_RP_address_p2(request): result = verify_join_state_and_timer( tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_1, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format( tc_name, result - ) + )) step("r3: Verify (S, G) ip mroutes") oif = "r3-r1-eth0" @@ -3190,9 +3224,10 @@ def test_multiple_groups_different_RP_address_p2(request): result = verify_join_state_and_timer( tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_2, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r4: (S,G) upstream state is joined and join timer is running\n Error: {}".format( tc_name, result - ) + )) step("r4: Verify (S, G) ip mroutes") oif = "none" @@ -3364,9 +3399,10 @@ def test_multiple_groups_different_RP_address_p2(request): result = verify_join_state_and_timer( tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_1, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r2: (S,G) upstream state is joined and join timer is running\n Error: {}".format( tc_name, result - ) + )) step("r2: Verify (S, G) ip mroutes") oif = "none" @@ -3385,9 +3421,10 @@ def test_multiple_groups_different_RP_address_p2(request): result = verify_join_state_and_timer( tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_1, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format( tc_name, result - ) + )) step("r3: Verify (S, G) ip mroutes") oif = "r3-r1-eth0" @@ -3454,9 +3491,10 @@ def test_multiple_groups_different_RP_address_p2(request): result = verify_join_state_and_timer( tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_2, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r4: (S,G) upstream state is joined and join timer is running\n Error: {}".format( tc_name, result - ) + )) step("r4: Verify (S, G) ip mroutes") oif = "none" @@ -3475,9 +3513,10 @@ def test_multiple_groups_different_RP_address_p2(request): result = verify_join_state_and_timer( tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_2, expected=False ) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format( tc_name, result - ) + )) step("r3: Verify (S, G) ip mroutes") oif = "r3-r1-eth0" @@ -3604,27 +3643,30 @@ def test_shutdown_primary_path_p1(request): iif = "r1-r3-eth2" oif = "r1-r0-eth0" result = verify_ip_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif, expected=False) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: (*,G) mroutes are not cleared after shut of R1 to R3 link\n Error: {}".format( tc_name, result - ) + )) step("r2: Verify (*, G) ip mroutes") dut = "r2" iif = "lo" oif = "r2-r3-eth1" result = verify_ip_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif, expected=False) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r2: (*,G) mroutes are not cleared after shut of R1 to R3 link\n Error: {}".format( tc_name, result - ) + )) step("r3: Verify (*, G) ip mroutes") dut = "r3" iif = "r3-r2-eth1" oif = "r3-r1-eth0" result = verify_ip_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif, expected=False) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r3: (*,G) mroutes are not cleared after shut of R1 to R3 link\n Error: {}".format( tc_name, result - ) + )) step("r3: No shutdown the link from R1 to R3 from R3 node") dut = "r3" @@ -3784,18 +3826,20 @@ def test_delete_RP_shut_noshut_upstream_interface_p1(request): iif = "r1-r2-eth1" oif = "r1-r0-eth0" result = verify_ip_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif, expected=False) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: (*,G) mroutes are not cleared after shut of R1 to R0 link\n Error: {}".format( tc_name, result - ) + )) step("r2: Verify (*, G) ip mroutes cleared") dut = "r2" iif = "lo" oif = "r2-r1-eth0" result = verify_ip_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif, expected=False) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r2: (*,G) mroutes are not cleared after shut of R1 to R0 link\n Error: {}".format( tc_name, result - ) + )) write_test_footer(tc_name) @@ -3905,18 +3949,20 @@ def test_delete_RP_shut_noshut_RP_interface_p1(request): iif = "r1-r2-eth1" oif = "r1-r0-eth0" result = verify_ip_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif, expected=False) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: (*,G) mroutes are not cleared after shut of R1 to R2 and R3 link\n Error: {}".format( tc_name, result - ) + )) step("r2: Verify (*, G) ip mroutes cleared") dut = "r2" iif = "lo" oif = "r2-r1-eth0" result = verify_ip_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif, expected=False) - assert result is not True, "Testcase {} :Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r2: (*,G) mroutes are not cleared after shut of R1 to R2 and R3 link\n Error: {}".format( tc_name, result - ) + )) write_test_footer(tc_name) diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_chaos.py b/tests/topotests/ospf_basic_functionality/test_ospf_chaos.py index 0dedc8f0df..cebe55b39c 100644 --- a/tests/topotests/ospf_basic_functionality/test_ospf_chaos.py +++ b/tests/topotests/ospf_basic_functionality/test_ospf_chaos.py @@ -249,16 +249,17 @@ def test_ospf_chaos_tc31_p1(request): dut = "r1" protocol = "ospf" result = verify_ospf_rib(tgen, dut, input_dict, expected=False) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: OSPF routes are present \n Error: {}".format( tc_name, result - ) + )) - result = verify_rib( - tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False - ) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol, + expected=False) + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are still present \n Error: {}".format( tc_name, result - ) + )) step("Bring up OSPFd daemon on R0.") start_router_daemons(tgen, "r0", ["ospfd"]) @@ -481,16 +482,17 @@ def test_ospf_chaos_tc34_p1(request): dut = "r1" protocol = "ospf" result = verify_ospf_rib(tgen, dut, input_dict, expected=False) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: OSPF routes are present \n Error: {}".format( tc_name, result - ) + )) - result = verify_rib( - tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False - ) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol, + expected=False) + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are still present \n Error: {}".format( tc_name, result - ) + )) step("Bring up staticd daemon on R0.") start_router_daemons(tgen, "r0", ["staticd"]) diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_ecmp.py b/tests/topotests/ospf_basic_functionality/test_ospf_ecmp.py index 441368e8fa..adf82a5e85 100644 --- a/tests/topotests/ospf_basic_functionality/test_ospf_ecmp.py +++ b/tests/topotests/ospf_basic_functionality/test_ospf_ecmp.py @@ -259,17 +259,19 @@ def test_ospf_ecmp_tc16_p0(request): shutdown_bringup_interface(tgen, dut, intf, False) result = verify_ospf_rib(tgen, dut, input_dict, next_hop=nh, expected=False) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: OSPF routes are present \n Error: {}".format( tc_name, result - ) + )) protocol = "ospf" result = verify_rib( tgen, "ipv4", dut, input_dict, protocol=protocol, next_hop=nh, expected=False ) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are still present \n Error: {}".format( tc_name, result - ) + )) for intfr in range(1, 7): intf = topo["routers"]["r1"]["links"]["r0-link{}".format(intfr)]["interface"] @@ -324,9 +326,10 @@ def test_ospf_ecmp_tc16_p0(request): result = verify_ospf_rib( tgen, dut, input_dict, next_hop=nh, attempts=5, expected=False ) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: OSPF routes are present \n Error: {}".format( tc_name, result - ) + )) protocol = "ospf" result = verify_rib( @@ -339,9 +342,10 @@ def test_ospf_ecmp_tc16_p0(request): attempts=5, expected=False, ) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are still present \n Error: {}".format( tc_name, result - ) + )) step("Re configure the static route in R0.") dut = "r0" @@ -428,9 +432,10 @@ def test_ospf_ecmp_tc17_p0(request): result = verify_ospf_rib( tgen, dut, input_dict, next_hop=nh, attempts=5, expected=False ) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: OSPF routes are present \n Error: {}".format( tc_name, result - ) + )) protocol = "ospf" result = verify_rib( @@ -443,9 +448,10 @@ def test_ospf_ecmp_tc17_p0(request): attempts=5, expected=False, ) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are still present \n Error: {}".format( tc_name, result - ) + )) step("Reconfigure the static route in R0.Change ECMP value to 2.") dut = "r0" diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_ecmp_lan.py b/tests/topotests/ospf_basic_functionality/test_ospf_ecmp_lan.py index 2da1dcd21a..c5230d6614 100644 --- a/tests/topotests/ospf_basic_functionality/test_ospf_ecmp_lan.py +++ b/tests/topotests/ospf_basic_functionality/test_ospf_ecmp_lan.py @@ -307,9 +307,10 @@ def test_ospf_lan_ecmp_tc18_p0(request): result = verify_ospf_rib( tgen, dut, input_dict, next_hop=nh, attempts=5, expected=False ) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: OSPF routes are present \n Error: {}".format( tc_name, result - ) + )) protocol = "ospf" result = verify_rib( @@ -322,9 +323,10 @@ def test_ospf_lan_ecmp_tc18_p0(request): attempts=5, expected=False, ) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are still present \n Error: {}".format( tc_name, result - ) + )) write_test_footer(tc_name) diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_lan.py b/tests/topotests/ospf_basic_functionality/test_ospf_lan.py index dac32090bc..2fbb27f4fc 100644 --- a/tests/topotests/ospf_basic_functionality/test_ospf_lan.py +++ b/tests/topotests/ospf_basic_functionality/test_ospf_lan.py @@ -397,9 +397,10 @@ def test_ospf_lan_tc1_p0(request): shutdown_bringup_interface(tgen, dut, intf, False) result = verify_ospf_neighbor(tgen, topo, dut, lan=True, expected=False) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r0: OSPF neighbors-hip is up \n Error: {}".format( tc_name, result - ) + )) step("No Shut interface on R0") dut = "r0" diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py b/tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py index ceadb3975b..b99ce6cfb8 100644 --- a/tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py +++ b/tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py @@ -332,16 +332,18 @@ def test_ospf_routemaps_functionality_tc19_p0(request): } } result = verify_ospf_rib(tgen, dut, input_dict, expected=False) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: OSPF routes are present \n Error: {}".format( tc_name, result - ) + )) result = verify_rib( tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False ) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are present in fib \n Error: {}".format( tc_name, result - ) + )) step("Delete and reconfigure prefix list.") # Create ip prefix list @@ -381,16 +383,18 @@ def test_ospf_routemaps_functionality_tc19_p0(request): } } result = verify_ospf_rib(tgen, dut, input_dict, expected=False) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: OSPF routes are present \n Error: {}".format( tc_name, result - ) + )) result = verify_rib( tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False ) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: OSPF routes are present \n Error: {}".format( tc_name, result - ) + )) pfx_list = { "r0": { @@ -434,16 +438,18 @@ def test_ospf_routemaps_functionality_tc19_p0(request): } } result = verify_ospf_rib(tgen, dut, input_dict, expected=False) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: OSPF routes are present \n Error: {}".format( tc_name, result - ) + )) result = verify_rib( tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False ) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are still present \n Error: {}".format( tc_name, result - ) + )) write_test_footer(tc_name) @@ -490,16 +496,18 @@ def test_ospf_routemaps_functionality_tc20_p0(request): dut = "r1" protocol = "ospf" result = verify_ospf_rib(tgen, dut, input_dict, attempts=2, expected=False) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: OSPF routes are present \n Error: {}".format( tc_name, result - ) + )) result = verify_rib( tgen, "ipv4", dut, input_dict, protocol=protocol, attempts=2, expected=False ) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are still present \n Error: {}".format( tc_name, result - ) + )) step( "configure the route map with the same name that is used " @@ -515,16 +523,18 @@ def test_ospf_routemaps_functionality_tc20_p0(request): dut = "r1" protocol = "ospf" result = verify_ospf_rib(tgen, dut, input_dict, expected=False) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: OSPF routes are present \n Error: {}".format( tc_name, result - ) + )) result = verify_rib( tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False ) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are still present \n Error: {}".format( tc_name, result - ) + )) # Create route map routemaps = {"r0": {"route_maps": {"rmap_ipv4": [{"action": "deny"}]}}} @@ -535,16 +545,18 @@ def test_ospf_routemaps_functionality_tc20_p0(request): dut = "r1" protocol = "ospf" result = verify_ospf_rib(tgen, dut, input_dict, expected=False) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: OSPF routes are present \n Error: {}".format( tc_name, result - ) + )) result = verify_rib( tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False ) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are still present \n Error: {}".format( tc_name, result - ) + )) step("Delete the route map.") # Create route map @@ -561,16 +573,18 @@ def test_ospf_routemaps_functionality_tc20_p0(request): dut = "r1" protocol = "ospf" result = verify_ospf_rib(tgen, dut, input_dict, expected=False) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: OSPF routes are present \n Error: {}".format( tc_name, result - ) + )) result = verify_rib( tgen, "ipv4", dut, input_dict, protocol=protocol, expected=False ) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: routes are still present \n Error: {}".format( tc_name, result - ) + )) write_test_footer(tc_name) diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_rte_calc.py b/tests/topotests/ospf_basic_functionality/test_ospf_rte_calc.py index 5aa2779aee..fb6b28ce5b 100644 --- a/tests/topotests/ospf_basic_functionality/test_ospf_rte_calc.py +++ b/tests/topotests/ospf_basic_functionality/test_ospf_rte_calc.py @@ -247,9 +247,11 @@ def test_ospf_redistribution_tc5_p0(request): if result is not True: break - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: OSPF routes are present after deleting ip address of newly " + "configured interface of R0 \n Error: {}".format( tc_name, result - ) + )) protocol = "ospf" result = verify_rib( @@ -262,9 +264,11 @@ def test_ospf_redistribution_tc5_p0(request): attempts=5, expected=False, ) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: OSPF routes are present in fib after deleting ip address of newly " + "configured interface of R0 \n Error: {}".format( tc_name, result - ) + )) step("Add back the deleted ip address on newly configured interface of R0") topo1 = { @@ -366,9 +370,11 @@ def test_ospf_redistribution_tc6_p0(request): result = verify_ospf_rib(tgen, dut, input_dict, next_hop=nh, expected=False) if result is not True: break - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: OSPF routes are present after deleting ip address of newly " + "configured loopback of R0 \n Error: {}".format( tc_name, result - ) + )) protocol = "ospf" result = verify_rib( @@ -380,9 +386,11 @@ def test_ospf_redistribution_tc6_p0(request): next_hop=nh, expected=False, ) - assert result is not True, "Testcase {} : Failed \n Error: {}".format( + assert result is not True, ("Testcase {} : Failed \n " + "r1: OSPF routes are present in fib after deleting ip address of newly " + "configured loopback of R0 \n Error: {}".format( tc_name, result - ) + )) step("Add back the deleted ip address on newly configured interface of R0") topo1 = { diff --git a/tests/topotests/static_routing_with_ebgp/test_static_routes_topo4_ebgp.py b/tests/topotests/static_routing_with_ebgp/test_static_routes_topo4_ebgp.py index 9b9749340e..dc4e29ebde 100644 --- a/tests/topotests/static_routing_with_ebgp/test_static_routes_topo4_ebgp.py +++ b/tests/topotests/static_routing_with_ebgp/test_static_routes_topo4_ebgp.py @@ -949,9 +949,10 @@ def static_routes_rmap_pfxlist_p0_tc7_ebgp(request): result4 = verify_rib( tgen, addr_type, dut, input_dict, protocol=protocol, expected=False ) - assert result4 is not True, "Testcase {} : Failed \n" "Error: {}".format( + assert result4 is not True, ("Testcase {} : Failed \n" + "routes are still present \n Error: {}".format( tc_name, result4 - ) + )) step("vm4 should be present in FRR1") dut = "r1" diff --git a/tests/topotests/static_routing_with_ibgp/test_static_routes_topo4_ibgp.py b/tests/topotests/static_routing_with_ibgp/test_static_routes_topo4_ibgp.py index e9960c7907..14db729195 100644 --- a/tests/topotests/static_routing_with_ibgp/test_static_routes_topo4_ibgp.py +++ b/tests/topotests/static_routing_with_ibgp/test_static_routes_topo4_ibgp.py @@ -947,9 +947,10 @@ def test_static_routes_rmap_pfxlist_p0_tc7_ibgp(request): result4 = verify_rib( tgen, addr_type, dut, input_dict, protocol=protocol, expected=False ) - assert result4 is not True, "Testcase {} : Failed \n" "Error: {}".format( + assert result4 is not True, ("Testcase {} : Failed \n" + "routes are still present \n Error: {}".format( tc_name, result4 - ) + )) step("vm4 should be present in FRR1") dut = "r1" -- 2.39.5