Merge pull request #9839 from donaldsharp/test_ospf_summarization

Test ospf summarization
This commit is contained in:
Russ White 2021-10-19 19:17:35 -04:00 committed by GitHub
commit 656b3fdceb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 83 deletions

View File

@ -2552,6 +2552,7 @@ def create_route_maps(tgen, input_dict, build=False):
nexthop = set_data.setdefault("nexthop", None)
origin = set_data.setdefault("origin", None)
ext_comm_list = set_data.setdefault("extcommunity", {})
metrictype = set_data.setdefault("metric-type", {})
# Local Preference
if local_preference:
@ -2559,6 +2560,10 @@ def create_route_maps(tgen, input_dict, build=False):
"set local-preference {}".format(local_preference)
)
# Metric-Type
if metrictype:
rmap_data.append("set metric-type {}\n".format(metrictype))
# Metric
if metric:
rmap_data.append("set metric {} \n".format(metric))

View File

@ -669,89 +669,6 @@ def test_ospf_type5_summary_tc48_p0(request):
result is True
), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
step("Configure metric type as 1 in route map.")
routemaps = {
"r0": {
"route_maps": {
"rmap_ipv4": [{"action": "permit", "set": {"metric-type": "type-1"}}]
}
}
}
result = create_route_maps(tgen, routemaps)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
step(
"Verify that external routes(static / connected) are summarised"
" to configured summary address with metric type 2."
)
input_dict = {
SUMMARY["ipv4"][0]: {
"Summary address": SUMMARY["ipv4"][0],
"Metric-type": "E2",
"Metric": 20,
"Tag": 0,
"External route count": 5,
}
}
dut = "r0"
result = verify_ospf_summary(tgen, topo, dut, input_dict)
assert (
result is True
), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
step("Un configure metric type from route map.")
routemaps = {
"r0": {
"route_maps": {
"rmap_ipv4": [
{
"action": "permit",
"set": {"metric-type": "type-1"},
"delete": True,
}
]
}
}
}
result = create_route_maps(tgen, routemaps)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
step(
"Verify that external routes(static / connected) are summarised"
" to configured summary address with metric type 2."
)
input_dict = {
SUMMARY["ipv4"][0]: {
"Summary address": SUMMARY["ipv4"][0],
"Metric-type": "E2",
"Metric": 20,
"Tag": 0,
"External route count": 5,
}
}
dut = "r0"
result = verify_ospf_summary(tgen, topo, dut, input_dict)
assert (
result is True
), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
step("Change rule from permit to deny in prefix list.")
pfx_list = {
"r0": {
"prefix_lists": {
"ipv4": {
"pf_list_1_ipv4": [
{"seqid": 10, "network": "any", "action": "deny"}
]
}
}
}
}
result = create_prefix_lists(tgen, pfx_list)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
write_test_footer(tc_name)