Cisco Systems IOS XR Laptop User Manual


 
Implementing Routing Policy on Cisco IOS XR Software
Information About Implementing Routing Policy
RC-217
Cisco IOS XR Routing Configuration Guide
if med eq 12 then
set med 42
if med eq 42 then
drop
endif
endif
This policy never executes the drop statement because the second test (med eq 42) sees the original,
unmodified value of the MED in the route. Because the MED has to be 12 to get to the second test, the
second test always returns false.
Default Drop Disposition
All route policies have a default action to drop the route under evaluation unless the route has been
modified by a policy action or explicitly passed. Applied (nested) policies implement this disposition as
though the applied policy were pasted into the point where it is applied.
Consider a policy to allow all routes in the 10 network and set their local preference to 200 while
dropping all other routes. You might write the policy as follows:
route-policy two
if destination in (10.0.0.0/8 ge 8 le 32) then
set local-preference 200
endif
end-policy
route-policy one
apply two
end-policy
It may appear that policy one drops all routes because it neither contains an explicit pass statement nor
modifies a route attribute. However, the applied policy does set an attribute for some routes and this
disposition is passed along to policy one. The result is that policy one passes routes with destinations in
network 10, and drops all others.
Control Flow
Policy statements are processed sequentially in the order in which they appear in the configuration.
Policies that hierarchically reference other policy blocks are processed as if the referenced policy blocks
had been directly substituted inline. For example, if the following policies are defined:
route-policy one
set weight 100
end-policy
route-policy two
set med 200
end-policy
route-policy three
apply two
set community (2:666) additive
end-policy
route-policy four
apply one
apply three
pass
end-policy