A WAN Policy contains three sections: Declaration, Selector, and Provider. Contructions used within the Declarations section are not described here. The following statements and constructions can be used, except as noted, in the Selector and Provider sections.
Comments are not executed, but are used to document the policy.
Comments can be set off using /* at the beginning of the line and */ at the end. For example:
/* This is a comment. */
Comments can also be distinguished by // at the end of the line before a comment. For example:
IF L2 > L3 THEN //This is a comment.
IF-THEN statements are used to run a block of declarations conditionally.
Examples:
IF <boolean expression> THEN <declarations>
END
IF <boolean expression> THEN <declarations>
ELSE <declarations>
END
IF <boolean expression> THEN <declarations>
ELSIF <boolean expression> THEN <declarations>
END
This is the first clause in an IF-THEN statement. The boolean expression is evaluated for a TRUE or FALSE result. If TRUE, the declarations that immediately follow are run. If FALSE, execution jumps to the next corresponding ELSE, ELSIF, or END declaration.
This declaration marks the beginning of declarations that run if all corresponding preceeding IF-THEN and ELSIF statements results in FALSE. For example:
IF <boolean expression> THEN <statements>
ELSIF <boolean expression> THEN <statements>
ELSIF <boolean expression> THEN <statements>
ELSE <statements>
END
The boolean expression is evaluated if the preceding IF-THEN declaration returns a FALSE. The ELSIF declaration is evaluated for a TRUE or FALSE result. If TRUE, the declarations that follow are run. If FALSE, execution jumps to the next corresponding ELSE, ELSIF, or END declaration. For example:
IF <boolean expression> THEN <statements>
ELSIF <boolean expression> THEN <statements>
ELSIF <boolean expression> THEN <statements>
END
The END declaration terminates an IF-THEN construction.
The RETURN command gives the results of the Selector and Provider sections.
In a Selector section, the RETURN declaration provides the integer result used as a weight for the policy. RETURN assigns a policy weight between 0-100, where 0 means do not use this policy, 1-99 means use this policy if no other policy returns a higher value, and 100 means use this policy. If no RETURN declaration is made in a Selector section, a default value of 0 will be returned.
A semicolon is required to terminate the declaration. For example:
RETURN 49;
RETURN L2;
RETURN 39+7;
In a Provider section, the RETURN declaration provides the SEND or DONT_SEND result. If no RETURN declaration is made, a default value of SEND will be returned.
A semicolon is required to terminate the declaration. Examples:
RETURN SEND;
RETURN DONT_SEND;
RETURN L1;
The assignment declaration changes the value of a symbol using the := characters. The defined variable or system variable is stated first, then the := with a value, variable, or operation following. For example:
<variable>.<field>:=<expression>; <variable>:=<expression>;
t1 and t2 are of type TIME, i1 and i2 are type INTEGER, b1, b2 are BOOLEAN valid assignments:
t1 := t2;
b1 := t1 < t2;
i1 := t1.mday - 15;
b2 := t2.year < 2000
Invalid assignments:
b1 := 10 < i2 < 12;
(10 < i2) is boolean, and a BOOLEAN cannot be compared to an INTEGER.
You might use b1 := (10 < i2) AND (i2 < 12); instead:
b2 := i1;
b2 is BOOLEAN, and i1 is INTEGER, therefore, they are incompatible types.
You might use b2 := i1 > 0; instead.
The assignment declaration must be terminated with a semicolon.
Strict type checking is performed. You are not allowed to assign an INT to a TIME variable.
You can include arithmetic operators in assignment declarations, RETURN declarations, or IF constructions. The valid operators are:
Use only INT variable types with arithmetic operators. Do not use TIME, NETADDRESS, and BOOLEAN variable types in arithmetic expressions.
Avoid operations that result in values outside of the range -2147483648 to +2147483648 or division by zero.
You can use relational operators in IF constructions. The valid operators are:
You can use any relational operators with TIME and INT variable types. You can also use <> and = with NET ADDRESS and BOOLEAN variable types.
The valid operators are:
You can use bitwise operators on INT variable types to return an integer value. The valid operators are:
The following precedence rules are enforced when processing complex expressions. Operators with the same precedence order are processed left-to-right. The order is as follows:
If you are not certain of precedence, use parentheses. For example, if A, B, and C are integers or variables, A<B<C is not allowed. A<B would return a boolean value, not an integer value, which cannot be compared to an integer C. However, (A<B) AND (B<C) would be syntactically correct.
You can use PRINT declarations to send text and symbol values to the server's WAN Traffic Manager display screen and to the log file.
PRINT statements can have any number of arguments that may be literal strings, symbol names or members, integer values, or boolean values, separated by commas.
You must enclose literal strings in double quotes ('). PRINT declarations must end in a semicolon (;). For example:
PRINT 'INT=',10,'BOOL=',TRUE,'SYM=',R1;
TIME and NETADDRESS variables use formatted print declarations. TIME symbols are printed as follows:
m:d:y h:m
NETADDRESS variables are printed as follows:
Type
length
data
is either IP or IPX, length is the number of bytes, and data is the hexadecimal address string.