Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: RANCID: Users

Huawei routers

 

 

RANCID users RSS feed   Index | Next | Previous | View Threaded


georg.naggies at r-it

Jun 28, 2006, 10:40 PM

Post #1 of 4 (2429 views)
Permalink
Huawei routers

Anyone got Rancid to work with Huawei equipment and would care to share?

Regards,


andy at shady

Jul 11, 2006, 6:40 AM

Post #2 of 4 (2351 views)
Permalink
Re: Huawei routers [In reply to]

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.
-----------------------------------------------
-------------- next part --------------
#!/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)=(@_);
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}@string";
} else {
$history{$command_string} = "@string";
}
} elsif (($new_hist_tag) && ($new_command)) {
$history{++$#history} = "@string";
} else {
print "@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);


chtse at starhub

Mar 9, 2008, 11:33 PM

Post #3 of 4 (2352 views)
Permalink
Re: Huawei routers [In reply to]

Hi Georg,

I have made rancid modules for Huawei router. Tested on NE80E router,
software V3R2

cheers,
Jonathan.
P.S. Sorry, reply 1.5 year after... ;-)


------------------------------------------------------------------------
--------georg.naggies at r-it.at georg.naggies at r-it.at
Thu Jun 29 06:40:18 UTC 2006

Anyone got Rancid to work with Huawei equipment and would care to share?

Regards,



StarHub Ltd. Reg. No.: 199802208C This email is confidential and privileged. If you are not the intended recipient, you must not view, disseminate, use or copy this email. Kindly notify the sender immediately, and delete this email from your system. Thank you. Please visit our website at www.starhub.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: hwlogin
Type: application/octet-stream
Size: 14614 bytes
Desc: hwlogin
Url : http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20080310/83eea0ec/attachment.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hwrancid
Type: application/octet-stream
Size: 8052 bytes
Desc: hwrancid
Url : http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20080310/83eea0ec/attachment-0001.obj


jethro.binks at strath

Mar 10, 2008, 1:57 AM

Post #4 of 4 (2351 views)
Permalink
Re: Huawei routers [In reply to]

On Mon, 10 Mar 2008, Jonathan TSE Chi Hang wrote:

> I have made rancid modules for Huawei router. Tested on NE80E router,
> software V3R2

That's annoying, I wrote the something similar last week :) Mine was
specifically aimed at the 3Com/Huawei joint venture switches, however I
will compare the two presently.

Jethro.


>
> cheers,
> Jonathan.
> P.S. Sorry, reply 1.5 year after... ;-)
>
>
> ------------------------------------------------------------------------
> --------georg.naggies at r-it.at georg.naggies at r-it.at
> Thu Jun 29 06:40:18 UTC 2006
>
> Anyone got Rancid to work with Huawei equipment and would care to share?
>
> Regards,
>
>
>
> StarHub Ltd. Reg. No.: 199802208C This email is confidential and privileged. If you are not the intended recipient, you must not view, disseminate, use or copy this email. Kindly notify the sender immediately, and delete this email from your system. Thank you. Please visit our website at www.starhub.com
>
>

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Jethro R Binks
Computing Officer, IT Services
University Of Strathclyde, Glasgow, UK

RANCID users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.