Commit 18adae30 authored by Andrey Vertiprahov's avatar Andrey Vertiprahov
Browse files

Merge branch 'patch-avs-eltex-mes-revision' into 'master'

Eltex.MES. Add MES-3324F rev B platform.

See merge request noc/noc!6041
parents 8eef650d 8471d4dd
......@@ -54,12 +54,12 @@ class Script(BaseScript):
else:
descr = None
platform = None
platform, revision = None, None
match = self.rx_platform.search(plat)
if match:
platform = match.group("platform")
platform = platform.split(".")[8]
platform = self.profile.get_platform(platform)
platform, revision = self.profile.get_platform(platform)
elif self.has_capability("Stack | Members"):
# Try to obtain platform from description
if descr and descr.startswith("MES"):
......@@ -84,7 +84,9 @@ class Script(BaseScript):
r = {"type": "CHASSIS", "vendor": "ELTEX", "part_no": [platform]}
if serial:
r["serial"] = serial.group("serial")
if hardware:
if revision:
r["revision"] = revision.split(".")[-1]
elif hardware:
r["revision"] = hardware.group("hardware")
if descr:
r["description"] = descr
......
......@@ -35,29 +35,40 @@ class Script(BaseScript):
def execute_snmp(self, **kwargs):
try:
platform = self.snmp.get(mib["SNMPv2-MIB::sysObjectID.0"], cached=True)
platform = self.snmp.get(mib["SNMPv2-MIB::sysObjectID", 0], cached=True)
platform = platform.split(".")[8]
platform = self.profile.get_platform(platform.split(")")[0])
version = self.snmp.get("1.3.6.1.2.1.47.1.1.1.1.10.67108992", cached=True)
bootprom = self.snmp.get("1.3.6.1.2.1.47.1.1.1.1.9.67108992", cached=True)
hardware = self.snmp.get("1.3.6.1.2.1.47.1.1.1.1.8.67108992", cached=True)
serial = self.snmp.get("1.3.6.1.2.1.47.1.1.1.1.11.67108992", cached=True)
platform, revision = self.profile.get_platform(platform.split(")")[0])
version = self.snmp.get(mib["ENTITY-MIB::entPhysicalSoftwareRev", 67108992])
try:
bootprom = self.snmp.get(mib["ENTITY-MIB::entPhysicalFirmwareRev", 67108992])
except self.snmp.SNMPError:
bootprom = None
try:
hardware = self.snmp.get(mib["ENTITY-MIB::entPhysicalHardwareRev", 67108992])
except self.snmp.SNMPError:
hardware = None
serial = self.snmp.get(mib["ENTITY-MIB::entPhysicalSerialNum", 67108992])
if not version:
# rndBrgVersion
version = self.snmp.get("1.3.6.1.4.1.89.2.4.0", cached=True)
if not serial:
# rlPhdUnitGenParamSerialNum
serial = self.snmp.get("1.3.6.1.4.1.89.53.14.1.5.1", cached=True)
return {
r = {
"vendor": "Eltex",
"platform": platform,
"version": version,
"attributes": {
"Boot PROM": bootprom,
"HW version": hardware,
"Serial Number": serial,
},
}
if bootprom:
r["attributes"]["Boot PROM"] = bootprom
if hardware:
r["attributes"]["HW version"] = hardware
if revision:
r["attributes"]["revision"] = revision
return r
except self.snmp.TimeOutError:
raise self.UnexpectedResultError
......@@ -83,7 +94,7 @@ class Script(BaseScript):
match = self.rx_platform.search(plat)
platform = match.group("platform")
platform = platform.split(".")[8]
platform = self.profile.get_platform(platform)
platform, revision = self.profile.get_platform(platform)
match = self.rx_version1.search(ver)
if match:
......@@ -124,4 +135,6 @@ class Script(BaseScript):
res["attributes"]["Boot PROM"] = bootprom.group("bootprom")
if hardware:
res["attributes"]["HW version"] = hardware.group("hardware")
if revision:
res["attributes"]["revision"] = revision
return res
......@@ -99,10 +99,12 @@ class Profile(BaseProfile):
"116": "MES-3308F",
"120": "MES-3348F",
"136": "MES-5316A",
"190": ("MES-3324F", "rev.B"), # rev.B
}
def get_platform(self, s):
return self.PLATFORMS.get(s)
platform, *revision = self.PLATFORMS.get(s)
return platform, revision[0] if revision else None
INTERFACE_TYPES = {
"as": "physical", # Async
......
......@@ -22,10 +22,10 @@ class Script(BaseScript):
def execute_cli(self):
fqdn = ""
v = self.scripts.get_config()
v = self.cli("show startup-config", cached=True)
match = self.rx_hostname.search(v)
if match:
fqdn = match.group("hostname")
fqdn = match.group("hostname").strip('"')
match = self.rx_domain_name.search(v)
if match:
fqdn = fqdn + "." + match.group("domain")
......
......@@ -35,6 +35,8 @@ class Script(BaseScript):
"00:01:02:03:04:00", # Very Smart programmer
"00:01:02:03:04:05", # Very Smart+ programmer
"00:02:03:04:05:06", # Ubiquity Programmers
"00:AA:BB:CC:DD:13",
"06:00:00:00:00:80",
"FF:FF:FF:FF:FF:FF", # Broadcast
}
......
Markdown is supported
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