Create and Run a Script¶
Add an instance to
data/IOS
. This instance contains the host, port and authentication details of the device.Create a Configuration Template for the Target Model Type selected as
device/ios/Script
. A GUI Rule calledConfigurationTemplateOverride
is applied by default to it to enable multiline input.Macros in a script should however be written on one line.
In the device/ios/Script group on the Configuration Template, the following values can be entered:
- The Description value can be entered.
- The Expect Script value is the entered. The script can be entered over multiple lines. Variables can be used in the entered script - sourced from either context variables or macros. Refer to the Expect Script Examples topic.
Create a Provisioning Workflow.
- Select the Workflow Operation as run.
- Select the Step Type as model.
- Select the Entity or Workflow as
device/ios/Script
- The Network Device Filter group’s Device Instance can be a
selected
data\Ios
instance, or if not, the device can be the value of a Provisioning Workflow Context variable that resolves to a particulardata\Ios
instance, for example{{data.Ios.* || direction:local}}
. - The Configuration Template is the created template that contains the
details of the script. If a Device Instance was added to the Provisioning
Workflow, the script can reference it with the variable
device_details
, for example thedata/Ios
instance as{{device_details.host}}
and{{device_details.host}}
. - To run the script, execute the workflow.
Inspect the transaction. The details of the transaction show the script with all macros and variables resolved, as well as the response from the device.