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 caa0de3d41..7bef57b629 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 @@ -210,6 +210,7 @@ class CreateTopo(Topo): """ Dummy """ print("%s", self.name) + def setup_module(mod): """ Sets up the pytest environment @@ -272,9 +273,7 @@ def teardown_module(): # Stop toplogy and Remove tmp files tgen.stop_topology() - logger.info( - "Testsuite end time: %s", time.asctime(time.localtime(time.time())) - ) + logger.info("Testsuite end time: %s", time.asctime(time.localtime(time.time()))) logger.info("=" * 40) @@ -338,10 +337,8 @@ def verify_mroute_repopulated(uptime_before, uptime_after): ) return errormsg - d_1 = datetime.datetime.strptime(uptime_before[group][source], - "%H:%M:%S") - d_2 = datetime.datetime.strptime(uptime_after[group][source], - "%H:%M:%S") + d_1 = datetime.datetime.strptime(uptime_before[group][source], "%H:%M:%S") + d_2 = datetime.datetime.strptime(uptime_after[group][source], "%H:%M:%S") if d_2 >= d_1: errormsg = "mroute (%s, %s) is not " "repopulated [FAILED!!]" % ( source, @@ -365,7 +362,7 @@ def verify_state_incremented(state_before, state_after): """ for router, state_data in state_before.items(): - for state, _ in state_data.items(): + for state, _ in state_data.items(): if state_before[router][state] >= state_after[router][state]: errormsg = ( "[DUT: %s]: state %s value has not" @@ -498,7 +495,8 @@ def test_add_delete_static_RP_p0(request): step("r1: Verify RP info") result = verify_pim_rp_info( - tgen, TOPO, dut, GROUP_RANGE_ALL, iif, rp_address, SOURCE) + tgen, TOPO, dut, GROUP_RANGE_ALL, iif, rp_address, SOURCE + ) assert ( result is not True ), "Testcase {} : Failed \n " "r1: RP info present \n Error: {}".format( @@ -513,9 +511,7 @@ def test_add_delete_static_RP_p0(request): ) step("r1: Verify upstream join state and join timer") - result = verify_join_state_and_timer( - tgen, dut, iif, STAR, GROUP_ADDRESS - ) + result = verify_join_state_and_timer(tgen, dut, iif, STAR, GROUP_ADDRESS) assert result is not True, ( "Testcase {} : Failed \n " "r1: upstream join state is up and join timer is running \n Error: {}".format( @@ -690,8 +686,7 @@ def test_SPT_RPT_path_same_p1(request): assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) step("r3: Verify (S, G) upstream join state and join timer") - result = verify_join_state_and_timer( - tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS) + result = verify_join_state_and_timer(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS) assert result is not True, ( "Testcase {} : Failed \n " "r3: (S, G) upstream join state is up and join timer is running\n Error: {}".format( @@ -759,8 +754,9 @@ def test_not_reachable_static_RP_p0(request): state_before = verify_pim_interface_traffic(tgen, state_dict) assert isinstance( state_before, dict - ), "Testcase{} : Failed \n state_before is not dictionary \n " \ - "Error: {}".format(tc_name, result) + ), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format( + tc_name, result + ) step("Enable IGMP on r1 interface and send IGMP " "join (225.1.1.1) to r1") step("Configure r2 loopback interface as RP") @@ -842,9 +838,7 @@ def test_not_reachable_static_RP_p0(request): "r1: join state should not be joined and join timer should stop," "verify using show ip pim upstream" ) - result = verify_join_state_and_timer( - tgen, dut, iif, STAR, GROUP_ADDRESS - ) + result = verify_join_state_and_timer(tgen, dut, iif, STAR, GROUP_ADDRESS) assert result is not True, ( "Testcase {} : Failed \n " "r1: join state is joined and timer is not stopped \n Error: {}".format( @@ -859,8 +853,9 @@ def test_not_reachable_static_RP_p0(request): state_after = verify_pim_interface_traffic(tgen, state_dict) assert isinstance( state_after, dict - ), "Testcase{} : Failed \n state_before is not dictionary \n " \ - "Error: {}".format(tc_name, result) + ), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format( + tc_name, result + ) result = verify_state_incremented(state_before, state_after) assert result is True, "Testcase{} : Failed Error: {}".format(tc_name, result) @@ -950,14 +945,13 @@ def test_add_RP_after_join_received_p1(request): state_before = verify_pim_interface_traffic(tgen, state_dict) assert isinstance( state_before, dict - ), "Testcase{} : Failed \n state_before is not dictionary \n " \ - "Error: {}".format(tc_name, result) + ), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format( + tc_name, result + ) step("r0 : Send IGMP join (225.1.1.1) to r1, when rp is not configured" "in r1") result = iperfSendIGMPJoin(tgen, "r0", GROUP_ADDRESS, join_interval=1) - assert result is True, "Testcase {} :Failed \n Error: {}".format( - tc_name, result - ) + assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) step("r1: IGMP group is received on R1 verify using show ip igmp groups") oif = "r1-r0-eth0" @@ -973,9 +967,7 @@ def test_add_RP_after_join_received_p1(request): step("r1: Verify upstream join state and join timer") - result = verify_join_state_and_timer( - tgen, dut, iif, STAR, GROUP_ADDRESS - ) + result = verify_join_state_and_timer(tgen, dut, iif, STAR, GROUP_ADDRESS) assert result is not True, ( "Testcase {} : Failed \n " "r1: upstream join state is joined and timer is running \n Error: {}".format( @@ -1042,8 +1034,9 @@ def test_add_RP_after_join_received_p1(request): state_after = verify_pim_interface_traffic(tgen, state_dict) assert isinstance( state_after, dict - ), "Testcase{} : Failed \n state_before is not dictionary \n " \ - "Error: {}".format(tc_name, result) + ), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format( + tc_name, result + ) result = verify_state_incremented(state_before, state_after) assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) @@ -1090,8 +1083,9 @@ def test_reachable_static_RP_after_join_p0(request): state_before = verify_pim_interface_traffic(tgen, state_dict) assert isinstance( state_before, dict - ), "Testcase{} : Failed \n state_before is not dictionary \n " \ - "Error: {}".format(tc_name, result) + ), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format( + tc_name, result + ) step("r1: Make RP un-reachable") dut = "r1" @@ -1127,9 +1121,7 @@ def test_reachable_static_RP_after_join_p0(request): ) step("r1 : Verify upstream join state and join timer") - result = verify_join_state_and_timer( - tgen, dut, iif, STAR, GROUP_ADDRESS - ) + result = verify_join_state_and_timer(tgen, dut, iif, STAR, GROUP_ADDRESS) assert result is not True, ( "Testcase {} : Failed \n " "r1: upstream join state is joined and timer is running\n Error: {}".format( @@ -1188,8 +1180,9 @@ def test_reachable_static_RP_after_join_p0(request): state_after = verify_pim_interface_traffic(tgen, state_dict) assert isinstance( state_after, dict - ), "Testcase{} : Failed \n state_before is not dictionary \n " \ - "Error: {}".format(tc_name, result) + ), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format( + tc_name, result + ) result = verify_state_incremented(state_before, state_after) assert result is True, "Testcase{} : Failed Error: {}".format(tc_name, result) @@ -1279,8 +1272,9 @@ def test_send_join_on_higher_preffered_rp_p1(request): state_before = verify_pim_interface_traffic(tgen, state_dict) assert isinstance( state_before, dict - ), "Testcase{} : Failed \n state_before is not dictionary \n " \ - "Error: {}".format(tc_name, result) + ), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format( + tc_name, result + ) step("r0 : Send IGMP join for 225.1.1.1") result = iperfSendIGMPJoin(tgen, "r0", GROUP_ADDRESS, join_interval=1) @@ -1328,8 +1322,9 @@ def test_send_join_on_higher_preffered_rp_p1(request): state_after = verify_pim_interface_traffic(tgen, state_dict) assert isinstance( state_after, dict - ), "Testcase{} : Failed \n state_before is not dictionary \n " \ - "Error: {}".format(tc_name, result) + ), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format( + tc_name, result + ) result = verify_state_incremented(state_before, state_after) assert result is True, "Testcase{} : Failed Error: {}".format(tc_name, result) @@ -1359,8 +1354,9 @@ def test_send_join_on_higher_preffered_rp_p1(request): state_before = verify_pim_interface_traffic(tgen, state_dict) assert isinstance( state_before, dict - ), "Testcase{} : Failed \n state_before is not dictionary \n " \ - "Error: {}".format(tc_name, result) + ), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format( + tc_name, result + ) step("r1 : Delete RP configuration for 225.1.1.1") input_dict = { @@ -1389,9 +1385,7 @@ def test_send_join_on_higher_preffered_rp_p1(request): step("r1 : Verify rp-info for group 225.1.1.1") iif = "r1-r4-eth3" - result = verify_pim_rp_info( - tgen, TOPO, dut, GROUP_RANGE, oif, rp_address_2, SOURCE - ) + result = verify_pim_rp_info(tgen, TOPO, dut, GROUP_RANGE, oif, rp_address_2, SOURCE) assert result is not True, ( "Testcase {} : Failed \n " "r1: rp-info is present for group 225.1.1.1 \n Error: {}".format( @@ -1440,8 +1434,9 @@ def test_send_join_on_higher_preffered_rp_p1(request): state_after = verify_pim_interface_traffic(tgen, state_dict) assert isinstance( state_after, dict - ), "Testcase{} : Failed \n state_before is not dictionary \n " \ - "Error: {}".format(tc_name, result) + ), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format( + tc_name, result + ) result = verify_state_incremented(state_before, state_after) assert result is True, "Testcase{} : Failed Error: {}".format(tc_name, result) @@ -1648,9 +1643,7 @@ def test_RP_configured_as_LHR_1_p1(request): assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) step("r3: Verify (S, G) upstream join state and join timer") - result = verify_join_state_and_timer( - tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS - ) + result = verify_join_state_and_timer(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS) assert result is not True, ( "Testcase {} : Failed \n " "r3: (S, G) upstream join state is joined and join" @@ -1857,9 +1850,7 @@ def test_RP_configured_as_LHR_2_p1(request): assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) step("r3: Verify (S, G) upstream join state and join timer") - result = verify_join_state_and_timer( - tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS - ) + result = verify_join_state_and_timer(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS) assert result is not True, ( "Testcase {} : Failed \n " "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format( @@ -2067,9 +2058,7 @@ def test_RP_configured_as_FHR_1_p1(request): assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) step("r3: Verify (S, G) upstream join state and join timer") - result = verify_join_state_and_timer( - tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS - ) + result = verify_join_state_and_timer(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS) assert result is not True, ( "Testcase {} : Failed \n " "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format( @@ -2079,12 +2068,8 @@ def test_RP_configured_as_FHR_1_p1(request): step("r3: Verify (S, G) ip mroutes") oif = "r3-r1-eth0" - result = verify_ip_mroutes(tgen, dut, SOURCE_ADDRESS, GROUP_ADDRESS, - iif, oif) - assert result is True, "Testcase {} :Failed \n Error: {}".format( - tc_name, - result - ) + result = verify_ip_mroutes(tgen, dut, SOURCE_ADDRESS, GROUP_ADDRESS, iif, oif) + assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) # Uncomment next line for debugging # tgen.mininet_cli() @@ -2282,9 +2267,7 @@ def test_RP_configured_as_FHR_2_p2(request): assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) step("r3: Verify (S, G) upstream join state and join timer") - result = verify_join_state_and_timer( - tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS - ) + result = verify_join_state_and_timer(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS) assert result is not True, ( "Testcase {} : Failed \n " "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format( @@ -2411,9 +2394,7 @@ def test_SPT_RPT_path_different_p1(request): assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) step("r3: Verify (S, G) upstream join state and join timer") - result = verify_join_state_and_timer( - tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS - ) + result = verify_join_state_and_timer(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS) assert result is not True, ( "Testcase {} : Failed \n " "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format( @@ -2435,9 +2416,7 @@ def test_SPT_RPT_path_different_p1(request): assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) step("r2: Verify (S, G) upstream join state and join timer") - result = verify_join_state_and_timer( - tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS - ) + result = verify_join_state_and_timer(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS) assert result is not True, ( "Testcase {} : Failed \n " "r2: (S,G) upstream state is joined and join timer is running\n Error: {}".format( @@ -2666,9 +2645,7 @@ def test_restart_pimd_process_p2(request): assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) step("r3: Verify (S, G) upstream join state and join timer") - result = verify_join_state_and_timer( - tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS - ) + result = verify_join_state_and_timer(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS) assert result is not True, ( "Testcase {} : Failed \n " "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format( diff --git a/tests/topotests/static_routing_with_ebgp/test_static_routes_topo1_ebgp.py b/tests/topotests/static_routing_with_ebgp/test_static_routes_topo1_ebgp.py index 99a04d26de..a16c4ae297 100644 --- a/tests/topotests/static_routing_with_ebgp/test_static_routes_topo1_ebgp.py +++ b/tests/topotests/static_routing_with_ebgp/test_static_routes_topo1_ebgp.py @@ -142,9 +142,7 @@ def setup_module(mod): # Api call verify whether BGP is converged converged = verify_bgp_convergence(tgen, topo) - assert converged is True, "setup_module :Failed \n Error: {}".format( - converged - ) + assert converged is True, "setup_module :Failed \n Error: {}".format(converged) logger.info("Running setup_module() done") @@ -312,8 +310,9 @@ def test_static_route_2nh_p0_tc_1_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name) step("Configure the static route with nexthop N1") @@ -368,15 +367,19 @@ def test_static_route_2nh_p0_tc_1_ebgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes is"\ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes is" " still present in RIB".format( + tc_name + ) nh = [next_hop_ip["nh1"][addr_type]] result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name) step("Configure the static route with nexthop N2") input_dict_4 = { @@ -407,8 +410,9 @@ def test_static_route_2nh_p0_tc_1_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name) nh = next_hop_ip["nh1"][addr_type] result = verify_rib( @@ -420,15 +424,21 @@ def test_static_route_2nh_p0_tc_1_ebgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes is" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes is" " still present in RIB".format( + tc_name + ) dut = "r3" result = verify_bgp_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, expected=False ) - assert result is not True, "Testcase {} : Failed \nError: Route is" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Route is" " still present in RIB".format( + tc_name + ) result = verify_rib( tgen, @@ -439,27 +449,35 @@ def test_static_route_2nh_p0_tc_1_ebgp(request): next_hop=nh, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Route is" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Route is" " still present in RIB".format( + tc_name + ) dut = "r2" nh = [next_hop_ip["nh2"][addr_type]] result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name) dut = "r3" result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4) - assert result is True, "Testcase {} : Failed \nError: Route is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Route is" " missing in RIB".format(tc_name) result = verify_rib( tgen, addr_type, dut, input_dict_4, protocol=protocol, expected=False ) - assert result is not True, "Testcase {} : Failed \nError: Route is" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Route is" " still present in RIB".format( + tc_name + ) dut = "r2" step("No shut the nexthop interface N1") @@ -474,8 +492,9 @@ def test_static_route_2nh_p0_tc_1_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name) step("Shut nexthop interface N2") intf = topo["routers"]["r2"]["links"]["r1-link1"]["interface"] @@ -483,7 +502,7 @@ def test_static_route_2nh_p0_tc_1_ebgp(request): shutdown_bringup_interface(tgen, dut, intf, False) step( - " after shut of nexthop N1 , route become active with " \ + " after shut of nexthop N1 , route become active with " "nexthop N2 and vice versa." ) nh = next_hop_ip["nh2"][addr_type] @@ -497,8 +516,11 @@ def test_static_route_2nh_p0_tc_1_ebgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes is" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes is" " still present in RIB".format( + tc_name + ) nh = [next_hop_ip["nh1"][addr_type]] dut = "r2" @@ -506,19 +528,24 @@ def test_static_route_2nh_p0_tc_1_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name) dut = "r3" result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4) - assert result is True, "Testcase {} : Failed \nError: Route is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Route is" " missing in RIB".format(tc_name) result = verify_rib( tgen, addr_type, dut, input_dict_4, protocol=protocol, expected=False ) - assert result is not True, "Testcase {} : Failed \nError: Route is" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Route is" " still present in RIB".format( + tc_name + ) step("No shut nexthop interface N2") dut = "r2" @@ -533,19 +560,24 @@ def test_static_route_2nh_p0_tc_1_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name) dut = "r3" result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4) - assert result is True, "Testcase {} : Failed \nError: Route is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Route is" " missing in RIB".format(tc_name) result = verify_rib( tgen, addr_type, dut, input_dict_4, protocol=protocol, expected=False ) - assert result is not True, "Testcase {} : Failed \nError: Route is" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Route is" " still present in RIB".format( + tc_name + ) step("Reload the FRR router") # stop/start -> restart FRR router and verify @@ -561,19 +593,26 @@ def test_static_route_2nh_p0_tc_1_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name) dut = "r3" result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4) - assert result is True, "Testcase {} : Failed \nError: Route is" \ - " still present in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Route is" " still present in RIB".format( + tc_name + ) result = verify_rib( tgen, addr_type, dut, input_dict_4, protocol=protocol, expected=False ) - assert result is not True, "Testcase {} : Failed \nError: Route is" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Route is" " still present in RIB".format( + tc_name + ) write_test_footer(tc_name) @@ -645,8 +684,9 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request): result = verify_rib( tgen, addr_type, dut, rte1_nh1, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - "missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" "missing in RIB".format(tc_name) rte2_nh2 = { "r2": { @@ -672,8 +712,9 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request): fib=True, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes is" \ - "not active in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name) step("Configure IBGP IPv4 peering between R2 and R3 router.") step("Explicit route is added in R3 for R2 nexthop rechability") @@ -762,8 +803,9 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request): fib=True, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes is" \ - "missing in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes is" "missing in RIB".format(tc_name) rte2_nh2 = { "r2": { @@ -780,8 +822,9 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request): result = verify_rib( tgen, addr_type, dut, rte2_nh2, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - "not active in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name) step("Configure the static route with nexthop N1") rte1_nh1 = { @@ -834,15 +877,19 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes is" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes is" " still present in RIB".format( + tc_name + ) nh = [next_hop_ip["nh1"][addr_type]] result = verify_rib( tgen, addr_type, dut, rte1_nh1, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name) step("Configure the static route with nexthop N2") rte2_nh2 = { @@ -880,15 +927,19 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes is" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes is" " still present in RIB".format( + tc_name + ) nh = [next_hop_ip["nh2"][addr_type]] result = verify_rib( tgen, addr_type, dut, rte2_nh2, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name) step("No shut the nexthop interface N1") shutdown_bringup_interface(tgen, dut, intf, True) @@ -902,8 +953,9 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request): result = verify_rib( tgen, addr_type, dut, rte1_nh1, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name) step("Shut nexthop interface N2") intf = topo["routers"]["r2"]["links"]["r1-link1"]["interface"] @@ -925,15 +977,19 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes is" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes is" " still present in RIB".format( + tc_name + ) nh = [next_hop_ip["nh1"][addr_type]] result = verify_rib( tgen, addr_type, dut, rte1_nh1, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name) step("No shut nexthop interface N2") shutdown_bringup_interface(tgen, dut, intf, True) @@ -959,8 +1015,9 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request): result = verify_rib( tgen, addr_type, dut, rte1_nh1, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - "missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" "missing in RIB".format(tc_name) rte2_nh2 = { "r2": { @@ -986,8 +1043,9 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request): fib=True, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes is" \ - "not active in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name) dut = "r3" protocol = "bgp" @@ -1002,8 +1060,9 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request): fib=True, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes is" \ - "not active in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name) dut = "r2" step("Reload the FRR router") @@ -1033,14 +1092,16 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request): result = verify_rib( tgen, addr_type, dut, rte1_nh1, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - "missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" "missing in RIB".format(tc_name) dut = "r3" protocol = "bgp" result = verify_bgp_rib(tgen, addr_type, dut, rte1_nh1, next_hop=nh) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - "missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" "missing in RIB".format(tc_name) rte2_nh2 = { "r2": { @@ -1066,14 +1127,16 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request): fib=True, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes is" \ - "not active in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name) dut = "r3" protocol = "bgp" result = verify_bgp_rib(tgen, addr_type, dut, rte2_nh2, next_hop=nh) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - "not active in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name) result = verify_rib( tgen, @@ -1085,8 +1148,9 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request): fib=True, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes is" \ - "not active in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name) write_test_footer(tc_name) @@ -1156,14 +1220,20 @@ def test_same_rte_from_bgp_static_p0_tc5_ebgp(request): step("Verify on R3 , route receive on R3 BGP table ") dut = "r3" result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4) - assert result is True, "Testcase {} : Failed \nError: Route is" \ - " still present in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Route is" " still present in RIB".format( + tc_name + ) step("Verify route installed in the RIB and FIB of R3") protocol = "bgp" result = verify_rib(tgen, addr_type, dut, input_dict_4, protocol=protocol) - assert result is True, "Testcase {} : Failed \nError: Route is" \ - " still present in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Route is" " still present in RIB".format( + tc_name + ) step( "Configure 2 links/interfaces between R1 and R3 , keep one" @@ -1214,15 +1284,19 @@ def test_same_rte_from_bgp_static_p0_tc5_ebgp(request): ) dut = "r3" result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4) - assert result is True, "Testcase {} : Failed \nError: Route is" \ - " missing in BGP RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Route is" " missing in BGP RIB".format( + tc_name + ) protocol = "bgp" result = verify_rib( tgen, addr_type, dut, input_dict_4, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Route is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Route is" " missing in RIB".format(tc_name) step("Remove the static route on R3 configured with active" "interface") for addr_type in ADDR_TYPES: @@ -1257,15 +1331,19 @@ def test_same_rte_from_bgp_static_p0_tc5_ebgp(request): ) dut = "r3" result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4) - assert result is True, "Testcase {} : Failed \nError: Route is" \ - " missing in BGP RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Route is" " missing in BGP RIB".format( + tc_name + ) protocol = "bgp" result = verify_rib( tgen, addr_type, dut, input_dict_4, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Route is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Route is" " missing in RIB".format(tc_name) write_test_footer(tc_name) diff --git a/tests/topotests/static_routing_with_ebgp/test_static_routes_topo2_ebgp.py b/tests/topotests/static_routing_with_ebgp/test_static_routes_topo2_ebgp.py index 72a6eb9871..bbb4370a93 100644 --- a/tests/topotests/static_routing_with_ebgp/test_static_routes_topo2_ebgp.py +++ b/tests/topotests/static_routing_with_ebgp/test_static_routes_topo2_ebgp.py @@ -314,8 +314,9 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ebgp(request): next_hop=nh_all[addr_type], protocol=protocol, ) - assert result is True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) step("Configure redistribute static in BGP on R2 router") for addr_type in ADDR_TYPES: @@ -338,8 +339,9 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ebgp(request): dut = "r3" protocol = "bgp" result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4) - assert result is True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) step( "Remove the static route configured with nexthop N1 to N8, one" @@ -384,8 +386,11 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ebgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed\nError: Routes is" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed\nError: Routes is" " still present in RIB".format( + tc_name + ) step("Configure the static route with nexthop N1 to N8, one by one") for addr_type in ADDR_TYPES: @@ -410,8 +415,11 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed\nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed\nError: Routes are" " missing in RIB".format( + tc_name + ) protocol = "static" step("Random shut of the nexthop interfaces") @@ -455,8 +463,9 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ebgp(request): next_hop=nh_all[addr_type], protocol=protocol, ) - assert result is True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) step("Remove random static route with all the nexthop") dut = "r2" @@ -493,8 +502,9 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ebgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) for addr_type in ADDR_TYPES: input_dict_4 = { @@ -546,8 +556,9 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ebgp(request): next_hop=nh_all[addr_type], protocol=protocol, ) - assert result is True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) step("Remove the redistribute static knob") for addr_type in ADDR_TYPES: @@ -580,8 +591,11 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, protocol=protocol, expected=False ) - assert result is not True, "Testcase {} : Failed \nError: Routes are" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes are" " still present in RIB".format( + tc_name + ) write_test_footer(tc_name) @@ -661,8 +675,9 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) nh = [] for nhp in range(2, 9): @@ -679,8 +694,9 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ebgp(request): wait=2, attempts=3, ) - assert result is not True, "Testcase {} : Failed \nError: Routes " \ - " are missing in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes " " are missing in RIB".format(tc_name) step( "Remove the static route configured with nexthop N1 to N8, one" @@ -723,8 +739,11 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ebgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes are" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes are" " still present in RIB".format( + tc_name + ) step("Configure the static route with nexthop N1 to N8, one by one") @@ -770,8 +789,9 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) nh = [] for nhp in range(2, 9): nh.append(NEXT_HOP_IP["nh" + str(nhp)][addr_type]) @@ -787,8 +807,9 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ebgp(request): wait=2, attempts=3, ) - assert result is not True, "Testcase {} : Failed \nError: Routes " \ - " are missing in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes " " are missing in RIB".format(tc_name) step("Random shut of the nexthop interfaces") randnum = random.randint(0, 7) @@ -815,8 +836,11 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ebgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \n" \ - "Error: Routes are still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \n" "Error: Routes are still present in RIB".format( + tc_name + ) step("Random no shut of the nexthop interfaces") for addr_type in ADDR_TYPES: @@ -826,8 +850,9 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_5, next_hop=nhip, protocol=protocol ) - assert result is True, "Testcase {} : Failed \n" \ - "Error: Routes are missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \n" "Error: Routes are missing in RIB".format(tc_name) dut = "r2" protocol = "static" @@ -955,8 +980,9 @@ def test_static_route_8nh_diff_AD_ebgp_ecmp_p1_tc8_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) nh = [] for nhp in range(2, 9): @@ -971,8 +997,9 @@ def test_static_route_8nh_diff_AD_ebgp_ecmp_p1_tc8_ebgp(request): fib=True, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes " \ - " are missing in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes " " are missing in RIB".format(tc_name) step( "Remove the static route configured with nexthop N1 to N8, one" @@ -1015,8 +1042,11 @@ def test_static_route_8nh_diff_AD_ebgp_ecmp_p1_tc8_ebgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes are" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes are" " still present in RIB".format( + tc_name + ) step("Configure the static route with nexthop N1 to N8, one by one") @@ -1062,8 +1092,9 @@ def test_static_route_8nh_diff_AD_ebgp_ecmp_p1_tc8_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) nh = [] for nhp in range(2, 9): nh.append(NEXT_HOP_IP["nh" + str(nhp)][addr_type]) @@ -1077,8 +1108,9 @@ def test_static_route_8nh_diff_AD_ebgp_ecmp_p1_tc8_ebgp(request): fib=True, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes " \ - " are missing in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes " " are missing in RIB".format(tc_name) step("Random shut of the nexthop interfaces") randnum = random.randint(0, 7) @@ -1105,8 +1137,11 @@ def test_static_route_8nh_diff_AD_ebgp_ecmp_p1_tc8_ebgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \n" \ - "Error: Routes are still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \n" "Error: Routes are still present in RIB".format( + tc_name + ) step("Random no shut of the nexthop interfaces") for addr_type in ADDR_TYPES: @@ -1116,8 +1151,9 @@ def test_static_route_8nh_diff_AD_ebgp_ecmp_p1_tc8_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_5, next_hop=nhip, protocol=protocol ) - assert result is True, "Testcase {} : Failed \n" \ - "Error: Routes are missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \n" "Error: Routes are missing in RIB".format(tc_name) dut = "r2" protocol = "static" @@ -1230,8 +1266,9 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) step("Verify that highest AD nexthop are inactive") nh = [] @@ -1249,8 +1286,9 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ebgp(request): wait=2, attempts=3, ) - assert result is not True, "Testcase {} : Failed \nError: Routes " \ - " are missing in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes " " are missing in RIB".format(tc_name) step("Configure redistribute static in BGP on R2 router") for addr_type in ADDR_TYPES: @@ -1312,8 +1350,11 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ebgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes are" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes are" " still present in RIB".format( + tc_name + ) step("Configure the static route with nexthop N1 to N8, one by one") for addr_type in ADDR_TYPES: @@ -1355,8 +1396,10 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Route with " \ - "lowest AD is missing in RIB".format(tc_name) + assert result is True, ( + "Testcase {} : Failed \nError: Route with " + "lowest AD is missing in RIB".format(tc_name) + ) step("Random shut of the nexthop interfaces") randnum = random.randint(0, 7) @@ -1383,8 +1426,11 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ebgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \n" \ - "Error: Routes are still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \n" "Error: Routes are still present in RIB".format( + tc_name + ) step("Random no shut of the nexthop interfaces") for addr_type in ADDR_TYPES: @@ -1394,8 +1440,9 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_5, next_hop=nhip, protocol=protocol ) - assert result is True, "Testcase {} : Failed \n" \ - "Error: Routes are missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \n" "Error: Routes are missing in RIB".format(tc_name) step("Remove random static route with all the nexthop") for addr_type in ADDR_TYPES: @@ -1434,8 +1481,10 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ebgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Route " \ - " is still present in RIB".format(tc_name) + assert result is not True, ( + "Testcase {} : Failed \nError: Route " + " is still present in RIB".format(tc_name) + ) step("Reconfigure the deleted routes and verify they are installed") for nhp in range(1, 9): @@ -1460,8 +1509,10 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ebgp(request): protocol = "static" nh = NEXT_HOP_IP["nh1"][addr_type] result = verify_rib(tgen, addr_type, dut, input_dict_4, protocol=protocol) - assert result is True, "Testcase {} : Failed \nError: Route " \ - " is still present in RIB".format(tc_name) + assert result is True, ( + "Testcase {} : Failed \nError: Route " + " is still present in RIB".format(tc_name) + ) step("Reload the FRR router") # stop/start -> restart FRR router and verify @@ -1577,8 +1628,9 @@ def test_static_route_delete_p0_tc11_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) step("Verify that highest AD nexthop are inactive") nh = [] @@ -1594,8 +1646,9 @@ def test_static_route_delete_p0_tc11_ebgp(request): fib=True, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes " \ - " are missing in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes " " are missing in RIB".format(tc_name) step("Configure redistribute static in BGP on R2 router") for addr_type in ADDR_TYPES: @@ -1647,8 +1700,11 @@ def test_static_route_delete_p0_tc11_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, protocol=protocol, expected=False ) - assert result is not True, "Testcase {} : Failed \nError: Routes are" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes are" " still present in RIB".format( + tc_name + ) for addr_type in ADDR_TYPES: for nhp in range(1, 9): @@ -1715,8 +1771,11 @@ def test_static_route_delete_p0_tc11_ebgp(request): fib=True, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes are" \ - " still active in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes are" " still active in RIB".format( + tc_name + ) write_test_footer(tc_name) diff --git a/tests/topotests/static_routing_with_ebgp/test_static_routes_topo3_ebgp.py b/tests/topotests/static_routing_with_ebgp/test_static_routes_topo3_ebgp.py index 6aaa2c0209..8525e3655c 100644 --- a/tests/topotests/static_routing_with_ebgp/test_static_routes_topo3_ebgp.py +++ b/tests/topotests/static_routing_with_ebgp/test_static_routes_topo3_ebgp.py @@ -297,8 +297,9 @@ def test_staticroute_with_ecmp_p0_tc3_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) step("Configure redistribute static in BGP on R2 router") for addr_type in ADDR_TYPES: input_dict_2 = { @@ -351,8 +352,11 @@ def test_staticroute_with_ecmp_p0_tc3_ebgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes are" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes are" " still present in RIB".format( + tc_name + ) step("Configure the static route with nexthop N1 to N8, one by" "one") @@ -379,8 +383,9 @@ def test_staticroute_with_ecmp_p0_tc3_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) step("Random shut of the nexthop interfaces") randnum = random.randint(0, 7) @@ -407,8 +412,11 @@ def test_staticroute_with_ecmp_p0_tc3_ebgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \n" \ - "Error: Routes are still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \n" "Error: Routes are still present in RIB".format( + tc_name + ) step("Random no shut of the nexthop interfaces") for addr_type in ADDR_TYPES: @@ -418,8 +426,9 @@ def test_staticroute_with_ecmp_p0_tc3_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_5, next_hop=nhip, protocol=protocol ) - assert result is True, "Testcase {} : Failed \n" \ - "Error: Routes are missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \n" "Error: Routes are missing in RIB".format(tc_name) step("Reload the FRR router") # stop/start -> restart FRR router and verify @@ -429,8 +438,9 @@ def test_staticroute_with_ecmp_p0_tc3_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) write_test_footer(tc_name) @@ -509,8 +519,10 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Route with " \ - " lowest AD is missing in RIB".format(tc_name) + assert result is True, ( + "Testcase {} : Failed \nError: Route with " + " lowest AD is missing in RIB".format(tc_name) + ) nh = [] for nhp in range(2, 9): @@ -525,8 +537,10 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ebgp(request): fib=True, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes " \ - " with high AD are active in RIB".format(tc_name) + assert result is not True, ( + "Testcase {} : Failed \nError: Routes " + " with high AD are active in RIB".format(tc_name) + ) step("Configure redistribute static in BGP on R2 router") for addr_type in ADDR_TYPES: @@ -569,8 +583,10 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Route with " \ - " lowest AD is missing in RIB".format(tc_name) + assert result is True, ( + "Testcase {} : Failed \nError: Route with " + " lowest AD is missing in RIB".format(tc_name) + ) step( "Remove the static route configured with nexthop N1 to N8, one" @@ -613,8 +629,11 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ebgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes are" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes are" " still present in RIB".format( + tc_name + ) step("Configure the static route with nexthop N1 to N8, one by" "one") for addr_type in ADDR_TYPES: @@ -655,8 +674,10 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Route with " \ - " lowest AD is missing in RIB".format(tc_name) + assert result is True, ( + "Testcase {} : Failed \nError: Route with " + " lowest AD is missing in RIB".format(tc_name) + ) nh = [] for nhp in range(2, 9): @@ -671,8 +692,10 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ebgp(request): fib=True, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes " \ - " with high AD are active in RIB".format(tc_name) + assert result is not True, ( + "Testcase {} : Failed \nError: Routes " + " with high AD are active in RIB".format(tc_name) + ) step("Random shut of the nexthop interfaces") randnum = random.randint(0, 7) @@ -699,8 +722,11 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ebgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \n" \ - "Error: Routes are still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \n" "Error: Routes are still present in RIB".format( + tc_name + ) step("Random no shut of the nexthop interfaces") for addr_type in ADDR_TYPES: @@ -710,8 +736,9 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_5, next_hop=nhip, protocol=protocol ) - assert result is True, "Testcase {} : Failed \n" \ - "Error: Routes are missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \n" "Error: Routes are missing in RIB".format(tc_name) step("Reload the FRR router") # stop/start -> restart FRR router and verify @@ -740,8 +767,10 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Route with " \ - " lowest AD is missing in RIB".format(tc_name) + assert result is True, ( + "Testcase {} : Failed \nError: Route with " + " lowest AD is missing in RIB".format(tc_name) + ) nh = [] for nhp in range(2, 9): @@ -756,8 +785,10 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ebgp(request): fib=True, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes " \ - " with high AD are active in RIB".format(tc_name) + assert result is not True, ( + "Testcase {} : Failed \nError: Routes " + " with high AD are active in RIB".format(tc_name) + ) write_test_footer(tc_name) @@ -818,18 +849,25 @@ def test_bgp_local_nexthop_p1_tc14_ebgp(request): step("Verify R2 BGP table has IPv4 route") dut = "r2" result = verify_rib(tgen, addr_type, dut, input_dict_4) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - " missing in RIB of R2".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" " missing in RIB of R2".format( + tc_name + ) step(" Verify route did not install in the R3 BGP table, RIB/FIB") dut = "r3" result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4, expected=False) - assert result is not True, "Testcase {} : Failed \nError: Routes is" \ - " still present in BGP RIB of R2".format(tc_name) + assert result is not True, ( + "Testcase {} : Failed \nError: Routes is" + " still present in BGP RIB of R2".format(tc_name) + ) result = verify_rib(tgen, addr_type, dut, input_dict_4, expected=False) - assert result is not True, "Testcase {} : Failed \nError: Routes is" \ - " still present in RIB of R2".format(tc_name) + assert result is not True, ( + "Testcase {} : Failed \nError: Routes is" + " still present in RIB of R2".format(tc_name) + ) write_test_footer(tc_name) @@ -889,8 +927,9 @@ def test_frr_intf_name_as_gw_gap_tc4_ebgp_p0(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, protocol=protocol, next_hop=nh ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name) input_dict_nh = { "r1": { @@ -902,8 +941,9 @@ def test_frr_intf_name_as_gw_gap_tc4_ebgp_p0(request): } } result = verify_ip_nht(tgen, input_dict_nh) - assert result is True, "Testcase {} : Failed \nError: Nexthop is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Nexthop is" " missing in RIB".format(tc_name) step( "Shut / no shut IPv4 and IPv6 static next hop interface from" @@ -925,8 +965,9 @@ def test_frr_intf_name_as_gw_gap_tc4_ebgp_p0(request): next_hop=nh, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes is" \ - " missing in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name) shutdown_bringup_interface(tgen, dut, intf, True) @@ -970,8 +1011,11 @@ def test_frr_intf_name_as_gw_gap_tc4_ebgp_p0(request): next_hop=nh, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes" " still present in RIB".format( + tc_name + ) write_test_footer(tc_name) @@ -1034,8 +1078,9 @@ def test_static_route_with_tag_p0_tc_13_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) step("Configure route-map on R2 with allow tag1 and deny tag2") @@ -1116,8 +1161,10 @@ def test_static_route_with_tag_p0_tc_13_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_0, protocol=protocol, expected=False ) - assert result is not True, "Testcase {} : Failed \nError: Route with " \ - "tag 4002 is still present in RIB".format(tc_name) + assert result is not True, ( + "Testcase {} : Failed \nError: Route with " + "tag 4002 is still present in RIB".format(tc_name) + ) dut = "r2" input_dict_1 = { @@ -1125,8 +1172,10 @@ def test_static_route_with_tag_p0_tc_13_ebgp(request): } result = verify_rib(tgen, addr_type, dut, input_dict_0, protocol=protocol) - assert result is True, "Testcase {} : Failed \nError: Route with " \ - "tag 4001 is missing in RIB".format(tc_name) + assert result is True, ( + "Testcase {} : Failed \nError: Route with " + "tag 4001 is missing in RIB".format(tc_name) + ) step("Modify the route-map to allow tag2 and deny tag1") # Create route map @@ -1164,8 +1213,10 @@ def test_static_route_with_tag_p0_tc_13_ebgp(request): } result = verify_rib(tgen, addr_type, dut, input_dict_0, protocol=protocol) - assert result is True, "Testcase {} : Failed \nError: Route with " \ - "tag 4002 is missing in RIB".format(tc_name) + assert result is True, ( + "Testcase {} : Failed \nError: Route with " + "tag 4002 is missing in RIB".format(tc_name) + ) input_dict_1 = { "r2": {"static_routes": [{"network": NETWORK[addr_type], "tag": 4001}]} @@ -1173,8 +1224,10 @@ def test_static_route_with_tag_p0_tc_13_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_1, protocol=protocol, expected=False ) - assert result is not True, "Testcase {} : Failed \nError: Route with " \ - "tag 4001 is still present in RIB".format(tc_name) + assert result is not True, ( + "Testcase {} : Failed \nError: Route with " + "tag 4001 is still present in RIB".format(tc_name) + ) step("Configure one static route with 2 ECMP nexthop N1 and N2") step("For N1 configure tag 1 and for N2 configure tag 2") @@ -1213,8 +1266,9 @@ def test_static_route_with_tag_p0_tc_13_ebgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) step("shut/no shut of tag1 and tag2 nexthop") 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 9a597484d9..812b39797f 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 @@ -88,6 +88,7 @@ NEXT_HOP_IP = {} pytestmark = [pytest.mark.bgpd, pytest.mark.staticd] + class CreateTopo(Topo): """ Test CreateTopo - topology 1. @@ -239,8 +240,11 @@ def test_static_routes_rmap_pfxlist_p0_tc7_ebgp(request): step(" All BGP nbrs are down as authentication is mismatch on both" " the sides") bgp_convergence = verify_bgp_convergence(tgen, topo, expected=False) - assert bgp_convergence is not True, "Testcase {} : " \ - "Failed \n BGP nbrs must be down. Error: {}".format(tc_name, bgp_convergence) + assert ( + bgp_convergence is not True + ), "Testcase {} : " "Failed \n BGP nbrs must be down. Error: {}".format( + tc_name, bgp_convergence + ) step( "Configure 4 IPv4 and 4 IPv6 nbrs with macthing password " @@ -335,8 +339,9 @@ def test_static_routes_rmap_pfxlist_p0_tc7_ebgp(request): "show ip prefix list" ) result = verify_prefix_lists(tgen, input_dict_2) - assert result is not True, "Testcase {} : Failed \n" \ - " Error: {}".format(tc_name, result) + assert result is not True, "Testcase {} : Failed \n" " Error: {}".format( + tc_name, result + ) step("Redistribute all the routes (connected, static)") input_dict_2_r1 = { @@ -586,8 +591,10 @@ def test_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 , VM1 route is " \ - "not filtered out via prefix list. \n Error: {}".format(tc_name, result4) + assert result4 is not True, ( + "Testcase {} : Failed , VM1 route is " + "not filtered out via prefix list. \n Error: {}".format(tc_name, result4) + ) step( "VM4 and VM6 IPV4 and IPv6 address are present in local and " @@ -962,8 +969,10 @@ def test_static_routes_rmap_pfxlist_p0_tc7_ebgp(request): ) input_dict = {"r1": {"static_routes": [{"network": ntwk_r2_vm1}]}} result4 = verify_rib(tgen, addr_type, dut, input_dict) - assert result4 is True, "Testcase {} : Failed , VM1 route is " \ - "not filtered out via prefix list. \n Error: {}".format(tc_name, result4) + assert result4 is True, ( + "Testcase {} : Failed , VM1 route is " + "not filtered out via prefix list. \n Error: {}".format(tc_name, result4) + ) step("vm4 should be present in FRR2") dut = "r2" @@ -974,8 +983,10 @@ def test_static_routes_rmap_pfxlist_p0_tc7_ebgp(request): ) input_dict = {"r1": {"static_routes": [{"network": ntwk_r2_vm1}]}} result4 = verify_rib(tgen, addr_type, dut, input_dict) - assert result4 is True, "Testcase {} : Failed , VM1 route is " \ - "not filtered out via prefix list. \n Error: {}".format(tc_name, result4) + assert result4 is True, ( + "Testcase {} : Failed , VM1 route is " + "not filtered out via prefix list. \n Error: {}".format(tc_name, result4) + ) dut = "r3" protocol = "bgp" diff --git a/tests/topotests/static_routing_with_ibgp/test_static_routes_topo1_ibgp.py b/tests/topotests/static_routing_with_ibgp/test_static_routes_topo1_ibgp.py index 790b16bc75..4e23a72423 100644 --- a/tests/topotests/static_routing_with_ibgp/test_static_routes_topo1_ibgp.py +++ b/tests/topotests/static_routing_with_ibgp/test_static_routes_topo1_ibgp.py @@ -242,8 +242,9 @@ def test_static_route_2nh_p0_tc_1_ibgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name) step("Configure IBGP IPv4 peering between R2 and R3 router.") step("Configure redistribute static in BGP on R2 router") @@ -296,15 +297,19 @@ def test_static_route_2nh_p0_tc_1_ibgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes is" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes is" " still present in RIB".format( + tc_name + ) nh = [NEXT_HOP_IP["nh2"][addr_type]] result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name) step("Configure the static route with nexthop N1") @@ -359,15 +364,19 @@ def test_static_route_2nh_p0_tc_1_ibgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes is" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes is" " still present in RIB".format( + tc_name + ) nh = [NEXT_HOP_IP["nh1"][addr_type]] result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name) step("Configure the static route with nexthop N2") input_dict_4 = { @@ -398,8 +407,9 @@ def test_static_route_2nh_p0_tc_1_ibgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name) nh = NEXT_HOP_IP["nh1"][addr_type] result = verify_rib( @@ -411,15 +421,21 @@ def test_static_route_2nh_p0_tc_1_ibgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes is" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes is" " still present in RIB".format( + tc_name + ) dut = "r3" result = verify_bgp_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, expected=False ) - assert result is not True, "Testcase {} : Failed \nError: Route is" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Route is" " still present in RIB".format( + tc_name + ) result = verify_rib( tgen, @@ -430,27 +446,35 @@ def test_static_route_2nh_p0_tc_1_ibgp(request): next_hop=nh, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Route is" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Route is" " still present in RIB".format( + tc_name + ) dut = "r2" nh = [NEXT_HOP_IP["nh2"][addr_type]] result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name) dut = "r3" result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4) - assert result is True, "Testcase {} : Failed \nError: Route is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Route is" " missing in RIB".format(tc_name) result = verify_rib( tgen, addr_type, dut, input_dict_4, protocol=protocol, expected=False ) - assert result is not True, "Testcase {} : Failed \nError: Route is" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Route is" " still present in RIB".format( + tc_name + ) dut = "r2" step("No shut the nexthop interface N1") @@ -465,8 +489,9 @@ def test_static_route_2nh_p0_tc_1_ibgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name) step("Shut nexthop interface N2") intf = topo["routers"]["r2"]["links"]["r1-link1"]["interface"] @@ -488,8 +513,11 @@ def test_static_route_2nh_p0_tc_1_ibgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes is" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes is" " still present in RIB".format( + tc_name + ) nh = [NEXT_HOP_IP["nh1"][addr_type]] dut = "r2" @@ -497,19 +525,24 @@ def test_static_route_2nh_p0_tc_1_ibgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name) dut = "r3" result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4) - assert result is True, "Testcase {} : Failed \nError: Route is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Route is" " missing in RIB".format(tc_name) result = verify_rib( tgen, addr_type, dut, input_dict_4, protocol=protocol, expected=False ) - assert result is not True, "Testcase {} : Failed \nError: Route is" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Route is" " still present in RIB".format( + tc_name + ) step("No shut nexthop interface N2") dut = "r2" @@ -524,19 +557,24 @@ def test_static_route_2nh_p0_tc_1_ibgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name) dut = "r3" result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4) - assert result is True, "Testcase {} : Failed \nError: Route is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Route is" " missing in RIB".format(tc_name) result = verify_rib( tgen, addr_type, dut, input_dict_4, protocol=protocol, expected=False ) - assert result is not True, "Testcase {} : Failed \nError: Route is" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Route is" " still present in RIB".format( + tc_name + ) step("Reload the FRR router") # stop/start -> restart FRR router and verify @@ -552,19 +590,26 @@ def test_static_route_2nh_p0_tc_1_ibgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name) dut = "r3" result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4) - assert result is True, "Testcase {} : Failed \nError: Route is" \ - " still present in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Route is" " still present in RIB".format( + tc_name + ) result = verify_rib( tgen, addr_type, dut, input_dict_4, protocol=protocol, expected=False ) - assert result is not True, "Testcase {} : Failed \nError: Route is" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Route is" " still present in RIB".format( + tc_name + ) write_test_footer(tc_name) @@ -636,8 +681,9 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request): result = verify_rib( tgen, addr_type, dut, rte1_nh1, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - "missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" "missing in RIB".format(tc_name) rte2_nh2 = { "r2": { @@ -663,8 +709,9 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request): fib=True, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes is" \ - "not active in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name) step("Configure IBGP IPv4 peering between R2 and R3 router.") step("Explicit route is added in R3 for R2 nexthop rechability") @@ -753,8 +800,9 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request): fib=True, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes is" \ - "missing in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes is" "missing in RIB".format(tc_name) rte2_nh2 = { "r2": { @@ -771,8 +819,9 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request): result = verify_rib( tgen, addr_type, dut, rte2_nh2, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - "not active in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name) step("Configure the static route with nexthop N1") rte1_nh1 = { @@ -825,15 +874,19 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes is" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes is" " still present in RIB".format( + tc_name + ) nh = [NEXT_HOP_IP["nh1"][addr_type]] result = verify_rib( tgen, addr_type, dut, rte1_nh1, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name) step("Configure the static route with nexthop N2") rte2_nh2 = { @@ -871,15 +924,19 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes is" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes is" " still present in RIB".format( + tc_name + ) nh = [NEXT_HOP_IP["nh2"][addr_type]] result = verify_rib( tgen, addr_type, dut, rte2_nh2, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name) step("No shut the nexthop interface N1") shutdown_bringup_interface(tgen, dut, intf, True) @@ -893,8 +950,9 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request): result = verify_rib( tgen, addr_type, dut, rte1_nh1, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name) step("Shut nexthop interface N2") intf = topo["routers"]["r2"]["links"]["r1-link1"]["interface"] @@ -916,15 +974,19 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes is" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes is" " still present in RIB".format( + tc_name + ) nh = [NEXT_HOP_IP["nh1"][addr_type]] result = verify_rib( tgen, addr_type, dut, rte1_nh1, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name) step("No shut nexthop interface N2") shutdown_bringup_interface(tgen, dut, intf, True) @@ -950,8 +1012,9 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request): result = verify_rib( tgen, addr_type, dut, rte1_nh1, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - "missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" "missing in RIB".format(tc_name) rte2_nh2 = { "r2": { @@ -977,8 +1040,9 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request): fib=True, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes is" \ - "not active in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name) dut = "r3" protocol = "bgp" @@ -993,8 +1057,9 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request): fib=True, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes is" \ - "not active in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name) dut = "r2" step("Reload the FRR router") @@ -1024,14 +1089,16 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request): result = verify_rib( tgen, addr_type, dut, rte1_nh1, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - "missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" "missing in RIB".format(tc_name) dut = "r3" protocol = "bgp" result = verify_bgp_rib(tgen, addr_type, dut, rte1_nh1, next_hop=nh) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - "missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" "missing in RIB".format(tc_name) rte2_nh2 = { "r2": { @@ -1057,14 +1124,16 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request): fib=True, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes is" \ - "not active in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name) dut = "r3" protocol = "bgp" result = verify_bgp_rib(tgen, addr_type, dut, rte2_nh2, next_hop=nh) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - "not active in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name) result = verify_rib( tgen, @@ -1076,8 +1145,9 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request): fib=True, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes is" \ - "not active in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name) write_test_footer(tc_name) diff --git a/tests/topotests/static_routing_with_ibgp/test_static_routes_topo2_ibgp.py b/tests/topotests/static_routing_with_ibgp/test_static_routes_topo2_ibgp.py index 738d1e6e3a..ee0e01b411 100644 --- a/tests/topotests/static_routing_with_ibgp/test_static_routes_topo2_ibgp.py +++ b/tests/topotests/static_routing_with_ibgp/test_static_routes_topo2_ibgp.py @@ -318,8 +318,9 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ibgp(request): next_hop=nh_all[addr_type], protocol=protocol, ) - assert result is True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) step("Configure redistribute static in BGP on R2 router") for addr_type in ADDR_TYPES: @@ -342,8 +343,9 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ibgp(request): dut = "r3" protocol = "bgp" result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4) - assert result is True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) step( "Remove the static route configured with nexthop N1 to N8, one" @@ -388,8 +390,11 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ibgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed\nError: Routes is" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed\nError: Routes is" " still present in RIB".format( + tc_name + ) step("Configure the static route with nexthop N1 to N8, one by one") for addr_type in ADDR_TYPES: @@ -414,8 +419,11 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ibgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed\nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed\nError: Routes are" " missing in RIB".format( + tc_name + ) protocol = "static" step("Random shut of the nexthop interfaces") @@ -459,8 +467,9 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ibgp(request): next_hop=nh_all[addr_type], protocol=protocol, ) - assert result is True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) step("Remove random static route with all the nexthop") dut = "r2" @@ -497,8 +506,9 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ibgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) for addr_type in ADDR_TYPES: input_dict_4 = { @@ -550,8 +560,9 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ibgp(request): next_hop=nh_all[addr_type], protocol=protocol, ) - assert result is True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) step("Remove the redistribute static knob") for addr_type in ADDR_TYPES: @@ -584,8 +595,11 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ibgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, protocol=protocol, expected=False ) - assert result is not True, "Testcase {} : Failed \nError: Routes are" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes are" " still present in RIB".format( + tc_name + ) write_test_footer(tc_name) @@ -665,8 +679,9 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ibgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) nh = [] for nhp in range(2, 9): @@ -683,8 +698,9 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ibgp(request): wait=2, attempts=3, ) - assert result is not True, "Testcase {} : Failed \nError: Routes " \ - " are missing in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes " " are missing in RIB".format(tc_name) step( "Remove the static route configured with nexthop N1 to N8, one" @@ -727,8 +743,11 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ibgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes are" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes are" " still present in RIB".format( + tc_name + ) step("Configure the static route with nexthop N1 to N8, one by one") @@ -774,8 +793,9 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ibgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) nh = [] for nhp in range(2, 9): nh.append(NEXT_HOP_IP["nh" + str(nhp)][addr_type]) @@ -791,8 +811,9 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ibgp(request): wait=2, attempts=3, ) - assert result is not True, "Testcase {} : Failed \nError: Routes " \ - " are missing in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes " " are missing in RIB".format(tc_name) step("Random shut of the nexthop interfaces") randnum = random.randint(0, 7) @@ -819,8 +840,11 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ibgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \n" \ - "Error: Routes are still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \n" "Error: Routes are still present in RIB".format( + tc_name + ) step("Random no shut of the nexthop interfaces") for addr_type in ADDR_TYPES: @@ -830,8 +854,9 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ibgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_5, next_hop=nhip, protocol=protocol ) - assert result is True, "Testcase {} : Failed \n" \ - "Error: Routes are missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \n" "Error: Routes are missing in RIB".format(tc_name) protocol = "bgp" # this is next hop reachability route in r3 as we are using ibgp @@ -856,8 +881,9 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ibgp(request): for addr_type in ADDR_TYPES: input_dict_4 = {"r2": {"static_routes": [{"network": PREFIX1[addr_type]}]}} result = verify_rib(tgen, addr_type, dut, input_dict_4, protocol=protocol) - assert result is True, "Testcase {} : Failed \n" \ - "Error: Routes are missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \n" "Error: Routes are missing in RIB".format(tc_name) protocol = "static" dut = "r2" @@ -964,8 +990,10 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ibgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes are" \ - " strill present in RIB of R3".format(tc_name) + assert result is not True, ( + "Testcase {} : Failed \nError: Routes are" + " strill present in RIB of R3".format(tc_name) + ) write_test_footer(tc_name) @@ -1060,8 +1088,9 @@ def test_static_route_8nh_diff_AD_ibgp_ecmp_p1_tc7_ibgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) nh = [] for nhp in range(2, 9): @@ -1076,8 +1105,9 @@ def test_static_route_8nh_diff_AD_ibgp_ecmp_p1_tc7_ibgp(request): fib=True, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes " \ - " are missing in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes " " are missing in RIB".format(tc_name) step( "Remove the static route configured with nexthop N1 to N8, one" @@ -1120,8 +1150,11 @@ def test_static_route_8nh_diff_AD_ibgp_ecmp_p1_tc7_ibgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes are" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes are" " still present in RIB".format( + tc_name + ) step("Configure the static route with nexthop N1 to N8, one by one") @@ -1167,8 +1200,9 @@ def test_static_route_8nh_diff_AD_ibgp_ecmp_p1_tc7_ibgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) nh = [] for nhp in range(2, 9): nh.append(NEXT_HOP_IP["nh" + str(nhp)][addr_type]) @@ -1182,8 +1216,9 @@ def test_static_route_8nh_diff_AD_ibgp_ecmp_p1_tc7_ibgp(request): fib=True, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes " \ - " are missing in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes " " are missing in RIB".format(tc_name) step("Random shut of the nexthop interfaces") randnum = random.randint(0, 7) @@ -1210,8 +1245,11 @@ def test_static_route_8nh_diff_AD_ibgp_ecmp_p1_tc7_ibgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \n" \ - "Error: Routes are still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \n" "Error: Routes are still present in RIB".format( + tc_name + ) step("Random no shut of the nexthop interfaces") for addr_type in ADDR_TYPES: @@ -1221,8 +1259,9 @@ def test_static_route_8nh_diff_AD_ibgp_ecmp_p1_tc7_ibgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_5, next_hop=nhip, protocol=protocol ) - assert result is True, "Testcase {} : Failed \n" \ - "Error: Routes are missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \n" "Error: Routes are missing in RIB".format(tc_name) dut = "r2" protocol = "bgp" @@ -1249,8 +1288,9 @@ def test_static_route_8nh_diff_AD_ibgp_ecmp_p1_tc7_ibgp(request): for addr_type in ADDR_TYPES: input_dict_4 = {"r2": {"static_routes": [{"network": PREFIX1[addr_type]}]}} result = verify_rib(tgen, addr_type, dut, input_dict_4, protocol=protocol) - assert result is True, "Testcase {} : Failed \n" \ - "Error: Routes are missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \n" "Error: Routes are missing in RIB".format(tc_name) protocol = "static" dut = "r2" @@ -1357,8 +1397,10 @@ def test_static_route_8nh_diff_AD_ibgp_ecmp_p1_tc7_ibgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes are" \ - " still present in RIB of R3".format(tc_name) + assert result is not True, ( + "Testcase {} : Failed \nError: Routes are" + " still present in RIB of R3".format(tc_name) + ) write_test_footer(tc_name) @@ -1453,8 +1495,9 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ibgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) step("Verify that highest AD nexthop are inactive") nh = [] @@ -1472,8 +1515,9 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ibgp(request): wait=2, attempts=3, ) - assert result is not True, "Testcase {} : Failed \nError: Routes " \ - " are missing in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes " " are missing in RIB".format(tc_name) step("Configure redistribute static in BGP on R2 router") for addr_type in ADDR_TYPES: @@ -1535,8 +1579,11 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ibgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes are" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes are" " still present in RIB".format( + tc_name + ) step("Configure the static route with nexthop N1 to N8, one by one") for addr_type in ADDR_TYPES: @@ -1578,8 +1625,10 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ibgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Route with " \ - "lowest AD is missing in RIB".format(tc_name) + assert result is True, ( + "Testcase {} : Failed \nError: Route with " + "lowest AD is missing in RIB".format(tc_name) + ) step("Random shut of the nexthop interfaces") randnum = random.randint(0, 7) @@ -1606,8 +1655,11 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ibgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \n" \ - "Error: Routes are still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \n" "Error: Routes are still present in RIB".format( + tc_name + ) step("Random no shut of the nexthop interfaces") for addr_type in ADDR_TYPES: @@ -1617,8 +1669,9 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ibgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_5, next_hop=nhip, protocol=protocol ) - assert result is True, "Testcase {} : Failed \n" \ - "Error: Routes are missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \n" "Error: Routes are missing in RIB".format(tc_name) step("Remove random static route with all the nexthop") for addr_type in ADDR_TYPES: @@ -1657,8 +1710,10 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ibgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Route " \ - " is still present in RIB".format(tc_name) + assert result is not True, ( + "Testcase {} : Failed \nError: Route " + " is still present in RIB".format(tc_name) + ) step("Reconfigure the deleted routes and verify they are installed") for nhp in range(1, 9): @@ -1683,8 +1738,10 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ibgp(request): protocol = "static" nh = NEXT_HOP_IP["nh1"][addr_type] result = verify_rib(tgen, addr_type, dut, input_dict_4, protocol=protocol) - assert result is True, "Testcase {} : Failed \nError: Route " \ - " is still present in RIB".format(tc_name) + assert result is True, ( + "Testcase {} : Failed \nError: Route " + " is still present in RIB".format(tc_name) + ) step("Reload the FRR router") # stop/start -> restart FRR router and verify @@ -1704,9 +1761,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ibgp(request): ) assert ( result is True - ), "Testcase {} : Failed \nError: Route is missing in RIB".format( - tc_name - ) + ), "Testcase {} : Failed \nError: Route is missing in RIB".format(tc_name) step("Remove the redistribute static knob") for addr_type in ADDR_TYPES: @@ -1750,8 +1805,11 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ibgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, protocol=protocol, expected=False ) - assert result is not True, "Testcase {} : Failed \nError: Routes are" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes are" " still present in RIB".format( + tc_name + ) write_test_footer(tc_name) @@ -1845,8 +1903,9 @@ def test_static_route_delete_p0_tc11_ibgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) step("Verify that highest AD nexthop are inactive") nh = [] @@ -1862,8 +1921,9 @@ def test_static_route_delete_p0_tc11_ibgp(request): fib=True, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes " \ - " are missing in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes " " are missing in RIB".format(tc_name) step("Configure redistribute static in BGP on R2 router") for addr_type in ADDR_TYPES: @@ -1915,8 +1975,11 @@ def test_static_route_delete_p0_tc11_ibgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, protocol=protocol, expected=False ) - assert result is not True, "Testcase {} : Failed \nError: Routes are" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes are" " still present in RIB".format( + tc_name + ) for addr_type in ADDR_TYPES: for nhp in range(1, 9): @@ -1983,8 +2046,11 @@ def test_static_route_delete_p0_tc11_ibgp(request): fib=True, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes are" \ - " still active in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes are" " still active in RIB".format( + tc_name + ) write_test_footer(tc_name) diff --git a/tests/topotests/static_routing_with_ibgp/test_static_routes_topo3_ibgp.py b/tests/topotests/static_routing_with_ibgp/test_static_routes_topo3_ibgp.py index 0045bc5c25..c84c88ac35 100644 --- a/tests/topotests/static_routing_with_ibgp/test_static_routes_topo3_ibgp.py +++ b/tests/topotests/static_routing_with_ibgp/test_static_routes_topo3_ibgp.py @@ -298,8 +298,9 @@ def test_staticroute_with_ecmp_p0_tc3_ibgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) step("Configure redistribute static in BGP on R2 router") for addr_type in ADDR_TYPES: input_dict_2 = { @@ -352,8 +353,11 @@ def test_staticroute_with_ecmp_p0_tc3_ibgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes are" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes are" " still present in RIB".format( + tc_name + ) step("Configure the static route with nexthop N1 to N8, one by" "one") @@ -380,8 +384,9 @@ def test_staticroute_with_ecmp_p0_tc3_ibgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) step("Random shut of the nexthop interfaces") randnum = random.randint(0, 7) @@ -408,8 +413,11 @@ def test_staticroute_with_ecmp_p0_tc3_ibgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \n" \ - "Error: Routes are still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \n" "Error: Routes are still present in RIB".format( + tc_name + ) step("Random no shut of the nexthop interfaces") for addr_type in ADDR_TYPES: @@ -419,8 +427,9 @@ def test_staticroute_with_ecmp_p0_tc3_ibgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_5, next_hop=nhip, protocol=protocol ) - assert result is True, "Testcase {} : Failed \n" \ - "Error: Routes are missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \n" "Error: Routes are missing in RIB".format(tc_name) step("Reload the FRR router") # stop/start -> restart FRR router and verify @@ -430,8 +439,9 @@ def test_staticroute_with_ecmp_p0_tc3_ibgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol ) - assert result is True, "Testcase {} : Failed \nError: Routes are" \ - " missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name) write_test_footer(tc_name) @@ -510,8 +520,10 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ibgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Route with " \ - " lowest AD is missing in RIB".format(tc_name) + assert result is True, ( + "Testcase {} : Failed \nError: Route with " + " lowest AD is missing in RIB".format(tc_name) + ) nh = [] for nhp in range(2, 9): @@ -526,8 +538,10 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ibgp(request): fib=True, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes " \ - " with high AD are active in RIB".format(tc_name) + assert result is not True, ( + "Testcase {} : Failed \nError: Routes " + " with high AD are active in RIB".format(tc_name) + ) step("Configure redistribute static in BGP on R2 router") for addr_type in ADDR_TYPES: @@ -570,8 +584,10 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ibgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Route with " \ - " lowest AD is missing in RIB".format(tc_name) + assert result is True, ( + "Testcase {} : Failed \nError: Route with " + " lowest AD is missing in RIB".format(tc_name) + ) step( "Remove the static route configured with nexthop N1 to N8, one" @@ -614,8 +630,11 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ibgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes are" \ - " still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \nError: Routes are" " still present in RIB".format( + tc_name + ) step("Configure the static route with nexthop N1 to N8, one by" "one") for addr_type in ADDR_TYPES: @@ -656,8 +675,10 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ibgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Route with " \ - " lowest AD is missing in RIB".format(tc_name) + assert result is True, ( + "Testcase {} : Failed \nError: Route with " + " lowest AD is missing in RIB".format(tc_name) + ) nh = [] for nhp in range(2, 9): @@ -672,8 +693,10 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ibgp(request): fib=True, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes " \ - " with high AD are active in RIB".format(tc_name) + assert result is not True, ( + "Testcase {} : Failed \nError: Routes " + " with high AD are active in RIB".format(tc_name) + ) step("Random shut of the nexthop interfaces") randnum = random.randint(0, 7) @@ -700,8 +723,11 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ibgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \n" \ - "Error: Routes are still present in RIB".format(tc_name) + assert ( + result is not True + ), "Testcase {} : Failed \n" "Error: Routes are still present in RIB".format( + tc_name + ) step("Random no shut of the nexthop interfaces") for addr_type in ADDR_TYPES: @@ -711,8 +737,9 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ibgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_5, next_hop=nhip, protocol=protocol ) - assert result is True, "Testcase {} : Failed \n" \ - "Error: Routes are missing in RIB".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \n" "Error: Routes are missing in RIB".format(tc_name) step("Reload the FRR router") # stop/start -> restart FRR router and verify @@ -741,8 +768,10 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ibgp(request): result = verify_rib( tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True ) - assert result is True, "Testcase {} : Failed \nError: Route with " \ - " lowest AD is missing in RIB".format(tc_name) + assert result is True, ( + "Testcase {} : Failed \nError: Route with " + " lowest AD is missing in RIB".format(tc_name) + ) nh = [] for nhp in range(2, 9): @@ -757,8 +786,10 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ibgp(request): fib=True, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes " \ - " with high AD are active in RIB".format(tc_name) + assert result is not True, ( + "Testcase {} : Failed \nError: Routes " + " with high AD are active in RIB".format(tc_name) + ) step("Remove the redistribute static knob") @@ -796,8 +827,10 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ibgp(request): protocol=protocol, expected=False, ) - assert result is not True, "Testcase {} : Failed \nError: Routes are" \ - " still present in RIB of R3".format(tc_name) + assert result is not True, ( + "Testcase {} : Failed \nError: Routes are" + " still present in RIB of R3".format(tc_name) + ) write_test_footer(tc_name) @@ -858,18 +891,25 @@ def test_bgp_local_nexthop_p1_tc14_ibgp(request): step("Verify R2 BGP table has IPv4 route") dut = "r2" result = verify_rib(tgen, addr_type, dut, input_dict_4) - assert result is True, "Testcase {} : Failed \nError: Routes is" \ - " missing in RIB of R2".format(tc_name) + assert ( + result is True + ), "Testcase {} : Failed \nError: Routes is" " missing in RIB of R2".format( + tc_name + ) step(" Verify route did not install in the R3 BGP table, RIB/FIB") dut = "r3" result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4, expected=False) - assert result is not True, "Testcase {} : Failed \nError: Routes is" \ - " still present in BGP RIB of R2".format(tc_name) + assert result is not True, ( + "Testcase {} : Failed \nError: Routes is" + " still present in BGP RIB of R2".format(tc_name) + ) result = verify_rib(tgen, addr_type, dut, input_dict_4, expected=False) - assert result is not True, "Testcase {} : Failed \nError: Routes is" \ - " still present in RIB of R2".format(tc_name) + assert result is not True, ( + "Testcase {} : Failed \nError: Routes is" + " still present in RIB of R2".format(tc_name) + ) write_test_footer(tc_name) 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 5014280bf9..a82ee64538 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 @@ -239,8 +239,11 @@ def test_static_routes_rmap_pfxlist_p0_tc7_ibgp(request): step(" All BGP nbrs are down as authentication is mismatch on both" " the sides") bgp_convergence = verify_bgp_convergence(tgen, topo, expected=False) - assert bgp_convergence is not True, "Testcase {} : " \ - "Failed \n BGP nbrs must be down. Error: {}".format(tc_name, bgp_convergence) + assert ( + bgp_convergence is not True + ), "Testcase {} : " "Failed \n BGP nbrs must be down. Error: {}".format( + tc_name, bgp_convergence + ) step( "Configure 4 IPv4 and 4 IPv6 nbrs with macthing password " @@ -335,8 +338,9 @@ def test_static_routes_rmap_pfxlist_p0_tc7_ibgp(request): "show ip prefix list" ) result = verify_prefix_lists(tgen, input_dict_2) - assert result is not True, "Testcase {} : Failed \n" \ - " Error: {}".format(tc_name, result) + assert result is not True, "Testcase {} : Failed \n" " Error: {}".format( + tc_name, result + ) step("Redistribute all the routes (connected, static)") input_dict_2_r1 = { @@ -586,8 +590,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 , VM1 route is " \ - "not filtered out via prefix list. \n Error: {}".format(tc_name, result4) + assert result4 is not True, ( + "Testcase {} : Failed , VM1 route is " + "not filtered out via prefix list. \n Error: {}".format(tc_name, result4) + ) step( "VM4 and VM6 IPV4 and IPv6 address are present in local and " @@ -962,8 +968,10 @@ def test_static_routes_rmap_pfxlist_p0_tc7_ibgp(request): ) input_dict = {"r1": {"static_routes": [{"network": ntwk_r2_vm1}]}} result4 = verify_rib(tgen, addr_type, dut, input_dict) - assert result4 is True, "Testcase {} : Failed , VM1 route is " \ - "not filtered out via prefix list. \n Error: {}".format(tc_name, result4) + assert result4 is True, ( + "Testcase {} : Failed , VM1 route is " + "not filtered out via prefix list. \n Error: {}".format(tc_name, result4) + ) step("vm4 should be present in FRR2") dut = "r2" @@ -974,8 +982,10 @@ def test_static_routes_rmap_pfxlist_p0_tc7_ibgp(request): ) input_dict = {"r1": {"static_routes": [{"network": ntwk_r2_vm1}]}} result4 = verify_rib(tgen, addr_type, dut, input_dict) - assert result4 is True, "Testcase {} : Failed , VM1 route is " \ - "not filtered out via prefix list. \n Error: {}".format(tc_name, result4) + assert result4 is True, ( + "Testcase {} : Failed , VM1 route is " + "not filtered out via prefix list. \n Error: {}".format(tc_name, result4) + ) dut = "r3" protocol = "bgp"