HPNA perl scripts failing (1233 Views)
Reply
Advisor
Niff
Posts: 15
Registered: ‎06-27-2013
Message 1 of 11 (1,233 Views)

HPNA perl scripts failing

So, I have a brand new install of hpna, running on *nix, and all my scripts give a:

 

Failed to connect. at /tmp/t152741.t229 line 15.

 

 

When I try to run them, with line 15 being:

 

015 $con->connect( $device ) or die "Failed to connect.";

 

And the rest of the predefined part of the script (all made by hpna from the change ssh session to perl script being:

 

001 #!/usr/bin/perl
002 use strict;
003 use warnings;
004 use Getopt::Long;
005 use Opsware::NAS::Connect;
006
007 my($host, $port, $user, $pass) = ('localhost','8023','user','********');
008 my $device = '#201';
009 my @output;
010
011
012 my $con = Opsware::NAS::Connect->new(-user => $user, -pass => $pass, -host => $host, -port => $port, -debug => 25);
013
014 $con->login();
015 $con->connect( $device ) or die "Failed to connect.";

 

I am trying to connect to a 3com switch, and according to the debug information, (attached) it is connecting as it grabs some stuff off the switch (first menu) I don't know what part is failing.

 

 

If anyone could offer some advice on why my script "fails to connect" it would be much appreciated

 

.

HP Expert
JFerong
Posts: 182
Registered: ‎05-17-2012
Message 2 of 11 (1,211 Views)

Re: HPNA perl scripts failing

Hi;

 

Thanks for using the Forums!

 

From the looks of the log, it is timing out waiting for a prompt that isn't defined properly.

 

Since the API goes through NA and uses the password rules for that device, all necessary access variables need to be set up in NA. 

 

I have a couple of questions that may help shed some light on this. 

 

What is the SysOID for this device?  (we have a like device in our lab, but not exactly the same model)

What driver is assigned to the device?  Did it autoassign or did you manually assign it?

 

With that information, we may be able to have a better understanding of how to proceed with this.

 

Joe

Online outReach Resource
HP Support

The views and opinions expressed in my contributions are my own and do not necessarily reflect the views and strategy of HP

If you find that this or any other post resolves your issue, please be sure to mark it as an accepted solution.
If you are satisfied with anyone’s response please remember to give them a KUDOS by clicking on the STAR at the bottom left of the post and show your appreciation.
Advisor
Niff
Posts: 15
Registered: ‎06-27-2013
Message 3 of 11 (1,206 Views)

Re: HPNA perl scripts failing

Thanks for the reply JFerong,  The SysOID for our 3coms are 1.3.6.1.4.1.43.10.27.4.1.2.5

As for driver, Most of the 3coms automatically find the right driver, but to be safe we assigned this one ourselves (3Com SuperStack 3 switches, OS version 3.x, 6.x)  I was talking to HP eariler today and learned about the password rules and how we can set the prompt vars from the ruleset, is that the solution I should be considering?

HP Expert
JFerong
Posts: 182
Registered: ‎05-17-2012
Message 4 of 11 (1,193 Views)

Re: HPNA perl scripts failing

Hi;

 

So, that is not a device that we specifically support.  So, using any driver for this device has the risk of unexpected behavior.   

 

It is possible that this device worked before a driver upgrade and doesn't work now.  We do a lot of work fixing drivers for their intended devices and sometimes a driver that worked for an unsupported device prior to the driver upgrade becomes non-functional for that device.

 

 The best course of action for this issue is to open a Support Case with NA and request that this device be supported. 

 

 

I am attaching the Driver Request Document in this reply.  Please fill it out as completely as possible and attach it to the case when you open it.

Joe

Online outReach Resource
HP Support

The views and opinions expressed in my contributions are my own and do not necessarily reflect the views and strategy of HP

If you find that this or any other post resolves your issue, please be sure to mark it as an accepted solution.
If you are satisfied with anyone’s response please remember to give them a KUDOS by clicking on the STAR at the bottom left of the post and show your appreciation.
Advisor
Niff
Posts: 15
Registered: ‎06-27-2013
Message 5 of 11 (1,191 Views)

Re: HPNA perl scripts failing

That is interesting that the specific 3com is not supported within the driver, however this problem persists in the same fashion with a nortel device (Ethernet Routing Switch 5520) That I am positive is supported (as per my co-workers recent discussions with hp) That has the same issue of "Failed to connect."
HP Expert
JFerong
Posts: 182
Registered: ‎05-17-2012
Message 6 of 11 (1,179 Views)

Re: HPNA perl scripts failing

Hi;

 

Yes it is possible that you are dealing with the same issue for both devices.   The 3Com is certainly not supported, but the driver may work with it if you set up the correct prompt string in the access variables.  I was considering suggesting that, but you're better off with a supported driver for the device.  Then you won't have the situation later on when a driver is changed to accommodate upgrades in other devices affecting your device.

 

 The "Failed to connect" message can be the result of a number of different things.  Improper Banner Skip Regex, undefined prompts, insufficient timeouts, and many other things.

 

If you are struggling getting NA to connect to the device, I would recommend opening a support case and providing logs so that the driver engineers can look at what is going on.   I would start by providing a session log of the task that gets the error.  That is usually sufficient to get things started.

 

 

Joe

Online outReach Resource
HP Support

The views and opinions expressed in my contributions are my own and do not necessarily reflect the views and strategy of HP

If you find that this or any other post resolves your issue, please be sure to mark it as an accepted solution.
If you are satisfied with anyone’s response please remember to give them a KUDOS by clicking on the STAR at the bottom left of the post and show your appreciation.
HP Expert
Greg Moxham
Posts: 39
Registered: ‎02-18-2009
Message 7 of 11 (1,174 Views)

Re: HPNA perl scripts failing

Adding in a small note here which might be useful for other cases.

 

I agree with Joe that this does seem to be some sort of prompt issue, where NA is not getting the data it is expecting in the buffer, and timing out.

 

However, 2 really interesting things were observed:

 

1. Running the manual connect command at the NA API command prompt as seen in the script log (ie: "connect -info:__INFO__ -nosession #201") works fine and logs into the device, sitting at the enable prompt.

 

I'd usually expect the same behaviour from the NA prompt as for a script.

 

2. When running this script directly from the O/S command line, the output from the command is dumped to the std out as well as the script timing out and dying.

 

This is different to the behaviour when running the script from within NA as an advanced command script.

 

I do still feel this is some kind of prompts issue, as Joe said, but just adding the observations from the call we had yesterday when this issue came up.

 

Greg

Advisor
Niff
Posts: 15
Registered: ‎06-27-2013
Message 8 of 11 (1,153 Views)

Re: HPNA perl scripts failing

Update with another set of debug info for a switch that is supported by HPNA, same script.

 

It is worth noting the command does run, but only if I run the perl script from the command prompt, it does not run if I run it from hpna (with the same error message of failed to connect in each location)

HP Expert
JFerong
Posts: 182
Registered: ‎05-17-2012
Message 9 of 11 (1,141 Views)

Re: HPNA perl scripts failing

Hi;

 

I've been doing some testing today on this. 

 

I used the script that you provided above and it worked for me in HPNA using a Cisco device.  I won't have a 3 Com on line until tomorrow or Thursday.

 

So, looking at the log that you provided in the last post, it seems that you are able to coneect to your device (#311)

<<

--- seems like we have connected to #311

>>

 

and then we get a device prompt:   5530-24TFD#

 

The problems begin when your script tries to do a "show stack health".  The device comes back and says that the "%Switch not in stack.". 

 

Then we try to exit.  i don't have the whole script, so I'm not sure if NA is trying to exit or if you are.  However, I'm suspecting that the exit is in your code stream as that is not how we normally function.  On these kinds of scripts, we usually expect the customer to exit and close the connection.

 

That being said, the problem seems to be in the exit.  It doesn't appear to be a valid command for the menu level that you are at.  So, the last thing that happens is that the current menu is then displayed.

 

It looks like the system is expecting you to be back at the CLI prompt;

The expect shows up on line 178 of your log;   (?m-xis:^(?:ONA|NAS|CWNCM|NCM|NA)\>\s*$)

 

Again, at this point, you are probably better served to open a support case to further investigate.

Joe

Online outReach Resource
HP Support

The views and opinions expressed in my contributions are my own and do not necessarily reflect the views and strategy of HP

If you find that this or any other post resolves your issue, please be sure to mark it as an accepted solution.
If you are satisfied with anyone’s response please remember to give them a KUDOS by clicking on the STAR at the bottom left of the post and show your appreciation.
Advisor
Niff
Posts: 15
Registered: ‎06-27-2013
Message 10 of 11 (1,133 Views)

Re: HPNA perl scripts failing

I do actually have a support case open at this time, although it is yielding less fruitful results than here to say the least...

 

 

 

That said, I have been messing around with a few things and will hopefully have another update based on your comments of the issue occuring on exit soon.

HP Expert
JFerong
Posts: 182
Registered: ‎05-17-2012
Message 11 of 11 (1,079 Views)

Re: HPNA perl scripts failing

Hi Niff;

 

Is this issue cleared up now?  Did the support case resolve it?

 

Can you please provide a status?  if we need to bounce some more ideas around, we can do that.

Joe

Online outReach Resource
HP Support

The views and opinions expressed in my contributions are my own and do not necessarily reflect the views and strategy of HP

If you find that this or any other post resolves your issue, please be sure to mark it as an accepted solution.
If you are satisfied with anyone’s response please remember to give them a KUDOS by clicking on the STAR at the bottom left of the post and show your appreciation.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.