YANG extension nodes paths
Hello,
I was recently trying to work with YANG nodes defined in extension instance. I was looking at this libyang unit test and I don't understand the format of the path for the lyd_new_path call. Why can't I use absolute path to the z leaf, i.e., /ext:c/z? The return is then LY_EVALID with a log message Not found node "c" in path.
Also, documentation of lyd_new_path that * If creating data nodes defined inside an extension instance, use ::lyd_new_ext_path(). which is not entirely true according to this paragraph which states that only first node must be created using the lyd_new_ext_* functions.
Why can't I use absolute path to the z leaf, i.e., /ext:c/z?
What if the module ext also defined
container c {
leaf z {
type string;
}
}
You would then get an ambiguity, hence the special functions. The exact extension instance is required because you may even have several extension instances with the same data nodes.
If creating data nodes defined inside an extension instance, use ::lyd_new_ext_path().
It does not say you must use the function for all the nodes but you can :)