This blog series covers some of the new API released as part of the APIC-EM 1.3 release of code.
This particular blog covers a new feature in the Plug and Play (PnP) application, configuration templates. Prior to version 1.3, the configuration file was a text file and did not support variables. If you wanted to use a template you needed to use Prime Infrastructure. In APIC-EM 1.3, template support has been added.
This blog looks at both the UI and API required for templates.
For all of these examples I am using a 3650 switch running 3.6.5 code, but you could use versions of 16.3.1 and 3.7.4 (For other platforms such 2960x please see release notes for details).
A template is identical to a standard configuration file, except it has variables embedded in it. Templates use the "velocity" template language, the same as Prime Infrastructure. Variables start with the "$" character. For example there is a "hostname" variable in this example.
enable password xxx
username sdn password 0 xxx
ip http server
ip http secure-server
snmp-server community xxxx RO
line con 0
line vty 0 15
transport input ssh telnet
When you view the template in APIC-EM, there are three views:
Text view: the file above. Variables have a "$" at the start
Form View: just shows the variables.
Preview: Shows the complete configuration with variables filled in.
Templates can be uploaded the same as any other configuration file, through the user interface or the API.
Using the Template – User Interface
Templates are used in PnP rules in exactly the same way as normal configuration files. One extra step is to fill in the variables. In this example I am going to use a pre-defined rule, but templates work with unclaimed devices as well.
NOTE: You do not need a specific suffix on a template file. The controller searches the configuration file for variables, and if they are present, the file is treated as a template.
I then need to select the "Form View" to fill in the variables. This example has only one variable "hostname"
I then need to select "Device Configuration" and scroll down to the bottom of the page to "Add" the Device.
NOTE: I have also configured some stack parameters. These are only required as I am also using a stack of switches.
Now the rule has been added successfully.
Once the switch has been provisioned you will notice the configuration file has changed. This will be the rendered template with all of the variables filled in.
Using the Template – User Interface
In this section I will cover the API that are required to use the template API. I am going to assume you have seen my earlier blogs for a detailed description of using the PnP API.
Here is a summary of the API calls above. NOTE the section in RED is the only difference compared to a standard configuration file.
This blog covered configuration templates for PnP, native in APIC-EM. My next blog will cover some of the new EasyQoS API.
In the meantime, if you would like to learn more about this, you could come hang out with us in The Cisco Devnet DNA Community. We’ll have a continuous stream of blogs like this and you can ask questions and we’ll get you answers. In addition, we have a Github repository where you can get examples related to PnP.
I'm playing with the Ansible Hands On lab with NXOS Sandbox On step 3, I understand the purpose is to create a playbook to copy a customized hosts file to replace the default hosts files stored in /etc/hosts However, when I run the playbook...
Hi Community, I was wondering if anyone has faced this issue. The below command option is not working for me: sh ip int br | json OR sh ip int br | json-pretty. Version: IOS XE 16.12.5. Re/Saleh Re/Sal
Hello,I'm trying to setup monitoring of IOS-XE devices using Streaming Telemetry to replace SNMP. I'm able to get some data through my Telegraf-Prometheus-Grafana setup, but it looks like I'm not getting all the entries in the YANG tree. My devices are ru...
Hello Boss, Please kindly see the question below. Question is here, I can get the data with filter1 but I am not able to get anything with filter2.I'd like to know what's the scenario we use ietf-interface and what's the...
I was able to find the Cisco-IOS-XR-ping-act model to automate the Ping actions. But is there anything similar for the XE platforms? I cannot find any. And if none exists, what is a common solution to that - to automate ping action on XE...