Efficient network management is crucial for scaling and securing modern networks. Cisco Catalyst Center (formerly DNA Center) offers powerful tools for automating the deployment of device configurations using templates, composite templates, and Jinja2 scripting. In this guide, we will walk through creating and deploying templates, including interface configurations, NTP, SNMP, ACLs, and more, for Cisco IOS-XE and IOS devices. We'll also cover using CSV imports for bulk deployments, ensuring a best-practice approach.
Why Use Templates in Cisco Catalyst Center?
Templates in Catalyst Center offer a standardized way to configure devices, making it easier to maintain consistency and reduce human error. Key benefits include:
- Scalability: Apply configurations to hundreds of devices simultaneously.
- Flexibility: Use Jinja2 templates to dynamically generate configurations based on device-specific variables.
- Compliance: Ensure consistent application of security and operational policies.
- Automation: Reduce manual configurations and operational overhead.
Getting Started with Templates
- Creating a Basic Jinja2 Template
Start by creating a basic template for common network settings like interface configurations, NTP servers, and SNMP settings. Here's a simple Jinja2 example for configuring an Ethernet interface:
interface
description
switchport mode access
switchport access vlan
spanning-tree portfast
no shutdown
Save this as Basic_Interface_Template in Catalyst Center.
- Adding Variables for Flexibility
To make the template reusable, add variables for key parameters. This allows you to dynamically configure interfaces based on device-specific data:
interface
description
ip address
no shutdown
- Using CSV for Bulk Deployments
Create a CSV file to import device-specific values for these variables. For example:
This file can be imported into the Catalyst Center template to quickly deploy configurations across multiple devices.
Building Composite Templates
Composite templates allow you to group multiple smaller templates into a single, reusable package. This is ideal for deploying complete device configurations, including:
- Interface settings
- NTP and SNMP configurations
- Access Control Lists (ACLs)
- Logging and monitoring settings
CSV Imports for Composite Templates
For composite templates, CSV imports can greatly simplify bulk deployments. To use CSV imports effectively:
- Prepare a CSV file with headers matching the variable names in each sub-template.
- Include the Template Path: Ensure that your CSV file includes a template_path column to specify the exact location of each sub-template in Catalyst Center's directory structure.
Sample CSV for a composite template:
Tip: Depending on the Catalyst Center version, csv field requirements may differ. To create the correct csv, deploy the template to the point where the variables need to be provided (either through the GUI or csv import). Export the configuration parameters first which will provide a csv download with the required information needed. That csv can now be use as a base.
High-Level Deployment Flow
- Template Creation:
- Create individual Jinja2 templates for interfaces, NTP, SNMP, ACLs, and other settings.
- Use variables to make these templates reusable across different devices.
- CSV Preparation:
- Prepare a CSV file for bulk imports, matching variable names to template parameters.
- Include the template_path column to specify the sub-template location.
- Composite Template Assembly:
- Group related templates into a composite template for streamlined deployments.
- Testing and Validation:
- Use the built-in simulator to validate templates before deployment.
- Deployment:
- Deploy the composite template, using the CSV variable set to customize each device's configuration.
- Monitoring and Troubleshooting:
- Use Catalyst Center's monitoring tools to verify successful deployments and address any issues.
Best Practices for Template Design
- Modular Design: Break large templates into smaller, reusable components.
- Version Control: Maintain version history for templates to track changes.
- Testing: Use Catalyst Center's built-in simulator to validate templates before deployment.
- Security: Always include secure SNMP and ACL configurations to protect your network.
Final Thoughts
Using templates and composite templates in Catalyst Center can significantly reduce the time and effort required for network configuration. By leveraging Jinja2, CSV imports, and best practices, you can create scalable, secure, and automated network configurations that reduce operational complexity and improve consistency.
Happy Automating!
LookingPoint offers multiple IT services if you’re interested. Want more information, give us a call! Please reach out to us at sales@lookingpoint.com and we’ll be happy to help!
Craig Grant, Senior Consulting Engineer