[c-nsp] cisco regex puzzle of the day

Nick Hilliard nick at foobar.org
Wed Mar 11 17:55:25 EDT 2015


On 11/03/2015 17:46, Jared Mauch wrote:
> 	In IOS-XR you can much more easily match against the origin-asn
> in a policy as well which isn't quite as easy in other routing operating
> systems.

this is the fundamental issue: ios/ios-xe policy management grammar is
unfit for purpose.  A subset of this problem is that regexps are a bizarre
hack for handling what are basically integer sequences.

Probably what Job wants to do could be handled in bird like this (totally
untested, i.e. it probably won't even pass a basic syntax check, but you
get the idea):

> filter check_downstreams
> int theirasn;
> {
>     if (bgp_path.first != theirasn) then
>         reject;
> 
>     if (bgp_path.last = theirasn) then
>         reject;
> 
>     accept;
> }

i.e. integer comparisons all the way and logic which is so clear that
anyone can understand it - even if they've never seen this style of syntax
before.  Being forced to create and debug IOS style line noise in 2015
involves a distressing level of fail.

Nick



More information about the cisco-nsp mailing list