Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: jturner [...] corp.iixpeering.net
Cc:
AdminCc:

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



Subject: cmd always returns false exit status
Date: Fri, 13 Feb 2015 11:49:30 -0500
To: <bug-Control-CLI-AvayaData [...] rt.cpan.org>
From: Jay Turner <jturner [...] corp.iixpeering.net>
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Control-CLI-AvayaData-1.00 This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi # uname -a Linux localhost.localdomain 2.6.32-504.el6.x86_64 #1 SMP Wed Oct 15 04:27:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux Not sure if it is the switches I'm working with or something else happening, but all 'cmd' calls exit with code 0, even when successful. Case in point, executing the example code from the CPAN page: $cli->enable; $cli->return_result(1); $cli->cmd('config terminal') or die $cli->last_cmd_errmsg; $cli->cmd('no banner') or die $cli->last_cmd_errmsg; $cli->cmd('exit') or die $cli->last_cmd_errmsg; $cli->return_result(0); $cli->device_more_paging(0); $config = $cli->cmd('show running-config'); print $config; $cli->disconnect; Will result in all of the 'die' options being executed. Yet all of the commands are actually succeeding. Thanks! - - jkt - -- Jay Turner, Director, CloudRouter DevOps, IIX Inc. ✉ jturner@iix.net ☎: +1-919-633-0619 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlTeKxoACgkQA/BpaFGKSrwSDwCeNJpgBh07/q3Cb0DiXh7xHAb9 qrMAn3PqZiiYYFwRSH+QKJp6y87oNV3z =ANYr -----END PGP SIGNATURE-----
Hi Are you testing with an Avaya (or ex-Nortel) switch ? A lot of the functionality of this module will only work on Avaya switches. Setting return_result(1) means that the cmd() method is not only able to complete the command (i.e. wait until it gets a new prompt back; if this fails the error mode action applies) but also to inspect the output of the command to see whether the host did not like the command and generated some error (which means the command was not accepted). This module can do this because it knows what an error message looks like on an Avaya switch. You can check by adding this line: print $cli->attribute('family_type'); If you are getting 'generic' then it would imply that the switch you are connected to is not an Avaya switch. In that case this module falls back on the same functionality provided by Control::CLI, and hence the ability mentioned above (return_result(1)) is not available and, yes, the cmd() method will always returns undef in that case. So if your switch is not an Avaya switch, I suggest you use Control::CLI instead. Or if you want to use this module, do not enable return_result(1); I shall update documentation to clarify this. Whereas if your switch is an Avaya switch, then I have a bug! In which case I'd need to know more details about the switch you are using. Best regards Ludovico Stevens On Fri Feb 13 11:49:46 2015, jturner@corp.iixpeering.net wrote: Show quoted text
> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Control-CLI-AvayaData-1.00 > This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi > # uname -a > Linux localhost.localdomain 2.6.32-504.el6.x86_64 #1 SMP Wed Oct 15 > 04:27:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux > > Not sure if it is the switches I'm working with or something else > happening, but all 'cmd' calls exit with code 0, even when successful. > Case in point, executing the example code from the CPAN page: > > $cli->enable; > $cli->return_result(1); > $cli->cmd('config terminal') or die $cli->last_cmd_errmsg; > $cli->cmd('no banner') or die $cli->last_cmd_errmsg; > $cli->cmd('exit') or die $cli->last_cmd_errmsg; > $cli->return_result(0); > $cli->device_more_paging(0); > $config = $cli->cmd('show running-config'); > print $config; > $cli->disconnect; > > Will result in all of the 'die' options being executed. Yet all of > the commands are actually succeeding. > > Thanks! > > - - jkt > > - -- > Jay Turner, Director, CloudRouter DevOps, IIX Inc. > ✉ jturner@iix.net ☎: +1-919-633-0619 > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1 > > iEYEARECAAYFAlTeKxoACgkQA/BpaFGKSrwSDwCeNJpgBh07/q3Cb0DiXh7xHAb9 > qrMAn3PqZiiYYFwRSH+QKJp6y87oNV3z > =ANYr > -----END PGP SIGNATURE-----
Subject: Re: [rt.cpan.org #102108] cmd always returns false exit status
Date: Tue, 17 Feb 2015 15:26:27 -0800
To: <bug-Control-CLI-AvayaData [...] rt.cpan.org>
From: Jay Turner <jturner [...] corp.iixpeering.net>
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 02/14/2015 05:48 AM, Ludovico Stevens via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=102108 > > > Hi Are you testing with an Avaya (or ex-Nortel) switch ? A lot of > the functionality of this module will only work on Avaya switches. > Setting return_result(1) means that the cmd() method is not only > able to complete the command (i.e. wait until it gets a new prompt > back; if this fails the error mode action applies) but also to > inspect the output of the command to see whether the host did not > like the command and generated some error (which means the command > was not accepted). This module can do this because it knows what an > error message looks like on an Avaya switch. > > You can check by adding this line: print > $cli->attribute('family_type'); > > If you are getting 'generic' then it would imply that the switch > you are connected to is not an Avaya switch. In that case this > module falls back on the same functionality provided by > Control::CLI, and hence the ability mentioned above > (return_result(1)) is not available and, yes, the cmd() method will > always returns undef in that case. > > So if your switch is not an Avaya switch, I suggest you use > Control::CLI instead. Or if you want to use this module, do not > enable return_result(1); I shall update documentation to clarify > this. > > Whereas if your switch is an Avaya switch, then I have a bug! In > which case I'd need to know more details about the switch you are > using.
I am indeed connected to an Avaya switch. $cli->attribute('family_type') returns "BaystackERS" Model: 7024XLS Software Version: v10.3.3.001 Firmware Version: v10.1.0.6 Let me know what other information I can provide. Thanks! - - jkt - -- Jay Turner, Director, CloudRouter DevOps, IIX Inc. ✉ jturner@iix.net ☎: +1-919-633-0619 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlTjziMACgkQA/BpaFGKSrzCNQCfUJa7uEm19LuewYbNMJoWcJI1 itoAnixpCueEO7XK3A77JMtH0P0q2l+q =aT2U -----END PGP SIGNATURE-----
Hi Jay Ok, I'm not sure why this is not working then. I use it all the time on my VSP7000s. What does die $cli->last_cmd_errmsg actually print out for you ? And can you please run the test script against your switch ? I'd like to activate the debug and logging in it. I have attached the test script with the debug and logging already activated. If you can just run it with: perl avayadata.t Then provide your switch IP and login credentials interactively. When it has completed, I'd like the output as well as files avayadata.t.dbg and avayadata.t.dump. Thanks Best regards Ludovico Stevens On Tue Feb 17 18:27:00 2015, jturner@corp.iixpeering.net wrote: Show quoted text
> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 02/14/2015 05:48 AM, Ludovico Stevens via RT wrote:
> > <URL: https://rt.cpan.org/Ticket/Display.html?id=102108 > > > > > Hi Are you testing with an Avaya (or ex-Nortel) switch ? A lot of > > the functionality of this module will only work on Avaya switches. > > Setting return_result(1) means that the cmd() method is not only > > able to complete the command (i.e. wait until it gets a new prompt > > back; if this fails the error mode action applies) but also to > > inspect the output of the command to see whether the host did not > > like the command and generated some error (which means the command > > was not accepted). This module can do this because it knows what an > > error message looks like on an Avaya switch. > > > > You can check by adding this line: print > > $cli->attribute('family_type'); > > > > If you are getting 'generic' then it would imply that the switch > > you are connected to is not an Avaya switch. In that case this > > module falls back on the same functionality provided by > > Control::CLI, and hence the ability mentioned above > > (return_result(1)) is not available and, yes, the cmd() method will > > always returns undef in that case. > > > > So if your switch is not an Avaya switch, I suggest you use > > Control::CLI instead. Or if you want to use this module, do not > > enable return_result(1); I shall update documentation to clarify > > this. > > > > Whereas if your switch is an Avaya switch, then I have a bug! In > > which case I'd need to know more details about the switch you are > > using.
> > I am indeed connected to an Avaya switch. > > $cli->attribute('family_type') returns "BaystackERS" > Model: 7024XLS > Software Version: v10.3.3.001 > Firmware Version: v10.1.0.6 > > Let me know what other information I can provide. > > Thanks! > > - - jkt > > - -- > Jay Turner, Director, CloudRouter DevOps, IIX Inc. > ✉ jturner@iix.net ☎: +1-919-633-0619 > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1 > > iEYEARECAAYFAlTjziMACgkQA/BpaFGKSrzCNQCfUJa7uEm19LuewYbNMJoWcJI1 > itoAnixpCueEO7XK3A77JMtH0P0q2l+q > =aT2U > -----END PGP SIGNATURE-----
Subject: avayadata.t

Message body is not shown because it is too large.

Subject: Re: [rt.cpan.org #102108] cmd always returns false exit status
Date: Thu, 19 Feb 2015 09:54:01 -0800
To: <bug-Control-CLI-AvayaData [...] rt.cpan.org>
From: Jay Turner <jturner [...] corp.iixpeering.net>
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 02/18/2015 02:26 PM, Ludovico Stevens via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=102108 > > > Hi Jay > > Ok, I'm not sure why this is not working then. I use it all the > time on my VSP7000s. What does die $cli->last_cmd_errmsg actually > print out for you ? And can you please run the test script against > your switch ? I'd like to activate the debug and logging in it. I > have attached the test script with the debug and logging already > activated. If you can just run it with: perl avayadata.t Then > provide your switch IP and login credentials interactively. When it > has completed, I'd like the output as well as files avayadata.t.dbg > and avayadata.t.dump.
Very strange. This all seems to execute correctly, and yet I'm still receiving the wrong exit code from commands which, seemingly, are working! Attached are the files. - - jkt - -- Jay Turner, Director, CloudRouter DevOps, IIX Inc. ✉ jturner@iix.net ☎: +1-919-633-0619 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlTmIzkACgkQA/BpaFGKSrwj0wCfR74D6AvN5twT59eN+tTyt4mj 03UAn2R3Ex030LNkHovV3ha93Fjbd9li =B+wO -----END PGP SIGNATURE-----

Message body is not shown because sender requested not to inline it.

Message body is not shown because sender requested not to inline it.

Message body is not shown because sender requested not to inline it.

Hi Jay Thanks for the debug files. Ok, so there was no problem there and it worked as expected. I have an identical VSP7000 in my lab where this scripts works fine (and none of the dies execute): use warnings; use Control::CLI::AvayaData; $cli = new Control::CLI::AvayaData('SSH'); $cli->connect(Host => '10.134.169.73', Username => 'RW',Password => 'RW'); $cli->enable; $cli->return_result(1); $cli->cmd('config terminal') or die $cli->last_cmd_errmsg; $cli->cmd('no banner') or die $cli->last_cmd_errmsg; $cli->cmd('exit') or die $cli->last_cmd_errmsg; $cli->return_result(0); $cli->device_more_paging(0); $config = $cli->cmd('show ip'); print $config; $cli->disconnect; I'm using Windows with Perl v5.16.3 and Solaris with Perl v5.12.3 and the above works on both. You have an older version of Perl, but that should really not matter, particularly as the test script worked fine. Can you share your full script (including use, new and connect statements) please ? Also, when cmd() dies, what does die $cli->last_cmd_errmsg actually print out please ? If you 'use warnings', does die complain about undefined value or does it actually print something ? I might then ask you to run your script with some additional debug. We'll get there.. Thanks Best regards Ludovico Stevens On Thu Feb 19 12:54:35 2015, jturner@corp.iixpeering.net wrote: Show quoted text
> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 02/18/2015 02:26 PM, Ludovico Stevens via RT wrote:
> > <URL: https://rt.cpan.org/Ticket/Display.html?id=102108 > > > > > Hi Jay > > > > Ok, I'm not sure why this is not working then. I use it all the > > time on my VSP7000s. What does die $cli->last_cmd_errmsg actually > > print out for you ? And can you please run the test script against > > your switch ? I'd like to activate the debug and logging in it. I > > have attached the test script with the debug and logging already > > activated. If you can just run it with: perl avayadata.t Then > > provide your switch IP and login credentials interactively. When it > > has completed, I'd like the output as well as files avayadata.t.dbg > > and avayadata.t.dump.
> > Very strange. This all seems to execute correctly, and yet I'm still > receiving the wrong exit code from commands which, seemingly, are working! > > Attached are the files. > > - - jkt > > > - -- > Jay Turner, Director, CloudRouter DevOps, IIX Inc. > ✉ jturner@iix.net ☎: +1-919-633-0619 > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1 > > iEYEARECAAYFAlTmIzkACgkQA/BpaFGKSrwj0wCfR74D6AvN5twT59eN+tTyt4mj > 03UAn2R3Ex030LNkHovV3ha93Fjbd9li > =B+wO > -----END PGP SIGNATURE-----
Jay Did you manage to sort this out ? If not, I will need that extra info from your side. Best regards Ludovico Stevens On Thu Feb 19 16:29:02 2015, LSTEVENS wrote: Show quoted text
> Hi Jay > Thanks for the debug files. > Ok, so there was no problem there and it worked as expected. > I have an identical VSP7000 in my lab where this scripts works fine > (and none of the dies execute): > > use warnings; > use Control::CLI::AvayaData; > $cli = new Control::CLI::AvayaData('SSH'); > $cli->connect(Host => '10.134.169.73', Username => 'RW',Password => > 'RW'); > $cli->enable; > $cli->return_result(1); > $cli->cmd('config terminal') or die $cli->last_cmd_errmsg; > $cli->cmd('no banner') or die $cli->last_cmd_errmsg; > $cli->cmd('exit') or die $cli->last_cmd_errmsg; > $cli->return_result(0); > $cli->device_more_paging(0); > $config = $cli->cmd('show ip'); > print $config; > $cli->disconnect; > > I'm using Windows with Perl v5.16.3 and Solaris with Perl v5.12.3 and > the above works on both. You have an older version of Perl, but that > should really not matter, particularly as the test script worked fine. > > Can you share your full script (including use, new and connect > statements) please ? > Also, when cmd() dies, what does die $cli->last_cmd_errmsg actually > print out please ? If you 'use warnings', does die complain about > undefined value or does it actually print something ? > > I might then ask you to run your script with some additional debug. > We'll get there.. > > Thanks > Best regards > Ludovico Stevens > > > On Thu Feb 19 12:54:35 2015, jturner@corp.iixpeering.net wrote:
> > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > On 02/18/2015 02:26 PM, Ludovico Stevens via RT wrote:
> > > <URL: https://rt.cpan.org/Ticket/Display.html?id=102108 > > > > > > > Hi Jay > > > > > > Ok, I'm not sure why this is not working then. I use it all the > > > time on my VSP7000s. What does die $cli->last_cmd_errmsg actually > > > print out for you ? And can you please run the test script against > > > your switch ? I'd like to activate the debug and logging in it. I > > > have attached the test script with the debug and logging already > > > activated. If you can just run it with: perl avayadata.t Then > > > provide your switch IP and login credentials interactively. When it > > > has completed, I'd like the output as well as files avayadata.t.dbg > > > and avayadata.t.dump.
> > > > Very strange. This all seems to execute correctly, and yet I'm still > > receiving the wrong exit code from commands which, seemingly, are > > working! > > > > Attached are the files. > > > > - - jkt > > > > > > - -- > > Jay Turner, Director, CloudRouter DevOps, IIX Inc. > > ✉ jturner@iix.net ☎: +1-919-633-0619 > > -----BEGIN PGP SIGNATURE----- > > Version: GnuPG v1 > > > > iEYEARECAAYFAlTmIzkACgkQA/BpaFGKSrwj0wCfR74D6AvN5twT59eN+tTyt4mj > > 03UAn2R3Ex030LNkHovV3ha93Fjbd9li > > =B+wO > > -----END PGP SIGNATURE-----
Subject: Re: [rt.cpan.org #102108] cmd always returns false exit status
Date: Thu, 12 Mar 2015 08:38:50 -0400
To: <bug-Control-CLI-AvayaData [...] rt.cpan.org>
From: Jay Turner <jturner [...] corp.iixpeering.net>
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 03/12/2015 08:22 AM, Ludovico Stevens via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=102108 > > > Jay Did you manage to sort this out ? If not, I will need that > extra info from your side.
Ah yes. Sorry about that. I should have followed-up sooner. It appears the switch itself was to blame for the behavior I was seeing. Having fixed that problem, my scripts are functioning as expected. Thanks! - - jkt - -- Jay Turner, Director, CloudRouter DevOps, IIX Inc. ✉ jturner@iix.net ☎: +1-919-633-0619 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlUBiNoACgkQA/BpaFGKSryPYACcDj43WzYXqXO0c9Um++JFDyGY 4YIAnjPZBVM8fvcacbDrYQWIYIgNUxaO =gztX -----END PGP SIGNATURE-----
Thanks! Glad to hear that. On Thu Mar 12 08:39:11 2015, jturner@corp.iixpeering.net wrote: Show quoted text
> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 03/12/2015 08:22 AM, Ludovico Stevens via RT wrote:
> > <URL: https://rt.cpan.org/Ticket/Display.html?id=102108 > > > > > Jay Did you manage to sort this out ? If not, I will need that > > extra info from your side.
> > Ah yes. Sorry about that. I should have followed-up sooner. It > appears the switch itself was to blame for the behavior I was seeing. > Having fixed that problem, my scripts are functioning as expected. > > Thanks! > > - - jkt > > > - -- > Jay Turner, Director, CloudRouter DevOps, IIX Inc. > ✉ jturner@iix.net ☎: +1-919-633-0619 > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1 > > iEYEARECAAYFAlUBiNoACgkQA/BpaFGKSryPYACcDj43WzYXqXO0c9Um++JFDyGY > 4YIAnjPZBVM8fvcacbDrYQWIYIgNUxaO > =gztX > -----END PGP SIGNATURE-----