ON THIS PAGE
Op Script Overview
Understanding Op Scripts
Junos OS 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 can be executed manually in the CLI or upon user login, or they can be called from another script. They are executed by the Junos OS management process (mgd).
Op scripts enable you to:
Create custom operational mode commands
Execute a series of operational mode commands
Customize the output of operational mode commands
Shorten troubleshooting time by gathering operational information and iteratively narrowing down the cause of a network problem
Perform controlled configuration changes
Monitor the overall status of a device by creating a general operation script that periodically checks 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, and 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 be inspected and automation script constructs to specify the actions to perform on the operational objects. The actions can change the configuration or output or execute additional commands based on the output.
Benefits of Op Scripts
Op scripts provide the following benefits:
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