![]() |
libyang 1.0.184
YANG data modeling language library
|
All data nodes in data trees are connected with their schema node - libyang is not able to represent data of an unknown schema.
Connected to the aforementioned, it is important to mention that there are several kinds of data trees libyang can work with. Except for a standard full data tree and configuration data tree, there are trees specific for use in NETCONF, which are <get> or <get-config> replies, <edit-config> input content, generic RPC/action request, RPC/action reply, or a notification.
Special care is needed when working with action input and RPC/action output, because in these cases the libyang data tree does not match the actual data tree NETCONF expects.
Action input differentiates from a standard RPC that the child of <rpc> element is not the specific RPC request being sent, but a special <action> element in the base YANG namespace. It is expected to be present when parsing an action input and can optionally be included when the action is printed.
As for RPC output, NETCONF expects the output parameters as direct children of the <rpc-reply> element. However, libyang encapsulates these parameters in the specific RPC request container. Same as before, it is expected to be without this container when parsing and can be printed out.
Lastly, action output is almost similar to RPC output and in NETCONF you actually cannot distinguish them, but in case of action output, libyang puts all the output parameters under the action container, which is also just a child to all the schema tree ancestors up to the schema top-level, just like in an action input. Same applies even in this case, parsed data should be only the output parameters, you can decide how to print it.
So, you do not have to use any special flag when you want to print the data tree the way libyang internally stores it, although you will not be able to parse it back, as was mentioned in the paragraphs above. To print data in the way NETCONF and libyang expects them to be, use LYP_NETCONF flag for any printing function.
Please, continue reading a specific subsection or go through all the subsections if you are a new user of libyang.