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-364
Cisco IOS XR Routing Configuration Guide
OL-14356-01
You may have as many levels of hierarchy as desired. However, many levels may be difficult to maintain
and understand.
Parameterization
In addition to supporting reuse of policies using the apply statement, policies can be defined that allow
for parameterization of some of the attributes. The following example shows how to define a
parameterized policy named param-example. In this case, the policy takes one parameter, $mytag.
Parameters always begin with a dollar sign and consist otherwise of any alphanumeric characters.
Parameters can be substituted into any attribute that takes a parameter.
In the following example, a 16-bit community tag is used as a parameter:
route-policy param-example ($mytag)
set community (1234:$mytag) additive
end-policy
This parameterized policy can then be reused with different parameterization, as shown in the following
example. In this manner, policies that share a common structure but use different values in some of their
individual statements can be modularized. For details on which attributes can be parameterized, see the
individual attribute sections.
route-policy origin-10
if as-path originates-from ‘10.5’ then
apply param-example(10.5)
else
pass
endif
end-policy
route-policy origin-20
if as-path originates-from ‘20.5’ then
apply param-example(20.5)
else
pass
endif
end-policy
The parameterized policy param-example provides a policy definition that is expanded with the values
provided as the parameters in the apply statement. Note that the policy hierarchy is always maintained,
Thus, if the definition of param-example changes, then the behavior of origin_10 and origin_20 changes
to match.
The effect of the origin-10 policy is that it adds the community 1234:10 to all routes that pass through
this policy and have an AS path indicating the route originated from autonomous system 10. The
origin-20 policy is similar except that it adds to community 1234:20 for routes originating from
autonomous system 20.
Parameterization at Attach Points
In addition to supporting parameterization using the apply statement described in the “Parameterization”
section on page RC-364, policies can also be defined that allow for parameterization of some of the
attributes at attach points. Parameterization at BGP neighbor inbound and neighbor outbound attach
points is supported.