banner



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.

Note

The template that you create for day-0 can also be applied for day-N.

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.

Note
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."
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.

  • Use the Find feature to quickly search for the device by entering the device name or expand the device type and check the check boxes next to the device types that you want to apply to the template.

    To view the devices that are selected, choose Selected from the Show drop-down list.

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

Refer to these sample templates 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.

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.

Note
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."
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.

  • Use the Find feature to quickly search for the device by entering the device name or expand the device type and check the check boxes next to the device types that you want to apply to the template.

    To view the devices that are selected, choose Selected from the Show drop-down list.

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.

Note

By default, the Applicable option is chosen in the View filter. Only the applicable templates that can be added to the composite template are shown in the Template Editor window. You can choose the All option in the View filter to view all the templates in the Template Editor window. In the All option view, the templates that match the chosen device types and software version are marked by a plus icon.

You can drag and drop templates that have the same device type, software type, and software version as that of the composite template.

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

After creating a template, you can edit the template to include content.

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:

  • 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.

  • Jinja: Use the Jinja language. For information, see https://www.palletsprojects.com/p/jinja/.
Step 5

From the Actions drop-down list, choose Check for errors to validate the template.

Cisco DNA Center checks for these errors and reports them:
  • Language syntax errors.

  • Conflicts with blocked list commands. For more information, see Blocked List Commands.

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.

Note

You can associate only a committed 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.

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.

Note

If there are implicit variables in your template then click edit link to select a device or site in the Simulation Input form to run the simulation against real devices based on your bindings.

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)

You can export a template or multiple templates to a single file, in JSON format.

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 .

  • To export multiple templates under a project, select a project in the left pane and choose .

    Select the templates from the Export Template(s) window and, click Export.

  • To export multiple templates under different projects, click , in the left pane.

    Select the templates to be exported, from the Export Project(s) window, and click Export.

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.

Note

To import a template with the same name as an existing one, check the Create new version of imported template/project when template/project with the same name already exists in the hierarchy check box on the Import Template(s) window.

Selecting this option creates a new version of the existing template.


Clone a Template

You can make a copy of a template to reuse portions of it.

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)

You can export a project or multiple projects, including their templates, to a single file in JSON format.

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.

Note

To import a project with the same name as an existing one, check the Create new version of imported template/project when template/project with the same name already exists in the hierarchy check box on the Import Project(s) window.

Selecting this option creates a new version of the existing 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:

  • Choose the variable and check the Not a Variable check box if you do not want the string to be considered as a variable.

  • Enter the field name in the Field Name text box. This is the label that is used for the UI widget of each variable during provisioning.

  • Enter the tooltip text that is displayed for each variable in the Tooltip text box.

  • Enter the default value in the Default Value text box. This value appears during provisioning as the default value.

  • Enter any instructional text in the Instructional Text text box. Instructional text appears within the UI widget (for example, Enter the hostname here). The text within the widget is cleared when you click the widget to enter any text.

  • Choose the data type from the Data Type drop-down list: String, Integer, IP Address, or Mac Address.

  • Check the Required 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 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, use the if-else block in the template.

  • Choose the type of UI widget you want to create at the time of provisioning from the Display Type drop-down list: Text Field, Single Select, or Multi Select.

  • Enter the number of characters that are allowed in the Maximum Characters text box. This is applicable only for the string data type.

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.

  • 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.


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.

  • Choose the Source, Entity, and Attributes from the respective drop-down lists.

  • 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.

    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.

  • For the source type NetworkProfile, choose SSID as the entity type. The SSID entity that is populated is defined under . 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. This attribute is used during the advanced CLI configurations at the time of template provisioning.

  • For the source type Inventory, choose one of these entities: Device, Interface, AP Group, Flex Group, Wlan, Policy Profile, Flex 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 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:

                            #INTERACTIVE config advanced timers ap-fast-heartbeat local enable 20 <SF><IQ>Apply(y/n)?<R>y #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 #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:

  • Routing & NFV: Select this to create a routing and NFV profile.
  • Switching: Select this to create a switching profile.
    • Click the Onboarding Templates or Day-N Templates as required.

    • Enter the Profile Name.

    • Click +Add and select 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 Editor as described in Create a Regular Template.

    • Click Save.

  • Wireless: Select this to create a wireless profile. Before assigning a wireless network profile to a template, ensure that you have created wireless SSIDs.
    • Enter the Profile Name.

    • Click + Add SSID. Those SSIDs that were created under are populated.

    • Under Attach Template(s), select the template that you want to provision from the Template drop-down list.

    • Click Save.

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

For Day-N provisioning, choose . 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 Choose a Site field, enter the name of the site to which you want to associate the controller or select from the Choose a Site drop-down list.
  • Click Next.

    The Configuration window appears. In the Managed AP Locations field, enter the AP locations managed by the controller. Here you can change, remove, or reassign the site. This is applicable only for wireless profiles.

  • Click Next.
  • The Advanced Configuration window appears. The templates associated with the site through the network profile appear in the advanced configuration.
    • 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.

  • Click Next to deploy the template. You are prompted to deploy the template now or to schedule it to a later time.
  • To deploy the template now, click the Now radio button and click Apply. To schedule the template deployment for a later date and time, click the Later radio button and define the date and time of the deployment.

    The Status column in the Device Inventory window shows SUCCESS after a successful deployment.

Step 4

For Day-0 provisioning, choose . The Plug and Play window appears.

  • Choose a device and click Claim from the Actions drop-down list.
  • Click Next, and in the Site Assignment window, choose a site from the Site drop-down list.
  • Click Next, and in the Configuration window, choose the image and the Day-0 template.
  • Click Next, and in the Advanced Configuration window, enter the location.
  • Click Next to view the Device Details, Image Details, Day-0 Configuration Preview, and Template CLI Preview.

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

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel