Designing Templates with a Configuration
You can design a configuration template either by using your own data model or by using the data model generated by the Configuration Designer. The Configuration Designer provides a configuration template wizard that takes you through a step-by-step procedure to create your configuration template. You can design multiple templates by creating requests and launching respective wizards from them.
To design a template using the data model generated by the Configuration Designer, you provide your Jinja configuration and the wizard automatically parses its parameters and generates the data model for your template. See http://jinja.pocoo.org/docs/2.10/templates/ for documenting the configuration templates of the jinja2 Python module.
Before you begin, create a configuration template request. See Creating Requests for Configuration Templates.
To design a template with your configuration:
- From the Configuration Template Request drop-down list,
select Begin with config.
The Templatize Config page appears.
- Enter or copy and paste your Jinja configuration in the
space provided for it.
The wizard parses the parameters in your configuration and generates a variables tree in the Detected Variables panel.
You can also download a sample template from this page.
When you paste the Jinja template, the Configuration Designer detects the keywords
diff_config, automatically. If the configuration template contains any one of these three keywords, the template will enable the Diff Config feature.
- Review your configuration and edit it as needed. The wizard
accordingly updates the variables in the Detected Variables panel.
The Customize Variables page appears.
- Select any variable to update. You can update different attributes of your template, such as the Yang and data types. You can also add default values and descriptions. See Table 1 for sample fields and their descriptions.
- After completing your configuration, click Next.
The Generate UI page appears and generates the data model according to your values and displays as read-only. You can drag and drop the field labels to reorder the UI.
If you edit an existing template and change its data model, then you can generate a new UI for it by clicking Re-generate ui. If you do not want a new UI, skip to the next step.
- Click Next.
The Validate Template page appears.
- Enter values that you want to validate, and ensure that the configuration template is displayed with the correct values.
- Click Validate.
The Rendered Config page appears and the configuration template is generated using the values that you entered.
- Make sure your data in the configuration template is complete and correct.
- Click Yes, it looks good to close the page. If any parameter value in the configuration template needs to be changed, click No, it needs change to return to the previous page.
- Click Next.
The Review Template page is displayed. It contains three tabs—Jinja Template, Data Model, and View Def. You can click through the tabs to view and update your Jinja template, data model, and the view definition.
- Click Done to save your configuration template.
The Designs page is updated with the new configuration template and its status shows as Validated. You can monitor and manage the new configuration template from the Configuration Design page.
You must publish the configuration template for it to be available for the Resource Designer to create virtualized network function (VNF) packages. See Publishing Configuration Templates.
Table 1: Sample Fields on the Customize Variables Page
Edit the variable name. A configuration template contains variables that get replaced with values when a template is rendered. The Configuration Designer automatically generates these variables from your Jinja configuration.
You can edit the variable name.
Select an appropriate Yang type from the drop-down list. A Yang module defines a data model through its data, and through the hierarchical organization and constraints on that data. It uses a hierarchical, tree-based structure with the following nodes:
Select an appropriate data type based on your variable. In Yang, each leaf and leaf-list node includes the type statement to identify the data type for valid data for that node. Yang defines a set of built-in types and also provides the typedef statement for defining a derived type from a base type, which can be either a built-in type or another derived type.
Specify the name of the variable as you want it to display.
Specify the key to be associated with the variable.
Keys are identifiers used in defining list entries in the Yang data hierarchy. They help distinguish one list entry from another.
Specify if the variable is mandatory.
Specify the default value for the variable.
Specify the regular expression (regex pattern) if the data type of the variable is string.
This field displays values only if the data type of the variable is enumeration. When you select the data type as enumeration, you need to specify the values for the enumeration list and these values are displayed in the Information column. You can also edit the enumeration list.
Enter a meaningful description for the variable.
Example: Firewall policy information
To create an actual configuration for a device, you must log in to Administration Portal or Customer Portal. You must enter the actual values for the configuration in the configuration template. The configuration template then renders the actual values. You can click on stage2 configuration to view the actual configuration.
To delete an actual configuration for a device, you must login to Administration Portal or Customer Portal and execute the delete command, remove command or an alternate command for the configuration. The command to delete a configuration depends on the existing configuration on the device.