Explore NaC Repo
NaC Introduction
  • Introduction
  • NaC Introduction
  • Manual Validation
  • CXTM Introduction
  • CXTM Projects
  • CXTM Test Cases
  • CXTM Test Automation
  • CXTM Git Integration
  • CXTM Batches
  • CXTM Notifications
  • Final Deployment
  • CXTM Reporting
  • CXTM References
  • Bonus Content

Network as Code Repository Structure


A Network as Code repository organizes network configurations, tests, and automation in a structured way. This makes it easy to manage, version control, and deploy network changes safely and consistently. In this lab, you'll work with the LTROPS-2711 repository, which manages the entire data center fabric.

GitLab is a web-based DevOps lifecycle tool that provides Git repository management, issue-tracking, and CI/CD pipeline features using an open-source license. To get started, you will login to the GitLab instance to view the LTROPS-2711 repository.

Step 1 - Login to GitLab

Login to the GitLab instance by clicking the URL below or copying the URL into a new tab in your browser window:

Login using the information below:

  1. Username: pod07
  2. Password: cisco.123
  3. Then click Sign in


Step 2 - Repository Overview

The LTROPS-2711 repository is already created and initialized with the necessary files for the lab. Additional configuration files will be added to the repository as we progress through the lab.

  1. Your landing page should look similar to the below screen capture.

What's Inside the Repository


The repository contains these main components:

LTROPS-2711/
├── .ci/                    
│   ├── webex-notification-gitlab.py 
├── .rules/                 
│   └── 101_unique_keys.py         
├── data/                  
├── cxtm/                   
├── .schema.yaml           
├── main.tf                
└── README.md              

.ci/ folder - Contains reusable scripts that perform specific pipeline tasks. The webex-notification-gitlab.py script is called by the .gitlab-ci.yml pipeline stages to send notifications about pipeline execution results.

.rules/ folder - Contains scripts that define conditional logic when pipeline jobs are run.

.schema.yaml - Defines the data model rules for all network device configurations. This schema ensures that YAML configuration files follow a consistent structure and contain valid parameters.

main.tf - The primary Terraform configuration file that orchestrates the deployment of your Nexus fabric. It defines the Terraform backend for state management and declares the NX-OS module that processes all YAML files in the data/ directory to generate and apply device configurations.

data/ folder - Stores individual YAML files for each network device. These files define the desired state of each device's configuration in a human-readable format. You'll be adding and maintaining the configuration files for all the devices in the lab topology during the lab exercises.

cxtm/ folder - Contains Robot Framework test cases that validate network functionality after configuration changes are deployed. These automated tests ensure the network is operating as expected.

.gitlab-ci.yml - Defines the CI/CD pipeline that automates the entire workflow through five stages: Validate (check YAML files for errors), Plan (preview what changes will be made), Deploy (apply changes to devices), Test (run CXTM tests to verify success), and Notify (send results to your team). This ensures every change is tested before reaching your network.

Setup Git Repo


Visual Studio Code is an interactive development environment (IDE) or simply, a code editor. You may hear Visual Studio Code referenced as VS Code or just code in the industry. VS Code is free to use for many types of development and supports various extensions for syntax checking and highlighting depending on the code language you are working with. For this lab, you will be working primarily with YAML file types. You will leverage VS Code as your code editor and GitLab's CI pipeline as your runtime environment.

Step 3 - Navigate to VS Code Server

The VS Code Server is a web-based IDE version that provides a development environment for this lab.

  1. Click on the link below to access the VS Code Server.


  2. Enter the password below into the VS Code Server login.

    • Password: cisco.123



  3. Your landing page should look similar to the below screen capture.


  4. Press Ctrl + Shift + ` (back tick) to open a new terminal window in VS Code Server


Note

If the keyboard shortcut above does not work, please open the VS Code Server hamburger menu and click Terminal > New Terminal


Step 4 - Clone LTROPS-2711 Repo

  1. Clone the pod07 user repository LTROPS-2711 using the 'clone with SSH' option.

    Copy and paste the below command in the VS Code Server terminal window to start the cloning process.

  2. 
    git clone git@cait-gitlab.svsrtpdmz.cisco.com:CL-POD07/LTROPS-2711.git
    
            

  3. Enter yes to continue when prompted to confirm the SSH connection authenticity to the repository server.

  4. The authenticity of host 'cait-gitlab.svsrtpdmz.cisco.com (10.0.205.200)' can't be established.
    ED25519 key fingerprint is SHA256:gJcb41tVGExNFq7UBf+z8bYRH7L1Y+WKvFPp6fbmXls.
    This key is not known by any other names
    Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
            

  5. Upon successful cloning of the repository, the files from the repository will be visible and accessible from the VS Code Server. Click on the LTROPS-2711 folder to view the cloned files. Your landing page should look similar to the below screen capture.


  6. Locate and open the main.tf file to view the Terraform configuration details. This file defines the Terraform backend configuration which stores the state file remotely in GitLab using HTTP, declares the NX-OS module location and the yaml_directories parameter that points to the data/ folder where all device configuration YAML files are located.


  7. Locate and open the data directory to view that there are no configuration YAML files present. The NaC solution will take all the available files in the data directory and push the configuration to the Nexus fabric. So, all Nexus fabric switch related configuration files need to be placed inside this data directory.


  8. Change directory to the repository LTROPS-2711 folder.

    
    cd LTROPS-2711/
    
            

Continue to the next section to create and manage the Nexus data center deployment configurations.