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 instantiate SD-Access Fabrics in minutes using an easy to use, opinionated data model. This is achieved by separating the *.yaml
files which contain the desired Catalyst Center state from the Terraform Modules which map the definition of the desired state to Terraform modules and 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 Catalyst Center users are very familiar with.
Directorydata
- devices.nac.yaml
- discovery.nac.yaml
- fabric.nac.yaml
- network_profiles.nac.yaml
- network_settings.nac.yaml
- sites.nac.yaml
- wireless.nac.yaml
- templates.nac.yaml
Directorytemplates
- *.j2
- main.tf
Configuration for switching_network_profiles
and wireless_network_profiles
can simply be managed via the network_profiles.nac.yaml
:
---catalyst_center: network_profiles: switching: - name: VirtualCat9k dayn_templates: - ACL_Block sites: - Global/Poland/Krakow wireless: - name: WIRELESS_PROFILE ssid_details: - name: SSID_1 enable_fabric: false enable_flex_connect: false sites: - Global/Poland/Krakow
Catalyst Center Provider
The Terraform provider for Catalyst Center includes resource which can be used to manage Catalyst Center configuration elements. A simple example of how to use the resource can be found below:
resource "catalystcenter_area" "san_jose" { name = "San Jose" parent_name = "Global"}
The Catalyst Center resources are not only capable of pushing a configuration but also reading its state and reconcile configuration drift.
Terraform Modules
A Terraform module is a container for multiple resources that are used together. Modules can be used to create lightweight abstractions. While a Terraform resource represents a single API object (configuration element in Catalyst Center), a Terraform Module consists of multiple resources.
A simple example of using terraform module for Catalyst Center can be found below:
module "catalyst_center" { source = "netascode/nac-catalystcenter/catalystcenter" version = "0.1.1"
yaml_directories = ["data/"] templates_directories = ["data/templates/"]}
Network as Code for Catalyst Center Module
The Network as Code Terraform module for Catalyst Catalyst Center is responsible for mapping the data to the corresponding Catalyst Center modules. This module supports an inventory driven approach, where a complete Catalyst Center configuration is either modeled in one or more YAML files or natively using Terraform variables.
The module ships with default values for certain objects. These values are documented in the Data Model section on this page. a single file defaults.nac.yaml
can be used to define specific requirements in a central location. This will overwrite any default values that come with the main modules.
This file is typically customized to reflect the specific customer requirements and reduces the overall size of input files as optional parameters with a default value can be omitted.
The Network as Code for Catalyst Center section includes a simple example to get started with Network as Code for Catalyst Center deployments.
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.