Loading...
Searching...
No Matches
Module Printers

Schema printers allows to serialize internal representations 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).

- YANG compiled

  Syntactically, this format is based on standard YANG format. In contrast to standard YANG format, YANG compiled format represents the module how it is used by libyang - with all uses expanded, augments and deviations applied, etc. (more details about the compiled modules can be found on Context page).

- YIN

  Alternative XML-based format to YANG - YANG Independent Notation. The details can be found in RFC 6020 and RFC 7951.

- Tree Diagram

  Simple tree diagram providing overview of the module. The details can be found in RFC 8340.

For simpler transition from libyang 1.x (and for some simple use cases), there are functions (lys_print_clb(), lys_print_fd(), lys_print_file() and lys_print_mem()) to print the complete module into the specified output. But note, that these functions are limited to print only the complete module.

The full functionality of the schema printers is available via functions using output handler. Besides the lys_print_module() function to print the complete module, there are functions to print a submodule (lys_print_submodule()) or a subtree (lys_print_node()). Note that these functions might not support all the output formats mentioned above.

## Functions List

- lys_print_module()
- lys_print_submodule()
- lys_print_node()
- lys_print_clb()
- lys_print_fd()
- lys_print_file()
- lys_print_mem()
- lys_print_path()