Script variables in Kiwi CatTools
Kiwi CatTools includes several built in variables available to use in Client scripts. Use the "cl.
" prefix to access a variable or function from the client. For example:
If cl.QuitNow = 1 then exit sub
Variables
QuitNow As Long
- If set to a value other than
0
, indicates that the script must stop processing and exit immediately. - When the
STOP
button is pressed on the Activities page, the value ofQuitNow
is set to1
for each running thread.
Ensure that this variable is checked within any long duration loops so that the client responds to the stop events in a timely manner.
DeviceName As String
- Name of the current device that has been passed from the main script via the marshal threads function.
- Use this value to perform further database lookups based on this device name.
ScheduleNumber as integer
- Contains the current schedule number. Each activity is assigned a unique identifying number.
- This number is used as the unique key for database lookups of activity information.
ScriptFileClient As String
- File name of the current script file that is currently being run
UniqueFileID As String
- Unique file ID prefix for this script (set from the Main script).
- Use this unique value when writing results files that are to be read by the main script. This avoids other threads from overwriting the same results file.
ProcessID As Long
- The ID number of this thread (1 to MaxThreads).
- This value is not unique since the thread can be reused for running a different script and connecting to a different device.
- This variable can be used when signalling the main script as a way of identifying the number of this thread.
AppPath As String
- The folder where Kiwi CatTools is installed.
- This folder is always terminated with a "\" character.
- Use this variable as the root path when saving data to results files. The ClientTemp folder for example is located under the root path.
DeviceHostnameID
- Hostname as recovered from the device after login. For example:
sales1600
- When a connection to a device is made, the hostname is extracted from the prompt.
- A prompt of "
sales1600>
" gets extracted and converted to "sales1600
".
DeviceVTYPrompt
- This value holds the prompt that is expected to be returned after an action is taken in VTY mode.
- For example, after a show interface command has completed, the DeviceVTYPrompt can be expected, such as:
sales1600>
DeviceEnablePrompt
- This value holds the prompt that is expected to be returned after an action is taken in enable mode.
- For example, after a show interface command has completed, the DeviceEnablePrompt can be expected:
sales1600#
RecDataTimeOut as long
- Holds the number of seconds to wait for a response from the device.
- For example, time to wait for login prompt to be received after sending a command.
RxBuffer As String
- Holds the data returned from the active connection.
- For example:
SendData abcde, then WaitForMultData
- After a return value has been matched or the timeout has occurred, the received data will be held in
RxBuffer
.
StripVT100ESC as Long
- If set to non-zero, vt100 type escape sequences are removed from the buffer stream at the point of reception.
- This is useful for devices with menu based telnet interfaces.
- This variable can be toggled at any time to enable or disable the removal of the escape sequences.
- For example, set this variable to
1
, then call theWaitForMultData
function.
DebugMode as long
- Determines when to debug data that is sent or received from an active connection. Debugged data is save to a file.
- The file name is made up from the formula:
AppPath
+ "Capture" +UniqueFileID
+ ".txt". 0
= normal operation.1
= sent and received data from the active connection is written to a debug text file.
Device values
After calling the function DBDevicesGetAllFields(DeviceName)
, the following fields are loaded with the information from the database.
CurDevType As String
- The current device type.
- For example:
Cisco.Router.General
orCisco.Firewall.PIX
- To ensure a good match, always test for lowercase values. If
Lcase(CurDevType) = "cisco.router.general"
then...
CurDevGroup As String
- Group to which the device belongs. This is a free form field and can be any value that the user specifies.
CurDevName As String
- The current device's name. This is a free form field and can be any value that the user specifies.
- The device name must be unique.
CurDevHostAddress As String
- IP address or hostname of the device.
CurDevFilename As String
- A base filename for use when saving information to file for this device.
- The filename is made from the device name.
- Any invalid filename characters are replaced with an underscore.
CurDevModel As String
- Current device model, for example:
1601
or3300
. This is a free form field and can be any value that the user specifies.
CurDevConnectVia As String
- The name of the device to connect to first before attempting a telnet or SSH session.
- For example, you connect to Device A , then attempt a telnet connection to the current device.
CurDevTelnet As String
- Method used for connection, for example: Telnet, SSH1, or COMM.
- The connection method is dependent on the particular device.
CurDevTelnetPort As String
- Port to use for connection attempt, for example:
23
for telnet,22
for SSH,1
for COMM1.
CurDevSession As String
- Session number to use once connected to device.
- For xxample: Telnet to device, then issue
session 15
command to connect to LANE card.
CurDevVTYPass As String
- VTY password for the device.
CurDevConsolePass As String
- Console password for the device.
- The console password is only required when the connection is via the console (COMM port connection).
CurDevEnablePass As String
- Enable password for the device. This is usually the enable-secret password on Cisco devices.
CurDevPrivilegeLevel As String
- The privilege level to use when entering enable mode.
- For example:
Enable 7
CurDevAAAUsername As String
- Username to use when device is set to use AAA (TACACS/RADIUS/Username)
CurDevAAAPassword As String
- Password to use when device is set to use AAA (TACACS/RADIUS/Username)
CurDevVTYPrompt As String
- The VTY prompt to expect from the device.
- Normally set to
""
when the default prompt is expected. - For example:
Login:
CurDevConsolePrompt As String
- The console prompt to expect from the device.
- Normally set to
""
if the default prompt is expected. - For example:
Login:
CurDevEnablePrompt As String
- The Enable mode prompt to expect from the device.
- Normally set to
""
if the default prompt is expected. - For example:
Password:
CurDevAAAUserPrompt As String
- The username prompt to expect from the device.
- Normally set to
""
if the default prompt is expected. - For example:
Username:
CurDevAAAPassPrompt As String
- The password prompt to expect from the device.
- Normally set to
""
if the default prompt is expected. - Example:
Password:
CurDevRequireVTYLogin As String
- VTY password is required to login to the device. Check box value.
0
= no VTY password expected1
= VTY password expected
CurDevLoginUsesAAA As String
- AAA username and password required to login to the device. Check box value.
- Uses AAA user authentication.
0
= no username or password required1
= username or password required
CurDevEnableUsesAAA As String
- AAA username or password required when entering enable mode on the device. Check box value.
- Uses AAA user authentication.
0
= no username or password required for enable mode1
= username or password required
CurDevAddress1 / CurDevAddress2 / CurDevAddress3 As String
- Free form address information.
CurDevContactName As String
- Name of contact for device.
CurDevContactPhone As String
- Contact phone number for device contact.
CurDevContactEmail As String
- Contact e-mail address for device contact.
CurDevContactOther As String
- Other contact info for device contact.
CurDevAlertEmail As String
- E-mail to send alert info to for this device.
- If left blank, the e-mail address defined in the properties isused.
CurDevSerialNumber As String
- Device serial number. Free form field.
CurDevAssetTag As String
- Device asset tag information. Free form field.
CurDevIdentification As String
- Other device identification. Free form field.
CurDevSerialOther As String
- Other device identification. Free form field.
CurDevActivitySpecific1 As String
- Activity specific information for this device.
CurDevActivitySpecific2 As String
- Activity specific information for this device.
Temp01 to Temp10 as Variant
- General purpose global variables for use by the client scripts.
- Can be used to allow transfer of data from one script to another.
- These values are not initialized on startup and may contain data from previous script instances.