def test_route_map_set_only_no_match_p0(request): """ TC_37: Test add/remove route-maps with multiple set clauses and without any match statement.(Set only) """ tgen = get_topogen() # test case name tc_name = request.node.name write_test_header(tc_name) # Creating configuration from JSON reset_config_on_routers(tgen) for adt in ADDR_TYPES: # Create Static routes input_dict = { "r1": { "static_routes": [ { "network": NETWORK[adt][0], "no_of_ip": 1, "next_hop": NEXT_HOP[adt], } ] } } result = create_static_routes(tgen, input_dict) assert result is True, "Testcase {} : Failed \n Error: {}".format( tc_name, result ) # Api call to redistribute static routes input_dict_1 = { "r1": { "bgp": { "address_family": { "ipv4": { "unicast": { "redistribute": [ {"redist_type": "static"}, {"redist_type": "connected"}, ] } }, "ipv6": { "unicast": { "redistribute": [ {"redist_type": "static"}, {"redist_type": "connected"}, ] } }, } } } } result = create_router_bgp(tgen, topo, input_dict_1) assert result is True, "Testcase {} : Failed \n Error: {}".format( tc_name, result ) # Create route map input_dict_3 = { "r3": { "route_maps": { "rmap_match_pf_1": [ { "action": "permit", "set": {"metric": 50, "locPrf": 150, "weight": 4000}, } ] } } } result = create_route_maps(tgen, input_dict_3) assert result is True, "Testcase {} : Failed \n Error: {}".format( tc_name, result ) # Configure neighbor for route map input_dict_4 = { "r3": { "bgp": { "address_family": { "ipv4": { "unicast": { "neighbor": { "r1": { "dest_link": { "r3": { "route_maps": [ { "name": "rmap_match_pf_1", "direction": "in", } ] } } }, "r4": { "dest_link": { "r3": { "route_maps": [ { "name": "rmap_match_pf_1", "direction": "out", } ] } } }, } } }, "ipv6": { "unicast": { "neighbor": { "r1": { "dest_link": { "r3": { "route_maps": [ { "name": "rmap_match_pf_1", "direction": "in", } ] } } }, "r4": { "dest_link": { "r3": { "route_maps": [ { "name": "rmap_match_pf_1", "direction": "out", } ] } } }, } } }, } } } } result = create_router_bgp(tgen, topo, input_dict_4) assert result is True, "Testcase {} : Failed \n Error: {}".format( tc_name, result ) time.sleep(2) for adt in ADDR_TYPES: input_dict_4 = { "r3": { "route_maps": { "rmap_match_pf_1": [ { "action": "permit", "set": { "metric": 50, }, } ] } } } # Verifying RIB routes static_routes = [NETWORK[adt][0]] result = verify_bgp_attributes( tgen, adt, "r3", static_routes, "rmap_match_pf_1", input_dict_3 ) assert result is True, "Test case {} : Failed \n Error: {}".format( tc_name, result ) result = verify_bgp_attributes( tgen, adt, "r4", static_routes, "rmap_match_pf_1", input_dict_4 ) assert result is True, "Test case {} : Failed \n Error: {}".format( tc_name, result ) logger.info("Testcase " + tc_name + " :Passed \n")
def test_route_map_multiple_seq_different_match_set_clause_p0(request): """ TC_35: Test multiple sequence numbers in a single route-map for different match/set clauses. """ tgen = get_topogen() # test case name tc_name = request.node.name write_test_header(tc_name) # Creating configuration from JSON reset_config_on_routers(tgen) for adt in ADDR_TYPES: # Create Static routes input_dict = { "r1": { "static_routes": [ { "network": NETWORK[adt][0], "no_of_ip": 1, "next_hop": NEXT_HOP[adt], } ] } } result = create_static_routes(tgen, input_dict) assert result is True, "Testcase {} : Failed \n Error: {}".format( tc_name, result ) # Api call to redistribute static routes input_dict_1 = { "r1": { "bgp": { "address_family": { "ipv4": { "unicast": { "redistribute": [ {"redist_type": "static"}, {"redist_type": "connected"}, ] } }, "ipv6": { "unicast": { "redistribute": [ {"redist_type": "static"}, {"redist_type": "connected"}, ] } }, } } } } result = create_router_bgp(tgen, topo, input_dict_1) assert result is True, "Testcase {} : Failed \n Error: {}".format( tc_name, result ) # Create ip prefix list input_dict_2 = { "r3": { "prefix_lists": { "ipv4": { "pf_list_1_ipv4": [ {"seqid": 10, "network": "any", "action": "permit"} ] }, "ipv6": { "pf_list_1_ipv6": [ {"seqid": 100, "network": "any", "action": "permit"} ] }, } } } result = create_prefix_lists(tgen, input_dict_2) assert result is True, "Testcase {} : Failed \n Error: {}".format( tc_name, result ) # Create route map for addr_type in ADDR_TYPES: input_dict_3 = { "r3": { "route_maps": { "rmap_match_pf_1_{}".format(addr_type): [ { "action": "permit", "match": { addr_type: { "prefix_lists": "pf_list_2_{}".format(addr_type) } }, "set": {"path": {"as_num": 500}}, }, { "action": "permit", "match": { addr_type: { "prefix_lists": "pf_list_2_{}".format(addr_type) } }, "set": { "locPrf": 150, }, }, { "action": "permit", "match": { addr_type: { "prefix_lists": "pf_list_1_{}".format(addr_type) } }, "set": {"metric": 50}, }, ] } } } result = create_route_maps(tgen, input_dict_3) assert result is True, "Testcase {} : Failed \n Error: {}".format( tc_name, result ) # Configure neighbor for route map input_dict_4 = { "r3": { "bgp": { "address_family": { "ipv4": { "unicast": { "neighbor": { "r1": { "dest_link": { "r3": { "route_maps": [ { "name": "rmap_match_pf_1_ipv4", "direction": "in", } ] } } }, "r4": { "dest_link": { "r3": { "route_maps": [ { "name": "rmap_match_pf_1_ipv4", "direction": "out", } ] } } }, } } }, "ipv6": { "unicast": { "neighbor": { "r1": { "dest_link": { "r3": { "route_maps": [ { "name": "rmap_match_pf_1_ipv6", "direction": "in", } ] } } }, "r4": { "dest_link": { "r3": { "route_maps": [ { "name": "rmap_match_pf_1_ipv6", "direction": "out", } ] } } }, } } }, } } } } result = create_router_bgp(tgen, topo, input_dict_4) assert result is True, "Testcase {} : Failed \n Error: {}".format( tc_name, result ) for adt in ADDR_TYPES: # Verifying RIB routes dut = "r3" protocol = "bgp" input_dict = { "r3": { "route_maps": { "rmap_match_pf_list1": [ { "set": { "metric": 50, } } ], } } } static_routes = [NETWORK[adt][0]] time.sleep(2) result = verify_bgp_attributes( tgen, adt, dut, static_routes, "rmap_match_pf_list1", input_dict ) assert result is True, "Test case {} : Failed \n Error: {}".format( tc_name, result ) dut = "r4" result = verify_bgp_attributes( tgen, adt, dut, static_routes, "rmap_match_pf_list1", input_dict ) assert result is True, "Test case {} : Failed \n Error: {}".format( tc_name, result ) logger.info("Testcase " + tc_name + " :Passed \n")
def test_modify_route_map_match_set_clauses_p1(request): """ TC13_CHAOS_4: 1.5.13. Verify that Changing route-map configurations(match/set clauses) on the fly it takes immediate effect. """ tgen = get_topogen() tc_name = request.node.name write_test_header(tc_name) build_config_from_json(tgen, topo) if tgen.routers_have_failure(): check_router_status(tgen) for addr_type in ADDR_TYPES: step("Configure route-map to set community attribute for a specific" "prefix on R1 in vrf ISR") input_dict_pf = { "r1": { "prefix_lists": { addr_type: { "pflist_ABC_{}".format(addr_type): [{ "seqid": 10, "network": NETWORK1_1[addr_type], "action": "permit", }] } } } } result = create_prefix_lists(tgen, input_dict_pf) assert result is True, "Testcase {} : Failed \n Error: {}".format( tc_name, result) input_dict_cl = { "r1": { "bgp_community_lists": [{ "community_type": "expanded", "action": "permit", "name": "COMM", "value": "100:100", }] } } result = create_bgp_community_lists(tgen, input_dict_cl) assert result is True, "Testcase {} : Failed \n Error: {}".format( tc_name, result) for addr_type in ADDR_TYPES: input_dict_rm = { "r1": { "route_maps": { "rmap_XYZ_{}".format(addr_type): [{ "action": "permit", "match": { addr_type: { "prefix_lists": "pflist_ABC_{}".format(addr_type) } }, "set": { "community": { "num": "100:100" } }, }] } } } result = create_route_maps(tgen, input_dict_rm) assert result is True, "Testcase {} : Failed \n Error: {}".format( tc_name, result) for addr_type in ADDR_TYPES: step("Apply this route-map on R1 to vrf ISR while redistributing the" " prefixes into BGP") input_dict_1 = {} DUT = ["r1"] VRFS = ["ISR"] AS_NUM = [100] for dut, vrf, as_num in zip(DUT, VRFS, AS_NUM): temp = {dut: {"bgp": []}} input_dict_1.update(temp) temp[dut]["bgp"].append({ "local_as": as_num, "vrf": vrf, "address_family": { addr_type: { "unicast": { "redistribute": [{ "redist_type": "static", "attribute": { "route-map": "rmap_XYZ_{}".format(addr_type) }, }] } } }, }) result = create_router_bgp(tgen, topo, input_dict_1) assert result is True, "Testcase {} :Failed \n Error: {}".format( tc_name, result) for addr_type in ADDR_TYPES: step("Configure another route-map for filtering the prefixes based on" " community attribute while importing into default vrf") input_dict_rm = { "r1": { "route_maps": { "rmap_IMP_{}".format(addr_type): [{ "action": "permit", "seq_id": 10, "match": { "community_list": { "id": "COMM" } }, "set": { "community": { "num": "none" } }, }] } } } result = create_route_maps(tgen, input_dict_rm) assert result is True, "Testcase {} : Failed \n Error: {}".format( tc_name, result) for addr_type in ADDR_TYPES: step("Apply the route-map while Importing vrf ISR's prefixes into " "default vrf on router R1:") input_dict_isr = {} DUT = ["r1"] VRFS = ["default"] AS_NUM = [100] for dut, vrf, as_num in zip(DUT, VRFS, AS_NUM): temp = {dut: {"bgp": []}} input_dict_isr.update(temp) temp[dut]["bgp"].append({ "local_as": as_num, "vrf": vrf, "address_family": { addr_type: { "unicast": { "import": { "vrf": "ISR" } } } }, }) temp[dut]["bgp"].append({ "local_as": as_num, "vrf": vrf, "address_family": { addr_type: { "unicast": { "import": { "vrf": "route-map rmap_IMP_{}".format(addr_type) } } } }, }) result = create_router_bgp(tgen, topo, input_dict_isr) assert result is True, "Testcase {} : Failed \n Error: {}".format( tc_name, result) for addr_type in ADDR_TYPES: step("Verify on R1 that only prefixes with community value 100:100" "in vrf ISR are imported to vrf default. While importing, the" " community value has been stripped off:") input_routes_r1 = { "r1": { "static_routes": [{ "network": [NETWORK1_1[addr_type]], "vrf": "default" }] } } result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1) assert result is True, "Testcase {} : Failed \n Error {}".format( tc_name, result) for addr_type in ADDR_TYPES: step("Add set clause in route-map IMP:") input_dict_rm = { "r1": { "route_maps": { "rmap_IMP_{}".format(addr_type): [{ "action": "permit", "seq_id": 10, "match": { "community_list": { "id": "COMM" } }, "set": { "large_community": { "num": "100:100:100" }, "locPrf": 500, "path": { "as_num": "100 100", "as_action": "prepend" }, }, }] } } } result = create_route_maps(tgen, input_dict_rm) assert result is True, "Testcase {} : Failed \n Error: {}".format( tc_name, result) for addr_type in ADDR_TYPES: step("Verify that as we continue adding different attributes " "step-by-step in route-map IMP those attributes gets " "attached to prefixes:") input_routes_r1 = { "r1": { "static_routes": [{ "network": [NETWORK1_1[addr_type]], "vrf": "default" }] } } input_dict_comm = {"largeCommunity": "100:100:100"} result = verify_bgp_community(tgen, addr_type, dut, [NETWORK1_1[addr_type]], input_dict_comm) assert result is True, "Testcase {} : Failed \n Error {}".format( tc_name, result) input_rmap = { "r1": { "route_maps": { "rmap_IMP_{}".format(addr_type): [{ "set": { "locPrf": 500 } }] } } } result = verify_bgp_attributes( tgen, addr_type, "r1", [NETWORK1_1[addr_type]], rmap_name="rmap_IMP_{}".format(addr_type), input_dict=input_rmap, ) assert result is True, "Testcase : Failed \n Error: {}".format( tc_name, result) step("Change community-list to match a different value then " "100:100.") input_dict_cl = { "r1": { "bgp_community_lists": [{ "community_type": "expanded", "action": "permit", "name": "COMM", "value": "100:100", "delete": True, }] } } result = create_bgp_community_lists(tgen, input_dict_cl) assert result is True, "Testcase {} : Failed \n Error: {}".format( tc_name, result) for addr_type in ADDR_TYPES: input_routes_r1 = { "r1": { "static_routes": [{ "network": [NETWORK1_1[addr_type]], "vrf": "default" }] } } result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1, expected=False) assert ( result is not True ), "Testcase {} : Failed \n Error : Routes are still " "present {}".format( tc_name, result) write_test_footer(tc_name)
def test_route_map_match_only_no_set_p0(request): """ TC_38: Test add/remove route-maps with multiple match clauses and without any set statement.(Match only) """ tgen = get_topogen() # test case name tc_name = request.node.name write_test_header(tc_name) # Creating configuration from JSON reset_config_on_routers(tgen) for adt in ADDR_TYPES: # Create Static routes input_dict = { "r1": { "static_routes": [ { "network": NETWORK[adt][0], "no_of_ip": 1, "next_hop": NEXT_HOP[adt], } ] } } result = create_static_routes(tgen, input_dict) assert result is True, "Testcase {} : Failed \n Error: {}".format( tc_name, result ) # Api call to redistribute static routes input_dict_1 = { "r1": { "bgp": { "address_family": { "ipv4": { "unicast": { "redistribute": [ {"redist_type": "static"}, {"redist_type": "connected"}, ] } }, "ipv6": { "unicast": { "redistribute": [ {"redist_type": "static"}, {"redist_type": "connected"}, ] } }, } } } } result = create_router_bgp(tgen, topo, input_dict_1) assert result is True, "Testcase {} : Failed \n Error: {}".format( tc_name, result ) # Create ip prefix list input_dict_2 = { "r1": { "prefix_lists": { "ipv4": { "pf_list_1_ipv4": [ {"seqid": 10, "network": "any", "action": "permit"} ] }, "ipv6": { "pf_list_1_ipv6": [ {"seqid": 100, "network": "any", "action": "permit"} ] }, } } } result = create_prefix_lists(tgen, input_dict_2) assert result is True, "Testcase {} : Failed \n Error: {}".format( tc_name, result ) # Create route map for addr_type in ADDR_TYPES: input_dict_3 = { "r1": { "route_maps": { "rmap_match_pf_1_{}".format(addr_type): [ { "action": "permit", "set": { "metric": 50, "locPrf": 150, }, } ] } } } result = create_route_maps(tgen, input_dict_3) assert result is True, "Testcase {} : Failed \n Error: {}".format( tc_name, result ) # Configure neighbor for route map input_dict_4 = { "r1": { "bgp": { "address_family": { "ipv4": { "unicast": { "neighbor": { "r3": { "dest_link": { "r1": { "route_maps": [ { "name": "rmap_match_pf_1_ipv4", "direction": "out", } ] } } } } } }, "ipv6": { "unicast": { "neighbor": { "r3": { "dest_link": { "r1": { "route_maps": [ { "name": "rmap_match_pf_1_ipv6", "direction": "out", } ] } } } } } }, } } } } result = create_router_bgp(tgen, topo, input_dict_4) assert result is True, "Testcase {} : Failed \n Error: {}".format( tc_name, result ) # Create ip prefix list input_dict_5 = { "r3": { "prefix_lists": { "ipv4": { "pf_list_1_ipv4": [ {"seqid": 10, "network": "any", "action": "permit"} ] }, "ipv6": { "pf_list_1_ipv6": [ {"seqid": 100, "network": "any", "action": "permit"} ] }, } } } result = create_prefix_lists(tgen, input_dict_5) assert result is True, "Testcase {} : Failed \n Error: {}".format( tc_name, result ) # Create route map for addr_type in ADDR_TYPES: input_dict_6 = { "r3": { "route_maps": { "rmap_match_pf_2_{}".format(addr_type): [ { "action": "permit", "match": { addr_type: { "prefix_lists": "pf_list_1_{}".format(addr_type) } }, } ] } } } result = create_route_maps(tgen, input_dict_6) assert result is True, "Testcase {} : Failed \n Error: {}".format( tc_name, result ) # Configure neighbor for route map input_dict_7 = { "r3": { "bgp": { "address_family": { "ipv4": { "unicast": { "neighbor": { "r1": { "dest_link": { "r3": { "route_maps": [ { "name": "rmap_match_pf_2_ipv4", "direction": "in", } ] } } }, "r4": { "dest_link": { "r3": { "route_maps": [ { "name": "rmap_match_pf_2_ipv4", "direction": "out", } ] } } }, } } }, "ipv6": { "unicast": { "neighbor": { "r1": { "dest_link": { "r3": { "route_maps": [ { "name": "rmap_match_pf_2_ipv6", "direction": "in", } ] } } }, "r4": { "dest_link": { "r3": { "route_maps": [ { "name": "rmap_match_pf_2_ipv6", "direction": "out", } ] } } }, } } }, } } } } result = create_router_bgp(tgen, topo, input_dict_7) assert result is True, "Testcase {} : Failed \n Error: {}".format( tc_name, result ) for adt in ADDR_TYPES: # Verifying RIB routes static_routes = [NETWORK[adt][0]] result = verify_bgp_attributes( tgen, adt, "r3", static_routes, "rmap_match_pf_1", input_dict_3 ) assert result is True, "Test case {} : Failed \n Error: {}".format( tc_name, result )
def test_verify_deleting_re_adding_route_map_with_iBGP_peers_p0(request): """ Verify graceful-shutdown functionality after deleting/re-adding route-map with iBGP peers """ tc_name = request.node.name write_test_header(tc_name) tgen = get_topogen() reset_config_on_routers(tgen) step("Done in base config: Configure base config as per the topology") step("Base config should be up, verify using BGP convergence") result = verify_bgp_convergence(tgen, topo) assert result is True, "Test case {} : Failed \n Error: {}".format( tc_name, result) step("Done in base config: Advertise prefixes from R1") step("Verify BGP routes are received at R4 with best path from R3 to R1") for addr_type in ADDR_TYPES: dut = "r4" next_hop1 = next_hop_per_address_family(tgen, "r4", "r2", addr_type, NEXT_HOP_IP_1) next_hop2 = next_hop_per_address_family(tgen, "r4", "r3", addr_type, NEXT_HOP_IP_2) input_topo = {key: topo["routers"][key] for key in ["r1"]} result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop=[next_hop1, next_hop2]) assert result is True, "Test case {} : Failed \n Error: {}".format( tc_name, result) result = verify_rib(tgen, addr_type, dut, input_topo, next_hop=[next_hop1, next_hop2]) assert result is True, "Test case {} : Failed \n Error: {}".format( tc_name, result) step("On R1 configure:") step("Create standard bgp community-list to permit graceful-shutdown:") input_dict_1 = { "r1": { "bgp_community_lists": [{ "community_type": "standard", "action": "permit", "name": "GSHUT", "value": "graceful-shutdown", }] } } result = create_bgp_community_lists(tgen, input_dict_1) assert result is True, "Test case {} : Failed \n Error: {}".format( tc_name, result) step("Create route-map to set community GSHUT in OUT direction") input_dict_2 = { "r1": { "route_maps": { "GSHUT-OUT": [{ "action": "permit", "seq_id": "10", "set": { "community": { "num": "graceful-shutdown" } }, }] } } } result = create_route_maps(tgen, input_dict_2) assert result is True, "Test case {} : Failed \n Error: {}".format( tc_name, result) input_dict_3 = { "r1": { "bgp": { "address_family": { "ipv4": { "unicast": { "neighbor": { "r3": { "dest_link": { "r1": { "route_maps": [{ "name": "GSHUT-OUT", "direction": "out", }] } } } } } }, "ipv6": { "unicast": { "neighbor": { "r3": { "dest_link": { "r1": { "route_maps": [{ "name": "GSHUT-OUT", "direction": "out", }] } } } } } }, } } } } result = create_router_bgp(tgen, topo, input_dict_3) assert result is True, "Test case {} : Failed \n Error: {}".format( tc_name, result) step( "FRR is setting local-pref to 0 by-default on receiver GSHUT community, " "below step is not needed, but keeping for reference") step("On R3, apply route-map IN direction to match GSHUT community " "and set local-preference to 0.") step("Verify BGP convergence on R4 and ensure all the neighbours state " "is established") result = verify_bgp_convergence(tgen, topo) assert result is True, "Test case {} : Failed \n Error: {}".format( tc_name, result) step("Verify BGP routes on R4:") step("local pref for routes coming from R1 is set to 0.") for addr_type in ADDR_TYPES: rmap_dict = { "r1": { "route_maps": { "GSHUT-OUT": [{ "set": { "locPrf": 0 } }], } } } static_routes = [NETWORK[addr_type]] result = verify_bgp_attributes(tgen, addr_type, dut, static_routes, "GSHUT-OUT", rmap_dict) assert result is True, "Test case {} : Failed \n Error: {}".format( tc_name, result) step("Ensure that best path is selected from R4 to R3.") for addr_type in ADDR_TYPES: dut = "r4" next_hop1 = next_hop_per_address_family(tgen, "r4", "r2", addr_type, NEXT_HOP_IP_1) next_hop2 = next_hop_per_address_family(tgen, "r4", "r3", addr_type, NEXT_HOP_IP_2) input_topo = {key: topo["routers"][key] for key in ["r1"]} result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop=[next_hop1, next_hop2]) assert result is True, "Test case {} : Failed \n Error: {}".format( tc_name, result) result = verify_rib(tgen, addr_type, dut, input_topo, next_hop=next_hop1) assert result is True, "Test case {} : Failed \n Error: {}".format( tc_name, result) step("Delete route-map from R1") del_rmap_dict = { "r1": { "route_maps": { "GSHUT-OUT": [{ "action": "permit", "seq_id": "10", "set": { "community": { "num": "graceful-shutdown", "delete": True } }, }] } } } result = create_route_maps(tgen, del_rmap_dict) assert result is True, "Test case {} : Failed \n Error: {}".format( tc_name, result) step("Verify BGP convergence on R3 and ensure that all neighbor state " "is established") result = verify_bgp_convergence(tgen, topo) assert result is True, "Test case {} : Failed \n Error: {}".format( tc_name, result) step("Verify BGP routes on R4:") step("Ensure that best path is selected from R1->R3") for addr_type in ADDR_TYPES: dut = "r4" next_hop1 = next_hop_per_address_family(tgen, "r4", "r2", addr_type, NEXT_HOP_IP_1) next_hop2 = next_hop_per_address_family(tgen, "r4", "r3", addr_type, NEXT_HOP_IP_2) input_topo = {key: topo["routers"][key] for key in ["r1"]} result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop=[next_hop1]) assert result is True, "Test case {} : Failed \n Error: {}".format( tc_name, result) result = verify_rib(tgen, addr_type, dut, input_topo, next_hop=[next_hop1]) assert result is True, "Test case {} : Failed \n Error: {}".format( tc_name, result) step("Re-add route-map in R1") result = create_route_maps(tgen, input_dict_2) assert result is True, "Test case {} : Failed \n Error: {}".format( tc_name, result) step("Verify BGP convergence on R3 and ensure all the neighbours state " "is established") result = verify_bgp_convergence(tgen, topo) assert result is True, "Test case {} : Failed \n Error: {}".format( tc_name, result) step("Verify BGP routes on R4:") step("local pref for routes coming from R1 is set to 0.") for addr_type in ADDR_TYPES: rmap_dict = { "r1": { "route_maps": { "GSHUT-OUT": [{ "set": { "locPrf": 0 } }] } } } static_routes = [NETWORK[addr_type]] result = verify_bgp_attributes(tgen, addr_type, dut, static_routes, "GSHUT-OUT", rmap_dict) assert result is True, "Test case {} : Failed \n Error: {}".format( tc_name, result) step("Ensure that best path is selected from R4 to R3.") for addr_type in ADDR_TYPES: dut = "r4" next_hop1 = next_hop_per_address_family(tgen, "r4", "r2", addr_type, NEXT_HOP_IP_1) next_hop2 = next_hop_per_address_family(tgen, "r4", "r3", addr_type, NEXT_HOP_IP_2) input_topo = {key: topo["routers"][key] for key in ["r1"]} result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop=[next_hop1, next_hop2]) assert result is True, "Test case {} : Failed \n Error: {}".format( tc_name, result) result = verify_rib(tgen, addr_type, dut, input_topo, next_hop=next_hop1) assert result is True, "Test case {} : Failed \n Error: {}".format( tc_name, result) write_test_footer(tc_name)