Use this module to set up Telnet connections, send commands, and
perform string matching on the result. For information about how to use
Default values defined in
Connection timeout (time to wait for connection) = 10 seconds
Command timeout (time to wait for a command to return) = 10 seconds
Max number of reconnection attempts = 3
Reconnection interval (time to wait in between reconnection attempts) = 5 seconds
Keep alive (sends NOP to the server every 8 sec if
connection is idle) =
Polling limit (max number of times to poll to get a remaining string terminated) = 0
Polling interval (sleep time between polls) = 1 second
These parameters can be modified by the user with the following configuration term:
{telnet_settings, [{connect_timeout,Millisec}, {command_timeout,Millisec}, {reconnection_attempts,N}, {reconnection_interval,Millisec}, {keep_alive,Bool}, {poll_limit,N}, {poll_interval,Millisec}]}.
Enter the
The default logging behavior of
suite() -> [{ct_hooks, [{cth_conn_log, [{conn_mod(),hook_options()}]}]}].
The
By default, data for all Telnet connections is logged in one common
file (named
Hook option
All
Example:
{ct_conn_log, [{ct_telnet,[{log_type,raw}, {hosts,[key_or_name()]}]}]}
Hook options specified in a configuration file overwrite any hard-coded hook options in the test suite.
Logging Example:
The following
suite() -> [{ct_hooks, [{cth_conn_log, [{ct_telnet,[{hosts,[server1,server2]}]}]}]}].
As previously explained, this specification can also be provided by an entry like the following in a configuration file:
{ct_conn_log, [{ct_telnet,[{hosts,[server1,server2]}]}]}.
In this case the
suite() -> [{ct_hooks, [{cth_conn_log, []}]}].
For
Handle for a specific Telnet connection, see module
Regular expression matching all possible prompts for a specific
target type.
Closes the Telnet connection and stops the process managing it.
A connection can be associated with a target name and/or a handle.
If
Equivalent to
Sends a command through Telnet and waits for prompt.
By default, this function adds a new line to the end of the
specified command. If this is not desired, use option
Option
Equivalent to
Sends a Telnet command and waits for prompt (uses a format string and a list of arguments to build the command).
For details, see
Equivalent to
Gets data from Telnet and waits for the expected pattern.
If a
Options:
Indicates that the function must return if the Telnet
client is idle (that is, if no data is received) for more than
Sets a time limit for the complete
>The function returns when a prompt is received, even if
no pattern has yet been matched, and
Forces
The pattern(s) must be matched multiple times. If
All patterns must be matched in a sequence. A match is not
concluded until all patterns are matched. This option can be
interrupted by one or more
Example 1:
expect(Connection,[{abc,"ABC"},{xyz,"XYZ"}],[sequence,{halt,[{nnn,"NNN"}]}])
First this tries to match
Example 2:
expect(Connection,[{abc,"ABC"},{xyz,"XYZ"}],[{repeat,2},{halt,[{nnn,"NNN"}]}])
This tries to match
Options
Gets all data received by the Telnet client since the last command was sent. Only newline-terminated strings are returned. If the last received string has not yet been terminated, the connection can be polled automatically until the string is complete.
The polling feature is controlled by the configuration values
Equivalent to
Opens a Telnet connection to the specified target host.
Equivalent to
Opens a Telnet connection to the specified target host.
The target data must exist in a configuration file. The connection
can be associated with
A
A
If you want the connection to be associated with
For
See also
Equivalent to
Sends a Telnet command and returns immediately.
By default, this function adds a newline to the end of the
specified command. If this is not desired, option
The resulting output from the command can be read with
Equivalent to
Sends a Telnet command and returns immediately (uses a format string and a list of arguments to build the command).