|
UMLOutput
pyang plugin to generate UML diagrams from YANG
IntroductionIn some circumstances it is useful to be able to visualize YANG models as UML diagrams. The uml plugin to pyang generates a file that can be read by plantuml. The following example converts the ietf-netconf-monitoring module into a UML diagram: $ pyang -f uml ietf-netconf-monitoring.yang -o ietf-netconf-monitoring.uml $ java -jar plantuml.jar ietf-netconf-monitoring.uml $ open img/ietf-netconf-monitoring.png On some platforms Java might spit out "java.lang.OutOfMemoryError: Java heap space" Pass the -Xmx<SIZE>m to java like: $ java -Xmx1024m -jar plantuml.jar ietf-netconf-monitoring.uml You can also pass several YANG files to the UML output format, but the files must be given in dependency order. (Multi-file does not work for module/sub-module dependancies) Another example with some parts suppressed: $ pyang -f uml --uml-no=circles,stereotypes,annotation ietf-netconf-monitoring.yang -o ietf-netconf-monitoring.uml
A multi-file example from the ongoing YANG modeling in Metro Ethernet Forum
A complex example based on the Configuration Data Model for IPFIX and PSAMP There is also a python script to generate a UML package structure for all yangs in a folder. uml-utilities/uml-pkg Use it in the following way: $ ls *.yang | xargs -n1 pyang -f depend > packages.txt $ uml-pkg --title=TITLE --inputfile=packages.txt > packages.uml $ java -jar plantuml.jar packages.uml $ open img/packages.png |