Extend parsers for the driver

parse_power_supply also reads items of the legacy Power.PowerSupplies array, parse_ethernet_interface exposes the raw LinkStatus, and parse_network_protocol reports protocols that carry a Port without a ProtocolEnabled flag.
This commit is contained in:
Christian Manivong committed 2026-10-13 05:02:58 +00:00
1 parent 8b512b6e0d
commit 209537a793
4 files changed
+38 -14

No files matched your search

+4 -3
View File
@@ -99,6 +99,7 @@ def parse_ethernet_interface(iface: Mapping[str, Any]) -> dict[str, Any]:
"ipv6": _ipv6(iface.get("IPv6Addresses")),
"hostname": text(iface.get("HostName")),
"fqdn": text(iface.get("FQDN")),
"link_status": link_status,
"vlan": vlan_id,
"permanent_mac_address": _mac(iface.get("PermanentMACAddress")) or None,
}
@@ -107,13 +108,13 @@ def parse_ethernet_interface(iface: Mapping[str, Any]) -> dict[str, Any]:
def parse_network_protocol(proto: Mapping[str, Any]) -> dict[str, Any]:
"""``Managers/{id}/NetworkProtocol``: which services the BMC runs, NTP and SNMP.
``protocols`` holds every property with a ``ProtocolEnabled`` flag, so OEM-free services
the schema adds later show up without code changes. NTP servers and the SNMP details
``protocols`` holds every property with a ``ProtocolEnabled`` flag or a ``Port``, so
services the schema adds later show up without code changes. NTP servers and the SNMP details
exist only in newer schema versions; missing values are ``None``.
"""
protocols = {}
for key, value in proto.items():
if isinstance(value, Mapping) and "ProtocolEnabled" in value:
if isinstance(value, Mapping) and ("ProtocolEnabled" in value or "Port" in value):
protocols[key] = {
"enabled": boolean(value.get("ProtocolEnabled")),
"port": integer(value.get("Port")),