Commit 0e626151 authored by Andrey Vertiprahov's avatar Andrey Vertiprahov
Browse files

Merge branch 'noc-1175' into 'master'

noc/noc#1175 Huawei.MA5300.get_version. Add MA5303 to detecting profile.

See merge request noc/noc!3495

(cherry picked from commit 1524d210)

b0ba9770 Huawei.MA5300.get_version. Add MA5303 to detecting profile.
parent 23dc3285
......@@ -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 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 ="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