=================================================================== RCS file: /cvs/trango/Net-Telnet-Trango/lib/Net/Telnet/Trango.pm,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- trango/Net-Telnet-Trango/lib/Net/Telnet/Trango.pm 2006/09/07 04:00:07 1.16 +++ trango/Net-Telnet-Trango/lib/Net/Telnet/Trango.pm 2006/09/12 02:17:46 1.17 @@ -1,5 +1,5 @@ package Net::Telnet::Trango; -# $RedRiver: Trango.pm,v 1.14 2006/09/07 02:49:34 andrew Exp $ +# $RedRiver: Trango.pm,v 1.16 2006/09/07 03:00:07 andrew Exp $ use strict; use warnings; use base 'Net::Telnet'; @@ -246,6 +246,11 @@ reboots the trango and closes the connection +=item remarks + +Takes an optional argument "args => ", which sets the remarks. +If there is no argument, just returns the current remarks. + =item sulog returns an array ref of hashes containing each log line. @@ -274,6 +279,14 @@ returns the output from the eth list command +=item su_info + +You need to pass in args => and it will return the info for that suid. + +=item save_ss + +saves the config. Returns 1 on success, undef on failure. + =cut @@ -286,12 +299,15 @@ sulog => { decode => 'sulog', expect => $success }, 'exit' => { no_prompt => 1, cmd_disconnects => 1 }, reboot => { no_prompt => 1, cmd_disconnects => 1 }, + remarks => { decode => 'all', expect => $success }, save_sudb => { String => 'save sudb', expect => $success }, syslog => { expect => $success }, 'pipe' => { }, # XXX needs a special decode maclist => { decode => 'maclist' }, maclist_reset => { String => 'maclist reset', expect => 'done' }, eth_link => { String => 'eth link', expect => $success }, + su_info => { String => 'su info', decode => 'all', expect => $success }, + save_ss => { String => 'save ss', expect => $success }, # eth r, w and reset??? #su password??? #_bootloader @@ -329,8 +345,8 @@ } if (exists $COMMANDS{$method}) { - $method = shift if (@_ == 1); $COMMANDS{$method}{'String'} ||= $method; + $COMMANDS{$method}{'args'} .= ' ' . shift if (@_ == 1); return $self->cmd(%{ $COMMANDS{$method} }, @_); } @@ -860,9 +876,9 @@ my %conf; my $key = ''; - my $val = ''; + my $val = undef; my $in_key = 0; - my $in_val = 0; + my $in_val = 1; foreach my $line (@lines) { next if $line =~ /$success$/; @@ -876,17 +892,20 @@ if ($c eq '[') { $in_key = 1; $in_val = 0; + $val = ''; } else { $in_key = 0; - $in_val = 0; + $in_val = 1; } if ($key) { $key =~ s/^\s+//; $key =~ s/\s+$//; - $val =~ s/^\s+//; - $val =~ s/\s+$//; + if (defined $val) { + $val =~ s/^\s+//; + $val =~ s/\s+$//; + } if ($key eq 'Checksum' && $last_key) { # Special case for these bastids. @@ -918,7 +937,7 @@ if (%conf) { return \%conf; } else { - return undef; + return $val; } }