Network As Code (https://netascode.cisco.com/) aims to reduce time to value by lowering the barrier of entry to network orchestration through simplification, abstraction, and curated examples.
It allows users to instantiate network in minutes using an easy to use, opinionated data model and takes away the complexity of having to deal with references, dependencies or loops. Users can focus on describing the intended configuration while using a set of maintained and tested Ansible Modules without the need to understand the low-level network device configuration.
Network as Code has several Data Models
to help customer leverage the same methodology for their
entire network. Some of these models include:
In this particular section of the lab, we will be leveraging the VXLAN
module to configure
and deploy and new VRF.
The VXLAN
Data Model structure is divided into multiple high level sections:
It is important to continue to check the Network as Code website
as new features continue to be added to the Data Models
.
To make things easier in the lab, we have created an environment leveraging the web version of
Microsoft Visual Studio Code. This tool will allow us to create and edit the necessary files needed
to get Service as Code
working.
To access your POD which contains your Microsoft Visual Studio Code instance, please go to:
https://10.0.226.241:16005/?folder=vscode-remote://10.0.226.241:16005/home/pod05/ltrdcn-2654
After succesfully logging to Microsoft Visual Studio Code, you will be presented with the following screen:
Please open terminal session inside Microsoft Visual Studio Code by following steps:
At the bottom of the screen the terminal will appear with the following prompt:
pod5 ~/ltrdcn-2654 $:
Please contact one of the lab instructor if the prompt is different.
Before we start taking advantage of Service as Code and the VXLAN
Data Model, we
need to setup our working environment. This requires setting up:
VXLAN
Data Model CollectionNOTE: During the following steps you can leverage the copy function as well by hovering your mouse just below the Cisco logo and the copy icon will display. Allowing you to copy the command and then, being able to paste the command in the terminal. As in previous section we are trying to minimize errors.
pyenv install 3.10.13
pyenv versions
* system (set by /home/pod05/.pyenv/version) 3.10.13
pyenv global 3.10.13
The command to create your virtual environment using pyenv is pyenv virtualenv {python_version} {virtualenv_name}
.
Create a virtual environment called nac-ltrdcn-2654
using the 3.10.13
Python version you previously installed.
Do this by either typing or copying the command below into your VSCode Terminal window:
pyenv virtualenv 3.10.13 nac-ltrdcn-2654
Next, use the pyenv local {virtualenv_name}
to set the virtualenv for the project. This will create a
.python-version
file within the current directory, thus the reason we went ahead and changed directory into the project directory.
This file is powerful as it will handle activating and deactiving the virtualenv as you move in and out of the project directory automatically,
otherwise, this is an action you would need to perform manually or by some other automated means.
Do this by either typing or copying the command below into your VSCode Terminal window:
pyenv local nac-ltrdcn-2654
And with that you have created and activated the virtual environment you will use during this lab.
Notice that it placed you inside the virtual environment after creating it. The
important part is the way the SHELL looks like while you are inside
the virtual environment. Notice the (nac-ltrdcn-2654)
at the start of the line; that indicates the virtualenv is active.
What active virtualenv looks like:
(nac-ltrdcn-2654) pod05 ~/../nac-ltrdcn-2654 $:
Now, that we have setup our environment, let's move to the next session to setup Service as Code for our VXLAN environment.