Table of Contents
Network Automation Lab requires at least one controller to manage devices and one device to be managed.
We will be using Ubuntu with Visual Studio Code and Python as the controller and a Cisco IOS XE device managed through the controller throughout the course.
In this section, you will learn how to prepare these components for the rest of the course.
Network Automation Lab Preparation
I have already prepared the lab environment, but just to show how I prepared it, I will point out the main steps and points I have had. They are not exact but hopefully help you.
Install Ubuntu, Visual Studio Code and Python
In the first step I installed an Ubuntu desktop version. At the time of writing the latest version is 22.04.1 which you can download from this link.
Then I installed Python3 on the Ubuntu machine with these commands.
You probably have multiple versions of python2 and python3 on your machine, but that’s not a problem because in Visual Studio Code we choose our correct Python version.
In the next step I installed Visual Studio Code. It’s an environment where you can easily create your code.
To install Visual Studio Code, you can search in Ubuntu software for “vscode” as a keyword and then install “code”.
To start your Python codes in Visual Studio Code, you must install the Python extension in Visual Studio Code. Therefore in extension section or “file -> preferences -> extension”, search and install python.
After installing the Python extension in Visual Studio Code, in the same page there is a section asking you to select your correct Python version in Visual Studio Code.
If you no longer see this section, you can open or create a Python “.py” file. When you open a Python file, the lower-right section of Visual Studio code shows the current Python version. If you click on the current version, all installed python versions will be shown and you can choose the right version, preferably the latest version of Python3.
Another option is to use the keyboard shortcuts “Ctrl+Shift+p“. You see the Visual Studio Code command environment. Then type or choose “Python: Select Interpreter”. Now you can choose the right version of python to be used in visual studio code.
Prepare Cisco CSR 1000v IOS XE
In addition to the automation controller, we also need at least one router to be managed by the controller. To follow this course I chose to use Cisco IOS XE during the course. A lab with routers from multiple vendors is of course preferred.
To prepare network devices, we have many options. Cisco Sandbox, Eve-ng, GNS3, add virtual devices in VMware Workstation or vSphere Server or any other virtual hypervisor. It is important that you can prepare a connection between your controller and your devices.
Here I will show you two methods, Cisco sandbox and local Cisco IOS XE on VMware vSphere Server.
For the Cisco sandbox environment, simply search Google for “cisco sandbox”. Then select the “Networking” section and then and IOS XE Lab.
At the time of writing, there is only one IOS XE lab in Cisco Sandbox that you can access by reserving and creating a VPN connection
There you can see the IP address to connect to the device, the username, the password and the methods of connection which is SSH, NETCONF and RESTCONF. At this course we need only SSH connection to the device.
But I will be using the CSR 1000v Cisco IOS XE during the course, which I imported locally into my VMware vSphere Server. The version I’m using is 17.01.01 which you can download from Cisco’s website.
To prepare Cisco IOS XE, I gave the device an IP address and configured SSH for the remote connection.
This is the configuration I have already applied to the device.
Prepare Ubuntu to connect to the device via SSH
Ma Lab is prepared. I could connect to the device via SSH.
But when I tried to connect to the device via Ubuntu, I have received the error that some algorithms does not match between Ubuntu and Cisco IOS XE device.
After troubleshooting I solved the problem by adding the supported SSH algorithm for the IP address of the IOS XE device in the “config” file in the “.ssh” folder in the home directory.
Pull Python codes in your Ubuntu machine
If you want to have all python codes locally on your machine, you can install and clone my automation python codes from my GitHub.