I would like to see a day come true where all major vendors’ boxes (even small & cheap ones) will be 100% covered by YANG models. Can’t say I believe that it is possible for IETF to standard all the things in vendors domain, but we will manage as long as vendors will stick to standard YANG in their own in-house data modes.
Being in shadows for quite some time, Netconf/Yang are still something new to explore for many of network engineers, myself included. And that’s todays topic — exploring YANG data models with Yang Explorer tool in a docker container (reads: without pain).
Yang Explorer is capable of many things related to Netconf/Yang:
- Upload / Compile yang models from User Interface Or Command Line
- Build NetConf RPC
- Generate Python example code
- Search yang xpaths
- Execute RPC against real netconf server
- Save created RPCs to collections for later use
- Build dependency graph for models
- Browse data model tree and inspect yang properties
What is interesting particularly for me is to be able to build Netconf RPC for further usage with awesome Atom Netconf plugin against Nokia routers. Though when I first met Yang Explorer it was not so easy to install it due to some dependency hell on my VM.
And if to give a thought a tool like this, which you ran occasionally, makes a perfect candidate for a
containerization. No need to spawn and store a VM, just run a container, explore some Yang, stop a container. Fast, convenient, painless.
Yang Explorer in a container
MAINTAINER Roman Dodin <firstname.lastname@example.org>
RUN DEBIAN_FRONTEND=noninteractive apt-get update; apt-get install -y python2.7 python-pip python-virtualenv git graphviz libxml2-dev libxslt1-dev python-dev zlib1g-dev
RUN DEBIAN_FRONTEND=noninteractive git clone https://github.com/CiscoDevNet/yang-explorer.git
RUN bash setup.sh -y
RUN sed -i -e 's/HOST=\x27localhost\x27/HOST=$HOSTNAME/g' start.sh
CMD ["bash", "start.sh"]
The only thing that steps away from a described installation process is sed -i -e 's/HOST=\x27localhost\x27/HOST=$HOSTNAME/g' start.sh command. It is needed for a Web backend to accept connections made to a containerized application.
How to use
To run a container based on my image simply run:
docker run -p 8088:8088 -d hellt/yangexplorer-docker
Docker will pull the
hellt/yangexplorer-docker image and instantiate a container with exposing the
8088 port. Navigate your browser to the following URL (watch out for the port) to start Yang Explorer web app:
Note, that image size is approx.
Then follow official documentation on how to upload yang models and do some other things. Can’t say that this app behaves smooth and reliable, but its still beta and opensource, so you can contribute in any way.
Another yang explorer image
When I stumbled upon installation troubles half a year ago I checked docker hub for Yang Explorer image. Back in that time there was none. So I dropped it till these holidays when I found that Robert Csapo built a docker image for Yang Explorer. So why to build another image if there is one already?
Robert’s image is based on a fork of official repo, and I would like to create one which is based on a master branch of official one. As far as I can tell, Robert is a Cisco employee, so it could be safe to follow his repo, but its good to have another option if something happens with Robert’s image.