cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
8749
Views
15
Helpful
3
Comments
abdeabdu@cisco.com
Cisco Employee
Cisco Employee

Template Introduction

The template editor is a standalone application that can be used to Build your Day-0 (PnP) or Day-N configurations.

•Day-0 (PnP)  : Is your PnP/Onboarding Template . This is a one-time Template that used while you onboard your network devices, this  template are Pushed to the Network devices as once (Bulk Template) .Usually we recommend to Push all your Major Connectivity config using This Template.

Note:If DNAC Management interface need to be changed from the PnP discovery interface to any other interface, make sure to use : “ip http client source-interface”. **Managed I interface need to be reachable via DNAC.

•Day-N: Is your Provisioning Template. This is the template that you can use to change any Configuration after your device is Managed by DNAC, this template are Push to the Network device in a line by line cli basis , make sure to not touch any basic connectivity or you will lose connectivity to the device.

Template Tool

•Click ‘+’ and  select Create Template

•Enter Template variables

  • Regular Template or Composite SequencePicture2.png
  • Name
  • Project Name
  • Description
  • Tags
  • Device Type (List)
  • Software Type
  • Software Version

•After Add a New Template is completed the Template Editor is openedPicture1.png

•The following basic Actions are available

  • Check for errors
  • Show history
  • Save
  • Commit

 

 

 

•The following basic Edit options are available

  • UndoPicture3.png
  • Redo
  • Copy
  • Paste
  • Find and Replace

Template Type

Template Type Comparison

Description

Regular Template

Composit Template

Number of Template

One Template

One or more regualr template

Apply To

Day0/DayN

DayN only

Easy to Manage/Troublshoot

Ok

Easier

Configuration Mode

All commands are entered in conf t mode. As commands are delivered a prompt is expected after each command. This complicates thing, here you can find use cases and solutions to address the need :

  1. Enter multiple lines without a prompt being returned after each line of configuration.  A banner would be an example of this.
    • It can be address using ## ! Multiple Commands Tag.
  2. Questions Prompt,  when you configure things which also doesn’t show the regular prompt. Generating an SSH key pair could be an example of this.
    • It can be address using ## ! Interactive Tag.
  3. Exec Mode Config, Sometimes you might need to enter stuff in exec mode
    • It can be address using #MODE_ENABLE Tag.

Note: All the commands executed via templates are always in conf t mode. So there is no need to specify the enable / conf t command explicitly in the template.

Adding Enable Mode Commands

Use this syntax to add enable mode commands to your CLI templates:

Picture6.png

 

 

Note: You need to specify #MODE_ENABLE if you want to execute any command outside the conf t.

Adding interactive Mode Commands

An interactive command contains the expected cli query and input that must be entered following the execution of a command.

To enter interactive command mode

      To enter an interactive command in the CLI Content area, use the following syntax:

       CLI Command<IQ>interactive question 1<R>command response 1 <IQ>interactive question 2<R>command  response 2

Where Interactive Question <IQ> and Response <R> tags are case-sensitive and must be entered in uppercase. 

For example:

Picture7.png

 

Note: You need to specify #MODE_ENABLE if you want to execute any command outside the conf t.

Combining Interactive Enable Mode Commands

Use this syntax to combine interactive Enable Mode commands:

  #MODE_ENABLE

  #INTERACTIVE

  commands<IQ>interactive question<R>response

  #ENDS_INTERACTIVE

  #MODE_END_ENABLE

For example:

Picture8.png

 

Note:  All the templates in the PI system will work here also, except the multi line tag<MLTD>.

Input Form Editor variables

Picture10.png•Variable Form option  can be either Text Field, Single select or multiple select .

•Variables Value can Be validated against different format ( String ,IP ,integer, etc..)

•Variable Value can Bind to source – I don’t recommend as its not reliable •sometimes its not working.unless you are sure and you test this option against your •Hardware running release don't go with this approach.

•Commit will prompt you to save , no need to save and Commit

Template Sample

Templates are a composite of Cisco CLI, and velocity

•Configure hostname

hostname $name

•Configure Macro

Picture12.jpg

 

 

Picture13.jpg

 


 

 

 

 

 

 

 

Split the comma delimited Text string into a string list..

Example : Picture14.png

  $data_vlanids = 200,300

  $vlans list = [200,300]

 

 

Replace function is very useful to trim any spaces in an input variableScreen Shot 2020-05-21 at 4.09.09 PM.png

Template Form Export/ Import

On multiple device on-boarding scenario, rather than selecting each device and fill their variables , you can export Form variable into *.csv file,Fill it in excel and import it back.

•On testing/troubleshooting  scenario , it will reduce your time by importing the excel rather than fill in the variable every trial.

Note: Excel sheet Column will be head of device serial number.

Screen Shot 2020-05-21 at 2.42.58 PM.png
 
 
 
 
 
Screen Shot 2020-05-21 at 2.43.53 PM.png

 

 

 

 

 

 

 

 

Lesson Learned. Tips && Tricks

Picture16.png

 

Using Velocity to Create Plug and Play Reference

https://blogs.cisco.com/developer/using-velocity-to-create-plug-and-play-templates-in-dna-center-part-4

https://velocity.apache.org/engine/1.4/user-guide.html

Comments
inderdeeps
Level 4
Level 4

abdeabdu@cisco.com : Can you update us with the JInja Template as well ?

 

Regards
Inderdeep Singh
www.thenetworkdna.com ( Awarded by Cisco IT Blogs award 2020)

Bret Sedlak
Level 1
Level 1

Hi abdeabdu@cisco.com,

thank you for a very informative article.

I have a question about Composite templates. I have two templates in my Composite template and I would like to use a variable from Template1 in Template2. Is there a way how to do it?

Thank you,

Bret

gbekmezi-DD
Level 5
Level 5

Great article. Thanks for the useful nuggets of information. It would be nice if the screenshots were better resolution.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: