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

Merge branch 'patch-avs-raisecom-ros-version' into 'master'

Raisecom.ROS.get_version. Add parse_kv_version method for parse version output.

See merge request noc/noc!6665
parents 12a05900 14d5cb3f
......@@ -11,6 +11,7 @@ import re
# NOC modules
from noc.core.script.base import BaseScript
from noc.sa.interfaces.igetversion import IGetVersion
from noc.core.text import parse_kv
class Script(BaseScript):
......@@ -113,6 +114,29 @@ class Script(BaseScript):
rx_ver_qtech = re.compile(r"QTECH Universal Software Platform")
kv_map = {
"product name": "platform",
"ros version": "version",
"qos version": "version",
"bootstrap version": "bootstrap",
"boot room version": "bootstrap",
"bootrom version": "bootstrap",
"hardware version": "hw_rev",
"hardware version rev.": "hw_rev",
"system macaddress is": "mac_address",
"system macaddress": "mac_address",
"serial number": "serial",
}
@classmethod
def parse_kv_version(cls, v):
r = parse_kv(cls.kv_map, v)
if not r:
raise NotImplementedError("Not supported platform output format")
if "Gazelle" in r["platform"]:
_, r["platform"] = r["platform"].split(None, 1)
return r
def parse_version(self, c):
r = {}
if "Support ipv6" in c:
......@@ -144,6 +168,8 @@ class Script(BaseScript):
return r
else:
match = self.rx_ver3.search(c)
if not match:
return self.parse_kv_version(c)
return match.groupdict()
# NPK Rotek some Chinese vendor
......
......@@ -42,7 +42,9 @@ class Profile(BaseProfile):
"is_rotek": {"vendor": {"$in": ["Rotek", "ROTEK"]}},
"is_gazelle": {"platform": {"$regex": r"^[SR]\d+[Ii]\S+"}},
"is_ifname_use": {"platform": {"$regex": "QSW-8200"}},
"is_version_only_format": {"version": {"$regex": r"^\d+\S+"}}, # Version format 5.2.1_20171221
"is_version_only_format": {
"version": {"$regex": r"^\d+\S+"}
}, # Version format 5.2.1_20171221
}
rx_date_format = re.compile(r"(\S+)\s*\((.+)\)")
......
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