Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Example: Assign a Classifier Using a Commit Script

For each interface configured with the IPv4 protocol family, this commit script automatically assigns a specified classifier, which associates incoming packets with a forwarding class and loss priority as well as assigns packets to an output queue.

Requirements

This example uses a device running Junos OS.

Overview and Commit Script

In the Junos OS class of service (CoS), classifiers allow you to associate incoming packets with a forwarding class and loss priority and, based on the associated forwarding class, assign packets to output queues. After you configure a classifier, you must assign it to an input interface.

For each interface configured with the IPv4 protocol family, this script automatically assigns a specified classifier called fc-q3. The fc-q3 classifier must be configured at the [edit class-of-service] hierarchy level.

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

XSLT Syntax

SLAX Syntax

Configuration

Procedure

Step-by-Step Procedure

To download, enable, and test the script:

  1. Copy the script into a text file, name the file classifier.xsl or classifier.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 classifier.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.

Verification

Verifying the Configuration

Purpose

Verify that the script behaves as expected.

Action

Review the output of the commit command. In the test configuration stanzas, the fe-0/0/0.0 interface is configured with the family inet statement. Because the interface is configured with the IPv4 protocol family, the script automatically assigns the fc-q3 classifier to the interface, which is indicated in the commit command output.

View the configuration to verify that the script-generated changes are present. Issue the show class-of-service configuration mode command. The output shows that the fe-0/0/0.0 interface has been assigned the fc-q3 classifier: