Op Script Programming Overview
JUNOS operation (op) scripts automate network and router management and troubleshooting. Op scripts can perform any function available through the remote procedure calls (RPCs) supported by either of two application programming interfaces (APIs): the JUNOS Extensible Markup Language (XML) API and the JUNOScript API. Op scripts are executed by the JUNOS management (mgd) process.
Op scripts enable you to do the following things:
- Monitor the overall status of a router.
- Customize the output of operational mode commands.
- Reconfigure the router to avoid or work around known problems in the JUNOS Software.
- Change the router’s configuration in response to a problem.
Op scripts are based on two application programming interfaces (APIs) to the JUNOS Software: the JUNOS XML API and the JUNOScript API, which are discussed in JUNOScript API and JUNOS XML API Overview. Op scripts can be written in either the Extensible Stylesheet Language Transformations (XSLT) or Stylesheet Language Alternative Syntax (SLAX) scripting language. Op scripts use XPath to locate the operational objects to be inspected and XSLT constructs to specify the actions to perform on the located operational objects. The actions can change the output or execute additional commands based on the output. For more information about XPath and XSLT, see XSLT Overview. For more information about SLAX, see SLAX Overview.