mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 11:30:30 +00:00
Merge pull request #7498 from mjstapp/fix_topo_count_only
tests: only test count of nexthops in bgp max-paths test
This commit is contained in:
commit
02a17eaddf
@ -292,6 +292,10 @@ def test_modify_ecmp_max_paths(request, ecmp_num, test_type):
|
|||||||
input_dict_1 = {"r3": {"static_routes": [{"network": NETWORK[addr_type]}]}}
|
input_dict_1 = {"r3": {"static_routes": [{"network": NETWORK[addr_type]}]}}
|
||||||
|
|
||||||
logger.info("Verifying %s routes on r3", addr_type)
|
logger.info("Verifying %s routes on r3", addr_type)
|
||||||
|
|
||||||
|
# Only test the count of nexthops; the actual nexthop addresses
|
||||||
|
# can vary and are not deterministic.
|
||||||
|
#
|
||||||
result = verify_rib(
|
result = verify_rib(
|
||||||
tgen,
|
tgen,
|
||||||
addr_type,
|
addr_type,
|
||||||
@ -299,7 +303,9 @@ def test_modify_ecmp_max_paths(request, ecmp_num, test_type):
|
|||||||
input_dict_1,
|
input_dict_1,
|
||||||
next_hop=NEXT_HOPS[addr_type][: int(ecmp_num)],
|
next_hop=NEXT_HOPS[addr_type][: int(ecmp_num)],
|
||||||
protocol=protocol,
|
protocol=protocol,
|
||||||
|
count_only=True
|
||||||
)
|
)
|
||||||
|
|
||||||
assert result is True, "Testcase {} : Failed \n Error: {}".format(
|
assert result is True, "Testcase {} : Failed \n Error: {}".format(
|
||||||
tc_name, result
|
tc_name, result
|
||||||
)
|
)
|
||||||
|
@ -293,6 +293,10 @@ def test_modify_ecmp_max_paths(request, ecmp_num, test_type):
|
|||||||
input_dict_1 = {"r3": {"static_routes": [{"network": NETWORK[addr_type]}]}}
|
input_dict_1 = {"r3": {"static_routes": [{"network": NETWORK[addr_type]}]}}
|
||||||
|
|
||||||
logger.info("Verifying %s routes on r3", addr_type)
|
logger.info("Verifying %s routes on r3", addr_type)
|
||||||
|
|
||||||
|
# Test only the count of nexthops, not the specific nexthop addresses -
|
||||||
|
# they're not deterministic
|
||||||
|
#
|
||||||
result = verify_rib(
|
result = verify_rib(
|
||||||
tgen,
|
tgen,
|
||||||
addr_type,
|
addr_type,
|
||||||
@ -300,7 +304,9 @@ def test_modify_ecmp_max_paths(request, ecmp_num, test_type):
|
|||||||
input_dict_1,
|
input_dict_1,
|
||||||
next_hop=NEXT_HOPS[addr_type][: int(ecmp_num)],
|
next_hop=NEXT_HOPS[addr_type][: int(ecmp_num)],
|
||||||
protocol=protocol,
|
protocol=protocol,
|
||||||
|
count_only=True
|
||||||
)
|
)
|
||||||
|
|
||||||
assert result is True, "Testcase {} : Failed \n Error: {}".format(
|
assert result is True, "Testcase {} : Failed \n Error: {}".format(
|
||||||
tc_name, result
|
tc_name, result
|
||||||
)
|
)
|
||||||
|
@ -2559,6 +2559,7 @@ def verify_rib(
|
|||||||
tag=None,
|
tag=None,
|
||||||
metric=None,
|
metric=None,
|
||||||
fib=None,
|
fib=None,
|
||||||
|
count_only=False
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Data will be read from input_dict or input JSON file, API will generate
|
Data will be read from input_dict or input JSON file, API will generate
|
||||||
@ -2576,6 +2577,8 @@ def verify_rib(
|
|||||||
* `next_hop`[optional]: next_hop which needs to be verified,
|
* `next_hop`[optional]: next_hop which needs to be verified,
|
||||||
default: static
|
default: static
|
||||||
* `protocol`[optional]: protocol, default = None
|
* `protocol`[optional]: protocol, default = None
|
||||||
|
* `count_only`[optional]: count of nexthops only, not specific addresses,
|
||||||
|
default = False
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
-----
|
-----
|
||||||
@ -2739,7 +2742,23 @@ def verify_rib(
|
|||||||
for rib_r in rib_routes_json[st_rt][0]["nexthops"]
|
for rib_r in rib_routes_json[st_rt][0]["nexthops"]
|
||||||
]
|
]
|
||||||
|
|
||||||
if found_hops:
|
# Check only the count of nexthops
|
||||||
|
if count_only:
|
||||||
|
if len(next_hop) == len(found_hops):
|
||||||
|
nh_found = True
|
||||||
|
else:
|
||||||
|
errormsg = (
|
||||||
|
"Nexthops are missing for "
|
||||||
|
"route {} in RIB of router {}: "
|
||||||
|
"expected {}, found {}\n".format(
|
||||||
|
st_rt, dut, len(next_hop),
|
||||||
|
len(found_hops)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return errormsg
|
||||||
|
|
||||||
|
# Check the actual nexthops
|
||||||
|
elif found_hops:
|
||||||
missing_list_of_nexthops = set(
|
missing_list_of_nexthops = set(
|
||||||
found_hops
|
found_hops
|
||||||
).difference(next_hop)
|
).difference(next_hop)
|
||||||
|
Loading…
Reference in New Issue
Block a user