198100205SJeremy KerrHost Management with OpenBMC 298100205SJeremy Kerr============================ 398100205SJeremy Kerr 498100205SJeremy KerrThis document describes the host-management interfaces of the OpenBMC object 598100205SJeremy Kerrstructure, accessible over REST. 698100205SJeremy Kerr 798100205SJeremy KerrInventory 898100205SJeremy Kerr--------- 998100205SJeremy Kerr 10*6ba5cff0SGunnar MillsThe system inventory structure is under the `/xyz/openbmc_project/inventory` hierarchy. 1198100205SJeremy Kerr 1298100205SJeremy KerrIn OpenBMC the inventory is represented as a path which is hierarchical to the 1398100205SJeremy Kerrphysical system topology. Items in the inventory are referred to as inventory 14*6ba5cff0SGunnar Millsitems and are not necessarily FRUs (field-replaceable units). If the system 15*6ba5cff0SGunnar Millscontains one chassis, a motherboard, and a CPU on the motherboard, then the 16*6ba5cff0SGunnar Millspath to that inventory item would be: 1798100205SJeremy Kerr 1898100205SJeremy Kerr inventory/system/chassis0/motherboard0/cpu0 1998100205SJeremy Kerr 20*6ba5cff0SGunnar MillsThe properties associated with an inventory item are specific to that item. 21*6ba5cff0SGunnar MillsSome common properties are: 2298100205SJeremy Kerr 23*6ba5cff0SGunnar Mills * `Version`: A code version associated with this item. 24*6ba5cff0SGunnar Mills * `Present`: Indicates whether this item is present in the system (True/False). 25*6ba5cff0SGunnar Mills * `Functional`: Indicates whether this item is functioning in the system (True/False). 2698100205SJeremy Kerr 2798100205SJeremy KerrThe usual `list` and `enumerate` REST queries allow the system inventory 2898100205SJeremy Kerrstructure to be accessed. For example, to enumerate all inventory items and 2998100205SJeremy Kerrtheir properties: 3098100205SJeremy Kerr 31*6ba5cff0SGunnar Mills curl -b cjar -k https://${bmc}/xyz/openbmc_project/inventory/enumerate 3298100205SJeremy Kerr 3398100205SJeremy KerrTo list the properties of one item: 3498100205SJeremy Kerr 35*6ba5cff0SGunnar Mills curl -b cjar -k https://${bmc}/xyz/openbmc_project/inventory/system/chassis/motherboard 3698100205SJeremy Kerr 3798100205SJeremy KerrSensors 3898100205SJeremy Kerr------- 3998100205SJeremy Kerr 40*6ba5cff0SGunnar MillsThe system sensor structure is under the `/xyz/openbmc_project/sensors` hierarchy. 4198100205SJeremy Kerr 4298100205SJeremy KerrThis interface allows monitoring of system attributes like temperature or 4398100205SJeremy Kerraltitude, and are represented similar to the inventory, by object paths under 4498100205SJeremy Kerrthe top-level `sensors` object name. The path categorizes the sensor and shows 4598100205SJeremy Kerrwhat the sensor represents, but does not necessarily represent the physical 4698100205SJeremy Kerrtopology of the system. 4798100205SJeremy Kerr 4898100205SJeremy KerrFor example, all temperature sensors are under `sensors/temperature`. CPU 4998100205SJeremy Kerrtemperature sensors would be `sensors/temperature/cpu[n]`. 5098100205SJeremy Kerr 51*6ba5cff0SGunnar MillsThese are some common properties: 5298100205SJeremy Kerr 53*6ba5cff0SGunnar Mills * `Value`: Current value of the sensor 54*6ba5cff0SGunnar Mills * `Unit`: Unit of the value and "Critical" and "Warning" values 55*6ba5cff0SGunnar Mills * `Scale`: The scale of the value and "Critical" and "Warning" values 56*6ba5cff0SGunnar Mills * `CriticalHigh` & `CriticalLow`: Sensor device upper/lower critical threshold bound 57*6ba5cff0SGunnar Mills * `CriticalAlarmHigh` & `CriticalAlarmLow`: True if the sensor has exceeded the 58*6ba5cff0SGunnar Millscritical threshold bound 59*6ba5cff0SGunnar Mills * `WarningHigh` & `WarningLow`: Sensor device upper/lower warning threshold bound 60*6ba5cff0SGunnar Mills * `WarningAlarmHigh` & `WarningAlarmLow`: True if the sensor has exceeded the 61*6ba5cff0SGunnar Millswarning threshold bound 62*6ba5cff0SGunnar Mills 63*6ba5cff0SGunnar MillsA temperature sensor might look like: 64*6ba5cff0SGunnar Mills 65*6ba5cff0SGunnar Mills curl -b cjar -k https://${bmc}/xyz/openbmc_project/sensors/temperature/pcie 66*6ba5cff0SGunnar Mills { 67*6ba5cff0SGunnar Mills "data": { 68*6ba5cff0SGunnar Mills "CriticalAlarmHigh": 0, 69*6ba5cff0SGunnar Mills "CriticalAlarmLow": 0, 70*6ba5cff0SGunnar Mills "CriticalHigh": 70000, 71*6ba5cff0SGunnar Mills "CriticalLow": 0, 72*6ba5cff0SGunnar Mills "Scale": -3, 73*6ba5cff0SGunnar Mills "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC", 74*6ba5cff0SGunnar Mills "Value": 28187, 75*6ba5cff0SGunnar Mills "WarningAlarmHigh": 0, 76*6ba5cff0SGunnar Mills "WarningAlarmLow": 0, 77*6ba5cff0SGunnar Mills "WarningHigh": 60000, 78*6ba5cff0SGunnar Mills "WarningLow": 0 79*6ba5cff0SGunnar Mills }, 80*6ba5cff0SGunnar Mills "message": "200 OK", 81*6ba5cff0SGunnar Mills "status": "ok" 82*6ba5cff0SGunnar Mills } 83*6ba5cff0SGunnar Mills 84*6ba5cff0SGunnar MillsNote the value of this sensor is 28.187C (28187 * 10^-3). 8598100205SJeremy Kerr 8698100205SJeremy KerrUnlike IPMI, there are no "functional" sensors in OpenBMC; functional states are 8798100205SJeremy Kerrrepresented in the inventory. 8898100205SJeremy Kerr 8998100205SJeremy KerrTo enumerate all sensors in the system: 9098100205SJeremy Kerr 91*6ba5cff0SGunnar Mills curl -b cjar -k https://${bmc}/xyz/openbmc_project/sensors/enumerate 9298100205SJeremy Kerr 9398100205SJeremy KerrList properties of one inventory item: 9498100205SJeremy Kerr 95*6ba5cff0SGunnar Mills curl -b cjar -k https://${bmc}/xyz/openbmc_project/sensors/temperature/ambient 9698100205SJeremy Kerr 9798100205SJeremy KerrEvent Logs 9898100205SJeremy Kerr---------- 9998100205SJeremy Kerr 100*6ba5cff0SGunnar MillsThe event log structure is under the `/xyz/openbmc_project/logging/entry` hierarchy. 10198100205SJeremy KerrEach event is a separate object under this structure, referenced by number. 10298100205SJeremy Kerr 103*6ba5cff0SGunnar MillsBMC and host firmware on POWER-based servers can report event logs to the BMC. 104*6ba5cff0SGunnar MillsTypically, these event logs are reported in cases where host firmware cannot start the 10598100205SJeremy KerrOS, or cannot reliably log to the OS. 10698100205SJeremy Kerr 107*6ba5cff0SGunnar MillsThe properties associated with an event log are as follows: 10898100205SJeremy Kerr 109*6ba5cff0SGunnar Mills * `Message`: The type of event log (e.g. "xyz.openbmc_project.Inventory.Error.NotPresent"). 110*6ba5cff0SGunnar Mills * `Resolved` : Indicates whether the event has been resolved. 111*6ba5cff0SGunnar Mills * `Severity`: The level of problem ("Info", "Error", etc.). 112*6ba5cff0SGunnar Mills * `Timestamp`: The date of the event log in epoch time. 113*6ba5cff0SGunnar Mills * `associations`: A URI to the failing inventory part. 11498100205SJeremy Kerr 115*6ba5cff0SGunnar MillsTo list all reported event logs: 11698100205SJeremy Kerr 117*6ba5cff0SGunnar Mills $ curl -b cjar -k https://${bmc}/xyz/openbmc_project/logging/entry/ 11898100205SJeremy Kerr { 11998100205SJeremy Kerr "data": [ 120*6ba5cff0SGunnar Mills "/xyz/openbmc_project/logging/entry/3", 121*6ba5cff0SGunnar Mills "/xyz/openbmc_project/logging/entry/2", 122*6ba5cff0SGunnar Mills "/xyz/openbmc_project/logging/entry/1", 123*6ba5cff0SGunnar Mills "/xyz/openbmc_project/logging/entry/7", 124*6ba5cff0SGunnar Mills "/xyz/openbmc_project/logging/entry/6", 125*6ba5cff0SGunnar Mills "/xyz/openbmc_project/logging/entry/5", 126*6ba5cff0SGunnar Mills "/xyz/openbmc_project/logging/entry/4" 12798100205SJeremy Kerr ], 12898100205SJeremy Kerr "message": "200 OK", 12998100205SJeremy Kerr "status": "ok" 13098100205SJeremy Kerr } 13198100205SJeremy Kerr 13298100205SJeremy KerrTo read a specific event log: 13398100205SJeremy Kerr 134*6ba5cff0SGunnar Mills $ curl -b cjar -k https://${bmc}/xyz/openbmc_project/logging/entry/1 13598100205SJeremy Kerr { 13698100205SJeremy Kerr "data": { 137*6ba5cff0SGunnar Mills "AdditionalData": [ 138*6ba5cff0SGunnar Mills "CALLOUT_INVENTORY_PATH=/xyz/openbmc_project/inventory/system/chassis/powersupply0", 139*6ba5cff0SGunnar Mills "_PID=1136" 140*6ba5cff0SGunnar Mills ], 141*6ba5cff0SGunnar Mills "Id": 1, 142*6ba5cff0SGunnar Mills "Message": "xyz.openbmc_project.Inventory.Error.NotPresent", 143*6ba5cff0SGunnar Mills "Resolved": 0, 144*6ba5cff0SGunnar Mills "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error", 145*6ba5cff0SGunnar Mills "Timestamp": 1512154612660, 146*6ba5cff0SGunnar Mills "associations": [ 147*6ba5cff0SGunnar Mills [ 148*6ba5cff0SGunnar Mills "callout", 149*6ba5cff0SGunnar Mills "fault", 150*6ba5cff0SGunnar Mills "/xyz/openbmc_project/inventory/system/chassis/powersupply0" 151*6ba5cff0SGunnar Mills ] 152*6ba5cff0SGunnar Mills ] 15398100205SJeremy Kerr }, 15498100205SJeremy Kerr "message": "200 OK", 15598100205SJeremy Kerr "status": "ok" 15698100205SJeremy Kerr } 15798100205SJeremy Kerr 158*6ba5cff0SGunnar MillsTo delete an event log (log 1 in this example), call the `delete` method on the event: 15998100205SJeremy Kerr 16098100205SJeremy Kerr curl -b cjar -k -H "Content-Type: application/json" -X POST \ 16198100205SJeremy Kerr -d '{"data" : []}' \ 162*6ba5cff0SGunnar Mills https://${bmc}/xyz/openbmc_project/logging/entry/1/action/Delete 16398100205SJeremy Kerr 164*6ba5cff0SGunnar MillsTo clear all event logs, call the top-level `deleteAll` method: 16598100205SJeremy Kerr 16698100205SJeremy Kerr curl -b cjar -k -H "Content-Type: application/json" -X POST \ 16798100205SJeremy Kerr -d '{"data" : []}' \ 168*6ba5cff0SGunnar Mills https://${bmc}/xyz/openbmc_project/logging/action/deleteAll 16998100205SJeremy Kerr 170*6ba5cff0SGunnar MillsHost Boot Options 17198100205SJeremy Kerr----------------- 17298100205SJeremy Kerr 173*6ba5cff0SGunnar MillsWith OpenBMC, the Host boot options are stored as D-Bus properties under the 174*6ba5cff0SGunnar Mills`control/host0/boot` path. Properties include `BootMode` and `BootSource`. 17598100205SJeremy Kerr 1764cd993e2SJoel Stanley 177*6ba5cff0SGunnar MillsHost State Control 1784cd993e2SJoel Stanley------------------ 1794cd993e2SJoel Stanley 180*6ba5cff0SGunnar MillsThe host can be controlled through the `host` object. The object implements a number 181*6ba5cff0SGunnar Millsof actions including power on and power off. These correspond to the IPMI 182*6ba5cff0SGunnar Mills`power on` and `power off` commands. 1834cd993e2SJoel Stanley 184*6ba5cff0SGunnar MillsAssuming you have logged in, the following will power on the host: 1854cd993e2SJoel Stanley 1864cd993e2SJoel Stanley``` 187*6ba5cff0SGunnar Millscurl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT \ 188*6ba5cff0SGunnar Mills -d '{"data": "xyz.openbmc_project.State.Host.Transition.On"}' \ 189*6ba5cff0SGunnar Mills https://${bmc}/xyz/openbmc_project/state/host0/attr/RequestedHostTransition 1904cd993e2SJoel Stanley``` 1914cd993e2SJoel Stanley 192*6ba5cff0SGunnar MillsTo power off the host: 1934cd993e2SJoel Stanley 194*6ba5cff0SGunnar Mills``` 195*6ba5cff0SGunnar Millscurl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT \ 196*6ba5cff0SGunnar Mills -d '{"data": "xyz.openbmc_project.State.Host.Transition.Off"}' \ 197*6ba5cff0SGunnar Mills https://${bmc}/xyz/openbmc_project/state/host0/attr/RequestedHostTransition 198*6ba5cff0SGunnar Mills``` 199*6ba5cff0SGunnar Mills 200*6ba5cff0SGunnar MillsTo issue a hard power off (accomplished by powering off the chassis): 201*6ba5cff0SGunnar Mills 202*6ba5cff0SGunnar Mills``` 203*6ba5cff0SGunnar Millscurl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT \ 204*6ba5cff0SGunnar Mills -d '{"data": "xyz.openbmc_project.State.Chassis.Transition.Off"}' \ 205*6ba5cff0SGunnar Mills https://${bmc}/xyz/openbmc_project/state/chassis0/attr/RequestedPowerTransition 206*6ba5cff0SGunnar Mills``` 207*6ba5cff0SGunnar Mills 208*6ba5cff0SGunnar MillsTo reboot the host: 209*6ba5cff0SGunnar Mills 210*6ba5cff0SGunnar Mills``` 211*6ba5cff0SGunnar Millscurl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT \ 212*6ba5cff0SGunnar Mills -d '{"data": "xyz.openbmc_project.State.Host.Transition.Reboot"}' \ 213*6ba5cff0SGunnar Mills https://${bmc}/xyz/openbmc_project/state/host0/attr/RequestedHostTransition 214*6ba5cff0SGunnar Mills``` 215*6ba5cff0SGunnar Mills 216*6ba5cff0SGunnar Mills 217*6ba5cff0SGunnar MillsMore information about Host State Management can be found here: 218*6ba5cff0SGunnar Millshttps://github.com/openbmc/phosphor-dbus-interfaces/tree/master/xyz/openbmc_project/State 219