Commit 71770afa authored by Andrey Vertiprahov's avatar Andrey Vertiprahov

Merge branch 'patch-avs-refactor-ip-cam' into 'master'

Some fixes on IP Cam profiles Dahua.DH, Beward.BD, Hikvision.DSKV8

See merge request !1722
parents 3541f8e4 a1220fc9
Pipeline #11397 passed with stages
in 2 minutes and 1 second
......@@ -16,7 +16,6 @@ class Script(BaseScript):
cache = True
interface = IGetVersion
@property
def execute(self):
res = self.http.get("/cgi-bin/admin/param.cgi?action=list", json=False, cached=True, use_basic=True)
r = {}
......@@ -30,8 +29,13 @@ class Script(BaseScript):
"vendor": "Beward",
"platform": r["root.Brand.ProdNbr"],
"version": r["root.Properties.Firmware.Version"],
"attributes":
{"build": r["root.Properties.Firmware.BuildDate"]}
"attributes": {
# "Boot PROM": match.group("bootprom"),
"Build Date": r["root.Properties.Firmware.BuildDate"],
# "HW version": system_info["hardwareVersion"],
# "Serial Number": system_info["serialNumber"]
# "Firmware Type":
}
}
return ver
......@@ -30,17 +30,18 @@ class Script(BaseScript):
software_version = self.profile.parse_equal_output(software_version)
version, build = software_version["version"].split(",")
build = build.split(":")[1]
# print(software_version)
attributes = {
# "Boot PROM": match.group("bootprom"),
"Build Date": build,
"HW version": system_info["hardwareVersion"],
"Serial Number": system_info["serialNumber"]
# "Firmware Type":
}
return {
"vendor": "Dahua",
"platform": system_info["deviceType"],
"version": version,
"attributes": {
# "Boot PROM": match.group("bootprom"),
"Build Date": build,
"HW version": system_info["hardwareVersion"],
"Serial Number": system_info["serialNumber"]
# "Firmware Type":
}
"attributes": attributes
}
......@@ -22,27 +22,19 @@ class Script(BaseScript):
rx_date = re.compile(r"(?P<yy>\d\d)(?P<mm>\d\d)(?P<dd>\d\d)")
def execute(self):
v = self.http.get("/ISAPI/System/deviceInfo/capabilities", json=False, cached=True, use_basic=True)
ns = {'isapi': 'http://www.isapi.org/ver20/XMLSchema'}
v = self.http.get("/ISAPI/System/deviceInfo", use_basic=True)
root = ElementTree.fromstring(v)
for child in root:
key = child.tag.split("}")[1][0:]
if key == "model":
platform = child.text
elif key == "serialNumber":
serial = child.text
elif key == "firmwareVersion":
version = child.text
elif key == "firmwareReleasedDate":
build = child.text
match = self.rx_date.search(build)
build = "20%s-%s-%s" % (match.group("yy"), match.group("mm"), match.group("dd"))
return {
"vendor": 'Hikvision',
"platform": platform,
"version": version,
"platform": root.find("isapi:model", ns).text,
"version": root.find("isapi:firmwareVersion", ns).text,
"attributes": {
"Serial Number": serial,
"build": build
# "Boot PROM": match.group("bootprom"),
"Build Date": root.find("isapi:firmwareReleasedDate", ns).text,
"HW version": root.find("isapi:firmwareVersion", ns).text,
"Serial Number": root.find("isapi:serialNumber", ns).text
# "Firmware Type":
}
}
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