Menu déroulant pour mobile

Category : Containers

Creating a Net-DevOps environment.

TL;DR : Code is here. Help yourself 🙂

Introduction to the Net-DevOps Container:

Recently, Ethan Banks posted a very interesting blog post where he struggled a little bit to set up a Python environment. If I understood correctly, he wanted to increase his skills set in particular with NetDevOps. He fairly pointed that it could be a bit complicated to handle all the dependencies you might need. Based on the fact that you also want to start fresh between projects you want to spend the least amount of time resolving these kinds of issues and maximize your time on something that is valuable: Learn how to Automate or just Automate your network environment.

Credit xkcd #1987 and inspired by Ethan’s site to illustrate my point.

A lot of people are in a similar case and are not sure how to start their journey to Devops / Full stack engineer. Ivan Pepelnjak first lessons of the great Network Automation Course is inviting us to create a lab environment so that you can practice in a safe environment (aka “don’t mess with your prod”)… You can use eve-ng / GNS3/ VIRL / Vagrant to emulate the devices but I also wanted to have an environment where I could run the code …. and don’t have to rely on my corporate laptop OS.

I was in a similar case a few weeks ago and I decided to setup an environment that would fill the following requirements:

  • Must be able to run scripts
  • Changes in that environment must be quick and easy to install. We don’t have much time to troubleshoot the dependencies.
  • Must be able to edit code on my favorite code editor rather than vim (sorry guys … my beard is not long enough 🙂 )
  • Must be able to run the environment on any machine (PC / MAC / Server) so that I can experience the same behavior everywhere.

All these requirements led me to the wonderful world of Docker !

By definition, Docker is a tool engineered and release with one goal in mind: “Create and Deploy application using containers”. It was natural to add Docker as a tool of the NetDevOps portfolio. It felt natural to create a “NetDevOps container that will allow me to work with efficiency in mind. I wasn’t very familiar with it until last year so it was a good opportunity to learn it.

In order to have a container, you need to choose a base image and I decided to go with Ubuntu 18.04 because I was familiar with it and enjoyed it throughout the years. Ubuntu is now very popular across the world and the community is one of the best (if not the best)

Then, I managed to install all the regular and well-known linux tools that I am using as a network engineer: fping/hping, curl, htop, iperf, netcat, nmap, openssh-client, snmp-walker (yeah !), tcpdump, tshark, telnet (!), wget, vim and zsh. I am pretty sure you used them at least once as well …

From a Net DevOps standpoint, I have installed most of the things I needed as well: Python2, Python3, Powershell (NSX), PIP, Ansible 2.7.4. Libraries are not left behind, they are critical and mandatory for your scripts to run. We are network engineers and not full time developers (or real developers I should say) so there is a chance we will use the same libraries over and over again (e.g netmiko, napalm, nornir, xmltodict, PyYAML …). Hank from Cisco DevNet has released an awesome video that demonstrates all the useful libraries a network engineer should use. I have implemented these libraries into a requirements.txt file that will be copied and installed when the docker image is build using pip. There are still some work that needs to be done in order to configure ansible up to this point but I got mainly what I need …


First, I need to build the image ( I use the term “bake” when I speak about container so it helps neophytes to understand it better) so that I can consume it.

Now that you baked (built) the container using the recipe (Dockerfile), you are ready to consume the container.

We are now in the container and ready to automate !!! We have access to our networking tools as well as our NetDevOps tools

It is obvious that if you want to use that particular container, you should probably change a few things to accommodate your needs. For example this container will create a user ‘nic’ with a home directory of the same name … You might want to change that. Also, I did a mapping of my laptop drive to a folder in the container so that I could use my laptop editor to work on my code but execute it in the container.

I am still far away from being an expert in NetDevOps so if you have suggestions or comment so that I could improve this, please let me know !

Also I have uploaded a series of video of that work here. Refer to videos 3 and 4 in order to see this in action.