[j-nsp] Regular expressions in CLI.
David Martinez CSIC RedIRIS
david.martinez@rediris.es
Mon, 2 Sep 2002 18:46:01 +0200
Hello. I'm trying to count all the active prefixes from one particular AS.
Aside from the quantity of time spent doing the query, I cannot set up a
proper regexp for filtering the active prefixes:
ender@dub1> show route aspath-regex ^1299.*
inet.0: 114313 destinations, 226204 routes (114302 active, 11 holddown, 0
hidden)
+ = Active Route, - = Last Active, * = Both
3.0.0.0/8 [BGP/150] 1w4d 09:56:52, localpref 100, from
130.206.206.249
AS path: 1299 1239 80 I
> to 130.206.220.1 via ge-1/1/0.0
3.210.36.0/24 [BGP/150] 1w4d 09:56:48, localpref 100, from
130.206.206.249
AS path: 1299 3549 I
> to 130.206.220.1 via ge-1/1/0.0
4.0.0.0/8 [BGP/150] 1w4d 09:56:48, localpref 100, from
130.206.206.249
AS path: 1299 1 I
> to 130.206.220.1 via ge-1/1/0.0
4.22.240.0/21 [BGP/150] 1w4d 09:56:50, localpref 100, from
130.206.206.249
AS path: 1299 1 7843 I
> to 130.206.220.1 via ge-1/1/0.0
[blablabla]
But active prefixes _have_ * or + before the [BGP/... string, so with a
'match':
ender@dub1> show route aspath-regex ^1299.* | match (\+|\*)
^
syntax error.
Nice error. I've tried nearly all the possible combinations of \ and (\). But
something is happening with the supposed regular expression, because a simple
whatever | match '(A|B)'
or
whatever | match (A|B)
gives errors as well.
http://www.juniper.net/techpubs/software/junos52/swcmdref52/html/cli-overview-cmdref9.html#1014458
claims that match accepts extended (modern) regular expressions. The above
one works with perl, but not in the router.
And another problem: the amount of time that the above command spends is not
negligible. In fact, is terribly _big_ (I'm trying to get periodic stats of
active prefixes per AS). Is there any other way to do it? I've not seen any
MIB for doing that with SNMP, and don't think that JunOScript makes much
better (thinking about XML overhead, for example). Am I wrong?
Thanks in advance for your help,
David.
PS: For the Juniper guys in the list: I've found a bug in JunOS with the copy
between REs, should I open a PR, or go directly to support@juniper.net, or
contact with my equipment provider for opening the case through them?
--
Why is a cow? Mu. (Ommmmmmmmmm)
--
Servicios de red - Network services
Centro de Comunicaciones CSIC/RedIRIS
Spanish Academic Network for Research and Development
Madrid (Spain)
Tlf (+34) 91.585.49.05