Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?


Example: Control IS-IS and MPLS Interfaces

This example shows how to use commit scripts to decrease the amount of manual configuration.


This example uses a device running Junos OS.

Overview and Commit Script

If you want to enable MPLS on an interface, you must make changes at both the [edit interfaces] and [edit protocols mpls] hierarchy levels. This example shows how to use commit scripts to decrease the amount of manual configuration.

This example performs two related tasks. If an interface has [family iso] configured but not [family mpls], a configuration change is made (using the jcs:emit-change template) to enable MPLS. MPLS is not valid on loopback interfaces (loX), so this script ignores loopback interfaces. Secondly, if the interface is not configured at the [edit protocols mpls] hierarchy level, a change is made to add the interface. Both changes are accompanied by appropriate warning messages.

The example script is shown in both XSLT and SLAX syntax:

XSLT Syntax

SLAX Syntax



Step-by-Step Procedure

To download, enable, and test the script:

  1. Copy the script into a text file, name the file iso.xsl or iso.slax as appropriate, and copy it to the /var/db/scripts/commit/ directory on the device.

  2. Select the following test configuration stanzas, and press Ctrl+c to copy them to the clipboard.

    If you are using the SLAX version of the script, change the filename at the [edit system scripts commit file] hierarchy level to iso.slax.

  3. In configuration mode, issue the load merge terminal command to merge the stanzas into your device configuration.

    1. At the prompt, paste the contents of the clipboard by using the mouse and the paste icon.

    2. Press Enter.

    3. Press Ctrl+d.

  4. Commit the configuration.


Verifying the Configuration


Verify that the script behaves as expected.


Review the output of the commit command.

Issue the show interfaces command. Confirm that the loopback interface is not altered and that the SONET/SDH interfaces are altered.