xref: /openbmc/entity-manager/docs/entity_manager_dbus_api.md (revision ec1137d54552e346ee3d9d7f7c647316dbb5794f)
13ce9143fSBrad Bishop# Entity Manager DBus API
23ce9143fSBrad Bishop
33ce9143fSBrad BishopThe Entity Manager is in charge of inventory management by scanning JSON files
43ce9143fSBrad Bishopand representing the data on DBus in a meaningful way. For more information on
53ce9143fSBrad Bishopthe internal structure of the Entity Manager, please refer to the README of the
63ce9143fSBrad BishopEntity Manager. This file documents a consumers usage of the entity manager, and
73ce9143fSBrad Bishopis not a description of the internal workings.
83ce9143fSBrad Bishop
93ce9143fSBrad Bishop## DBus Object
103ce9143fSBrad Bishop
11*ec1137d5SPatrick Williams### Object Paths
123ce9143fSBrad Bishop
13*ec1137d5SPatrick Williams#### Entities: `/xyz/openbmc_project/Inventory/Item/{Entity Type}/{Entity Name}`
143ce9143fSBrad Bishop
153ce9143fSBrad BishopEntities are top level json objects that describe a piece of hardware. They are
163ce9143fSBrad Bishopgroups of configurations with few properties of their own, they are a container
173ce9143fSBrad Bishoptype for most pratical purposes.
183ce9143fSBrad Bishop
19*ec1137d5SPatrick Williams#### Devices: `/xyz/openbmc_project/Inventory/Item/{Entity Type}/{Entity Name}/{Configuration}`
203ce9143fSBrad Bishop
213ce9143fSBrad BishopConfigurations are components that are exposed when an entity is added to the
223ce9143fSBrad Bishop"global" system configuration. An example would be a TMP75 sensor that is
233ce9143fSBrad Bishopexposed when the front panel is detected.
243ce9143fSBrad Bishop
25fa8ee87eSPatrick Williams**Example**:
263ce9143fSBrad Bishop
27*ec1137d5SPatrick Williams```text
283ce9143fSBrad Bishop/xyz/openbmc_project/Inventory/Item/Board/Intel_Front_Panel/Front_Panel_Temp
293ce9143fSBrad Bishop```
303ce9143fSBrad Bishop
31*ec1137d5SPatrick Williams### Interfaces
323ce9143fSBrad Bishop
33*ec1137d5SPatrick Williams#### `xyz.openbmc_project.{InventoryType}`
343ce9143fSBrad Bishop
35fa8ee87eSPatrick WilliamsSee
36fa8ee87eSPatrick Williams[upstream types](https://github.com/openbmc/phosphor-dbus-interfaces/tree/master/yaml/xyz/openbmc_project/Inventory/Item)
373ce9143fSBrad Bishop
38fa8ee87eSPatrick Williams- BMC
39fa8ee87eSPatrick Williams- Board
40fa8ee87eSPatrick Williams- Chassis
41fa8ee87eSPatrick Williams- CPU
42fa8ee87eSPatrick Williams- ...
433ce9143fSBrad Bishop
443ce9143fSBrad BishopThese types closely align with Redfish types.
453ce9143fSBrad Bishop
463ce9143fSBrad BishopEntity objects describe pieces of physical hardware.
473ce9143fSBrad Bishop
48*ec1137d5SPatrick Williams##### Properties
493ce9143fSBrad Bishop
50*ec1137d5SPatrick Williams`unsigned int num_children`: Number of configurations under this entity.
513ce9143fSBrad Bishop
52*ec1137d5SPatrick Williams`std::string name`: name of the inventory item
533ce9143fSBrad Bishop
54*ec1137d5SPatrick Williams#### `xyz.openbmc_project.Configuration`
553ce9143fSBrad Bishop
563ce9143fSBrad BishopConfiguration objects describe components owned by the Entity.
573ce9143fSBrad Bishop
58*ec1137d5SPatrick Williams##### Properties
593ce9143fSBrad Bishop
603ce9143fSBrad BishopProperties will contain all non-objects (simple types) exposed by the JSON.
613ce9143fSBrad Bishop
62fa8ee87eSPatrick Williams**Example**:
633ce9143fSBrad Bishop
64*ec1137d5SPatrick Williams```text
653ce9143fSBrad Bishoppath: /xyz/openbmc_project/Inventory/Item/Board/Intel_Front_Panel/Front_Panel_Temp
663ce9143fSBrad BishopInterface: xyz.openbmc_project.Configuration
673ce9143fSBrad Bishop    string name = "front panel temp"
683ce9143fSBrad Bishop    string address = "0x4D"
693ce9143fSBrad Bishop    string "bus" = "1"
703ce9143fSBrad Bishop```
713ce9143fSBrad Bishop
72*ec1137d5SPatrick Williams#### `xyz.openbmc_project.Device.{Object}.{index}`
733ce9143fSBrad Bishop
743ce9143fSBrad Bishop{Object}s are members of the parent device that were originally described as
753ce9143fSBrad Bishopdictionaries. This allows for creating more complex types, while still being
763ce9143fSBrad Bishopable to get a picture of the entire system when doing a get managed objects
773ce9143fSBrad Bishopmethod call. Array objects will be indexed zero based.
783ce9143fSBrad Bishop
79*ec1137d5SPatrick Williams##### Properties
803ce9143fSBrad Bishop
813ce9143fSBrad BishopAll members of the dictonary.
823ce9143fSBrad Bishop
83fa8ee87eSPatrick Williams**Example**:
843ce9143fSBrad Bishop
85*ec1137d5SPatrick Williams```text
863ce9143fSBrad Bishoppath: /xyz/openbmc_project/Inventory/Item/Board/Intel_Front_Panel/Front_Panel_Temp
873ce9143fSBrad BishopInterface: xyz.openbmc_project.Device.threshold.0
883ce9143fSBrad Bishop    string direction = "greater than"
893ce9143fSBrad Bishop    int value = 55
903ce9143fSBrad Bishop```
913ce9143fSBrad Bishop
923ce9143fSBrad Bishop## JSON Requirements
933ce9143fSBrad Bishop
94*ec1137d5SPatrick Williams### JSON syntax requirements
953ce9143fSBrad Bishop
963ce9143fSBrad BishopBased on the above DBus object, there is an implicit requirement that device
973ce9143fSBrad Bishopobjects may not have more than one level deep of dictionary or list of
983ce9143fSBrad Bishopdictionary. It is possible to extend in the future to allow nearly infinite
993ce9143fSBrad Bishoplevels deep of dictonary with extending the
100fa8ee87eSPatrick Williams**xyz.openbmc_project.Device.{Object}** to allow
101fa8ee87eSPatrick Williams**xyz.openbmc_project.Device.{Object}.{SubObject}.{SubObject}** but that
1023ce9143fSBrad Bishopcomplexity will be avoided until proven needed.
1033ce9143fSBrad Bishop
104fa8ee87eSPatrick Williams**Example**:
1053ce9143fSBrad Bishop
1063ce9143fSBrad BishopLegal:
1073ce9143fSBrad Bishop
108*ec1137d5SPatrick Williams```text
1093ce9143fSBrad Bishopexposes :
1103ce9143fSBrad Bishop[
1113ce9143fSBrad Bishop    {
1123ce9143fSBrad Bishop        "name" : "front panel temp",
1133ce9143fSBrad Bishop        "property": {"key: "value"}
1143ce9143fSBrad Bishop    }
1153ce9143fSBrad Bishop]
1163ce9143fSBrad Bishop```
1173ce9143fSBrad Bishop
1183ce9143fSBrad BishopNot Legal:
1193ce9143fSBrad Bishop
120*ec1137d5SPatrick Williams```text
1213ce9143fSBrad Bishopexposes :
1223ce9143fSBrad Bishop[
1233ce9143fSBrad Bishop    {
1243ce9143fSBrad Bishop        "name" : "front panel temp",
1253ce9143fSBrad Bishop        "property": {
1263ce9143fSBrad Bishop            "key": {
1273ce9143fSBrad Bishop                "key2": "value"
1283ce9143fSBrad Bishop            }
1293ce9143fSBrad Bishop        }
1303ce9143fSBrad Bishop    }
1313ce9143fSBrad Bishop]
1323ce9143fSBrad Bishop```
133