Document toolboxDocument toolbox

Working with Configuration Templates

If you plan to work with categories of Cisco and Juniper switches and routers that are not part of the Automation Change Manager set, you create a new "canned" IOS or JunOS template on the Configurations Templates  page. This is the foundational tool for adding device types to the Automation Change Manager (ACM).

Note

A new variable is available for use in script templates: the $NetMRI_ipaddress variable, whose data is formatted in standard dotted-quad format. It sets a variable for the IP address of the device.

The Config Templates tab (Config Management > Job Management tab > Config Templates) provides an editing environment to develop standard configuration files. This feature is required for provisioning network devices using the Automation Change Manager's Bare Metal Provisioning (BMP) task, specifically for Cisco and Juniper routers and switches.

For all config templates, NetMRI provides an Action icon with the following important editing functions:

  • Copy: To copy a template into a new file.
  • Edit: Opening an editor window to make changes to an existing config template.
  • Schedule: To schedule the config template job to run at a later time.
  • Run Now: To run the Config Template job through the Job Wizard.
  • Test Policy: Test the template as a device-specific Policy. this requires all variables within the saved template file to be configured with specific values.
  • Export: To immediately open the selected config file template in a text editor or save it out on your disk.
  • Delete: To delete the template from the table.

NetMRI does not validate templates. You can experiment within the limits of common sense and best practices for device configuration. Templates are a different job type, similar to scripts. The ACM Bare Metal Provisioning task operates using Config Templates as one of its core building blocks.

Note

The ACM Bare Metal Provisioning task is designed to execute on numerous instances of the exact same device type (50 Cisco 2821 routers, for example). You cannot execute a single BMP job on different device types. Therefore, you use only a single Config template for any BMP job.

You can access templates from CCS, Perl, and Python.

You can use templates to define variables and configuration file text. Variable definitions are optional, while configuration text is required as part of the template.

Note

Templates are a support feature of jobs in the NetMRI appliance. You apply templates to jobs just as you would a script. ACM's Bare Metal Provisioning is an example of this principle. The same rules and restrictions that apply to scheduling, running, and approving script jobs apply to running template jobs.

Use completed templates to create a new policy or test against a policy, schedule as a Job, create new templates, respond to a trigger event such as Bare Metal Provisioning, and other tasks. When scheduling a template as part of a Job, it is combined with a script as part of a new Job definition.

Should a Configuration Template be used to provision a Bare Metal Device, the name of the Config Template in NetMRI must be the same as for a corresponding List in Job Management. For example, a cisco_catalyst37xxstack configuration template appears in the Config Template page when the NetMRI appliance is enabled for the Automation  Change Manager. The sample Cisco Catalyst 37xx IOS template reads as follows (edited to remove extra line feeds):

version 12.2 no service pad
service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption
!
hostname $hostname enable password infoblox
!
boot-start-marker boot-end-marker
username admin privilege 15 password 0 infoblox no aaa new-model
switch 1 provision ws-c3750-48p system mtu routing 1500
vtp domain cisco vtp mode transparent ip subnet-zero
ip domain-name $domain_name no ip domain-lookup spanning-tree mode pvst
spanning-tree extend system-id
!
vlan internal allocation policy ascending
$config_vlans
$config_interfaces
!
no ip classless
ip default-gateway $gateway no ip http server
no ip http secure-server
!
logging $syslog
snmp-server community infoblox RW
!
control-plane
!
line con 0
line vty 0 4
exec-timeout 300 0 logging synchronous login local
transport input telnet ssh line vty 5 15
exec-timeout 300 0 logging synchronous login local
transport input telnet ssh
!
end

The template also provides a standard set of template variables for use by the BMP provisioning script:

$hostname string""
$config_vlans string""
$domain_name string""
$gatewaystring""
$syslog string""
$config_interfaces string""

Note the use of variables in the template. For example, consider the following command string in the Config Template:

ip domain-name $domain_name

And the corresponding statement in the Template Variables:

$domain_name string""

Note that the set of variables defined in the config templates are fixed. The values themselves are defined during job execution by the values in the columns in the TAE BMP Device Provisioning list or from the TAE BMP Site Settings list.

To create a new template, perform the following:

  1. At the top right of the page, click New. The Config File Template dialog appears.
  2. Enter a Name for the template.
  3. Choose the Vendor and Device Type.
  4. Enter the Model and Version.
  5. Enter any Template Variables required for the new Config File Template. Consult the other Config Templates if you need examples.
  6. Paste or write any configuration file text that is required for the template.
  7. Click Save & Close.

Admins may provide templates exported from another NetMRI appliance or from an archive.

To import a template from an existing configuration file (you might wish to do this, because you are creating a Config Template for a different type of device in your network), perform the following:

  1. At the top right of the page, click Import.
  2. Enter the path and file name, or click Browse... to locate the file.
  3. Click Import.

To export the entire table of templates from the Config Template page, perform the following:

  1. At the top right of the page, click CSV Export. A dialog box appears, requesting "Do you want to open or save this file?" If you have Excel or another CSV file-compatible spreadsheet program, you can immediately open the complete table of templates by simply clicking Open.
  2. To save the table data as a new CSV-format file, click Save.
  3. Click Save in the Save As dialog box after browsing folder paths and defining the file name. (Procedures may vary slightly based on the operating system.)

NetMRI does not export the templates — the table listing all the templates is exported to an externally readable file.

To copy a template, perform the following:

  1. Click Copy. The Copy Script dialog appears.
  2. Enter a name for the new template, and then click OK.

To edit a template, perform the following:

  1. Click Edit. The Edit Template dialog appears.
  2. Edit the template as needed. Note the similarities between the Edit Template window and the Edit Job window.
  3. Click Save & Close.

To create a Policy from a template and to test a template as a Policy, perform the following:

  1. Click Edit. The Edit Template dialog appears.
  2. Delete or replace device-specific terms with regular expressions. You will need to have a significant understanding of regular expressions and Policy definition. For more information, see Policy Design Center.
  3. Click Create Policy.
    All variables in a template must be replaced with specific values before the template is saved as a new Policy. We recommend using the Test Policy feature before saving the template as a new Policy.

To test a template as a policy, perform the following:

  1. Click Test Policy. The Policy Selector dialog appears.
  2. Select the policy or policies to test against.
  3. Click Test.

The test results will open in a new window.

If any template variables do not have values declared against them, the appliance responds with an "All variables in the template must be replaced with values before testing as a policy" message.

To export a template, click Export, and then save the file.

To delete a template, click Delete, and then confirm the deletion.