CISCO Create Templates to Automate Device Software User Guide
- June 1, 2024
- Cisco
Table of Contents
- Create Templates to Automate Device Software
- About Template Hub
- Create Projects
- Create Templates
- Export Template(s)
- Import Template(s)
- Clone a Template
- Attach a CLI Template to the Network Profiles
- Provision CLI Templates
- Export Project(s)
- Import Project(s)
- Template Variables
- foreach ( $interface in $interfaces )
- end
- foreach ( $interface in $interfaces )
- end
- MODE_ENABLE
- MODE_END_ENABLE
- INTERACTIVE
- ENDS_INTERACTIVE
- INTERACTIVE
- ENDS_INTERACTIVE
- INTERACTIVE
- ENDS_INTERACTIVE
- INTERACTIVE
- ENDS_INTERACTIVE
- INTERACTIVE
- MODE_ENABLE
- INTERACTIVE
- ENDS_INTERACTIVE
- MODE_END_ENABLE
- MODE_ENABLE
- INTERACTIVE
- ENDS_INTERACTIVE
- MODE_END_ENABLE
- Associate Templates to Network Profiles
- Detect Conflicts in a CLI Template
- Read User Manual Online (PDF format)
- Download This Manual (PDF format)
User Guide
Create Templates to Automate Device Software
Create Templates to Automate Device Configuration Changes
About Template Hub
Cisco DNA Center provides an interactive template hub to author CLI templates.
You can design templates easily with a predefined configuration by using
parameterized elements or variables. After creating a template, you can use
the template to deploy your devices in one or more sites that are configured
anywhere in your network.
With Template Hub, you can:
- View the list of available templates.
- Create, edit, clone, import, export, and delete a template.
- Filter the template based on the Project Name, template Type, Template Language, Category, Device Family, Device Series, Commit State and Provision Status.
- View the following attributes of the template in the Template Hub window, under the Templates table:
- Name: Name of the CLI template.
- Project: Project under which the CLI template is created.
- Type: Type of CLI template (regular or composite).
- Version: Number of versions of the CLI template.
- Commit State: Shows if the latest version of the template is committed. You can view the following information under the Commit State column:
- The timestamp of the last committed date.
- A warning icon means the template is modified but not committed.
- A check icon means the latest version of the template is committed.
Note
The last template version must be committed to provision the template on
the devices.
-
Provision Status: You can view the following information under the Provision Status column:
- The count of devices on which the template is provisioned.
- A check icon displays the count of devices for which the CLI template was provisioned without any failures.
- A warning icon displays the count of devices for which the latest version of the CLI template is not yet provisioned.
- A cross icon displays the count of devices for which the CLI template deployment failed.
-
Potential Design Conflicts: Displays potential conflicts in the CLI template.
-
Network Profiles: Displays the number of network profiles to which a CLI template is attached. Use the link under the Network Profiles column to attach a CLI template to network profiles.
-
Actions: Click the ellipsis under the Actions column to clone, commit, delete, or edit a template; edit a project; or attach a template to a network profile.
-
Attach templates to network profiles. For more information, see Attach a CLI Template to the Network Profiles, on page 10.
-
View the number of network profiles to which a CLI template is attached.
-
Add interactive commands.
-
Autosave the CLI commands.
-
Version control the templates for tracking purposes.
You can view the versions of a CLI template. In the Template Hub window, click the template name and click the Template History tab to view the template version. -
Detect errors in templates.
-
Simulate templates.
-
Define variables.
-
Detect potential design conflict and run-time conflict.
Note
Be careful that your template does not overwrite a network-intent
configuration pushed by Cisco DNA Center.
Create Projects
Step 1 Click the menu icon ( ) and choose Tools> Template Hub.
Step 2 Click Add at the top right corner of the window and choose, New
Project from the drop-down list. The Add New Project slide-in pane is
displayed.
Step 3 Enter a unique name in the Project Name field.
Step 4 (Optional) Enter a description for the project in the Project
Description field.
Step 5 Click Continue.
The project is created and appears in the left pane.
What to do next
Add new template to the project. For more information, see Create a Regular
Template, on page 3 and Create a Composite Template, on page 5.
Create Templates
Templates provide a method to easily predefine configurations using parameter
elements and variables.
Templates allow an administrator to define a configuration of CLI commands
that can be used to consistently configure multiple network devices, reducing
deployment time. Variables in the template allow customization of specific
settings per device.
Create a Regular Template
Step 1 Click the menu icon ( ) and choose Tools> Template Hub.
Note By default, the Onboarding Configuration project is available for
creating day-0 templates. You can create your own custom projects. Templates
created in custom projects are categorized as day-N templates.
Step 2 In the left pane, click Project Name and select the project under
which you are creating templates.
Step 3 Click Add at the top right of the window, and choose New Template
from the drop-down list.
Note The template that you create for day-0 can also be applied for
day-N.
Step 4 In Add New Template slide-in pane, configure the settings for the
regular template.
In the Template Details area do the following:
a. Enter a unique name in the Template Name field.
b. Choose the Project Name from the drop-down list.
c. Template Type: Click Regular Template radio button.
d. Template Language: Choose either the Velocity or Jinja language to be used
for the template content.
-
Velocity: Use the Velocity Template Language (VTL). For information, see http://velocity.apache.org/engine/devel/vtl-reference.html.
The Velocity template framework restricts the use of variables that start with a number. Make sure that the variable name starts with a letter and not with a number.
Note Do not use the dollar ($) sign while using the velocity templates. If you have used the dollar($) sign, any value behind it is treated as a variable. For example, if a password is configured as “$a123$q1ups1$va112”, then the Template Hub treats this as variables “a123”, “q1ups”, and “va112”.
To workaround this issue, use Linux shell style for text processing with Velocity templates.
Note Use the dollar ($) sign in the velocity templates only when declaring a variable. -
Jinja: Use the Jinja language. For information, see https://www.palletsprojects.com/p/jinja/.
e. Choose the Software Type from the drop-down list.
Note You can select the specific software type (such as IOS-XE or IOS-XR)
if there are commands specific to these software types. If you select IOS as
the software type, the commands apply to all software types, including IOS-XE
and IOS-XR. This value is used during provisioning to check whether the
selected device confirms to the selection in the template.
In the Device Type Details area do the following:
a. Click Add Device Details link.
b. Choose Device Family from the drop-down list.
c. Click the Device Series tab and check the check box next to the preferred
device series.
d. Click the Device Models tab and check the check box next to the preferred
device model.
e. Click Add.
In Additional Details area do the following:
a. Choose the Device Tags from the drop-down list.
Note
Tags are like keywords that help you locate your template more easily.
If you use tags to filter the templates, you must apply the same tags to the
device to which you want to apply the templates. Otherwise, you get the
following error during provisioning:
Cannot select the device. Not compatible with template
b. Enter the Software Version in the software version field.
Note
During provisioning, Cisco DNA Center checks to see if the selected device has
the software version listed in the template. If there is a mismatch, the
template is not provisioned.
c. Enter the Template Description.
Step 5 Click Continue.
The template is created and appears under the Templates table.
Step 6 You can edit the template content by selecting the template that
you created, click the ellipsis under Actions column, and choose Edit
Template. For more information about editing the template content, see Edit
Templates, on page 7.
Blocked List Commands
Blocked list commands are commands that cannot be added to a template or
provisioned through a template.
If you use blocked list commands in your templates, it shows a warning in the
template that it may potentially conflict with some of the Cisco DNA Center
provisioning applications.
The following commands are blocked in this release:
- router lisp
- hostname
Sample Templates
Refer to these sample templates for switches while creating variables for your template.
Configure Hostname
hostname$name
Configure Interface
interface $interfaceName
description $description
Configure NTP on Cisco Wireless Controllers
config time ntp interval $interval
Create a Composite Template
Two or more regular templates are grouped into a composite sequence template.
You can create a composite sequential template for a set of templates, which
are applied collectively to devices. For example, when you deploy a branch,
you must specify the minimum configurations for the branch router. The
templates that you create can be added to a single composite template, which
aggregates all the individual templates that you need for the branch router.
You must specify the order in which templates that are in the composite
template are deployed to devices.
Note
You can add only a committed template to a composite template.
Step 1 Click the menu icon ( ) and choose Tools> Template Hub.
Step 2 In the left pane, click Project Name and select the project under
which you are creating templates.
Step 3 Click Add at the top right of the window, and choose New Template
from the drop-down list.
The Add New Template slide-in pane is displayed.
Step 4 In Add New Template slide-in pane, configure the settings for the
composite template.
In the Template Details area do the following:
a) Enter a unique name in the Template Name field.
b) Choose the Project Name from the drop-down list.
c) Template Type: Choose Composite Sequence radio button.
d) Choose the Software Type from the drop-down list.
Note
You can select the specific software type (such as IOS-XE or IOS-XR) if there
are commands specific to these software types. If you select IOS as the
software type, the commands apply to all software types, including IOS-XE and
IOS-XR. This value is used during provisioning to check whether the selected
device confirms to the selection in the template.
In the Device Type Details area do the following:
a. Click Add Device Details link.
b. Choose Device Family from the drop-down list.
c. Click the Device Series tab and check the check box next to the preferred
device series.
d. Click the Device Models tab and check the check box next to the preferred
device model.
e. Click Add.
In Additional Details area do the following:
a. Choose the Device Tags from the drop-down list.
Note
Tags are like keywords that help you locate your template more easily.
If you use tags to filter the templates, you must apply the same tags to the
device to which you want to apply the templates. Otherwise, you get the
following error during provisioning:
Cannot select the device. Not compatible with template
b. Enter the Software Version in the software version field.
Note
During provisioning, Cisco DNA Center checks to see if the selected device has
the software version listed in the template. If there is a mismatch, the
template is not provisioned.
c. Enter the Template Description.
Step 5 Click Continue.
The composite template window is displayed, which shows the list of applicable
templates.
Step 6 Click Add Templates link and click + to add the templates and
click Done.
The composite template is created.
Step 7 Check the check box next to the composite template that you
created, click the ellipsis under Actions column, and choose Commit to commit
the template content.
Edit Templates
After creating a template, you can edit the template to include content.
Step 1 Click the menu icon ( ) and choose Tools> Template Hub.
Step 2 In the left pane, choose the Project Name and select the template
that you want to edit.
The chosen template is displayed.
Step 3 Enter the template content. You can have a template with a single-
line configuration or a multi-select configuration.
Step 4 Click Properties next to the template name at the top of the
window to edit Template Details, Device Details and Additional Details. Click
Edit next to the respective area.
Step 5 The template is auto saved. You can also choose to change the time
interval of auto save, by clicking at the time recurrence next to Auto Saved.
Step 6 Click Template History to view the versions of the template. Also,
you can click Compare to view the difference in the template versions.
Step 7 Click Variables tab to view the variables from the CLI template.
Step 8 Click the Show Design Conflicts toggle button to view potential
errors in the template.
Cisco DNA Center allows you to view, potential and run-time errors. For more
information, see Potential Design Conflicts Detection Between CLI Template and
Service Provisioning Intent, on page 21 and Detect CLI Template Run-Time
Conflict, on page 21.
Step 9 Click Save at the bottom of the window.
After saving the template, Cisco DNA Center checks for any errors in the
template. If there are any syntax errors, the template content is not saved
and all input variables that are defined in the template are automatically
identified during the save process. The local variables (variables that are
used in for loops, assigned though a set, and so on) are ignored.
Step 10 Click Commit to commit the template.
Note You can associate only a committed template to a network profile.
Step 11 Click Attach to Network Profile link, to attach the created
template to a network profile.
Template Simulation
The interactive template simulation lets you simulate the CLI generation of
templates by specifying test data for variables before sending them to
devices. You can save the test simulation results and use them later, if
required.
Step 1 Click the menu icon ( ) and choose Tools> Template Hub.
Step 2 From the left pane, choose a project and click a template, for
which you want to run a simulation.
The template is displayed.
Step 3 Click the Simulation tab.
Step 4 Click Create Simulation.
The Create Simulation slide-in pane is displayed.
Step 5 Enter a unique name in Simulation Name field.
Note
If there are implicit variables in your template then select a device from
the Device drop-down list to run the simulation against real devices based on
your bindings.
Step 6 Click Import Template Parameters to import the template parameters
or click Export Template Parameters to export the template parameters.
Step 7 To use the variables from the last device provisioning, click Use
Variable Values from the Last Provisioning link. New variables must be added
manually.
Step 8 Choose values of the variables, by clicking on the link and click
Run.
Export Template(s)
You can export a template or multiple templates to a single file, in JSON format.
Step 1 Click the menu icon ( ) and choose Tools> Template Hub.
Step 2 Check a check box or multiple check box, next to the template name
to select a template or multiple template that you want to export.
Step 3 From the Export drop-down list, choose Export Template.
Step 4 (Optional) You can filter the templates based on categories in the
left pane.
Step 5 The latest version of the template is exported.
To export an earlier version of the template, do the following:
a. Click the template name to open the template.
b. Click Template History tab.
The Template History slide-in pane is displayed.
c. Choose the preferred version.
d. Click View button below the version.
The CLI template of that version is displayed.
e. Click Export at the top of the template.
The JSON format of the template is exported.
Import Template(s)
You can import a template or multiple templates under a project.
Note
You can import templates only from an earlier version of Cisco DNA Center to a
newer version. However, the opposite is not allowed.
Step 1 Click the menu icon ( ) and choose Tools> Template Hub.
Step 2 In the left pane, choose the project for which you want to import
templates, under Project Name and choose Import> Import Template.
Step 3 Import Templates slide-in pane is displayed.
a. Choose the Project Name from the drop-down list.
b. Upload the JSON file by doing one of the following actions:
- Drag and drop the file to the drag and drop area.
- Click, Choose a file, browse to the location of the JSON file, and click Open.
File size should not exceed 10Mb.
c. Check the check box to create a new version of imported template, if
template with the same name already exists in the hierarchy.
d. Click Import.
The CLI template is successfully imported to the chosen project.
Clone a Template
You can make a copy of a template to reuse portions of it.
Step 1 Click the menu icon ( ) and choose Tools> Template Hub.
Step 2 Click the ellipsis under Action column and choose Clone.
Step 3 The Clone Template slide-in pane is displayed.
Do the following:
a. Enter a unique name in Template Name field.
b. Choose the Project Name from the drop-down list.
Step 4 Click Clone.
The latest version of the template is cloned.
Step 5 (Optional) Alternatively, you can clone the template by clicking
the template name. The template is displayed. Click
Clone above the template.
Step 6 To clone an earlier version of the template, do the following:
a. Select the template by clicking the template name.
b. Click the Template History tab.
The Template History slide-in pane is displayed.
c. Click the preferred version.
The chosen CLI template is displayed.
d. Click Clone above the template.
Attach a CLI Template to the Network Profiles
To provision a CLI template, it needs to be attached to a network profile. Use this procedure to attach a CLI template to a network profile or multiple network profiles.
Step 1 Click the menu icon ( ) and choose Tools> Template Hub.
The Template Hub window is displayed.
Step 2 Click Attach, under Network Profile column, to attach the a
template to the network profile.
Note
Alternatively, you can click the ellipsis under Actions column and choose
Attach to Profile or you can attach a template to network profile from Design>
Network Profiles. For more information, see Associate Templates to Network
Profiles, on page 19.
Attach to Network Profile slide-in pane is displayed.
Step 3 Check the check box next to the network profile name and click
Save.
The CLI Template is attached to the chosen Network Profile.
Step 4 A number is displayed under Network Profile column, which shows
the number of network profiles to which a CLI template is attached. Click the
number to view the network profile details.
Step 5 To attach more network profiles to a CLI template, do the
following:
a. Click the number under Network Profile column.
Alternatively, you can click the ellipsis under Actions column and choose
Attach to Profile.
The Network Profiles slide-in pane is displayed.
b. Click Attach to Network Profile link at the top right of the slide-in pane
and check the check box next to the Network Profile name and click Attach.
Provision CLI Templates
Step 1 Click the menu icon ( ) and choose Tools> Template Hub.
Step 2 Check the check box next to the template you want to provision and
click Provision Templates at the top of the table.
You can choose to provision multiple templates.
You are redirected to the Provision Template workflow.
Step 3 In the Get Started window, enter a unique name in Task Name field.
Step 4 In the Select Devices window, choose the devices from the
applicable devices list, which are based on the device details defined in the
template and click Next.
Step 5 In the Review Applicable Templates window, review the devices and
the templates attached to it. If required, you can remove the templates that
you do not want to be provisioned on the device.
Step 6 Configure the template variables for each device, in Configure
Template Variables window.
Step 7 Select the device to preview the configuration being provisioned
on the device, in Preview Configuration window.
Step 8 In the Schedule Task window, select whether to provision the
template Now, or schedule the provision for a Later time, and click Next.
Step 9 In the Summary window, review the template configurations for your
devices, click Edit to make any changes; otherwise click Submit.
Your devices will be provisioned with the template.
Export Project(s)
You can export a project or multiple projects, including their templates, to a single file in JSON format.
Step 1 Click the menu icon ( ) and choose Tools> Template Hub.
Step 2 In the left pane, select a project or multiple project that you
want to export under Project Name.
Step 3 From Export drop-down list, choose Export Project.
Step 4 Click Save, if prompted.
Import Project(s)
You can import a project or multiple projects with their templates, into the Cisco DNA Center Template Hub.
Note
You can import projects only from an earlier version of Cisco DNA Center to
a newer version. However, the opposite is not allowed.
Step 1 Click the menu icon ( ) and choose Tools> Template Hub.
Step 2 From the Import drop-down list, choose Import Project.
Step 3 The Import Projects slide-in pane is displayed.
a. Upload the JSON file by doing one of the following actions:
- Drag and drop the file to the drag and drop area.
- Click Choose a file, browse to the location of the JSON file, and click Open.
File size should not exceed 10Mb.
b. Check the check box to create a new version of the template, in the
existing project, if the project with the same name already exists in
hierarchy.
c. Click Import.
The project is successfully imported.
Template Variables
The Template Variables is used for adding additional metadata information to the template variables in the template. You can also use the variables to provide validations for variables such as maximum length, range, and so on.
Step 1 Click the menu icon ( ) and choose Tools> Template Hub.
Step 2 From the left pane, choose a project and click a template.
The template is displayed.
Step 3 Click the Variables tab.
It enables you to add meta data to the template variables. All the variables
that are identified in the template are displayed.
You can configure the following metadata:
-
Choose the variable from the left pane, and click the Variable toggle button if you want the string to be considered as a variable.
Note
By default the string considered as a variable. Click the toggle button, if you do not want the string to be considered as a variable. -
Check the Required Variable 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. If the parameter is not marked as Required Variable and if you do not pass any value to the parameter, it substitutes an empty string at run time. A lack of a variable can lead to command failure, which may not be syntactically correct.
If you want to make an entire command optional based on a variable not marked as Required Variable, use the if-else block in the template. -
Enter the field name in the Field Name. This is the label that is used for the UI widget of each variable during provisioning.
-
In Variable Data Value area, choose the Variable Data Source by clicking the radio button. You can choose, User Defined value or Bound to Source value to hold a specific value.
Do the following, if you choose User Defined value:
a. Choose the Variable Type from the drop-down list: String, Integer, IP
Address, or Mac Address
b. Choose the Data Entry Type from the drop-down list: Text Field, Single
Select, or Multi Select.
c. Enter the default variable value in the Default Variable Value field.
d. Check the Sensitive Value check box for sensitive value.
e. Enter the number of characters that are allowed in the Maximum Characters
field. This is applicable only for the string data type.
f. Enter hint text in the Hint Text field.
g. Enter any additional information in the Additional Info text box.
Do the following, if you choose Bound to Source value:
a. Choose the Data Entry Type from the drop-down list: Text Field, Single
Select, or Multi Select.
b. Choose the Source from the drop-down list: Network Profile, Common
Settings, Cloud Connect and Inventory.
c. Choose the Entity from the drop-down list.
d. Choose the Attribute from the drop-down list.
e. Enter the number of characters that are allowed in the Maximum Characters
field. This is applicable only for the string data type.
f. Enter hint text in the Hint Text field.
g. Enter any additional information in the Additional Info text box.
For more details on Bound to Source value, see Variable Binding, on page 13.
Step 4 After configuring metadata information, click Review Form to
review the variable information.
Step 5 Click Save.
Step 6 To commit the template, choose Commit. The Commit window is
displayed. You can enter a commit note in the Commit Note text box.
Variable Binding
While creating a template, you can specify variables that are contextually
substituted. Many of these variables are available in the Template Hub.
Template Hub provides an option to bind or use variables in the template with
the source object values while editing or through the input form enhancements;
for example, DHCP server, DNS server, and syslog server.
Some variables are always bound to their corresponding source and their
behavior cannot be changed. To view the list of implicit variables, click the
template and click Variables tab.
The predefined object values can be one of the following:
-
Network Profile
• SSID
• Policy profile
• AP group
• Flex group
• Flex profile
• Site tag
• Policy tag -
Common Settings
• DHCP server
• Syslog server
• SNMP trap receiver
• NTP server
• Timezone site
• Device banner
• DNS server
• NetFlow collector
• AAA network server
• AAA endpoint server
• AAA server pan network
• AAA server pan endpoint
• WLAN info
• RF profile info -
Cloud Connect
• Cloud router-1 Tunnel IP
• Cloud router-2 Tunnel IP
• Cloud router-1 Loopback IP
• Cloud router-2 Loopback IP
• Branch router-1 Tunnel IP
• Branch router-2 Tunnel IP
• Cloud router-1 Public IP
• Cloud router-2 Public IP
• Branch router-1 IP
• Branch router-2 IP
• Private subnet-1 IP
• Private subnet-2 IP
• Private subnet-1 IP mask
• Private subnet-2 IP mask -
Inventory
• Device
• Interface
• AP group
• Flex group
• WLAN
• Policy profile
• Flex profile
• Webauth parameter map
• Site tag
• Policy tag
• RF profile
• Common Settings: Settings available under Design> Network Settings> Network. The common settings variable binding resolves values that are based on the site to which the device belongs.
Step 1 Click the menu icon ( ) and choose Tools> Template Hub.
Step 2 Choose the template and click the Variables tab to bind variables
in the template to network settings.
Step 3 Select the variables in the left pane and check the Required
Variable check box to bind variables to the network settings.
Step 4 To bind variables to network settings, select each variable from
the left pane, and choose Bound to Source radio button, under Variable Data
Source and do the following:
a. From the Data Entry Type drop-down list, choose the type of UI widget to
create at the time of provisioning: Text Field, Single Select, or Multi
Select.
b. Choose the Source, Entity, and Attribute from the respective drop-down
lists.
c. For the source type CommonSettings, choose one of these entities:
dhcp.server, syslog.server, snmp.trap.receiver, ntp.server, timezone.site,
device.banner, dns.server, netflow.collector, aaa.network.server,
aaa.endpoint.server, aaa.server.pan.network, aaa.server.pan.endpoint,
wlan.info or rfprofile.info.
You can apply a filter on the dns.server or netflow.collector attributes to
display only the relevant list of bind variables during provisioning of
devices. To apply a filter on an attribute, select an attribute from the
Filter by drop-down list. From the Condition drop-down list, select a
condition to match the Value.
d. For the source type NetworkProfile, choose SSID as the entity type. The
SSID entity that is populated is defined under Design> Network Profile. The
binding generates a user-friendly SSID name, which is a combination of SSID
name, site, and SSID category. From the Attributes drop-down list, choose
wlanid or wlanProfileName. This attribute is used during the advanced CLI
configurations at the time of template provisioning.
e. For the source type Inventory, choose one of these entities: Device,
Interface, AP Group, Flex Group, Wlan, Policy Profile, Flex Profile, Webauth
Parameter Map, Site Tag, Policy Tag, or RF Profile. For the entity type Device
and Interface, the Attribute drop-down list shows the device or interface
attributes. The variable resolves to the AP Group and Flex Group name that is
configured on the device to which the template is applied.
You can apply filter on the Device, Interface, or Wlan attributes to display
only the relevant list of bind variables during provisioning of devices. To
apply a filter on an attribute, select an attribute from the Filter by drop-
down list. From the Condition drop-down list, select a condition to match the
Value.
After binding variables to a common setting, when you assign templates to a wireless profile and provision the template, the network settings that you defined under Network Settings> Network appear in the drop-down list. You must define these attributes under Network Settings> Network at the time of designing your network.
Step 5
If the template contains variable bindings that bind to specific attributes
and the template code accesses those attributes directly, you must do one of
the following:
- Change the binding to the object instead of to the attributes.
- Update the template code to not access the attributes directly.
For example, if the template code is as follows, where $interfaces binds to
specific attributes, you must update the code as shown in the following
example, or modify the binding to the object instead of to the attributes.
Old sample code:
foreach ( $interface in $interfaces )
$interface.portName
description “something”
end
New sample code:
foreach ( $interface in $interfaces )
interface $interface
description “something”
end
Special Keywords
All commands executed through templates are always in the configt mode.
Therefore, you do not have to specify the enable or configt commands
explicitly in the template.
Day-0 templates do not support special keywords.
Enable Mode Commands
Specify the #MODE_ENABLE command if you want to execute any commands outside
of the configt command.
Use this syntax to add enable mode commands to your CLI templates:
MODE_ENABLE
<
MODE_END_ENABLE
Interactive Commands
Specify #INTERACTIVE if you want to execute a command where a user input is
required.
An interactive command contains the input that you must enter following the
execution of a command. To enter an interactive command in the CLI Content
area, use the following syntax:
CLI Command
Where
The Interactive question uses regular expressions to validate if the text
received from the device is similar to the text entered. If the regular
expressions entered in the
For example, the following command has output that includes metacharacters and newlines.
Switch(config)# no crypto pki trustpoint DNAC-CA
% Removing an enrolled trustpoint will destroy all certificates received from
the related Certificate Authority
Are you sure you want to do this? [yes/no]:
To enter this in a template, you need to select a portion that does not have
any metacharacters or newlines.
Here are a few examples of what could be used.
INTERACTIVE
no crypto pki trustpoint DNAC-CA
ENDS_INTERACTIVE
INTERACTIVE
no crypto pki trustpoint DNAC-CA
ENDS_INTERACTIVE
INTERACTIVE
no crypto pki trustpoint DNAC-CA
ENDS_INTERACTIVE
INTERACTIVE
crypto key generate rsa general-keys
ENDS_INTERACTIVE
Where
Note
In response to the interactive question after providing a response, if the
newline character is not required, you must enter the
For example:
INTERACTIVE
config advanced timers ap-fast-heartbeat local enable 20
Combining Interactive Enable Mode Commands
Use this syntax to combine interactive Enable Mode commands:
MODE_ENABLE
INTERACTIVE
commands
ENDS_INTERACTIVE
MODE_END_ENABLE
MODE_ENABLE
INTERACTIVE
mkdir
ENDS_INTERACTIVE
MODE_END_ENABLE
Multiline Commands
If you want multiple lines in the CLI template to wrap, 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:
- Where
and are case-sensitive and must be in uppercase. - The multiline commands must be inserted between the
and tags. - The tags cannot start with a space.
- The
and tags cannot be used in a single line.
Associate Templates to Network Profiles
Before you begin
Before provisioning a template, ensure that the template is associated with a
network profile and the profile is assigned to a site.
During provisioning, when the devices are assigned to specific sites, the
templates associated with the site through the network profile appear in the
advanced configuration.
Step 1
Click the menu icon ( ) and choose Design> Network Profiles, and click Add
Profile.
The following types of profiles are available:
-
Assurance: Click this to create an Assurance profile.
-
Firewall: Click this to create a firewall profile.
-
Routing: Click this to create a routing profile.
-
Switching: Click this to create a switching profile.
• Click the Onboarding Templates or Day-N Templates, as required.
• In the Profile Name field, enter the profile name.
• Click +Add Template and choose the device type, tag, and template from the Device Type, Tag Name, and Template drop-down lists.
If you do not see the template that you need, create a new template in Template Hub. See Create a Regular Template, on page 3.
• Click Save. -
Telemetry Appliance: Click this to create a Cisco DNA Traffic Telemetry Appliance profile.
-
Wireless: Click this to create a wireless profile. Before assigning a wireless network profile to a template, ensure that you have created wireless SSIDs.
• In the Profile Name field, enter the profile name.
• Click+ Add SSID. The SSIDs that were created under Network SettingsWireless are populated.
• Under Attach Template(s), from the Template drop-down list, choose the template that you want to provision.
• Click Save.
Note
You can view the Switching and Wireless profiles in the Cards and the Table
view.
Step 2 The Network Profiles window lists the following:
- Profile Name
- Type
- Version
- Created By
- Sites: Click Assign Site to add sites to the selected profile.
Step 3
For Day-N provisioning, choose Provision> Network Devices > Inventory and
do the following:
a) Check the check box next to the device name that you want to provision.
b) From the Actions drop-down list, choose Provision.
c) In the Assign Site window, assign a site to which the profiles are
attached.
d) In the Choose a Site field, enter the name of the site to which you want to
associate the controller, or choose from the Choose a Site drop-down list.
e) Click Next.
f) The Configuration window appears. In the Managed AP Locations field, enter
the AP locations managed by the controller. You can change, remove, or
reassign the site. This is applicable only for wireless profiles.
g) Click Next.
h) The Advanced Configuration window appears. The templates associated with
the site through the network profile appear in the advanced configuration.
- Check the Provision these templates even if they have been deployed before check box if you overwrote any configurations from intent in the template, and you want your changes to override. (This option is disabled by default.)
- The Copy running config to startup config option is enabled by default, which means that after deploying the template configuration, write mem will be applied. If you don’t want to apply the running config to the startup config, you must uncheck this check box.
- Use the Find feature to quickly search for the device by entering the device name, or expand the templates folder and select the template in the left pane. In the right pane, select values for those attributes that are bound to the source.
- To export the template variables into a CSV file while deploying the template, click Export in the right pane.
You can use the CSV file to make necessary changes in the variable configuration and import it into Cisco DNA Center at a later time by clicking Import in the right pane.
i) Click Next to deploy the template.
j) Choose whether you want to deploy the template Now or schedule it for
later.
The Status column in the Device Inventory window shows SUCCESS after the
deployment succeeds.
Step 4 Click Export Deployment CSV to export template variables from all
the templates in a single file.
Step 5 Click Import Deployment CSV to import template variables from all
the templates in a single file.
Step 6 For Day-0 provisioning, choose Provision> Plug and Play and do the
following:
a) Choose a device from the Actions drop-down list, and choose Claim.
b) Click Next and in Site Assignment window, choose a site from the Site drop-
down list.
c) Click Next and in Configuration window, choose the image and the Day-0
template.
d) Click Next and in the Advanced Configuration window, enter the location.
e) Click Next to view the Device Details, Image Details, Day-0 Configuration
Preview, and Template CLI Preview.
Detect Conflicts in a CLI Template
Cisco DNA Center allows you to detect conflicts in a CLI template. You can view potential design conflicts and run-time conflicts for switching, SD- Access, or fabric.
Potential Design Conflicts Detection Between CLI Template and Service Provisioning Intent
Potential Design Conflicts identify the intent commands in the CLI template and flag them, if the same command is pushed by switching, SD-Access, or fabric. Intent commands are not recommended for use, because they are reserved to be pushed to the device, by Cisco DNA Center.
Step 1 Click the menu icon ( ) and choose Tools> Template Hub.
The Template Hub window is displayed.
Step 2 In the left pane, click the Project Name from the drop-down list
to view the CLI templates of the preferred project.
To view only the templates with conflicts, in the left pane, under Potential
Design Conflicts, check the
Note
Conflicts check box.
Step 3 Click the template name.
Alternatively, you can click the warning icon under the Potential Design
Conflicts column. The total number of conflicts is displayed.
The CLI Template is displayed.
Step 4 In the template, the CLI commands that have conflicts are flagged
with a warning icon. Hover over the warning icon to view the details of the
conflict.
For new templates, the conflicts are detected after you save the template.
Step 5 (Optional) To show or hide the conflicts, click the Show Design
Conflicts toggle.
Step 6 Click the menu icon ( ) and choose Provision> Inventory to view
the number of CLI templates with conflicts. In the Inventory window a message
with a warning icon is displayed, which shows the number of conflicts in the
newly configured CLI template. Click the Update CLI Templates link to view the
conflicts.
Detect CLI Template Run-Time Conflict
Cisco DNA Center allows you to detect run-time conflict for switching, SD- Access, or fabric.
Before you begin
You must configure the CLI template through Cisco DNA Center to detect run-
time conflict.
Step 1 Click the menu icon ( ) and choose Provision> Inventory.
The Inventory window is displayed.
Step 2 View the template provisioning status of devices under the
Template Provision Status column, which shows the number of templates
provisioned for the device. The templates that are provisioned successfully
are displayed with a tick icon.
The templates that have conflicts are displayed with a warning icon.
Step 3 Click the link under the Template Provision Status column to open
the Template Status slide-in pane.
You can view the following information in the table:
- Template Name
- Project Name
- Provision Status: Displays Template Provisioned if the template was provisioned successfully or Template Out of Sync if there are any conflicts in the template.
- Conflict Status: Displays the number of conflicts in the CLI template.
- Actions: Click View Configuration to view the CLI template. Commands that have conflicts are flagged with a warning icon.
Step 4 (Optional) View the number of conflicts in a CLI template under
the Template Conflicts Status column in the Inventory window.
Step 5 Identify the run-time conflicts by generating a configuration
preview:
a) Check the check box next to the device name.
b) From the Actions drop-down list, choose Provision Device.
c) In the Assign Site window, click Next. In the Advanced Configuration
window, make the necessary changes and click Next. In the Summary window,
click Deploy.
d) In the Provision Device slide-in pane, click the Generate Configuration
Preview radio button and click Apply.
e) Click the Work Items link to view the generated configuration preview.
Alternatively, click the menu icon ( ) and choose Activities >Work Items to
view the generated configuration preview.
f) If the activity is still loading, click Refresh.
g) Click the preview link to open the Configuration Preview slide-in pane. You
can view the CLI commands with run-time conflicts flagged with warning icons.
Read User Manual Online (PDF format)
Read User Manual Online (PDF format) >>