diff options
author | Mark Stapp <mjs@labn.net> | 2023-10-05 19:47:17 +0200 |
---|---|---|
committer | Mark Stapp <mjs@labn.net> | 2023-10-05 19:47:17 +0200 |
commit | 22fb94a248f0e5ac52492b16b04a3a181befaa1a (patch) | |
tree | 44e81557f1d2b3cc0b0616c83668f893ae641531 | |
parent | Merge pull request #14510 from opensourcerouting/fix/coccinelle_issues (diff) | |
download | frr-22fb94a248f0e5ac52492b16b04a3a181befaa1a.tar.xz frr-22fb94a248f0e5ac52492b16b04a3a181befaa1a.zip |
tests: locate nhg id from json output in all_proto_startup
Don't hard-code a sharpd nhg id: those values aren't stable
if the daemons/protos/route-types change. Use json show output
to find the id in the 'resilient' nhg test case in
the all_protocol_startup suite.
Signed-off-by: Mark Stapp <mjs@labn.net>
-rw-r--r-- | tests/topotests/all_protocol_startup/test_all_protocol_startup.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/tests/topotests/all_protocol_startup/test_all_protocol_startup.py b/tests/topotests/all_protocol_startup/test_all_protocol_startup.py index 4b7c4de80..c319477c8 100644 --- a/tests/topotests/all_protocol_startup/test_all_protocol_startup.py +++ b/tests/topotests/all_protocol_startup/test_all_protocol_startup.py @@ -38,6 +38,9 @@ from lib.common_config import ( required_linux_kernel_version, ) +from lib.topolog import logger +import json + fatal_error = "" @@ -1611,10 +1614,21 @@ def test_resilient_nexthop_group(): ) output = net["r1"].cmd('vtysh -c "show nexthop-group rib sharp"') - output = re.findall(r"Buckets", output) + buckets = re.findall(r"Buckets", output) + + output = net["r1"].cmd('vtysh -c "show nexthop-group rib sharp json"') + + joutput = json.loads(output) + + # Use the json output and collect the nhg id from it + + for nhgid in joutput: + n = joutput[nhgid] + if "buckets" in n: + break - verify_nexthop_group(185483878) - assert len(output) == 1, "Resilient NHG not created in zebra" + verify_nexthop_group(int(nhgid)) + assert len(buckets) == 1, "Resilient NHG not created in zebra" def test_shutdown_check_stderr(): |