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.
A lot of people are in a similar case and are not sure how to start their journey to
I was in a similar case a few weeks ago and I decided to
- 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:
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
First, I need to build the image ( I use the term “bake” when I speak about
nic@vPackets-MBPro.local:/Users/nic/Code/DOCKER - Tools git:(master) $ docker build -t vpackets/tools .
Successfully built 130aba981a36
Successfully tagged vpackets/tools:latest
Now that you baked (built) the container using the recipe (Dockerfile), you are ready to consume the container.
docker run -dit --name vpackets-tools -h vpackets-container -v /Users/nic/Code/:/home/nic/code vpackets/tools:latest
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
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.