-
I'm trying to look up back references to paths, and I have it reasonably working for normal leafref nodes, and they can return a path like:
Which is generated when passing the However, when processing a union, we're dealing with a different set of data structures and do something like: leaf = (const struct lysc_node_leaf *)node;
if (leaf->type->basetype == LY_TYPE_UNION) {
const struct lysc_type_union *un = (const struct lysc_type_union *)leaf->type;
for (i=0; i<LY_ARRAY_COUNT(un->types); i++) {
const struct lysc_type *utype = un->types[i];
if (utype->basetype != LY_TYPE_LEAFREF) {
continue;
}
const struct lysc_type_leafref *lref = (const struct lysc_type_leafref *)utype;
printf("union leafref path: %s\n", lyxp_get_expr(lref->path));
} The problem is, when the leaf reference is pointing to the same node, we get: How can I derive the same path as I'm porting SONiC from libyang1 to libyang3, and they use backlinks. I'm working on a patch for libyang-python with this support, it contains the test cases and yang files: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
nevermind, I figured it out, see CESNET/libyang-python#132 |
Beta Was this translation helpful? Give feedback.
nevermind, I figured it out, see CESNET/libyang-python#132