Skip Menu |

This queue is for tickets about the Control-CLI CPAN distribution.

Report information
The Basics
Id: 101194
Status: resolved
Priority: 0/
Queue: Control-CLI

People
Owner: LSTEVENS [...] cpan.org
Requestors: jwolfert [...] nyiso.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 2.00



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.

Subject: RE: [rt.cpan.org #101194] AutoReply: Perl Issue
Date: Tue, 30 Dec 2014 10:07:04 -0500
To: "bug-Control-CLI [...] rt.cpan.org" <bug-Control-CLI [...] rt.cpan.org>
From: "Wolfert, Jonathan X" <jwolfert [...] nyiso.com>
This email address is through a client, which I will not be onsite with much longer. Please use my work email address of jonathan.wolfert@corebts.com . Thank you! 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 http://www.nyiso.com Show quoted text
-----Original Message----- From: Bugs in Control-CLI via RT [mailto:bug-Control-CLI@rt.cpan.org] Sent: Monday, December 29, 2014 4:23 PM To: Wolfert, Jonathan X Subject: [rt.cpan.org #101194] AutoReply: Perl Issue Greetings, This message has been automatically generated in response to the creation of a trouble ticket regarding: "Perl Issue", a summary of which appears below. There is no need to reply to this message right now. Your ticket has been assigned an ID of [rt.cpan.org #101194]. Your ticket is accessible on the web at: https://rt.cpan.org/Ticket/Display.html?id=101194 Please include the string: [rt.cpan.org #101194] in the subject line of all future correspondence about this issue. To do so, you may reply to this message. Thank you, bug-Control-CLI@rt.cpan.org ------------------------------------------------------------------------- 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. 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.
RT-Send-CC: jonathan.wolfert [...] corebts.com
Hi Jonathan That message you get is just a warning so yes it won't stop the script from working. I 'use warnings' on all my scripts and yet that never showed up for me; however I found that if I run perl with the -w switch, then I also get the same warning message. Not sure why that is... Anyhow seems the solution should be pretty straightforward; if you are using version 1.06 of Control::CLI changing line 364 in CLI.pm should do it: - $self->{SOCKET}->sockopt('SO_LINGER', pack('SS', 0, 0)); + $self->{SOCKET}->sockopt(&Socket::SO_LINGER, pack('SS', 0, 0)); I was on the verge of posting a major update to this module on the same day you raised this! So I have made the above change in 2.00 which I just posted. Let me know if that fixes the problem. Best regards Ludovico Stevens On Tue Dec 30 10:08:34 2014, jwolfert@nyiso.com wrote: Show quoted text
> This email address is through a client, which I will not be onsite > with much longer. Please use my work email address of > jonathan.wolfert@corebts.com . Thank you! > > > 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 > http://www.nyiso.com > > > -----Original Message----- > From: Bugs in Control-CLI via RT [mailto:bug-Control-CLI@rt.cpan.org] > Sent: Monday, December 29, 2014 4:23 PM > To: Wolfert, Jonathan X > Subject: [rt.cpan.org #101194] AutoReply: Perl Issue > > > Greetings, > > This message has been automatically generated in response to the > creation of a trouble ticket regarding: > "Perl Issue", > a summary of which appears below. > > There is no need to reply to this message right now. Your ticket has > been assigned an ID of [rt.cpan.org #101194]. Your ticket is > accessible on the web at: > > https://rt.cpan.org/Ticket/Display.html?id=101194 > > Please include the string: > > [rt.cpan.org #101194] > > in the subject line of all future correspondence about this issue. To > do so, you may reply to this message. > > Thank you, > bug-Control-CLI@rt.cpan.org > > ------------------------------------------------------------------------- > 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. > > 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.