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.
How can I find the substatements of a schema node? For example, if it is a configuration node or mandatory node? Or in the case of list nodes, how do I find the keys? I the script below, I can find out the keyword and argument for timer, but I can't find ...
hello guys, somehow I couldn't figure out the way to remove existing configuration with netconf. I created xml template based on yang file static for xr 6.5.3 as follows: sr_config = '''
HI I have enabled NETCONF on a lab CSR1000V and I am getting message on terminal as below NETCONF/SSH: error: Trustpoint does not have a cert Also I am unable to connect to it via yang explorer from my Ubuntu machine. My ru...
Wondering if someone else has experienced issues creating datanodes with xpaths in the YDK Path API?
Sometimes the node is created without a value and the incorrect node is returned.
I filed this issue on github: https://github.com/Cisc...
Hi All, Is there a way to run show commands through RESTCONF on IOS-XE ? For example, I want to run the the command "show ip igmp snooping groups" as I didn't find any YANG model to retrieve the operational data of the IGMP snooping.Also I didn'...