Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Add Configuration Templates

Note:

In CSO releases before Release 5.1.0, configuration templates are called stage-2 configuration templates.

In Customer Portal, users with the Tenant Administrator role can add a configuration template by providing the device configuration in the Jinja template language syntax.

Note:
  • Before you add the configuration template, ensure that you have the device configuration ready.

  • We recommend that you use a working device configuration to add the configuration template.

To add a configuration template:

  1. Select Resources > Templates > Configuration Templates.

    The Configuration Templates page appears.

  2. Click the + (add) icon.

    The Add Configuration Template page (wizard) appears.

    Note:

    Fields marked with an asterisk (*) are mandatory.

  3. Configure the fields on the Basic Information tab according to the guidelines provided in Table 1.

    Click Next to go to the Templatize Config tab.

  4. Add the configuration on the Templatize Config tab. Refer to Table 2 for an explanation of the actions on this tab.

    Click Next to go to the Generated UI tab, where the UI for the parameters that you entered is generated and displayed.

  5. Perform one or more actions on this tab, as explained in Table 3.
  6. Click Save.

    The configuration template is added and you are returned to the Configuration Templates page, where a confirmation message is displayed. You can assign the configuration template to device templates or deploy the template on devices.

Table 1: Basic Information Settings (Add Configuration Template Page)

Setting

Guideline

Template Name

Enter a unique name that can only contain alphanumeric characters and hyphens; 64-character maximum.

Description

Enter a description for the configuration template.

Output Config Format

Select the output configuration format for the template:

  • CLI (default)

  • XML

Device Family

Select the device family for which you are adding the template; for example, juniper-nfx.

Can be re-deployed

Enable this toggle button if you want CSO to deploy the configuration template again when you redeploy the template. CSO deploys the template even if there are no configuration changes since the previous deployment.

If this button is disabled, which is the default, then CSO does not deploy the template again if there are no changes since the previous deployment.

 

Click Next to continue.

Table 2: Templatize Config Actions (Add Configuration Template Page)

Action

Description

View a sample configuration

You can view a sample configuration by clicking the Sample Configuration link near the top of the tab. The sample configuration appears in a new tab in your browser.

Add the device configuration

In the inline editor, copy and paste the device configuration ensuring that the syntax follows the Jinja Template language.

CSO detects the template parameters corresponding to the configuration that you entered and displays them in the Parameters pane.

For more information, see Jinja Syntax and Examples for Configuration Templates.

Advanced Mode

  • When advanced mode is disabled, which is the default, CSO converts the configuration that you entered in Jinja Template language to a Junos OS configuration that uses Junos OS configuration groups. (Configuration groups make it easier to configure and maintain Junos OS configurations; see Understanding Junos OS Configuration Groups.) CSO also automatically includes the commands to delete the configuration groups in the configuration template. If you trigger an undeploy configuration template workflow, CSO uses these commands to delete the configuration. Therefore, to avoid conflict with the commands that CSO automatically includes, ensure that you do not manually include commands related to configuration groups (as part of the device configuration).

  • When advanced mode is enabled, CSO converts the configuration that you entered in Jinja Template language but does not use Junos OS configuration groups and does not include commands to delete the configuration. Therefore, if you plan to undeploy the configuration template later, you must ensure that you manually enter the commands to delete the configuration as part of the device configuration so that CSO can use these commands to delete the configuration.

[Detected Parameters]

Check that the parameters detected match the configuration that you added to the template:

  • If the parameters detected do not match, check the Jinja syntax that you used for the template configuration and make any changes needed in the inline editor.

  • If the parameters detected match the configuration that you added to the template, click Next to continue.

CSO validates the Jinja template syntax and displays an error message if there are any errors.

Table 3: Generated UI Actions (Add Configuration Template Page)

Action

Description

Reorder the UI

Drag and drop individual fields, grids, or sections to change the order in which the parameters appear on the UI.

Modify the settings for a field, section, or grid

To modify the settings for a field, section, or grid:

  1. Click the settings (gear) icon next to the field, section, or grid.

    The Parameter Settings pane appears on the right side of the page, displaying the Basic Settings and Advanced Settings tabs.

  2. Modify the fields on these tabs, as needed. See Table 4 for an explanation of the fields on these tabs.

  3. Click Save Settings for each field to save your changes.

    The modifications that you made are displayed on the UI.

Reset the generated UI

Click Undo all Edits to discard the changes that you made and undo the changes made on the UI.

Preview configuration

Previewing the configuration enables you to check the configuration template that you added.

To preview a configuration template:

  1. Click Preview Configuration.

    The Preview Configuration page appears, displaying the configuration that was rendered based on the values that you entered.

  2. Check if the configuration was rendered correctly.

    • If the configuration was not rendered correctly, click the close (X) icon to go back and make modifications as needed.

    • If the configuration was rendered correctly, click OK.

    You are returned to the Generated UI page.

Table 4: Parameter Settings (Add Configuration Template Page)

Setting

Guideline

Basic Settings Tab

Fields populated in this tab are based on the input type that you select.

Input Type

Select the input type for the parameter in the configuration template:

  • Text (default): If the input value for the parameter is a string of characters.

  • Number: If the input value for the parameter is a number.

  • E-mail: If the input value for the parameter is an e-mail address.

  • IPv4: If the input value for the parameter is an IPv4 address.

  • IPv4 Prefix: If the input value for the parameter is an IPv4 prefix.

  • IPv6: If the input value for the parameter is an IPv6 address.

  • IPv6 Prefix: If the input value for the parameter is an IPv6 prefix.

  • Toggle Button (Boolean): If the input value for the parameter is a boolean value (true or false).

  • Dropdown: If the input value for the parameter is selected from a list.

  • Password: If the input value for the parameter is a password.

    The value that you enter is masked (default).

    (Optional) Click the Show Password (eye) icon to unmask the password.

  • Confirm Password: If the input value for the parameter is to confirm the password.

    If you select this option, a Confirm Password field appears on the UI. The value that you enter is masked (default).

    (Optional) Click the Show Password (eye) icon to unmask the password.

Label

Enter the label that you want displayed (on the UI) for the parameter.

Default Value

Specify a default value for the parameter.

Validation Criteria

For Text input type, select one or more validation criteria against which the input value will be checked.

If the value that you entered for the parameter on the UI does not meet the selected validation criteria, an error message appears.

Description

Enter an explanation for the parameter, which will appear when you hover over the Help (?) icon for the parameter; the maximum length allowed is 256 characters.

Global Scope

Click the toggle button to make the parameter common across all devices to which the configuration template is being deployed to. If you disable the toggle button, which is default, the parameter must be specified for each device.

Hidden

Click the toggle button to hide the parameter on the UI when you preview and deploy the template.

Typically, this option is used to hide a parameter and display it in the template only when an event is triggered. By default, the toggle button is disabled, which means that the parameter is displayed.

Required

Click the toggle button to make the parameter mandatory; parameters that are mandatory are marked with an asterisk (*) on the UI.

Maximum Value

For parameters that are numbers, enter the maximum value (up to 16 digits) for the input.

Minimum Value

For parameters that are numbers, enter the minimum value (up to 16 digits) for the input.

Fields Visible (Toggle Disabled)

For Boolean parameters, select one or more parameters that must appear on the UI when the toggle button is disabled (boolean value is FALSE).

Fields Visible (Toggle Enabled)

For Boolean parameters, select one or more parameters that must appear on the UI when the toggle button is enabled (boolean value is TRUE).

Resource Type

For Dropdown input type, select the type of resource from which you want to retrieve data:

  • Static Resource—Resources in the list on the UI are mapped to the values that you specify.

    • To add a static resource:

      1. Click the + (add) icon.

        Cells appear in the List Values table.

      2. Click inside the cells to specify values for the Label (name for the option in the list), Value (value for the option in the list), and Visibility (conditional visibility based on the option selected from the list) fields.

      3. click (check mark) to save your changes.

        The values that you specified are displayed in the List Values table.

    • To edit a static resource, select the resource and click the edit (pencil) icon.

    • To delete a static resource, select the resource and click the X (delete) icon.

  • Dynamic Resource—Resources in the list on the UI are mapped to the predefined services in CSO.

    Click the Resource Management link to view add, edit, and delete dynamic resources. The Manage Dynamic Resources page appears displaying the existing resources.

    • To add a dynamic resource:

      1. Click the + (add) icon.

        The Add Dynamic Resource page appears.

      2. Complete the configuration according to the guidelines specified in Table 5. Fields marked with an asterisk (*) are mandatory.

      3. Click OK to save the resource.

        You are returned to the Manage Dynamic Resources page, where the resource that you added appears.

      4. Click OK.

        You are returned to the Add Configuration Template page. The resource or resources that you added are available in the Resource list on the Parameter Settings pane.

    • To edit a dynamic resource, select the resource and click the edit (pencil) icon.

    • To delete a dynamic resource, select the resource and click the X (delete) icon.

Key

For data in a table, select a column from the dropdown list that is to be used as a key.

The column that you select is marked as unique (Unique Key), indicating that the entries in this column must be unique.

Keys are unique identifiers used in defining entries (in a table) in the Yang data hierarchy. They help distinguish entries in a column.

Advanced Settings Tab

Regexp

Enter a regular expression (regex pattern) to validate the input value.

A regular expression defines a search pattern that is used to match characters in a string.

For example, the regular expression [A-Z] matches the input with the characters A through Z.

If the input consists of characters other than A through Z, an error message (as specified in the Invalid Message field) appears.

Error Message (Regexp)

Enter an error message that you want displayed on the UI when the input value does not match the specified regular expression.

Remote Validation

Enter a JavaScript function to validate the input value.

Event List

Event Name

Select an event from the list based on which the parameter is conditionally displayed.

Event Handler

Enter a JavaScript function that specifies the actions that the event handler takes in response to an event.

Table 5: Fields on the Add Dynamic Resource Page

Field

Guideline

Data Source

Name

Enter a unique name for the resource.

Source Type

Select the source from which you want to retrieve data:

  • Service based, which uses predefined services to retrieve data.

  • URL based, which uses a URL of the API to retrieve data.

Service

For service-based source type, select a predefined service from which you want to retrieve data.

Entity

For service-based source type, select an entity for which you want to retrieve data.

URL

For URL-based source type, enter the URL of the API to be used for the request.

Method

For the URL-based source type, select the type of HTTPS method (GET or POST) to be used for the resource.

POST Body

For POST method, enter the format of the payload (in JavaScript Object Notation [JSON] format) of the API method, which is sent to the server.

Mock Result

Specify a mock result (in JSON format) if the API request is unable to retrieve data.

Result Mapping

Result Mapping

Select the type of processing to be done on the output of the remote request:

  • Script—Use this option if you want to use a script (in JSON format) to process the output.

  • Mapping—Use this option if you want to map the output using a base path.

Mapping Script

To process the output by using a script, enter a mapping script in JSON format.

Base Path

To process the output by using a base path, enter the base path (JSONPath expression) of the variable in the output from which you want to extract the data; for example, interface.

Label Field

Select whether you want the names, UUIDs, or management status (for the selected entity) displayed as options in the list on the UI.

Value Field

Select a value (such as names, management status, and so on) that you want to associate with the labels (options) in the list on the UI.

When you select an option from the list and save the configuration template, CSO processes its associated value (in the backend).

Extra Fields

Specify the additional values that you want to associate with the labels (options) in the list on the UI. When you select an option from the list on the UI, its associated additional value can be used to trigger an event, when a condition is met, by using a JavaScript function. You specify the JavaScript function in the Event Handler field.