4. Template Editor

The Template Editor is a workspace inside the Developer Console for low-level template design and modification.

Modular design practices are encouraged in this space to create a great application experience for operators. Recommended practices include the following key considerations.

  1. Single Purpose Templates - There is no limit to the number of templates that can be created. As such, it is recommended to use each template for one configuration task only. This will give power to the operator in choosing which configuration snippets they would like to combine. If a template performs multiple tasks, then it will be harder for an operator to utilize subsections of the template.
  2. Appropriate use of Conditional Logic - Developers can utilize Business Rules throughout their template design to create a modular environment. The use of conditional logic allows similar configuration tasks to be clustered into a single template and avoid duplication. With that said, however, developers should avoid using conditional logic in a way that violates the Single Purpose Template recommendation. For example, it would make sense for iBGP and eBGP configuration tasks to share the same template but an OSPF configuration task should be created in a separate template.
  3. Readable Variable Names - When creating an input variable, it is highly recommended to use a readable variable ID which clearly expresses the referenced field. The variable ID is displayed in the template markup so readable names will make for much greater legibility.

With these key recommendations in mind, let us now take a look at how we can create a template.

4.1 Launching the TE

The Template Editor is launched via the Developer Console. Simply click on the Create Template button or view/edit an existing template via the action menu.

4.2 Template Info

The top area of the Template Editor contains the Template Info block. Each field inside this block is described below.

  1. Display Name - Sets a display name for the template.
  2. Description - Sets a description for the template. This field will be visible in the Generator Console when hovering the mouse over the information icon of a template.
  3. Business Rule - Sets a business rule for the template. The configuration snippet for this template will only be generated if the business rule is true. A blank entry for a business rule will implicitly evaluate to true. For more information, refer to 4.6 Business Rules
  4. ID - A unique identifier for the template. This field is auto-generated.
  5. Newest Version - The production template version. This field is auto-generated.
  6. Loaded Version - This field provides a drop-down list of all historical template versions. Users can roll back to any prior version by modifying the value selected for this field.
  7. Date Created - The date the template was first created. This field is auto-generated.
  8. Date Modified - The date the template was last updated. This field is auto-generated.
  9. Updated By - The user who last updated the template. This field is auto-generated.

4.3 Input Table

The second block inside the Template Editor is the Input Table, which lists all input variables created by the template. An input variable is a data field presented to the user as a form entry inside the Generator Console. Once an input variable has been created, it may be utilized inside template markup and referenced inside business rules.

There are two types of input variables.

  1. Text Input - A text input is a free-text field, which allows operators to provide any value they like for the variable.
  2. Select Input - A select input is a drop-down field, which allows operators to choose a variable value from a predefined list of options.

Take a look at the screenshot below for an example of an Input Table.

4.4 Creating an Input

To create an input variable, simply click on the Create New Input button. The user will then be presented with a form to define the details of the new variable.

Let us now take a look at the meaning of these fields.

  1. Variable Name - Sets a display name for the input variable.
  2. Variable ID - An identifier for the input variable. The Variable ID is the value that will be used to reference the input in template markup and business rules.
  3. Description - Sets a description for the input variable. This field will be visible in the Generator Console when hovering the mouse over the information icon of the variable.
  4. Input Type - Sets the input variable type as either a free text field or a drop-down select field.
  5. Input Options - Defines the list of selectable values. Each option is separated by a new line. This field is only applicable for drop-down inputs. Each input option can have a business rule defined. If a business rule is defined, the corresponding option will only be selectable if the expression evaluates to true. For more information, refer to 4.6 Business Rules
  6. Default Value - Sets a default value for the input variable. When a template is activated in the Generator Console, the default value will be initialized.
  7. Priority - The priority value determines the display order of input fields as presented in the Generator Console. To modify this value, click on the Edit Input Priority button inside the Input Table; the display order of input fields can then be adjusted through a drag-and-drop interface.
  8. Read Only - Sets the read-only attribute as true or false. The value of a read-only input will always equal the default value.
  9. Global Variable - Sets the scope of the input variable. If the value is set to true, then the variable will be accessible when referenced from any active template. Otherwise, the variable will only be accessible from within the template which defined it. To keep templates modular, it is recommended to avoid using global variables wherever possible.
  10. Business Rule - Sets a business rule for the input variable. The input field will only be visible if the business rule evaluates to true. A blank business rule will always evaluate to true. For more information, refer to 4.6 Business Rules

The screenshots below illustrate these attributes in practice.

4.5 Template Markup

The Template Markup block is where the actual configuration is represented. The block is made up of two code editors.

  1. Config Editor - The editor on the left side is the Config Editor. It is here that the configuration snippet is written in a markup form. To do so, begin by pasting in a real piece of network configuration. Next, replace fields with variables as necessary using the IDs of relevant input variables. To add a variable to the markup, wrap the IDs in curly braces to indicate a reference to a variable.
  2. Control Editor - The editor on the right side is the Control Editor. Each line inside the Control Editor can contain a business rule. Each business rule corresponds to the same line number inside the Config Editor. The corresponding configuration line will only be generated if the business rule evaluates to true. If a business rule is not included for a line, then the corresponding line of configuration will always be generated.

4.6 Business Rules

Throughout the documentation, many references to business rules occur. Business rules are at the core of conditional logic within the application. By utilizing the power of conditional logic, users can enforce all kinds of policies to show and hide form fields, configuration snippets, and input options.

A business rule will always evaluate to either true or false based on the current state within the Generator Console. Business rules use a simple syntax, which makes the rules very readable. Let's take a look at the syntax requirements.

  1. Variables - Variables are written using the Variable ID wrapped in curly braces.
  2. Constants - Strings, numbers, and other constants are wrapped in single quotation marks.
  3. Relational Operators - Two different relational operators exist. The first uses the keyword "is" and will return true if the objects under comparison are equal. The second uses the keyword "not" and will return true if the objects under comparison are not equal.
  4. Boolean Operators - Two different boolean operators exist. The first uses the keyword "and". This operator will accept two boolean inputs and only return true if both inputs are true. The second operator uses the keyword "or". This operator will accept two boolean inputs and return true if one or more inputs are true.
  5. Expression Nesting - Expressions can be nested within each other through the use of parenthesis.

With the syntax rules out of the way, let's now take a look at some examples.

Example 1

{WAN_TYPE} is 'VDSL'

In this example, the expression will only evaluate to true if the WAN_TYPE variable is equal to VDSL.

Example 2

{WAN_TYPE} not 'VDSL'

In this example, the expression will only evaluate to true if the WAN_TYPE variable is not equal to VDSL.

Example 3

{LICENSE} is 'Advanced' and {ENABLE_SHAPING} is 'Yes'

In this example, the expression will only evaluate to true if both the LICENSE variable is set to Advanced and the ENABLE_SHAPING variable is set to Yes.

Example 4

{LICENSE} is 'Advanced' or {ENABLE_SHAPING} is 'Yes'

In this example, the expression will only evaluate to true if either the LICENSE variable is set to Advanced or the ENABLE_SHAPING variable is set to Yes.


Example 5

({LICENSE} is 'Advanced' or {ENABLE_SHAPING} is 'Yes') and ({WAN_TYPE} is 'VDSL')

In this example, the expression will only evaluate to true if both the conditions in Example 1 and Example 4 are true. This example illustrates the use of parenthesis to nest expressions.


These examples conclude the documentation for the template editor. Armed with this information, you may now proceed to design and develop templates. If at any time you would like any advice or have any other questions, please lodge an enquiry with our support team.

Proceed to Next Page