Re: [rancid] paloalto feedback in current alpha [was: Re: clogin commenting script commands following multiple blanks lines]

2018-11-05 Thread heasley
Fri, Oct 26, 2018 at 06:24:10PM -0400, Erik Muller:
> On 10/24/18 18:32 , heasley wrote:
> > Wed, Oct 24, 2018 at 09:19:31PM +, heasley:
> > ok; committed.  Either the alpha tarball or the svn repo.  Welcome testers,
> > esp for palo alto, of which I have none.
> 
> At least on 8.1.4 on my 3250s, the cli is a little bit busted until you get 
> out of interactive mode - for every space you enter between words in the 
> command, it redraws the current line, which was messing up the prompt 
> matching as below.  Fix for that attached at end of message.
> -e

super; committed.  thanks.

> diff -ur rancid-3.99.99/etc/rancid.types.base 
> rancid-3.99.99-em/etc/rancid.types.base
> --- rancid-3.99.99/etc/rancid.types.base  2018-10-24 11:13:49.0 
> -0400
> +++ rancid-3.99.99-em/etc/rancid.types.base   2018-10-26 17:16:53.950868707 
> -0400
> @@ -607,9 +607,8 @@
>  paloalto;login;panlogin
>  paloalto;module;panos
>  paloalto;inloop;panos::inloop
> -paloalto;command;rancid::RunCommand;set cli scripting-mode on
> -paloalto;command;rancid::RunCommand;set cli pager off
>  paloalto;command;panos::ShowInfo;show system info
> +paloalto;command;panos::ShowInventory;show chassis inventory
>  paloalto;command;panos::ShowConfig;show config running
>  #
>  procket;script;prancid
> diff -ur rancid-3.99.99/lib/panos.pm.in rancid-3.99.99-em/lib/panos.pm.in
> --- rancid-3.99.99/lib/panos.pm.in2016-02-16 07:28:46.0 -0500
> +++ rancid-3.99.99-em/lib/panos.pm.in 2018-10-26 17:19:11.552895792 -0400
> @@ -119,6 +119,23 @@
>  return(0);
>  }
> 
> +# This routine parses "show chassis inventory"
> +sub ShowInventory {
> +my($INPUT, $OUTPUT, $cmd) = @_;
> +my($slot);
> +
> +print STDERR "In ShowInventory:: $_" if ($debug);
> +
> +while (<$INPUT>) {
> + tr/\015//d;
> + last if (/^$prompt/);
> +
> + ProcessHistory("INV","","","#$_");
> +}
> +ProcessHistory("INV","","","#\n");
> +return(0);
> +}
> +
> 
>  # This routine parses "show config running"
>  sub ShowConfig {

Is this a new command or specific to larger platforms?  What is the error
if the command is unknown?

> diff -ur rancid-3.99.99/lib/nxos.pm.in rancid-3.99.99-em/lib/nxos.pm.in
> --- rancid-3.99.99/lib/nxos.pm.in 2018-09-19 18:02:44.0 -0400
> +++ rancid-3.99.99-em/lib/nxos.pm.in  2018-10-26 17:58:51.611639817 -0400
> @@ -494,9 +494,12 @@
>   # Drop vtp_debug.log and vtp_debug_old.log CDETS bug CSCuy87611
>   /\s+vtp_debug(_old)?\.log$/ && next;
> 
> + # Drop bcm_mem_locl_trace.log
> + /\s+bcm_mem_lock_trace\.log$/ && next;
> +
>   next if (/BufferMonitor-1HourData/);
> 
> - if (/( debug_logs| log)\/$/) {
> + if (/( debug_logs| log| vdc_\d+)\/$/) {
>   # change
>   # 8192Jan 08 14:05:05 2015  log/
>   # to

did I miss an explaination of this patch?  I see what it does, but ...

___
Rancid-discuss mailing list
Rancid-discuss@shrubbery.net
http://www.shrubbery.net/mailman/listinfo/rancid-discuss


Re: [rancid] paloalto feedback in current alpha [was: Re: clogin commenting script commands following multiple blanks lines]

2018-10-30 Thread Gauthier, Chris
Interesting!  I have yet to upgrade our installations to 8.1.4.  Thanks for the 
heads up!


Chris Gauthier Senior Network Engineer | comScore, Inc.
t +1 (503) 331-2704 |
cgauth...@comscore.com
317 SW Alder Street, Suite 700 | Portland, OR 97204  United States
comscore.com
​​​This e-mail (including any attachments) may contain information that is 
private, confidential, or protected by attorney-client or other privilege. If 
you received this e-mail in error, please delete it from your system and notify 
sender.
-Original Message-
From: Rancid-discuss  on behalf of Erik 
Muller 
Date: Friday, October 26, 2018 at 3:25 PM
To: heasley 
Cc: rancid list 
Subject: [rancid] paloalto feedback in current alpha [was: Re: clogin 
commenting script commands following multiple blanks lines]

On 10/24/18 18:32 , heasley wrote:
> Wed, Oct 24, 2018 at 09:19:31PM +, heasley:
> ok; committed.  Either the alpha tarball or the svn repo.  Welcome testers,
> esp for palo alto, of which I have none.

At least on 8.1.4 on my 3250s, the cli is a little bit busted until you get out 
of interactive mode - for every space you enter between words in the command, 
it redraws the current line, which was messing up the prompt matching as below. 
 Fix for that attached at end of message.
-e

rancid@status:~$ rancid -t paloalto -d fw1.ams
loadtype: device type paloalto
loadtype: found device type paloalto in 
/home/erikm/rancidtest/etc/rancid.types.base
executing panlogin -t 90 -c"set cli scripting-mode on;set cli pager off;show 
system info;show config running" fw1.ams
line: fw1.ams
line: spawn ssh -c aes256-ctr,aes192-ctr -x -l rancid fw1.ams
line: Password:
line: Last login: Fri Oct 26 20:04:51 2018 from 10.x.x.x
line: No entry for terminal type "network";
line: using dumb terminal settings.
line:
line: Number of failed attempts since last successful login: 0
line:
line:
line: ran...@fw1.ams(active)>
line: ran...@fw1.ams(active)>
line: ran...@fw1.ams(active)> set
line: ran...@fw1.ams(active)> set cli
line: ran...@fw1.ams(active)> set cli scripting-mode
line: ran...@fw1.ams(active)> set cli scripting-mode on
PROMPT MATCH: ran...@fw1.ams\(active\)[#>]
HIT COMMAND:ran...@fw1.ams(active)> set cli scripting-mode on

COMMAND is: set cli scripting-mode on|rancid::RunCommand
In RunCommand: ran...@fw1.ams(active)> set cli scripting-mode on
line: sran...@fw1.ams(active)> how system info
line: s
line: hostname: fw1.ams
line: ip-address: 10.x.x.x
...
line: family: 3200
line: model: PA-3250
line: sw-version: 8.1.4-h2
...
line: multi-vsys: off
line: operational-mode: normal
line:
line: ran...@fw1.ams(active)> how config running
line: exit
line:
line: config {
line:   mgt-config {
line: users {
...
line: ran...@fw1.ams(active)> Connection to fw1.ams closed.
fw1.ams: missed cmd(s): set cli pager off, show system info
fw1.ams: End of run not found
fw1.ams: clean_run is false
fw1.ams: found_end is false
!



erikm@status:~/src$ diff -ur rancid-3.99.99 rancid-3.99.99-em/
diff -ur 
rancid-3.99.99/bin/https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fpanlogin.in=E,1,6ITCpn7S8etHwRGxye4nnY-WXsOspZJKTHaSxUMwn7CUVVRDtL9N4eULfbpZKMnS2fE-49UrdfNQg0zd5F8rE7gq5t_QzpoQwMmdI9v87bdIynxj_kNZYaM,=1
 
rancid-3.99.99-em/bin/https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fpanlogin.in=E,1,AFuvKrybC8GB6DG7swV-DVjqoacwb3bN-9HbNrwIHSu3eQM0RtFFTm_43KfETWr8-Uz_SJGx3N-3-OaDDhdxtdoNE4ZVfLEnq_ly_T8O8XSbFZ9ZEA,,=1
--- 
rancid-3.99.99/bin/https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fpanlogin.in=E,1,PaBCXESaFYWjzoqImlahNbNlLrsy_b2vXybrRIrH36LE0245jqMqk6zO7RNZojKH5MycizqdsA_XLMSlWFTJWC55BdQ4EZyVefR65_EuhGMq766dEcz4ZHHC=1
2018-10-24 18:26:50.0 -0400
+++ 
rancid-3.99.99-em/bin/https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fpanlogin.in=E,1,EMioRKDRQlsHo46MUuAFylZdiNznL5XtoxGxMWzoJ-zE-yjczHpChxK9eUwVOkVfFMmWgFqx3n44hw-w1Ry9jmPUH43kK_du2ctguUJdL-p0-eIk=1
 2018-10-26 17:24:55.945967567 -0400
@@ -455,14 +455,22 @@
}
 }

+# PAN-OS in interactive mode will send a newline and then redraw the
+# whole prompt-and-command if you send a space.
+if { $do_command || $do_script } {
+   set cmd "set cli scripting-mode on\r"
+   send $cmd
+   # ensure we eat the partial commands redrawn while entering the command
+   expect -re "$cmd.*$prompt"  {}
+   send "set cli pager off\r"
+   expect -re $prompt  {}
+}
+
 if { $do_command } {
if {[run_commands $prompt $command]} {
continue
}
 } elseif { $do_script } {
-#  send "set cli scripting-mode on\r"
-#  send "set cli pager off\r"
-   expect -re $prompt  {}
source $sfile
close
 } else {
diff -ur rancid-3.99.99/etc/rancid.types.base 
rancid-3.99.99-em/etc/rancid.types.base
--- rancid-3.99.99/etc/rancid.types.base2018-10-24 11:13:49.000

[rancid] paloalto feedback in current alpha [was: Re: clogin commenting script commands following multiple blanks lines]

2018-10-26 Thread Erik Muller
On 10/24/18 18:32 , heasley wrote:
> Wed, Oct 24, 2018 at 09:19:31PM +, heasley:
> ok; committed.  Either the alpha tarball or the svn repo.  Welcome testers,
> esp for palo alto, of which I have none.

At least on 8.1.4 on my 3250s, the cli is a little bit busted until you get out 
of interactive mode - for every space you enter between words in the command, 
it redraws the current line, which was messing up the prompt matching as below. 
 Fix for that attached at end of message.
-e

rancid@status:~$ rancid -t paloalto -d fw1.ams
loadtype: device type paloalto
loadtype: found device type paloalto in 
/home/erikm/rancidtest/etc/rancid.types.base
executing panlogin -t 90 -c"set cli scripting-mode on;set cli pager off;show 
system info;show config running" fw1.ams
line: fw1.ams
line: spawn ssh -c aes256-ctr,aes192-ctr -x -l rancid fw1.ams
line: Password:
line: Last login: Fri Oct 26 20:04:51 2018 from 10.x.x.x
line: No entry for terminal type "network";
line: using dumb terminal settings.
line:
line: Number of failed attempts since last successful login: 0
line:
line:
line: ran...@fw1.ams(active)>
line: ran...@fw1.ams(active)>
line: ran...@fw1.ams(active)> set
line: ran...@fw1.ams(active)> set cli
line: ran...@fw1.ams(active)> set cli scripting-mode
line: ran...@fw1.ams(active)> set cli scripting-mode on
PROMPT MATCH: ran...@fw1.ams\(active\)[#>]
HIT COMMAND:ran...@fw1.ams(active)> set cli scripting-mode on

COMMAND is: set cli scripting-mode on|rancid::RunCommand
In RunCommand: ran...@fw1.ams(active)> set cli scripting-mode on
line: sran...@fw1.ams(active)> how system info
line: s
line: hostname: fw1.ams
line: ip-address: 10.x.x.x
...
line: family: 3200
line: model: PA-3250
line: sw-version: 8.1.4-h2
...
line: multi-vsys: off
line: operational-mode: normal
line:
line: ran...@fw1.ams(active)> how config running
line: exit
line:
line: config {
line:   mgt-config {
line: users {
...
line: ran...@fw1.ams(active)> Connection to fw1.ams closed.
fw1.ams: missed cmd(s): set cli pager off, show system info
fw1.ams: End of run not found
fw1.ams: clean_run is false
fw1.ams: found_end is false
!



erikm@status:~/src$ diff -ur rancid-3.99.99 rancid-3.99.99-em/
diff -ur rancid-3.99.99/bin/panlogin.in rancid-3.99.99-em/bin/panlogin.in
--- rancid-3.99.99/bin/panlogin.in  2018-10-24 18:26:50.0 -0400
+++ rancid-3.99.99-em/bin/panlogin.in   2018-10-26 17:24:55.945967567 -0400
@@ -455,14 +455,22 @@
}
 }

+# PAN-OS in interactive mode will send a newline and then redraw the
+# whole prompt-and-command if you send a space.
+if { $do_command || $do_script } {
+   set cmd "set cli scripting-mode on\r"
+   send $cmd
+   # ensure we eat the partial commands redrawn while entering the command
+   expect -re "$cmd.*$prompt"  {}
+   send "set cli pager off\r"
+   expect -re $prompt  {}
+}
+
 if { $do_command } {
if {[run_commands $prompt $command]} {
continue
}
 } elseif { $do_script } {
-#  send "set cli scripting-mode on\r"
-#  send "set cli pager off\r"
-   expect -re $prompt  {}
source $sfile
close
 } else {
diff -ur rancid-3.99.99/etc/rancid.types.base 
rancid-3.99.99-em/etc/rancid.types.base
--- rancid-3.99.99/etc/rancid.types.base2018-10-24 11:13:49.0 
-0400
+++ rancid-3.99.99-em/etc/rancid.types.base 2018-10-26 17:16:53.950868707 
-0400
@@ -607,9 +607,8 @@
 paloalto;login;panlogin
 paloalto;module;panos
 paloalto;inloop;panos::inloop
-paloalto;command;rancid::RunCommand;set cli scripting-mode on
-paloalto;command;rancid::RunCommand;set cli pager off
 paloalto;command;panos::ShowInfo;show system info
+paloalto;command;panos::ShowInventory;show chassis inventory
 paloalto;command;panos::ShowConfig;show config running
 #
 procket;script;prancid
diff -ur rancid-3.99.99/lib/nxos.pm.in rancid-3.99.99-em/lib/nxos.pm.in
--- rancid-3.99.99/lib/nxos.pm.in   2018-09-19 18:02:44.0 -0400
+++ rancid-3.99.99-em/lib/nxos.pm.in2018-10-26 17:58:51.611639817 -0400
@@ -494,9 +494,12 @@
# Drop vtp_debug.log and vtp_debug_old.log CDETS bug CSCuy87611
/\s+vtp_debug(_old)?\.log$/ && next;

+   # Drop bcm_mem_locl_trace.log
+   /\s+bcm_mem_lock_trace\.log$/ && next;
+
next if (/BufferMonitor-1HourData/);

-   if (/( debug_logs| log)\/$/) {
+   if (/( debug_logs| log| vdc_\d+)\/$/) {
# change
# 8192Jan 08 14:05:05 2015  log/
# to
diff -ur rancid-3.99.99/lib/panos.pm.in rancid-3.99.99-em/lib/panos.pm.in
--- rancid-3.99.99/lib/panos.pm.in  2016-02-16 07:28:46.0 -0500
+++ rancid-3.99.99-em/lib/panos.pm.in   2018-10-26 17:19:11.552895792 -0400
@@ -119,6 +119,23 @@
 return(0);
 }

+# This routine parses "show chassis inventory"
+sub ShowInventory {
+my($INPUT, $OUTPUT, $cmd) = @_;
+my($slot);
+
+print STDERR "In