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

Erik Muller <[email protected]>
Newsgroups gmane.network.rancid
Message-ID <[email protected]>
On 10/24/18 18:32 , heasley wrote:
> Wed, Oct 24, 2018 at 09:19:31PM +0000, 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: [email protected](active)>
line: [email protected](active)>
line: [email protected](active)> set
line: [email protected](active)> set cli
line: [email protected](active)> set cli scripting-mode
line: [email protected](active)> set cli scripting-mode on
PROMPT MATCH: [email protected]\(active\)[#>]
HIT COMMAND:[email protected](active)> set cli scripting-mode on

COMMAND is: set cli scripting-mode on|rancid::RunCommand
    In RunCommand: [email protected](active)> set cli scripting-mode on
line: [email protected](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: [email protected](active)> how config running
line: exit
line:
line: config {
line:   mgt-config {
line:     users {
...
line: [email protected](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.000000000 -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.base	2018-10-24 11:13:49.000000000 -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.000000000 -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
 	    #         8192    Jan 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.000000000 -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 {

_______________________________________________
Rancid-discuss mailing list
[email protected]
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.