Template Builder allows you to parse command responses in your workflows using pre-built or custom templates. The application takes text input in the Console area and parses it in real-time against a template in the Template area. Template Builder returns the parsed results in the Output response area as a data table. By parsing complex data that is normally verified by manual interaction, you have real-time information to make better decisions about your system. Template Builder has over 200 ready-to-use templates based on the most common device commands.
Note: Itential Automation Platform (IAP) is compatible with several third-party software products for network operating environments. Beginning with the system requirements for 2019.1.2, all third-party software version compatibility is documented in Release Notes. To get the most up-to-date requirements for any third-party software, including open source, first identify which IAP release you are using and then refer to the respective release note.
Create New Template
To build (create) a new template:
From the IAP home page, go to Automation Studio.
Click the plus (+) icon in the top toolbar menu. The Create dialog opens.
Figure 1: Create Icon
Select Template from the dropdown. The dialog will automatically display additional input fields and menu options.
Figure 2: Create Dialog
Enter your template details. A description of each numbered element is provided in the reference table that follows.
Figure 3: Enter Template Details
Label UI Element Function 1 Create Verify Template is selected from the dropdown. 2 Name Enter a template name. System templates use a combination of the template group and the command field for their name. 3 Group Enter a group name. This field is used to group your templates into collections. This allows you to easily find the most relevant templates you may later need. 4 Type Allows you to select the parsing type: TextFSM or Jinja2. 5 Description Enter a brief description for the named template.
After all template details have been set, click Create. The newly created template is added to the Templates collection in the left navbar.
Template Builder UI
This section provides a brief walk-through of the Template Builder interface. The Data Console and Template areas are parsed in real-time against your templates to give instant feedback about what is working and what is not.
A description of each numbered element is provided in the reference table that follows.
Figure 4: Template Builder UI
|1||Toolbar||Icons for completing quick actions from anywhere within Automation Studio. These icons (from left to right) are: Create, Dashboard, Search, Import, and View Documentation.|
|2||Data||The Data area serves as a way to test your template against a typical text response you would expect. This text will be parsed by your template and the output will be displayed in the Response area below. Any text can be parsed by TextFSM. If Jinja2 is selected, then JSON is required. The most common use case is to parse CLI response text since it usually does not provide a system level response that can be parsed.|
|3||Template||The Template area contains the TextFSM (or Jinja2) template that will parse your console text. Use the prebuilt templates to modify the TextFSM template; you can also use it as a guide to write your own custom template. As you make modifications to the template, the Response area will update with the data object from TextFSM (or Jinja2).|
|4||Save & More Options||Click the first icon to Save. Click the stacked dots button (second icon) to display additional menu options to view metadata and clone, delete, or export the template.|
|5||Templates Collection||Click the arrow to expand and view all available templates. Each template is divided into a custom group, usually based on the device type. You can click on any template to view it in the main canvas (right of left side navbar). Users can search for template items within a collection.|
|6||Output Response||Output from TextFSM or Jinja2 parsing is displayed in the Output area in the form of a data table. This response can be used in workflows in the form of an object.|
TextFSM can be difficult to understand at first but if you use existing templates as your guide, you can become more familiar with how they work. With the real-time TextFSM engine, you can see how your response is updated when the Template or Console text is modified. You can copy/paste example templates into Template Builder and modify the value/state definitions to create a custom file.
Note: For more information on TextFSM, refer to following wiki on GitHub: Google TextFSM Wiki.
Jinja2 is a widely known templating engine for Python, and Template Builder is designed to render Jinja2 templates for parsing command outputs into JSON objects to be utilized in workflows. Of note, values passed to a Jinja2 template are within the data object. Moreover, there is a workflow task to render Jinja2 templates from within workflows.
renderJinjaTemplate task generates output from a template file in the templates folder of
Note: For more information on Jinja2, refer to the following links:
Referenced below are two simple examples of Jinja2 templates. The first example template uses variables, and the second one uses an iteration.
Figure 5: Jinja2 Variables Template
Figure 6: Jinja2 Iteration Template