Skip to content

Setup NaC for SDWAN

The best method to start working with Network as Code Nexus Dashboard is to clone our example repository. This repository contains the proper directory structure and base files required. In addition the team updates this repository to match with releases so that you get the correct combination of versionss for execution.

Terraform Setup for Network as Code for SDWAN

Section titled “Terraform Setup for Network as Code for SDWAN”

In this section, you will clone the repository and then setup Terraform for Network as Code for SDWAN. This includes setting the Python virtual environment, installing necessary packages, and configuring Terraform to work with SDWAN.

The first step is to clone the example repository that contains the necessary files and configurations for Network as Code (NaC) for SDWAN. Using the GIT command you will be doing a clone of the example repository into a directory named nac-sdwan-terraform in your home directory.

Note: If you are not familiar with GIT, please refer to the Understanding GIT section of this guide. It provides a starting point to help you understand GIT and the relationship with Network as Code.

Terminal window
cd ~/network-as-code
git clone --depth 1 https://github.com/netascode/nac-sdwan-example nac-sdwan

Once completed you should be able to see the structure inside of the IDE.

Repository Structure

After cloning the repository, you will need to remove the .git directory. This is because you will be using this repository as a starting point for your own Network as Code SDWAN project. We provide these example repositories as “starting points”, but you will not be using this repository for yourself. When you delete the .git directory, you will no longer be able to use GIT commands to manage the repository until the repository has been initialized again, which you will do later in this guide.

Terminal window
cd ~/network-as-code/nac-sdwan
rm -rf .git

Step 3: Install all python requirement packages

Section titled “Step 3: Install all python requirement packages”

We must install the required packages for Network as Code testing and validation. The lab environment comes pre-configured with Python, so you can install packages directly using pip:

  • nac-validate: Syntax and schema validation for Network as Code data model files.
  • nac-test: Testing framework for Network as Code data model files.
  • jmespath: JSON path expressions for data extraction and filtering.
Terminal window
cd ~/network-as-code/nac-sdwan
pip install nac-validate nac-test jmespath

Terraform is shipped as a single binary file and there is no dependency. In this lab Terraform comes pre installed.

Terminal window
terraform -v
Terraform v1.13.1
on linux_amd64

The data folder contains the data model used by Network as Code. The ‘.rules’ folder and .schema.yaml file contains the rules used by nac-validate to validate the data model files. The ‘tests’ folder contains the tests used by nac-test to test the data model files. The main.tf file is the main Terraform configuration file that defines the resources to be created and managed by Terraform.

Diagram

Navigate to nac-sdwan directory.

Terminal window
cd ~/network-as-code/nac-sdwan

Configure the following environment variables.

Terminal window
export SDWAN_USERNAME=sdwan
export SDWAN_PASSWORD=C1sco12345
export SDWAN_URL=https://198.18.133.100