Netshot
Netshot copied to clipboard
HPE Switches Drivers
Hello! Any idea if there's plan to write a driver for HPE switches?
Thanks!
Hi all, Netshot seems to be a great software, but unfortunately there is no driver for HPE switches. I try to write my own, I started from the Huawei driver, because the commands are very similar. So I replaced all the specific Huawei commands with HPE commands, but I am stocked with an error:
[INFO] Snapshot task for device [NONAME] (X.X.X.X). [ERROR] Error while taking the snapshot: Error while running CLI macro 'user' in at line number 143 at column number 4 [TRACE] Will try Telnet credentials RDL Telnet. [ERROR] I/O error: Timeout waiting for the command output. [ERROR] Error while running snapshot using driver HPE SWITCH: 'Error while running CLI macro 'user' in at line number 143 at column number 4'.
As I am not a developer, it is quite hard for me to find out the solution. Any help?
@hemh, the error message means the 'user' prompt /^(<[A-Za-z\-_0-9\.]+>)$/
was not matched in the output coming from the switch. You can try to run the snapshot in debug mode (see https://github.com/netfishers-onl/Netshot/wiki/Snapshot-troubleshooting) to identify the mismatch. Share the result if you want some help.
Thank you very much SCadilhac! It helped me a lot. I then learned how to use regex tanks to this site:https://rubular.com/ and I have been abble to write my own script for HPE switches(I built it for the version 3208P03, not shure it will work for other versions. I share my driver if other people are interested to improve it. HPE switch 3208P03.zip
Other question, why the HPE driver is not automatically selected when I had a HPE device, like for cisco device? Each time, it is the Generic SNMP that is used if I do not force the utilization of HPE driver
@hemh, you need to customize the snmpAutoDiscover
function with the sysObjectId and sysDesc values which identify any HPE device compatible with your driver.
Thanks, autodiscover work now. If other people are intersted in improve the HPE driver, don't hesitate to contact me by MP.
I am trying to use my driver on another HPE model (7900) and the driver is stocked, check the logs:
[ERROR] I/O error: Timeout waiting for the command output. [ERROR] I/O error: Read timed out [ERROR] Error while running snapshot using driver HPE SWITCH 7900: 'Error while waiting for a response from the device after command 'display current-configuration' in at line number 224 at column number 5'.
It is like the command in the following line is not issued : var currentConfig = cli.command("display current-configuration"); Any idea?
Hi,
To bring more details about the above problem here are the netshot logs for a specific snapshot that doesn't work:
2019-10-17 13:16:38,290 ERROR [QuartzScheduler_Worker-1] TakeSnapshotTask: Error while taking the snapshot.
javax.script.ScriptException: Error while waiting for a response from the device after command 'save force' in
It is very weird, because my HPE driver work for about 50 devices and is not working for 10 other witch are of the same model, same version...I try to find out but I see no difference in the behaviour, what could cause this? And the most weir is that I can see in the switch logs that the command is issued, but Netshot seems unable to proccess the output.
In both cases, the logs indicate a timeout after the passed command. In most cases:
- There is a paging system on the device (e.g. the device displays
--More--
and waits for a key to be pressed) - Or the device displays a confirmation message and waits for an answer
- Or the prompt has changed after the command
You should look at the debugging logs to see the precise data sent by the device. Or share your code and the debugging logs to get some help.
Thank you SCadilhac...Sorry for that, the problem was due to the fact that SSH prompt is different than TELNET prompt.
Here is the telnet prompt: login: login Password: <XXXSW1>
Here is the SSH prompt: login as: login [email protected]'s password:
But If I force to use telnet, The driver work.
I add my new driver version.
When using SSH, the username and login are not exposed to the script (authentication is handled directly at the SSH level), so you don't have to adjust username and password macros for SSH. Your password prompt doesn't look good as a regular expression even if it may work. Please provide a debug of the snapshot (https://github.com/netfishers-onl/Netshot/wiki/Snapshot-troubleshooting) if you want more help (for SSH only, or with a fake password for Telnet).
So I change my password prompt.
Here is the debug file of a host that doesn't work: debug_2411.zip
Here is the driver updated HPE switch 3208P03-v2.zip
Here are the Netshol logs: [INFO] Snapshot task for device [NONAME] (172.19.1.3). [ERROR] Error while taking the snapshot: Error while waiting for a response from the device after command 'save force' in at line number 224 at column number 5 [ERROR] I/O error: Timeout waiting for the command output. [ERROR] I/O error: Read timed out [ERROR] Error while running snapshot using driver HPE SWITCH: 'Error while waiting for a response from the device after command 'save force' in at line number 224 at column number 5'.
Thank you very much for your help.
Is this Telnet or SSH snapshot attempt?
It is a telnet attempt,
I can't see an exact correlation between the trace and the version of the driver you provided. Are you sure they match? I thought Telnet was OK. I shall try with a virtual Comware device.
Hi Sylvain, my driver works well with HPE 5130, and HPE 5700 but no way to make it work with HPE FF 7910 and HPE 5120. I guess this is because of the history of HP(old mix of 3COM, Huawei and H3C) You can find a good history of the brand here: https://sites.google.com/site/jrbinks/code/rancid/h3c. But my main need is for the HP FF 7910, as this is our Core router, do you have a way to get the hand on a virtual version of that model?
@hemh, I have no experience with HPE switches, I have no idea whether the virtual edition version would look to which of the versions you use, so I'm not willing to waste time on this. If you want more help, please provide the full login sequence (copy/paste from your preferred terminal when you connect manually) for each version in both Telnet and SSH.
Hello,
I worked on this issue and have a bit of a working driver. Sort of used the example attached but it has been heavily modified.
It is able to pull hostname and config. Otherwise the script is a mess. Literally my first time in javascript.
I have tried to get snmp autodiscover working but it doesnt work. The OID there does give that result. It ought to always be that but it doesnt seem to pull.
SNMP autodiscovery is pretty simple. Your script's snmpAutoDiscover
function will get sysObjectID and sysDesc values, it must return true
or false
whether it supports the device or not.
What is the result of snmpwalk -v2c -c [community] [IP of the device] 1.3.6.1.2.1.1
for your device?
That's the difficulty I think. That OID doesn't exist for procurve switches.
Name/OID: system; Value (NoSuchObject): (Snmp No Such Object)
Though looking at it now.
ObjectID and Desc is following:
Name/OID: sysObjectID.0; Value (OID): .1.3.6.1.4.1.11.2.3.7.11.88
Name/OID: sysDescr.0; Value (OctetString): ProCurve J9279A Switch 2510G-24, revision Y.11.41, ROM N.10.02 (/sw/code/build/cod)
If I do the follow it just shows up as Generic SNMP device.
function snmpAutoDiscover(sysObjectID, sysDesc) { return sysObjectID.substring(0, 255) == ".1.3.6.1.4.1.11.2.3.7.11.88" && sysDesc.match(/ProCurve*/); }
Hi, did you read this page: https://networkangle.com/rancid-for-hp-h3c-huawei-switches/
On Mon, Feb 22, 2021 at 2:08 PM tbiens [email protected] wrote:
That's the difficulty I think. That OID doesn't exist for procurve switches.
Name/OID: system; Value (NoSuchObject): (Snmp No Such Object)
Though looking at it now.
ObjectID and Desc is following:
Name/OID: sysObjectID.0; Value (OID): .1.3.6.1.4.1.11.2.3.7.11.88
Name/OID: sysDescr.0; Value (OctetString): ProCurve J9279A Switch 2510G-24, revision Y.11.41, ROM N.10.02 (/sw/code/build/cod)
If I do the follow it just shows up as Generic SNMP device.
function snmpAutoDiscover(sysObjectID, sysDesc) { return sysObjectID.substring(0, 255) == ".1.3.6.1.4.1.11.2.3.7.11.88" && sysDesc.match(/ProCurve*/); }
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/netfishers-onl/Netshot/issues/54#issuecomment-783604043, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACI5EM6GMGCO6SNLSJGOMJTTAKTTFANCNFSM4I5GJJUQ .
Name/OID: sysObjectID.0; Value (OID): .1.3.6.1.4.1.11.2.3.7.11.88 Name/OID: sysDescr.0; Value (OctetString): ProCurve J9279A Switch 2510G-24, revision Y.11.41, ROM N.10.02 (/sw/code/build/cod)
1.3.6.1.4.1.11.2.3.7.11.88 points to a specific model, hpSwitchJ9279A
function snmpAutoDiscover(sysObjectID, sysDesc) { return sysObjectID.substring(0, 255) == ".1.3.6.1.4.1.11.2.3.7.11.88" && sysDesc.match(/ProCurve*/); }
You may want to write something like:
function snmpAutoDiscover(sysObjectID, sysDesc) {
return sysObjectID.substring(0, 24) == "1.3.6.1.4.1.11.2.3.7.11." && sysDesc.match(/ProCurve/);
}
No luck with that. Still being detected as Generic SNMP Device.