Subject: | Perl Issue |
Date: | Mon, 29 Dec 2014 16:22:35 -0500 |
To: | "bug-Control-CLI [...] rt.cpan.org" <bug-Control-CLI [...] rt.cpan.org> |
From: | "Wolfert, Jonathan X" <jwolfert [...] nyiso.com> |
When I attempt to have my program connect to a network device via SSH, it seems to work as I can throw commands at it afterward, but I do receive the following message just after the connection is made to the device. Below is a snippet of my code, as well as the output below it. Please let me know if there is something I am missing, but I believe I am using the module correctly.
sub conn {
my $session = shift;
my $ip = shift;
my $version = shift;
my $second_try = shift;
eval{
${$session} = new Control::CLI('TELNET');
${$session}->connect($ip);
${$session}->login( Username => $username,
Password => $login_pass
);
};
if($@) {
print $tee "Telnet failed, attempting SSH...\n";
eval{
${$session} = new Control::CLI('SSH');
print "Test\n";
${$session}->connect(
Host => $ip,
Username => $username,
Password => $password,
);
};
if($@) {
print $tee "Could not connect to $ip \n";
return 0;
}
print $tee "Connected\n";
};
print "This is a test:\n";
${$session}->cmd("terminal length 0");
my $out = ${$session}->cmd("show vers");
print $out;
}
Output is:
===============
C:\Users\wolfertjx\Desktop\Network Discovery>perl "Network Discovery.pl" Test test test 10.65.6.15
Mon Dec 29 16:16:25 2014
Now processing: 10.65.6.15
Telnet failed, attempting SSH...
Test
Argument "SO_LINGER" isn't numeric in setsockopt at C:/Perl64/lib/IO/Socket.pm l
ine 312.
Connected
This is a test:
Cisco IOS Software, C2960S Software (C2960S-UNIVERSALK9-M), Version 15.0(2)SE4,
RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2013 by Cisco Systems, Inc.
Compiled Wed 26-Jun-13 02:59 by prod_rel_team
...
Regards,
Jonathan Wolfert
Jonathan Wolfert
Network Infrastructure
New York Independent System Operator, Inc.
10 Krey Boulevard
Rensselaer, NY 12144
(C) 518-649-7448
JWolfert@nyiso.com<mailto:JWolfert@nyiso.com>
http://www.nyiso.com
The information in this email is confidential and may be legally privileged against disclosure other than to the intended recipient. It is intended solely for the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. Please immediately delete this message and inform the sender of this error.
Message body is not shown because it is too large.