The scripting facility of CatTools allows you ready access to almost all of the activity and device specific functionality of CatTools. This allows you to add new device types or even add activities if you wish, without needing to change anything in the application code.
The CatTools applications contain a rich selection of functions and variables that are available to the scripts. These give you access to internal information such as device details, and functional processes such as writing data to disk files or comparing device outputs.
There are two levels of scripts - the Main scripts and the Client scripts. See the next chapter for more detail on the sequence of events in running an activity and where the scripts fit in.
The Main scripts are run by the main CatTools program. These act as the intermediary between the client processes and the main executable. They make all the preparations for running an activity, and then activate the clients for each device that the activity is to run against. When all the individual client processes have completed, the Main scripts do any amalgamation of data or whatever is required to finalise the activity.
The Main script may launch one or more Client processes, one for each device selected by the activity. A single Client process interacts with a single device and performs the activity functions against the device. The Client scripts are further divided into two groups.
The activity specific group of scripts do the actions required to perform a specific activity. For instance, to run a backup of a device, the normal flow of actions might be:
1.
login
2.
get the device name
3.
set some session properties
4.
go in to enable mode
5.
display and capture the configuration
6.
reset the session properties
7.
exit
The device specific set of scripts perform the activity functions listed previously according to the requirements of the device itself. For instance, each device script contains a Login routine that is called by the activity script. The contents of the Login routine varies for each device type, but after logging on to the device signals back to the activity script that the login was a success. The activity script then calls a routine called Enable to place the device in enable mode. The device script contains the Enable routine that works for the specific device. This interaction continues until all the activity processes are done.
For efficiency, the CatTools Client application loads only the script files required for the specified activity. To back up a Cisco router, the Client loads the Client.General.Backup Running Config.txt script and the Cisco.Router.general.txt script. The first script file knows how to perform the activity. The second script knows how to communicate with a Cisco router.
This division of function should make it relatively straight forward to add custom activities and new devices to CatTools.