Docker container of Yang Creator can be found at here.
YANG Creator is a great tool for novice users who are still learning syntax rules and can serve as an introduction into the Sysrepo project.
Similarly to testconf, YANG Creator was also one of the NETCONF/YANG utilities which was ported to libyang (one of Sysrepo's main dependency), through which the tool switched to the community standard YANG backend. Initially, the tool enabled code generation where prototype code templates could be generated for C language in both plugin and application mode. Showcase of this can be seen here.
This section will guide you how to install YANG Creator on a fresh Ubuntu 16.04 build. Follow the steps or watch the video below:
Start by running the Ubuntu container:
docker run -i -t --name yang --rm ubuntu:16.04 bash
Then update and install necessary packages:
[email protected]:/# apt-get update [email protected]:/# apt-get install git nodejs npm python-setuptools libpcre3-dev
Download python package installers easy_install and pip
[email protected]:/# easy_install pip Searching for pip Reading https://pypi.python.org/simple/pip/ (truncated output)
and then install pyang:
[email protected]:/# pip install pyang
Now head into /opt/ directory and there clone the YANG Creator github repo:
[email protected]:/opt# cd /opt/ [email protected]:/opt# git clone https://github.com/freenetconf/yang-creator.git
Head into yang-creator directory. Due to a known nodejs binary naming conflict, we will also need to symlink /usr/bin/node to /usr/bin/nodejs and specify that we will use python2 version. After that issue npm install:
[email protected]:/opt/yang-creator# ln -sf /usr/bin/nodejs /usr/bin/node [email protected]:/opt/yang-creator# export PYTHON=python2 [email protected]:/opt/yang-creator# npm install
Lastly, you can run the YANG Creator server with:
[email protected]:/opt/yang-creator# ./server.js
After you have run the server, access YANG Creator by opening http://127.0.0.1:8888/ in your browser. You should get the following screen:
To manage your YANG files, enter your e-mail address and password. If there are any modules that import other modules, these dependent modules will need to be created/imported and saved, after which they can be used. Let us see which options are available in YANG Creator:
Using this option you can manage (edit or remove, download or export source code) files which you have saved in your account. You can also reset your YANG database and start from scratch.
This option is used for creating new modules and submodules.
By clicking Validate, on the right side of the screen you should see whether your YANG module is valid or not. Validation is performed using pyang.
Review your finalized YANG module and download, copy, export source code or send to mail. Note that copying the module requires flash.
As its name states, this option saves the module currently edited for later usage.