1# Entity Manager 2 3Entity manager is a runtime configuration application which parses configuration 4files (in JSON format) and attempts to detect the devices described by the 5configuration files. It also can, based on the configuration, attempt to load 6install devices into sysfs. It takes these configurations and produces a best 7representation of the files on dbus using the xyz.openbmc_project.Configuration 8namespace. It also produces a system.json file for persistance. 9 10## Configuration Syntax 11 12In most cases a server system is built with multiple hardware modules (circuit 13boards) such as baseboard, risers, and hot-swap backplanes. While it is 14perfectly legal to combine the JSON configuration information for all the 15hardware modules into a single file if desired, it is also possible to divide 16them into multilple configuration files. For example, there may be a baseboard 17JSON file (describes all devices on the baseboard) and a chassis JSON file 18(describes devices attached to the chassis). When one of the hardware modules 19needs to be upgraded (e.g., a new temperature sensor), only such JSON 20configuration file needs to be be updated. 21 22Within a configuration file, there is a JSON object which consists of multiple 23"string : value" pairs. This Entity Manager defines the following strings. 24 25| String | Example Value | Description | 26| :-------- | ---------------------------------------- | ---------------------------------------- | 27| "Name" | "X1000 1U Chassis" | Human readable name used for identification and sorting. | 28| "Probe" | "xyz.openbmc_project.FruDevice({'BOARD_PRODUCT_NAME':'FFPANEL'})" | Statement which attempts to read from d-bus. The result determines if a configuration record should be applied. The value for probe can be set to “TRUE” in the case the record should always be applied, or set to more complex lookups, for instance a field in a FRU file that is exposed by the frudevice | 29| "Exposes" | [{"Name" : "CPU fan"}, ...] | An array of JSON objects which are valid if the probe result is successful. These objects describe the devices BMC can interact. | 30| "Status" | "disabled" | An indicator that allows for some records to be disabled by default. | 31| "Bind*" | "2U System Fan connector 1" | The record isn't complete and needs to be combined with another to be functional. The value is a unique reference to a record elsewhere. | 32| "DisableNode| "Fan 1" | Sets the status of another Entity to disabled. | 33 34Template strings in the form of "$identifier" may be used in configuration 35files. The following table describes the template strings currently defined. 36 37| Template String | Description | 38| :-------------- | :--------------------------------------- | 39| "$bus" | During a I2C bus scan and when the "probe" command is successful, this template string is substituted with the bus number to which the device is connected. | 40| "$address" | When the "probe" is successful, this template string is substituted with the (7-bit) I2C address of the FRU device. | 41| "$index" | A run-tim enumeration. This template string is substituted with a unique index value when the "probe" command is successful. This allows multiple identical devices (e.g., HSBPs) to exist in a system but each with a unique name. | 42 43 44 45## Configuration HowTos 46 47If you're just getting started and your goal is to add sensors dynamically, 48check out [My First Sensors](docs/my_first_sensors.md) 49 50 51## Configuration Records - Baseboard Example 52 53Required fields are name, probe and exposes. 54 55The configuration JSON files attempt to model after actual hardware modules 56which made up a complete system. An example baseboard JSON file shown below 57defines two fan connectors and two temperature sensors of TMP75 type. These 58objects are considered valid by BMC when the probe command (reads and compares 59the product name in FRU) is successful and this baseboard is named as "WFP 60baseboard". 61 62``` 63{ 64 "Exposes": [ 65 { 66 "Name": "1U System Fan connector 1", 67 "Pwm": 1, 68 "Status": "disabled", 69 "Tachs": [ 70 1, 71 2 72 ], 73 "Type": "IntelFanConnector" 74 }, 75 { 76 "Name": "2U System Fan connector 1", 77 "Pwm": 1, 78 "Status": "disabled", 79 "Tachs": [ 80 1 81 ], 82 "Type": "IntelFanConnector" 83 }, 84 { 85 "Address": "0x49", 86 "Bus": 6, 87 "Name": "Left Rear Temp", 88 "Thresholds": [ 89 [ 90 { 91 "Direction": "greater than", 92 "Name": "upper critical", 93 "Severity": 1, 94 "Value": 115 95 }, 96 { 97 "Direction": "greater than", 98 "Name": "upper non critical", 99 "Severity": 0, 100 "Value": 110 101 }, 102 { 103 "Direction": "less than", 104 "Name": "lower non critical", 105 "Severity": 0, 106 "Value": 5 107 }, 108 { 109 "Direction": "less than", 110 "Name": "lower critical", 111 "Severity": 1, 112 "Value": 0 113 } 114 ] 115 ], 116 "Type": "TMP75" 117 }, 118 { 119 "Address": "0x48", 120 "Bus": 6, 121 "Name": "Voltage Regulator 1 Temp", 122 "Thresholds": [ 123 [ 124 { 125 "Direction": "greater than", 126 "Name": "upper critical", 127 "Severity": 1, 128 "Value": 115 129 }, 130 { 131 "Direction": "greater than", 132 "Name": "upper non critical", 133 "Severity": 0, 134 "Value": 110 135 }, 136 { 137 "Direction": "less than", 138 "Name": "lower non critical", 139 "Severity": 0, 140 "Value": 5 141 }, 142 { 143 "Direction": "less than", 144 "Name": "lower critical", 145 "Severity": 1, 146 "Value": 0 147 } 148 ] 149 ], 150 "Type": "TMP75" 151 } 152 ], 153 "Name": "WFP Baseboard", 154 "Probe": "xyz.openbmc_project.FruDevice({'BOARD_PRODUCT_NAME' : '.*WFT'})" 155} 156``` 157 158[Full Configuration](https://github.com/openbmc/entity-manager/blob/master/configurations/WFT%20Baseboard.json) 159 160 161#### Configuration Records - Chassis Example 162 163Although fan connectors are considered a part of a baseboard, the physical fans 164themselves are considered as a part of a chassis. In order for a fan to be 165matched with a fan connector, the keyword "Bind" is used. The example below 166shows how a chassis fan named "Fan 1" is connected to the connector named "1U 167System Fan connector 1". When the probe command finds the correct product name 168in baseboard FRU, the fan and the connector are considered as being joined 169together. 170 171``` 172{ 173 "Exposes": [ 174 { 175 "BindConnector": "1U System Fan connector 1", 176 "Name": "Fan 1", 177 "Thresholds": [ 178 [ 179 { 180 "Direction": "less than", 181 "Name": "lower critical", 182 "Severity": 1, 183 "Value": 1750 184 }, 185 { 186 "Direction": "less than", 187 "Name": "lower non critical", 188 "Severity": 0, 189 "Value": 2000 190 } 191 ] 192 ], 193 "Type": "AspeedFan" 194 } 195 ] 196} 197``` 198 199## Enabling Sensors 200 201As daemons can trigger off of shared types, sometimes some handshaking will be 202needed to enable sensors. Using the TMP75 sensor as an example, when the sensor 203object is enabled, the device tree must be updated before scanning may begin. 204The entity-manager can key off of different types and export devices for 205specific configurations. Once this is done, the baseboard temperature sensor 206daemon can scan the sensors. 207 208