version 1.34, 2007/02/05 21:02:07 |
version 1.36, 2007/02/05 21:09:26 |
|
|
package Net::Telnet::Trango;
|
package Net::Telnet::Trango;
|
|
|
# $RedRiver: Trango.pm,v 1.33 2007/02/02 21:26:56 andrew Exp $
|
# $RedRiver: Trango.pm,v 1.35 2007/02/05 21:03:40 andrew Exp $
|
use strict;
|
use strict;
|
use warnings;
|
use warnings;
|
use base 'Net::Telnet';
|
use base 'Net::Telnet';
|
|
|
=head2 B<new>
|
=head2 B<new>
|
- Creates a new Net::Telnet::Trango object.
|
- Creates a new Net::Telnet::Trango object.
|
|
|
new([Options from Net::Telnet,]
|
new([Options from Net::Telnet,]
|
[Decode => 0,]);
|
[Decode => 0,]);
|
|
|
Same as new from L<Net::Telnet> but sets the default Trango Prompt:
|
Same as new from L<Net::Telnet> but sets the default Trango Prompt:
|
'/#> *$/'
|
'/#> *$/'
|
|
|
remarks => { decode => 'all', expect => $success },
|
remarks => { decode => 'all', expect => $success },
|
save_sudb => { String => 'save sudb', expect => $success },
|
save_sudb => { String => 'save sudb', expect => $success },
|
syslog => { expect => $success },
|
syslog => { expect => $success },
|
'pipe' => {}, # XXX needs a special decode
|
'pipe' => {}, # XXX needs a special decode
|
maclist => { decode => 'maclist' },
|
maclist => { decode => 'maclist' },
|
maclist_reset => { String => 'maclist reset', expect => 'done' },
|
maclist_reset => { String => 'maclist reset', expect => 'done' },
|
eth_link => { String => 'eth link', expect => $success },
|
eth_link => { String => 'eth link', expect => $success },
|
su_info => { String => 'su info', decode => 'all', expect => $success },
|
su_info =>
|
|
{ String => 'su info', decode => 'all', expect => $success },
|
su_testrflink =>
|
su_testrflink =>
|
{ String => 'su testrflink', decode => 'each', expect => $success },
|
{ String => 'su testrflink', decode => 'each', expect => $success },
|
save_ss => { String => 'save ss', expect => $success },
|
save_ss => { String => 'save ss', expect => $success },
|
opmode => { decode => 'all', expect => $success },
|
opmode => { decode => 'all', expect => $success },
|
|
|
# eth r, w and reset???
|
|
#su password???
|
|
#_bootloader
|
|
#temp
|
|
#heater
|
|
);
|
);
|
|
|
my %ALIASES = (
|
my %ALIASES = (
|
|
|
|
|
Takes the following paramaters
|
Takes the following paramaters
|
|
|
suid : numeric,
|
suid : numeric,
|
type : (reg|pr)
|
type : (reg|pr)
|
cir : numeric,
|
cir : numeric,
|
mir : numeric,
|
mir : numeric,
|
mac : Almost any format, it will be reformatted,
|
mac : Almost any format, it will be reformatted,
|
|
|
and returns true on success or undef otherwise.
|
and returns true on success or undef otherwise.
|
|
|
|
|
- a string containing the command line options that are passed to the
|
- a string containing the command line options that are passed to the
|
command
|
command
|
|
|
$t->cmd( String => 'exit', no_prompt => 1, cmd_disconnects => 1 );
|
$t->cmd( String => 'exit', no_prompt => 1, cmd_disconnects => 1 );
|
|
|
=cut
|
=cut
|
|
|
|
|
foreach my $line (@lines) {
|
foreach my $line (@lines) {
|
$line =~ s/\r?\n$//;
|
$line =~ s/\r?\n$//;
|
my ( $mac, $loc, $tm ) = $line =~ /
|
my ( $mac, $loc, $tm ) = $line =~ /
|
([0-9a-fA-F ]{17})\s+
|
([0-9a-fA-F ]{17})\s+
|
(.*)\s+
|
(.*)\s+
|
tm\s+
|
tm\s+
|
(\d+)
|
(\d+)
|
/x;
|
/x;
|
|
|
if ($mac) {
|
if ($mac) {
|
$mac =~ s/\s+//g;
|
$mac =~ s/\s+//g;
|