pyang icon indicating copy to clipboard operation
pyang copied to clipboard

dump modified object to YANG

Open sispehar opened this issue 4 years ago • 1 comments

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.

sispehar avatar Nov 03 '20 12:11 sispehar

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 -f yang".

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)

mbj4668 avatar Nov 03 '20 13:11 mbj4668