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 

Procedure

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

    Click Next to go to the Templatize Config tab.

  4. Add the configuration on the Templatize Config tab. Refer to Table 90 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 91.
  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 89: 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.

 

Click Next to continue.

Table 90: 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.

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 91: 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

Procedure

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

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

    The Form 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 92 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.

Procedure

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 92: Form 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.

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

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

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

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

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

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

Validate

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.

Max

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

Min

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

Visibility for 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).

Visibility for 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:

      Procedure

      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 Resources page appears displaying the existing resources.

    • Procedure

      To add a dynamic resource:

      1. Click the + (add) icon.

        The Add Resource page appears.

      2. Complete the configuration according to the guidelines specified in Table 93. Fields marked with an asterisk (*) are mandatory.
      3. Click OK to save the resource.

        You are returned to the Manage 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 Form 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.

Invalid Message

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 93: Fields on the Add 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.

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