Quick reference : Template formatting


Templates are added to the ‘Template-‘ tabs within the spreadsheet. The first row in each Template sheet must be used as a heading row (i.e. template name) for a column.


T:<TemplateName>

Or

Template:<TemplateName>        


Any text placed under the template heading will be considered as to be part of the template.

Using Variables

Standard Variables

Data variables are added to the templates in the format


<VariableDelimiter><VariableName><VariableDelimiter>, e.g. <<IPAddress>>


All <<VariableName>>’s should match a single ‘DD:VariableName’ column on a Data sheet.

The variables can be included anywhere within a template. Multiple variables and/or text may be added to a single cell.

The data variable name is prefixed and suffixed by predefined characters (defaults ‘<<‘ and ‘>>‘) defined in the spreadsheet specific settings file.

<Characters> are 2 characters which are not typically used within the user required configuration. E.g. <<, >>.

ID Specific Variables

This allows a variable used within a template to contain different values depending on the device ID for which the template is used. The variable may be defined as:


DD:<Variable> e.g. ‘DD:Hostname’

DD:<Variable>:<DeviceID> e.g. ‘DD:Hostname:1’


Within templates, the variable may be referenced as:


<<Variable>>

<<Variable:<DeviceID>>>

Predefined Variables

Date and time variables may be added to the template. The values added are the date/time when Gen.IT generates the output. The format is:


Year – <Left Variable>R:YYYY<Right Variable> = 2012, e.g. <<R:YYYY>>

Month – <Left Variable>R:MM<Right Variable> = 01, e.g. <<R:MM>>

Month – <Left Variable>R:MMMM<Right Variable> = January, e.g. <<R:MMMM>>

Day – <Left Variable>R:DD<Right Variable> = 01, e.g. <<R:DD>>

Day – <Left Variable>R:DDDD<Right Variable> = Tuesday, e.g. <<R:DDDD>>

Hour – <Left Variable>R:HH<Right Variable> = 12, e.g. <<R:HH>>

Minute – <Left Variable>R:MI<Right Variable> = 30, e.g. <<R:MI>>

Seconds – <Left Variable>R:SS<Right Variable> = 45, e.g. <<R:SS>>

Other – <Left Variable>R:TT<Right Variable> = AM or PM, e.g. <<R:TT>>


The data variable name is prefixed and suffixed by predefined characters (defaults ‘<<‘ and ‘>>‘) specified in the spreadsheet settings file.        

IP Variables

IPv4 addresses may be incremented dynamically within Gen.IT. CIDR addresses (10.0.0.0/8) can be split and used to calculate IP addressing, subnet length, subnet mask or subnet inverse mask.

IP variables can be entered into templates in the formats:


<$<<IPv4CIDR Variable>>,<<IncrementVal>>$> - Add to or subtract from to the IPv4 in the variable

<$<<IPv6CIDR Variable>>,<<IncrementVal>>$> - Add to the IPv6 in the variable


<$<<IPVariable>>,3$> - Adds 3 to the IP in the variable

<$<<IPVariable>>,<<IncrementVal>>$> - Adds value from <<IncrementVal>> to the IP in the variable


<$192.168.1.1,1$> - Adds 1 to the IP Address

<$2402:9400::0000:0000:0001/48,1$> - Adds 1 to the IPv6 Address


<$<<CIDR Variable>>,LEN$> - Extracts the CIDR length value

<$<<CIDR Variable>>,MASK$> - Extracts the CIDR length value and converts to a mask

<$<<CIDR Variable>>,IMASK$> - Extracts the CIDR length value and converts to a inverse mask


This features allows a single variable to be defined (e.g. site subnet), and the specific required ip addresses (VRRP/Standby/Point to Point links) are calculated dynamically as specified within the template.

Note: IPv6 is supported as a beta feature.


Although not an IP function, integers may be incremented in the same way as IP addressing:


<$<<IntegerVariable>>,3$> - Adds 3 to the value in the variable

<$<<IntegerVariable>>,<<IncrementVal>>$> - Adds value from <<IncrementVal>> to the value in the variable


Include Statements

Gen IT supports the use of ‘Include Statements’. Include Statements allow for the inclusion of a single line, multiple lines, or a separate template within another template. The decision on whether to include the Include Statements is based on a variable lookup at run-time.


The Include Statements must be an exclusive entry within a template cell. The format of the compound template statement is as below:


<%T:Template_Name%>

<%T:Template_Name,<<VariabletoCheck>>%>

<%T:Template_Name,DN<>”Text”%>

<%T:Template_Name,<<VariableToCheck>>==”Text”%>

<%T:Template_Name,<<VariableToCheck>>!=”Text”%>

<%T:Template_Name,<<VariableToCheck>>~=”Text”%>

<%T:Template_Name,<<VariableToCheck>>=~”Text”%>

<%”Text to include….<<Variable>>”,<<VariabletoCheck>>%>

<%”Text to include….<<Variable>>”,DN~=”Text”%>

<%”Text to include….<<Variable>>”,<<VariableToCheck>>==”Text”%>

<%”Text to include….<<Variable>>”,<<VariableToCheck>>!=”Text”%>

<%”Text to include….<<Variable>>”,<<VariableToCheck>>~=”Text”%>

<%”Text to include….<<Variable>>”,<<VariableToCheck>>=~”Text”%>

<%IncludeLines:X,<<VariableToCheck>>!=”Text”%>

<%IncludeLines:X,<<VariableToCheck>>!=”Text”%> / <%IncludeLines:END%>

<%IncludeLines:X:A,<<VariableToCheck>>!=”Text”%> / <%IncludeLines:END:A%>


T:TemplateName or Text – The name of the template to be included, formatted as ‘T:<Template_name>‘, or the text to be included, formatted as ‘“Text to Include”‘

IncludeLines:X – Include X many lines following the include statement depending on the variable check. If a cell containing <%IncludeLines:END%> is found before the specified line count is reached, then IncludeLines processing is ended.

IncludeLines:X:A – Include X many lines following the include statement depending on the variable check. If a cell containing <%IncludeLines:END:A%> is found before the specified line count is reached, then IncludeLines processing is ended.

IncludeVariable – The variable used to determine the include status, formatted as a variable <<Variable>>. A variable look-up is done to determine this value, options are:


Note: the number of lines included by 'IncludeLines ' statements is limited to the maximum line count set in the project settings.


<<Variable>> where any number 0+ will include, blank will exclude.

DN<=>”Text” where Text matches all or part of the selected Device Name. This allows for text to be included based on the device name.

<<VariableToCheck>>==”Text” where variable matching text will include.

<<VariableToCheck>>!=”Text” where variable not matching text will include.

<<VariableToCheck>>~=”Text” where variable contains "Text".

<<VariableToCheck>>=~”Text” where "Text" contains the variable value.

<<VariableToCheck>>>>”Integer” where "Integer" is greater than the variable value.

<<VariableToCheck>><<”Integer” where "Integer" is less then the variable value.


The processing order and depth of Include/Compound Templates can be customized on a per spreadsheet basis.


Please see the user manual on the web site for further details and examples. http://gen-it.net/user-guide/include_statements/

Compound Templates

Gen IT supports the use of Compound Templates. Compound Templates allows a template to be recursively included within another template. The compound template definition includes details regarding repeat count, and the incrementing variables within the compound template.


The Compound Template must be an exclusive entry within a template cell. Compound Templates are added to the templates in the format as show below:


<%T:<Template>,<RepeatCountVariable>,<NumberOfVariables>,(Variables)%>


Variable are formatted as ‘VVV,WWW,XXX,YYY,ZZZ’

Variable as Integer

VVV – The name of the variable within the compound template to be replaced by a value, formatted as a standard variable including left and right delimiters

WWW – The starting value to be used during variable replacement, formatted as an integer. If WWW is defined as a data variable, a variable look-up is done to determine this value.

XXX – The value by which WWW is incremented on each iteration, formatted as an integer.

YYY – This value indicates how often to increment value WWW, formatted as an integer.

ZZZ – The maximum value WWW may reach before being reset back to its starting value, formatted as an integer.

Variable as IP Address

VVV – The name of the variable within the compound template to be replaced by a value, formatted as a standard variable including left and right delimiters

WWW – The starting value to be used during variable replacement, formatted as an IP Address or IP Address variable. If WWW is defined as a data variable, a variable look-up is done to determine this value.

XXX – The value by which WWW is incremented on each iteration, formatted as an integer.

YYY – This value indicates how often to increment value WWW, formatted as a integer.

ZZZ – This value defines an offset, formatted as an integer. The value of ZZZ will be added to the IP address value of WWW before doing the variable replacement.


The processing order and depth of Include/Compound Templates can be customized on a per spreadsheet basis. Up to 5 levels of processing is supported.

Please see the user manual on the web site for further details and examples. http://gen-it.net/user-guide/compound_templates/

Text Formatting

Individual template lines can be formatted with a color, bold or italic.

Predefined characters placed at the start or end of a template cell indicate to Gen IT how to treat the line. These characters are defined in the Excel spreadsheet specific settings file.

In addition, up to 10 styles can be can be defined which will mark a line according to the defined values as above. These styles are defined in the Excel file settings (Settings Menu -> Edit XLS File Settings)


<!B!> – Bold

<!I!> – Italic

<!color!> – A system color

<!00 to 15!> – Predefined Bold, Italic, Color set.        

Other

Template lines starting with the ';' ignore character are not loading by Gen.IT. This character is configurable in the preject settings.