Cisco Systems OL-14356-01 Network Router User Manual


 
Implementing Routing Policy on Cisco IOS XR Software
Information About Implementing Routing Policy on Cisco IOS XR Software
RC-356
Cisco IOS XR Routing Configuration Guide
OL-14356-01
Sets
In this context, the term set is used in its mathematical sense to mean an unordered collection of unique
elements. The policy language provides sets as a container for groups of values for matching purposes.
Sets are used in conditional expressions. The elements of the set are separated by commas. Null (empty)
sets are allowed.
In the following example:
prefix-set backup-routes
# currently no backup routes are defined
end-set
a condition such as:
if destination in backup-routes then
evaluates as FALSE for every route, because there is no match-condition in the prefix set that it satisfies.
Five kinds of sets exist: as-path-set, community-set, extcommunity-set, prefix-set, and rd-set. You may
want to perform comparisons against a small number of elements, such as two or three community
values, for example. To allow for these comparisons, the user can enumerate these values directly. These
enumerations are referred to as inline sets. Functionally, inline sets are equivalent to named sets, but
allow for simple tests to be inline. Thus, comparisons do not require that a separate named set be
maintained when only one or two elements are being compared. See the set types described in the
following sections for the syntax. In general, the syntax for an inline set is a comma-separated list
surrounded by parentheses as follows: (element-entry,element-entry,element-entry, ...element-entry),
where element-entry is an entry of an item appropriate to the type of usage such as a prefix or a
community value.
The following is an example using an inline community set:
route-policy sample-inline
if community matches-any ([10..15]:100) then
set local-preference 100
endif
end-policy
The following is an equivalent example using the named set test-communities:
community-set test-communities
10:100,
11:100,
12:100,
13:100,
14:100,
15:100
end-set
route-policy sample
if community matches-any test-communities then
set local-preference 100
endif
end-policy
Both of these policies are functionally equivalent, but the inline form does not require the configuration
of the community set just to store the six values. You can choose the form appropriate to the
configuration context. In the following sections, examples of both the named set version and the inline
form are provided where appropriate.