About Template Editor

About Template Editor
Cisco DNA Center provides an interactive editor to author CLI templates. Template editor is a centralized
CLI management tool to help the design and provisioning workflows in the DNA Center. With the template
editor you can:
• Create, edit, and delete templates.
• Add interactive commands.
• Validate errors in the template.
• Create Projects, page 1
• Create Templates, page 2
• Edit Templates, page 3
• Template Form Editor, page 4
• Create and Assign Templates to Profiles, page 6
Create Projects
Procedure
Step 1
Step 2
Step 3
Select Tools > Template Editor.
To create a project, on the Template Editor page, click
> Create Project.
In the Add New Project window, enter the following details:
• Name—Unique name for the project.
• Description—Description for the project.
• Tags—Metadata tags, which are used to search projects in the project tree.
Step 4
Click Save to save the project.
Cisco Digital Network Architecture Center User Guide, Release 1.1
1
About Template Editor
Create Templates
What to Do Next
1 Create templates. See Create Templates, on page 2.
Create Templates
Procedure
Step 1
Step 2
Step 3
Select Tools > Template Editor.
Select the project in the left menu under which you are creating templates, and click the gear icon
> Add
Templates or click
> Add Templates located at the top of the tree pane.
In the Add New Template window, enter the following details:
• Name—Unique name for the template within a project.
• Project Name—Unique name for the project. The text box is enabled if you are navigating from the
> Add Templates path. The text box is disabled if you select a project, and click the gear icon
> Add Templates in the tree pane.
• Description—Template description.
• Tags—Metadata tags which are used to search projects in the project tree.
• Device Type—The drop-down list contains the product family, series, or type. You can select the type
of devices to which you want to apply the template.
• Software Type—The drop-down list contains the software types. You can select the specific software
type such as IOS-XE, ISO-XR, or NX-OS if there are commands specific to these software types. If you
select the software type as IOS, then the commands are applicable to all software types including IOS-XE,
IOS-XR, and NX-OS. This is used at the provisioning time to check whether the selected device is
conforming to the selection in the template.
• Software Version—Minimum software version to which the template is applicable. During provisioning,
the DNA Center checks to see if the selected device has the similar software version as mentioned in
the template. If there is a mismatch, then the provision skips the template.
• Click Add. The template is now created and is listed in the left menu.
Step 4
Step 5
Step 6
You can edit the template content by selecting the template you created in the left menu.
The template editor window opens where you can enter content for the template.
You can validate the template by selecting Check for errors from the Actions drop-down list.
DNA Center checks for these errors and reports them:
• Velocity syntax error
• Conflicts with blacklisted commands.
Cisco Digital Network Architecture Center User Guide, Release 1.1
2
About Template Editor
Blacklisted Commands
Step 7
To save the template content, select Save from the Actions drop-down list. You can use the Velocity Template
Language (VTL) to write the content in the template. For more information about using VTL, see http://
velocity.apache.org/engine/devel/vtl-reference.html.
After saving the template, the DNAC checks for any errors in the template. If there are any syntax errors, then
the template content is not saved and all the input variables defined in the template is automatically identified
during the save process. The local variables (variables used in for loops, assigned though a set, and so on)
are also ignored.
Step 8
Click the Form Editor icon, which is located at the top-right corner of the page to enter additional information
to the variables in the template.
Blacklisted Commands
The blacklisted commands are those that are added in the blacklisted category. You can use these commands
only through the DNA Center applications. If you use the blacklisted commands in templates, it shows a
warning in the template that it may potentially conflict with some of the DNA Center provisioning applications.
Use this query to find out the blacklisted commands which are part of the DNA Center: select commands
from cliconfigtree where sdnconfig_id in (selectid from SDNConfig where classname like
'SPFServiceConfig').
Sample Templates
Configure Hostname
hostname$name
Configure Interface
interface $interfaceName
description $description
Configure NTP on Cisco Wireless Controllers
config time ntp interval $interval
Edit Templates
Procedure
Step 1
Step 2
Step 3
Step 4
Select Tools > Template Editor.
Select the template you want to edit in the left menu.
The template editor window opens in the right pane.
Enter the template content in the template editor, and validate the template by selecting Check for errors
from the Actions drop-down list.
Cisco Digital Network Architecture Center User Guide, Release 1.1
3
About Template Editor
Template Form Editor
DNA Center checks for these errors and reports them:
• Velocity syntax error
• Conflicts with blacklisted commands
Step 5
Step 6
Select Save from the Actions drop-down list to save the template content.
Click the Form Editor icon, which is located in the top-right corner to enter additional information to the
variables in the template.
Template Form Editor
Procedure
Step 1
Step 2
Select the template in the left menu. The template window opens.
Click the Form Editor icon located in the top-right corner to add additional metadata to the template variables.
All the variables identified in the template are displayed. You can configure the following metadata:
• Required—Check the check box if this is a required variable during the provisioning. All the variables
by default are marked as Required, which means you must enter the value for this variable at the time
of provisioning. You can uncheck the Required check box only if the variables are assigned conditionally
inside an if-else block in the template.
• Field Name—Enter the field name. This is the label used for the UI widget of each variable during the
provisioning.
• Tooltip text—Enter the tooltip text displayed for each variable.
• Default Value—Enter the default value. This value appears during provisioning as the default value.
• Instructional Text—Enter the instructional text. Instructional text appears within the UI widget (for
example, Enter the hostname here). The text within the widget is cleared when the user clicks the
widget to enter any text.
• Data Type—Select the data type: String, Integer, IP Address, or Mac Address.
• Display Type—From the drop-down list, select the type of UI widget you want to create at the time of
provisioning: Text Field, Single Select, or Multi Select.
• Maximum Characters—Enter the number of characters allowed. This is applicable only for string data
type.
Step 3
Step 4
Step 5
After configuring additional metadata information, from the Actions drop-down list, select Save.
After saving the template, you need to version the template. You must version the template every time you
make changes to the template. To do that, from the Actions drop-down list, select Commit. The Commit
window appears. You can enter a commit note in the Commit Note text box. However, the version numbers
are automatically generated by the system.
To view the history, from the Actions drop-down list, select Show History to view previously created and
versioned templates. A pop-up window appears.
Cisco Digital Network Architecture Center User Guide, Release 1.1
4
About Template Editor
Special Keywords
• Click View in the pop-up window to see the content of the old version.
• Click Edit in the pop-up window to edit the template.
Step 6
To view the old versions, from the Actions drop-down list, select
Special Keywords
Note
All commands executed through templates are always in the config t mode. Hence, you do not have to
specify the enable or config t commands explicitly in the template.
Enable Mode Commands
Note
Specify the #MODE_ENABLE command if you want to execute any commands outside of the config t
command.
Use this syntax to add enable mode commands to your CLI templates:
#MODE_ENABLE
<<commands>>
#MODE_END_ENABLE
Interactive Commands
Note
Specify #INTERACTIVE if you want to execute a command where a user input is required.
An interactive command contains the input that must be entered following the execution of a command.
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 <IQ> and <R> tags are case-sensitive and must be entered in uppercase.
#INTERACTIVE
crypto key generate rsa general-keys <IQ>yes/no<R> no
#ENDS_INTERACTIVE
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
#ENDS_END_ENABLE
#MODE_ENABLE
#INTERACTIVE
mkdir <IQ>Create directory<R>xyz
Cisco Digital Network Architecture Center User Guide, Release 1.1
5
About Template Editor
Create and Assign Templates to Profiles
#ENDS_INTERACTIVE
#MODE_END_ENABLE
Multiline Commands
Note
If you want multiple lines in the CLI template to be wrapped, use the MLTCMD tags. Otherwise, the
command is sent line by line to the device. To enter multiline commands in the CLI Content area, use the
following syntax:
<MLTCMD>first line of multiline command
second line of multiline command
.....
.....
last line of multiline command</MLTCMD>
• Where <MLTCMD> and </MLTCMD> are case-sensitive and must be in uppercase.
• The multiline commands must be inserted between the <MLTCMD> and </MLTCMD> tags.
• The tags cannot start with a space.
• The <MLTCMD> and </MLTCMD> tags cannot be used in a single line.
Create and Assign Templates to Profiles
Before You Begin
Before provisioning the template, ensure that the templates are associated with a network profile and the
profile is assigned to a site.
During provisioning, when the devices are assigned to the specific sites, the templates associated with the site
through the network profile appears in the advanced configuration.
Procedure
Step 1
Choose Design > Network Profiles, and click Add Profile.
There are three types of profiles available:
• Routing & NFV—Select this to create a routing and NFV profile. See Routing &NFC for more
information.
• Switching—Select this to create a switching profile.
◦Enter the Profile Name.
◦Click +Add and select the device type and template from the Device Type and Template drop-down
lists.
Note
If you do not see the template that you need, create a new template in Template Editor as
described in Create Templates, on page 2.
◦Click Save.
Cisco Digital Network Architecture Center User Guide, Release 1.1
6
About Template Editor
Create and Assign Templates to Profiles
• Wireless—Select this to create a wireless profile. Before assigning wireless network profile to a template,
ensure that you have created wireless SSIDs. See Configure Global Wireless Settingsfor more information.
◦Enter the Profile Name.
◦Click + Add SSID. Those SSIDs that were created under Network Settings > Wireless gets
populated.
◦Under Attach Template(s) area, select the template you want to provision from the Template
drop-down list.
◦Click Save to save the profile.
Step 2
The Network Profiles page lists the following:
• Profile Name
• Type
• Version
• Created By
• Sites—Click Assign Site to add sites to the selected profile.
Step 3
Choose Provision > Devices.The Device Inventory window appears.
• Check one or more check boxes next to the device name that you want to provision.
• From the Action drop-down list, choose Provision.
• In the Assign Site window, assign a site to which the profiles are attached. In the Find Site field, enter
the name of the site to which you want to associate the controller.
• Click Next.
The Configuration window appears. In the Managed AP Locations field, enter the AP locations
managed by controller. Here you can change, remove, or reassign the site. This is applicable only for
wireless profiles.
• Click Next.
• Check the check box of the device and enter the details for the template.
• Click Next to deploy.
Cisco Digital Network Architecture Center User Guide, Release 1.1
7
About Template Editor
Create and Assign Templates to Profiles
Cisco Digital Network Architecture Center User Guide, Release 1.1
8