Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation

Example: Configuring Conditions for Applying Configuration Groups

This example shows how to configure conditions under which a specified configuration group is to be applied.

Requirements

No special configuration beyond device initialization is required before you configure this example.

Overview

You can configure your group configuration data at the [edit groups group-name] hierarchy level, then use the when statement to have the group applied based on conditions including: type of chassis, model, or routing-engine, virtual chassis member, cluster node, and start and optional end time of day or date.

If you specify multiple conditions in a single configuration group, all conditions must be met before the configuration group is applied.

You can specify the start time or the time duration for the configuration group to be applied. If only the start time is specified, the configuration group is applied at the specified time and it remains in effect until the time is changed. If the end time is specified, then on each day, the applied configuration group is started and stopped at the specified times.

This example sets conditions in a configuration group, test1, such that this group is applied only when all of the following conditions are met: the router is a model MX240 router with chassis type LCC0, with a Routing Engine operating as RE0, is member0 of the virtual chassis on node0, and the configuration group will only be in effect from 9:00 a.m. until 5:00 p.m. each day. The configuration data has not yet been added to the test1 group in this example.

Configuration

CLI Quick Configuration

To quickly configure this example, copy the following commands, paste them into a text file, remove any line breaks, change any details necessary to match your network configuration, and then copy and paste the commands into the CLI at the [edit] hierarchy level.

set groups test1 when model mx240 set groups test1 when chassis lcc0 set groups test1 when routing-engine re0 set groups test1 when member member0 set groups test1 when node node0 set groups test1 when time 9 to 5

Step-by-Step Procedure

The following example requires you to navigate various levels in the configuration hierarchy. For information about navigating the CLI, see Using the CLI Editor in Configuration Mode in the CLI User Guide.

To configure conditions for configuration group test1:

  1. Set the condition that identifies the model MX240 router.
    [edit groups test1 when]user@host# set model mx240
  2. Set the condition that identifies the chassis type as LCC0.
    [edit groups test1 when]user@host# set chassis lcc0
  3. Set the condition that identifies the Routing Engine operating as RE0.
    [edit groups test1 when]user@host# set routing-engine re0
  4. Set the condition that identifies the virtual chassis member0.
    [edit groups test1 when]user@host# set member member0
  5. Set the condition that identifies the cluster node0.
    [edit groups test1 when]user@host# set node node0
  6. Set the condition that applies the group only between the hours of 9:00 a.m. and 5:00 p.m. daily.
    [edit groups test1 when]user@host# set time 9 to 5

    Note: The syntax for specifying the time is: time <start-time> [to <end-time>] using the time format yyyy-mm-dd.hh:mm, hh:mm, or hh.

  7. Commit the configuration.

Results

From configuration mode, confirm your configuration by entering the show groups command. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration.

user@host# show groups test1
when { time 9 to 5; chassis lcc0; model mx240; routing-engine re0; member member0; node node0; }

Verification

Confirm that the configuration is working properly.

Checking Group Inheritance with Conditional Data

Purpose

Verify that conditional data from a configuration group is inherited when applied.

Action

The show | display inheritance operational command can be issued with the when data to display the conditional inheritance. Using this example, you could issue one of these commands to determine that the conditional data was inherited:

user@host> show | display inheritance when model mx240 user@host> show | display inheritance when chassis lcc0 user@host> show | display inheritance when routing-engine re0 user@host> show | display inheritance when member member0 user@host> show | display inheritance when node node0 user@host> show | display inheritance when time 9 to 5

Published: 2013-02-22