From 590a44bdcf985d26eb04cfea1ba3729fe8f16b31 Mon Sep 17 00:00:00 2001 From: kk Date: Sat, 21 Dec 2019 00:00:18 +0300 Subject: [PATCH 1/2] add BDCOM.IOS, Carelink.SWG, Cambium.ePMP, Eltex.DSLAM, H3C.VRP, Linksys.SPS2xx, Linksys.SRW --- sa/profiles/BDCOM/IOS/get_inventory.py | 14 +------------- sa/profiles/Cambium/ePMP/get_inventory.py | 16 ++++++++++++++++ sa/profiles/Carelink/SWG/get_inventory.py | 16 ++++++++++++++++ sa/profiles/Eltex/DSLAM/get_inventory.py | 6 +----- sa/profiles/H3C/VRP/get_inventory.py | 11 +---------- sa/profiles/Linksys/SPS2xx/get_inventory.py | 16 ++++++++++++++++ sa/profiles/Linksys/SRW/get_inventory.py | 16 ++++++++++++++++ 7 files changed, 67 insertions(+), 28 deletions(-) create mode 100644 sa/profiles/Cambium/ePMP/get_inventory.py create mode 100644 sa/profiles/Carelink/SWG/get_inventory.py create mode 100644 sa/profiles/Linksys/SPS2xx/get_inventory.py create mode 100644 sa/profiles/Linksys/SRW/get_inventory.py diff --git a/sa/profiles/BDCOM/IOS/get_inventory.py b/sa/profiles/BDCOM/IOS/get_inventory.py index 22f7d3e5ba..1d6a21d1c7 100644 --- a/sa/profiles/BDCOM/IOS/get_inventory.py +++ b/sa/profiles/BDCOM/IOS/get_inventory.py @@ -7,22 +7,10 @@ # --------------------------------------------------------------------- # NOC modules -from noc.core.script.base import BaseScript +from noc.sa.profiles.Generic.get_inventory import Script as BaseScript from noc.sa.interfaces.igetinventory import IGetInventory class Script(BaseScript): name = "BDCOM.IOS.get_inventory" interface = IGetInventory - - def execute_cli(self): - v = self.scripts.get_version() - return [ - { - "type": "CHASSIS", - "vendor": "BDCOM", - "part_no": [v["platform"]], - "revision": v["attributes"]["HW version"], - "serial": v["attributes"]["Serial Number"], - } - ] diff --git a/sa/profiles/Cambium/ePMP/get_inventory.py b/sa/profiles/Cambium/ePMP/get_inventory.py new file mode 100644 index 0000000000..0f1ff51971 --- /dev/null +++ b/sa/profiles/Cambium/ePMP/get_inventory.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# --------------------------------------------------------------------- +# Cambium.ePMP.get_inventory +# --------------------------------------------------------------------- +# Copyright (C) 2007-2019 The NOC Project +# See LICENSE for details +# --------------------------------------------------------------------- + +# NOC modules +from noc.sa.profiles.Generic.get_inventory import Script as BaseScript +from noc.sa.interfaces.igetinventory import IGetInventory + + +class Script(BaseScript): + name = "Cambium.ePMP.get_inventory" + interface = IGetInventory diff --git a/sa/profiles/Carelink/SWG/get_inventory.py b/sa/profiles/Carelink/SWG/get_inventory.py new file mode 100644 index 0000000000..e04e0008f7 --- /dev/null +++ b/sa/profiles/Carelink/SWG/get_inventory.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# --------------------------------------------------------------------- +# Carelink.SWG.get_inventory +# --------------------------------------------------------------------- +# Copyright (C) 2007-2019 The NOC Project +# See LICENSE for details +# --------------------------------------------------------------------- + +# NOC modules +from noc.sa.profiles.Generic.get_inventory import Script as BaseScript +from noc.sa.interfaces.igetinventory import IGetInventory + + +class Script(BaseScript): + name = "Carelink.SWG.get_inventory" + interface = IGetInventory diff --git a/sa/profiles/Eltex/DSLAM/get_inventory.py b/sa/profiles/Eltex/DSLAM/get_inventory.py index bd2be84dfd..eb68613a35 100644 --- a/sa/profiles/Eltex/DSLAM/get_inventory.py +++ b/sa/profiles/Eltex/DSLAM/get_inventory.py @@ -7,14 +7,10 @@ # --------------------------------------------------------------------- # NOC modules -from noc.core.script.base import BaseScript +from noc.sa.profiles.Generic.get_inventory import Script as BaseScript from noc.sa.interfaces.igetinventory import IGetInventory class Script(BaseScript): name = "Eltex.DSLAM.get_inventory" interface = IGetInventory - - def execute_cli(self, **kwargs): - v = self.scripts.get_version() - return [{"type": "CHASSIS", "vendor": "ELTEX", "part_no": v["platform"]}] diff --git a/sa/profiles/H3C/VRP/get_inventory.py b/sa/profiles/H3C/VRP/get_inventory.py index ffe137fa5e..01903068eb 100644 --- a/sa/profiles/H3C/VRP/get_inventory.py +++ b/sa/profiles/H3C/VRP/get_inventory.py @@ -7,19 +7,10 @@ # --------------------------------------------------------------------- # NOC modules -from noc.core.script.base import BaseScript +from noc.sa.profiles.Generic.get_inventory import Script as BaseScript from noc.sa.interfaces.igetinventory import IGetInventory class Script(BaseScript): name = "H3C.VRP.get_inventory" interface = IGetInventory - - def execute(self): - objects = [] - v = self.scripts.get_version() - inv = {"type": "CHASSIS", "vendor": "H3C", "part_no": [v["platform"]]} - if "attributes" in v and "Serial Number" in v["attributes"]: - inv["serial"] = v["attributes"]["Serial Number"] - objects += [inv] - return objects diff --git a/sa/profiles/Linksys/SPS2xx/get_inventory.py b/sa/profiles/Linksys/SPS2xx/get_inventory.py new file mode 100644 index 0000000000..3c86c85a35 --- /dev/null +++ b/sa/profiles/Linksys/SPS2xx/get_inventory.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# --------------------------------------------------------------------- +# Linksys.SPS2xx.get_inventory +# --------------------------------------------------------------------- +# Copyright (C) 2007-2019 The NOC Project +# See LICENSE for details +# --------------------------------------------------------------------- + +# NOC modules +from noc.sa.profiles.Generic.get_inventory import Script as BaseScript +from noc.sa.interfaces.igetinventory import IGetInventory + + +class Script(BaseScript): + name = "Linksys.SPS2xx.get_inventory" + interface = IGetInventory diff --git a/sa/profiles/Linksys/SRW/get_inventory.py b/sa/profiles/Linksys/SRW/get_inventory.py new file mode 100644 index 0000000000..df6ee63baf --- /dev/null +++ b/sa/profiles/Linksys/SRW/get_inventory.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# --------------------------------------------------------------------- +# Linksys.SRW.get_inventory +# --------------------------------------------------------------------- +# Copyright (C) 2007-2019 The NOC Project +# See LICENSE for details +# --------------------------------------------------------------------- + +# NOC modules +from noc.sa.profiles.Generic.get_inventory import Script as BaseScript +from noc.sa.interfaces.igetinventory import IGetInventory + + +class Script(BaseScript): + name = "Linksys.SRW.get_inventory" + interface = IGetInventory -- GitLab From 4f5582acd64ac5a11a5258e433fd8bd569f68d60 Mon Sep 17 00:00:00 2001 From: kk Date: Sat, 21 Dec 2019 00:32:11 +0300 Subject: [PATCH 2/2] add_new_get_inventory2 --- sa/profiles/NSCComm/LPOS/get_inventory.py | 16 ++++++++++++++++ .../Nateks/FlexGainACE16/get_inventory.py | 13 +------------ .../Nateks/FlexGainACE24/get_inventory.py | 16 ++++++++++++++++ sa/profiles/Nateks/NetXpert/get_inventory.py | 13 +------------ sa/profiles/Nateks/NetXpert/get_version.py | 5 ++--- sa/profiles/Orion/NOS/get_inventory.py | 19 +++---------------- sa/profiles/Planet/WGSD/get_inventory.py | 16 ++++++++++++++++ sa/profiles/Proscend/SHDSL/get_inventory.py | 13 +------------ sa/profiles/Qtech/QSW2500/get_inventory.py | 13 +------------ sa/profiles/Rubytech/l2ms/get_inventory.py | 13 +------------ sa/profiles/TFortis/PSW/get_inventory.py | 16 ++++++++++++++++ sa/profiles/Ubiquiti/AirOS/get_inventory.py | 6 +----- sa/profiles/Vitesse/VSC/get_inventory.py | 6 +----- sa/profiles/ZTE/ZXDSL98xx/get_inventory.py | 16 ++++++++++++++++ 14 files changed, 92 insertions(+), 89 deletions(-) create mode 100644 sa/profiles/NSCComm/LPOS/get_inventory.py create mode 100644 sa/profiles/Nateks/FlexGainACE24/get_inventory.py create mode 100644 sa/profiles/Planet/WGSD/get_inventory.py create mode 100644 sa/profiles/TFortis/PSW/get_inventory.py create mode 100644 sa/profiles/ZTE/ZXDSL98xx/get_inventory.py diff --git a/sa/profiles/NSCComm/LPOS/get_inventory.py b/sa/profiles/NSCComm/LPOS/get_inventory.py new file mode 100644 index 0000000000..f67adadab8 --- /dev/null +++ b/sa/profiles/NSCComm/LPOS/get_inventory.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# --------------------------------------------------------------------- +# NSCComm.LPOS.get_inventory +# --------------------------------------------------------------------- +# Copyright (C) 2007-2019 The NOC Project +# See LICENSE for details +# --------------------------------------------------------------------- + +# NOC modules +from noc.sa.profiles.Generic.get_inventory import Script as BaseScript +from noc.sa.interfaces.igetinventory import IGetInventory + + +class Script(BaseScript): + name = "NSCComm.LPOS.get_inventory" + interface = IGetInventory diff --git a/sa/profiles/Nateks/FlexGainACE16/get_inventory.py b/sa/profiles/Nateks/FlexGainACE16/get_inventory.py index eb9aae1d99..42efb3c915 100644 --- a/sa/profiles/Nateks/FlexGainACE16/get_inventory.py +++ b/sa/profiles/Nateks/FlexGainACE16/get_inventory.py @@ -7,21 +7,10 @@ # --------------------------------------------------------------------- # NOC modules -from noc.core.script.base import BaseScript +from noc.sa.profiles.Generic.get_inventory import Script as BaseScript from noc.sa.interfaces.igetinventory import IGetInventory class Script(BaseScript): name = "Nateks.FlexGainACE16.get_inventory" interface = IGetInventory - - def execute(self): - v = self.scripts.get_version() - return [ - { - "type": "CHASSIS", - "vendor": "Nateks", - "part_no": [v["platform"]], - "serial": v["attributes"]["Serial Number"], - } - ] diff --git a/sa/profiles/Nateks/FlexGainACE24/get_inventory.py b/sa/profiles/Nateks/FlexGainACE24/get_inventory.py new file mode 100644 index 0000000000..d264e4b6ba --- /dev/null +++ b/sa/profiles/Nateks/FlexGainACE24/get_inventory.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# --------------------------------------------------------------------- +# Nateks.FlexGainACE24.get_inventory +# --------------------------------------------------------------------- +# Copyright (C) 2007-2019 The NOC Project +# See LICENSE for details +# --------------------------------------------------------------------- + +# NOC modules +from noc.sa.profiles.Generic.get_inventory import Script as BaseScript +from noc.sa.interfaces.igetinventory import IGetInventory + + +class Script(BaseScript): + name = "Nateks.FlexGainACE24.get_inventory" + interface = IGetInventory diff --git a/sa/profiles/Nateks/NetXpert/get_inventory.py b/sa/profiles/Nateks/NetXpert/get_inventory.py index 288785e718..7852455368 100644 --- a/sa/profiles/Nateks/NetXpert/get_inventory.py +++ b/sa/profiles/Nateks/NetXpert/get_inventory.py @@ -7,21 +7,10 @@ # --------------------------------------------------------------------- # NOC modules -from noc.core.script.base import BaseScript +from noc.sa.profiles.Generic.get_inventory import Script as BaseScript from noc.sa.interfaces.igetinventory import IGetInventory class Script(BaseScript): name = "Nateks.NetXpert.get_inventory" interface = IGetInventory - - def execute(self): - v = self.scripts.get_version() - return [ - { - "type": "CHASSIS", - "vendor": "Nateks", - "part_no": [v["platform"]], - "serial": v["attributes"]["Serial Number"], - } - ] diff --git a/sa/profiles/Nateks/NetXpert/get_version.py b/sa/profiles/Nateks/NetXpert/get_version.py index eeb135b2ba..6e3a0ed28f 100644 --- a/sa/profiles/Nateks/NetXpert/get_version.py +++ b/sa/profiles/Nateks/NetXpert/get_version.py @@ -1,12 +1,11 @@ # -*- coding: utf-8 -*- # --------------------------------------------------------------------- -# Nateks.flexgain.get_version +# Nateks.NetXpert.get_version # --------------------------------------------------------------------- # Copyright (C) 2007-2016 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- -""" -""" + # Python modules import re diff --git a/sa/profiles/Orion/NOS/get_inventory.py b/sa/profiles/Orion/NOS/get_inventory.py index 2cfa32d137..595853dfec 100644 --- a/sa/profiles/Orion/NOS/get_inventory.py +++ b/sa/profiles/Orion/NOS/get_inventory.py @@ -2,28 +2,15 @@ # --------------------------------------------------------------------- # Orion.NOS.get_inventory # --------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- -""" -""" + # NOC modules -from noc.core.script.base import BaseScript +from noc.sa.profiles.Generic.get_inventory import Script as BaseScript from noc.sa.interfaces.igetinventory import IGetInventory class Script(BaseScript): name = "Orion.NOS.get_inventory" interface = IGetInventory - - def execute_cli(self): - v = self.profile.get_version(self) - return [ - { - "type": "CHASSIS", - "vendor": "Orion", - "part_no": v["platform"], - "revision": v["hardware"], - "serial": v["serial"], - } - ] diff --git a/sa/profiles/Planet/WGSD/get_inventory.py b/sa/profiles/Planet/WGSD/get_inventory.py new file mode 100644 index 0000000000..f843dd0381 --- /dev/null +++ b/sa/profiles/Planet/WGSD/get_inventory.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# --------------------------------------------------------------------- +# Planet.WGSD.get_inventory +# --------------------------------------------------------------------- +# Copyright (C) 2007-2019 The NOC Project +# See LICENSE for details +# --------------------------------------------------------------------- + +# NOC modules +from noc.sa.profiles.Generic.get_inventory import Script as BaseScript +from noc.sa.interfaces.igetinventory import IGetInventory + + +class Script(BaseScript): + name = "Planet.WGSD.get_inventory" + interface = IGetInventory diff --git a/sa/profiles/Proscend/SHDSL/get_inventory.py b/sa/profiles/Proscend/SHDSL/get_inventory.py index ed8681b4e9..afcdb77bf8 100644 --- a/sa/profiles/Proscend/SHDSL/get_inventory.py +++ b/sa/profiles/Proscend/SHDSL/get_inventory.py @@ -7,21 +7,10 @@ # --------------------------------------------------------------------- # NOC modules -from noc.core.script.base import BaseScript +from noc.sa.profiles.Generic.get_inventory import Script as BaseScript from noc.sa.interfaces.igetinventory import IGetInventory class Script(BaseScript): name = "Proscend.SHDSL.get_inventory" interface = IGetInventory - - def execute(self): - v = self.scripts.get_version() - return [ - { - "type": "CHASSIS", - "vendor": "Proscend", - "part_no": [v["platform"]], - "serial": v["attributes"]["Serial Number"], - } - ] diff --git a/sa/profiles/Qtech/QSW2500/get_inventory.py b/sa/profiles/Qtech/QSW2500/get_inventory.py index 79eb881ef7..aaa92f0c61 100644 --- a/sa/profiles/Qtech/QSW2500/get_inventory.py +++ b/sa/profiles/Qtech/QSW2500/get_inventory.py @@ -7,21 +7,10 @@ # --------------------------------------------------------------------- # NOC modules -from noc.core.script.base import BaseScript +from noc.sa.profiles.Generic.get_inventory import Script as BaseScript from noc.sa.interfaces.igetinventory import IGetInventory class Script(BaseScript): name = "Qtech.QSW2500.get_inventory" interface = IGetInventory - - def execute(self): - v = self.scripts.get_version() - return [ - { - "type": "CHASSIS", - "vendor": "Qtech", - "part_no": [v["platform"]], - "serial": v["attributes"]["Serial Number"], - } - ] diff --git a/sa/profiles/Rubytech/l2ms/get_inventory.py b/sa/profiles/Rubytech/l2ms/get_inventory.py index 5e37754c09..c2c8c1eebf 100644 --- a/sa/profiles/Rubytech/l2ms/get_inventory.py +++ b/sa/profiles/Rubytech/l2ms/get_inventory.py @@ -7,21 +7,10 @@ # --------------------------------------------------------------------- # NOC modules -from noc.core.script.base import BaseScript +from noc.sa.profiles.Generic.get_inventory import Script as BaseScript from noc.sa.interfaces.igetinventory import IGetInventory class Script(BaseScript): name = "Rubytech.l2ms.get_inventory" interface = IGetInventory - - def execute(self): - v = self.scripts.get_version() - return [ - { - "type": "CHASSIS", - "vendor": "Rubytech", - "part_no": [v["platform"]], - "serial": v["attributes"]["Serial Number"], - } - ] diff --git a/sa/profiles/TFortis/PSW/get_inventory.py b/sa/profiles/TFortis/PSW/get_inventory.py new file mode 100644 index 0000000000..8f5358b794 --- /dev/null +++ b/sa/profiles/TFortis/PSW/get_inventory.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# --------------------------------------------------------------------- +# TFortis.PSW.get_inventory +# --------------------------------------------------------------------- +# Copyright (C) 2007-2019 The NOC Project +# See LICENSE for details +# --------------------------------------------------------------------- + +# NOC modules +from noc.sa.profiles.Generic.get_inventory import Script as BaseScript +from noc.sa.interfaces.igetinventory import IGetInventory + + +class Script(BaseScript): + name = "TFortis.PSW.get_inventory" + interface = IGetInventory diff --git a/sa/profiles/Ubiquiti/AirOS/get_inventory.py b/sa/profiles/Ubiquiti/AirOS/get_inventory.py index 669bd99d6d..5df0355e81 100644 --- a/sa/profiles/Ubiquiti/AirOS/get_inventory.py +++ b/sa/profiles/Ubiquiti/AirOS/get_inventory.py @@ -7,14 +7,10 @@ # --------------------------------------------------------------------- # NOC modules -from noc.core.script.base import BaseScript +from noc.sa.profiles.Generic.get_inventory import Script as BaseScript from noc.sa.interfaces.igetinventory import IGetInventory class Script(BaseScript): name = "Ubiquiti.AirOS.get_inventory" interface = IGetInventory - - def execute(self): - v = self.scripts.get_version() - return [{"type": "CHASSIS", "vendor": "UBIQUITI", "part_no": [v["platform"]]}] diff --git a/sa/profiles/Vitesse/VSC/get_inventory.py b/sa/profiles/Vitesse/VSC/get_inventory.py index 5648d47b21..f1628476b4 100644 --- a/sa/profiles/Vitesse/VSC/get_inventory.py +++ b/sa/profiles/Vitesse/VSC/get_inventory.py @@ -7,14 +7,10 @@ # --------------------------------------------------------------------- # NOC modules -from noc.core.script.base import BaseScript +from noc.sa.profiles.Generic.get_inventory import Script as BaseScript from noc.sa.interfaces.igetinventory import IGetInventory class Script(BaseScript): name = "Vitesse.VSC.get_inventory" interface = IGetInventory - - def execute_cli(self): - v = self.scripts.get_version() - return [{"type": "CHASSIS", "vendor": "VITESSE", "part_no": [v["platform"]]}] diff --git a/sa/profiles/ZTE/ZXDSL98xx/get_inventory.py b/sa/profiles/ZTE/ZXDSL98xx/get_inventory.py new file mode 100644 index 0000000000..5ccd81ad5f --- /dev/null +++ b/sa/profiles/ZTE/ZXDSL98xx/get_inventory.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# --------------------------------------------------------------------- +# ZTE.ZXDSL98xx.get_inventory +# --------------------------------------------------------------------- +# Copyright (C) 2007-2019 The NOC Project +# See LICENSE for details +# --------------------------------------------------------------------- + +# NOC modules +from noc.sa.profiles.Generic.get_inventory import Script as BaseScript +from noc.sa.interfaces.igetinventory import IGetInventory + + +class Script(BaseScript): + name = "ZTE.ZXDSL98xx.get_inventory" + interface = IGetInventory -- GitLab