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:
4 files changed
+38
-14
No files matched your search
@@ -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")),
|
||||
|
||||
Reference in new issue
Block a user