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
{{ message }}
Repository navigation
Feature Request | RESTCONF like PATH expressions #1622
Only list-key values are provided (no attribute names)
For lists with multiple keys, comma is used as separator while key values will follow the same order as in the YANG key statement
Example with multiple keys:
In YANG the statement key: "p1 p2 p3 p4" for list mylist occurs. To access an object with p1="bla" and p4="bing" one would use the following URL path statement .../mylist=bla,,,bing/...
Rational:
To convert a RESTCONF URL/PATH to XPATH is rather complex, because one needs to understand the list keys including ordering (aka requires to know the corresponding YANG file). As libyang has the knowledge the recommendation is to support URL style (model-path) out-of-the-box.
You could have at least reference the specification. Should be fairly simple to support but we have no spare time right now for implementing it and have no use-case so we would not know what exactly should the API do. But we accept pull requests so you are free to implement it.
@michalvasko, I will start with the specification and use-case definition first. Will check, if we have cycles to add the code for this.
Instead of providing alternative support for mode-path for all available API endpoints that support XPATH today, likely the best API requirement would be to have a function that translates model-path to xpath and vice versa.
have a function that translates model-path to xpath and vice versa.
Not sure that is really possible because that would require there to already be support in libyang for expressions that can be mapped 1:1 to these RESTCONF URIs. It is certainly not XPath, it may be path but that would need careful examination to make sure of it.
Not sure that is really possible because that would require there to already be support in libyang for expressions that can be mapped 1:1 to these RESTCONF URIs.
1:1 mapping shall be possible. Not sure, what libyang2 provides to make this happen...
It is certainly not XPath, it may be path but that would need careful examination to make sure of it.
Well, it's a path expression (FDN style), however it uses XPATH syntax. Indeed, it's not any XPATH expression just the once that are related to object paths - because else translation would not be possible.
Indeed, it's not any XPATH expression just the once that are related to object paths
I think the restrictions are much more severe than that, you cannot have any operators and even no predicates, which are substituted by special syntax that is not valid in any YANG/NETCONF path.
I think the restrictions are much more severe than that, you cannot have any operators and even no predicates, which are substituted by special syntax that is not valid in any YANG/NETCONF path.
Right... The main use-case here is to having tooling on top of RESTCONF agent. To provide any sort of validation and compare on top of RESTCONF transformation this sort of translation is essential an requires knowledge about the YANG module contents.
Activity
michalvasko commentedon Jun 17, 2021
You could have at least reference the specification. Should be fairly simple to support but we have no spare time right now for implementing it and have no use-case so we would not know what exactly should the API do. But we accept pull requests so you are free to implement it.
wisotzky commentedon Jun 17, 2021
@michalvasko, I will start with the specification and use-case definition first. Will check, if we have cycles to add the code for this.
Instead of providing alternative support for mode-path for all available API endpoints that support XPATH today, likely the best API requirement would be to have a function that translates model-path to xpath and vice versa.
michalvasko commentedon Jun 21, 2021
Not sure that is really possible because that would require there to already be support in libyang for expressions that can be mapped 1:1 to these RESTCONF URIs. It is certainly not XPath, it may be path but that would need careful examination to make sure of it.
wisotzky commentedon Jun 21, 2021
1:1 mapping shall be possible. Not sure, what libyang2 provides to make this happen...
Well, it's a path expression (FDN style), however it uses XPATH syntax. Indeed, it's not any XPATH expression just the once that are related to object paths - because else translation would not be possible.
michalvasko commentedon Jun 21, 2021
I think the restrictions are much more severe than that, you cannot have any operators and even no predicates, which are substituted by special syntax that is not valid in any YANG/NETCONF path.
wisotzky commentedon Jun 21, 2021
Right... The main use-case here is to having tooling on top of RESTCONF agent. To provide any sort of validation and compare on top of RESTCONF transformation this sort of translation is essential an requires knowledge about the YANG module contents.