summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChristian Hopps <chopps@labn.net>2024-01-06 10:47:04 +0100
committerChristian Hopps <chopps@labn.net>2024-01-07 16:17:56 +0100
commite85ff7a1f20d2429bffa2922272194da7326783f (patch)
tree1f84d129b33a7f6771b96a2bf1a63fa83633a86e /tests
parentlib: use libyang functions if they are present (diff)
downloadfrr-e85ff7a1f20d2429bffa2922272194da7326783f.tar.xz
frr-e85ff7a1f20d2429bffa2922272194da7326783f.zip
tests: test new XPath 1.0 predicate functionality
Signed-off-by: Christian Hopps <chopps@labn.net>
Diffstat (limited to 'tests')
-rw-r--r--tests/topotests/mgmt_oper/test_querying.py10
-rw-r--r--tests/topotests/mgmt_oper/test_scale.py12
2 files changed, 19 insertions, 3 deletions
diff --git a/tests/topotests/mgmt_oper/test_querying.py b/tests/topotests/mgmt_oper/test_querying.py
index e53ea52c9..220f2b4ab 100644
--- a/tests/topotests/mgmt_oper/test_querying.py
+++ b/tests/topotests/mgmt_oper/test_querying.py
@@ -51,6 +51,16 @@ def test_oper_simple(tgen):
pytest.skip(tgen.errors)
query_results = [
+ # Non-key specific query with function filtering selector
+ '/frr-interface:lib/interface[contains(name,"eth")]/vrf',
+ # Non-key specific query with child value filtering selector
+ '/frr-interface:lib/interface[vrf="red"]/vrf',
+ '/frr-interface:lib/interface[./vrf="red"]/vrf',
+ # Container query with function filtering selector
+ '/frr-interface:lib/interface[contains(name,"eth")]/state',
+ # Multi list elemenet with function filtering selector
+ '/frr-interface:lib/interface[contains(name,"eth")]',
+ #
# Specific list entry after non-specific lists
'/frr-vrf:lib/vrf[name="default"]/frr-zebra:zebra/ribs/'
'rib[afi-safi-name="frr-routing:ipv4-unicast"][table-id="254"]/'
diff --git a/tests/topotests/mgmt_oper/test_scale.py b/tests/topotests/mgmt_oper/test_scale.py
index d7a0e25ad..391400f91 100644
--- a/tests/topotests/mgmt_oper/test_scale.py
+++ b/tests/topotests/mgmt_oper/test_scale.py
@@ -11,7 +11,7 @@
"""
Test static route functionality
"""
-import logging
+import re
import time
import pytest
@@ -63,5 +63,11 @@ def test_oper_simple(tgen):
check_kernel_32(r1, "20.0.0.0", count, vrf, 1000)
step(f"All {count} routes installed in kernel, continuing")
- output = r1.cmd_raises("vtysh -c 'show mgmt get-data /frr-vrf:lib'")
- step("Got output: output")
+ # output = r1.cmd_raises("vtysh -c 'show mgmt get-data /frr-vrf:lib'")
+ # step(f"Got output: {output[0:1024]}")
+
+ query = '/frr-vrf:lib/vrf/frr-zebra:zebra/ribs/rib/route[contains(prefix,"20.0.0.12")]/prefix'
+ output = r1.cmd_raises(f"vtysh -c 'show mgmt get-data {query}'")
+ matches = re.findall(r'"prefix":', output)
+ # 20.0.0.12 + 20.0.0.12{0,1,2,3,4,5,6,7,8,9}
+ assert len(matches) == 11