Re: [rancid] Juniper SRX cluster {primary:nodeX}, {secondary:nodeX} filtering

2019-02-12 Thread Anderson, Charles R
The ShowSystemCoreDumps function was missing this filter.  I updated the patch 
to add this.

On Tue, Feb 12, 2019 at 11:56:31PM +, Anderson, Charles R wrote:
> I'm using the "juniper" type on RANCID 3.9 collecting from Juniper EX/QFX/MX 
> devices and SRX clusters.  On the EX/QFX/MX devices the {master:N} and 
> {backup:N} first line of the prompt (related to RE redundancy) is filtered 
> out.  But on the SRX clusters, they use a different type of clustering 
> compared with MX/EX, and the first line of the prompt there has 
> {primary:node0}, {secondary:node1} etc.  Additionlly, it is possible for 
> {linecard:X) to appear there for non-RE members of a EX/QFX Virtual Chassis.  
> For many years we've been using a local change to RANCID that filters out 
> these with code such as:
> 
>next if (/^\{(master|backup|primary|secondary)/);
> 
> I'd like to get this changed upstream so we no longer have to use our local 
> customizations.  Would you consider a patch similar to below (applied 
> everywhere master|backup is already filtered):
> 
> -   next if (/^\{(master|backup)(:\d+)?\}/);
> +   next if 
> (/^\{(master|backup|linecard|primary|secondary)(:(node)?\d+)?\}/);
> 
> I've attached the entire patch against 3.9 which I've tested with all my 
> EX/QFX/MX/SRX devices.  Thanks.
--- junos.pm.orig   2019-02-06 02:03:28.0 -0500
+++ junos.pm2019-02-12 21:16:55.165617409 -0500
@@ -150,7 +150,7 @@
tr/\015//d;
last if (/^$prompt/);
next if (/^system (shutdown message from|going down )/i);
-   next if (/^\{(master|backup)(:\d+)?\}/);
+   next if 
(/^\{(master|backup|linecard|primary|secondary)(:(node)?\d+)?\}/);
 
/error: the chassis(-control)? subsystem is not r/ && return(-1);
/Couldn\'t initiate connection/ && return(-1);
@@ -194,7 +194,7 @@
last if (/^$prompt/);
return 1 if (/^aborted!/i);
next if (/^system (shutdown message from|going down )/i);
-   next if (/^\{(master|backup)(:\d+)?\}/);
+   next if 
(/^\{(master|backup|linecard|primary|secondary)(:(node)?\d+)?\}/);
 
/error: the chassis(-control)? subsystem is not r/ && return(-1);
/Couldn\'t initiate connection/ && return(-1);
@@ -231,7 +231,7 @@
last if (/^$prompt/);
return(1) if (/^aborted!/i);
next if (/^system (shutdown message from|going down )/i);
-   next if (/^\{(master|backup)(:\d+)?\}/);
+   next if 
(/^\{(master|backup|linecard|primary|secondary)(:(node)?\d+)?\}/);
 
return(0) if ($junos::ShowChassisFirmware);
/error: the chassis(-control)? subsystem is not r/ && return(-1);
@@ -259,7 +259,7 @@
last if (/^$prompt/);
return 1 if (/^aborted!/i);
next if (/^system (shutdown message from|going down )/i);
-   next if (/^\{(master|backup)(:\d+)?\}/);
+   next if 
(/^\{(master|backup|linecard|primary|secondary)(:(node)?\d+)?\}/);
 
/error: the chassis(-control)? subsystem is not r/ && return(-1);
/Couldn\'t initiate connection/ && return(-1);
@@ -288,7 +288,7 @@
last if (/^$prompt/);
return 1 if (/^aborted!/i);
next if (/^system (shutdown message from|going down )/i);
-   next if (/^\{(master|backup)(:\d+)?\}/);
+   next if 
(/^\{(master|backup|linecard|primary|secondary)(:(node)?\d+)?\}/);
 
/error: the chassis(-control)? subsystem is not r/ && return(-1);
/Couldn\'t initiate connection/ && return(-1);
@@ -314,7 +314,7 @@
tr/\015//d;
last if (/^$prompt/);
next if (/^system (shutdown message from|going down )/i);
-   next if (/^\{(master|backup)(:\d+)?\}/);
+   next if 
(/^\{(master|backup|linecard|primary|secondary)(:(node)?\d+)?\}/);
 
/error: the chassis(-control)? subsystem is not r/ && return(-1);
/Couldn\'t initiate connection/ && return(-1);
@@ -348,7 +348,7 @@
tr/\015//d;
last if (/^$prompt/);
next if (/^system (shutdown message from|going down )/i);
-   next if (/^\{(master|backup)(:\d+)?\}/);
+   next if 
(/^\{(master|backup|linecard|primary|secondary)(:(node)?\d+)?\}/);
 
return(0) if ($junos::ShowChassisSCB);
/error: the chassis(-control)? subsystem is not r/ && return(-1);
@@ -382,7 +382,7 @@
tr/\015//d;
last if (/^$prompt/);
next if (/^system (shutdown message from|going down )/i);
-   next if (/^\{(master|backup)(:\d+)?\}/);
+   next if 
(/^\{(master|backup|linecard|primary|secondary)(:(node)?\d+)?\}/);
 
/Unrecognized command/ && return(1);
/command is not valid/ && return(1);
@@ -405,7 +405,7 @@
tr/\015//d;
last if (/^$prompt/);
next if (/^system (shutdown message from|going down )/i);
-   next if (/^\{(master|backup)(:\d+)?\}/);
+   next if 
(/^\{(master|backup|linecard|primary|secondary)(:(node)?\d+)?\}/);
 
/Unrecognized command/ && return(1);
/command is not valid/ && 

[rancid] Juniper SRX cluster {primary:nodeX}, {secondary:nodeX} filtering

2019-02-12 Thread Anderson, Charles R
I'm using the "juniper" type on RANCID 3.9 collecting from Juniper EX/QFX/MX 
devices and SRX clusters.  On the EX/QFX/MX devices the {master:N} and 
{backup:N} first line of the prompt (related to RE redundancy) is filtered out. 
 But on the SRX clusters, they use a different type of clustering compared with 
MX/EX, and the first line of the prompt there has {primary:node0}, 
{secondary:node1} etc.  Additionlly, it is possible for {linecard:X) to appear 
there for non-RE members of a EX/QFX Virtual Chassis.  For many years we've 
been using a local change to RANCID that filters out these with code such as:

   next if (/^\{(master|backup|primary|secondary)/);

I'd like to get this changed upstream so we no longer have to use our local 
customizations.  Would you consider a patch similar to below (applied 
everywhere master|backup is already filtered):

-   next if (/^\{(master|backup)(:\d+)?\}/);
+   next if 
(/^\{(master|backup|linecard|primary|secondary)(:(node)?\d+)?\}/);

I've attached the entire patch against 3.9 which I've tested with all my 
EX/QFX/MX/SRX devices.  Thanks.
--- junos.pm.orig   2019-02-06 02:03:28.0 -0500
+++ junos.pm2019-02-12 18:52:19.073192943 -0500
@@ -150,7 +150,7 @@
tr/\015//d;
last if (/^$prompt/);
next if (/^system (shutdown message from|going down )/i);
-   next if (/^\{(master|backup)(:\d+)?\}/);
+   next if 
(/^\{(master|backup|linecard|primary|secondary)(:(node)?\d+)?\}/);
 
/error: the chassis(-control)? subsystem is not r/ && return(-1);
/Couldn\'t initiate connection/ && return(-1);
@@ -194,7 +194,7 @@
last if (/^$prompt/);
return 1 if (/^aborted!/i);
next if (/^system (shutdown message from|going down )/i);
-   next if (/^\{(master|backup)(:\d+)?\}/);
+   next if 
(/^\{(master|backup|linecard|primary|secondary)(:(node)?\d+)?\}/);
 
/error: the chassis(-control)? subsystem is not r/ && return(-1);
/Couldn\'t initiate connection/ && return(-1);
@@ -231,7 +231,7 @@
last if (/^$prompt/);
return(1) if (/^aborted!/i);
next if (/^system (shutdown message from|going down )/i);
-   next if (/^\{(master|backup)(:\d+)?\}/);
+   next if 
(/^\{(master|backup|linecard|primary|secondary)(:(node)?\d+)?\}/);
 
return(0) if ($junos::ShowChassisFirmware);
/error: the chassis(-control)? subsystem is not r/ && return(-1);
@@ -259,7 +259,7 @@
last if (/^$prompt/);
return 1 if (/^aborted!/i);
next if (/^system (shutdown message from|going down )/i);
-   next if (/^\{(master|backup)(:\d+)?\}/);
+   next if 
(/^\{(master|backup|linecard|primary|secondary)(:(node)?\d+)?\}/);
 
/error: the chassis(-control)? subsystem is not r/ && return(-1);
/Couldn\'t initiate connection/ && return(-1);
@@ -288,7 +288,7 @@
last if (/^$prompt/);
return 1 if (/^aborted!/i);
next if (/^system (shutdown message from|going down )/i);
-   next if (/^\{(master|backup)(:\d+)?\}/);
+   next if 
(/^\{(master|backup|linecard|primary|secondary)(:(node)?\d+)?\}/);
 
/error: the chassis(-control)? subsystem is not r/ && return(-1);
/Couldn\'t initiate connection/ && return(-1);
@@ -314,7 +314,7 @@
tr/\015//d;
last if (/^$prompt/);
next if (/^system (shutdown message from|going down )/i);
-   next if (/^\{(master|backup)(:\d+)?\}/);
+   next if 
(/^\{(master|backup|linecard|primary|secondary)(:(node)?\d+)?\}/);
 
/error: the chassis(-control)? subsystem is not r/ && return(-1);
/Couldn\'t initiate connection/ && return(-1);
@@ -348,7 +348,7 @@
tr/\015//d;
last if (/^$prompt/);
next if (/^system (shutdown message from|going down )/i);
-   next if (/^\{(master|backup)(:\d+)?\}/);
+   next if 
(/^\{(master|backup|linecard|primary|secondary)(:(node)?\d+)?\}/);
 
return(0) if ($junos::ShowChassisSCB);
/error: the chassis(-control)? subsystem is not r/ && return(-1);
@@ -382,7 +382,7 @@
tr/\015//d;
last if (/^$prompt/);
next if (/^system (shutdown message from|going down )/i);
-   next if (/^\{(master|backup)(:\d+)?\}/);
+   next if 
(/^\{(master|backup|linecard|primary|secondary)(:(node)?\d+)?\}/);
 
/Unrecognized command/ && return(1);
/command is not valid/ && return(1);
@@ -405,7 +405,7 @@
tr/\015//d;
last if (/^$prompt/);
next if (/^system (shutdown message from|going down )/i);
-   next if (/^\{(master|backup)(:\d+)?\}/);
+   next if 
(/^\{(master|backup|linecard|primary|secondary)(:(node)?\d+)?\}/);
 
/Unrecognized command/ && return(1);
/command is not valid/ && return(1);
@@ -431,7 +431,7 @@
tr/\015//d;
($found_end = 1, last) if (/^$prompt/);
next if (/^system (shutdown message from|going down )/i);
-   next if