| 433c9193 | 29-Oct-2025 |
Janet Adkins <janeta@us.ibm.com> |
Sensors: Convert fan_tach sensors to Percent
Redfish 2025.3 clarified the reporting of fan sensors should always be as ReadingType Percent to address issue #6197. [1] The fan_tach sensors on D-Bus a
Sensors: Convert fan_tach sensors to Percent
Redfish 2025.3 clarified the reporting of fan sensors should always be as ReadingType Percent to address issue #6197. [1] The fan_tach sensors on D-Bus are Rotational sensors. Conversion is necessary for these sensor values to reflect Percent instead. [2] This is reflected in a published mockup. [3]
The Redfish update includes an additional sentence for the ReadingType description:
``` "... Services should represent fan speed and pump speed sensors with the `ReadingType` value `Percent`." ```
The ReadingRangeMax and ReadingRangeMin properties also must be converted to percent basis as they are defined to reflect the range of the Reading property.
``` curl -s https://redfish.dmtf.org/schemas/v1/Sensor.v1_11_1.json | jq .definitions.Sensor.properties.ReadingRangeMax.longDescription "This property shall indicate the maximum possible value of the `Reading` property for this sensor. This value is the range of valid readings for this sensor. Values outside this range are discarded as reading errors." ```
A new compile option, redfish-allow-rotational-fans, will maintain the old behavior of reporting fan_tach sensors as Rotational. When the option is disabled they will be reported as Percent. This will allow time for distributions to make adjustments to handle Percent reported fan sensors.
The SpeedRPM Redfish property contains the RPM value for these sensors whether this option is enabled or disabled. Clients wanting to use the RPM value should convert to use the SpeedRPM property instead of the Reading property.
``` curl -s https://redfish.dmtf.org/schemas/v1/Sensor.v1_11_1.json | jq .definitions.Sensor.properties.SpeedRPM { "description": "The rotational speed.", "excerpt": "SensorFan,SensorFanArray,SensorPump", "longDescription": "This property shall contain a reading of the rotational speed of the device in revolutions per minute (RPM) units.", "readonly": true, "type": [ "number", "null" ], "units": "{rev}/min", "versionAdded": "v1_2_0" } ```
With the compile option disabled the following differences will be reflected in the responses for /redfish/v1/Chassis/chassis/Sensors/{}: - ReadingRangeMax/ReadingRangeMin: Converted to percent range, (100,0) - ReadingType: "Percent" - ReadingUnits: "%" - Reading: Computed percent value. The computation is the percent of the RPM Value within the MaxValue to MinValue range as reported by D-Bus for the sensor. - Note: If the percent cannot be computed for any reason the Reading property is set to null. - Note: SpeedRPM: Remains unchanged, it continues to report the RPM value as reported by D-Bus.
Implementation Notes: - The SensorFanExcerpt and SensorFanArrayExcerpt definitions also include the SpeedRPM property. So moved setting of this property to be handled for excerpts as well. - The Sensor schema version has been updated regardless of the compile option setting.
[1] https://github.com/DMTF/Redfish/issues/6197 [2] https://redfish.dmtf.org/schemas/v1/Sensor.v1_11_1.json [3] https://github.com/DMTF/Redfish-Publications/blob/main/mockups/public-rackmount1/Chassis/1U/Sensors/CPUFan1/index.json
Tested: - Added new unit tests for new function getFanPercent() - Adjusted existing unit tests for Sensors to reflect changes for fan_tach sensors. - Redfish Service Validator passes (with option enabled and disabled) - Using hardware simulator hand-edited values for the min/max of the fan_tach sensors: - Option enabled: confirmed Redfish response same before and after code changes. - Option disabled: Confirmed Redfish responses and percent calculation.
Example responses with compile option disabled: ``` // D-Bus: "Value" d 18000 "MaxValue" d 18000 "MinValue" d 0 curl -s -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassis/Sensors/fantach_fan0_0 { "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan0_0", "@odata.type": "#Sensor.v1_11_1.Sensor", "Id": "fantach_fan0_0", "Name": "fan0 0", "Reading": 100, "ReadingRangeMax": 100, "ReadingRangeMin": 0, "ReadingType": "Percent", "ReadingUnits": "%", "SpeedRPM": 18000.0, "Status": { "Health": "OK", "State": "Enabled" } }
// D-Bus: "Value" d 18000 "MaxValue" d 36000 "MinValue" d 0 curl -s -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassis/Sensors/fantach_fan1_0 { "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan1_0", "@odata.type": "#Sensor.v1_11_1.Sensor", "Id": "fantach_fan1_0", "Name": "fan1 0", "Reading": 50, "ReadingRangeMax": 100, "ReadingRangeMin": 0, "ReadingType": "Percent", "ReadingUnits": "%", "SpeedRPM": 18000.0, "Status": { "Health": "OK", "State": "Enabled" } }
// Minimum is non-zero // D-Bus: "Value" d 18000 "MaxValue" d 27000 "MinValue" d 9000 curl -s -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassis/Sensors/fantach_fan2_0 { "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan2_0", "@odata.type": "#Sensor.v1_11_1.Sensor", "Id": "fantach_fan2_0", "Name": "fan2 0", "Reading": 50, "ReadingRangeMax": 100, "ReadingRangeMin": 0, "ReadingType": "Percent", "ReadingUnits": "%", "SpeedRPM": 18000.0, "Status": { "Health": "OK", "State": "Enabled" } }
// Minimum is not initialized - Reading is null // D-Bus: "Value" d 18000 "MaxValue" d 18000 "MinValue" d -inf curl -s -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassis/Sensors/fantach_fan3_0 { "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan3_0", "@odata.type": "#Sensor.v1_11_1.Sensor", "Id": "fantach_fan3_0", "Name": "fan3 0", "Reading": null, "ReadingRangeMax": 100, "ReadingRangeMin": 0, "ReadingType": "Percent", "ReadingUnits": "%", "SpeedRPM": 18000.0, "Status": { "Health": "OK", "State": "Enabled" } }
// Minimum and Maximum are not initialized - so Reading is null // D-Bus: "Value" d 18000 "MaxValue" d inf "MinValue" d -inf curl -s -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassis/Sensors/fantach_fan4_0 { "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan4_0", "@odata.type": "#Sensor.v1_11_1.Sensor", "Id": "fantach_fan4_0", "Name": "fan4 0", "Reading": null, "ReadingRangeMax": 100, "ReadingRangeMin": 0, "ReadingType": "Percent", "ReadingUnits": "%", "SpeedRPM": 18000.0, "Status": { "Health": "OK", "State": "Enabled" } } ```
Example of unchanged response with compile option enabled: ``` curl -s -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassis/Sensors/fantach_fan0_0 { "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan0_0", "@odata.type": "#Sensor.v1_11_1.Sensor", "Id": "fantach_fan0_0", "Name": "fan0 0", "Reading": 18000.0, "ReadingRangeMax": 18000.0, "ReadingRangeMin": 0.0, "ReadingType": "Rotational", "ReadingUnits": "RPM", "SpeedRPM": 18000.0, "Status": { "Health": "OK", "State": "Enabled" } } ```
Change-Id: I8ec1e739bcd5ebce7453a2570569f2edc2284341 Signed-off-by: Janet Adkins <janeta@us.ibm.com>
show more ...
|
| 1aa94df4 | 31-Jul-2025 |
Harshit Aghera <haghera@nvidia.com> |
sensor_utils: Add PeakReading property
Add support for PeakReading and PeakReadingTime for sensors. This enhancement allows sensor readings to include max observed value information in the Redfish A
sensor_utils: Add PeakReading property
Add support for PeakReading and PeakReadingTime for sensors. This enhancement allows sensor readings to include max observed value information in the Redfish API, along with timestamp. It uses PDI xyz.openbmc_project.Telemetry.Report. Property PeakReading is added if OperationType in PDI property ReadingParameters is set to Maximum.
Current Limitation - The ResetMetrics action is currently not supported for sensor URIs. As a result, the ability to clear PeakReading values for GPU Power Sensors has not been implemented.
Future Consideration - If ResetMetrics action support is added in the future, the corresponding functionality will also need to be implemented in the dbus-sensor application to ensure full compatibility.
Schema: https://redfish.dmtf.org/schemas/v1/Sensor.v1_2_0.yaml (PeakReading)
Backend implementation for reference: https://gerrit.openbmc.org/c/openbmc/dbus-sensors/+/82479
Tested: Build an image for nvl32-obmc machine with the following patches cherry picked.
https://gerrit.openbmc.org/c/openbmc/openbmc/+/85490 https://gerrit.openbmc.org/c/openbmc/bmcweb/+/82449.
The patch cherry-picks the following patches that are currently under review.
``` 1. device tree https://lore.kernel.org/all/aRbLqH8pLWCQryhu@molberding.nvidia.com/ 2. mctpd patches https://github.com/CodeConstruct/mctp/pull/85 3. u-boot changes https://lore.kernel.org/openbmc/20251121-msx4-v1-0-fc0118b666c1@nvidia.com/T/#t 4. kernel changes as specified in the openbmc patch (for espi) 5. entity-manager changes https://gerrit.openbmc.org/c/openbmc/entity-manager/+/85455 6. platform-init changes https://gerrit.openbmc.org/c/openbmc/platform-init/+/85456 7. spi changes https://lore.kernel.org/all/20251121-w25q01jv_fixup-v1-1-3d175050db73@nvidia.com/ ```
``` > curl -s -k -u 'root:0penBmc' https://10.137.203.137/redfish/v1/Chassis/NVIDIA_GB200_1/Sensors/power_NVIDIA_GB200_GPU_0_Power_0 { "@odata.id": "/redfish/v1/Chassis/NVIDIA_GB200_1/Sensors/power_NVIDIA_GB200_GPU_0_Power_0", "@odata.type": "#Sensor.v1_2_0.Sensor", "Id": "power_NVIDIA_GB200_GPU_0_Power_0", "Name": "NVIDIA GB200 GPU 0 Power 0", "PeakReading": 52.671, "PeakReadingTime": 0, "Reading": 27.214, "ReadingRangeMax": 5000.0, "ReadingRangeMin": 0.0, "ReadingType": "Power", "ReadingUnits": "W", "Status": { "Health": "OK", "State": "Enabled" } }% ````
Change-Id: I8c1ab6ce85f31419db4a1d931bf99722d24afbd7 Signed-off-by: Harshit Aghera <haghera@nvidia.com>
show more ...
|
| 378f1d61 | 06-Oct-2022 |
George Liu <liuxiwei@inspur.com> |
Add PowerWatts for EnvironmentMetrics
The EnvironmentMetrics schema[1] provides for efficient retrieval of environmental metrics by separating them from performance metrics. EnvironmentMetrics is a
Add PowerWatts for EnvironmentMetrics
The EnvironmentMetrics schema[1] provides for efficient retrieval of environmental metrics by separating them from performance metrics. EnvironmentMetrics is a property of the Chassis schema since v1_15_0[2]. EnvironmentMetrics was added to Redfish release 2021.2 [3] to be used instead of the deprecated Power schema.[4]
This commit adds PowerWatts property of the EnvironmentMetrics schema. PowerWatts has been part of the EnvironmentMetrics schema since v1_1_0. PowerWatts is a SensorPowerExcerpt[5].
Implementation notes: The new D-Bus interface "xyz.openbmc_project.Sensor.Purpose" is used to find the sensor with the "TotalPower" purpose.[6][7] The new utility function sensor_utils::getSensorsByPurpose() returns a subset of an incoming list of sensors which implement a specified purpose.
Multiple D-Bus calls are needed to find the sensor providing the totalPower: 1. Retrieve list of power sensors associated with specified chassis which implement the Sensor.Purpose interface using existing getAllSensorObjects() function. 2. For each of those power sensors retrieve the actual purpose of the sensor to find the sensor implementing totalPower purpose. Expect no more than one sensor to implement this purpose. New utility function getSensorsByPurpose() is used. 3. If a totalPower sensor is found then retrieve its properties to fill in PowerWatts in the response using existing sensor_utils::objectExcerptToJson() utility function.
If no sensor has the "TotalPower" purpose then PowerWatts is not added to EnvironmentMetrics and no error is returned.
[1] https://redfish.dmtf.org/schemas/v1/EnvironmentMetrics.v1_3_2.json [2] https://redfish.dmtf.org/schemas/v1/Chassis.v1_25_2.json [3] http://redfish.dmtf.org/schemas/Redfish_Release_History.pdf [4] https://redfish.dmtf.org/schemas/v1/Power.v1_7_3.json [5] http://redfish.dmtf.org/schemas/v1/Sensor.v1_9_1.json#/definitions/SensorPowerExcerpt [6] https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/75943 [7] https://gerrit.openbmc.org/c/openbmc/openpower-occ-control/+/77408
Tested: - Updated unit tests for new environmentMetricsNode enum - Redfish Service Validator passes (confirmed PowerWatts tested) ``` VERBOSE1 - ServiceRoot -> Chassis -> Members#4 -> EnvironmentMetrics, EnvironmentMetrics.v1_3_0, EnvironmentMetrics VERBOSE1 - @odata.id PASS VERBOSE1 - @odata.type PASS VERBOSE1 - Id PASS VERBOSE1 - Name PASS VERBOSE1 - PowerWatts PASS ``` - No "TotalPower" sensor exists (system never powered on). PowerWatts is not shown and no error is returned. ``` curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassis/EnvironmentMetrics { "@odata.id": "/redfish/v1/Chassis/chassis/EnvironmentMetrics", "@odata.type": "#EnvironmentMetrics.v1_3_0.EnvironmentMetrics", "Id": "EnvironmentMetrics", "Name": "Chassis Environment Metrics" } ```
- "TotalPower" sensor exists (system powered on) ``` curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Systems/system | grep PowerState "PowerState": "On",
curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassis/EnvironmentMetrics { "@odata.id": "/redfish/v1/Chassis/chassis/EnvironmentMetrics", "@odata.type": "#EnvironmentMetrics.v1_3_0.EnvironmentMetrics", "Id": "EnvironmentMetrics", "Name": "Chassis Environment Metrics", "PowerWatts": { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/power_total_power", "Reading": 191.0 } } ``` DataSourceUri is a valid sensor: ``` curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassis/Sensors/power_total_power { "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/power_total_power", "@odata.type": "#Sensor.v1_2_0.Sensor", "Id": "power_total_power", "Name": "total power", "Reading": 191.0, "ReadingType": "Power", "ReadingUnits": "W", "Status": { "Health": "OK", "State": "Enabled" } } ```
- "TotalPower" sensor exists but null value (system powered off) ``` curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Systems/system | grep PowerState "PowerState": "Off",
curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassis/EnvironmentMetrics { "@odata.id": "/redfish/v1/Chassis/chassis/EnvironmentMetrics", "@odata.type": "#EnvironmentMetrics.v1_3_0.EnvironmentMetrics", "Id": "EnvironmentMetrics", "Name": "Chassis Environment Metrics", "PowerWatts": { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/power_total_power", "Reading": null } } ```
And again the DataSourceUri points to a valid sensor: ``` curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassis/Sensors/power_total_power { "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/power_total_power", "@odata.type": "#Sensor.v1_2_0.Sensor", "Id": "power_total_power", "Name": "total power", "Reading": null, "ReadingType": "Power", "ReadingUnits": "W", "Status": { "Health": "OK", "State": "Enabled" } } ```
- Invalid chassis id ("TotalPower" sensor exists) ``` curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassisBAD/EnvironmentMetrics { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type Chassis named 'chassisBAD' was not found.", "MessageArgs": [ "Chassis", "chassisBAD" ], "MessageId": "Base.1.19.ResourceNotFound", "MessageSeverity": "Critical", "Resolution": "Provide a valid resource identifier and resubmit the request." } ], "code": "Base.1.19.ResourceNotFound", "message": "The requested resource of type Chassis named 'chassisBAD' was not found." } } ```
Signed-off-by: George Liu <liuxiwei@inspur.com> Signed-off-by: Janet Adkins <janeta@us.ibm.com> Change-Id: Ibe84a5e7fe0d2b232f925e457a094c021ca85d36
show more ...
|
| 740fea16 | 12-Sep-2025 |
Ed Tanous <ed@tanous.net> |
Remove deprecated json decodes
These decodes haven't been standard practice for a while. While they will likely break some downstream builds, we need to clean things up.
If you are seeing this com
Remove deprecated json decodes
These decodes haven't been standard practice for a while. While they will likely break some downstream builds, we need to clean things up.
If you are seeing this commit message because your downstream build is broken, please migrate your code to using nlohmann::json::object_t instead of nlohmann::json when it does the unpack.
Tested: Code compiles.
Change-Id: Id892ee381b2d6b40a6366ee0622cde04d2cacd7b Signed-off-by: Ed Tanous <etanous@nvidia.com>
show more ...
|
| 08fad5d9 | 31-Jul-2025 |
Corey Ethington <cethington@coreweave.com> |
Add check to omit `DateTime` from etag calculation
Ignores any json property named `DateTime` when calculating the etag value of an HTTP response as per the updated Redfish Spec (section 6.5: ETags)
Add check to omit `DateTime` from etag calculation
Ignores any json property named `DateTime` when calculating the etag value of an HTTP response as per the updated Redfish Spec (section 6.5: ETags)
Tested: - Redfish Service Validator passes - Tested on romulus: 1. GET resource with a "DateTime" field ``` curl -k -H "X-Auth-Token: $XAUTH_TOKEN" "https://$BMC/redfish/v1/TaskService" \ --etag-save ./etag.txt -v ... < etag: "6A4CE897" ... { "@odata.id": "/redfish/v1/TaskService", "@odata.type": "#TaskService.v1_1_4.TaskService", "CompletedTaskOverWritePolicy": "Oldest", "DateTime": "2025-07-23T17:08:20+00:00", "Id": "TaskService", "LifeCycleEventOnTaskStateChange": true, "Name": "Task Service", "ServiceEnabled": true, "Status": { "State": "Enabled" }, "Tasks": { "@odata.id": "/redfish/v1/TaskService/Tasks" } ```
2. GET same resource again later, etag is same as before ``` curl -k -H "X-Auth-Token: $XAUTH_TOKEN" "https://$BMC/redfish/v1/TaskService" \ --etag-save ./etag.txt -v ... < etag: "6A4CE897" ... { "@odata.id": "/redfish/v1/TaskService", "@odata.type": "#TaskService.v1_1_4.TaskService", "CompletedTaskOverWritePolicy": "Oldest", "DateTime": "2025-07-23T17:10:48+00:00", "Id": "TaskService", "LifeCycleEventOnTaskStateChange": true, "Name": "Task Service", "ServiceEnabled": true, "Status": { "State": "Enabled" }, "Tasks": { "@odata.id": "/redfish/v1/TaskService/Tasks" } ``` "DateTime" is the only value to have changed, but since it is ignored the etag did not change
3. GET with if-none-match returns 304 ``` curl -k -H "X-Auth-Token: $XAUTH_TOKEN" "https://$BMC/redfish/v1/TaskService" \ --etag-save ./etag.txt --etag-compare ./etag.txt -v ... > if-none-match: "6A4CE897" ... < HTTP/2 304 < allow: GET < odata-version: 4.0 < strict-transport-security: max-age=31536000; includeSubdomains < pragma: no-cache < cache-control: no-store, max-age=0 < x-content-type-options: nosniff < etag: "6A4CE897" < date: Wed, 23 Jul 2025 17:14:39 GMT < content-length: 0 < ... ```
Change-Id: I51f7668e75719c69c55535e4a1e48c8bae7c9488 Signed-off-by: Corey Ethington <cethington@coreweave.com>
show more ...
|
| e7bcf475 | 17-Nov-2024 |
Jayanth Othayoth <ojayanth@gmail.com> |
json utility: fixed core dump during sensor load
bmcweb replaces underscores with spaces in sensor names for better readability. The existing objectKeyCmp function did not handle this case, leading
json utility: fixed core dump during sensor load
bmcweb replaces underscores with spaces in sensor names for better readability. The existing objectKeyCmp function did not handle this case, leading to core dumps in the sensor load path.
Error details are provided below.
``` bmcwebd[1368]: [DEBUG sensors.hpp:507] Added sensor P0_NS_VR_FAN_2 bmcwebd[1368]: terminate called after throwing an instance of 'boost::detail::with_throw_location<boost::system::system_error>' bmcwebd[1368]: what(): leftover [boost.url.grammar:4] ```
Implemented a new algorithm that alphabetically sorts non-URL keys and retains the existing logic for URL-type keys.
Tested: Updated and verified the test cases.
Change-Id: I39c3f7cc54dec5e7cf9658977e1078acb827afb2 Signed-off-by: Jayanth Othayoth <ojayanth@gmail.com> Signed-off-by: Ed Tanous <etanous@nvidia.com>
show more ...
|
| 340d74c8 | 12-Oct-2024 |
Myung Bae <myungbae@us.ibm.com> |
Handling of OutOfRange in ReadJson
Currently readJsonPatch returns `PropertValueNotInList` in case when an input integer is out of range. This change is to return `PropertyValueOutOfRange` for the
Handling of OutOfRange in ReadJson
Currently readJsonPatch returns `PropertValueNotInList` in case when an input integer is out of range. This change is to return `PropertyValueOutOfRange` for the case out-of-range integer input.
Tested:
- Verify PATCH with an out-of-value integer. e.g. ``` $ curl -k -X PATCH https://${bmc}/redfish/v1/EventService/ -H "Content-Type: application/json" -d '{ "DeliveryRetryIntervalSeconds" : 4294967296}' ```
Before the change, its `MessageId` is `PropertyValueNotInList`. ``` "Message": "The value '4294967296' for the property DeliveryRetryIntervalSeconds is not in the list of acceptable values.", "MessageId": "Base.1.19.0.PropertyValueNotInList", "MessageSeverity": "Warning", "Resolution": "Choose a value from the enumeration list that the implementation can support and resubmit the request if the operation failed." ```
After the change, its `MessageId` will be `PropertyValueOutOfRange`.
``` "Message": "The value '4294967296' for the property DeliveryRetryIntervalSeconds is not in the supported range of acceptable values.", "MessageId": "Base.1.19.0.PropertyValueOutOfRange", "MessageSeverity": "Warning", "Resolution": "Correct the value for the property in the request body and resubmit the request if the operation failed." ```
- Redfish Service Validator passes
Change-Id: I0d0c5ecbc9f416b68fa7c0e81a0ea896ec2e50af Signed-off-by: Myung Bae <myungbae@us.ibm.com>
show more ...
|
| 6fe8751c | 20-Jul-2023 |
George Liu <liuxiwei@inspur.com> |
Implement TemperatureReadingsCelsius property for ThermalMetrics
The ThermalMetrics schema[1] provides for efficient thermal metric gathering for thermal sensors. The schema allows retrieving just t
Implement TemperatureReadingsCelsius property for ThermalMetrics
The ThermalMetrics schema[1] provides for efficient thermal metric gathering for thermal sensors. The schema allows retrieving just the thermal metrics with one Redfish URI. This prevents the additional work required when returning all the sensor data, or multiple Redfish URI calls to retrieve the properties for all of the thermal sensors.
This commit implements the TemperatureReadingsCelsius property of ThermalMetrics[1]. ThermalMetrics is a property of ThermalSubsystem[2]. TemperatureReadingsCelsius is a SensorArrayExcerpt[3].
[1] https://redfish.dmtf.org/schemas/v1/ThermalMetrics.v1_0_1.json [2] https://redfish.dmtf.org/schemas/v1/ThermalSubsystem.v1_3_2.json [3] http://redfish.dmtf.org/schemas/v1/Sensor.v1_9_0.json#/definitions/SensorArrayExcerpt
The temperature sensors are found by finding 'all_sensors' endpoints for specific chassis of D-Bus service /xyz/openbmc_project/sensors/temperature. An entry of SensorArrayExcerpt is built for each temperature sensor retrieved.
Implementation Notes: - Common function sensor_utils::objectPropertiesToJson() is used to fill in sensor excerpt properties. Currently the only excerpt ChassisSubNode is ThermalMetrics. However there are others excerpts defined by Redfish. Right now mostly this is just skipping things, but I'm expecting when other sensor excerpts are implemented that some of the other properties may be added for excerpts as well. I'm expecting the combination of the chassisSubNode and the sensorType will be used to determine which properties are included for a particular call to build a sensor Json representation. - New sensor_utils::objectExcerptToJson() function created. This wraps sensor_utils::objectPropertiesToJson() and builds DataSourceUri for a sensor excerpt. - New sensor_utils::getAllSensorObjects() function created. This builds list of 'all_sensors' association endpoints for specified D-Bus path with specified D-Bus interfaces. Callback function is called with list for handling sensors.
Tested: 1. Redfish Service Validator passed. 2. doGet method: ``` curl -k -H "X-Auth-Token: ${token}" -X GET https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/ThermalMetrics { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/ThermalMetrics", "@odata.type": "#ThermalMetrics.v1_0_1.ThermalMetrics", "Id": "ThermalMetrics", "Name": "Thermal Metrics", "TemperatureReadingsCelsius": [ { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/temperature_ps0_temp0", "Reading": -131072000.0 }, { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/temperature_ps0_temp1", "Reading": -131072000.0 }, { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/temperature_ps0_temp2", "Reading": -131072000.0 }, { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/temperature_ps1_temp0", "Reading": -131072000.0 }, { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/temperature_ps1_temp1", "Reading": -131072000.0 }, { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/temperature_ps1_temp2", "Reading": -131072000.0 } ], "TemperatureReadingsCelsius@odata.count": 6 } ```
3. Verification of DataSourceUri: ``` curl -k -H "X-Auth-Token: ${token}" -X GET https://${bmc}/redfish/v1/Chassis/chassis/Sensors/temperature_ps1_temp0 { "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/temperature_ps1_temp0", "@odata.type": "#Sensor.v1_2_0.Sensor", "Id": "temperature_ps1_temp0", "Name": "ps1 temp0", "Reading": -131072000.0, "ReadingType": "Temperature", "ReadingUnits": "Cel", "Status": { "Health": "OK", "State": "Enabled" } } ```
4. A bad chassis ID: ``` curl -k -H "X-Auth-Token: ${token}" -X GET https://${bmc}/redfish/v1/Chassis/chassisBAD/ThermalSubsystem/ThermalMetrics { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type Chassis named 'chassisBAD' was not found.", "MessageArgs": [ "Chassis", "chassisBAD" ], "MessageId": "Base.1.18.1.ResourceNotFound", "MessageSeverity": "Critical", "Resolution": "Provide a valid resource identifier and resubmit the request." } ], "code": "Base.1.18.1.ResourceNotFound", "message": "The requested resource of type Chassis named 'chassisBAD' was not found." } } ```
Signed-off-by: George Liu <liuxiwei@ieisystem.com> Change-Id: I6e4ed1f281fd5371c978983b6cc5666badd3752c Signed-off-by: Janet Adkins <janeta@us.ibm.com>
show more ...
|
| 352e3b78 | 04-Oct-2024 |
Hieu Huynh <hieuh@os.amperecomputing.com> |
dateStringToEpoch: add the additional format
This adds the additional format for ISO 8601, such as YYYYMMDD or YYYYMMDDThhmmssZ.
Tested:
Test case 1: The input ISO 8601 timestamp: 20230531T000000Z
dateStringToEpoch: add the additional format
This adds the additional format for ISO 8601, such as YYYYMMDD or YYYYMMDDThhmmssZ.
Tested:
Test case 1: The input ISO 8601 timestamp: 20230531T000000Z The output Epoch timestamp: 1685491200000000
Test case 2: The input ISO 8601 timestamp: 20230531 The output Epoch timestamp: 1685491200000000
Signed-off-by: Hieu Huynh <hieuh@os.amperecomputing.com> Change-Id: I23080a466b2edeecb5d8a4fb7ec0b00739454056
show more ...
|