[c-nsp] IOS-XR RPL parameters

Jason Lixfeld jason at lixfeld.ca
Fri Dec 9 16:11:39 EST 2016


Hi there,

I’m trying to write some community-matching RPL, and I’m wondering if anyone has any interesting tricks to using parameters. 

I’d like to match a bit within the community and do stuff based on a match.  For example, 1234:60xx (where x = 00-99), match on x and do stuff.

.. It seems I can't insert a parameter in-line of a community:

RP/0/0/CPU0:xr(config-rpl)#if community matches-any ( 1234:600$foo ) then
                                                              ^
% Invalid input detected at '^' marker.
RP/0/0/CPU0:xr(config-rpl)#

.. I can’t use a range in-line of a community (unless it’s the entire left or right half of the community):

RP/0/0/CPU0:xr(config-rpl)#if community matches-any ( 1234:600[0..9] ) then
                                                              ^
% Invalid input detected at '^' marker.
RP/0/0/CPU0:xr(config-rpl)#if community matches-any ( 1234:[6000..6009] ) then
RP/0/0/CPU0:xr(config-rpl-if)#

.. But in the [6000..6009] range case, that doesn’t really buy me anything because I still need to find a way to do a more specific match on the bit that I’m interested in, so I’d have to do something totally analog:


RP/0/0/CPU0:xr(config-rpl-if)#if community matches-any ( 1234:6000 ) then
RP/0/0/CPU0:xr(config-rpl-if)#set stuff..
RP/0/0/CPU0:xr(config-rpl-if)#elseif
RP/0/0/CPU0:xr(config-rpl-if)#if community matches-any ( 1234:6001 ) then
RP/0/0/CPU0:xr(config-rpl-if)#apply stuff..
RP/0/0/CPU0:xr(config-rpl-if)#elseif
..
RP/0/0/CPU0:xr(config-rpl-if)#if community matches-any ( 1234:6099 ) then
RP/0/0/CPU0:xr(config-rpl-if)#apply stuff..
RP/0/0/CPU0:xr(config-rpl-if)#elseif
..

.. So unless there are some tricks that I don’t quite get, are RPL parameters not best suited for arbitrary bit matching and better suited to more exact matching based on word boundaries where something like this is as close as I’m going to get?

RP/0/0/CPU0:xr(config-rpl)#if community matches-any (1234:$poo) then
RP/0/0/CPU0:xr(config-rpl-if)#set local-preference $foo

Thanks for any insight.


More information about the cisco-nsp mailing list