![]() |
libyang
1.0.184
YANG data modeling language library
|
Schema printers allows to serialize internal representation of a schema module in a specific format. libyang supports the following schema formats for printing:
YANG
Basic YANG schemas format described in RFC 6020 and RFC 7951 (so both YANG 1.0 and YANG 1.1 versions are supported).
YIN
Alternative XML-based format to YANG - YANG Independent Notation. The details can be found in RFC 6020 and RFC 7951.
Tree
Simple tree structure of the module where each node is printed as:
<status> <flags> <name> <opts> <type> <if-features>
<status> is one of:+ for currentx for deprecatedo for obsolete<flags> is one of:rw for configuration dataro for status data-x for RPCs-n for Notification<name> is the name of the node(<name>) means that the node is a choice node:(<name>) means that the node is a case node<module-name>:<name>.<opts> is one of:? for an optional leaf or choice! for a presence container* for a leaf-list or list[<keys>] for a list's keys<type> is the name of the type for leafs and leaf-lists<default-value><if-features> is the list of features this node depends on, printed within curly brackets and a question mark {...}?Info
Detailed information about the specific node in the schema tree. It allows to print information not only about a specific module, but also about its specific part:
absolute-schema-nodeid
e.g. /modules/module-set-id in ietf-yang-library module
typedef/typedef-name
e.g. typedef/revision-identifier in ietf-yang-library module
feature/feature-name
e.g. feature/ssh in ietf-netconf-server module
grouping/grouping-name/descendant-schema-nodeid
e.g. grouping/module or grouping/module/module/submodules in ietf-yang-library module
type/leaf-or-leaflist
e.g. type/modules/module-set-id in ietf-yang-library module
Printer functions allow to print to the different outputs including a callback function which allows caller to have a full control of the output data - libyang passes to the callback a private argument (some internal data provided by a caller of lys_print_clb()), string buffer and number of characters to print. Note that the callback is supposed to be called multiple times during the lys_print_clb() execution.