pyang
你可以用,我也有这个要求,我用的pyang
就够了。
pyang -f sample-xml-skeleton --sample-xml-skeleton-defaults -o output.xml input.yang
和pyang
格式帮助:
$ pyang -h
Usage: pyang [options] [<filename>...]
-f FORMAT, --format=FORMAT
Convert to FORMAT. Supported formats are: yang, yin,
dsdl, capability, depend, jsonxsl, jstree, jtox, name,
omni, sample-xml-skeleton, tree, uml
Sample-xml-skeleton output specific options:
--sample-xml-skeleton-doctype=DOCTYPE
Type of sample XML document (data or config).
--sample-xml-skeleton-defaults
Insert leafs with defaults values.
--sample-xml-skeleton-annotations
Add annotations as XML comments.
--sample-xml-skeleton-path=SAMPLE_PATH
Subtree to print