cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
321
Views
0
Helpful
1
Replies
Ratheesh mv
Beginner

IOS-XR RPL

As per documentation , the "pass" definition is the route is assigned a ticket to pass the default drop , processing continues through additional RPL statement .

I have configured below RPL :-  

 

route-policy test
if destination in (10.0.0.0/8) then
pass
else
if destination in (10.0.0.0/8) then
drop
else
pass
endif
endif
end-policy

As per definition ,10.0.0.0/8  must be dropped as per second if statement but it is not being dropped .If I use endif statement in between  1st and 2nd  if statement 10.0.0.0/8 is being dropped.

I would like to know that how does endif and else statement behaves ?

 

Thanks in advance   

1 ACCEPTED SOLUTION

Accepted Solutions
smilstea
Cisco Employee

Here is how your statement reads:

 

if destination in 10.0.0.0/8:

    pass

else:

    if destination in 10.0.0.0/8:

        drop

    else:

       pass

 

So since your route matches the first if statement we will not process any conditions under the else.

 

The reason why using an endif between if statements works is because you are closing the if conditions of the first if statement and starting a new if statement, not an else statement. We will process each if statement at the highest level, typically this is used for different route manipulations such as pass, local-preference, or any other attributes we want to set based on different conditions of the route. Here because you have the same if statement twice at the same level the first if statement says pass but then the second if statement says drop and overrides the first if statements action.

 

 

Sam

View solution in original post

1 REPLY 1
smilstea
Cisco Employee

Here is how your statement reads:

 

if destination in 10.0.0.0/8:

    pass

else:

    if destination in 10.0.0.0/8:

        drop

    else:

       pass

 

So since your route matches the first if statement we will not process any conditions under the else.

 

The reason why using an endif between if statements works is because you are closing the if conditions of the first if statement and starting a new if statement, not an else statement. We will process each if statement at the highest level, typically this is used for different route manipulations such as pass, local-preference, or any other attributes we want to set based on different conditions of the route. Here because you have the same if statement twice at the same level the first if statement says pass but then the second if statement says drop and overrides the first if statements action.

 

 

Sam

View solution in original post