R12.1-JA-2025June05

Configure Interactive Prompts and Commands

The system provides a set of prompts and commands for each device type in the driver. During the live access process, the system determines which command to send depending on different command prompts. However, the built-in prompts and commands may not fit in some special scenarios, which may cause failures. To tackle with this issue, you can customize these prompts and commands for a single device in device settings.

Configuring Prompt and Command Pairs for Login Modes

1. Right-click the device on a map page and select Shared Device Settings from the drop-down menu.

2. In the Shared Device Settings of the device, click Advanced on the CLI tab.

3. Toggle the switch to enable the login script.

4. Configure the prompts and commands for a specific mode. Take Non-privilege Mode as an example.
a. Point to the Non-privilege Mode entry, click the drop-down icon and select Edit.

b. In the Edit Mode dialog, add prompts and commands by either of the following ways:
  • Add prompts and commands on GUI
    On the
    UI tab, click Add Row to add a new pair of prompt and command..

The definition contains three fields:

FieldDescription
Expected Prompt

A prompt to require a command input to continue the login process, such as the prompt Enter CTRL-Y to begin that you may encounter when logging to some Avaya switches.

  • The input supports text, such as Enter CTRL-Y to begin, and regex expression, such as regex:.+?to +begin.+.
  • The input supports the variable $(hostname), such as $(hostname)> and $(hostname)#.

Note: The prompt cannot be empty and cannot exceed 255 characters.

Send Command

The corresponding command that the system sends out after receiving an expected prompt.

  • Besides common commands such as enable, exit and end, the system allows sending a key or combination keys on your keyboard to a device. See Supported Key and Combination Key Commands for details.
  • The system allows the following variables in the command input:
  • $(username) — the non-privileged username of a device.
  • $(password) — the non-privileged password of a device.
  • $(privilege username) — the privileged username of a device.
  • $(privilege password) — the privileged password of a device.

Note: The command cannot be empty and cannot exceed 255 characters.

Hide CommandShow the content in the Send Command column as ciphertexts.
  • Add prompts and commands using JSON script

On the JSON tab, configure the prompts and commands by using JSON scripts. The JSON definition contains the following elements:

ElementTypeDescription
expected_ItemsArrayA collection of all matched items in the script.
expected_promptstring

A prompt to indicate a command input to continue the login process, such as the prompt Enter CTRL-Y to begin that you may meet when logging to some Avaya switches.

  • The input is a string that supports the regex expression, such as "regex:[\>\#]".
    Note: For special characters, such as "\","'","r", in the regex expression, you need to add escape characters ahead of them in JSON. For more details about JSON character escaping, see JSON RFC document.
  • The input string supports the variable $(hostname, such as "$(hostname)>".

Note: The prompt cannot be empty and cannot exceed 255 characters.

send_commandstring

The corresponding command that the system sends out after receiving an expected prompt.

  • Besides the common commands such as enable, exit and end, the system allows sending a key or combination keys on your keyboard to a device. See Supported Key and Combination Key Commands for details.
  • The system allows the following variables in the command input:
  • $(username) — the non-privileged username of a device.
  • $(password) — the non-privileged password of a device.
  • $(privilege username) — the privileged username of a device.
  • $(privilege password) — the privileged password of a device.

Note: The command cannot be empty and cannot exceed 255 characters.

hide boolDetermine whether to show the content in the Send Command column.

Sample JSON Script:

Code
{
"expected_items": [
{
"expected_prompt": "regex:login.*:",
"send_command": "$(username)",
"hide": false
},
{
"expected_prompt": "password:",
"send_command": "$(password)",
"hide": false
},
{
"expected_prompt": "regex:Terminal type\\? \\[.+\\]",
"send_command": "xterm",
"hide": false
},
{
"expected_prompt": "regex:[\\>\\#]",
"send_command": "!/bin/bash",
"hide": false
},
{
"expected_prompt": "regex:[\\>\\#]",
"send_command": "tmsh",
"hide": false
},
{
"expected_prompt": "regex:\\S.+?\\)[\\>\\#]",
"send_command": "",
"hide": false
}
]
}
Information

Note: The content defined on the UI tab and JSON tab is synchronized with each other. Therefore, you can select either way to define prompts and commands for only once.




5. In the Add CLI commands to this mode field, enter the commands that can be executed in this mode.
6. Click OK.
7. To enable SSH fingerprint, toggle the switch and enter the key.
Information Tip: The system will use this key to verify with the Fingerprint Key on the device when logging in to the device through SSH. If the verification fails, the failed device and the Fingerprint Key will be recorded in Domain Management > Data Accuracy Resolution > SSH Fingerprint Check Failed Table.

    Configuring Prompt and Command Pairs for Live Data Retrieval 

    1. Right-click the device on a map page and select Shared Device Settings from the drop-down menu.
    2. In the Shared Device Settings of the device, click Interactive Commands on the CLI tab.
    3. In the pop-up dialog, toggle the switch to enable the built-in two pairs of interactive commands.
    4. Click Add to customize more pairs of expected prompts and responsive commands.
    Information Note: Use || to separate multiple expected prompts. For more rules and formats, refer to Prompt and Command Definition on GUI.

    Supported Key and Combination Key Commands

    On devices of some vendors, a key or combination key requires to be sent during the login process. The system supports the following types of keys and combination keys.

    No.Key/Combination KeyDescription
    1[Ctrl+Y] The Ctrl+Y command is sent. Y is a letter in a lower or upper case from A to Z.
    2[Shift+Y] The Shift+Y command is sent. Y is a letter in a lower or upper case from A to Z.
    3[Alt+Y]The Shift+Y command is sent. Y is a letter in a lower or upper case from A to Z.
    4[Ctrl+Shift+Y]The Ctrl+Shift+Y command is sent. Y is a letter in a lower or upper case from A to Z.
    5[Ctrl+Alt+Y]The Ctrl+ALT+Y command is sent. Y is a letter in a lower or upper case from A to Z.
    6[Shift+Alt+Y]The Shift+ALT+Y command is sent. Y is a letter in a lower or upper case from A to Z.
    7[Ctrl+Y, X]

    This command includes pressing the Ctrl +X combination key and then pressing the Y key separately (without holding Ctrl +X).

    • X and Y are both letters in a lower or upper case from A to Z.
    • Ctrl +Y in this case can be any type of combination keys from No.1 to No.6, such as [Ctrl+Shift+Y, X].
    8[Ctrl+Y, Ctrl+X]

    The Ctrl +Y+X command is sent.

    • X and Y are both letters in a lower or upper case from A to Z.
    • Ctrl +Y or Ctrl+X in this case can be any type of combination keys from No.1 to No.6, such as [Ctrl+Shift+Y, Ctrl+X].
    9[Esc] The Esc command is sent.
    10[Enter]The Enter command is sent.
    11[Space]The Space command is sent.
    12[Y] The Y command is sent. Y is a letter in a lower or upper case from A to Z.
    13[Ctrl+\]]The Ctrl+] command is sent. Because the system uses [ ] to include a key or combination key, the escape character \ is used to avoid the conflict of the ] character.

    Information Notes:
    • The system uses the square brackets [ ] to recognize a key and combination keys. 
    • Add + \r after a key or combination key to send the command with the Enter key. For example, [Ctrl+Y, X] +\r.
    • Add  - \r after a key or combination key to send the command without the Enter key. For example, [Ctrl+Y] -\r.