Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PYTHONPATH=lib
28 changes: 28 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Python",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"env": {
"PYTHONPATHsdsd": "${workspaceFolder}/lib;${env:PYTHONPATH}"
}
},
{
"name": "PyTest",
"type": "python",
"request": "launch",
"stopOnEntry": false,
"module": "pytest",
"args": [
"-sv"
],
"cwd": "${workspaceRoot}",
"env": {},
"envFile": "${workspaceRoot}/.env"
}
]
}
51 changes: 47 additions & 4 deletions lib/nelsnmp/vendors/hpe/versions.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,56 @@
from nelsnmp.hostinfo.version import DeviceVersion

# Comware SAMPLES
#
# Comware Platform Software, Software Version 5.20, Release 2112P08
# HPE Comware Platform Software, Software Version 5.20.105, Release 1810P16
# HPE Comware Platform Software, Software Version 7.1.045, Release 2432P06

# ProCurve SAMPLES
#
# ProCurve 516733-B21 6120XG Blade Switch, revision Z.14.58, ROM Z.14.09 (/ws/swbuildm/Z_zinfandel_fip_t4b_qaoff/code/build/vern(Z1.3.6.1.4.1.11.2.3.7.11.107
# ProCurve J9022A Switch 2810-48G, revision N.11.78, ROM N.10.01 (/sw/code/build/bass)
# HP ProCurve 1810G - 24 GE, P.2.24, eCos-2.0, CFE-2.1
# PROCURVE J9028B - PB.03.10

# OfficeConnect SAMPLES
#
# HPE OfficeConnect Switch 1820 48G J9981A, PT.02.08, Linux 3.6.5-45630aff, U-Boot 2012.10-00119-gae4e43bd91 (Aug 31 2018 - 10:12:27)


class HpeVersion(DeviceVersion):

def _get_version(self):
for line in self._descriptions:
if 'ProCurve' in line:
self.os = 'procurve'
parts = line.split()
if len(parts) > 5:
if parts[4] == 'revision':
self.version = parts[5].split(',')[0]
parts = line.split(',')
if len(parts) > 1:
if 'revision' in parts[1]:
self.version = parts[1].replace('revision', "").strip()
else:
self.version = parts[1].strip()
elif 'PROCURVE' in line:
self.os = 'procurve'
parts = line.split('-')
if len(parts) > 1:
self.version = parts[1].strip()
elif 'OfficeConnect' in line:
self.os = 'officeconnect'
parts = line.split(',')
if len(parts) > 1:
self.version = parts[1].strip()
elif 'Comware' in line:
self.os = 'comware'
parts = line.split(',')
if len(parts) > 1:
if 'Software Version' in parts[1]:
self.version = "V " + parts[1].replace('Software Version', "").strip()
if len(parts) > 2:
if 'Release' in parts[2]:
self.version += " - R " + parts[2].replace('Release', "").strip()
# default HP
elif 'HP' in line:
parts = line.split(',')
if len(parts) > 1:
self.version = parts[1].strip()
1 change: 1 addition & 0 deletions lib/nelsnmp/vendors/mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
vendor_map = {}
vendor_map['9'] = 'cisco'
vendor_map['11'] = 'hpe'
vendor_map['25506'] = 'hpe'
vendor_map['1916'] = 'extreme'
vendor_map['2011'] = 'huawei'
vendor_map['2352'] = 'ericsson'
Expand Down
75 changes: 75 additions & 0 deletions tests/valid_hostinfo_files/hpe.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,83 @@
---
# OID REF
# - https://oidref.com/1.3.6.1.4.1.11.2.3.7.11
# - http://www.circitor.fr/Mibs/Html/H/HH3C-PRODUCT-ID-MIB.php
#
# Get sysobjectid: 1.3.6.1.2.1.1.2

procurve01:
sysobjectid: 1.3.6.1.4.1.11.2.3.7.11.62
description: 'ProCurve j9020a Switch 2510-48, revision U.11.57, ROM R.10.06 (/sw/code/build/dosx'
vendor: hpe
os: procurve
version: U.11.57

procurve-516733-B21:
sysobjectid: 1.3.6.1.4.1.11.2.3.7.11.107
description: 'ProCurve 516733-B21 6120XG Blade Switch, revision Z.14.58, ROM Z.14.09 (/ws/swbuildm'
vendor: hpe
os: procurve
version: Z.14.58

procurve-J9022A:
sysobjectid: 1.3.6.1.4.1.11.2.3.7.11.64
description: 'ProCurve J9022A Switch 2810-48G, revision N.11.78, ROM N.10.01 (/sw/code/build/bass)'
vendor: hpe
os: procurve
version: N.11.78

procurve-J9450A:
sysobjectid: 1.3.6.1.4.1.11.2.3.7.11.104
description: 'HP ProCurve 1810G - 24 GE, P.2.24, eCos-2.0, CFE-2.1'
vendor: hpe
os: procurve
version: P.2.24

procurve-J9028B:
sysobjectid: 1.3.6.1.4.1.11.2.3.7.11.81
description: 'PROCURVE J9028B - PB.03.10'
vendor: hpe
os: procurve
version: PB.03.10

comware-6125G:
sysobjectid: 1.3.6.1.4.1.25506.11.1.103
description: 'Comware Platform Software, Software Version 5.20, Release 2112P08'
vendor: hpe
os: comware
version: V 5.20 - R 2112P08

comware-5820X:
sysobjectid: 1.3.6.1.4.1.25506.11.1.23
description: 'HPE Comware Platform Software, Software Version 5.20.105, Release 1810P16'
vendor: hpe
os: comware
version: V 5.20.105 - R 1810P16

comware-6125XLG:
sysobjectid: 1.3.6.1.4.1.25506.11.1.137
description: 'HPE Comware Platform Software, Software Version 7.1.045, Release 2432P06'
vendor: hpe
os: comware
version: V 7.1.045 - R 2432P06

comware-5950:
sysobjectid: 1.3.6.1.4.1.25506.11.1.260
description: 'HPE Comware Platform Software, Software Version 7.1.070, Release 6301'
vendor: hpe
os: comware
version: V 7.1.070 - R 6301

comware-5710:
sysobjectid: 1.3.6.1.4.1.25506.11.1.287
description: 'HPE Comware Platform Software, Software Version 7.1.070, Release 2702'
vendor: hpe
os: comware
version: V 7.1.070 - R 2702

officeconnect-J9981A:
sysobjectid: 1.3.6.1.4.1.11.2.3.7.11.169
description: 'HPE OfficeConnect Switch 1820 48G J9981A, PT.02.08, Linux 3.6.5-45630aff, U-Boot 2012.10-00119-gae4e43bd91 (Aug 31 2018 - 10:12:27)'
vendor: hpe
os: officeconnect
version: PT.02.08