Related Documentation
- ACX, EX, J, M, MX, PTX, T Series
- Creating a Junos Configuration Group
- Understanding the Junos Configuration Groups
- EX, J, M, MX, PTX, T Series
- Selecting Wildcard Names
- EX, M, MX, PTX, T Series
- Applying a Junos Configuration Group
Using Wildcards with Configuration Groups
You can use wildcards to identify names and allow one statement to provide data for a variety of statements. For example, grouping the configuration of the sonet-options statement over all SONET/SDH interfaces or the dead interval for OSPF over all Asynchronous Transfer Mode (ATM) interfaces simplifies configuration files and eases their maintenance.
Using wildcards in normal configuration data is done in a style that is consistent with that used with traditional UNIX shell wildcards. In this style, you can use the following metacharacters:
- Asterisk ( * )—Matches any string of characters.
- Question mark ( ? )—Matches any single character.
- Open bracket ( [ )—Introduces a character class.
- Close bracket ( ] )—Indicates the end of a character class. If the close bracket is missing, the open bracket matches a [ rather than introduce a character class.
- A character class matches any of the characters between the square brackets. Within a configuration group, an interface name that includes a character class must be enclosed in quotation marks.
- Hyphen ( - )—Specifies a range of characters.
- Exclamation point ( ! )—The character class can be complemented by making an exclamation point the first character of the character class. To include a close bracket (]) in a character class, make it the first character listed (after the !, if any). To include a minus sign, make it the first or last character listed.
Wildcarding in configuration groups follows the same rules, but any term using a wildcard pattern must be enclosed in angle brackets <pattern> to differentiate it from other wildcarding in the configuration file.
Wildcard expressions match (and provide configuration data for) existing statements in the configuration that match their expression only. In the previous example, the expression <so-*> passes its sonet-options statement to any interface that matches the expression so-*.
The following example shows how to specify a range of interfaces:
Angle brackets allow you to pass normal wildcarding through without modification. In any matching within the configuration, whether it is done with or without wildcards, the first item encountered in the configuration that matches is used. In the following example, data from the wildcarded BGP groups is inherited in the order in which the groups are listed. The preference value from <*a*> overrides the preference in <*b*>, just as the p value from <*c*> overrides the one from <*d*>. Data values from any of these groups override the data values from abcd.
Related Documentation
- ACX, EX, J, M, MX, PTX, T Series
- Creating a Junos Configuration Group
- Understanding the Junos Configuration Groups
- EX, J, M, MX, PTX, T Series
- Selecting Wildcard Names
- EX, M, MX, PTX, T Series
- Applying a Junos Configuration Group
Published: 2013-02-22
Related Documentation
- ACX, EX, J, M, MX, PTX, T Series
- Creating a Junos Configuration Group
- Understanding the Junos Configuration Groups
- EX, J, M, MX, PTX, T Series
- Selecting Wildcard Names
- EX, M, MX, PTX, T Series
- Applying a Junos Configuration Group