Discussion:
[rancid] jerancid show version parsing
Mack, David A (Dave)
2009-05-15 14:32:06 UTC
Permalink
Hello!
We are current running rancid version, rancid-2.3.2a7 and have
run into a parsing issue for JunOSE devices (ERX-1440s and E320s). It
appears that certain slots are being excluded from the parsed output of
sh version and we have a need to see those slots. Details are provided
below:

Raw output from show version:

BLTMMD-VFTTP-37#sh ver
Juniper Edge Routing Switch E320
Copyright (c) 1999-2008 Juniper Networks, Inc. All rights reserved.
System Release: e320_9-0-1p0-7-3.rel
Version: 9.0.1 patch-0.7.3 [BuildId 10622] (March 8, 2009
21:10)
System running for: 352 days, 19 hours, 13 minutes, 28 seconds
(since TUE MAY 27 2008 18:15:28 UTC)

slot state type admin spare running release slot uptime
---- -------- ------- ------- ----- -------------------- --------------
0 standby LM-10 enabled spare e320_9-0-1p0-7-3.rel ---
1 online LM-4 enabled --- e320_9-0-1p0-7-3.rel 16d08h:14m:38s
2 --- --- --- --- --- ---
3 online LM-10 enabled --- e320_9-0-1p0-7-3.rel 16d08h:00m:20s
4 --- --- --- --- --- ---
5 online LM-10 enabled --- e320_9-0-1p0-7-3.rel 16d07h:59m:56s
6 standby SRP-320 enabled --- e320_9-0-1p0-7-3.rel ---
6 online SFM-320 enabled --- --- 16d08h:31m:30s
7 online SRP-320 enabled --- e320_9-0-1p0-7-3.rel 16d08h:31m:38s
7 online SFM-320 enabled --- --- 16d08h:31m:18s
8 online SFM-320 enabled --- --- 16d08h:31m:24s
9 online SFM-320 enabled --- --- 16d08h:31m:11s
10 online SFM-320 enabled --- --- 16d08h:31m:15s
11 online LM-10 enabled spare e320_9-0-1p0-7-3.rel 10d04h:36m:12s
12 online LM-10 enabled --- e320_9-0-1p0-7-3.rel 16d07h:53m:10s
13 online LM-10 enabled --- e320_9-0-1p0-7-3.rel 16d07h:52m:17s
14 online LM-10 enabled --- e320_9-0-1p0-7-3.rel 16d08h:08m:49s
15 online LM-10 enabled --- e320_9-0-1p0-7-3.rel 16d07h:57m:12s
16 inactive LM-10 enabled --- e320_9-0-1p0-7-3.rel ---

BLTMMD-VFTTP-37#


Here is the parsed output:

!RANCID-CONTENT-TYPE: Juniper_ERX
!
!Chassis type: E320 - a Juniper Edge Routing Switch E320
!
!System Release: e320_9-0-1p0-7-3.rel
!System Version: 9.0.1 patch-0.7.3 [BuildId 10622] (March 8, 2009
21:10)
!
! slot state type admin spare running release
! ---- -------- ------- ------- ----- --------------------
! 1 online LM-4 enabled --- e320_9-0-1p0-7-3.rel
! 3 online LM-10 enabled --- e320_9-0-1p0-7-3.rel
! 5 online LM-10 enabled --- e320_9-0-1p0-7-3.rel
! 6 online SFM-320 enabled --- ---
! 7 online SRP-320 enabled --- e320_9-0-1p0-7-3.rel
! 7 online SFM-320 enabled --- ---
! 8 online SFM-320 enabled --- ---
! 9 online SFM-320 enabled --- ---
! 10 online SFM-320 enabled --- ---
! 12 online LM-10 enabled --- e320_9-0-1p0-7-3.rel
! 13 online LM-10 enabled --- e320_9-0-1p0-7-3.rel
! 14 online LM-10 enabled --- e320_9-0-1p0-7-3.rel
! 15 online LM-10 enabled --- e320_9-0-1p0-7-3.rel
!

Here is the section of code that I believe that is responsible for
parsing:

# This routine parses "show version"
sub ShowVersion {
print STDERR " In ShowVersion: $_" if ($debug);
my($slots);

while (<INPUT>) {
tr/\015//d;
last if(/^$prompt/);
next if(/^(\s*|\s*$cmd\s*)$/);
next if (/^Please wait/i);
return(-1) if (/command authorization failed/i);

/^Juniper Edge .* (\S+)$/ &&
ProcessHistory("COMMENTS","keysort","A1",
"!Chassis type: $1 - a $_") && next;
/^System Release: / &&
ProcessHistory("COMMENTS","keysort","B1", "!$_") &&
next;
/^\s+(Version: .*)$/ &&
ProcessHistory("COMMENTS","keysort","B1", "!System
$1\n") &&
next;

if (/^(slot .*)\s+slot uptime/i) {
($slots++);
ProcessHistory("COMMENTS","keysort","B2", "!\n! $1\n");
next;
}
/^(--.*) --+$/ && $slots &&
ProcessHistory("COMMENTS","keysort","B2", "! $1\n") &&
next;
if (/^(\d+ +\S+ +(\S+).*) \S+$/ && $slots) {
my($line) = $1;
if ($2 != /--+/) {
ProcessHistory("COMMENTS","keysort","B3", "! $line\n");
}
next;
}
}
ProcessHistory("COMMENTS","keysort","B4","!\n");
return(0);
}
john heasley
2009-05-15 20:29:49 UTC
Permalink
Fri, May 15, 2009 at 10:32:06AM -0400, Mack, David A (Dave):
Mack, David A (Dave)
2009-05-15 21:46:24 UTC
Permalink
John,
Hello! I applied the patch and did a manual run, but no joy!

Here is cli output:

Juniper Edge Routing Switch E320
Copyright (c) 1999-2008 Juniper Networks, Inc. All rights reserved.
System Release: e320_9-0-1p0-7-3.rel
Version: 9.0.1 patch-0.7.3 [BuildId 10622] (March 8, 2009
21:10)
System running for: 353 days, 2 hours, 34 minutes, 40 seconds
(since TUE MAY 27 2008 18:15:29 UTC)

slot state type admin spare running release slot uptime
---- -------- ------- ------- ----- -------------------- --------------
0 standby LM-10 enabled spare e320_9-0-1p0-7-3.rel ---
1 online LM-4 enabled --- e320_9-0-1p0-7-3.rel 16d15h:35m:50s
2 --- --- --- --- --- ---
3 online LM-10 enabled --- e320_9-0-1p0-7-3.rel 16d15h:21m:33s
4 --- --- --- --- --- ---
5 online LM-10 enabled --- e320_9-0-1p0-7-3.rel 16d15h:21m:09s
6 standby SRP-320 enabled --- e320_9-0-1p0-7-3.rel ---
6 online SFM-320 enabled --- --- 16d15h:52m:43s
7 online SRP-320 enabled --- e320_9-0-1p0-7-3.rel 16d15h:52m:51s
7 online SFM-320 enabled --- --- 16d15h:52m:31s
8 online SFM-320 enabled --- --- 16d15h:52m:36s
9 online SFM-320 enabled --- --- 16d15h:52m:24s
10 online SFM-320 enabled --- --- 16d15h:52m:27s
11 online LM-10 enabled spare e320_9-0-1p0-7-3.rel 10d11h:57m:24s
12 online LM-10 enabled --- e320_9-0-1p0-7-3.rel 16d15h:14m:22s
13 online LM-10 enabled --- e320_9-0-1p0-7-3.rel 16d15h:13m:30s
14 online LM-10 enabled --- e320_9-0-1p0-7-3.rel 16d15h:30m:01s
15 online LM-10 enabled --- e320_9-0-1p0-7-3.rel 16d15h:18m:24s
16 inactive LM-10 enabled --- e320_9-0-1p0-7-3.rel ---

and here is the jerancid output:

!RANCID-CONTENT-TYPE: Juniper_ERX
!
!Chassis type: E320 - a Juniper Edge Routing Switch E320
!
!System Release: e320_9-0-1p0-7-3.rel
!System Version: 9.0.1 patch-0.7.3 [BuildId 10622] (March 8, 2009
21:10)
!
! slot state type admin spare running release
! ---- -------- ------- ------- ----- --------------------
! 1 online LM-4 enabled --- e320_9-0-1p0-7-3.rel
! 3 online LM-10 enabled --- e320_9-0-1p0-7-3.rel
! 5 online LM-10 enabled --- e320_9-0-1p0-7-3.rel
! 6 online SFM-320 enabled --- ---
! 7 online SRP-320 enabled --- e320_9-0-1p0-7-3.rel
! 7 online SFM-320 enabled --- ---
! 8 online SFM-320 enabled --- ---
! 9 online SFM-320 enabled --- ---
! 10 online SFM-320 enabled --- ---
! 12 online LM-10 enabled --- e320_9-0-1p0-7-3.rel
! 13 online LM-10 enabled --- e320_9-0-1p0-7-3.rel
! 14 online LM-10 enabled --- e320_9-0-1p0-7-3.rel
! 15 online LM-10 enabled --- e320_9-0-1p0-7-3.rel

Thanks!
Dave

______________________________________________________________
David A. Mack (703) 391-7787 (W)
CCIE #6963 (SP and R&S) JNCIE-M #399 CISSP (703) 431-7617 (C)
email: ***@verizon.com
______________________________________________________________
"We are now the knights who say... Ping!"
-----Original Message-----
Sent: Friday, May 15, 2009 4:30 PM
To: Mack, David A (Dave)
Subject: Re: [rancid] jerancid show version parsing
Gino Doucet
2009-06-10 15:56:38 UTC
Permalink
Dave/John,
Not sure if you ever got this resolved but I just noticed it recently and
realized that it affects us as well. I made some further modifications to
the same line of code that John had initially attempted. However, here is
what I ended up successfully testing with:

- if (/^(\d+ +\S+ +(\S+).*) \S+$/ && $slots) {
+ if (/^(\d+ +\w+ +(\S+).*) (\S+| -+ +)$/ && $slots) {

As for the slot uptime column I would suggest against including it in your
rancid reports as it continuously changes. However, if you really want to
have it included and cause a version update every time you run rancid
against your ERX's, modify the line following the above If statement as
- my($line) = $1;
+ my($line) = $_;
Cheers,
Gino.


-----Original Message-----
From: rancid-discuss-***@shrubbery.net
[mailto:rancid-discuss-***@shrubbery.net] On Behalf Of Mack, David A
(Dave)
Sent: May 15, 2009 6:46 PM
To: john heasley
Cc: rancid-***@shrubbery.net
Subject: [rancid] Re: jerancid show version parsing

John,
Hello! I applied the patch and did a manual run, but no joy!

Here is cli output:

Juniper Edge Routing Switch E320
Copyright (c) 1999-2008 Juniper Networks, Inc. All rights reserved.
System Release: e320_9-0-1p0-7-3.rel
Version: 9.0.1 patch-0.7.3 [BuildId 10622] (March 8, 2009
21:10)
System running for: 353 days, 2 hours, 34 minutes, 40 seconds
(since TUE MAY 27 2008 18:15:29 UTC)

slot state type admin spare running release slot uptime
---- -------- ------- ------- ----- -------------------- --------------
0 standby LM-10 enabled spare e320_9-0-1p0-7-3.rel ---
1 online LM-4 enabled --- e320_9-0-1p0-7-3.rel 16d15h:35m:50s
2 --- --- --- --- --- ---
3 online LM-10 enabled --- e320_9-0-1p0-7-3.rel 16d15h:21m:33s
4 --- --- --- --- --- ---
5 online LM-10 enabled --- e320_9-0-1p0-7-3.rel 16d15h:21m:09s
6 standby SRP-320 enabled --- e320_9-0-1p0-7-3.rel ---
6 online SFM-320 enabled --- --- 16d15h:52m:43s
7 online SRP-320 enabled --- e320_9-0-1p0-7-3.rel 16d15h:52m:51s
7 online SFM-320 enabled --- --- 16d15h:52m:31s
8 online SFM-320 enabled --- --- 16d15h:52m:36s
9 online SFM-320 enabled --- --- 16d15h:52m:24s
10 online SFM-320 enabled --- --- 16d15h:52m:27s
11 online LM-10 enabled spare e320_9-0-1p0-7-3.rel 10d11h:57m:24s
12 online LM-10 enabled --- e320_9-0-1p0-7-3.rel 16d15h:14m:22s
13 online LM-10 enabled --- e320_9-0-1p0-7-3.rel 16d15h:13m:30s
14 online LM-10 enabled --- e320_9-0-1p0-7-3.rel 16d15h:30m:01s
15 online LM-10 enabled --- e320_9-0-1p0-7-3.rel 16d15h:18m:24s
16 inactive LM-10 enabled --- e320_9-0-1p0-7-3.rel ---

and here is the jerancid output:

!RANCID-CONTENT-TYPE: Juniper_ERX
!
!Chassis type: E320 - a Juniper Edge Routing Switch E320
!
!System Release: e320_9-0-1p0-7-3.rel
!System Version: 9.0.1 patch-0.7.3 [BuildId 10622] (March 8, 2009
21:10)
!
! slot state type admin spare running release
! ---- -------- ------- ------- ----- --------------------
! 1 online LM-4 enabled --- e320_9-0-1p0-7-3.rel
! 3 online LM-10 enabled --- e320_9-0-1p0-7-3.rel
! 5 online LM-10 enabled --- e320_9-0-1p0-7-3.rel
! 6 online SFM-320 enabled --- ---
! 7 online SRP-320 enabled --- e320_9-0-1p0-7-3.rel
! 7 online SFM-320 enabled --- ---
! 8 online SFM-320 enabled --- ---
! 9 online SFM-320 enabled --- ---
! 10 online SFM-320 enabled --- ---
! 12 online LM-10 enabled --- e320_9-0-1p0-7-3.rel
! 13 online LM-10 enabled --- e320_9-0-1p0-7-3.rel
! 14 online LM-10 enabled --- e320_9-0-1p0-7-3.rel
! 15 online LM-10 enabled --- e320_9-0-1p0-7-3.rel

Thanks!
Dave

______________________________________________________________
David A. Mack (703) 391-7787 (W)
CCIE #6963 (SP and R&S) JNCIE-M #399 CISSP (703) 431-7617 (C)
email: ***@verizon.com
______________________________________________________________
"We are now the knights who say... Ping!"
-----Original Message-----
Sent: Friday, May 15, 2009 4:30 PM
To: Mack, David A (Dave)
Subject: Re: [rancid] jerancid show version parsing
'john heasley'
2009-06-10 21:10:36 UTC
Permalink
Post by Gino Doucet
Dave/John,
Not sure if you ever got this resolved but I just noticed it recently and
realized that it affects us as well. I made some further modifications to
the same line of code that John had initially attempted. However, here is
- if (/^(\d+ +\S+ +(\S+).*) \S+$/ && $slots) {
+ if (/^(\d+ +\w+ +(\S+).*) (\S+| -+ +)$/ && $slots) {
As for the slot uptime column I would suggest against including it in your
rancid reports as it continuously changes. However, if you really want to
have it included and cause a version update every time you run rancid
against your ERX's, modify the line following the above If statement as
- my($line) = $1;
+ my($line) = $_;
I believe that I've already fixed this in 2.3.2.
Gino Doucet
2009-06-11 11:13:37 UTC
Permalink
Hi John,
Actually, I'm using 2.3.2a7 version of rancid but verified jerancid in the
final 2.3.2 release to be the same for this segment of code as far as I can
tell.

Cheers,
Gino.


-----Original Message-----
From: 'john heasley' [mailto:***@shrubbery.net]
Sent: June 10, 2009 6:11 PM
To: Gino Doucet
Cc: 'Mack, David A (Dave)'; rancid-***@shrubbery.net; 'john heasley'
Subject: Re: [rancid] Re: jerancid show version parsing
Post by Gino Doucet
Dave/John,
Not sure if you ever got this resolved but I just noticed it recently and
realized that it affects us as well. I made some further modifications to
the same line of code that John had initially attempted. However, here is
- if (/^(\d+ +\S+ +(\S+).*) \S+$/ && $slots) {
+ if (/^(\d+ +\w+ +(\S+).*) (\S+| -+ +)$/ && $slots) {
As for the slot uptime column I would suggest against including it in your
rancid reports as it continuously changes. However, if you really want to
have it included and cause a version update every time you run rancid
against your ERX's, modify the line following the above If statement as
- my($line) = $1;
+ my($line) = $_;
I believe that I've already fixed this in 2.3.2.
john heasley
2009-06-11 19:46:58 UTC
Permalink
Post by Gino Doucet
Hi John,
Actually, I'm using 2.3.2a7 version of rancid but verified jerancid in the
final 2.3.2 release to be the same for this segment of code as far as I can
tell.
Sorry, it didnt make it into 2.3.2. here it is:

Index: bin/jerancid.in
===================================================================
RCS file: /home/rancid/.CVS/rancid/bin/jerancid.in,v
retrieving revision 1.47
retrieving revision 1.48
diff -d -u -r1.47 -r1.48
--- bin/jerancid.in 4 Mar 2009 19:11:55 -0000 1.47
+++ bin/jerancid.in 15 May 2009 23:12:12 -0000 1.48
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
-## $Id: jerancid.in,v 1.47 2009/03/04 19:11:55 heas Exp $
+## $Id: jerancid.in,v 1.48 2009/05/15 23:12:12 heas Exp $
##
## @PACKAGE@ @VERSION@
## Copyright (c) 1997-2008 by Terrapin Communications, Inc.
@@ -193,9 +193,9 @@
}
/^(--.*) --+$/ && $slots &&
ProcessHistory("COMMENTS","keysort","B2", "! $1\n") && next;
- if (/^(\d+ +\S+ +(\S+).*) \S+$/ && $slots) {
+ if (/^(\d+\s+(\S+)\s+\S+\s+.*) \S+/ && $slots) {
my($line) = $1;
- if ($2 != /--+/) {
+ if (! ($2 =~ /--+/)) {
ProcessHistory("COMMENTS","keysort","B3", "! $line\n");
}
next;

Loading...