Commit 3be83ce7 authored by Andrey Vertiprahov's avatar Andrey Vertiprahov
Browse files

Merge branch 'cherry-pick-caebb4d9' into 'release-19.2'

release-19.2:Backport!2302

See merge request noc/noc!2304
parents e2426949 fc66b6ac
......@@ -18,18 +18,22 @@ class Script(BaseScript):
def execute(self):
res = self.http.get("/cgi-bin/admin/param.cgi?action=list", json=False, cached=True, use_basic=True)
res = self.http.get(
"/cgi-bin/admin/param.cgi?action=list", json=False, cached=True, use_basic=True
)
r = {}
for x in res.splitlines():
if not x:
continue
k, v = x.split("=")
try:
k, v = x.split("=")
except ValueError:
continue
r[k] = v
interfaces = []
ifname = "eth0"
status = "Up"
# enabled_afi = ["IPv4"]
# enabled_afi = ["IPv4"]
mac = r["root.Network.eth0.MACAddress"]
ip = r["root.Network.eth0.IPAddress"]
mask = r["root.Network.eth0.SubnetMask"]
......@@ -40,13 +44,15 @@ class Script(BaseScript):
"type": "physical",
"admin_status": status == "Up",
"oper_status": status == "Up",
"subinterfaces": [{
"name": ifname,
"admin_status": status == "Up",
"oper_status": status == "Up",
"ipv4_addresses": [ip_addr],
"mac": mac
}]
"subinterfaces": [
{
"name": ifname,
"admin_status": status == "Up",
"oper_status": status == "Up",
"ipv4_addresses": [ip_addr],
"mac": mac,
}
],
}
interfaces += [iface]
return [{"interfaces": interfaces}]
......@@ -17,14 +17,18 @@ class Script(BaseScript):
interface = IGetVersion
def execute(self):
res = self.http.get("/cgi-bin/admin/param.cgi?action=list", json=False, cached=True, use_basic=True)
res = self.http.get(
"/cgi-bin/admin/param.cgi?action=list", json=False, cached=True, use_basic=True
)
r = {}
for x in res.splitlines():
if not x:
continue
k, v = x.split("=")
try:
k, v = x.split("=")
except ValueError:
continue
r[k] = v
ver = {
"vendor": "Beward",
"platform": r["root.Brand.ProdNbr"],
......@@ -35,7 +39,7 @@ class Script(BaseScript):
# "HW version": system_info["hardwareVersion"],
# "Serial Number": system_info["serialNumber"]
# "Firmware Type":
}
},
}
return ver
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