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 IOS-XE devices in minutes, following the familiar IOS-XE CLI structure. This is achieved by separating the *.yaml files which contain the desired IOS-XE 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 IOS-XE 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 device:
---iosxe: devices: - name: Switch1 host: 1.2.3.4 configuration: system: hostname: Switch1 mtu: 9198IOS-XE Provider
Section titled “IOS-XE Provider”The Terraform provider for IOS-XE manages device configuration over NETCONF, a standards-based, YANG-modeled API. NETCONF (default port 830) must be enabled on each device before Terraform can communicate with it:
config tnetconf-yangendNetwork as Code for IOS-XE Module
Section titled “Network as Code for IOS-XE Module”The Network as Code Terraform module for IOS-XE is responsible for mapping the data to the corresponding IOS-XE resources. This module supports an inventory driven approach, where a complete IOS-XE 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 (including a dedicated cli template type for raw CLI snippets), 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.