Hi all, I am getting errors, even though successful telnet on machine (observed in Telnet log file also I have put below code and telnet log content ) Telnet log code section:

my $comdb_copy_obj= new Net::Telnet (Timeout => 20, Input_log=>($Prepa +reENB_Telnet_copycomdb_log)); if ($comdb_copy_obj->open(Host => $tftp_ServerIP, Port =>'23') != +1) { print ("connection success"); return "ERROR_CONNECTION" ; }

"Below are the telnet log file PrepareENB_Telnet_copycomdb_log.txt content

Ubuntu 12.04.3 LTS tdd login: tdd Password: Last login: Fri Dec 19 12:08:10 IST 2014 from ThinkCentre-E73.local on pts/9 Welcome to Ubuntu 12.04.3 LTS (GNU/Linux 3.8.0-29-generic i686) * Documentation: https://help.ubuntu.com/ 365 packages can be updated. 179 updates are security updates. New release '14.04.1 LTS' available. Run 'do-release-upgrade' to upgrade to it. tdd:~$"

But even for successful telnet on machine (which we can confirm from above output and prompt ) I found below errors for Wait function.

Uncaught exception from user code: pattern match timed-out at /media/TDD_ATF/PrepareENB.pm line 55 at /usr/share/perl5/Net/Telnet.pm line 2036

Net::Telnet::_croak('Net::Telnet=GLOB(0x1de46c8)', 'pattern match timed-out') called at /usr/share/perl5/Net/Telnet.pm line 539 Net::Telnet::error('Net::Telnet=GLOB(0x1de46c8)', 'pattern match timed-out') called at /usr/share/perl5/Net/Telnet.pm line 1995 Net::Telnet::waitfor('Net::Telnet=GLOB(0x1de46c8)', 'Match', '/tdd:~$/i', 'Timeout', 200) called at /media/TDD_ATF/PrepareENB.pm line 55

And below are my code section where I am getting error

sub Copy_config { my $comdb_copy_obj= new Net::Telnet (Timeout => 20, Input_log=>($Prepa +reENB_Telnet_copycomdb_log)); if ($comdb_copy_obj->open(Host => $tftp_ServerIP, Port =>'23') != +1) { print ("connection success"); return "ERROR_CONNECTION" ; } my $user = "tdd"; my $password = "tdd123"; my $comdbcopy_cmd = "cp -rf /home/tdd/LTE/ATF/TDD_ATF/$BW/$TM/$UD/ +eNBcfg10.102.81.60.bin /tftpboot/" ; my $prompt = '/tdd:~$/i'; $comdb_copy_obj->open($tftp_ServerIP); $comdb_copy_obj->waitfor('/tdd login:/i'); $comdb_copy_obj->print($user); $comdb_copy_obj->waitfor('/Password:/i'); $comdb_copy_obj->print($password); 1. $comdb_copy_obj->waitfor('/tdd:~$/i'); 2. $comdb_copy_obj->waitfor(Match => $prompt, Timeout => $comdb_co +py_obj->timeout * 10 ); 3. $comdb_copy_obj->waitfor($comdb_copy_obj->prompt); $comdb_copy_obj->print($comdbcopy_cmd); $comdb_copy_obj->waitfor(Match => $prompt, Timeout => $comdb_copy_ +obj->timeout * 10 ); #$comdb_copy_obj->waitfor('/tdd:~$/i'); #$comdb_copy_obj->waitfor($comdb_copy_obj->prompt); $comdb_copy_obj->print('exit'); $comdb_copy_obj->close; }

In above code I have tried all three options 1,2,3 for wait function but none of them worked and got same error mentioned above. Can anyone please help me . Thanks a bunch in advance.


In reply to Error in Telnet wait function even though succesful telnet on machine by singhabsk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.