Smart scripting

Smart scripting

Smart scripting is a feature that allows to execute commands (or tags) to analyze output from a device.

Compare output to previous

All output from a devices during script execution is saved in execution folder. This feature compares output of previous script execution to output of current execution. If output of executions is the same, then the message “Job output identical to output of the previous job” displayed in console and saved to program log file. If not the message “Job output is not identical to output of the previous job” displayed in console and saved to program log. One use case of this feature is to get notification when configuration of device changes.

To compare output of current execution to previous, insert the following to the script code. The comparison will be done after script executions ends.

<COMPARE_OUTPUT_TO_PREVIOUS></COMPARE_OUTPUT_TO_PREVIOUS>

Insert this command only once to execution script only, and do not use any other commands or script lines on the same line.

Find line in script output.

To find line in script output use the following command:

<OUTPUT_CONTAINS></OUTPUT_CONTAINS>

The program will search for any string between the tags <OUTPUT_CONTAINS> </OUTPUT_CONTAINS> in output of a script. If string is found then the message “Searched text found in output of this job” will be sent to console and will be saved to log file. Otherwise the message “Searched text wasn’t found in output of this job” will be sent to console and will be saved to log file.

This is useful to check or monitor status of a device. For example it is possible to search for a string “up up” in output of a command “show ip int br | inc GigabitEthernet0” in cisco ASR1000V router. This will save in output of the script the indication if interface Gigabitethernet 0 is up.

Print line in console.

The following command will print anything between “<PRINT>” and “</PRINT>”.

<PRINT>output to console</PRINT>

This is useful to notify something useful in the console. For example notify “Execution of cisco backup script”