Terminal - Connect

Declaration

<AMCONTROLTERM SESSION="text" ACTION="SETCURSORPOSITION" CURSORROW="number" CURSORCOL="number" />

Related Topics

Description

Connects to a terminal using the specified emulation type and establishes a new terminal session which can be used in subsequent terminal related steps.

Practical Usage

Used to begin a transaction with a terminal. This activity is used in conjunction with other terminal activities such as Get terminal text, Control terminal or Send terminal text. These activities are used in leu of terminal emulation software. Using Automate's terminal activities, legacy systems can be automated in the background without the use of 3rd party software.

Parameters

General

Property

Type

Required

Default

Markup

Description

Connection type

Text (options)

No

TCP/IP

  1. TYPE="TCP/IP"

  2. TYPE="SSH"

The type of terminal connection to perform. If unsure which to use, check with the administrator of the terminal. The available options are:

  • TCP/IP: Connection is established using TCP/IP.

  • SSH: Connection is established using a secure socket.

Hostname

Text

Yes

(Empty)

HOST="ftp.netauto.com"

The IP address (i.e. xxx.xxx.xxx.xxx) or a server/domain name (i.e. server.domain.com) of the host server to connect to.

Port

Number

No

23

PORT="25"

The port that should be used to connect to the TCP/IP or SSH server. This usually takes place on port 23 for TCP/IP and port 22 for SSH, however it is possible to customize this setting on the server.

Username

Text

Yes if connection is SSH

(Empty)

USERNAME="Anonymous"

The username that should be used when logging onto an SSH server. The username should be pre-configured at the server level. This parameter is valid only if the Connection Type parameter is set to SSH.

Password

Text

Yes if connection is SSH

(Empty)

PASSWORD="encrypted"

The password that corresponds to the username that is to  be used when logging onto the an SSH server. This parameter is valid only if the Connection Type parameter is set to SSH.

Session

Text

No

TermSess1

SESSION="mySession"

The session name to identify this terminal connection request in subsequent terminal steps. This allows several terminal sessions to be active simultaneously.

NOTE: If you are only using one connection at a time, you do not need to specify a value other than the default, which is TermSess1.

Show terminal window

Yes/No

No

No

SHOWTERMINALWINDOW="YES"

If set to YES, a window will be displayed at runtime showing the results of the terminal transaction. This option is normally enabled while debugging the task so that the developer can see what is occurring in the session. It is normally disabled during production so that the transaction occurs in the background and does not interfere with other tasks. This parameter is set to NO by default.

Advanced

Property

Type

Required

Default

Markup

Description

Emulation

No

No

ANSI

  1. EMULATION="TTY"

  2. EMULATION="ANSI"

  3. EMULATION="VT52

  4. EMULATION="VT100"

  5. EMULATION="VT220"

  6. EMULATION="VT320"

  7. EMULATION="TN3270"

  8. EMULATION="tn5210"

 

The type of terminal emulator that should be used. If you are unsure of the value to use in this parameter, contact your server administrator. The available options are:

  • TTY - Use the TTY terminal emulation standard.

  • ANSI (default) - Use the ANSI terminal emulation standard.

  • VT52 - Use the VT52 terminal emulation standard.

  • VT100 - Use the VT100 terminal emulation standard.

  • VT220 - Use the VT220 terminal emulation standard.

  • VT320 - Use the VT320 terminal emulation standard.

  • TN3270 - Use the TN3270 terminal emulation standard.

  • TN5250 - Use the TN5250 terminal emulation standard.

Resource Name

Text

No

(Empty)

RESOURCENAME="Text>"

The resource name is a generic term for any of the following names: LU name, device name or device pool name. You may specify a Windows environment variable as the resource name. For example, if you specify "%username%" it will be replaced by the Windows username when it is sent to the host. You may also specify a semicolon delimited list of resource names (i.e. DEC-VT220;VT220;DEC-VT100;VT100). If the first resource is in use, then the session attempts to use the second, and so on. This parameter is available only when TN3270 or TN5250 is selected from the Emulation Type parameter.

Default prompt

Text

No

(Empty)

PROMPT="READY>"

The prompt that appears in the target terminal system. This allows subsequent terminal activities to wait until a certain prompt appears before executing. For example, on some terminal systems, the prompt is the text "READY>". By specifying this value, AutoMate will know to wait until that text appears before moving onto the next step.

Regular expression

Yes/No

No

No

PROMPTISRE="YES"

If set to YES, indicates that the text specified in the Default Prompt parameter is a regular expression and not literal text. Specifying a regular expression can be useful This is useful in cases where the prompt may not always be the same but some portion of it is. This parameter is set to NO by default.

Wait for default Prompt

Yes/No

No

No

WAITFORPROMPT="YES"

If set to YES, indicates that the step will wait the for the default prompt to appear until the specified amount of time. If the default prompt does not appear within the amount of time specified, execution halts with a time-out error. If this parameter is set to NO (default), the step will wait indefinitely.    

Time to wait

Number

No

10000

PROMPTTIMEOUT="233"

The length of time allowed to wait for the default prompt before a time out error is thrown. This parameter corresponds with the time measurement specified in the Measure parameter below.

Measure

Text (options)

No

milliseconds

  1. MEASURE="milliseconds"

  2. MEASURE="seconds"

  3. MEASURE="minutes"

  4. MEASURE="hours"

The time measurement that corresponds with the value entered in the Time to wait parameter. The available options are:

  • Milliseconds (Default) - Time to wait value will be measured in milliseconds.

  • Seconds -  Time to wait value will be measured in seconds.

  • Minutes -  Time to wait value will be measured in minutes.

  • Hours -  Time to wait value will be measured in hours.

Log file

Text (options)

No

(Empty)

LOGFILE="c:\temp\log.log"

The path and filename of a log file in which to log data about the terminal connection. This log file can be useful in diagnosing particular errors or elusive connection problems.

Overwrite existing log file

Yes/No

No

No

OVERWRITELOG="NO"

If set to YES, specifies that the log file should be overwritten with new log data if the same file already exists. If set to NO (default), the file will not be overwritten, however, an error will occur at runtime as a result. The default value is YES.

 

Description

Error Causes

On Error

Examples

NOTE: The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.

Sample 1:

Connect to terminal at "linux.networkautomation.com" port 23. The session name will be "TerminalSession1".

<AMTERMINAL HOST="linux.networkautomation.com" SESSION="TerminalSession1" SHOWTERMINALWINDOW="YES" EMULATION="tn3270" RESOURCENAME="a" PROMPT="as" PROMPTISRE="YES" WAITFORPROMPT="YES" PROMPTTIMEOUT="233" MEASURE="seconds" />

Sample 2:

This sample task uses an assortment of terminal activities to automate a terminal logon process. Examining the step parameters and properties of this task may assist you in creating your own terminal emulation task.

<AMVARIABLE NAME="theUsername" VALUE="terminalUser" />

<AMVARIABLE NAME="thePassword" VALUE="password" />

<AMTERMINAL HOST="linux.networkautomation.com" SESSION="TerminalSession1" SHOWTERMINALWINDOW="YES" EMULATION="vt220" />

<AMTERMINAL ACTIVITY="waitfor" SESSION="TerminalSession1" TEXT="login:" />

<AMTERMINAL ACTIVITY="sendtext" SESSION="TerminalSession1" TEXT="%theUsername%{ENTER}" />

<AMSHOWDIALOG MESSAGE="OK to proceed?" />

<AMTERMINAL ACTIVITY="waitfor" SESSION="TerminalSession1" TEXT="Password:" />

<AMTERMINAL ACTIVITY="sendtext" SESSION="TerminalSession1" TEXT="%thePassword%{ENTER}" />

<AMSHOWDIALOG MESSAGE="OK to proceed?" />

<AMTERMINAL ACTIVITY="disconnect" SESSION="TerminalSession1" />