Add Configuration Templates
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.
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:
- Select Resources > Templates > Configuration Templates.
The Configuration Templates page appears.
- Click the + (add) icon.
The Add Configuration Template page (wizard) appears.
Fields marked with an asterisk (*) are mandatory.
- 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.
- 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.
- Perform one or more actions on this tab, as explained in Table 3.
- 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)
Enter a unique name that can only contain alphanumeric characters and hyphens; 64-character maximum.
Enter a description for the configuration template.
Output Config Format
Select the output configuration format for the template:
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)
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.
Check that the parameters detected match the configuration that you added to the template:
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)
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:
Reset the generated UI
Click Undo all Edits to discard the changes that you made and undo the changes made on the UI.
Previewing the configuration enables you to check the configuration template that you added.
To preview a configuration template:
Table 4: Parameter Settings (Add Configuration Template Page)
Basic Settings Tab
Fields populated in this tab are based on the input type that you select.
Select the input type for the parameter in the configuration template:
Enter the label that you want displayed (on the UI) for the parameter.
Specify a default value for the parameter.
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.
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.
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.
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.
Click the toggle button to make the parameter mandatory; parameters that are mandatory are marked with an asterisk (*) on the UI.
For parameters that are numbers, enter the maximum value (up to 16 digits) for the input.
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).
For Dropdown input type, select the type of resource from which you want to retrieve data:
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
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.
Select an event from the list based on which the parameter is conditionally displayed.
Table 5: Fields on the Add Dynamic Resource Page
Enter a unique name for the resource.
Select the source from which you want to retrieve data:
For service-based source type, select a predefined service from which you want to retrieve data.
For service-based source type, select an entity for which you want to retrieve data.
For URL-based source type, enter the URL of the API to be used for the request.
For the URL-based source type, select the type of HTTPS method (GET or POST) to be used for the resource.
Specify a mock result (in JSON format) if the API request is unable to retrieve data.
Select the type of processing to be done on the output of the remote request:
To process the output by using a script, enter a mapping script in JSON format.
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.
Select whether you want the names, UUIDs, or management status (for the selected entity) displayed as options in the list on the UI.
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).