netconfcentral logo
YangTools

 

smidump

The smidump program is used to convert SMIv2 source files to YANG modules.

This program is part of the libsmi library, and is can be freely obtained from the libsmi download page. It is also available in many Linux distributions.

The YANG module sources generated from SMIv2 are created with smidump, using the following Makefile commands, run from a work directory:


    TARGET=../modules/ietf

    PLAINS = $(patsubst %.txt,%,$(wildcard *.txt))

    YANGS = $(patsubst %,$(TARGET)/%.yang,$(wildcard *-*))

    # generate the YANG modules in the target directory
    $(TARGET)/%.yang: %
         smidump -f yang --yang-smi-extensions \
            --yang-indent 3 --output $@ ./$< 

    # convert FOO-MIB.txt to FOO-MIB
    %: %.txt
          mv $< $@

	

yangdump

The yangdump program is used to convert YANG source files to XML Schema 1.0 (XSD), or Extensible HyperText Markup Language 1.0 (XHTML), and other formats.

The HTML for YANG modules used in most WEB pages is generated with the following command line, run from the modules sub-directory.


    modules> yangdump --format=html --subtree=. --defnames=true \
      --output=$(HTML_TARGET) --log-level=info --html-div=true \
      --html-toc=menu --urlstart=/modules --simurls=true

	

The HTML for the 'cooked' YANG modules WEB pages is generated with the following command line, run from the modules sub-directory.


    modules> yangdump --format=html --subtree=. --defnames=true \
	--output=$(COOKEDHTML_TARGET) --log-level=info \
        --html-div=true --html-toc=menu --urlstart=/modules \
        --simurls=true --objview=cooked

	

The XSDs for the YANG modules are generated with the following command line, run from the modules sub-directory.


    modules> yangdump --format=xsd --subtree=. --defnames=true \
	--output=$(XSD_TARGET) --urlstart=/xsd --log-level=info

	

The source files available for the modules used in the database are directly copied (with versions in the filenames) with the following command line, run from the modules sub-directory.


    modules> yangdump --format=copy --subtree=. --defnames=true \
	--output=$(COPY_TARGET) --log-level=info 

	

The internal SQL database information is generated with the following command line, run from the modules sub-directory. This database is still under development, so it is not available online at this time. (Warning: this command will generate a very large SQL file!)


    modules> yangdump --format=sqldb --subtree=. \
	--output=$(SQLDB_TARGET) --log-level=info \
	--urlstart=/modules --simurls=true

	

The following limitations apply to the HTML and YANG files generated by yangdump:

  • Comments are not saved, and are not used in the generated output.
  • String concatenation is not preserved. The converted string is used in the generated output.