Introduction
Network as Code allows for complete separation of data (defining variables) from logic (infrastructure declaration). With little to no knowledge about automation, users can configure Cisco NX-OS switches in minutes, following the familiar NX-OS CLI structure. This is achieved by separating the *.yaml files which contain the desired NX-OS state from the Terraform Modules which map the definition of the desired state to Terraform resources. The data model and modules used in Network as Code are open-source and available as-is. For support and or customization it is required to engage with Cisco Professional Services.
The tree output below shows an example of a data model where the *.yaml files compose logical groups that map to constructs that NX-OS users are very familiar with.
Directorydata
- inventory.nac.yaml
- system.nac.yaml
- routing.nac.yaml
- main.tf
Configuration for a device can simply be managed via YAML files. Below is a simple example configuring the system settings of a single switch:
---nxos: devices: - name: Switch1 url: https://1.2.3.4 configuration: system: hostname: Switch1 mtu: 9216NX-OS Provider
Section titled “NX-OS Provider”The Terraform provider for NX-OS uses NX-API to manage device configuration through DME (Data Management Engine) model objects. NX-API must be enabled on each device (feature nxapi) before Terraform can communicate with it.
Network as Code for NX-OS Module
Section titled “Network as Code for NX-OS Module”The Network as Code Terraform module for NX-OS is responsible for mapping the data to the corresponding NX-OS resources. This module supports an inventory driven approach, where a complete NX-OS configuration or parts of it are modeled in one or more YAML files.
For multi-device deployments, the module provides powerful abstractions: device groups allow logical grouping of devices, templates enable reusable configuration blocks with variable substitution, and interface groups define shared interface configurations. The VXLAN example repository demonstrates a comprehensive multi-device VXLAN EVPN fabric deployment using these concepts.
Additional services
Section titled “Additional services”Cisco Customer Experience (CX) is able to help you with many additional services such as CI/CD integration, pre-change validation, integration with Information Technology Service Management (ITSM), as well as automated testing. Please reach out to your Cisco account team for more information.