You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In libyang v1 the schema nodes had a backlinks member to be able to
look up dependents of the node. SONiC depends on this to provide
functionality it uses and it needs to be exposed via the python
module.
In theory, exposing the 'dfs' functions could make this work, but
it would likely be cost prohibitive since walking the tree would
be expensive to create a python node for evaluation in native
python.
Instead this PR depends on the this libyang PR:
CESNET/libyang#2352
And adds thin wrappers.
This implementation provides 2 python functions:
* Context.find_backlinks_paths() - This function can
take the path of the base node and find all dependents. If
no path is specified, then it will return all nodes that contain
a leafref reference.
* Context.find_leafref_path_target_paths() - This function takes
an xpath, then returns all target nodes the xpath may reference.
Typically only one will be returned, but multiples may be in the
case of a union.
A user can build a cache by combining Context.find_backlinks_paths()
with no path set and building a reverse table using
Context.find_leafref_path_target_paths()
Signed-off-by: Brad House <[email protected]>
0 commit comments