Add PowerLimitWatts in 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].
This commit extends the GET EnvironmentMetrics response to include
PowerLimitWatts property. PowerLimitWatts has been part of the
EnvironmentMetrics schema since v1_1_0. PowerLimitWatts is a
ControlSingleExcerpt[3].
Additionally this commit implements PATCH for the PowerLimitWatts
property of EnvironmentMetrics.
The PowerLimitWatts was added to Redfish release 2021.2 [4] to be used
instead of the deprecated Power schema.[5]
[1] https://redfish.dmtf.org/schemas/v1/EnvironmentMetrics.v1_5_0.json
[2] https://redfish.dmtf.org/schemas/v1/Chassis.v1_28_0.json
[3] https://redfish.dmtf.org/schemas/v1/Control.v1_7_0.json
[4] http://redfish.dmtf.org/schemas/Redfish_Release_History.pdf
[5] https://redfish.dmtf.org/schemas/v1/Power.v1_7_3.json
Tested:
(Used p10bmc hardware simulator with association added)
1. Redfish Service Validator passes
2.GET PowerLimitWatts in Chassis EnvironmentMetrics
```
curl -k -H "X-Auth-Token: ${token}" -X GET https://${bmc}/redfish/v1/Chassis/chassis/EnvironmentMetrics
{
"@odata.id": "/redfish/v1/Chassis/chassis/EnvironmentMetrics",
"@odata.type": "#EnvironmentMetrics.v1_3_0.EnvironmentMetrics",
...
"PowerLimitWatts": {
"AllowableMax": 4294967295,
"AllowableMin": 0,
"ControlMode": "Disabled",
"SetPoint": 0
}
}
```
3. GET error handling of invalid chassisId
```
curl -k -H "X-Auth-Token: ${token}" -X GET https://${bmc}/redfish/v1/Chassis/chassisERROR/EnvironmentMetrics
{
"error": {
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The requested resource of type Chassis named 'chassisERROR' was not found.",
"MessageArgs": [
"Chassis",
"chassisERROR"
],
"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 'chassisERROR' was not found."
}
}
```
4. PATCH to set SetPoint in PowerLimitWatts
1> When the value is in the allowable range, the modification succeeds.
```
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X PATCH -d'{ "PowerLimitWatts": {"SetPoint": 10}}' https://${bmc}/redfish/v1/Chassis/chassis/EnvironmentMetrics
curl -k -H "X-Auth-Token: ${token}" -X GET https://${bmc}/redfish/v1/Chassis/chassis/EnvironmentMetrics
{
"@odata.id": "/redfish/v1/Chassis/chassis/EnvironmentMetrics",
"@odata.type": "#EnvironmentMetrics.v1_3_0.EnvironmentMetrics",
...
"PowerLimitWatts": {
"AllowableMax": 4294967295,
"AllowableMin": 0,
"ControlMode": "Disabled",
"SetPoint": 10
}
}
```
2> When the value is outside of the allowable range, the modification
fails and an error is reported.
```
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X PATCH -d '{ "PowerLimitWatts": {"SetPoint": 4294967296}}' https://${bmc}/redfish/v1/Chassis/chassis/EnvironmentMetrics
{
"error": {
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The value '4294967296' for the property SetPoint is not in the supported range of acceptable values.",
"MessageArgs": [
"4294967296",
"SetPoint"
],
"MessageId": "Base.1.19.PropertyValueOutOfRange",
"MessageSeverity": "Warning",
"Resolution": "Correct the value for the property in the request body and resubmit the request if the operation failed."
}
],
"code": "Base.1.19.PropertyValueOutOfRange",
"message": "The value '4294967296' for the property SetPoint is not in the supported range of acceptable values."
}
}
```
5. PATCH to set ControlMode in PowerLimitWatts
1>When the ControlMode is changed to Automatic, the modification
is successful.
```
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X PATCH -d'{ "PowerLimitWatts": {"ControlMode": "Automatic"}}' https://${bmc}/redfish/v1/Chassis/chassis/EnvironmentMetrics
curl -k -H "X-Auth-Token: ${token}" -X GET https://${bmc}/redfish/v1/Chassis/chassis/EnvironmentMetrics
{
"@odata.id": "/redfish/v1/Chassis/chassis/EnvironmentMetrics",
"@odata.type": "#EnvironmentMetrics.v1_3_0.EnvironmentMetrics",
...
"PowerLimitWatts": {
"AllowableMax": 4294967295,
"AllowableMin": 0,
"ControlMode": "Automatic",
"SetPoint": 10
}
}
```
2>When the ControlMode is changed to Disabled, the modification
is successful.
```
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X PATCH -d'{ "PowerLimitWatts": {"ControlMode": "Disabled"}}' https://${bmc}/redfish/v1/Chassis/chassis/EnvironmentMetrics
curl -k -H "X-Auth-Token: ${token}" -X GET https://${bmc}/redfish/v1/Chassis/chassis/EnvironmentMetrics
{
"@odata.id": "/redfish/v1/Chassis/chassis/EnvironmentMetrics",
"@odata.type": "#EnvironmentMetrics.v1_3_0.EnvironmentMetrics",
...
"PowerLimitWatts": {
"AllowableMax": 4294967295,
"AllowableMin": 0,
"ControlMode": "Disabled",
"SetPoint": 10
}
}
```
3>When the ControlMode is changed to other values, the modification
fails and an error is reported.
```
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X PATCH -d '{ "PowerLimitWatts": {"ControlMode": "Error"}}' https://${bmc}/redfish/v1/Chassis/chassis/EnvironmentMetrics
{
"error": {
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The value '\"Error\"' for the property ControlMode is not in the list of acceptable values.",
"MessageArgs": [
"\"Error\"",
"ControlMode"
],
"MessageId": "Base.1.19.PropertyValueNotInList",
"MessageSeverity": "Warning",
"Resolution": "Choose a value from the enumeration list that the implementation can support and resubmit the request if the operation failed."
}
],
"code": "Base.1.19.PropertyValueNotInList",
"message": "The value '\"Error\"' for the property ControlMode is not in the list of acceptable values."
}
}
```
6. PATCH to set PowerLimitWatts when no associated object
```
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X PATCH -d '{ "PowerLimitWatts":{"SetPoint":0,"ControlMode":"Automatic"}}' https://${bmc}/redfish/v1/Chassis/chassis/EnvironmentMetrics
{
"error": {
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The property PowerLimitWatts is not in the list of valid properties for the resource.",
"MessageArgs": [
"PowerLimitWatts"
],
"MessageId": "Base.1.19.PropertyUnknown",
"MessageSeverity": "Warning",
"Resolution": "Remove the unknown property from the request body and resubmit the request if the operation failed."
}
],
"code": "Base.1.19.PropertyUnknown",
"message": "The property PowerLimitWatts is not in the list of valid properties for the resource."
}
}
```
Change-Id: Iacd244e537ccab6572a0a55b7f30871774e097ff
Signed-off-by: Albert Zhang <zhanghaodi@inspur.com>
Signed-off-by: Janet Adkins <janeta@us.ibm.com> A
Albert Zhang committed
ff90bece9911be4b7b81102eb701e9b4b7ec8674
Parent: 917fbad
Committed by Janet Adkins <janeta@us.ibm.com>
on 7/6/2026, 7:47:51 PM