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:
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:
|
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. |
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 |
|
[Detected Parameters] |
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. |
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:
|
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:
|
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:
|
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:
|
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. |
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 |
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:
|
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. |