[Contents] [Prev] [Next] [Index] [Report an Error]


Commit Scripts Overview

JUNOS commit scripts enforce custom configuration rules. A script runs each time a new candidate configuration is committed and inspects the configuration. If a configuration violates your custom rules, the script can instruct the JUNOS software to perform various actions, including the following:

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

The scripting language you use for writing commit scripts is Extensible Stylesheet Language Transformations (XSLT). XSLT commit scripts are based on two application programming interfaces (APIs): the JUNOS extensible markup language (XML) API and the JUNOScript API.

The JUNOScript API is an Extensible Markup Language (XML) application that client applications use to request and change configuration information on routing platforms that run the JUNOS software. The operations defined in the API are equivalent to configuration mode commands in the JUNOS command-line interface (CLI). Applications use the API to display, edit, and commit configuration statements (among other operations), just as administrators use CLI configuration mode commands such as show, set, and commit to perform those operations.

The JUNOS XML API is an XML representation of JUNOS configuration statements and operational mode commands. JUNOS XML configuration tag elements are the content to which the operations in the JUNOScript API apply. JUNOS XML operational tag elements are equivalent in function to operational mode commands in the CLI, which administrators use to retrieve status information for a routing platform. The JUNOS XML API also includes tag elements that are the counterpart to JUNOS configuration statements.

To view your configuration in XML, issue the show configuration | display xml operational mode command. To view your configuration in commit-script-style XML, issue the show configuration | display commit-scripts view operational mode command.

Extensible Stylesheet Language (XSL) is a family of languages that allows you to describe how files encoded in the XML standard are to be formatted or transformed. Commit scripts use two XSL languages:

Commit scripts use XPath to locate the configuration objects to be inspected and XSLT constructs to specify the actions to perform on the located configuration objects. The actions can change the configuration or generate messages about it. For more information about XPath and XSLT, see Understanding XSLT.

This chapter discusses the following topics:


[Contents] [Prev] [Next] [Index] [Report an Error]