ret = NB_ERR_NOT_FOUND;
return ret;
}
- assert(CHECK_FLAG(node->schema->nodetype, LYS_CONTAINER | LYS_LIST));
+ while (node &&
+ !CHECK_FLAG(node->schema->nodetype, LYS_CONTAINER | LYS_LIST))
+ node = &node->parent->node;
+ if (!node)
+ return NB_ERR_NOT_FOUND;
inner = (struct lyd_node_inner *)node;
for (len = 1; inner->parent; len++)
* `route-entry` element for a query
* `.../route-entry/metric` where the list element had
* no metric value.
+ *
+ * However, if the user query is for a key of a list
+ * element, then when we reach that list element it will
+ * have no non-key children, check for this condition
+ * and do not reap if true.
*/
if (!list_start && ni->inner &&
!lyd_child_no_keys(&ni->inner->node) &&
+ /* not the top element with a key match */
+ !((darr_ilen(ys->node_infos) ==
+ darr_ilen(ys->schema_path) - 1) &&
+ lysc_is_key((*darr_last(ys->schema_path)))) &&
/* is this at or below the base? */
darr_ilen(ys->node_infos) <= ys->query_base_level)
lyd_free_tree(&ni->inner->node);
* Get the node_info path (stack) corresponding to the uniquely
* resolvable data nodes from the beginning of the xpath query.
*/
- // I think this moves
ret = nb_op_ys_init_node_infos(ys);
if (ret != NB_OK)
return ret;
pytest.skip(tgen.errors)
query_results = [
+ (
+ # Non-key query with key specific selection
+ '/frr-interface:lib/interface[name="r1-eth0"]/vrf',
+ "simple-results/result-intf-eth0-vrf.json",
+ ),
+ # Test machines will have different sets of interfaces so the test results will
+ # vary and need to be generated dynamically before this test is re-enabled
+ # (
+ # # Key query on generic list
+ # "/frr-interface:lib/interface/name",
+ # "simple-results/result-intf-name.json",
+ # ),
+ (
+ # Key query with key specific selection
+ '/frr-interface:lib/interface[name="r1-eth0"]/name',
+ "simple-results/result-intf-eth0-name.json",
+ ),
("/frr-vrf:lib", "simple-results/result-lib.json"),
("/frr-vrf:lib/vrf", "simple-results/result-lib-vrf-nokey.json"),
(