Hi Jan,
On 24/10/2017 11:41, Jan Lindblad wrote:
Rob,
The XPath mixed-quotes problem is well-known, and the suggested
solution seems to be use the "concat" function
/foo/bar[name=concat("It's a", ' "valid" string')]
Not very user friendly, is it?
I suspect that this is unlikely to be popular, but I think that it would be
nice if there was a plan to move away from XPath, and define a YANG specific
equivalent instead. Broadly it could follow the same format as XPath but be
defined against a YANG data tree, and bind to YANG's types. We could get rid
of the bits of XPath that aren't really helpful or meaningful for YANG, and add
in some new functionality/fixes that are helpful to solve the YANG specific
problems related to path expressions.
The idea has some merit, and I understand the background for this sentiment.
Trying not to be on either side at this point, I would just like to point out
that this would mean a considerable amount of work. Both for the WG to define
this language, and later, for implementors to implement it.
Yes, definitely agree to both of these.
To ease implementation, then possibly a mapping (ideally supported with
an open source conversion tool) could be defined between XPath and a new
YANG path language. How successfully this would be depends on how much
a YANG path language differs/evolves beyond XPath.
One example of this was the NETMOD discussion [Retrieving Information
Pointed by leafref]. It is possible to come up with an XPath expression
that returns the required entries, but it required union operators at
the top level of the expression, which is probably harder to implement
efficiently (i.e. it is fine if you can determine that the two branches
don't return overlapping entries, otherwise you have to collate and
remove duplicates before returning them). If it was possible to move
the union operator further down the expression path then that might more
closely map to an efficient implementation.
E.g. something more like this:
/te/tunnels/(tunnel[name='foo'] |
tunnel[name=/te/tunnels/tunnel[name='foo']/supporting-tunnels/supporting-tunnel/name])
Instead of this:
/te/tunnels/tunnel[name='foo'] |
/te/tunnels/tunnel[name=/te/tunnels/tunnel[name='foo']/supporting-tunnels/supporting-tunnel/name]
Thanks,
Rob
/jan
.
_______________________________________________
netmod mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/netmod