diff options
| author | Christian Hopps <chopps@labn.net> | 2023-04-17 01:36:46 -0400 |
|---|---|---|
| committer | Christian Hopps <chopps@labn.net> | 2023-04-17 02:18:56 -0400 |
| commit | 9b3fd1ef696ad5a66c159009abf397a4f50492c5 (patch) | |
| tree | 02f570df2e645b7ba84c6bfb45d480eab996c928 | |
| parent | b5c12fb1f1e0b7a145bb5b2682db737316084003 (diff) | |
tests: use a more specific xpath for finding the route JSON data
Rather than requesting the data for the entire model, just request the route
data for the specific prefix. This also tests the xpath code (which was
previously broken).
Signed-off-by: Christian Hopps <chopps@labn.net>
| -rw-r--r-- | tests/topotests/rip_allow_ecmp/test_rip_allow_ecmp.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/topotests/rip_allow_ecmp/test_rip_allow_ecmp.py b/tests/topotests/rip_allow_ecmp/test_rip_allow_ecmp.py index b0ba146984..acc0aea9e8 100644 --- a/tests/topotests/rip_allow_ecmp/test_rip_allow_ecmp.py +++ b/tests/topotests/rip_allow_ecmp/test_rip_allow_ecmp.py @@ -52,10 +52,18 @@ def test_rip_allow_ecmp(): r1 = tgen.gears["r1"] def _show_rip_routes(): - output = json.loads( - r1.vtysh_cmd("show yang operational-data /frr-ripd:ripd ripd") + xpath = ( + "/frr-ripd:ripd/instance[vrf='default']" + "/state/routes/route[prefix='10.10.10.1/32']" ) try: + output = json.loads( + r1.vtysh_cmd(f"show yang operational-data {xpath} ripd") + ) + except Exception: + return False + + try: output = output["frr-ripd:ripd"]["instance"][0]["state"]["routes"] except KeyError: return False |
