]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/yang.c
Merge pull request #13649 from donaldsharp/unlock_the_node_or_else
[mirror_frr.git] / lib / yang.c
index 70a3251ab39db4280c8c3a904fac85d7febee71b..4dd8654217183cfcdec1d41abf4c14cb689f2d5c 100644 (file)
@@ -250,6 +250,23 @@ void yang_snode_get_path(const struct lysc_node *snode,
        }
 }
 
+struct lysc_node *yang_find_snode(struct ly_ctx *ly_ctx, const char *xpath,
+                                 uint32_t options)
+{
+       struct lysc_node *snode;
+       struct ly_set *set;
+       LY_ERR err;
+
+       err = lys_find_xpath(ly_native_ctx, NULL, xpath, options, &set);
+       if (err || !set->count)
+               return NULL;
+
+       snode = set->snodes[0];
+       ly_set_free(set, NULL);
+
+       return snode;
+}
+
 struct lysc_node *yang_snode_real_parent(const struct lysc_node *snode)
 {
        struct lysc_node *parent = snode->parent;