Commit ccf3d110 authored by Andrey Vertiprahov's avatar Andrey Vertiprahov
Browse files

Merge branch 'cherry-pick-1524d210-2' into 'release-19.4'

release-19.4:Backport!3495

See merge request noc/noc!3497
parents 23dc3285 0e626151
......@@ -6,23 +6,35 @@
# Copyright (C) 2007-2018 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
"""
"""
# Python modules
import re
# NOC Modules
from noc.core.script.base import BaseScript
from noc.sa.interfaces.igetversion import IGetVersion
import re
from noc.core.mib import mib
class Script(BaseScript):
name = "Huawei.MA5300.get_version"
cache = True
interface = IGetVersion
always_prefer = "S"
rx_platform = re.compile(r"SmartAX (?P<platform>\S+) \S+")
rx_ver = re.compile(r"Version (?P<version>\S+)")
def execute(self):
def execute_snmp(self, **kwargs):
# slot number
slots_count = self.snmp.get(mib["HUAWEI-DEVICE-MIB::hwSlots"])
version = self.snmp.get(mib["HUAWEI-DEVICE-MIB::hwSysVersion", 0])
platform = self.snmp.get(mib["HUAWEI-DEVICE-MIB::hwFrameDesc", 0])
if platform == "MA5300" and slots_count == 8:
platform = "MA5303"
return {"vendor": "Huawei", "platform": platform, "version": version}
def execute_cli(self, **kwargs):
v = self.cli("show version", cached=True)
match = self.re_search(self.rx_ver, v)
version = match.group("version")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment