diff options
| author | Donald Sharp <donaldsharp72@gmail.com> | 2023-10-05 15:36:27 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-05 15:36:27 -0400 |
| commit | c5164478474ef1d08d7bf851e4eb8baf2a01929d (patch) | |
| tree | 7f8b9dbf545504246091eef9842ad576f8b6aa40 | |
| parent | 580bc71aca393bed7d96a4047f666ac8b46dda21 (diff) | |
| parent | 22fb94a248f0e5ac52492b16b04a3a181befaa1a (diff) | |
Merge pull request #14534 from mjstapp/fix_topo_nhgid
tests: locate nhg id from json output in all_proto_startup
| -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 4b7c4de806..c319477c8a 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(): |
