SPUG: Net::Telnet issues.....
Nord, Chris
chris.nord at attws.com
Tue Aug 19 16:54:56 CDT 2003
Gurus,
I am having some trouble capturing data while using the Net::Telnet
module. Line: my @data = $t->cmd('find Routing_Label'); should save the
results of the command 'find Routing_Label', but it does not. However
if you view the Input_Log correct results of 'find Routing_Label' are
captured. I have tried various concoctions using $t->waitfor() and
$t->print() as per the module documents but with the same results...
Any ideas?
Chris Nord
######################################################
#! /bin/perl -w
use Net::Telnet;
use strict;
my $cli_user = 'user';
my $cli_pw = 'password';
my $node = 'lab';
my $port = '8123';
my $prompt = '/\[N\/S\]\> /';
my $t = new Net::Telnet ( Timeout => 5,
Prompt => "$prompt",
Errmode => 'return',
Dump_log => 'dump.log',
Input_log => 'in.log',
Output_Log => 'out.log',
);
print "\nConnecting: $node $port\n";
unless ( $t->open (Host => $node, Port => $port) ){
print "ERROR: not able to connect, node:$node port:$port\n";
exit 1;
}
unless ( $t->login($cli_user,$cli_pw) ){
print "ERROR: not able to login, user:$cli_user pw:cli_pw\n";
exit 1;
}
$t->cmd('select switch awspsx1');
$prompt = '/\[awspsx1\]\> /';
print "print data here!!\n";
my @data = $t->cmd('find Routing_Label');
print @data;
# @data remains empty!
$t->cmd('exit');
##### in.log #########################################
Login : user
Password: ........
Sonus Insight V04.01.00R003P10 CLI Shell (Non-Tcl)
Date: Tue Aug 19 14:41:49 PDT 2003
[N/S]> select switch awspsx1
Result: Ok
[awspsx1]> find Routing_Label
Routing_Label_Id
------------------------
CRT_B_MOBILE_RL
CRT_GSX1_GSX2_RL_TDM
CRT_GSX1_GSX2_RL_TDM2te
CRT_GSX2_RL_TDM
RH_ORIG_GW
To_ERIC5000_1
To_ERIC5000_2
To_LOAD_BOX_1
To_LOAD_BOX_2
To_LUANYPATH1
To_LUANYPATH2
To_LUANYPATH3
To_LUCENT2G_1
To_LUCENT2G_2
To_NORTEL2G_1
To_NORTEL2G_2
To_NORTELGSM_1
To_NORTELGSM_2
To_OCTELVM_1
To_SPATIALRTC2
To_SPATIALRTC2_1
To_SPATIALRTC2_2
To_SPATIALWTC3
To_SPATIALWTC3_1
To_SPATIALWTC3_2
To_TSUNAMI_1
To_TSUNAMI_2
Result: Ok
[awspsx1]> exit
Goodbye!
More information about the spug-list
mailing list