| commit | dc7770153b8fdfca26f1e7fd038033dff6b20456 | [log] [tgz] |
|---|---|---|
| author | Tao Lin <lintao.lc@inspur.com> | Wed Jul 27 20:41:46 2022 +0800 |
| committer | Patrick Williams <patrick@stwcx.xyz> | Thu Sep 08 16:48:19 2022 +0000 |
| tree | 3ac02ba4c1a41eca1c632395f7d3d259549f1042 | |
| parent | e667239d5a57ee3599c6378839e7858a545ae275 [diff] |
Association not created when sensors from DBus
Save the path when create virtual sensors from DBus.
Main functions after saving:
* Set the threshold on the path corresponding to entity-manager
* Create an association
I found that the sensor created by reading virtual_sensor_config.json will create association.
However,the virtual sensor created from DBus has no association,
so I added this.
In this way, my web/redfish can display this virtual sensor.
```
root@NULL:~# busctl introspect xyz.openbmc_project.VirtualSensor /xyz/openbmc_project/sensors/temperature/NVMe_MAX_Temp xyz.openbmc_project.Association.Definitions
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
.Associations property a(sss) 1 "chassis" "all_sensors" "/xyz/openbmc_project/inventory/system/nvme/NVMe_MAX" emits-change writable
```
The BMC web will find my all_sensor according to the following steps:
```
root@NULL:~# busctl call xyz.openbmc_project.ObjectMapper /xyz/openbmc_project/object_mapper xyz.openbmc_project.ObjectMapper GetSubTreePaths sias /xyz/openbmc_project/inventory 0 2 xyz.openbmc_project.Inventory.Item.Board xyz.openbmc_project.Inventory.Item.Chassis --verbose
MESSAGE "as" {
ARRAY "s" {
STRING "/xyz/openbmc_project/inventory/system/board/FP5280G2_Motherboard";
STRING "/xyz/openbmc_project/inventory/system/chassis";
STRING "/xyz/openbmc_project/inventory/system/nvme/NVMe_MAX";
};
};
root@NULL:~# busctl call xyz.openbmc_project.ObjectMapper /xyz/openbmc_project/inventory/system/nvme/NVMe_MAX/all_sensors org.freedesktop.DBus.Properties Get ss xyz.openbmc_project.Association endpoints --verbose
MESSAGE "v" {
VARIANT "as" {
ARRAY "s" {
STRING "/xyz/openbmc_project/sensors/temperature/NVMe_MAX_Temp";
};
};
};
```
Signed-off-by: Tao Lin <lintao.lc@inspur.com>
Change-Id: I5ab8ce532dde9cff837f85d1e27a0a420942a8ce
phosphor-virtual-sensor reads in virtual_sensor_config.json There are two types of data in this file:
See virtual_sensor_config.json in this repository for an example. Sensors added this way can use any expression that is accepted by exprtk.
For example:
{ "Desc": { "Config": "D-Bus", "Type": "ModifiedMedian" } }
Sensors added this way can only use a set of restricted calculations. At this stage the only type supported is modifiedMedian.
The virtual sensor configuration information needs to be added into the relevant hardware configuration file in entity-manager. This method of adding a virtual sensor allows a recipe that builds for different hardware configurations to have different virtual sensors for each configuration.
The virtual sensor configuration in entity manager follows a different format to the JSON in virtual_sensor_config.json (specified in entity-manager/schemas/VirtualSensor.json).