It seems like your browser didn't download the required fonts. Please revise your security settings and try again.
Barracuda CloudGen Firewall

Configuration Templates - Parameters, Variables, Operators, and Functions

  • Last updated on

A Configuration Template consists of a choice of Configuration Units. Each Configuration Unit has a number of input parameters that have to be filled with values or references.

The types of these input parameters are defined in the Configuration Unit specification available in Campus XXX Link XXX and Swagger XXX Link REST XXX.

The Configuration Template defines how the inputs of the Configuration Units are filled. The following options are available:

  • Static values are defined in the Configuration Template. A static value of a certain input parameter type can be defined and is used for every instance based on the Configuration Template.
  • XXX Configuration Templates parameter references:
  • Configuration Template variable references: Variables can be defined in every Configuration Template. The idea of variables is to allow the user to define expressions (formulas) that derive values from the Configuration Template parameters.
Configuration Templates Variables

There are several operators and functions available to form variable expressions.

Binary Operators
OperatorMeaning
+Arithmetic plus
-Arithmetic minus
*Arithmetic multiplication
/Arithmetic division
%Arithmetic modulo
|Arithmetic OR
&Bitwise AND
||Logical OR
&&Logical AND
>Larger
<Smaller
>=Larger or equal
<=Smaller or equal
==Equal
!=Not equal
++Increment by one
--Decrement by one
[ ]Dereference
!Logical not
~Bitwise inverse

 

String Operators
Operator ExampleDescription
string + string'Adding' strings is done by concatenating multiple strings to a single one.

 

Functions
Function CallDescription
int atoi(string val)Convert a string to an integer.
string itoa(int i)Convert an integer to a string.
int strcmp(string s1, string s2)Compare two strings.
int strncmp( string s1, string s2, int length)Compare two strings over a given length.
string ipadd(string ipString1, string ipString2)"Adds" the "partial" values of two IPv4 addresses.
Example:
ipadd("10.0.4.0", "0.0.0.3")
returns
"10.0.4.3"
string ipor(string ipString1, string ipString2)Applies the OR operator to two IPv4 addresses.
Example:
ipor("10.0.4.0", "0.0.0.3")
returns
"10.0.4.3"
string ipmask(string ipString, string maskString)Applies the digital, bitwise AND operator to the partials of an IPv4 address.
Example:
ipmask("10.0.4.7", "255.255.255.0")
returns
"10.0.4.0"
string ipmask6(string ipString, string ipMaskString)

Applies the digital, bitwise AND operator to the partials of an IPv6 address.
Example:
ipmask6("2000:2000:4400:3::5", "ffff:ffff:ffff:ffff")
returns
"2000:2000:4400:3::"

string ipand(string ipString1, string ipString2)Applies the digital, bitwise AND operator to the partials of an IPv4 address.
Example:
ipand("10.0.4.7", "255.255.255.0")
returns
"10.0.4.0"
string ipgetaddr(string ipmaskString)Calculates the IP address from a given CIDR network address.
Example:
ipgetaddr("10.0.4.7/8")
returns
"10.0.4.7"
string ipgetmask(string ipmaskString)Calculates the size of a network from a given CIDR network address.
Example:
ipgetaddr("10.0.4.7/8")
returns
"8"
string ipgetmaskaddr(string ipmaskString)Calculates the mask from a given IPv4 network address.
Example:
ipgetaddr("10.0.4.7/8")
returns
"255.255.255.0"
string ipgetmaskaddr6(string ipmaskString)

Calculates the mask from a given IPv6 network address.
Example:
"2000:2000:4400:3::5"
returns
"ffff:ffff:ffff:ffff::"

int ipmatchnet(string addr, string network)Calculates whether an IPv4 address matches a certain IPv4 network address.
Example:
ipmatchnet("10.0.66.2", "10.0.4.0/8")
returns
0
int ipmatchnet6(string addr, string network)Calculates whether an IPv6 address matches a certain IPv6 network address.
Example:
ipmatchnet("2000:2000:4400:3::5", "2000:2000:4400:4::/64")
returns
0
int ipcmp(string ipString1, string ipString2)

Compares two given IPv4 addresses. If the addresses are equal, the function returns 0. Otherwise the function returns a value <> 0.
Example:
ipcmp("192.168.1.1", "192.168.1.1")
returns
0

int ipcmp6(string ipString1, string ipString2)Compares two given IPv6 addresses. If the addresses are equal, the function returns 0. Otherwise the function returns a value <> 0.
Example:
ipcmp("2000:2000:4400:3::5", "2000:2000:4400:3::5")
returns
0
string date()Get the current date from the system using the format "dd mm yyyy".
string time()Get the current time from the system using the format "hh mm ss".
int unixsec()Returns the time in Unix seconds.
string generaterandomstring(int size)Returns a randomly generated string with the length of <size>.
The maximum length of the string must not exceed 128 characters.
Note: This function was introduced with firmware 7.2. If you are not sure whether this function is available, check using the function funcexist("generaterandomstring").
string dateinternational()Returns the current date using the format "yyyy-mm-dd".
Note: This function was introduced with firmware 7.2. If you are not sure whether this function is available, check using the function funcexist("dateinternational").

 

Examples in TDL
TDL Script ContentExplanation

[parameters]
name type=string

[variables]
Boxname type=string expression='"The boxname is " + name'

Concatenates a static and a dynamic string set in a parameter.
[parameters]
id type=int
[variables]
mip type=ip expression='ipadd("10.0.10.0",itoa(id))'
Calculates an IP address based on an integer parameter and a static base-IP.
E.g., id=1 would result in mip=10.0.10.1