Scripts Overview
Scripts are configuration and diagnostic automation tools provided by the Junos operating system (Junos OS). They help reduce network downtime and configuration complexity, automate common tasks, and reduce the time required to resolve problems. Junos OS scripts are of three types: commit, op, and event scripts.
Commit scripts—Commit scripts enforce custom configuration rules and can be used to automate configuration tasks, enforce consistency, prevent common mistakes, and more. Every time a new candidate configuration is committed, the active commit scripts are called to inspect the new candidate configuration. If a configuration violates your custom rules, the script can instruct the Junos OS to perform various actions, including making changes to the configuration and generating custom, warning, and system log messages.
Operation (Op) scripts—Op scripts enable you to add your own commands to the operational mode CLI. They can automate the troubleshooting of known network problems and correct them.
Event scripts—Event scripts use event policies to enable you to automate network troubleshooting by diagnosing and fixing issues, monitoring the overall status of the router, and examining errors periodically. Event scripts are similar to op scripts but are triggered by events that occur on the device.
Using Junos Space Network Management Platform, you can import multiple scripts into the Junos Space server. You can then perform tasks such as modifying the scripts, viewing their details, exporting their contents, comparing the contents, viewing their association with devices, and staging them on multiple devices simultaneously. After you stage scripts on devices, you can use Junos Space Platform to enable, disable, or execute the scripts on those devices. You can remove the scripts from the devices as well. To help ensure that the staged scripts are not corrupt, you can verify the checksum of the scripts.
Junos Space Platform also supports task scheduling. You can specify the date and time at which you want a script to be staged, verified, enabled, disabled, removed, or executed.
Junos Space Platform associates scripts with devices when you stage scripts on the devices. As part of this association, Junos Space Platform maintains information pertaining to the current status of the script on the device. Based on this feature, Junos Space Platform supports the following operations:
Associating scripts with devices and maintaining the association
Displaying the status (version, enabled, or disabled) of scripts on the devices
Displaying the results of script execution on the devices
Upgrading the scripts to the latest version on some or all associated devices
Upgrading the staged script on the associated devices whenever the script is modified from Junos Space Platform
Marking and unmarking scripts as favorites
Removing the script-device association
Note:You can perform script-related operations on a device (enable, disable, remove, verify, or execute scripts— but you cannot stage scripts) only if the scripts are associated with the device.
If you want to delete scripts from Junos Space Platform, first remove the scripts from the device (using the Remove Scripts from Devices action) and then delete all the related associations.
You cannot modify the script type if the script is associated with a device. You need to first remove the scripts from the device and then modify the script type.
Based on the roles assigned to your username, Junos Space Platform enables or disables different tasks. You can enable and disable scripts on devices only if you are a Super Administrator with all permissions or a user who has been given maintenance privileges.
For more information about the roles that you need to be assigned to perform any tasks on scripts, see Predefined Roles Overview.
The Junos OS management process executes commit scripts with root permissions, not the permission levels of the user who is committing the script. If the user has the permissions required to commit the configuration, then Junos OS performs all actions of the configured commit scripts, regardless of the privileges of the user who is committing the script.
You can perform the following tasks from the Scripts page:
Import scripts.
View script details.
Modify a script.
Delete scripts.
Disable scripts on devices.
Enable scripts on devices.
Execute a script on devices.
Remove scripts from devices.
Stage scripts on devices.
Compare script versions.
Export scripts in .tar format.
Modify the type of script.
View associated devices.
View verification results.
Verify the checksum of scripts on devices.
View execution results.
Assign scripts to domains.
Tag and untag the scripts, view the scripts that are tagged, and delete private tags.
To run any of your scripts on devices, see Executing Scripts on Devices and Executing Scripts on Devices Locally with JUISE.