Telnetting with Perl to OLT MA5608T

311 views Asked by At

I need help with Net:Telnet. Trying to connect to Huawei OLT M5608 terminal. When using normal telnet from console it works fine. I can connect and issue commands, but when i try the same from Perl, it not connects, waitfor just timeouts and displays that prompt is not matched: "pattern match timed-out at ".
I'v tried all possible prompts but without any success.

From console it works fine:

telnet xxx.xxx.xxx.xxx
Trying xxx.xxx.xxx.xxx...
Connected to xxx.xxx.xxx.xxx.
Escape character is '^]'.
>>User name:root

>>User password:
Huawei Integrated Access Software (MA5608T).
...

Here is my sample code:

use Net::Telnet ();
$remote = new Net::Telnet (Timeout => 5,
                           Errmode => 'return',
                            Dump_Log => 'log.txt');
$remote->open("xxx.xxx.xxx.xxx") or die $remote->errmsg;
$remote->waitfor('/>>User name: $/i') or die $remote->errmsg;
$remote->print("root") or die $remote->errmsg;
$remote->waitfor('/>>User password: $/i') or die $remote->errmsg;
$remote->print("<;-)>") or die $remote->errmsg;
$remote->waitfor('/\$ $/') or die $remote->errmsg;
$remote->print("display idle-timeout") or die $remote->errmsg;
($output) = $remote->waitfor('/\$ $/') or die $remote->errmsg;
print $output;

and cat log.txt

< 0x00000: ff fb 01 ff  fb 03                                  ▒▒.▒▒.
> 0x00000: ff fd 01 ff  fd 03                                  ▒▒.▒▒.
< 0x00000: 0d 0a 3e 3e  55 73 65 72  20 6e 61 6d  65 3a        ..>>User name:

How could the cause be?

0

There are 0 answers