Terminal - Connect
Declaration
<AMCONTROLTERM SESSION="text" ACTION="SETCURSORPOSITION" CURSORROW="number" CURSORCOL="number" />
Description: Connects to a terminal using the specified emulation type and establishes a new terminal session which can be used in subsequent terminal 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 terminal activities, legacy systems can be automated in the background without the use of third-party software.
General Parameters
Property |
Type |
Required |
Default |
Markup |
Description |
---|---|---|---|---|---|
Connection type |
Text (options) |
No |
TCP/IP |
TYPE="TCP/IP" TYPE="SSH" TYPE="COM1" TYPE="COM2" |
The type of terminal connection to perform. If unsure which to use, check with the administrator of the terminal. The available options are:
|
Hostname |
Text |
Yes |
(Empty) |
HOST="ftp.netauto.com" |
The IP address (e.g., xxx.xxx.xxx.xxx) or a server / domain name (e.g., server.domain.com) of the host server to connect to. |
Username |
Text |
Yes |
(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 |
(Empty) |
PASSWORD="myPassword" |
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. |
Baud rate |
Number (options) |
No |
9600 |
BAUDRATE="921600" |
The speed of transmission between the local computer and terminal. The available values range from 110 to 921600. The default value is set to 9600. |
Data bits |
Number (options) |
No |
8 |
DATABITS="5" |
The number of bits containing data in a transmission (because 8 bits make up a character, data bits are often referred to as character bits). The available values are 5 (default), 6, 7, and 8 bits. |
Stop bits |
Number (options) |
No |
1 |
STOPBITS="1.5" |
The number of bits that signals the end of a character. The available values are 1, 1.5 or 2 bits. |
Parity |
Text (options) |
No |
None |
PARITY="Odd" |
Determines the type of parity to use. Parity bits are used as the simplest form of error detecting code. The available options are:
|
Flow control |
Text (options) |
No |
None |
FLOWCONTROL="Hardware" |
Flow control is the process of managing the rate of data transmission between two nodes to prevent a fast sender from outrunning a slow receiver. Overrunning is when a device can't process what it is receiving quickly enough and thus loses bytes and/or generates other serious errors. What flow control does is to halt the flow of bytes until the terminal (for example) is ready for some more bytes. Flow control sends its signal to halt the flow in a direction opposite to the flow of bytes it wants to stop. Flow control must both be set at the terminal and at the computer. The available options are:
|
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. |
Session name |
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 Parameters
Property |
Type |
Required |
Default |
Markup |
Description |
---|---|---|---|---|---|
Emulation |
No |
No |
ANSI |
|
The emulation type that should be used. If you are unsure of the value to use in this parameter, contact the server administrator or developer of the system. The available options are:
|
Resource Name |
Text |
No |
(Empty) |
RESOURCENAME="Text>" |
A resource name (LU name, device name or device pool name) for a session. 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 is utilized on the target terminal system. This allows the terminal actions to wait until a certain prompt appears before moving on to the next step. For example, on some terminal systems, the prompt is the text "READY>". By specifying this value, will know to wait until that text appears before moving on. |
Regular expression |
Yes/No |
No |
No |
PROMPTISRE="YES" |
If set to YES, indicates that the text specified in Default Prompt parameter is a regular expression and not literal text. 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 set to NO (default), the step will wait indefinitely. |
Time to wait |
Number |
No |
10000 |
PROMPTTIMEOUT="233" |
The wait value. This parameter corresponds with the measure selected below. |
Measure |
Text (options) |
No |
milliseconds |
MEASURE="seconds" |
The time measurement that corresponds with the value entered in the Time to wait parameter. The available options are:
|
Description tab - A custom description can be provided on the Description tab to convey additional information or share special notes about a task step.
Error Causes tab - Specify how this step should behave upon the occurrence of an error. (Refer to Task Builder > Error Causes Tab for details.)
On Error tab - Specify what AWE should do if this step encounters an error as defined on the Error Causes tab. (Refer to Task Builder > On Error Tab for details.)
Examples
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 TermSess1. Wait 233 seconds for default prompt.
<AMCONNECTTERM RESOURCENAME="a" PROMPT="as" EMULATION="TN3270" HOST="linux.networkautomation.com" SHOWTERMINALWINDOW="YES" WAITFORPROMPT="YES" PROMPTTIMEOUT="233" MEASURE="seconds" PROMPTISRE="YES" />
Sample 2 - A sample task that uses all available terminal actions. Examining the step parameters and properties of this task may assist you in creating your own terminal emulation task.
<AMVARIABLE NAME="thePassword">password</AMVARIABLE> <AMCONNECTTERM EMULATION="VT220" HOST="linux.networkautomation.com" SHOWTERMINALWINDOW="YES" /> <AMWAITFORTERMTEXT TYPE="TEXT">login:</AMWAITFORTERMTEXT> <AMSENDTERMTEXT>%theUsername%{ENTER}</AMSENDTERMTEXT> <AMSHOWDIALOG>OK to proceed?</AMSHOWDIALOG> <AMWAITFORTERMTEXT TYPE="TEXT">Password:</AMWAITFORTERMTEXT> <AMSENDTERMTEXT>%thePassword%{ENTER}</AMSENDTERMTEXT> <AMSHOWDIALOG>OK to proceed?</AMSHOWDIALOG> <AMDISCONNECTTERM />