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

+14
View File
@@ -281,3 +281,17 @@ def test_build_environment_from_new_resources(rackmount):
def test_build_environment_empty():
assert build_environment() == {
"fans": {}, "temperature": {}, "power": {}, "voltages": {}, "consumed_watts": None}
def test_power_supply_legacy_item(rackmount):
# Items of the legacy Power.PowerSupplies array parse the same way: MemberId as id,
# LastPowerOutputWatts as output.
(item,) = rackmount(CHASSIS + "/Power")["PowerSupplies"]
psu = parse_power_supply(item)
assert psu["id"] == "0"
assert psu["name"] == "Power Supply Bay"
assert psu["capacity"] == 800.0
assert psu["output"] == 325.0
assert psu["model"] == "499253-B21"
assert psu["serial_number"] == "1Z0000001"
assert psu["status"] is False
+7
View File
@@ -57,6 +57,7 @@ def test_ethernet_interface(rackmount):
assert eth["fqdn"] == "web483-bmc.dmtf.org"
assert eth["vlan"] == 101
assert eth["permanent_mac_address"] == "23:11:8A:33:CF:EA"
assert eth["link_status"] == "LinkUp"
def test_ethernet_interface_without_link_status(rackmount):
@@ -64,6 +65,7 @@ def test_ethernet_interface_without_link_status(rackmount):
eth = parse_ethernet_interface(rackmount(MANAGER + "/EthernetInterfaces/ToHost"))
assert eth["interface"]["is_up"] is True
assert eth["ipv4"] == {"192.168.20.55": {"prefix_length": 24}}
assert eth["link_status"] is None
assert eth["vlan"] is None
@@ -151,6 +153,11 @@ def test_network_protocol_ntp(telemetry):
"communities": []}
def test_network_protocol_port_without_flag():
np = parse_network_protocol({"IPMI": {"Port": 623}, "Proxy": {"Enabled": True}})
assert np["protocols"] == {"IPMI": {"enabled": None, "port": 623}}
def test_network_protocol_ntp_blank_entries():
servers = ["", None, " pool.ntp.org ", "pool.ntp.org"]
np = parse_network_protocol({"NTP": {"ProtocolEnabled": True, "NTPServers": servers}})