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.
Does anyone have worked on Prime Infrastructure integration with ServiceNow to get a full inventory of devices (wifi & wireless devices).
I guess PI does not have direct integration with ServiceNow? We are lo...
Hello everyone, I'm trying to develop a script to run on IOS XR 6.6 (32 bits, QNX based) to perform a single ping to a large number of destinations in a short time.I found this script to perform such operation: GitHub - romana/multi-ping: Python...
I work in a project where we have C8500/ASR1006-X with IOS-XE >=17.6 and ASR9k with 64bit IOS-XR >=7.4. I'm currently evaluating the programmability interfaces that both IOS operating systems offer. They both seem to support NETCONF and gNMI. As...
How can I get all interfaces from a specific Cisco ACI Node (Leaf and Spine) from API? I can get all interfaces from all nodes with the following URL, but not for a specific node. /api/node/class/l1PhysIf.json?&order-by=l1PhysIf.modTs|desc&n...
Hi All, If you are a network engineer like me and hardly worked on the Cloud (AWS, GCP, Azzue etc) or ACI, but still like to learn the terraform, there are couple of very good providers created by Cisco individuals and by using those providers,...