cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1968
Views
0
Helpful
1
Replies

yanger: Generate html document

DTtb
Level 1
Level 1

Hi all,

NSO is using yanger to validate the yang models internally.

 

Is it possible to generate a HTML document based on defined yang model, like pyang does it?

 

If not: It is recommend to generate a HTML doc by pyang, although NSO is using only yanger?

 

Output of yanger help page:

$ yanger --help
Usage: yanger [-h] [-v] [--print-error-code] [-p <path>] [-P <plugindir>] [-c] [--strict] [-e] [-W <warning>] [-w <no_warning>]
              [-E <error>] [-f <format>] [-t <transform>] [--deviation-module <deviation_module>] [-F <features>] [-o <outfile>]
              [--no-deviation-apply] [--print] [--print-all] <file>...
[...]
-f, --format                      Convert to FORMAT.  Supported formats are: fxs,jsoninfo,sn,swagger,tree,yang.

Output of pyang help page:

$ pyang --help 
Usage: pyang [options] [<filename>...]
Validates the YANG module in <filename> (or stdin), and all its dependencies.
Options:
[...]
-f FORMAT, --format=FORMAT Convert to FORMAT. Supported formats are: dsdl, depend, sample-xml-skeleton, omni, yin, tree, html, jstree, capability, yang, xsd, uml, rest-doc, jtox, jsonxsl

Thanks

1 Accepted Solution

Accepted Solutions

perander
Cisco Employee
Cisco Employee

There is no HTML output format for Yanger.

 

The closest thing is a two step procedure where Swagger (for RESTCONF) can be generated with Yanger and saved to file

yanger -t expand -f swagger example-jukebox.yang > example-jukebox.yang.swagger.json

 This file can then be viewed with Swagger/OpenAPI tools, e.g. Swagger UI.

View solution in original post

1 Reply 1

perander
Cisco Employee
Cisco Employee

There is no HTML output format for Yanger.

 

The closest thing is a two step procedure where Swagger (for RESTCONF) can be generated with Yanger and saved to file

yanger -t expand -f swagger example-jukebox.yang > example-jukebox.yang.swagger.json

 This file can then be viewed with Swagger/OpenAPI tools, e.g. Swagger UI.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the NSO Developer community: