Files
Christian Manivong daa7dc9726
driver / standard (pull_request) Successful in 14s
driver / lint (pull_request) Successful in 13s
driver / types (pull_request) Successful in 58s
driver / test (3.12) (pull_request) Failing after 58s
driver / test (3.13) (pull_request) Failing after 55s
driver / lowest (pull_request) Failing after 30s
driver / build (pull_request) Successful in 27s
driver / security (pull_request) Successful in 1m4s
CI / driver (pull_request) Failing after 2m29s
driver / publish (pull_request) Skipped
feat(time-sync): the BMC's NTP servers through TimeSyncMixin
netOrk keeps one list of NTP servers per site and aligns a device that
differs (NetOrk/netork#2360). A BMC takes part through Redfish's
ManagerNetworkProtocol: NTP.NTPServers is read, and written with a
PATCH that carries the resource's @odata.etag as If-Match, so a change
made on the BMC in between is refused instead of overwritten.

BMCs give the array a fixed length and show the unused slots as empty
strings (three on an iDRAC 9, two on an iLO 5). Such an array is filled
up with its empty value, and more servers than slots are refused before
anything is written. Servers of a disabled NTP are not in use: they read
as none, and the write turns NTP on. Servers the BMC already uses are
not written again, so a poll that aligns it every time does not churn.
get_ntp_servers() follows the same rule.

A BMC runs on UTC or an offset (DateTimeLocalOffset), not a zone, so
time_sync_writes is {"ntp_servers"} and the zone is read only where the
manager names an IANA zone (TimeZoneName). A BMC whose Redfish has no
NTP block (the Supermicro X10's v1_0_0) raises rather than claiming it
has no servers. The bmc driver has it over Redfish only; ipmi has none.

Needs napalm-device-types 4.35.0.

Refs NetOrk/netork#2367
2026-11-11 15:20:35 +01:00

69 lines
5.1 KiB
Markdown

# Getters mapped to Redfish resources
Paths use the usual single-member IDs (`Systems/1`, `Managers/1`, `Chassis/1`); the driver
must follow the collections instead of assuming IDs, because vendors differ (Dell uses
`System.Embedded.1`, HPE uses `1`, Supermicro uses `1`).
## Authentication
- **Session:** `POST /redfish/v1/SessionService/Sessions` with user and password returns
an `X-Auth-Token` header and the session's URI. Use the token, `DELETE` the session on
close. BMCs allow few concurrent sessions, so leaking them locks out the web UI.
- **Basic auth** works on most services and is the fallback.
- Self-signed certificates are the norm; verification is configurable per device.
## NAPALM getters
| Getter | Resource | Fields |
|---|---|---|
| `get_facts` | `Systems/{id}`, `Managers/{id}` | `Manufacturer`, `Model`, `SerialNumber`, `HostName`; BMC `FirmwareVersion` as `os_version`. `uptime` is not in Redfish (return -1). `interface_list` from `Managers/{id}/EthernetInterfaces` |
| `get_interfaces` | `Managers/{id}/EthernetInterfaces/*` | BMC ports: `MACAddress`, `SpeedMbps`, `LinkStatus`, `InterfaceEnabled` |
| `get_interfaces_ip` | same | `IPv4Addresses`, `IPv6Addresses` |
| `get_environment` | `Chassis/{id}/Thermal` (`Temperatures[]`, `Fans[]`), `Chassis/{id}/Power` (`PowerSupplies[]`, `PowerControl[].PowerConsumedWatts`) | Newer services move these to `ThermalSubsystem`, `PowerSubsystem` and `Sensors`; read whichever exists. CPU and memory of the host OS are unknown to a BMC |
| `get_users` | `AccountService/Accounts/*` | `UserName`, `RoleId`, `Enabled` |
| `get_ntp_servers` | `Managers/{id}/NetworkProtocol` | `NTP.NTPServers` (newer schema versions only); none while `NTP.ProtocolEnabled` is false |
| `get_snmp_information` | `Managers/{id}/NetworkProtocol` | `SNMP.ProtocolEnabled` (details vary) |
| `get_config` | n/a | A BMC has no configuration file. Not implemented |
## Role methods (draft, see role.md)
| Method | Resource |
|---|---|
| `get_power_state` | `Systems/{id}`: `PowerState` |
| `set_power_state` | `POST Systems/{id}/Actions/ComputerSystem.Reset` with `ResetType`; allowed values from `ResetType@Redfish.AllowableValues` (or the `ActionInfo` resource) |
| `reboot_host` (the BMC) | `POST Managers/{id}/Actions/Manager.Reset` |
| `get_hardware_inventory` | `Systems/{id}` (`ProcessorSummary`, `MemorySummary`), `Systems/{id}/Processors/*`, `Systems/{id}/Memory/*`, `Systems/{id}/Storage/*` (older: `SimpleStorage`), `Chassis/{id}/Power` PSUs, `Systems/{id}/EthernetInterfaces/*` |
| `get_event_log` | `Systems/{id}/LogServices/*/Entries` or `Managers/{id}/LogServices/*/Entries` (where the SEL lives varies by vendor) |
| `get_firmware_inventory` | `UpdateService/FirmwareInventory/*`: `Name`, `Version`, `Updateable` |
| `get_management_protocols` | `Managers/{id}/NetworkProtocol`: `HTTP`, `HTTPS`, `SSH`, `IPMI`, `SNMP`, `KVMIP`, `VirtualMedia`, `SSDP`, each with `ProtocolEnabled` and `Port` |
## Time sync (napalm-device-types' `TimeSyncMixin`)
| Method | Resource |
|---|---|
| `get_time_sync` | `Managers/{id}/NetworkProtocol`: `NTP.NTPServers` (empty slots dropped; none while `NTP.ProtocolEnabled` is false). `timezone` is `Managers/{id}` `TimeZoneName` (Manager v1.10) where that is an IANA zone, else none: `DateTimeLocalOffset` is an offset, not a zone. A `NetworkProtocol` without an `NTP` block (Supermicro X10, `v1_0_0`) raises |
| `configure_time_sync` | `PATCH Managers/{id}/NetworkProtocol` with `{"NTP": {"NTPServers": [...]}}` and `If-Match: <@odata.etag>` where the resource has one; `ProtocolEnabled: true` too where NTP is off. An array that shows empty slots (`""`, null; three on an iDRAC 9, two on an iLO 5) has a fixed length: the servers fill it, the rest keep the empty value, and more servers than slots are refused before the PATCH. Only the servers are written (`time_sync_writes == {"ntp_servers"}`): BMCs run on UTC or an offset. The `ipmi` driver has no time sync; `bmc` has it over Redfish only |
## IPMI fallback (`ipmi` entry point)
Via `pyghmi`: device ID and FRU data for `get_facts`, sensor data repository for
`get_environment`, chassis status for `get_power_state`, SEL for `get_event_log`.
`set_power_state` sends a chassis control (`On` → power up, `GracefulShutdown` → soft off
via ACPI, `ForceOff` → power down, `ForceRestart` → hard reset). IPMI has no graceful
restart, and pyghmi offers no power cycle, so `get_power_state` never offers those two.
No BMC reset over IPMI.
## Redfish and IPMI together (`bmc` entry point)
`BmcDriver` holds a `RedfishDriver` and an `IpmiDriver` for the same BMC and account:
| Situation | Used |
|---|---|
| Redfish answers | Redfish for every getter; IPMI is not opened |
| A getter fails over Redfish (`RedfishError`, `ConnectionException`) | that getter over IPMI, if IPMI has it (Redfish-only getters re-raise) |
| The service root refuses Redfish for want of a license, or Redfish does not answer | IPMI for everything; Redfish-only getters raise `NotImplementedError` |
| `set_power_state` | Redfish when it answers; a refusal (`RuntimeError`) is final |
| `reboot_host` | Redfish only (`Manager.Reset`) |
| `get_management_protocols` over IPMI | `{"ipmi": {"enabled": True, "port": 623}}` |