ON THIS PAGE
Op Script Overview
Understanding Op Scripts
Junos operation (op) scripts automate network and device management and troubleshooting. Op scripts can perform any function available through the remote procedure calls (RPCs) supported by either the Junos XML management protocol or the Junos Extensible Markup Language (XML) API.
Op scripts enable you to:
-
Create custom operational mode commands
-
Execute a series of operational mode commands
-
Customize the output of operational mode commands
-
Perform controlled configuration changes
-
Shorten troubleshooting time by gathering operational information and iteratively narrowing down the cause of a network problem
-
Monitor the overall status of a device by periodically checking network warning parameters, such as high CPU usage.
Op scripts are based on the Junos XML management protocol and the Junos XML API. The Junos XML management protocol is an XML-based RPC mechanism. The Junos XML API is an XML representation of Junos configuration statements and operational mode commands. For additional information, see Junos XML Management Protocol and Junos XML API Overview.
Op scripts can be written in Python, Extensible Stylesheet Language Transformations (XSLT), or Stylesheet Language Alternative syntaX (SLAX). Op scripts use XML Path Language (XPath) to locate the operational objects to inspect and use automation script constructs to perform actions on the objects. The actions can change the configuration, modify the output, or execute additional commands based on the output.
You can invoke op scripts in a number of ways. For example, you can:
-
Invoke an op script manually in the CLI.
-
Invoke an op script automatically upon user login.
-
Call an op script from another script.
-
Invoke an op script through an API call.
When you invoke an op script, the Junos OS management process (mgd) executes the script.
Benefits of Op Scripts
-
Mitigate human error by performing controlled configuration changes
-
Shorten troubleshooting time and speed time to resolution for network issues
-
Streamline tasks
-
Enable customization of operational commands and their output