From f1193d4ded27a59bf1bc71148995fbda654828b4 Mon Sep 17 00:00:00 2001 From: smile Date: Fri, 23 Aug 2019 11:07:14 +0300 Subject: [PATCH 1/2] Add new profile TP-Link EAP --- sa/profiles/TPLink/EAP/__init__.py | 0 sa/profiles/TPLink/EAP/get_chassis_id.py | 21 +++++++++++++++++++++ sa/profiles/TPLink/EAP/get_fqdn.py | 22 ++++++++++++++++++++++ sa/profiles/TPLink/EAP/get_version.py | 23 +++++++++++++++++++++++ sa/profiles/TPLink/EAP/profile.py | 15 +++++++++++++++ 5 files changed, 81 insertions(+) create mode 100644 sa/profiles/TPLink/EAP/__init__.py create mode 100644 sa/profiles/TPLink/EAP/get_chassis_id.py create mode 100644 sa/profiles/TPLink/EAP/get_fqdn.py create mode 100644 sa/profiles/TPLink/EAP/get_version.py create mode 100644 sa/profiles/TPLink/EAP/profile.py diff --git a/sa/profiles/TPLink/EAP/__init__.py b/sa/profiles/TPLink/EAP/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/sa/profiles/TPLink/EAP/get_chassis_id.py b/sa/profiles/TPLink/EAP/get_chassis_id.py new file mode 100644 index 0000000000..5d26598364 --- /dev/null +++ b/sa/profiles/TPLink/EAP/get_chassis_id.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# --------------------------------------------------------------------- +# TPLink.EAP.get_chassis_id +# --------------------------------------------------------------------- +# Copyright (C) 2007-2019 The NOC Project +# See LICENSE for details +# --------------------------------------------------------------------- + + +# NOC modules +from noc.sa.profiles.Generic.get_chassis_id import Script as BaseScript +from noc.sa.interfaces.igetchassisid import IGetChassisID +from noc.core.mib import mib + + +class Script(BaseScript): + name = "TPLink.EAP.get_chassis_id" + cache = True + interface = IGetChassisID + + SNMP_GETNEXT_OIDS = {"SNMP": [mib["IF-MIB::ifPhysAddress"]]} diff --git a/sa/profiles/TPLink/EAP/get_fqdn.py b/sa/profiles/TPLink/EAP/get_fqdn.py new file mode 100644 index 0000000000..d09c1dc32b --- /dev/null +++ b/sa/profiles/TPLink/EAP/get_fqdn.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# --------------------------------------------------------------------- +# TPLink.EAP.get_config +# --------------------------------------------------------------------- +# Copyright (C) 2007-2018 The NOC Project +# See LICENSE for details +# --------------------------------------------------------------------- + +# NOC modules +from noc.core.script.base import BaseScript +from noc.sa.interfaces.igetfqdn import IGetFQDN + + +class Script(BaseScript): + name = "TPLink.EAP.get_fqdn" + interface = IGetFQDN + + def execute_snmp(self, **kwargs): + v = self.snmp.get("1.3.6.1.2.1.1.5.0", cached=True) + if v: + return v + raise self.NotSupportedError diff --git a/sa/profiles/TPLink/EAP/get_version.py b/sa/profiles/TPLink/EAP/get_version.py new file mode 100644 index 0000000000..29a31229c3 --- /dev/null +++ b/sa/profiles/TPLink/EAP/get_version.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# --------------------------------------------------------------------- +# TPLink.EAP.get_version +# --------------------------------------------------------------------- +# Copyright (C) 2007-2018 The NOC Project +# See LICENSE for details +# --------------------------------------------------------------------- + +# NOC modules +from noc.core.script.base import BaseScript +from noc.sa.interfaces.igetversion import IGetVersion + + +class Script(BaseScript): + name = "TPLink.EAP.get_version" + interface = IGetVersion + cache = True + + def execute_snmp(self): + platform = self.snmp.get("1.3.6.1.4.1.11863.10.1.10.3.0", cached=True) + version = self.snmp.get("1.3.6.1.4.1.11863.10.1.10.5.0", cached=True) + result = {"vendor": "TPLink", "version": version, "platform": platform} + return result diff --git a/sa/profiles/TPLink/EAP/profile.py b/sa/profiles/TPLink/EAP/profile.py new file mode 100644 index 0000000000..0ac68aa2b7 --- /dev/null +++ b/sa/profiles/TPLink/EAP/profile.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# --------------------------------------------------------------------- +# Vendor: TPLink +# OS: EAP +# --------------------------------------------------------------------- +# Copyright (C) 2007-2016 The NOC Project +# See LICENSE for details +# --------------------------------------------------------------------- + +# NOC modules +from noc.core.profile.base import BaseProfile + + +class Profile(BaseProfile): + name = "TPLink.EAP" -- GitLab From 6b240f09e88cc8f75ba8fd738528d78d52ac4b83 Mon Sep 17 00:00:00 2001 From: smile Date: Fri, 23 Aug 2019 11:56:03 +0300 Subject: [PATCH 2/2] fix Docs --- docs/src/en/profiles/TPLink.EAP.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 docs/src/en/profiles/TPLink.EAP.rst diff --git a/docs/src/en/profiles/TPLink.EAP.rst b/docs/src/en/profiles/TPLink.EAP.rst new file mode 100644 index 0000000000..61c80a37aa --- /dev/null +++ b/docs/src/en/profiles/TPLink.EAP.rst @@ -0,0 +1,14 @@ +.. _profile-TPLink.EAP: + +============= +TPLink.EAP +============= + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +.. todo:: + Describe *TPLink.EAP* profile -- GitLab