Configure and Apply Custom Templates
Custom templates overview
Custom Templates are user-defined templates that
-
allow for the customization and automation of network services not supported by the function pack
define specific configurations and settings that can be applied to network devices and services, and
make deploying and managing network resources more efficient and consistent.
To use custom templates in Crosswork Network Controller, you must pre-configure them in Cisco Network Services Orchestration (NSO). Once configured in NSO, the Crosswork Network Controller will display your custom template for selection when you provision a device or a service. NSO uses XML-based configuration (config) templates, which you can invoke from provisioning code or link directly to devices or services. XML templates are snippets of configuration, similar to the CDB init files, but more powerful.
Create and load custom templates
To illustrate the capabilities of custom templates, we have provided an example that uses variable substitution to create an XML template. We then walk you through importing the template in NSO and referencing it in the L2VPN service in the Crosswork Network Controller.
To create and load custom templates:
Step 1 | Create a sample instance with the desired device configuration on the router. Example:
|
Step 2 | Log in to NSO CLI and sync from that device. Example:
|
Step 3 | In NSO CLI, get the running config for the policy map. Display the configuration in an XML format. Example:
|
Step 4 | Copy the file output to a text or code editor. Specify the variables that can be substituted or parameterized according to your needs using curly braces and a dollar sign, {$VARIABLE}. You can keep the variable name uppercased to make it stand out from the other XML elements in the file. Here, we created two variables, $POLICY_VAR and $RATE_MBS, for our template. Example:
|
Step 5 | Create a skeleton template package in NSO. This will help you generate the XML structure with the correct headers. Copy the <devices> code in the below example to your skeleton template. The custom-templates name must start with either ct- or CT-. Example:
|
Step 6 | Copy the policy-map <config> code you created in step 4 from your text editor. Example:
|
Step 7 | Paste it in your skeleton template. Example:
|
Step 8 | Save and import your new XML template into NSO using NSO web UI or CLI. This step allows you to load merge the custom templates to NSO before applying them. |
Step 9 | Validate the new template in NSO. Example:
|
Step 10 | Add this template to the L2VPN service in the Crosswork Network Controller.
|
Step 11 | Repeat the process for adding the policy to the interfaces. Ensure to add the policy at the device level, as the interface numbers may be different on each side of the L2VPN. Example:
For more examples of configuring custom templates, refer to Using Custom-Templates – CFP Services in the Cisco NSO Transport SDN Function Pack Bundle 7.1 User Guide. |