mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-31 18:28:45 +00:00
Merge pull request #5864 from kuldeepkash/route_map
tests: Optimizing route-map test cases
This commit is contained in:
commit
1f713948c6
@ -71,7 +71,7 @@ from time import sleep
|
|||||||
|
|
||||||
# Save the Current Working Directory to find configuration files.
|
# Save the Current Working Directory to find configuration files.
|
||||||
CWD = os.path.dirname(os.path.realpath(__file__))
|
CWD = os.path.dirname(os.path.realpath(__file__))
|
||||||
sys.path.append(os.path.join(CWD, '../'))
|
sys.path.append(os.path.join(CWD, "../"))
|
||||||
|
|
||||||
# pylint: disable=C0413
|
# pylint: disable=C0413
|
||||||
# Import topogen and topotest helpers
|
# Import topogen and topotest helpers
|
||||||
@ -102,7 +102,7 @@ ADDR_TYPES = check_address_types()
|
|||||||
# Reading the data from JSON File for topology and configuration creation
|
# Reading the data from JSON File for topology and configuration creation
|
||||||
jsonFile = "{}/bgp_route_map_topo1.json".format(CWD)
|
jsonFile = "{}/bgp_route_map_topo1.json".format(CWD)
|
||||||
try:
|
try:
|
||||||
with open(jsonFile, 'r') as topoJson:
|
with open(jsonFile, "r") as topoJson:
|
||||||
topo = json.load(topoJson)
|
topo = json.load(topoJson)
|
||||||
except IOError:
|
except IOError:
|
||||||
assert False, "Could not read file {}".format(jsonFile)
|
assert False, "Could not read file {}".format(jsonFile)
|
||||||
@ -442,11 +442,12 @@ def test_route_map_inbound_outbound_same_neighbor_p0(request):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result = verify_rib(tgen, adt, dut, input_dict_2, protocol=protocol)
|
result = verify_rib(tgen, adt, dut, input_dict_2, protocol=protocol,
|
||||||
|
expected=False)
|
||||||
assert result is not True, "Testcase {} : Failed \n"
|
assert result is not True, "Testcase {} : Failed \n"
|
||||||
"Expected behavior: routes are not present in rib \n"
|
"routes are not present in rib \n Error: {}".format(
|
||||||
"Error: {}".format(
|
|
||||||
tc_name, result)
|
tc_name, result)
|
||||||
|
logger.info("Expected behaviour: {}".format(result))
|
||||||
|
|
||||||
# Verifying RIB routes
|
# Verifying RIB routes
|
||||||
dut = "r4"
|
dut = "r4"
|
||||||
@ -461,11 +462,12 @@ def test_route_map_inbound_outbound_same_neighbor_p0(request):
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = verify_rib(tgen, adt, dut, input_dict, protocol=protocol)
|
result = verify_rib(tgen, adt, dut, input_dict, protocol=protocol,
|
||||||
|
expected=False)
|
||||||
assert result is not True, "Testcase {} : Failed \n "
|
assert result is not True, "Testcase {} : Failed \n "
|
||||||
"Expected behavior: routes are not present in rib \n "
|
"routes are not present in rib \n Error: {}".format(
|
||||||
"Error: {}".format(
|
|
||||||
tc_name, result)
|
tc_name, result)
|
||||||
|
logger.info("Expected behaviour: {}".format(result))
|
||||||
|
|
||||||
write_test_footer(tc_name)
|
write_test_footer(tc_name)
|
||||||
|
|
||||||
@ -649,10 +651,14 @@ def test_route_map_with_action_values_combination_of_prefix_action_p0(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result = verify_rib(tgen, adt, dut, input_dict_2, protocol=protocol)
|
#tgen.mininet_cli()
|
||||||
|
result = verify_rib(tgen, adt, dut, input_dict_2, protocol=protocol,
|
||||||
|
expected=False)
|
||||||
if "deny" in [prefix_action, rmap_action]:
|
if "deny" in [prefix_action, rmap_action]:
|
||||||
assert result is not True, "Testcase {} : Failed \n Error: {}".\
|
assert result is not True, "Testcase {} : Failed \n "
|
||||||
|
"Routes are still present \n Error: {}".\
|
||||||
format(tc_name, result)
|
format(tc_name, result)
|
||||||
|
logger.info("Expected behaviour: {}".format(result))
|
||||||
else:
|
else:
|
||||||
assert result is True, "Testcase {} : Failed \n Error: {}".format(
|
assert result is True, "Testcase {} : Failed \n Error: {}".format(
|
||||||
tc_name, result)
|
tc_name, result)
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1293,16 +1293,13 @@ def verify_bgp_attributes(tgen, addr_type, dut, static_routes, rmap_name,
|
|||||||
for static_route in static_routes:
|
for static_route in static_routes:
|
||||||
cmd = "show bgp {} {} json".format(addr_type, static_route)
|
cmd = "show bgp {} {} json".format(addr_type, static_route)
|
||||||
show_bgp_json = run_frr_cmd(rnode, cmd, isjson=True)
|
show_bgp_json = run_frr_cmd(rnode, cmd, isjson=True)
|
||||||
print("show_bgp_json $$$$$", show_bgp_json)
|
|
||||||
|
|
||||||
dict_to_test = []
|
dict_to_test = []
|
||||||
tmp_list = []
|
tmp_list = []
|
||||||
for rmap_router in input_dict.keys():
|
for rmap_router in input_dict.keys():
|
||||||
for rmap, values in input_dict[rmap_router][
|
for rmap, values in input_dict[rmap_router][
|
||||||
"route_maps"].items():
|
"route_maps"].items():
|
||||||
print("rmap == rmap_name $$$$1", rmap, rmap_name)
|
|
||||||
if rmap == rmap_name:
|
if rmap == rmap_name:
|
||||||
print("rmap == rmap_name $$$$", rmap, rmap_name)
|
|
||||||
dict_to_test = values
|
dict_to_test = values
|
||||||
for rmap_dict in values:
|
for rmap_dict in values:
|
||||||
if seq_id is not None:
|
if seq_id is not None:
|
||||||
@ -1318,7 +1315,6 @@ def verify_bgp_attributes(tgen, addr_type, dut, static_routes, rmap_name,
|
|||||||
if tmp_list:
|
if tmp_list:
|
||||||
dict_to_test = tmp_list
|
dict_to_test = tmp_list
|
||||||
|
|
||||||
print("dict_to_test $$$$", dict_to_test)
|
|
||||||
for rmap_dict in dict_to_test:
|
for rmap_dict in dict_to_test:
|
||||||
if "set" in rmap_dict:
|
if "set" in rmap_dict:
|
||||||
for criteria in rmap_dict["set"].keys():
|
for criteria in rmap_dict["set"].keys():
|
||||||
|
Loading…
Reference in New Issue
Block a user