diff --git a/lib/nelsnmp/hostinfo/collect.py b/lib/nelsnmp/hostinfo/collect.py index fbbc0b5..02e3e9c 100644 --- a/lib/nelsnmp/hostinfo/collect.py +++ b/lib/nelsnmp/hostinfo/collect.py @@ -3,6 +3,7 @@ from nelsnmp.vendors.arista.versions import AristaVersion from nelsnmp.vendors.cisco.versions import CiscoVersion from nelsnmp.vendors.ericsson.versions import EricssonVersion +from nelsnmp.vendors.hpe.versions import HpeVersion from nelsnmp.vendors.huawei.versions import HuaweiVersion from nelsnmp.vendors.juniper.versions import JuniperVersion from nelsnmp.vendors.metamako.versions import MetamakoVersion @@ -22,12 +23,14 @@ def get_device_version(**kwargs): vendors['arista'] = AristaVersion vendors['cisco'] = CiscoVersion vendors['ericsson'] = EricssonVersion + vendors['hpe'] = HpeVersion vendors['huawei'] = HuaweiVersion vendors['juniper'] = JuniperVersion vendors['metamako'] = MetamakoVersion if vendor in vendors: return vendors[vendor](**kwargs) + elif vendor == 'net-snmp': if 'snmp' in kwargs.keys(): found_vendor = get_netsnmp_device_vendor(kwargs['snmp']) diff --git a/lib/nelsnmp/vendors/hpe/__init__.py b/lib/nelsnmp/vendors/hpe/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/lib/nelsnmp/vendors/hpe/versions.py b/lib/nelsnmp/vendors/hpe/versions.py new file mode 100644 index 0000000..dcba56d --- /dev/null +++ b/lib/nelsnmp/vendors/hpe/versions.py @@ -0,0 +1,13 @@ +from nelsnmp.hostinfo.version import DeviceVersion + + +class HpeVersion(DeviceVersion): + + def _get_version(self): + for line in self._descriptions: + if (('Aruba' in line and "Switch" in line) or 'revision KB.16.04.' in line): + self.os = 'arubaos-switch' + parts = line.split() + if len(parts) > 6: + if parts[4] == 'revision': + self.version = parts[5].split(',')[0] diff --git a/lib/nelsnmp/vendors/mappings.py b/lib/nelsnmp/vendors/mappings.py index 026bffc..4d3ff85 100644 --- a/lib/nelsnmp/vendors/mappings.py +++ b/lib/nelsnmp/vendors/mappings.py @@ -1,6 +1,7 @@ vendor_map = {} vendor_map['9'] = 'cisco' +vendor_map['11'] = 'hpe' vendor_map['2011'] = 'huawei' vendor_map['2352'] = 'ericsson' vendor_map['2636'] = 'juniper' diff --git a/tests/valid_hostinfo_files/hpe.yml b/tests/valid_hostinfo_files/hpe.yml new file mode 100644 index 0000000..fafcccc --- /dev/null +++ b/tests/valid_hostinfo_files/hpe.yml @@ -0,0 +1,15 @@ +--- +arubaos01: + sysobjectid: 1.3.6.1.4.1.11.2.3.7.8.5.4 + description: "Aruba 3810M Switch Stack, revision KB.16.04.0009, ROM KB.16.01.0008 (/ws/swbuildm/rel_ukiah_qaoff/code/build/bom(swbuildm_rel_ukiah_qaoff_rel_ukiah))" + vendor: hpe + os: arubaos-switch + version: KB.16.04.0009 + + +arubaos02: + sysobjectid: 1.3.6.1.4.1.11.2.3.7.11.161 + description: "HP J9851A Switch 5412Rzl2, revision KB.16.04.0009, ROM KB.16.01.0006 (/ws/swbuildm/rel_ukiah_qaoff/code/build/bom(swbuildm_rel_ukiah_qaoff_rel_ukiah))" + vendor: hpe + os: arubaos-switch + version: KB.16.04.0009