mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-22 01:13:00 +02:00
test: usb: adapt to new yangerd
This commit is contained in:
+4
-3
@@ -1,11 +1,12 @@
|
||||
def _get_hardware(target):
|
||||
xpath="/ietf-hardware:hardware"
|
||||
return target.get_data(xpath)["hardware"]
|
||||
hw = target.get_data(xpath)
|
||||
return {} if hw is None else hw.get("hardware", {})
|
||||
|
||||
def get_usb_ports(target):
|
||||
hardware=_get_hardware(target)
|
||||
ports=[]
|
||||
for component in hardware["component"]:
|
||||
for component in hardware.get("component"):
|
||||
if component.get("class") == "infix-hardware:usb":
|
||||
ports.append(component["name"])
|
||||
|
||||
@@ -13,6 +14,6 @@ def get_usb_ports(target):
|
||||
|
||||
def get_usb_state(target, name):
|
||||
hardware=_get_hardware(target)
|
||||
for component in hardware["component"]:
|
||||
for component in hardware.get("component"):
|
||||
if component.get("name") == name and component.get("class") == "infix-hardware:usb":
|
||||
return component["state"]["admin-state"]
|
||||
|
||||
Reference in New Issue
Block a user