Scripts#

It is possible to create and execute SSH scripts on devices from within the system. Scripts can be executed as part of a provisioning workflow.

Script files syntax is the Expect script syntax with the ability to add one of the following per line of the script:

  • send data to a device and evaluate and substitute macros visible in the context hierarchy

  • define a regular expression for the response expected from the device

  • branch to a next line based on a match to a response from a device

  • comments can be added to the script

Scripting has been tested with Cisco IOS devices.

Please note:

  • Branching is only for one line in the script file and does not yet support blocks of commands.

  • Security: There is no control of what can be done or not done on the device.

In order to create and run a script, a supporting data model and IOS script device model Configuration Template can be used as a part of a Provisioning Workflow that is executed.

A GUI Rule called ConfigurationTemplateOverride for device/ios/Script is applied by default to the Configuration Template, which adds a multiline property to the expect_script field of the device model. This enables multiline input of the script.

The supporting model for the IOS device is data/Ios, to which an instance is added containing the host, port and authentication details of the device. This instance can then be selected as the Network Device Filter in the Provisioning Workflow if required. Alternatively, the Provisioning Workflow can define a context variable, say ios_details, that resolves to a particular data\Ios instance, for example {{data.Ios.* || direction:local}}

In the IOS device model Configuration Template, the script itself is entered and can consist of a combination of Expect script syntax and system macros that are for example used for standard script blocks or variables for the selected data/IOS instance values.

When the Provisioning Workflow is executed, the transaction log can be inspected to examine the entire script with macros and variables referenced, as well as the device response.