pyang
pyang copied to clipboard
dump modified object to YANG
Question: Is there a way to 'dump' the contents of a modified object (ModSubmodStatement) to YANG. E.g. I'd like to add/remove statements from the module object and then store the new one. The pprint seems to be used for debugging as it adds some extra debug lines to the output.
The "yang" plugin formats a module statement (tree) as yang. This is invoked with "pyang -f yang" on the command line.
You can write your code that modifies some statements as a "transform", and then do "pyang -t
There is one builtin transform "edit", which can be used to do some simple transformations of modules. See the man page for details (and test code for examples)