Extend system check to display MAC, hostname, and link status
_parse_network_data now returns mac, hostname, and link_status extracted from the Redfish EthernetInterfaces/1 response (MACAddress, HostName, LinkStatus fields confirmed present in live IOM output). _print_results gains a second table — Interface Details (IOM | MAC | Hostname) — between the Network Settings and Firmware Versions tables. Network Settings table drops the redundant Origin column and adds Link Status instead. Both _check_via_serial and _check_via_network updated to unpack and pass the additional fields. fetch_current_config in workflow_serial.py also updated to use the same address-parsing logic and trimmed table layout. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -354,13 +354,12 @@ def fetch_current_config(cfg: ShelfConfig, ser: SerialPort) -> bool:
|
||||
ok_flag, data = _serial_redfish_request(ser, cfg.password, "GET", path)
|
||||
|
||||
if ok_flag and isinstance(data, dict):
|
||||
# Determine mode
|
||||
dhcp_enabled = (
|
||||
data.get("DHCPv4", {}).get("DHCPEnabled", False) or
|
||||
data.get("DHCPv6", {}).get("DHCPEnabled", False)
|
||||
)
|
||||
|
||||
# Pull address info — prefer StaticAddresses, fall back to IPv4Addresses
|
||||
# Prefer IPv4StaticAddresses; fall back to IPv4Addresses
|
||||
addrs = data.get("IPv4StaticAddresses") or data.get("IPv4Addresses", [])
|
||||
if addrs:
|
||||
addr_rec = addrs[0]
|
||||
@@ -370,9 +369,6 @@ def fetch_current_config(cfg: ShelfConfig, ser: SerialPort) -> bool:
|
||||
else:
|
||||
ip = gateway = netmask = "--"
|
||||
|
||||
origin = data.get("IPv4Addresses", [{}])[0].get("AddressOrigin", "Unknown") \
|
||||
if data.get("IPv4Addresses") else ("DHCP" if dhcp_enabled else "Static")
|
||||
|
||||
cfg.iom1 = IOMConfig(
|
||||
iom = "IOM1",
|
||||
dhcp = dhcp_enabled,
|
||||
@@ -381,11 +377,11 @@ def fetch_current_config(cfg: ShelfConfig, ser: SerialPort) -> bool:
|
||||
netmask = netmask if netmask != "--" else "",
|
||||
)
|
||||
|
||||
mode_str = f"{_c(C.CYN, 'DHCP')}" if dhcp_enabled else f"{_c(C.GRN, 'Static')}"
|
||||
mode_str = _c(C.CYN, "DHCP") if dhcp_enabled else _c(C.GRN, "Static")
|
||||
draw_table(
|
||||
["IOM", "Mode", "Origin", "IP Address", "Gateway", "Subnet Mask"],
|
||||
[["IOM1", mode_str, origin, ip, gateway, netmask]],
|
||||
[5, 10, 8, 16, 16, 16],
|
||||
["IOM", "Mode", "IP Address", "Gateway", "Subnet Mask"],
|
||||
[["IOM1", mode_str, ip, gateway, netmask]],
|
||||
[5, 8, 15, 15, 15],
|
||||
)
|
||||
print()
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user