This section explains specific description methods, including Template syntax and format.
The following procedure is required to create a service adaptor config using a Template.
Create Template
First, input a desired name and create a “Template.”
Create Template config
Specify a Module ID and create a “Template config.” You also can create a Template config for multiple Module IDs. Furthermore, the Template can be used only when the target module is in command line format.
Once created, enter the descriptions of the “Template Variables” and “Macro commands” (noted below), which serve as the source content for the config applied to the service adaptor.
Service adaptor mapping
Map the service adaptor to its assigned Template. Each service adaptor can be mapped to only a single Template.
Set Template Variables
Create the “Template Variables” that will be inserted when the Template is applied.
Template Variables can be set as either default values or specific variables for each service adaptor.
Reflect config
Run the “Reflect config” operation to apply the Template content to the service adaptor. If a service adaptor is mapped to a Template, the Template content is reflected. If no service adaptor has been mapped, then the content of the Working config for the individual service adaptor is reflected.
You can describe “Macro commands” within the Template config. The syntax for macro commands is as follows.
Allows you to change the output character string based on specific parameters.
#if (evaluation formula 1)
strings 1
#elseif (evaluation formula 2)
strings 2
#else
strings 3
#end
The evaluation formula compares template variable values. You can use “Match (==)” or “Nomatch (!=)” as the comparison condition. For example, to compare whether the value for template variable ${var_1} matches the character string value_1, the description is: “#if (${var_1} == “value_1”)”.
You can omit #elseif and #else. Also, you can describe multiple lines for #elseif.
Allows you to execute a loop process on all service adaptors mapped to the Template and extracts Template values in order.
#foreach(${<loop variable>} in ${<template name 1>})
strings 1 ${<loop variable>.<template variable name 1>}
strings 2 ${<loop variable>.<template variable name 2>}
strings 3 ${<loop variable>.<template variable name 3>}
#end
“Loop Variables” are the Variables that are referenced only within the relevant foreach line. The loop Variable name can be any Variable name you desire.
The Template name can be specified as the name of the current Template or the name of a different Template.
You can freely insert comments inside the Template config.
## this line is comment
Comments are not output during Reflect config. This function also allows you to temporarily disable a specific line in the config.
Comments also may be added to the end of a line.
this is config ## this is comment
You also may insert comments that span multiple lines.
#* this line is comment
and this line is comment too *#
“Template Variables” are the Variables that are referenced within the Template config text. Describing the Variable name in the text will result in the Variable being applied automatically during the Reflect config operation.
Template Variable descriptions are based on the following format.
${<template variable name>}
Template Variables includes “default values” and “specific values” for each service adaptor. If specific values exist for each service adaptor when the Template is applied, read priority is given to those values. If none exist, then the default values are read.
In addition to standard “Template Variables,” Templates also have predefined “system defined variables.” The types of system defined variables are as follows.
${loopCount}
Used only within the “foreach” macro command. Incremented for each macro process executed. The process starts from the default value of “0”.
${system.sa_code}
Outputs the “SA codes” for target service adaptors. Can be used as a unique identifier. Described as follows when using within the “foreach” macro command.
${<loop variable>.system.sa_code}
${sa_working_config_<module ID>}
Outputs the “Working config” set for the target service adaptor. Reads the “Working config” for the module with the ID specified in the ending “Module ID.” For example, describe as “${sa_working_config_0}” to read the Working config for the module with the Module ID 0. Compatible only with modules in command line format.
Begin a description with “\” when you need to output character strings that are identical to defined Template Variables or macro commands within the Template config.
this is config and parameter is \${var}
this is config and parameter is \#if
Among Template values, values for “Template Variables” and “Template Assigned SA” can be imported/exported using a CSV file. The exported CSV file can be edited using an application such as Excel or text editor. The values for “Template Variables” and “Template Assigned SA” are overwritten when you import the edited CSV file.
The CSV file format is as follows.
[name] ,variableA ,variableB ,variableC , ...
[default] ,defaultValue,defaultValue,defaultValue, ...
SA-code1 ,value ,value ,value , ...
SA-code2 ,value ,value ,value , ...
SA-code3 ,value ,value ,value , ...
:
:
The following is an example of a CSV file immediately after export. The following example explains the method for adding updates from this status.
[name],var_A,var_B,var_C
[default],default_A,,default_C
tssXXXXXXX1,A-1,B-1,C-1
tssXXXXXXX2,A-2,B-2,
tssXXXXXXX3,,B-3,
tssXXXXXXX4,,B-4,
tssXXXXXXX5,A-5,B-5,C-5
Updates are applied by overwriting the Variable values in the CSV file.
In the following example, Variable value A-1 is updated to A-1-modified.
[name],var_A,var_B,var_C
[default],default_A,,default_C
tssXXXXXXX1,A-1-modified,B-1,C-1
tssXXXXXXX2,A-2,B-2,
tssXXXXXXX3,,B-3,
tssXXXXXXX4,,B-4,
tssXXXXXXX5,A-5,B-5,C-5
We also newly set the specific value C-3 for the Template Variable var_C tssXXXXXXX3.
[name],var_A,var_B,var_C
[default],default_A,,default_C
tssXXXXXXX1,A-1-modified,B-1,C-1
tssXXXXXXX2,A-2,B-2,
tssXXXXXXX3,,B-3,C-3
tssXXXXXXX4,,B-4,
tssXXXXXXX5,A-5,B-5,C-5
You can add Variable definitions by adding Variable name strings to the [name] row. When you add or delete a string, you must make sure the number of elements is consistent in all rows.
In the following example, Variable var_D is newly added and both default and specific values are set.
[name],var_A,var_B,var_C,var_D
[default],default_A,,default_C,default_D
tssXXXXXXX1,A-1,B-1,C-1,D-1
tssXXXXXXX2,A-2,B-2,,D-2
tssXXXXXXX3,,B-3,,D-3
tssXXXXXXX4,,B-4,,
tssXXXXXXX5,A-5,B-5,C-5,
You can update the settings for an SA template assignment by adding or deleting an SA code row.
In the following example, the assignment tssXXXXXXX3 is deleted and the assignment tssXXXXXXX6 is newly added.
[name],var_A,var_B,var_C
[default],default_A,,default_C
tssXXXXXXX1,A-1,B-1,C-1
tssXXXXXXX2,A-2,B-2,
tssXXXXXXX4,,B-4,
tssXXXXXXX5,A-5,B-5,C-5
tssXXXXXXX6,A-6,B-6,C-6
The following is an example of settings applied when using a Template.
For this example, we create the Template “template_set_1”.
Here, we assume that the service adaptor config is performed for module 0 and module 1. The following type of Template config is created for each module.
Module 0
command_1 this is an example
#if (${param_pattern} == "name_only")
command_2 ${name}
#elseif (${param_pattern} == "name_and_address")
command_2 ${name} ${address}
#end
#foreach (${l} in ${template_set_1})
command_3 ${l.name}_${loopCount} ${l.address}
#end
Module 1
#if (${use_module_1} == "true")
<sample>
<param_1>value_1</param_1>
<param_2>value_2</param_2>
<param_3>value_3</param_3>
</sample>
#end
The following three service adaptors are assigned to template_set_1.
SA code |
Distribution ID |
---|---|
tssXXXXXXX1 |
0001-0000-0000-0000-0000-0000-0000-0001 |
tssXXXXXXX2 |
0001-0000-0000-0000-0000-0000-0000-0002 |
tssXXXXXXX3 |
0001-0000-0000-0000-0000-0000-0000-0003 |
The following Template Variables are created and both default and specific values are set.
- |
address |
name |
param_pattern |
use_module_1 |
---|---|---|---|---|
Default value |
name_only |
true |
||
tssXXXXXXX1 |
10.0.0.1 |
SA1 |
name_and_address |
|
tssXXXXXXX2 |
10.0.0.2 |
SA2 |
||
tssXXXXXXX3 |
10.0.0.3 |
SA3 |
false |
When Reflect config is run, the Template is applied and the following config is reflected in each service adaptor.
tssXXXXXXX1
Module 0
command_1 this is an example
command_2 SA1 10.0.0.1
command_3 SA1_0 10.0.0.1
command_3 SA2_1 10.0.0.2
command_3 SA3_2 10.0.0.3
Module 1
<sample>
<param_1>value_1</param_1>
<param_2>value_2</param_2>
<param_3>value_3</param_3>
</sample>
tssXXXXXXX2
Module 0
command_1 this is an example
command_2 SA2
command_3 SA1_0 10.0.0.1
command_3 SA2_1 10.0.0.2
command_3 SA3_2 10.0.0.3
Module 1
<sample>
<param_1>value_1</param_1>
<param_2>value_2</param_2>
<param_3>value_3</param_3>
</sample>
tssXXXXXXX3
Module 0
command_1 this is an example
command_2 SA3
command_3 SA1_0 10.0.0.1
command_3 SA2_1 10.0.0.2
command_3 SA3_2 10.0.0.3
Module 1
(N/A)
The explanations thus far note the basic operational flow for using a Template. After this process is complete, a config reflecting the edited content is output automatically when the config is reflected after assigning service adaptors or updating template variable values.