Mordechai T. Abzug | 4 Jul 2006 00:20

[rancid] Re: Maximum length of config

On Fri, Jun 30, 2006 at 12:52:57AM +0100, Jee Kay wrote:

> I've got a device that returns 35k+ lines of config... and expect
> doesn't seem to be very happy about that. Specifically it seems to
> give up after roughly 29k lines - I'm guessing a buffer of some
> description has filled up.

Which device type?

rancid is actually a collection of scripts.  There are different
scripts for different device types.

> Sorry for the newbie expect question, but is this a known 'problem'
> and if so how do I go about making it go away? :)

Not a problem for me, for the device types I use.

Look inside the *login script for your device type and see if it
includes exp_continue in the run_commands equivalent; or match_max; or
handling for full_buffer.

- Morty
_______________________________________________
Rancid-discuss mailing list
Rancid-discuss <at> shrubbery.net
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss

john heasley | 4 Jul 2006 08:56

[rancid] Re: Maximum length of config

Mon, Jul 03, 2006 at 06:20:41PM -0400, Mordechai T. Abzug:
> On Fri, Jun 30, 2006 at 12:52:57AM +0100, Jee Kay wrote:
> 
> > I've got a device that returns 35k+ lines of config... and expect
> > doesn't seem to be very happy about that. Specifically it seems to
> > give up after roughly 29k lines - I'm guessing a buffer of some
> > description has filled up.
> 
> Which device type?
> 
> rancid is actually a collection of scripts.  There are different
> scripts for different device types.
> 
> > Sorry for the newbie expect question, but is this a known 'problem'
> > and if so how do I go about making it go away? :)
> 
> Not a problem for me, for the device types I use.
> 
> Look inside the *login script for your device type and see if it
> includes exp_continue in the run_commands equivalent; or match_max; or
> handling for full_buffer.

feh.  look at the expect patches on the rancid site.
_______________________________________________
Rancid-discuss mailing list
Rancid-discuss <at> shrubbery.net
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss

georg.naggies | 10 Jul 2006 13:02
Picon

[rancid] run_commands adaptation for Huawei

Hello!

I'm trying to adapt Rancid for Huawei routers, by doing a "3comlogin" from 
clogin. 
Logging in is easy, with minimal adaptation of clogin.

I'm having trouble though to get run_commands to work. I commented out 
this line

-re "^\[^\n\r *]*$reprompt" {send_user -- "$expect_out(buffer)"}

otherwise it breaks out of the one loop, just after the commands are sent, 
immediately. When I do away with the line, I never get to breaking out of 
the loop, though, of course.

Can someone shed light on how clogin distinguishes from a prompt after 
commands are done, breaking out of the loop, from a prompt before 
commands?

In other words, what's the difference between 
"^\[^\n\r]*$reprompt." 
and 
"^\[^\n\r *]*$reprompt" ?

I have been thinking long on the regular expressions, therefore now trying 
my luck on the list, 

thanks
Georg Naggies

(Continue reading)

Gary L Roberts | 10 Jul 2006 17:36

[rancid] Unrecognized command errors

Hi All,
Long time listener, first time caller :D
First off, let me open by saying, i love rancid, and what it can do, (very well i might add)
We have a (very) hybrid network, and so far, i've yet to run into anything that i cannot get rancid to login to, and back up.
I do have a question,
We're using several Adtran Netvanta 1524st's in our network.
i have it setup as a cisco type os, which for the most part, ,it is,
however, i get several "Unrecognized command" errors, ie:

!RANCID-CONTENT-TYPE: cisco
!
!
!
!
!
!Image: % Unrecognized command
!
!
!
!
!BootFlash: % Unrecognized command
!
!BootFlash: % Unrecognized command
!
!BootFlash: % Unrecognized command
!
!Flash: 2572222 9200580-2A1001SC.biz
!Flash:    2384 startup-config.bak
!Flash:    2384 startup-config
!Flash: 2583728 bytes used, 11917136 available, 14500864 total
!
!Flash: nvram: % Unrecognized command
!
!Flash: bootflash: % Unrecognized command
!
!Flash: slot0: % Unrecognized command
!
!Flash: disk0: % Unrecognized command
!
!Flash: slot1: % Unrecognized command
!
!Flash: disk1: % Unrecognized command
!
!Flash: slot2: % Unrecognized command
!
!Flash: disk2: % Unrecognized command
!
!Flash: harddisk: % Unrecognized command
!
!Flash: harddiska: % Unrecognized command
!
!Flash: harddiskb: % Unrecognized command
!
!Flash: sup-bootflash: % Unrecognized command
!
!Flash: sup-microcode: % Unrecognized command
!
!Flash: slavenvram: % Unrecognized command
!
!Flash: slavebootflash: % Unrecognized command
!
!Flash: slaveslot0: % Unrecognized command
!
!Flash: slavedisk0: % Unrecognized command
!
!Flash: slaveslot1: % Unrecognized command
!
!Flash: slavedisk1: % Unrecognized command
!
!Flash: slaveslot2: % Unrecognized command
!
!Flash: slavedisk2: % Unrecognized command
!
!Flash: slavesup-bootflash: % Unrecognized command
!
!Flash: sec-nvram: % Unrecognized command
!
!Flash: sec-bootflash: % Unrecognized command
!
!Flash: sec-slot0: % Unrecognized command
!
!Flash: sec-disk0: % Unrecognized command
!
!Flash: sec-slot1: % Unrecognized command
!
!Flash: sec-disk1: % Unrecognized command
!
!Flash: sec-slot2: % Unrecognized command
!
!Flash: sec-disk2: % Unrecognized command
!
!
!Slot 1/0: type   
!Slot 1/0: part -, serial Empty
!Slot 1/0: hvers -
!
!Modem: % Unrecognized command
!
!VTP: % Unrecognized command

How do i remove these?

Thanks in advance
--

 

Gary L. Roberts Network Operations
_______________________________________________
Rancid-discuss mailing list
Rancid-discuss <at> shrubbery.net
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
andy | 11 Jul 2006 16:40

[rancid] Re: Huawei routers

yes but in a messy way using tftp to offload the config.

$tftphost = "x.x.x.x"; needs defined.

see attached, but im sure the expect coders could be far more impressive and actually do a proper one.

cheers

On Thu, Jun 29, 2006 at 08:40:18AM +0200, georg.naggies <at> r-it.at wrote:
> Anyone got Rancid to work with Huawei equipment and would care to share?
> 
> Regards,
> 
> _______________________________________________
> Rancid-discuss mailing list
> Rancid-discuss <at> shrubbery.net
> http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
> 

-- 
andy    andy <at> shady.org
-----------------------------------------------
Never argue with an idiot. They drag you down 
to their level, then beat you with experience.
----------------------------------------------- 
#!/usr/bin/perl
##
#  RANCID - Really Awesome New Cisco confIg Differ
#  Makes Huawei Switch TFTP its current-config
#  Prepends other environment, power, fan, version info 
#

# Syntax: hslogin [-l] [-d] [-f filename] host
use Getopt::Std;
getopts('dfl');
$log = $opt_l;
$debug = $opt_d;
$host = $ARGV[0];
$file = $opt_f;
$tftphost = "x.x.x.x";

# This routine is used to print out the router configuration
sub ProcessHistory {
    my($new_hist_tag,$new_command,$command_string, <at> string)=( <at> _);
    if((($new_hist_tag ne $hist_tag) || ($new_command ne $command))
       && defined %history) {
        print eval "$command \%history";
        undef %history;
    }
    if (($new_hist_tag) && ($new_command) && ($command_string)) {
        if ($history{$command_string}) {
            $history{$command_string} = "$history{$command_string} <at> string";
        } else {
            $history{$command_string} = " <at> string";
        }
    } elsif (($new_hist_tag) && ($new_command)) {
        $history{++$#history} = " <at> string";
    } else {
        print " <at> string";
    }
    $hist_tag = $new_hist_tag;
    $command = $new_command;
    1;
}

# Create the tftp file, and set it 777
open(TOUCH,">/tftpboot/$host.tftp");
close(TOUCH);
chmod 0777, "/tftpboot/$host.tftp";

# Main
$huawei_commands=sprintf("display fan;display power;display environment;display version;tftp
put flash:/vrpcfg.txt //%s/%s.tftp",$tftphost,$host);

open(OUTPUT,">$host.new") || die "Can't open $host.new for writing: $!\n";
select(OUTPUT);
# make OUTPUT unbuffered
if ($debug) { $| = 1; }

if ($file) {
    print STDERR "opening file $file\n" if ($debug);
    print STDOUT "opening file $file\n" if ($log);
    open(INPUT,"< $file") || die "open failed for $file: $!\n";
} else {
    print "# RANCID-CONTENT-TYPE: huawei\n!\n";
    print(STDERR "executing echo hslogin -c\"$huawei_commands\" $host\n") if ($debug);
    print(STDOUT "executing echo hslogin -c\"$huawei_commands\" $host\n") if ($debug);

    if (defined($ENV{NOPIPE})) {
        system "hslogin -c  \"$huawei_commands\" $host </dev/null > $host.raw" || die "hslogin failed for $host: $!\n";
        open(INPUT, "< $host.raw") || die "hslogin failed for $host: $!\n";
    } else {
        open(INPUT,"hslogin -c  \"$huawei_commands\" $host </dev/null |") || die "hslogin failed for $host: $!\n";
    }

}

# Read in the file from /tftpboot and append each line to host.new
if ( -s "/tftpboot/$host.tftp" )
{
        open(INPUT,"</tftpboot/$host.tftp");
        while($line=<INPUT>)
        {
                print $line;
        }
}

close(INPUT);
close(OUTPUT);

_______________________________________________
Rancid-discuss mailing list
Rancid-discuss <at> shrubbery.net
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
Gary Roberts | 11 Jul 2006 16:41

[rancid] temperature changes cause diffs to be sent out

Running rancid 2.3.2a
the router being backed up is a Foundry FastIron SuperX-PREM.
here is sample diff

  ! Fan controlled temperature: 
  ! 	Rule 1/2 (MGMT CARDS THERMAL PLANE): 36.0 deg-C
- ! 	Rule 2/2 (LINE CARDS THERMAL PLANE): 37.2 deg-C
+ ! 	Rule 2/2 (LINE CARDS THERMAL PLANE): 37.7 deg-C
  ! 
  ! Fan speed switching temperature thresholds:
  ! 	Rule 1/2 (MGMT CARDS THERMAL PLANE):
  ! 		Speed 1: NM<----->40                         deg-C
 <at>  <at>  -54,17 +54,17  <at>  <at> 
  ! 		Speed 3:             44<----->52             deg-C
  ! 		Speed 4:                   48<----->55       deg-C
  ! 		Speed 5:                         52<----->80 deg-C (shutdown)
  ! 
- ! Slot 1 Temperature: 36.5 deg-C
- ! Slot 2 Temperature: 38.0 deg-C
+ ! Slot 1 Temperature: 37.0 deg-C
+ ! Slot 2 Temperature: 38.5 deg-C
  ! Slot 3 Temperature: empty
  ! Slot 4 Temperature: empty
  ! Slot 5 Temperature: empty
  ! Slot 6 Temperature: empty
  ! Slot 7 Temperature: empty
  ! Slot 8 Temperature: empty
- ! Slot 9 Temperature: 36.0 deg-C (exhaust side), 31.5 deg-C (intake side)
+ ! Slot 9 Temperature: 36.0 deg-C (exhaust side), 32.0 deg-C (intake side)
  ! Exhaust Side Temperature Readings:
  ! 	Warning level.......: 70.0 deg-C
  ! 	Shutdown level......: 80.0 deg-C
  ! Intake Side Temperature Readings:

it appears that everytime there is a reported temp change in the chassis,  a diff is sent out.
This gets somewhat annoying by days end, Whats the best way to keep the diffs from being sent out on a temp change?

thanks in advance

Gary
_______________________________________________
Rancid-discuss mailing list
Rancid-discuss <at> shrubbery.net
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss

Shekhar Basnet | 12 Jul 2006 11:20
Favicon

[rancid] Re: Trouble with awk

cat /usr/local/rancid/var/bsr/configs/* | ./mktop

s

On Wed, 2006-07-12 at 14:15, Rikard Stemland Skjelsvik wrote:
> Hello!
> 
> I'm in the process of checking out rancid and other related tools. I was
> very intriged by "Managing IP Networks with Free Software" at Nanog.
> When trying to run mktop i get the following error message(se below). I am 
> not very familiar with awk and hope that someone on the list could point
> me in the right direction.
> 
> Thank you for your time!
> 
> 
> 
>   # ./mktop /usr/local/rancid/var/bsr/configs > bsr.top
> awk: ./mktop:392:   sub(/^ +description +"/, ");
> awk: ./mktop:392:                            ^ unterminated string
> # cat /usr/local/rancid/var/bsr/configs | ./mktop > bsr.top
> awk: ./mktop:392:   sub(/^ +description +"/, ");
> awk: ./mktop:392:                            ^ unterminated stringth an 
> "}" at line 63
> 
> 
> Line 389 to 394 is:
> 
> /description "/ && (indent > 1) && (section[1] == "interfaces") && \
>    (config == JUNOS) {
>    sub(/^ +description +"/, "");
>    sub(/\";$/, "");
>    new_ifdesc = $0;
>    next;
> }
> 
> I am running awk version:
>       #  /usr/local/bin/awk --version
>       GNU Awk 3.1.4
>       Copyright (C) 1989, 1991-2003 Free Software Foundation
> 
> on:
>      # uname -a
>      SunOS okm-cw2000 5.8 Generic_108528-27 sun4u sparc SUNW,Sun-Fire-V210
> 
> --
> Rikard

_______________________________________________
Rancid-discuss mailing list
Rancid-discuss <at> shrubbery.net
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss

Rikard Stemland Skjelsvik | 12 Jul 2006 11:41
Favicon

[rancid] Re: Trouble with awk


Thank you for taking the time to answer. I have tried what you 
suggested and it gives the following:

# cat /usr/local/rancid/var/bsr/configs/* | ./mktop
awk: ./mktop:392:   sub(/^ +description +"/, ");
awk: ./mktop:392:                            ^ unterminated string
Broken Pipe
#

The only new line is "Broken Pipe"

The command "cat /usr/local/rancid/var/bsr/configs/* " works fine

--
Rikard

On Wed, 12 Jul 2006, Shekhar Basnet wrote:

> cat /usr/local/rancid/var/bsr/configs/* | ./mktop
>
> s
>
> On Wed, 2006-07-12 at 14:15, Rikard Stemland Skjelsvik wrote:
>> Hello!
>>
>> I'm in the process of checking out rancid and other related tools. I was
>> very intriged by "Managing IP Networks with Free Software" at Nanog.
>> When trying to run mktop i get the following error message(se below). I am
>> not very familiar with awk and hope that someone on the list could point
>> me in the right direction.
>>
>> Thank you for your time!
>>
>>
>>
>>   # ./mktop /usr/local/rancid/var/bsr/configs > bsr.top
>> awk: ./mktop:392:   sub(/^ +description +"/, ");
>> awk: ./mktop:392:                            ^ unterminated string
>> # cat /usr/local/rancid/var/bsr/configs | ./mktop > bsr.top
>> awk: ./mktop:392:   sub(/^ +description +"/, ");
>> awk: ./mktop:392:                            ^ unterminated stringth an
>> "}" at line 63
>>
>>
>> Line 389 to 394 is:
>>
>> /description "/ && (indent > 1) && (section[1] == "interfaces") && \
>>    (config == JUNOS) {
>>    sub(/^ +description +"/, "");
>>    sub(/\";$/, "");
>>    new_ifdesc = $0;
>>    next;
>> }
>>
>> I am running awk version:
>>       #  /usr/local/bin/awk --version
>>       GNU Awk 3.1.4
>>       Copyright (C) 1989, 1991-2003 Free Software Foundation
>>
>> on:
>>      # uname -a
>>      SunOS okm-cw2000 5.8 Generic_108528-27 sun4u sparc SUNW,Sun-Fire-V210
>>
>> --
>> Rikard
>
>
_______________________________________________
Rancid-discuss mailing list
Rancid-discuss <at> shrubbery.net
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss

Shekhar Basnet | 12 Jul 2006 11:59
Favicon

[rancid] Re: Trouble with awk

I am afraid I am not able to help you out. I use Linux and it worked for
me in the first shot. Maybe some experts in this list have more ideas as
I am not so familiar with awk myself.

[root <at> test mktop]# uname -a
Linux test 2.4.22-1.2115.nptl #1 Wed Oct 29 15:42:51 EST 2003 i686 i686
i386 GNU/Linux

-s

On Wed, 2006-07-12 at 15:26, Rikard Stemland Skjelsvik wrote:
> Thank you for taking the time to answer. I have tried what you 
> suggested and it gives the following:
> 
> # cat /usr/local/rancid/var/bsr/configs/* | ./mktop
> awk: ./mktop:392:   sub(/^ +description +"/, ");
> awk: ./mktop:392:                            ^ unterminated string
> Broken Pipe
> #
> 
> The only new line is "Broken Pipe"
> 
> The command "cat /usr/local/rancid/var/bsr/configs/* " works fine
> 
> 
> --
> Rikard
> 
> 
> 
> On Wed, 12 Jul 2006, Shekhar Basnet wrote:
> 
> > cat /usr/local/rancid/var/bsr/configs/* | ./mktop
> >
> > s
> >
> > On Wed, 2006-07-12 at 14:15, Rikard Stemland Skjelsvik wrote:
> >> Hello!
> >>
> >> I'm in the process of checking out rancid and other related tools. I was
> >> very intriged by "Managing IP Networks with Free Software" at Nanog.
> >> When trying to run mktop i get the following error message(se below). I am
> >> not very familiar with awk and hope that someone on the list could point
> >> me in the right direction.
> >>
> >> Thank you for your time!
> >>
> >>
> >>
> >>   # ./mktop /usr/local/rancid/var/bsr/configs > bsr.top
> >> awk: ./mktop:392:   sub(/^ +description +"/, ");
> >> awk: ./mktop:392:                            ^ unterminated string
> >> # cat /usr/local/rancid/var/bsr/configs | ./mktop > bsr.top
> >> awk: ./mktop:392:   sub(/^ +description +"/, ");
> >> awk: ./mktop:392:                            ^ unterminated stringth an
> >> "}" at line 63
> >>
> >>
> >> Line 389 to 394 is:
> >>
> >> /description "/ && (indent > 1) && (section[1] == "interfaces") && \
> >>    (config == JUNOS) {
> >>    sub(/^ +description +"/, "");
> >>    sub(/\";$/, "");
> >>    new_ifdesc = $0;
> >>    next;
> >> }
> >>
> >> I am running awk version:
> >>       #  /usr/local/bin/awk --version
> >>       GNU Awk 3.1.4
> >>       Copyright (C) 1989, 1991-2003 Free Software Foundation
> >>
> >> on:
> >>      # uname -a
> >>      SunOS okm-cw2000 5.8 Generic_108528-27 sun4u sparc SUNW,Sun-Fire-V210
> >>
> >> --
> >> Rikard
> >
> >

_______________________________________________
Rancid-discuss mailing list
Rancid-discuss <at> shrubbery.net
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss

Rikard Stemland Skjelsvik | 12 Jul 2006 14:22
Favicon

[rancid] Re: Trouble with awk


The suggestion from Wim Livens fixed the problems i had. I was able to
create the top-file. Thank you all for your help!

On a relatet note: I would like to thank you all for rancid. I have only
used the clogin script up unntil now. But that alone has saved me hours
of typing and tons of frustration.

----------------------------------------------------------------------------

  I am running awk version:
        #  /usr/local/bin/awk --version
        GNU Awk 3.1.4
        Copyright (C) 1989, 1991-2003 Free Software Foundation

  on:
       # uname -a
       SunOS okm-cw2000 5.8 Generic_108528-27 sun4u sparc SUNW,Sun-Fire-V210
---------------------------------------------------------------------------

--
Rikard

On Wed, 12 Jul 2006, Wim Livens wrote:

>> > # cat /usr/local/rancid/var/bsr/configs/* | ./mktop
>> > awk: ./mktop:392:   sub(/^ +description +"/, ");
>> > awk: ./mktop:392:                            ^ unterminated string
>
> I'm not an awk expert and know nothing about junos, but maybe just try
> backslashing that quote?
>
> sub(/^ +description +\"/, "");
>
> It seems weird that it is escaped in the second sub but not in the
> first.  Both with or without the backslash work on my platform (GNU
> Awk 3.1.3) but maybe that's just luck.
>
> Wim.
>
_______________________________________________
Rancid-discuss mailing list
Rancid-discuss <at> shrubbery.net
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss


Gmane