Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Example: Configuring a Default Encapsulation Type

 

This commit script example configures default Cisco HDLC encapsulation on SONET/SDH interfaces not configured as aggregate interfaces.

Requirements

This example uses a device running Junos OS with SONET/SDH interfaces.

Overview and Commit Script

Point-to-Point Protocol (PPP) encapsulation is the default encapsulation type for physical interfaces. You do not need to configure encapsulation for any physical interfaces that support PPP encapsulation. If you do not configure encapsulation, PPP is used by default. For physical interfaces that do not support PPP encapsulation, you must configure an encapsulation to use for packets transmitted on the interface.

This example configures default Cisco HDLC encapsulation on SONET/SDH interfaces not configured as aggregate interfaces. The tag variable is passed to the jcs:emit-change template as transient-change, so this change is not copied to the candidate configuration.

Simply including configuration groups in the configuration does not enable you to test whether the aggregate statement is included for an interface at the [edit interfaces interface-name sonet-options] hierarchy level. A commit script can perform this test and set the encapsulation only on nonaggregated interfaces. The script written to perform this test has the following syntax:

XSLT Syntax

SLAX Syntax

Configuration

Step-by-Step Procedure

To download, enable, and test the script:

  1. Copy the script into a text file, name the file so-encap.xsl or so-encap.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 so-encap.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. Issue the commit command to commit the configuration.

Verification

Verifying the Configuration

Purpose

Verify that the script behaves as expected.

Action

When you issue the commit command, the commit script tests for SONET/SDH interfaces that are not configured as aggregate interfaces and sets the default encapsulation type on the nonaggregated interfaces to Cisco HDLC encapsulation. This is implemented as a transient-change. Even though the transient changes are in effect, they are not, by default, displayed in the normal output of the show interfaces command.

To view the configuration with the transient changes, issue the show interfaces | display commit-scripts command: