-
Notifications
You must be signed in to change notification settings - Fork 310
Leafref util functions #2352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Leafref util functions #2352
Conversation
Co-authored-by: Brad House <[email protected]>
Meaning all leafrefs that target a specific node. Co-authored-by: Brad House <[email protected]>
Co-authored-by: Brad House <[email protected]>
37030f8
to
2f373f8
Compare
thanks, at first glance this looks basically the same so it should work. I'll pull it into the SONiC PRs I've got so I can run the tests there to make sure all is good. I'll report back. Thanks! |
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]>
CESNET/libyang#2352 Backlinks were removed between libyang1 and libyang2, this adds helper functions for enumerating backlinks.
@michalvasko I can confirm this PR passes our test cases in SONiC. Thanks! |
I'm not familiar with your process, but it appears the libyang-python repo depends on commits in the libyang |
The last release is still fairly new so it will likely be at least a few months. |
Ok, I'll need to try to push @rjarry I guess to make sure the changes will be acceptable or if there are any requested APi changes in libyang-python when using the new APIs as I'll need to pull in PRs into SONiC as patches before they are accepted. |
CESNET/libyang#2352 Backlinks were removed between libyang1 and libyang2, this adds helper functions for enumerating backlinks.
CESNET/libyang#2352 Backlinks were removed between libyang1 and libyang2, this adds helper functions for enumerating backlinks.
CESNET/libyang#2352 Backlinks were removed between libyang1 and libyang2, this adds helper functions for enumerating backlinks.
CESNET/libyang#2352 Backlinks were removed between libyang1 and libyang2, this adds helper functions for enumerating backlinks.
CESNET/libyang#2352 Backlinks were removed between libyang1 and libyang2, this adds helper functions for enumerating backlinks.
CESNET/libyang#2352 Backlinks were removed between libyang1 and libyang2, this adds helper functions for enumerating backlinks.
CESNET/libyang#2352 Backlinks were removed between libyang1 and libyang2, this adds helper functions for enumerating backlinks.
CESNET/libyang#2352 Backlinks were removed between libyang1 and libyang2, this adds helper functions for enumerating backlinks.
CESNET/libyang#2352 Backlinks were removed between libyang1 and libyang2, this adds helper functions for enumerating backlinks.
CESNET/libyang#2352 Backlinks were removed between libyang1 and libyang2, this adds helper functions for enumerating backlinks.
CESNET/libyang#2352 Backlinks were removed between libyang1 and libyang2, this adds helper functions for enumerating backlinks.
CESNET/libyang#2352 Backlinks were removed between libyang1 and libyang2, this adds helper functions for enumerating backlinks.
CESNET/libyang#2352 Backlinks were removed between libyang1 and libyang2, this adds helper functions for enumerating backlinks.
CESNET/libyang#2352 Backlinks were removed between libyang1 and libyang2, this adds helper functions for enumerating backlinks.
CESNET/libyang#2352 Backlinks were removed between libyang1 and libyang2, this adds helper functions for enumerating backlinks.
CESNET/libyang#2352 Backlinks were removed between libyang1 and libyang2, this adds helper functions for enumerating backlinks.
CESNET/libyang#2352 Backlinks were removed between libyang1 and libyang2, this adds helper functions for enumerating backlinks.
CESNET/libyang#2352 Backlinks were removed between libyang1 and libyang2, this adds helper functions for enumerating backlinks.
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]>
CESNET/libyang#2352 Backlinks were removed between libyang1 and libyang2, this adds helper functions for enumerating backlinks.
CESNET/libyang#2352 Backlinks were removed between libyang1 and libyang2, this adds helper functions for enumerating backlinks.
CESNET/libyang#2352 Backlinks were removed between libyang1 and libyang2, this adds helper functions for enumerating backlinks.
CESNET/libyang#2352 Backlinks were removed between libyang1 and libyang2, this adds helper functions for enumerating backlinks.
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]>
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]>
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]>
Refs #2351