Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Extreme and Procurve #25

Merged
merged 1 commit into from
Dec 14, 2019
Merged
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 .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ language: python
python:
- 2.7
- 3.6
- 3.7

install:
- pip install tox-travis
Expand Down
4 changes: 4 additions & 0 deletions lib/nelsnmp/hostinfo/collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from nelsnmp.vendors.arista.versions import AristaVersion
from nelsnmp.vendors.cisco.versions import CiscoVersion
from nelsnmp.vendors.ericsson.versions import EricssonVersion
from nelsnmp.vendors.extreme.versions import ExtremeVersion
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
Expand All @@ -22,6 +24,8 @@ def get_device_version(**kwargs):
vendors['arista'] = AristaVersion
vendors['cisco'] = CiscoVersion
vendors['ericsson'] = EricssonVersion
vendors['extreme'] = ExtremeVersion
vendors['hpe'] = HpeVersion
vendors['huawei'] = HuaweiVersion
vendors['juniper'] = JuniperVersion
vendors['metamako'] = MetamakoVersion
Expand Down
Empty file.
14 changes: 14 additions & 0 deletions lib/nelsnmp/vendors/extreme/versions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from nelsnmp.hostinfo.version import DeviceVersion


class ExtremeVersion(DeviceVersion):

def _get_version(self):
for line in self._descriptions:
if 'ExtremeXOS' in line:
self.os = 'extremexos'
parts = line.split()
if len(parts) > 4:
if parts[2] == 'version':
self.version = '{} {}'.format(parts[3], parts[4])

Empty file.
13 changes: 13 additions & 0 deletions lib/nelsnmp/vendors/hpe/versions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from nelsnmp.hostinfo.version import DeviceVersion


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]
2 changes: 2 additions & 0 deletions lib/nelsnmp/vendors/mappings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

vendor_map = {}
vendor_map['9'] = 'cisco'
vendor_map['11'] = 'hpe'
vendor_map['1916'] = 'extreme'
vendor_map['2011'] = 'huawei'
vendor_map['2352'] = 'ericsson'
vendor_map['2636'] = 'juniper'
Expand Down
8 changes: 8 additions & 0 deletions tests/valid_hostinfo_files/extreme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
extreme01:
sysobjectid: 1.3.6.1.4.1.1916.2.93
description: 'ExtremeXOS (Stack) version 15.3.1.4 v1531b4-patch1-33 by release-manager'
vendor: extreme
os: extremexos
version: 15.3.1.4 v1531b4-patch1-33

8 changes: 8 additions & 0 deletions tests/valid_hostinfo_files/hpe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
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

2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py27, py36
envlist = py27, py36, py37
[testenv]
deps =
pytest
Expand Down