A P P E N D I X  E

Scripting

This appendix provides a scripting example. The supported scripting currently only includes TCP connections and ASCII string based protocols like HTTP that run on top of TCP. There are four supported commands. In a script file, up to 5 connections can be established and closed. Also these connections can be intertwined. Lines beginning with # are treated as comments. The supported commands are as follows:

Where name is a unique name assigned to a given connection. name is used with the other commands to identify the connection. port is the TCP port on which the connection has to be made to the server. If port is zero, the load balancing service's TCP port is used.

Where name is the name of the connection to close, and is the name used when the connection was opened with the connect command.

Where name is the name of the connection opened with the connect command. data is the data to be transmitted to the server. It starts just after the name and has to be within double quotes. The data starts with a double quote and can span multiple lines until the corresponding end double quote is found. If a double quote is part of the data, it has to be escaped with a '" character. The '" character is an escape character, so to include this character in the data, it also has to be escaped with the following: '". '\n'. The following character rules also apply:

Where name is the name of the connection opened with the connect command. data is the data pattern for which to wait. The rules for data are the same as the send command except that it has one more restriction that it cannot exceed 79 characters in length.

The following codeboxes give examples of these commands:

#
# This example uses a http connection.
# It uses the port specified with the service VIP.
#
connect stream1 0
send stream1 "GET /index.html HTTP\n
\n
"
expect stream1 " 200 OK"
close stream1

 

#
# This example uses a 2 http connections in sequence.
# It uses the port specified with the service VIP.
#
connect stream1 0
send stream1 "GET /index.html HTTP\n
\n
"
expect stream1 " 200 OK"
close stream1
# Open a second stream
connect stream2 0
send stream2 "GET /images/image.gif HTTP\n
\n
"
expect stream2 " 200 OK"
close stream2

 

#
# This example uses a 2 http connections intertwined.
# It uses the port specified with the service VIP.
#
connect stream1 0
# Open the second connection
connect stream2 0
send stream1 "GET /index.html HTTP\n
\n
"
send stream2 "GET /images/image.gif HTTP\n
\n
"
expect stream1 " 200 OK"
expect stream2 " 200 OK"
close stream1
close stream2