Add Configuration Templates
In Administration Portal, users with the SP (Service Provider) Administrator role (on-premises installation only) or OpCo (Operating Company) Administrator role can add a configuration template by providing the device configuration using the Jinja template language syntax.
In CSO releases before Release 5.1.0, configuration templates are called stage-2 configuration templates.
If a user with the SP Administrator role adds a template, the template is available to the OpCos, OpCo’s tenants, and the SP Administrator’s tenants.
If a user with the OpCo Administrator role adds a template, the template is available only to the OpCo and the OpCo’s tenants.
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.
Note 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)
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. |
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. |
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. |
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:
|
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:
|
Table 4: 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:
|
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:
|
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 5: 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 | 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. |
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. For example, let’s say that the list contains device UUIDs (universally unique IDs) and that you specify device type as an additional value. You can enter a JavaScript function in the Event Handler field to display a parameter (such as the Virtual Chassis toggle button) on the UI only when the device is an EX Series switch. So, the Virtual Chassis toggle button is displayed only if you select an EX Series switch from the list. |