Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation

Commit Script Overview

Junos OS commit scripts enforce custom configuration rules during the commit process. When a candidate configuration is committed, it is inspected by each active commit script. If a configuration violates your custom rules, the script can instruct Junos OS to take appropriate action. A commit script can perform the following actions:

  • Generate and display custom warning messages to the user
  • Generate and log custom system log (syslog) messages
  • Change the configuration to conform to the custom business rules
  • Generate a commit error and halt the commit operation

Commit 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.

Commit scripts can be written in either the Extensible Stylesheet Language Transformations (XSLT) or Stylesheet Language Alternative Syntax (SLAX) scripting language. Commit scripts use the XML Path Language (XPath) to locate the configuration objects to be inspected and XSLT or SLAX constructs to specify the actions to perform on the configuration objects. The actions can change the configuration or generate messages about it. For more information about XSLT, see XSLT Overview. For more information about SLAX, see SLAX Overview

Additionally, you can create macros, which allow you to create custom configuration syntax that simplifies the task of configuring a device running Junos OS. By itself, your custom syntax has no operational impact on the device. A corresponding commit script macro uses your custom syntax as input data for generating standard Junos OS configuration statements that execute your intended operational impact.

To view the device's current configuration in the Extensible Markup Language (XML), using the command-line interface's (CLI's) operational mode, issue the show configuration | display xml command. To view your configuration in commit-script-style XML, issue the show configuration | display commit-scripts view command. Commit-script-style XML view displays the configuration in the format that would be input to a commit script.

Published: 2013-03-05