Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I created a test script with the relevant code for this. The latest iteration of that code is seen below, with IP addresses/usernames/passwords changed for public sharing...

#!C:/Perl64/bin/perl.exe use Control::CLI; my $mrvip = "1.2.6.4"; my $mrvuser = "mrvuser"; my $mrvpass = "mrvpass"; my $mrvport = "5"; my $mrvenpass = "mrvenpass"; my $oauser = "oauser"; my $oapass = "oapass"; my $bladeuser = "bladeuser"; my $bladepass = "bladepass"; my $obj; my $ok; my $output; my @blades = qw/1 2 3 4 5 6/; my @switches = qw/1 2/; $obj = new Control::CLI ( Use => 'SSH', Timeout => 10800, Input_log => "mrv_oa.input.log", Output_log => "mrv_oa.output.log", Dump_log => "mrv_oa.dump.log", ); $ok = $obj->connect( Host => $mrvip, Username => $mrvuser, Password => + $mrvpass,); $ok = $obj->login( Password => $mrvpass,); $output = $obj->cmd(""); my $oaconn = $obj->cmd("conn port asy $mrvport\n"); if ( $oaconn =~ m/.*Unable to connect to port.*/s ) { $output = $obj->cmd("en"); $output = $obj->cmd("$mrvenpass"); $output = $obj->cmd("logout port asy $mrvport"); $oaconn = $obj->cmd("conn port asy $mrvport"); } $output = $obj->cmd(""); my $oaloginu = $obj->cmd("$oauser"); my $oaloginp = $obj->cmd("$oapass"); foreach my $blade (<@blades>) { print "Connecting To Blade $blade...\n"; my $bladeconn = $obj->cmd("connect server serial $blade\n"); if ($bladeconn =~ m/service is unavailable/s ) { next; } my $port = $obj->port; if (defined($port)) { print " Connected To Blade $blade!\n"; my $bladexit1 = $obj->cmd("\033\050"); } else { print " Not Connected To Blade $blade...\n"; } } foreach my $switch (<@switches>) { print "Connecting To Switch $switch...\n"; my $bladeconn = $obj->cmd("connect interconnect $switch\n"); my $port = $obj->port; if (defined($port)) { print " Connected To Switch $switch!\n"; my $switchexit = $obj->print("\037"); # <== PROBLEM $output = $obj->put("D"); # <== PROBLEM } else { print " Not Connected To Switch $switch...\n"; } } #$output = $obj->cmd("quit"); #$output = $obj->print("\032"); #$output = $obj->print("\145"); #$output = $obj->cmd("e");

The worst part is, in the dump log, I can see it sending the HEX to the remote machine, but it does not respond properly to the code (in this case, the "1f" 2 lines from bottom)...

... redacted for readability... < 0x00020: 0d 0a 45 73 63 61 70 65 20 63 68 61 72 61 63 74 ..Escap +e charact < 0x00000: 65 72 20 69 73 20 27 3c 43 74 72 6c 3e 5f 27 20 er is ' +<Ctrl>_' < 0x00010: 28 43 6f 6e 74 72 6f 6c 20 2b 20 53 68 69 66 74 (Contro +l + Shift < 0x00020: 20 2b 20 55 6e 64 65 72 73 63 6f 72 65 29 0d 0d + Unde +rscore).. < 0x00000: 0a 0d 0a 50 72 65 73 73 20 5b 45 6e 74 65 72 5d ...Pres +s [Enter] < 0x00010: 20 74 6f 20 64 69 73 70 6c 61 79 20 74 68 65 20 to dis +play the < 0x00020: 73 77 69 74 63 68 20 63 6f 6e 73 6f 6c 65 3a 20 switch +console: > 0x00000: 1f 0a .. > 0x00000: 44 D

In reply to Re^2: Control:CLI or Net::SSH2 - Send <ctrl>_ by ImJustAFriend
in thread Control:CLI or Net::SSH2 - Send <ctrl>_ by ImJustAFriend

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2024-04-25 11:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found