[c-nsp] IOS-XR RPL parameters

Jason Lixfeld jason at lixfeld.ca
Sun Dec 11 07:58:10 EST 2016


Hi James,

> On Dec 9, 2016, at 6:16 PM, James Jun <james at towardex.com> wrote:
> 
> Hey,
> 
> On Fri, Dec 09, 2016 at 04:11:39PM -0500, Jason Lixfeld wrote:
>> RP/0/0/CPU0:xr(config-rpl)#if community matches-any ( 1234:600[0..9] ) then
> 
> You will need to use regex with community-set for that:
> 
> !
> community-set a-all-net
> ios-regex '^64552:5...$'
> end-set
> !
> route-policy test
> if community matches-any a-all-net then
>   # do stuff here
>   done
> endif
> end-policy
> !

Ok, I see that.  However, I'm trying to match on the community, and also use the wildcard within the matched community as a variable for the subsequent set operation(s).  I recognize that my original post may not have clearly articulated that.

So for example, one simple entry for a bunch of possible matches:

!
route-policy test
 if community matches-any ( ios-regex ‘^64552:123.$’ ) then
  set med $wildcard
  set local-preference $wildcard
  prepend as—path 1234 $wildcard
  done
 endif
end-policy
!

Where,

If matched community was 64552:1231, then med = 1, local-preference = 1, prepend 1 times.
If matched community was 64552:1232, then med = 2, local-preference = 2, prepend 2 times.
If matched community was 64552:1233, then med = 3, local-preference = 3, prepend 3 times.
...
If matched community was 64552:1239, then med = 9, local-preference = 9, prepend 9 times.

It seems that if this function is not possible, I’m relegated to the long form of that?:

!
route-policy test
 if community matches-any ( ios-regex ‘^64552:1231’ ) then
  set med 1
  set local-preference 1
  prepend as—path 64552 1
 elseif community matches-any ( ios-regex ‘^64552:1232’ ) then
  set med 2
  set local-preference 2
  prepend as—path 64552 2
 elseif community matches-any ( ios-regex ‘^64552:1233’ ) then
  set med 3
  set local-preference 3
  prepend as—path 64552 3
 ..
 elseif community matches-any ( ios-regex ‘^64552:1239’ ) then
  set med 9
  set local-preference 9
  prepend as—path 64552 9
 endif
end-policy
!

Thanks!


More information about the cisco-nsp mailing list