summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Hopps <chopps@labn.net>2023-04-17 01:36:46 -0400
committerChristian Hopps <chopps@labn.net>2023-04-17 02:18:56 -0400
commit9b3fd1ef696ad5a66c159009abf397a4f50492c5 (patch)
tree02f570df2e645b7ba84c6bfb45d480eab996c928
parentb5c12fb1f1e0b7a145bb5b2682db737316084003 (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.py12
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