bgp / bgpq4

BGP Filter generator
https://github.com/bgp/bgpq4
BSD 2-Clause "Simplified" License
289 stars 42 forks source link

IOS-XR: originates-from instead of ios-regex in as-path-set. #105

Open sigurbjartur opened 7 months ago

sigurbjartur commented 7 months ago

Hey team!

Might it be possible to implement the 'originates-from' matcher instead of, or alongside the 'ios-regex' for as-path-set in IOS XR?

ios-regex based elements can be processor intensive and for peers with many prefixes it can take a long time to parse all against a large and recursive AS-SET objects.

'originates-from' is much better and, in fact recommended by Cisco. Will only match the right-most ASN instead of trying to match the entire path. Also, only takes one ASN per line.

An example might be:

as-path-set example
  originates-from '64496',
  originates-from '64497',
  originates-from '64498',
  originates-from '64499',
  originates-from '64500'
end-set

Thanks for a great tool!

job commented 7 months ago

Since what version is this available?

sigurbjartur commented 7 months ago

Hey Job!

I've only been using IOS XR since version 6.7.3 but according to the ASR9K command reference it was introduced in version 3.7.2. It's certainly available in all currently supported releases.

https://www.cisco.com/c/en/us/td/docs/routers/asr9000/software/routing/command/reference/b-routing-cr-asr9000/routing-policy-language-commands.html#wp1346673425

Also, I was rather imprecise in my original post when saying it only takes one ASN per line. If I want to filter only on the origin, that is correct but it is possible to have more than one ASN matched but then that sequence must match from the right.

The following is valid, for example:

as-path-set example
  originates-from '64496 64497',
  originates-from '64498 64499'
end-set

Althought it would match the two right-most ASNs. So if one wants to match a substring from the right, with multiple ASNs, that is possible as well. I'm not sure if it's relevant in terms of this project, but figured I'd mention it.

job commented 4 months ago

What exact invocation of bgpq4 do you use to produce as-path-sets for XR?