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-XR devices in minutes, following the familiar IOS-XR CLI structure. This is achieved by separating the *.yaml files which contain the desired IOS-XR 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-XR 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 hostname of a single device:
---iosxr: devices: - name: router-1 host: 1.2.3.4 configuration: hostname: router-1IOS-XR Provider
Section titled “IOS-XR Provider”The Terraform provider for IOS-XR manages device configuration over gNMI, a standards-based, YANG-modeled API. gNMI (default port 57400) must be enabled on each device before Terraform can communicate with it:
config tgrpc port 57400 no-tls address-family ipv4commitendThe no-tls line disables TLS on the gRPC server. It is convenient for a lab, so the examples in this guide use it together with IOSXR_TLS=false. For production, enable TLS on the device and configure the provider certificates instead.
Network as Code for IOS-XR Module
Section titled “Network as Code for IOS-XR Module”The Network as Code Terraform module for IOS-XR is responsible for mapping the data to the corresponding IOS-XR resources. This module supports an inventory driven approach, where a complete IOS-XR 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.
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.