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
|