Skip to content

Commit

Permalink
tests: test new XPath 1.0 predicate functionality
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Hopps <[email protected]>
  • Loading branch information
choppsv1 committed Jan 7, 2024
1 parent 1e4229f commit e85ff7a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
10 changes: 10 additions & 0 deletions tests/topotests/mgmt_oper/test_querying.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]/'
Expand Down
12 changes: 9 additions & 3 deletions tests/topotests/mgmt_oper/test_scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"""
Test static route functionality
"""
import logging
import re
import time

import pytest
Expand Down Expand Up @@ -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

0 comments on commit e85ff7a

Please sign in to comment.