How To Add Templates In Pathfinder
Create Templates to Automate Device Configuration Changes
About Template Editor
Cisco DNA Center provides an interactive editor called Template Editor 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 reuse the template to deploy your devices in one or more sites that are configured anywhere in your network.
With Template Editor, you can:
-
Create, edit, and delete a template
-
Add interactive commands
-
Validate errors in template
-
Version control the templates for tracking purposes
-
Simulate templates
Create Projects
Procedure
Step 1 | In the Cisco DNA Center GUI, click the Menu icon () and choose . |
Step 2 | In the left pane, click . The Add New Project window appears. |
Step 3 | Enter a name for the project in the Name field. |
Step 4 | Enter a description for the project in the Description field. |
Step 5 | Click Add. The created project appears in the left pane. |
Create Templates
Cisco DNA Center provides regular and composite configuration templates. CLI templates allow you choose the elements in the configuration. Cisco DNA Center provides variables that you can replace with the actual values and logic statements.
Create a Regular Template
Procedure
Step 1 | In the Cisco DNA Center GUI, click the Menu icon () and choose . 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, select the project under which you are creating templates. | ||
Step 3 | Click the gear icon in the left pane. Alternately, click in the left pane.
| ||
Step 4 | The Regular Template is selected by default in the Add New Template window. | ||
Step 5 | In the Template Language selection, click the Velocity or Jinja radio button to select the language that you want to use to create the template content. | ||
Step 6 | Enter a unique name for the template in the Name field, | ||
Step 7 | From the Project Name drop-down list, choose the project. The drop-down list is enabled if you are navigating from the path. The drop-down list is disabled if you select a project and click the gear icon in the left pane. | ||
Step 8 | Enter a description for the template in the Description field. | ||
Step 9 | From the Tags drop-down list, choose a tag name for your template. Tags are like keywords that help you locate your template more easily.
| ||
Step 10 | Click Edit to select device types that you want to apply to this template. The Select Device Type(s) window appears. By default, all device types are displayed.
There are different granularity levels for selecting the device type from the hierarchical structure. The device type is used during deployment to ensure that templates deploy devices that match the specified device type criteria. This lets you create specialized templates for specific device models. Template Editor does not show device product IDs (PIDs); instead, it shows the device series and model description. You can use cisco.com to look up the device data sheet based on the PID, find the device series and model description, and choose the device type appropriately. | ||
Step 11 | After selecting device types, click Back to Add New Template. | ||
Step 12 | From the Software Type drop-down list, choose the software type: IOS, IOS-XE, IOS-XR, NX-OS, Cisco Controller, Wide Area Application Services, Adaptive Security Appliance, NFV- OS, and Others. For more information on the Cisco Wireless Controller supported software versions and the minimum supported version, see Cisco DNA Center Supported Devices. For example, 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 conforms to the selection in the template. | ||
Step 13 | In the Software Version field, enter the software version. 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 provision skips the template. | ||
Step 14 | Click Add. The create template appears under the project you selected in the left pane. | ||
Step 15 | You can edit the template content by selecting the template that you created in the left pane. For more information about editing the template content, see Edit Templates. |
Blocked List Commands
Blocked list commands are commands that are added to the blocked list category. You can use these commands only through the Cisco DNA Center applications. 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.
Here is the list of supported blocked list commands in this release:
-
Router LISP is supported on Cisco Catalyst 1000 Series Switches, Cisco Catalyst 3000 Series Switches, Cisco Catalyst 4000 Series Switches, and Cisco Catalyst 6000 Series Switches.
-
Hostname is supported on Cisco Integrated Services Virtual Router (ISRv) and Cisco Adaptive Security Virtual Appliance (ASAv).
Sample Templates
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
Note | You can add only a committed template to a composite template. |
Procedure
Step 1 | In the Cisco DNA Center GUI, click the Menu icon () and choose . | ||
Step 2 | In the left pane, select the project under which you are creating templates. | ||
Step 3 | Click the gear icon in the left pane. Alternately, click in the left pane. | ||
Step 4 | In the Add New Template window, click the Composite Template radio button to create a composite sequential template. | ||
Step 5 | In the Name field, enter a unique name for the template. | ||
Step 6 | In the Project Name field, enter a unique name for the project. The text box is enabled if you are navigating from the path. The text box is disabled if you select a project and choose in the left pane. | ||
Step 7 | In the Description field, enter a description for the template. | ||
Step 8 | From the Tags drop-down list, choose a tag name for your template. Tags are like keywords that help you locate your template more easily.
| ||
Step 9 | Click Edit to select device types that you want to apply to this template. The Select Device Type(s) window appears. By default, all device types are displayed.
| ||
Step 10 | After selecting device types, click Back to Add New Template. | ||
Step 11 | From the Software Type drop-down list, choose the software type. 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. | ||
Step 12 | In the Software Version field, enter the software version. During provisioning, Cisco DNA Center checks to see if the selected device has the similar software version listed in the template. If there is a mismatch, the provision skips the template. | ||
Step 13 | Click Add. The create composite template appears under the project you selected in the left pane. | ||
Step 14 | Click the composite template that you created in the left view pane. | ||
Step 15 | In the Template Editor window, drag and drop templates from the left pane to order or sequence the templates. The templates are deployed based on the order in which they are sequenced. You can change the order of templates in the Template Editor window.
| ||
Step 16 | To cancel the deployment process upon failure of the first template, select the first template in the Template Editor window and check the Abort sequence on targets if deployment fails check box. | ||
Step 17 | From the Actions drop-down list, choose Commit to commit the template content. |
Edit Templates
Procedure
Step 1 | In the Cisco DNA Center GUI, click the Menu icon () and choose . | ||
Step 2 | In the left pane, choose the template that you want to edit. The Template Editor window appears. | ||
Step 3 | In the Template Editor window, enter the template content. You can have a template with a single-line configuration or a multi-select configuration. | ||
Step 4 | From Template Language, choose the language with which to write the content:
| ||
Step 5 | From the Actions drop-down list, choose Check for errors to validate the template.
| ||
Step 6 | From the Actions drop-down list, choose Save. 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 7 | From the Actions drop-down list, choose Commit.
|
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.
Procedure
Step 1 | In the Cisco DNA Center GUI, click the Menu icon () and choose . | ||
Step 2 | From the left pane, choose the template that you want to edit. The Template Editor window appears. | ||
Step 3 | In the top-right corner, click the Simulator Editor icon to run simulation on commands. | ||
Step 4 | From the Actions drop-down list, choose Create Simulation. The Simulation Input form appears. | ||
Step 5 | In the Simulation Name name field, enter a name for the simulation.
| ||
Step 6 | In the Simulation Input form, complete the required fields, and click Run. The results are displayed in the Template Preview window. |
Export Template(s)
Procedure
Step 1 | In the Cisco DNA Center GUI, click the Menu icon () and choose . |
Step 2 | In the left pane, select the template that you want to export. Choose .
|
Step 3 | Click Save, if prompted. The latest version of the template is exported. To export an earlier version of the template, open the template from Actions > Show History > View. Click Actions > Export. |
Import Template(s)
You can import a template or multiple templates under a project.
Procedure
Step 1 | In the Cisco DNA Center GUI, click the Menu icon () and choose . | ||
Step 2 | In the left pane, select a project to which you want to import the template(s). Choose . | ||
Step 3 | Click Select a File from your computer on the Import Template(s) window and browse to the location of your JSON template file. | ||
Step 4 | Select the JSON file and click Open. The template is imported under the selected project. If a template with the same name exists, Cisco DNA Center displays an error message and does not import the template.
|
Clone a Template
Procedure
Step 1 | In the Cisco DNA Center GUI, click the Menu icon () and choose . |
Step 2 | In the left pane, select the template that you want to export. Choose . |
Step 3 | Enter the name of the cloned template in the Name field of the Clone Template window. |
Step 4 | Choose a project from the Project Name drop-down list. |
Step 5 | Click Clone. |
Step 6 | To commit the cloned template, select the template from the left pane of the window and click Actions > Commit. The latest version of the template is cloned. To clone an earlier version of the template, open the template from Actions > Show History > View. Click Actions > Clone. |
Export Project(s)
Procedure
Step 1 | In the Cisco DNA Center GUI, click the Menu icon () and choose . |
Step 2 | In the left pane, select the project that you want to export. Choose . To export projects in bulk, click in the left pane. Select the projects to be exported and click Export. |
Step 3 | Click Save, if prompted. |
Import Project(s)
You can import a project or multiple projects with their templates, into the Cisco DNA Center Template Editor.
Procedure
Step 1 | In the Cisco DNA Center GUI, click the Menu icon () and choose . | ||
Step 2 | In the left pane, click . | ||
Step 3 | Click Select a File from your computer on the Import Project(s) window and browse to the location of your JSON project file. | ||
Step 4 | Select the JSON file and click Open. The project and its templates are imported. If a project with the same name exists, Cisco DNA Center displays an error message and does not import the project.
|
Template Form Editor
Procedure
Step 1 | Select the template in the left pane. The template window opens. |
Step 2 | Click the Form Editor icon to add metadata to the template variables. All the variables that are identified in the template are displayed. You can configure the following metadata:
|
Step 3 | After configuring metadata information, from the Actions drop-down list, choose Save. |
Step 4 | After saving the template, you must version it. You must version the template every time you make changes to it. From the Actions drop-down list, choose Commit. The Commit window appears. You can enter a commit note in the Commit Note text box. The version numbers are automatically generated by the system. |
Step 5 | 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.
|
Variable Binding
While creating a template, you can specify variables that are contextually substituted. Many of these variables are available in the Template Editor drop-down list.
Template Editor 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. You can view the list of implicit variables by clicking the icon next to the name of the template in the Code Editor or the Form Editor window.
The predefined object values can be one of the following:
-
Inventory
-
Device object
-
Interface object
-
-
Common Settings: Settings available under . The common settings variable binding resolves values that are based on the site to which the device belongs.
Procedure
Step 1 | In the Cisco DNA Center GUI, click the Menu icon () and choose . |
Step 2 | Choose the template and click the Input Form icon to bind variables in the template to network settings. |
Step 3 | Select the variables in the Input Form pane and check the Required check box to bind variables to the network settings. |
Step 4 | From the Display drop-down list, choose the type of UI widget to create at the time of provisioning: Text Field, Single Select, or Multi Select. |
Step 5 | To bind variables to network settings, select each variable in Input Form, and check the Bind to Source check box under Content.
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 appear in the drop-down list. You must define these attributes under at the time of designing your network. |
Special Keywords
All commands executed through templates are always in the config t mode. Therefore, you do not have to specify the enable or config t 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 config t command.
Use this syntax to add enable mode commands to your CLI templates:
#MODE_ENABLE <<commands>> #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<IQ>interactive question 1 <R> command response 1 <IQ>interactive question 2<R>command response 2
Where <IQ> and <R> tags evaluate the text provided against what is seen on the device.
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 <IQ> <R> tags are found, then the interactive question passes and a part of the output text appears. This means that you need to enter a part of the question and not the entire question. Entering Yes or No between the <IQ> and <R> tags is sufficient but you must make sure that the text Yes or No appears in the question output from the device. The best way to do this is by running the command on the device and observe the output. In addition, you need to ensure that any regular expression metacharacters or newlines entered are used appropriately or avoided completely. The common regular expression metacharacters are . ( ) [ ] { } | * + ? \ $ ^ : &.
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<IQ>yes/no<R>yes #ENDS_INTERACTIVE
#INTERACTIVE no crypto pki trustpoint DNAC-CA<IQ>Removing an enrolled<R>yes #ENDS_INTERACTIVE
#INTERACTIVE no crypto pki trustpoint DNAC-CA<IQ>Are you sure you want to do this<R>yes #ENDS_INTERACTIVE
#INTERACTIVE crypto key generate rsa general-keys <IQ>yes/no<R> no #ENDS_INTERACTIVE
Where <IQ> and <R> tags are case-sensitive and must be entered in uppercase.
Note | In response to the interactive question after providing a response, if the newline character is not required, you must enter the <SF> tag. Include one space before the <SF> tag. When you enter the <SF> tag, the </SF> tag pops up automatically. You can delete the </SF> tag because it is not needed. For example: |
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 #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:
<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.
Associate Templates to Network 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 appear in the advanced configuration.
Procedure
Step 1 | In the Cisco DNA Center GUI, click the Menu icon () and choose , and click Add Profile. The following types of profiles are available:
|
Step 2 | The Network Profiles page lists the following:
|
Step 3 | For Day-N provisioning, choose . The Device Inventory window appears.
|
Step 4 | For Day-0 provisioning, choose . The Plug and Play window appears.
|
How To Add Templates In Pathfinder
Source: https://www.cisco.com/c/en/us/td/docs/cloud-systems-management/network-automation-and-management/dna-center/2-1-2/user_guide/b_cisco_dna_center_ug_2_1_2/b_cisco_dna_center_ug_2_1_1_chapter_01000.html
Posted by: sharpwaitted.blogspot.com
0 Response to "How To Add Templates In Pathfinder"
Post a Comment