From 2dffad67b7b9351ea7757f0b774eee7363f4aae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Wed, 29 Apr 2026 14:03:39 +0200 Subject: [PATCH] test: usb: adapt to new yangerd --- test/infamy/usb.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/infamy/usb.py b/test/infamy/usb.py index 2f7eb4ac..8bd64086 100644 --- a/test/infamy/usb.py +++ b/test/infamy/usb.py @@ -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"]