[j-nsp] Regular expressions in CLI.
Eric Van Tol
eric@atlantech.net
Mon, 2 Sep 2002 14:35:35 -0400
I replied off-list, but in case anyone else needs this answer, I've
found the following to work in this situation (5.4R1.4):
show route as-path-regex "1299 [1-64511]{1,20}" | match \*
This shows all prefixes that start with 1299 and then have 1 through 20
instances of any non-reserved ASN after that. =20
This seems to work in my case...if anyone sees anything wrong with this,
please let us know.
evt
-----Original Message-----
From: David Martinez CSIC RedIRIS [mailto:david.martinez@rediris.es]=20
Sent: Monday, September 02, 2002 12:46 PM
To: juniper-nsp@puck.nether.net
Subject: [j-nsp] Regular expressions in CLI.
Hello. I'm trying to count all the active prefixes from one
particular AS.=20
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=20
hidden)
+ =3D Active Route, - =3D Last Active, * =3D Both
3.0.0.0/8 [BGP/150] 1w4d 09:56:52, localpref 100, from=20
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=20
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=20
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=20
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=20
'match':
ender@dub1> show route aspath-regex ^1299.* | match (\+|\*)
^
syntax error.
Nice error. I've tried nearly all the possible combinations of \
and (\). But=20
something is happening with the supposed regular expression, because a
simple
whatever | match '(A|B)'
or=20
whatever | match (A|B)
gives errors as well.
http://www.juniper.net/techpubs/software/junos52/swcmdref52/html/cli-ove
rview-cmdref9.html#1014458=20
claims that match accepts extended (modern) regular expressions. The
above=20
one works with perl, but not in the router.
And another problem: the amount of time that the above command
spends is not=20
negligible. In fact, is terribly _big_ (I'm trying to get periodic stats
of=20
active prefixes per AS). Is there any other way to do it? I've not seen
any=20
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=20
between REs, should I open a PR, or go directly to support@juniper.net,
or=20
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
_______________________________________________
juniper-nsp mailing list juniper-nsp@puck.nether.net
http://puck.nether.net/mailman/listinfo/juniper-nsp