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.000000000 -0500
+++ junos.pm    2019-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 (/^\{(master|backup)(:\d+)?\}/);
+       next if 
(/^\{(master|backup|linecard|primary|secondary)(:(node)?\d+)?\}/);
 
        /Unrecognized command/ && return(0);
        /command is not valid/ && return(0);
@@ -480,7 +480,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+)?\}/);
 
        # licenses used changes constantly.  distill it to a percentage.
        # example input:
@@ -534,7 +534,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);
@@ -557,7 +557,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);
@@ -587,7 +587,7 @@
        return -1 if (/select: protocol failure /i);    # fail sending cmd
        next if (/^\s*$/);
        next if (/^system (shutdown message from|going down )/i);
-       next if (/^\{(master|backup)(:\d+)?\}/);
+       next if 
(/^\{(master|backup|linecard|primary|secondary)(:(node)?\d+)?\}/);
        /error: abnormal communication termination with / && return(-1);
        /error: could not connect to \S+ : no route to host/i && return(-1);
 
@@ -621,8 +621,7 @@
        }
        next if (/^system (shutdown message from|going down )/i);
        next if (/^## last commit: /i);
-       next if (/^\{(master|backup)(:\d+)?\}/);
-       next if (/^\{(primary|secondary)(:\d+)?\}/);
+       next if 
(/^\{(master|backup|linecard|primary|secondary)(:(node)?\d+)?\}/);
        $lines++;
 
        /^database header mismatch: / && return(-1);
_______________________________________________
Rancid-discuss mailing list
Rancid-discuss@shrubbery.net
http://www.shrubbery.net/mailman/listinfo/rancid-discuss

Reply via email to