[rancid] [PATCH 2/2] Multiple fixes/improvements for Extreme XOS

Zenon Mousmoulas zmousm at noc.grnet.gr
Thu Dec 1 01:44:32 UTC 2011


On Wed, 30 Nov 2011 21:51:10 +0000, john heasley <heas at shrubbery.net>
wrote:
> Wed, Nov 30, 2011 at 08:12:43PM +0200, Zenon Mousmoulas:
>> On Tue, 29 Nov 2011 22:51:46 +0000, john heasley <heas at shrubbery.net>
>> wrote:
>> > Mon, Nov 28, 2011 at 03:36:45PM +0200, Zenon Mousmoulas:
>> >> Improve support for Extreme Networks devices running XOS:
>> >> - The pager can be disabled per session since XOS 12.3, try to do
that
>> >>   in order to avoid struggling with pager prompts and ANSI sequences
>> >>   altogether (clogin).
>> > 
>> >> +++ rancid-2.3.6-grnet/bin/clogin.in	2011-11-26 00:15:17.000000000
>> +0200
>> >> @@ -610,11 +610,9 @@
>> >>      global do_saveconfig in_proc platform
>> >>      set in_proc 1
>> >>  
>> >> -    # If the prompt is (enable), then we are on a switch and the
>> >> -    # command is "set length 0"; otherwise its "terminal length 0".
>> >> -    # skip if its an extreme (since the pager can not be disabled
on
>> >> a
>> >> -    # per-vty basis).
>> >>      if { [ string compare "extreme" "$platform" ] } {
>> >> +        # If the prompt is (enable), then we are on a switch and
the
>> >> +        # command is "set length 0"; otherwise its "terminal length
>> 0".
>> >>  	if [ regexp -- ".*> .*enable" "$prompt" ] {
>> >>  	    send "set length 0\r"
>> >>  	    # This is ugly, but reduces code duplication, allowing the
>> >> @@ -631,7 +629,12 @@
>> >>  	    -re "\[\n\r]+"	{ exp_continue }
>> >>  	}
>> >>      } else {
>> >> +	send "disable clipaging\r"
>> >>  	set reprompt $prompt
>> >> +	expect {
>> >> +	    -re $reprompt	{}
>> >> +	    -re "\[\n\r]+"	{ exp_continue }
>> >> +	}
>> >>      }
>> >>  
>> >>      # this is the only way i see to get rid of more prompts in
>> >>      o/p..grrrrr
>> >> @@ -640,11 +643,14 @@
>> >>      set commands [split $command \;]
>> >>      set num_commands [llength $commands]
>> >>      # the pager can not be turned off on the PIX, so we have to
look
>> >> -    # for the "More" prompt.  the extreme is equally obnoxious,
with
>> >> a
>> >> -    # global switch in the config.
>> >> +    # for the "More" prompt.
>> > 
>> > i think this what you really want:
>> 
>> The following diff seems to be against some version of clogin (other
>> than 2.3.6) I don't have access to (is there a public source code repo
>> for rancid, btw?) so I can not apply/try it and therefore I'm not sure
>> if it is what I really want.
> 
> attached

I tried it. The part about "disable clipaging" looks good.


However there's still a problem in this version with buffered output from
the extreme. After login, when you send "\r", the following expect
catches the first prompt, not the one after "\r". This becomes evident
later on, when the expect statement in the loop within run_commands
catches
"disable clipaging\r\n\<prompt>" rather than the command echoed and
its' output. So you're always one step behind, until the end, where you
erroneously see a prompt after sending "quit\r" so you also
send -h "exit\r". This obviously messes up xrancid parsing as
well. See the attached clogin log for more evidence (with exp_internal
added after login).

The following snippet from our patch addresses this issue, admittedly
not very elegantly, but we saw no way to deal with this other than
waiting for the extreme to send everything up to the first
prompt. Actually, according to my tests, the same thing can also happen on
a
cisco if you configure a very very large exec banner. So this is
generally useful, though not as much/often as for extreme.

+    # Get all (output after login) you can eat in 1s
+    # (hopefully up to and including the first prompt).
+    # This is mostly necessary to work around
+    # stoopid extreme output buffering.
+    expect {
+	-timeout 1
+	-re "\[\n\r]+"	{ exp_continue }
+	-re "\[^\n\r]+"	{ exp_continue -continue_timer }
+	timeout		{}
+    }


>> > Index: bin/clogin.in
>> > ===================================================================
>> > --- bin/clogin.in	(revision 2340)
>> > +++ bin/clogin.in	(working copy)
>> > @@ -633,8 +633,8 @@
>> >      set commands [split $command \;]
>> >      set num_commands [llength $commands]
>> >      # the pager can not be turned off on the PIX, so we have to look
>> > -    # for the "More" prompt.  the extreme is equally obnoxious, with
a
>> > -    # global switch in the config.
>> > +    # for the "More" prompt.  the extreme is equally obnoxious in
>> > pre-12.3 XOS,
>> > +    # with a global switch in the config.
>> 
>> Actually I am not sure this last statement is true: we had not found
>> such a "global switch" in pre-12.3 XOS, as far as we can remember.
> 
> What came before XOS?  has it always been called XOS?  the old extreme
> boxes
> had a global knob, IIRC.

Dunno, ExtremeWare? Fortunately we did not get a chance to see
that. Anyway, we didn't see such a knob in any version of XOS 12.x.



More information about the Rancid-discuss mailing list