tty_test Utility

The tty_test utility contains a test server, a test client, and a small terminal application. The test client calls the test server. When the connection is established, the client starts to generate test frames and to transmit these frames to the test server. The test server loops the received data back to the transmitter (client). The test client verifies the received frames based on sequence number and check sum, and generates link statistics. The tty_test utility is located in the /usr/lib/eicon/divas directory.

tty_test in server mode

The test server can be started with the following commands:

Command

Description

tty_test <tty_nr> s <protocol> [- l<frame_length> -s<rate>]

This command starts a test server on your console. You can see the messages from the TTY interface and the link statistics generated by the receiving side.

tty_test <tty_nr> sv <protocol> [- l<frame_length> -s<rate>]&

This command starts a test server in the background. In this mode, the test server detaches from your console and does not display any output. To get information about the test server started in the background, use the ps x command. To safely stop the test server running in the background, use the HUP signal (kill -HUP process_number or killall -HUP tty_test).

 

The following table describes the parameters for the tty_test in server mode:

Parameter

Level

Description

tty_nr

Mandatory

Diva TTY number that should be used by this test server. It should range between 1 and N, where N is the sum of B-channels of the Diva Media Boards installed in the system

protocol

Mandatory

Value

Description

 

 

auto

Automatic detection of the B-channel protocol stack.

 

 

x75

HDLC/X.75/Transparent. This protocol stack provides reliable data transfer. V.42bis compression is detected automatically.

 

 

x75v42

HDLC/X.75 with V.42bis data compression/Transparent. This protocol is not used on the server side because x75 automatically detects X.75 with V.42bis.

 

 

v120

HDLC/V.120/Transparent V.120 with V.42bis is possible.

 

 

v110

V.110/Transparent/Transparent

 

 

mdm

Modem with full negotiation/V.42+V.42bis/Transparent.

-l<frame_length>

Optional

Length of the test frame. It is normally not used by the test server but it should be provided if the -s option follows

-s<rate>

Optional

Speed adaptation rate. This parameter should be indicated if the v110 B-channel protocol is used without auto detection. It should range between 2 and 9 (5-9600, 9-56000). If this option is selected, the "-l" option should also be used

 

tty_test in client mode

The test client can be started with the following commands:

Command

Description

tty_test <tty_nr> <CPN> <protocol> [-l<frame_length> -s<rate>] [- a<at_command>] [-y] [-m<packets>]

This command starts a test client on your console.

tty_test <tty_nr> <CPN> <protocol> [-l<frame_length> -s<rate>] [- a<at_command>] [-mpackets] -x&

This command starts a test client in the background. In this mode, the test client detaches from your console and does not display any output. It generates a file named log.<tty_nr> in its working directory. The test client reports its link statistics to this file. You can monitor the link statistics by the command strings log.* | more.

Note: The tty_test updates the log files after 64 KBytes of data have been transferred. Therefore, please be patient if you use, e.g., the V.110 protocol with 9600 bps.

To get information about the test client started in the background, type: ps ax | grep tty_test.

To safely stop the test client running in the background, use the "HUP" signal (kill -HUP process_number or killall -HUP tty_test). The tty_test utility understands the commands HUP, TERM, ABRT and INT. These commands terminate the tty_test utility.

The following table describes the parameters for the tty_test in client mode:

Parameter

Level

Description

tty_nr

Mandatory

Dialogic® Diva® TTY number that should be used by this test server. It should range between 1 and N, where N is the sum of B-channels of the Dialogic® Diva® Media Board installed in the system.

CPN

Mandatory

Called Party Number (any number can be used in back-to-back mode)

protocol

Mandatory

Value

Description

 

 

hdlc

HDLC/Transparent/Transparent. This protocol stack is widely used by RAS.

 

 

x75

HDLC/X.75/Transparent. This protocol stack provides reliable data transfer. V.42bis compression is detected automatically.

 

 

x75v42

HDLC/X.75 with V.42bis data compression/Transparent. This protocol is not used on the server side because x75 automatically detects X.75 with V.42bis.

 

 

v120

HDLC/V.120/Transparent V.120 with V.42bis is possible.

 

 

v110

V.110/Transparent/Transparent

 

 

mdm

Modem with full negotiation/V.42+V.42bis/Transparent.

-l<frame_length>

Optional

Length of the test frame. It is normally not used by the test server but it should be provided if the -s option follows.

-s<rate>

Optional

Speed adaptation rate. This parameter should be indicated if the v110 B-channel protocol is used without auto detection. It should range between 2 and 9 (5-9600, 9-56000). If this option is selected, the -l option should also be used.

-a<at_command>

Optional

Allows to provide additional AT-command strings used for client initialization.

-y

Optional

Does not display any messages except call progress and data transfer status.

-m<packets>

Optional

Exits after "packets" data packets were sent. Displays the transfer status on the screen (standard out) and prints it to the log.<tty_nr> file. Error messages generated at dial time are additionally written to syslog. If the data packets have been successfully transferred, exit status is 20. Any other exit status indicates an error. This option allows you to create scripts that provide tests for multiple calls with different protocols.

 

Example 1. Start tty_test server with protocol auto-detection

To start the test server at TTY number 10 and use protocol auto-detection, execute:

tty_test 10 s auto.

Example 2. Start the test server using the V.110 protocol

To start the test server at TTY number 21 using the V.110 protocol with 9600 bps in the background, execute:

tty_test 21 sv v110 -l2048 -s5&

Example 3. Start the test client using the X.75 protocol and specify the frame length

To start the test client at TTY 1 using the X.75 protocol, the called party number 800, and a test frame length of 514 bytes, execute:

tty_test 1 800 x75 -l514.

Example 4. Start the test client using the V.110 protocol

To start the test client at TTY 1 running in the background using the V.110 protocol, called party number 800, a test frame length of 128 bytes, a rate adaptation speed of 9600 bps, and rate adaptation indication in the bearer capabilities, execute:

 tty_test 1 800 v110 -l128 -s5 -a+iu="<8890214800bb>" -x&

Example 5. Start 30 test server and 30 test client sessions

Start 30 test server and 30 test client sessions using this sample shell script. It uses B-channel protocol auto detection on the server side and V.110 with 9600 bps on the client side.

 #! /bin/sh
 #This "n_cons" value will start 30 server and 30 client sessions
 n_cons=30
 # remove old log files
 rm -f log.*
 while [ $((n_cons)) -ge 1 ]
 do
 echo "Start $(($n_cons+30)) -> $((n_cons))"
 /usr/lib/opendiva/divas/tty_test $((n_cons)) sv auto&
 sleep 1
 /usr/lib/opendiva/divas/tty_test $(($n_cons+30)) 800 v110 -l512 -a+ib5+iu="<8890214800bb>" -x&
 sleep 1
 n_cons=$(($n_cons-1))
 done
 #
 # Note that tty_test updates log files after 64 KBytes
 # of data have been transferred. Also, please be patient if you
 # use v110 with 9600 bps.
 # To view tty_test processes, type "ps x".
 # To view the log files, use "cat log.* | more".
 # --------------------------------------------------------------
 # END OF SCRIPT
 # --------------------------------------------------------------

tty_test in terminal mode

tty_test includes a simple and easy to use terminal mode. To start tty_test in terminal mode, execute:

/usr/lib/opendiva/divas/tty_test <tty_nr> t

The following table describes parameters for tty_test in terminal mode

Parameter

Level

Description

tty_test

Mandatory

DSiva TTY number that should be used by this test. It should range between 1 and N, where N is the sum of B-channels of the Dialogic® Diva® Media Boards installed in the system.

Normally, <CR> is forwarded to TTY. If you wish to strip <CR> from your input (for example to test the +++ escape operation), enter ENTER "r" ENTER. tty_test will enter the "no CR" mode and will remove <CR> from your input before data is written to TTY. You can switch back to "normal" operation by entering ENTER "R" ENTER. If you are in "no CR" mode, ENTER "r" ENTER writes a <CR> to TTY.

In terminal mode, you can view the content of the virtual modem status register if you enter ENTER show msr ENTER. This will issue TIOCMGET ioctl on the TTY interface and print its output to the terminal.

You can set or clear the DTR line in the virtual Line Control Register (LCR). If you enter ENTER "DTR+" ENTER, the DTR line will be set. If you enter ENTER "DTR-" ENTER, the DTR line will be cleared (TIOCMBIS and TIOCMBIC ioctl codes).

To quit the tty_test terminal mode, enter ENTER "q" ENTER.

Selection of different TTY interfaces

tty_test has been developed to test and control the Diva TTY interface. It tries to open the /dev/ttyds[01 .... ] device node. With other operating systems, the name of the Diva TTY interface may be different. You can still use tty_test without any changes if you create a symbolic link: ln -s <your_real_tty_interface_device_node> /dev/ttydsXXX.