Add Configuration Templates
NoteIn 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
using the Jinja template language syntax.
NoteBefore you add the configuration template, ensure that
you have the device configuration ready.
We recommend that you use a working configuration on the
device 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.
NoteFields 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 Customize Variables tab,
where the template parameters that you configured are displayed in
a grid.
- You can modify the parameters for one or more rows as
follows:
- Click inside a row to modify the values for the fields
in that row according to the guidelines provided in Table 3.
- Click √ (check mark) to save your changes
or X to discard the changes.
After you are finished, click Next to go to the Generated
UI tab, where the UI for the variables that you entered is generated
and displayed after a few seconds.
- Perform one or more actions on this tab, as explained
in Table 4.
- Click OK.
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; 15-character maximum. |
Description | Enter a description for the configuration template. |
Configuration 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 the sample configuration and detected template variables | The Templatize Config tab displays a sample Jinja configuration
template in an inline editor on the left and the corresponding template
variables in the Detected Template Variables pane on the right. |
Download a sample configuration | You can download a sample configuration by clicking the here link near the top of the tab. |
Add the device configuration | To 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 variables corresponding to the configuration
that you entered and displays them in the Detected Template Variables
pane. - Check that the template variables detected match the configuration
that you added to the template:
|
| If the template variables detected match the configuration
that you added to the template, click Next to continue. CSO validates the Jinja template and displays an error message
if there are any errors. |
Table 3: Customize
Variables Settings (Add Configuration Templates Page)
Setting | Guideline |
---|
Detected Variables | Displays the name of the detected variable. You cannot
edit the name. |
Data Type | Select the data type for the variable: Note:
You cannot specify a data type for a top-level variable
that has one or more leaf nodes under it. String (default)—If the variable is a
string of characters. Boolean—If the variable is a boolean
value (true or false). Number—If the variable is a number. Enumeration—If the variable is an enumerated
values with all strings or all numbers. In the Add enumeration for variable-name that appears, enter the list of enumerated values for the variable,
separating each one by entering a space or pressing Enter. Click OK to save the values that you entered and go back to the Customize
Variables tab. The values you entered are displayed in the Enumerated Values
field. IPv4—If the variable is an IPv4 address. IP Prefix—If the variable is an IPv4
prefix.
|
Key | Select this check box if the variable is to be used as
a key. Keys are unique identifiers used in defining list entries in
the Yang data hierarchy. They help distinguish one list entry from
another. Note:
For lists, you must define a key. |
Required | Select this check box if you want the parameter to be
mandatory. |
Default Value | Enter a default value for the variable. |
Pattern | For data types string or number, specify one of the following: If the data type of the variable is string, specify the
regular expression (regex pattern) ; for example, ^[a-z][A-Z]. If the data type is number, specify the range in the format Starting Number...Ending Number.
For example, 1...100.
|
Enumerated Values | If you selected entered enumerated values, the values
are displayed here. Click inside the field to edit the enumerated
values (in the Edit enumeration for variable-name page that appears). |
Scope | Note:
This field can be configured only for the root-level (top-level)
node. Select the scope of the parameter: Device, which means that the parameter is specific
to each device. This is the default. Global—The parameter is common across
devices.
|
Description | Enter a meaningful description for the variable; for
example, Gateway IP address. |
| After you finish customizing the parameters, click Next. |
Table 4: 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 variables appear in the UI. |
Modify the settings for a section | - Hover over a section and click the settings icon (gear).
The Section setting for section-name page
appears. - Modify the following fields, as needed; fields marked
with an asterisk (*) are mandatory.
- Click OK to save your changes.
You are returned to the Generated UI tab and the modifications
that you made are displayed on the UI.
|
Modify the settings for a field | - Hover over a field and click the settings (gear) icon
to modify the settings for a field.
The Input setting for field-name page appears. - Modify the following fields, as needed; fields marked
with an asterisk (*) are mandatory.
Label—Enter the label that you want displayed
in the UI. Input type—Select whether you want the
field to be a text box (Input text), list (input dropdown), or text area (input textarea). If you select input
dropdown, the Resources and Multiple Selection fields appear. Place holder—Enter the text, which provides
guidance to the user, that you want displayed (as ghost text) in the
field on the UI. Hidden—Click the toggle button to hide
the field in the UI; by default, a field is displayed. Resource—For a list (dropdown), if the
administrator created resources for the configuration template, then
you can select a resource or choose not to use resources (No
Resource, which is the default). If there are no resources for
the configuration template, then No Resource is displayed
and can’t be modified. Multiple Selection—For a list (dropdown),
click the toggle button to enable the selection of more than one items
or not (default). Event listener—If you want a field to
be conditionally displayed based on an event, select Data change; if not, select No listener (default). If you select Data change, the following fields appear: Event behavior—Displays the event behavior
(function) based on which the field is conditionally displayed. Change path—Click the Select path link to select the variable (that you want to conditionally display)
from the viewdef tree in the popup page, and click OK.
The selected path is displayed. Event function—Enter a JavaScript function
that will be used to determine if the variable selected in the Change path field is displayed in the UI or not.
- Click OK to save your changes.
You are returned to the Generated UI tab and the modifications
that you made are displayed on the UI.
|
Modify the settings for a grid | - Hover over the grid area and click the settings (gear)
icon to modify the settings for a field.
The Grid setting for Grid-name page appears. - Modify the following fields, as needed; fields marked
with an asterisk (*) are mandatory.
Title—Enter the title that you want displayed
in the UI. Height—Enter the height (in pixels) of
the grid or click the up or down arrows to specify a height. Columns—You can modify the following
for each field: Header—Click inside the cell, modify
as needed, and click √ (check mark) to save your
changes Values—Click inside the cell that you
want to modify. The Settings for column column-name page
appears. - Resource—For a list (dropdown), if resources
are present for the configuration template, then you can select a
resource or choose not to use resources (No Resource, which
is the default). If there are no resources for the configuration template,
then No Resource is displayed and can’t be modified.
- If you chose No Resource, enter one or more values (in
JavaScript Object Notation [JSON] format) in the Values field.
- Click OK.
You are returned to the Grid setting for Grid-name page - Click OK to save your changes.
You are returned to the Generated UI tab and the modifications
that you made are displayed on the UI.
- Click OK to save your changes.
You are returned to the Generated UI tab and 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 in the UI. |
Validate and render the configuration | Validating the template and rendering the configuration
enables you to check the configuration template that you added. To validate and render a configuration template: - Click Validation.
The Validate Template page appears. - Enter values for the different parameters in the configuration
template.
- Click Render.
The Rendered Config page appears, where CSO displays the configuration
that was rendered based on the values that you entered. - Check if the configuration was rendered correctly. If
the configuration was not rendered correctly, you can go back and
make modifications as needed.
- Click OK.
You are returned to the Validate Template page. - Click Cancel to exit the template validation
workflow.
You are returned to the Generated UI page.
|
| After you are finished checking the configuration, click Next to continue. |