| Age | Commit message (Collapse) | Author | Files | Lines |
|
- State `Available` will be mapped to `UnavailableOffline` for
Status.State for resources that are present but unavailable
- Added a utility function to reduce code duplication for retrieving
resource's Status.State (`getResourceState`) and Status.Health
(`getResourceHealth`)
Tested:
- Compiles and builds
- Unit tests pass
Change-Id: I1164a9412cbd4e1ab8938366ffc7ea9c7fe58786
Signed-off-by: Justin Nguyen <justinnanguyen@gmail.com>
|
|
Long lambdas have been documented as an anti-pattern for some time.[1]
Despite this being generally understood, bmcweb has a long ways to go
cleaning these up, and routinely code is submitted in violation of this
anti-pattern.
Invent an ast-grep rule that can identify when new examples of this
anti-pattern are added, and ignore the existing 200+ examples that are
in the codebase already using ast-grep ignore. These flags will give us
something to search for as we clean this up, and will help to prevent
new instances from being added unintentionally.
[1] https://github.com/openbmc/docs/blob/master/anti-patterns.md#very-long-lambda-callbacks
Tested: Comment only change. ast-grep passes. Manually removing an
ast-grep ignore flag shows as a failure in ast-grep scan
Change-Id: I77d634a393884969f184d2c39c02cc08288d5a29
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
Some of messages are not currently reported as errors, although they
are the results as Redfish request errors. Those include
- PropertyDuplicate
- ResourceAlreadyExists
- CreateFailedMissingReqProperties
- PropertyValueFormatError
- PropertyValueNotInList
- PropertyValueTypeError
- PropertyValueError
- PropertyNotWritable
- PropertyValueModified
- PropertyMissing
For example, PropertyValueFormatError is currently not treated as an
error. It shows like
```
curl -k -X PATCH "${bmc}/redfish/v1/AccountService/Accounts/admin" \
-H "Content-Type: application/json" \
-d '{ "Password": "" }'
"Password@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The value 'null' for the property Password is not a format that the property can accept.",
"MessageArgs": [
"null",
"Password"
],
"MessageId": "Base.1.19.PropertyValueFormatError",
"MessageSeverity": "Warning",
"Resolution": "Correct the value for the property in the request body and resubmit the request if the operation failed."
}
]
```
After making it as an error, it will be like
```
{
"error": {
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The value 'null' for the property Password is not a format that the property can accept.",
"MessageArgs": [
"null",
"Password"
],
"MessageId": "Base.1.19.PropertyValueFormatError",
"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.PropertyValueFormatError",
"message": "The value 'null' for the property Password is not a format that the property can accept."
}
}
```
Tested:
- Check those response messages
Change-Id: I746c55e42e8f0cde205a3800e3da17cd78cf7e34
Signed-off-by: Myung Bae <myungbae@us.ibm.com>
|
|
The comment from 'getEventLogParams()' says:
The redfish log format is "<Timestamp> <MessageId>,<MessageArgs>"
And in the OpenBMC main tree, the 'rsyslog.conf' from vendor defines:
# Template for Redfish messages
# "<timestamp> <MessageId>,<MessageArgs>"
template(name="RedfishTemplate" type="list") {
property(name="timereported" dateFormat="rfc3339")
constant(value=" ")
property(name="$!REDFISH_MESSAGE_ID")
constant(value=",")
property(name="$!REDFISH_MESSAGE_ARGS")
constant(value="\n")
}
# If the journal entry has a Redfish MessageId, save as a Redfish
# event
if ($!REDFISH_MESSAGE_ID != "") then {
action(type="omfile"
file="/var/log/redfish"
template="RedfishTemplate")
}
The commit aa2dfd26a514 ("Remove static variables") removed extraction
of timestamp data from the whole event log entry, 'dateStringToEpoch()'
will reject this kind of timestamp with trailing text.
Fixes: aa2dfd26a514 ("Remove static variables")
Change-Id: Id59af476e56a913a02a9f56a8c5f38c4ada7ccbf
Signed-off-by: Haiyue Wang <haiyuewa@163.com>
|
|
The aggregator forwards every method (GET, POST, PATCH, DELETE) to a
singular satellite resource, as described in the "Aggregating a
Resource" section of docs/AGGREGATION.md. createNewRequest() builds
the request that is forwarded, so it must preserve the original
method, target, and body -- otherwise Actions (e.g.
ComputerSystem.Reset) and PATCH updates would not reach the owning
satellite intact. It must also drop the client's X-Auth-Token while
keeping Host/Content-Type and setting Accept.
createNewRequest() had no unit-test coverage. Add tests that pin down
this contract:
- a non-GET (POST) request preserves method, target, and body
- a PATCH request preserves its body
- the client X-Auth-Token is filtered out while Host and
Content-Type are forwarded and Accept is set
No functional change.
Tested: clean build + full unit-test suite pass in the official
openbmc/ubuntu-unit-test container; the createNewRequest tests added
here pass (3/3).
Signed-off-by: Gary Beihl <garybeihl@microsoft.com>
Change-Id: If82cffe0f47523fc05af8e36892629e273ba865e
|
|
Add ChargeAh ReadingType and Ah units mapping for
charge sensors exposed under /sensors/charge/ D-Bus
path. This enables battery backup unit remaining and
full charge sensors to appear in Redfish. Unit test
added for charge sensor type.
Tested:
1. Sensor Query using curl -
```
{
"@odata.id": "/redfish/v1/Chassis/BBU_SHELF_1/Sensors/charge_BBU_SHELF_1_BBU5_REMAINING_CHARGE_AH",
"@odata.type": "#Sensor.v1_11_1.Sensor",
"Id": "charge_BBU_SHELF_1_BBU5_REMAINING_CHARGE_AH",
"Name": "BBU SHELF 1 BBU5 REMAINING CHARGE AH",
"Reading": 10477.0,
"ReadingType": "ChargeAh",
"ReadingUnits": "Ah",
"Status": {
"Health": "OK",
"State": "Enabled"
},
...
}
```
2. Redfish Validation passed using Redfish Validator.
Signed-off-by: Jagpal Singh Gill <paligill@gmail.com>
Change-Id: I9b7180cb8597378a1b42f9da73335ca96b20d55a
|
|
The location_util::getLocation is used to find the `LocationCode`
interface used for `ServiceLabel`. Also added logic to look for the
Inventory.Connector.X interfaces to populate `LocationType`.
The helper function is added to serve as the common location helper
and remove the same method call in each individual resource files.
For example, `Inventory.Connector.Embedded` means LocationType of
Embedded type.
Currently only support LocationType of
- Slot
- Embedded
Tested: No changes to redfish tree yet
Added unit tests
Change-Id: I7f2a8d6172e37dd72881fbfb5a9dfeaf83b2db09
Signed-off-by: Zhenwei Chen <zhenweichen0207@gmail.com>
Signed-off-by: Willy Tu <wltu@google.com>
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
These static variables have the potential to cause reentrancy issues.
In practice, the conditions to cause issues would require someone to
basically write incorrect code, but it makes sense to wrap this into a
state tracker anyway to clean up the code. While we're here, convert to
using std::chrono.
Note, this changes the behavior such that the values produced are now no
longer dependent on timezone. Functionally, Redfish only recently got
the ability to set a timezone, so this is not expected to have any user
facing impact, even though the unit tests need to change.
Tested: RSV Passes
Change-Id: Icb7cff1d289ae23790a5fb1db6604abd73dd68fd
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
time_t is less specific than using the equivalents in std::chono. In
practice, most of the time we end up converting the time_t to some
std::chrono class anyway. Avoid the intermediate conversion and just
use the std::chrono version of time.
Tested: Unit tests pass. Good Coverage
Change-Id: I2e3eca78760e158feaaf4b91793631343e417f15
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
This should be doing exact matching, not partial matching. This failed
to catch a bug in a later change.
Note, this unit test will currently only pass on the UTC timezone.
Later in the series the backend is fixed to produce consistent results
regardless of timezone
Tested: unit test
Change-Id: Ie5652c0f9503b4de926addcfc292c76b59682b12
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
BMC now exposes DateTime property under the Manager/<ID> in timezone
configured on the BMC (local TZ) and not in UTC, but the other date
time properties are still in UTC.
Convert date time fields to local timezone.
Tested:
1. Redfish service validator
2. Built Facebook's Catalina image with this change, ran in QEMU and
checked manually varioius endpoints.
3. Ran automated tests [1] from openbmc-test-automation repo.
4. Unit tests
[1] https://gerrit.openbmc.org/c/openbmc/openbmc-test-automation/+/88659
Change-Id: I8e587c7a1030deff8e6a550651c5e62719fe5299
Signed-off-by: Igor Kanyuka <ifelmail@gmail.com>
Signed-off-by: Ed Tanous <ed@tanous.net>
|
|
Not a lot we can do here, but at least we can check the regex matches.
Tested: Unit test passes
Change-Id: Ib6058042c725169e90b971bd15851f16d621ac0e
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
In certain debug scenarios, there were cases where we would hit
recursion depth limits. These do not appear in conventional scenarios,
but could pop up in debug builds while running fuzzing. To fix this,
implement two checks.
First, limit $filter expressions to 1000 characters or less. This is
largely arbitrary.
Second, implement a depth checker to ensure that stack depth doesn't
exceed 10 frames. 10 is intended to be an order of magnitude more than
anyone will ever use. Most examples use 1 or 2 parens.
Tested: Unit tests pass. New unit tests added for this case.
Change-Id: I2c95e2fc8c0a3b94ab2a7f882ac6e1805bb7ebd5
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
We should have a single entry point where we do json parsing. There are
configurations for nlohmmann that we had previously documented, but were
not well enforced. Move all uses to using the helper parse functions.
Tested: Unit tests pass.
Redfish service validator passes.
Change-Id: I2a8aed9327b6b15219dc9b4d6db146b69bcd8eb3
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
It would be better if the larger compile units didn't have to pull in
the sd-journal header. At the same time, there's C handling of a number
of resources that could be moved to an RAII class, and unit tests that
we can add. This commit does all those things.
Note, vacuum.journal is a file created with
```
journalctl --rotate && sleep 1 && journalctl --rotate
````
And contains a few log entries. Note, while this file is 8MB, the
majority are zeros, so git should compress it just fine.
Tested: Unit tests updated.
Redfish service validator passes
Change-Id: If578316bcd1d0162b7ecdcca27c1c7818ce2b6fa
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
docs/COMMON_ERRORS.md documents patterns that are easy to introduce
and hard to catch in review. This adds machine-enforceable ast-grep
rules for those patterns so they get caught in CI instead of review.
Rules cover unsafe integer parsing, throwing JSON APIs, throwing
filesystem APIs, wildcard lambda captures, blocking calls, missing
trailing slashes on routes, and route string concatenation.
Tested: ast-grep scan --error exits 0.
Change-Id: I7ae24b52ac5b120826d29bb3ac6fce8f30199c15
Signed-off-by: Davy Marrero <dmarrero@nvidia.com>
|
|
Current code always return Date time in UTC, despite local timezone may
differ. This change allows to set manager timezone via redfish and show
manager's TZ and offset in manager's local timezone. When the DateTime
is being patched, the provided date time gets converted from the
provided TZ to the local timezone, but configured TZ does not get
changed. A user must explicitly patch TimeZoneName to change Manager's
TZ.
Tested:
1. Built an image, ran in QEMU, changed TZ to PST8PDT (negative offset),
UTC (0 offset), and Tokyo (positive offset). Made sure the patch works
and all the touched fields have correct values. See [1].
2. Unit tests
3. Redfish validator
[1]
```
$ curl -s -k -H 'Content-type: application/json' -u root:0penBmc https://localhost:8443/redfish/v1/Managers/bmc | jq '.DateTime, .DateTimeLocalOffset, .TimeZoneName'
"2026-03-19T11:03:16-07:00"
"-07:00"
"PST8PDT"
$ curl -i -k -H 'Content-type: application/json' -u root:0penBmc -d '{"TimeZoneName": "UTC"}' -X PATCH https://localhost:8443/redfish/v1/Managers/bmc
HTTP/1.1 204 No Content
Allow: GET, PATCH
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
Date: Thu, 19 Mar 2026 18:03:28 GMT
Content-Length: 0
$ curl -s -k -H 'Content-type: application/json' -u root:0penBmc https://localhost:8443/redfish/v1/Managers/bmc | jq '.DateTime, .DateTimeLocalOffset, .TimeZoneName'
"2026-03-19T18:03:53+00:00"
"+00:00"
"UTC"
$ curl -i -k -H 'Content-type: application/json' -u root:0penBmc -d '{"TimeZoneName": "Asia/Tokyo"}' -X PATCH https://localhost:8443/redfish/v1/Managers/bmc
HTTP/1.1 204 No Content
Allow: GET, PATCH
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
Date: Thu, 19 Mar 2026 18:04:20 GMT
Content-Length: 0
$ curl -s -k -H 'Content-type: application/json' -u root:0penBmc https://localhost:8443/redfish/v1/Managers/bmc | jq '.DateTime, .DateTimeLocalOffset, .TimeZoneName'
"2026-03-20T03:04:32+09:00"
"+09:00"
"Asia/Tokyo"
$ curl -i -k -H 'Content-type: application/json' -u root:0penBmc -d '{"DateTime": "2026-01-02T11:03:16-07:00"}' -X PATCH https://localhost:8443/redfish/v1/Managers/bmc
HTTP/1.1 204 No Content
Allow: GET, PATCH
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
Date: Fri, 02 Jan 2026 18:03:16 GMT
Content-Length: 0
$ curl -s -k -H 'Content-type: application/json' -u root:0penBmc https://localhost:8443/redfish/v1/Managers/bmc | jq '.DateTime, .DateTimeLocalOffset, .TimeZoneName'
"2026-01-03T03:03:21+09:00"
"+09:00"
"Asia/Tokyo"
$ curl -s -k -H 'Content-type: application/json' -u root:0penBmc https://localhost:8443/redfish/v1/Managers/bmc/LogServices/Journal/Entries | jq '.Members[0]'
{
"@odata.id": "/redfish/v1/Managers/bmc/LogServices/Journal/Entries/cz0zNTMzMTVkMTBjYWQ0ZTg5ODJiYjliZGVmOTc2NDE2MDtpPTE7Yj00YzU5NzY1NzQ0M2M0N2IzOWZjYTZiNzU1ZWVlY2NjOTttPTFlZjc1Yzg7dD02MzY0OGQxOTFhZTE0O3g9ZDU5MjYwNzJkZTgzMWYzYw==",
"@odata.type": "#LogEntry.v1_9_0.LogEntry",
"Created": "2025-05-29T16:30:41.794580+00:00",
"EntryType": "Oem",
"Id": "cz0zNTMzMTVkMTBjYWQ0ZTg5ODJiYjliZGVmOTc2NDE2MDtpPTE7Yj00YzU5NzY1NzQ0M2M0N2IzOWZjYTZiNzU1ZWVlY2NjOTttPTFlZjc1Yzg7dD02MzY0OGQxOTFhZTE0O3g9ZDU5MjYwNzJkZTgzMWYzYw==",
"Message": "kernel: Booting Linux on physical CPU 0xf00",
"Name": "BMC Journal Entry",
"OemRecordFormat": "BMC Journal Entry",
"Severity": "OK"
}
```
Change-Id: I5a4567b9ca6a0f56dd9d1b971d418a19bf625a10
Signed-off-by: Igor Kanyuka <ifelmail@gmail.com>
|
|
Keep existing Members on local I/O failures in the generic
collection path, and ensure empty collections still return
mandatory Members and Members@odata.count properties.
Add a reusable JSON array helper and use it in both
collection building and aggregator merge logic to avoid
clearing the response on transient failures.
Fixes common error #13.[1]
[1] https://github.com/openbmc/bmcweb/blob/master/docs/COMMON_ERRORS.md#13-complete-replacement-of-the-response-object
Tested: unit test passed; validator passed on empty collection URIs.
Change-Id: I8e144f55b99e3f8017abcebb11c409fffebf38ad
Signed-off-by: Tony Ao <tao@nvidia.com>
|
|
The generic collection path could clear the "Members" array on a local
I/O error, which breaks aggregated responses and can trigger Common
Error #13 [1].
The aggregator merge logic also needed a small reusable helper to ensure
a JSON value is an array.
Add a generic JSON array "ensure" helper in utils/collection.hpp and use
it from both the local collection builder and the aggregator merge path.
This avoids resetting Members on transient failures and avoids relying
on transitive includes for the helper.
[1] https://github.com/openbmc/bmcweb/blob/master/docs/COMMON_ERRORS.md#13-complete-replacement-of-the-response-object
Tested: Unit tests passed.
Change-Id: Iddaa608916af661f75989b4aeae9b557d09eebe3
Signed-off-by: Tony Ao <tao@nvidia.com>
|
|
Adds SpeedPercent and SecondarySpeedPercent information according to the
Redfish Fan schema.[1] The schema only allows fans of ReadingType
Percent to be reported in SpeedPercent and SecondarySpeedPercent.
These new properties are accessed through the Redfish Uri for a
particular fan on a particular chassis[2]:
```
/redfish/v1/Chassis/<chassisId>/ThermalSubsystem/Fans/<fanId>
```
The primary and secondary fan sensors connected to the fan are found by:
1) Find all sensors associated to fan using the 'sensors' endpoint.[3]
2) For each sensor get its priority using the
'xyz.openbmc_project.Common.Priority' interface.[4][5]
3) Retrieve the sensor excerpt and place into the response based on the
priority of the sensor.
Implementation Notes:
- The utility function objectExcerptToJson() is used to populate the
SensorFanExcerpt.
- Guards are added to handle different cases of D-Bus sensors Priority
settings:
- Fan has only 1 sensor associated and the sensor has no priority.
Fills SpeedPercent for response.
- Fan has more than one sensor. Any sensor without priority will be
skipped.
- Fan has one or more sensors with priority. The priority setting
determines which property will be filled for the response. If the
priority is 0 it uses SpeedPercent. If the priority is 1 it uses
SecondarySpeedPercent. Any other priority the sensor will not be
included in the response.
- Fan has two sensors with the same priority. The first one is in the
response and the second one is skipped.
[1] https://redfish.dmtf.org/schemas/v1/Fan.v1_6_0.json
[2] https://www.dmtf.org/sites/default/files/standards/documents/DSP0268_2025.4.html#fan
[3] https://github.com/openbmc/docs/blob/master/architecture/sensor-architecture.md#association-type-2-linking-a-low-level-hardware-item-to-its-sensors
[4] https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/66779
[5] https://gerrit.openbmc.org/c/openbmc/phosphor-hwmon/+/67170
Tested (using p10bmc hardware simulator with fan configuration edits):
- Redfish Service Validator passes
- Tested various fan configurations with Percent fans:
```
/* Fan has two sensors both with priority set */
curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan0
{
"@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan0",
"@odata.type": "#Fan.v1_6_0.Fan",
...
"SecondarySpeedPercent": {
"DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan0_1",
"Reading": 60,
"SpeedRPM": 12036.0
},
...
"SpeedPercent": {
"DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan0_0",
"Reading": 100,
"SpeedRPM": 18000.0
},
...
}
/* Fan has two sensors neither with priority, both skipped */
curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan1
{
"@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan1",
"@odata.type": "#Fan.v1_6_0.Fan",
...
"PartNumber": "XXXXXXX",
"SerialNumber": "XXXXXXXXXXXX",
"SparePartNumber": "XXXXXXX",
"Status": {
"Health": "OK",
"State": "Enabled"
}
}
/* Fan has one sensor without priority, shown as primary */
curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan2
{
"@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan2",
"@odata.type": "#Fan.v1_6_0.Fan",
...
"SpeedPercent": {
"DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan2_0",
"Reading": 50,
"SpeedRPM": 18000.0
},
...
}
/* Fan has two sensors. Both have priority 0. The first sensor is in the
* response the second sensor is skipped.
*/
curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan3
{
"@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan3",
"@odata.type": "#Fan.v1_6_0.Fan",
"Id": "fan3",
"Location": {
"PartLocation": {
"ServiceLabel": "U78DA.ND0.1234567-A3"
}
},
"LocationIndicatorActive": false,
"Manufacturer": "Delta",
"Model": "7B5G",
"Name": "Fan",
"PartNumber": "02YK200",
"SerialNumber": "YS10JP12V0TY",
"SparePartNumber": "02YK237",
"SpeedPercent": {
"DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan3_0",
"Reading": null,
"SpeedRPM": 18000.0
},
"Status": {
"Health": "OK",
"State": "Enabled"
}
}
/* Fan has two sensors. One priority 0, other priority 2. Only the
* primary is in the response.
*/
curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan4
{
"@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan4",
"@odata.type": "#Fan.v1_6_0.Fan",
...
"PartNumber": "XXXXXXX",
"SerialNumber": "XXXXXXXXXXXX",
"SparePartNumber": "XXXXXXX",
"SpeedPercent": {
"DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan4_0",
"Reading": null,
"SpeedRPM": 18000.0
},
...
}
/* Fan has two sensors. One priority 1, other priority 2. Only the
* secondary is in the response.
*/
curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan5
{
"@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan5",
"@odata.type": "#Fan.v1_6_0.Fan",
...
"SecondarySpeedPercent": {
"DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan5_1",
"Reading": null,
"SpeedRPM": 12036.0
},
"SerialNumber": "XXXXXXXXXXXX",
"SparePartNumber": "XXXXXXX",
"Status": {
"Health": "OK",
"State": "Enabled"
}
}
```
- Tested with rotational fans the new fields are not in response:
```
curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan0
{
"@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan0",
"@odata.type": "#Fan.v1_6_0.Fan",
...
"PartNumber": "XXXXXXX",
"SerialNumber": "XXXXXXXXXXXX",
"SparePartNumber": "XXXXXXX",
"Status": {
"Health": "OK",
"State": "Enabled"
}
}
curl -k -H "X-Auth-Token: $token" 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",
...
"ReadingType": "Rotational",
...
}
```
Signed-off-by: George Liu <liuxiwei@inspur.com>
Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
Signed-off-by: Janet Adkins <janeta@us.ibm.com>
Change-Id: Ic767de3bde8bfe14b31da23b67e17a8d04eefadb
|
|
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>
|
|
nlohmann::json::begin() throws an uncaught exception.
Tested: Redfish service validator passes.
Signed-off-by: Ed Tanous <ed@tanous.net>
Change-Id: I08244b0787cd4d6e592b0731196490a5160aba62
|
|
An earlier commit [1] refactored parts of objectPropertiesToJson() into
sub-functions to make the code easier to follow. The review of that
change requested unit tests for these new functions. [2] This commit
adds them.
[1] https://gerrit.openbmc.org/c/openbmc/bmcweb/+/85835
[2] https://gerrit.openbmc.org/c/openbmc/bmcweb/+/85835/comments/408617a1_474b4062
Tested: Compiles and unit tests pass
Change-Id: I65e06deccb4b7194603f2749a977986bcb673cd1
Signed-off-by: Janet Adkins <janeta@us.ibm.com>
|
|
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>
|
|
Initially, systems_utils.hpp has not defined its own namespace, all
functions were under the redfish namespace. Patch 82078 [1] introduced
systems_utils namespace to the header for new functionality.
This patch adds all functions, that haven't been part of the new
namespace to systems_utils namespace and updates all call sites
accordingly.
[1] https://gerrit.openbmc.org/c/openbmc/bmcweb/+/82078
Tested: Code compiles.
Change-Id: Ia6ac3edd36aacc22cbf1a6adae4e2b264932b43c
Signed-off-by: Oliver Brewka <oliver.brewka@9elements.com>
|
|
Applications are logging Redfish Message ID to journal, but the version
of some message ID are different with the definition of bmcweb. E.g:
- psusensor is defining version of OpenBMC registry is "0.1" as [1].
- The bmcweb defines the version of OpenBMC registry is "0.5" as [2].
It makes the "MessageId" property of Event log's enties has different
version with definition in the /redfish/v1/Registries.
This commit corrects the version of Message ID.
[1]: https://github.com/openbmc/dbus-sensors/blob/6b7123225fc4a5180faf89190e9f64a7e248e697/src/psu/PSUEvent.cpp#L121
[2]: https://github.com/openbmc/bmcweb/blob/master/redfish-core/include/registries/openbmc.json#L1678
Tested:
Verify the version of Events are the same the version of Registries
that are defined in the bmcweb.
Change-Id: Ib862c8d0a62cae63082436cb4646a9ca45207872
Signed-off-by: Thang Tran <thuutran@amperecomputing.com>
|
|
Deprecate intoToHex handler now that we can do everything using
std::format.
Tested: RSV passes
Redfish protocol validator passes
Change-Id: I71000506573314d6c9326c4677f5fbca1ca02b46
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
Include cleaner helps the code review process. Add it back, by ignoring
some of the more recent boost headers.
Change-Id: I6eddd0e67cd9f469c93fbb344cc1ab46231e450f
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
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
|
|
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>
|
|
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>
|
|
Add support for multi-host GET request-handling under the
/redfish/v1/Systems/{computerSystemId}/ redfish resource.
All multi-host supported redfish URIs can be found in this listing [1].
Multi-host meson options needed:
-Dexperimental-redfish-multi-computer-system=enabled
Tested: Validator passes on single-host machine and yv4 qemu emulation.
[1] https://gerrit.openbmc.org/c/openbmc/bmcweb/+/76118
Change-Id: I67c17c3dd7a354fa9a2ebbc56d4def7a7e788909
Signed-off-by: Oliver Brewka <oliver.brewka@9elements.com>
|
|
Since 2020, nlohmann has recognized that implicit conversions to and
from json are an issue. Many bugs have been caused at both development
time and runtime due to unexpected implicit conversions from json to
std::string/int/bool. This commit disables implicit conversions using
JSON_USE_IMPLICIT_CONVERSIONS [1]. This option will become the default
in the future. That comment was written 3 years ago at this point, so
we should prepare.
Tested:
Redfish service validator passes.
[1] https://json.nlohmann.me/api/macros/json_use_implicit_conversions/
Change-Id: Id6cc47b9bbf8889e4777fd6d77ec992f3139962c
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
Rather than having to manually hook code for registries, add a small
registration function to the registry header and use this registration
results throughout the registry interactions.
Tested:
Confirmed registries have same behavior.
```
$ curl -s -k https://localhost:18080/redfish/v1/Registries/ | jq '.Members | map(."@odata.id")'
[
"/redfish/v1/Registries/Base",
"/redfish/v1/Registries/HeartbeatEvent",
"/redfish/v1/Registries/OpenBMC",
"/redfish/v1/Registries/ResourceEvent",
"/redfish/v1/Registries/TaskEvent",
"/redfish/v1/Registries/Telemetry"
]
```
```
$ curl -s -k https://localhost:18080/redfish/v1/Registries/TaskEvent/TaskEvent | jq ".Messages | keys"
[
"TaskAborted",
"TaskCancelled",
"TaskCompletedOK",
"TaskCompletedWarning",
"TaskPaused",
"TaskProgressChanged",
"TaskRemoved",
"TaskResumed",
"TaskStarted"
]
```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Iaa355420736a2587d9da4e995208d579443ca9b8
|
|
Extension of OEM route infra to support registration of handlers for OEM
patch requests. When patch request is made on a redfish resource, first
the main route handler will be called and if request patch payload
contains any OEM fragments then, registered OEM patch handler will be
called.
Tested
1. UT passes with new test cases added for OEM patch handling
2. Patch on FAN OEM property works as expected
```
Step 1: Creating new fan controller...
Create PATCH data:
{
"Oem": {
"OpenBmc": {
"Fan": {
"FanControllers": {
"Fan_TEST_391715": {
"FFGainCoefficient": 2.0,
"Zones": [
{
"@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones/Zone_1"
}
]
}
}
}
}
}
}
HTTP Response Code (PATCH /redfish/v1/Managers/bmc): 200
HTTP Response Code (GET /redfish/v1/Managers/bmc): 200
✓ Fan controller created successfully
Step 2: Updating the fan controller...
Update PATCH data:
{
"Oem": {
"OpenBmc": {
"Fan": {
"FanControllers": {
"Fan_TEST_391715": {
"FFGainCoefficient": 3.0
}
}
}
}
}
}
HTTP Response Code (PATCH /redfish/v1/Managers/bmc): 200
HTTP Response Code (GET /redfish/v1/Managers/bmc): 200
Final Configuration:
{
"@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanControllers/Fan_TEST_391715",
"@odata.type": "#OpenBMCManager.v1_0_0.Manager.FanController",
"FFGainCoefficient": 3.0,
"Zones": [
{
"@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones/Zone_1"
}
]
}
✓ Fan controller updated successfully
```
Test Summary
```
[+] Tests DateTime update after NTP disable. Payload: {DateTime: <date-string>}. Expects: 204 success, validates date matches update.: PASSED
[-] Tests invalid property in request. Payload: {InvalidProperty: 'value', DateTime: <date-string>}. Expects: 400 PropertyUnknown error, validates DateTime unchanged.: PASSED
[-] Tests fan controller with invalid property. Payload: Oem/OpenBmc/Fan/FanControllers with InvalidProperty. Expects: 400 PropertyUnknown error, fan not created.: PASSED
[-] Tests empty PATCH request. Payload: {}. Expects: 400 MalformedJSON error.: PASSED
[-] Tests malformed fan controller JSON. Payload: Fan property as string instead of object. Expects: 400 PropertyValueTypeError error.: PASSED
[-] Tests DateTime with wrong type. Payload: {DateTime: 12345}. Expects: 400 PropertyValueTypeError error, DateTime unchanged.: PASSED
[-] Tests PATCH to invalid manager path. Payload: Valid DateTime and fan update to /invalid_bmc. Expects: 404 ResourceNotFound error.: PASSED
[+] Tests fan controller creation. Payload: Oem/OpenBmc/Fan/FanControllers with FFGainCoefficient and Zones. Expects: 200 success with success message.: PASSED
[-] Tests fan controller without required Zones. Payload: Oem/OpenBmc/Fan/FanControllers with only FFGainCoefficient. Expects: 500 InternalError, fan not created.: PASSED
[+] Tests combined DateTime and fan update. Payload: DateTime and Oem/OpenBmc/Fan/FanControllers. Expects: 200 success with success message.: PASSED
[-] Tests PATCH with wrong Content-Type header. Payload: Valid DateTime update with text/plain content-type. Expects: 400 UnrecognizedRequestBody error.: PASSED
[+] Tests fan controller creation and update. Payload: Create with FFGainCoefficient=2.0, then update to 3.0. Expects: 200 success for both operations, verifies all properties.: PASSED
```
Change-Id: Ib2498b6a4db0343d5d4a405a5a8e4d78f615bed8
Signed-off-by: Rohit PAI <rohitpai77@gmail.com>
|
|
Initial copy was done to avoid request object going out of scope before
OEM handler are invoked.
The MR avoids the whole copy of the request object and create a sub
route object which contains elements required for OEM route handling.
Tested
- Service Validator Passes
- OpenBMC OEM properties and rendered well.
Change-Id: I3ef80a130afe6ab764a13704a8b672f5b0635126
Signed-off-by: Rohit PAI <ropai@nvidia.com>
|
|
Goal of the MR is to provide infrastructure support in bmcweb to manage
the OEM fragment handling separately. OEM schema are vendor defined and
per DMTF resource we could have multiple vendor defined OEM schema to be
enabled.
The feature allows registration of route handler per schema per OEM
namespace.
Example
```
REDFISH_SUB_ROUTE<"/redfish/v1/Managers/<str>/#/Oem/OpenBmc">(service,
HttpVerb::Get)(oemOpenBmcCallback);
REDFISH_SUB_ROUTE<"/redfish/v1/Managers/<str>/#/Oem/Nvidia">(service,
HttpVerb::Get)(oemNidiaCallback);
```
We can have separate vendor defined route handlers per resource. Each of
these route handlers can populate their own vendor specific OEM data.
The OEM code can be better organized and enabled/disabled as per the
platform needs. The current MR has the code changes related to handling
GET requests alone. The feature only supports requests
where the response payload is JSON.
Tests
- All UT cases passes
- New UT added for RF OEM router passes
- Service Validator passes on qemu
- GET Response on Manager/bmc resource contains the OEM fragment
```
curl -c cjar -b cjar -k -X GET https://127.0.0.1:2443/redfish/v1/Managers/bmc
{
"@odata.id": "/redfish/v1/Managers/bmc",
"@odata.type": "#Manager.v1_14_0.Manager",
"Oem": {
"OpenBmc": {
"@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc",
"@odata.type": "#OpenBMCManager.v1_0_0.Manager",
"Certificates": {
"@odata.id": "/redfish/v1/Managers/bmc/Truststore/Certificates"
}
}
},
"UUID": "40575e98-90d7-4c10-9eb5-8d8a7156c9b9"
}
```
Change-Id: Ic82aa5fe760eda31e2792fbdfb6884ac3ea613dc
Signed-off-by: Rohit PAI <rohitpai77@gmail.com>
|
|
Redfish specification states:
```
The value of the id field shall be the same as the Id property in the
event payload. The value of the Id property in the event payload should
be the same as the EventId property of the last event record in the
Events array. The value of the EventId property for an event record
should be a positive integer value and should be generated in a
sequential manner.
```
The event service code did not implement that correctly. So:
1. Add ID fields for all events.
2. Remove the per-sse connection id field and rely solely on
EventServiceManager.
3. Make sure all paths, (including metric report) are generating an
event id that's based on the eventservice event id
Tested: Redfish event listener now sees events populated.
LastEventId when sent to the SSE socket now sees a contiguous id.
```
uri=$(curl -s --user "root:0penBmc" -k "https://192.168.7.2/redfish/v1/EventService" | jq -r .ServerSentEventUri)
curl -u root:0penBmc -vvv -k -N -H "Accept: text/event-stream" -H "Last-Event-Id: 0" "https://192.168.7.2$uri"
```
Change-Id: Ic32e036f40a53a9b2715639ae384d7891c768260
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
When array/vector object is expected in JSON patch the error info does
not contain the actual wrong property instead shows "null". Fix is to
correct the value in the error info.
Tested
- add new test case to verify this
- unit tests are passing.
Change-Id: Ica26ac9e501b5a34a5b118769cc1917eeab30524
Signed-off-by: rohitpai <rohitpai77@gmail.com>
|
|
Error code utils can be used for aggregating error
responses from multiples responses including use case
for managing separate route handlers for OEM namespace
Tests
Units tests are passing.
Change-Id: I2223d41fb318c0276de1ca64dd3e841bb988d902
Signed-off-by: rohitpai <rohitpai77@gmail.com>
|
|
The way we pass around io contexts is somewhat odd. Boost maintainers
in slack recommended that we just have a method that returns an io
context, and from there we can control this (context link lost years
ago).
The new version of clang claims the singleton pattern of passing in an
io_context pattern is a potential nullptr dereference. It's technically
correct, as calling the singleton without immediately initializing the
io context will lead to a crash.
This commit implements what the boost maintainers suggested, having a
single method that returns "the context" that should be used. This also
helps to maintain isolation, as some pieces are no longer tied directly
to dbus to get their reactor.
Tested: WIP
Change-Id: Ifaa11335ae00a3d092ecfdfb26a38380227e8576
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
Implemented the code to identify the '/' character in the
key and perform the level by level search
Testing :
Tested query parameter with path separated by / example
curl -k -u root:0penBmc https://<IP>/redfish/v1/Systems/
Baseboard/LogServices/FaultLog/Entries?$filter=CPER/Oem/
OEM/IpSignature eq 'DRAM-CHANNELS'
Results having 'DRAM-CHANNELS' in nested path "CPER/Oem/
OEM/IpSignature" are listed.
Change-Id: Ie6cf796026a29ec7a3e8a0366bbfd0c658d0ac7e
Signed-off-by: Chandramohan Harkude <chandramohan.harkude@gmail.com>
|
|
This code should really be in a cpp/hpp file, not in a generated python
script. The python script housed this temporarily to allow us to
generate the registries. It's time to roll it out.
Tested: Message registries generate successfully on GET. Redfish
service validator passes.
Change-Id: I7aca2d0a7fac6d530511421b667ff732617df61e
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
SPDX identifiers are simpler, and reduce the amount of cruft we have in
code files. They are recommended by linux foundation, and therefore we
should do as they allow.
This patchset does not intend to modify any intent on any existing
copyrights or licenses, only to standardize their inclusion.
[1] https://www.linuxfoundation.org/blog/blog/copyright-notices-in-open-source-software-projects
Change-Id: I935c7c0156caa78fc368c929cebd0f068031e830
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
Currently that code is still unfinished,
but we can already define some trivial testcases.
The main result of this function is populating EventLogObjectsType.
Tested: Unit tests pass.
Change-Id: I2e23147190be33192d41176413c16cd98c7bfd81
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
|
|
Changes Added : Updated the submit test event feature to send test
data as per spec
https://www.dmtf.org/sites/default/files/standards/documents/
DSP2046_2019.1.pdf
Testing :
Tested sending custom test data
and same data received at the event listener
Change-Id: I2c2363a676aafd39c121c9fe4e16402c0f5961e2
Signed-off-by: Chandramohan Harkude <chandramohan.harkude@gmail.com>
|
|
We use these pragmas, that we must've been getting transitively through
chrono in the past. Now we need to include them explicitly.
Change-Id: Iee4c0a8866981b91adaa17bee0678b2c10e65ea9
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
Redfish specification, section 9.5.11.2 says:
The MessageId property value shall be in the format:
<MessageRegistryPrefix>.<MajorVersion>.<MinorVersion>.<MessageKey>
bmcweb in certain places has incorrectly used the 3 digit version
instead of the 2 digit version. This commit fixes that by modifying the
parse_registries script to generate 3 separate struct entries to
represent the registry version, and parse them where appropriate.
MessageRegistryFileCollection uses the 3 digit version. No behavior
changes.
Message/event log entries use the 2 digit version. This will cause a
MessageId change from:
Base.1.19.0.InternalError
to
Base.1.19.InternalError
This is a breaking change, so a new option to allow the old behavior is
provided.
Tested: Redfish Service validator passes.
Heartbeat events on EventService show 2 digit versions.
Change-Id: I4165e994f73e200f13bed8ea76cb58bee2b69faa
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
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>
|
|
Provide basic unit test coverage for the functions from event_log.cpp.
Tested: Unit tests pass.
Change-Id: Ib555d2404e0f5cc5d5610d466100d0f07c79f5d9
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
|