History log of /openbmc/bmcweb/redfish-core/lib/redfish_v1.hpp (Results 1 – 25 of 32)
Revision Date Author Comments
# 504af5a0 03-Feb-2025 Patrick Williams <patrick@stwcx.xyz>

clang-format: update latest spec and reformat

Copy the latest format file from the docs repository and apply.

Change-Id: I2f0b9d0fb6e01ed36a2f34c750ba52de3b6d15d1
Signed-off-by: Patrick Williams <p

clang-format: update latest spec and reformat

Copy the latest format file from the docs repository and apply.

Change-Id: I2f0b9d0fb6e01ed36a2f34c750ba52de3b6d15d1
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>

show more ...


# d7857201 28-Jan-2025 Ed Tanous <etanous@nvidia.com>

Fix includes

Clang-tidy misc-include-cleaner appears to now be enforcing
significantly more headers than previously. That is overall a good
thing, but forces us to fix some issues. This commit is

Fix includes

Clang-tidy misc-include-cleaner appears to now be enforcing
significantly more headers than previously. That is overall a good
thing, but forces us to fix some issues. This commit is largely just
taking the clang-recommended fixes and checking them in. Subsequent
patches will fix the more unique issues.

Note, that a number of new ignores are added into the .clang-tidy file.
These can be cleaned up over time as they're understood. The majority
are places where boost includes a impl/x.hpp and x.hpp, but expects you
to use the later. include-cleaner opts for the impl, but it isn't clear
why.

Change-Id: Id3fdd7ee6df6c33b2fd35626898523048dd51bfb
Signed-off-by: Ed Tanous <etanous@nvidia.com>
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>

show more ...


# 40e9b92e 10-Sep-2024 Ed Tanous <etanous@nvidia.com>

Use SPDX identifiers

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 pa

Use SPDX identifiers

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>

show more ...


# d51c61b4 13-Sep-2024 Myung Bae <myungbae@us.ibm.com>

Fix status for non-existent JsonSchema FileGet

This will fix the incorrect status 500 to status 404 for the
non-eixstent JsonSchema FileGet.

```
% redfishtool raw GET -r ${bmc} -u root -p 0penBmc

Fix status for non-existent JsonSchema FileGet

This will fix the incorrect status 500 to status 404 for the
non-eixstent JsonSchema FileGet.

```
% redfishtool raw GET -r ${bmc} -u root -p 0penBmc -S Always /redfish/v1/JsonSchemas/ComputerSystem/ComputerSystem.v1_99_1.json
redfishtool: Transport: Response Error: status_code: 500 -- Internal Server Error
redfishtool: raw: Error getting response
```

This commit also refactor `Response::openFile()` to return `ec` so that
the caller can check the reason of the failure.

Tested:
- Verify redfishtool result for the non-existent JsonSchema file like
```
% redfishtool raw GET -r ${bmc} -u root -p 0penBmc -S Always /redfish/v1/JsonSchemas/<schema>/<non-existent-schema>.json
redfishtool: Transport: Response Error: status_code: 404 -- Not Found
redfishtool: raw: Error getting response
```
- Redfish Service validator passes

Change-Id: I98927c076bb6e7dfb3742183b4b3545e328d2657
Signed-off-by: Myung Bae <myungbae@us.ibm.com>

show more ...


# fe37ddaf 12-Sep-2024 Myung Bae <myungbae@us.ibm.com>

Fix 404 status from JsonSchemas FileGet

This will fix the 404 error from JsonSchema FileGet

```
redfishtool raw GET -r ${bmc} -u root -p 0penBmc -S Always /redfish/v1/JsonSchemas/ComputerSystem/C

Fix 404 status from JsonSchemas FileGet

This will fix the 404 error from JsonSchema FileGet

```
redfishtool raw GET -r ${bmc} -u root -p 0penBmc -S Always /redfish/v1/JsonSchemas/ComputerSystem/ComputerSystem.v1_22_2.json
redfishtool: Transport: Response Error: status_code: 404 -- Not Found
redfishtool: raw: Error getting response
```

Tested:
- Get `/redfish/v1/JsonSchemas/<schema>/<schema>` and use its
`Location/Uri` for the next redfishtool
- Verify redfishtool result like
```
redfishtool raw GET -r ${bmc} -u root -p 0penBmc -S Always /redfish/v1/JsonSchemas/<schema>/<schema>.<version>.json
```
- Redfish Service validator passes

Change-Id: I0ca443177537d0a73a31a7195deb3cfb028c49b5
Signed-off-by: Myung Bae <myungbae@us.ibm.com>

show more ...


# bd79bce8 16-Aug-2024 Patrick Williams <patrick@stwcx.xyz>

clang-format: re-format for clang-18

clang-format-18 isn't compatible with the clang-format-17 output, so we
need to reformat the code with the latest version. The way clang-18
handles lambda forma

clang-format: re-format for clang-18

clang-format-18 isn't compatible with the clang-format-17 output, so we
need to reformat the code with the latest version. The way clang-18
handles lambda formatting also changed, so we have made changes to the
organization default style format to better handle lambda formatting.

See I5e08687e696dd240402a2780158664b7113def0e for updated style.
See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement.

Change-Id: Iceec1dc95b6c908ec6c21fb40093de9dd18bf11a
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>

show more ...


# a529a6aa 29-May-2024 Ed Tanous <ed@tanous.net>

Make schemas selectable

Which schemas are installed should be selectable in both a meson config,
and trivially by forks. This commit gets us closer to that idea.

It does it in several ways, first,

Make schemas selectable

Which schemas are installed should be selectable in both a meson config,
and trivially by forks. This commit gets us closer to that idea.

It does it in several ways, first, the code for generating
JsonSchemaFile resources has been changed to be generated at runtime,
based on files on disk. This is slightly slower, but allows installing
schemas from anywhere, and matches the CSDL handling.

Next, the schema folders are separated into two sets
csdl -> This includes the complete schema pack from dmtf
installed -> this includes only the schemas the bmc includes

Similar folders exist for json-schema and json-schema-installed.

This allows any additional schemas to be a single symlink addition.
Note, this also checks in all of the dmtf json schemas, not just the
versions we use. This allows us to update the schema pack without
needing to break our versions we ship.

Because the static files are now selectable, all files need to be in a
folder. This forces the css and image for the redfish built-in gui to
be moved.

Tested:
/redfish/v1/JsonSchemas returns the correct result
/redfish/v1/JsonSchemas/UpdateService returns a JsonSchemaFile instance
/redfish/v1/JsonSchemas/UpdateService/UpdateService<version>json returns
the JsonSchemaFile contents.

Redfish service validator passes.

Change-Id: Ie96b2e4b623788dc2ec94eb40fcfd80325f0d826
Signed-off-by: Ed Tanous <ed@tanous.net>

show more ...


# 3544d2a7 06-Aug-2023 Ed Tanous <edtanous@google.com>

Use ranges

C++20 brought us std::ranges for a lot of algorithms. Most of these
conversions were done using comby, similar to:

```
comby -verbose 'std::lower_bound(:[a].begin(),:[b].end(),:[c])' 's

Use ranges

C++20 brought us std::ranges for a lot of algorithms. Most of these
conversions were done using comby, similar to:

```
comby -verbose 'std::lower_bound(:[a].begin(),:[b].end(),:[c])' 'std::ranges::lower_bound(:[a], :[c])' $(git ls-files | grep "\.[hc]\(pp\)\?$") -in-place
```

Change-Id: I0c99c04e9368312555c08147d474ca93a5959e8d
Signed-off-by: Ed Tanous <edtanous@google.com>

show more ...


# 62598e31 17-Jul-2023 Ed Tanous <ed@tanous.net>

Replace logging with std::format

std::format is a much more modern logging solution, and gives us a lot
more flexibility, and better compile times when doing logging.

Unfortunately, given its level

Replace logging with std::format

std::format is a much more modern logging solution, and gives us a lot
more flexibility, and better compile times when doing logging.

Unfortunately, given its level of compile time checks, it needs to be a
method, instead of the stream style logging we had before. This
requires a pretty substantial change. Fortunately, this change can be
largely automated, via the script included in this commit under
scripts/replace_logs.py. This is to aid people in moving their
patchsets over to the new form in the short period where old patches
will be based on the old logging. The intention is that this script
eventually goes away.

The old style logging (stream based) looked like.

BMCWEB_LOG_DEBUG << "Foo " << foo;

The new equivalent of the above would be:
BMCWEB_LOG_DEBUG("Foo {}", foo);

In the course of doing this, this also cleans up several ignored linter
errors, including macro usage, and array to pointer deconstruction.

Note, This patchset does remove the timestamp from the log message. In
practice, this was duplicated between journald and bmcweb, and there's
no need for both to exist.

One design decision of note is the addition of logPtr. Because the
compiler can't disambiguate between const char* and const MyThing*, it's
necessary to add an explicit cast to void*. This is identical to how
fmt handled it.

Tested: compiled with logging meson_option enabled, and launched bmcweb

Saw the usual logging, similar to what was present before:
```
[Error include/webassets.hpp:60] Unable to find or open /usr/share/www/ static file hosting disabled
[Debug include/persistent_data.hpp:133] Restored Session Timeout: 1800
[Debug redfish-core/include/event_service_manager.hpp:671] Old eventService config not exist
[Info src/webserver_main.cpp:59] Starting webserver on port 18080
[Error redfish-core/include/event_service_manager.hpp:1301] inotify_add_watch failed for redfish log file.
[Info src/webserver_main.cpp:137] Start Hostname Monitor Service...
```
Signed-off-by: Ed Tanous <ed@tanous.net>

Change-Id: I86a46aa2454be7fe80df608cb7e5573ca4029ec8

show more ...


# ef4c65b7 24-Apr-2023 Ed Tanous <edtanous@google.com>

Boost::urls::format

Boost 1.82 dropped a lovely new toy, boost::urls::format, which is a lot
like our urlFromPieces method, but better in that it makes the resulting
uris more readable, and allows d

Boost::urls::format

Boost 1.82 dropped a lovely new toy, boost::urls::format, which is a lot
like our urlFromPieces method, but better in that it makes the resulting
uris more readable, and allows doing things like fragments in a single
line instead of multiple. We should prefer it in some cases.

Tested:
Redfish service validator passes.
Spot checks of URLs work as expected.
Unit tests pass.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ia7b38f0a95771c862507e7d5b4aa68aa1c98403c

show more ...


# ad539545 12-May-2023 Patrick Williams <patrick@stwcx.xyz>

use emplace where appropriate per clang-tidy

The clang-tidy warning 'modernize-use-emplace' correctly flags a
few places where emplace should be used over push.

Signed-off-by: Patrick Williams <pat

use emplace where appropriate per clang-tidy

The clang-tidy warning 'modernize-use-emplace' correctly flags a
few places where emplace should be used over push.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I6ca79285a87d6927e718345dc8dce0387e6b1eda

show more ...


# 89492a15 10-May-2023 Patrick Williams <patrick@stwcx.xyz>

clang-format: copy latest and re-format

clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest

clang-format: copy latest and re-format

clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.

Change-Id: I75f89d2959b0f1338c20d72ad669fbdc1d720835
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>

show more ...


# 39662a3b 06-Feb-2023 Ed Tanous <edtanous@google.com>

Make url by value in Request

There's some tough-to-track-down safety problems in http Request. This
commit is an attempt to make things more safe, even if it isn't clear
how the old code was wrong.

Make url by value in Request

There's some tough-to-track-down safety problems in http Request. This
commit is an attempt to make things more safe, even if it isn't clear
how the old code was wrong.

Previously, the old code took a url_view from the target() string for a
given URI. This was effectively a pointer, and needed to be updated in
custom move/copy constructors that were error prone to write.

This commit moves to taking the URI by non-view, which involves a copy,
but allows us to use the default move and copy constructors, as well as
have no internal references within Request, which should improve the
safety and reviewability.

There's already so many string copies in bmcweb, that this is unlikely
to show up as any sort of performance regression, and simple code is
much better in this case.

Note, because of a bug in boost::url, we have to explicitly construct a
url_view in any case where we want to use segments() or query() on a
const Request. This has been reported to the boost maintainers, and is
being worked for a long term solution.

https://github.com/boostorg/url/pull/704

Tested: Redfish service validator passed on last commit in series.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I49a7710e642dff624d578ec1dde088428f284627

show more ...


# 48f3ffcb 22-Feb-2023 Gunnar Mills <gmills@us.ibm.com>

Change BMCWEB_LOG level for 404/405

404/405 which are part of 4xx errors are client-side errors. These might
be server errors, e.g. a client is walking the redfish tree and had a id
that no longer e

Change BMCWEB_LOG level for 404/405

404/405 which are part of 4xx errors are client-side errors. These might
be server errors, e.g. a client is walking the redfish tree and had a id
that no longer exists but they could also be the client tried an id or
URL that isn't there, e.g. a fuzz tester. Due to this, use WARNING log
level.

A future commit attempts to better clarify our log levels.

Saw "404 on path v1/badinput/badinput"

Tested: None.

Change-Id: I4f056754638ef2d640615e9fcc74a7a68a767593
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>

show more ...


# 26ccae32 16-Feb-2023 Ed Tanous <edtanous@google.com>

Pass string views by value

string_view should always be passed by value; This commit is a sed
replace of the code to make all string_views pass by value, per general
coding guidelines[1].

[1] http

Pass string views by value

string_view should always be passed by value; This commit is a sed
replace of the code to make all string_views pass by value, per general
coding guidelines[1].

[1] https://quuxplusone.github.io/blog/2021/11/09/pass-string-view-by-value/

Tested: Code compiles.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I55b342a29a0fbfce0a4ed9ea63db6014d03b134c

show more ...


# 3ccb3adb 13-Jan-2023 Ed Tanous <edtanous@google.com>

Fix a boatload of #includes

Most of these missing includes were found by running clang-tidy on all
files, including headers. The existing scripts just run clang-tidy on
source files, which doesn't

Fix a boatload of #includes

Most of these missing includes were found by running clang-tidy on all
files, including headers. The existing scripts just run clang-tidy on
source files, which doesn't catch most of these.

Tested: Code compiles

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ic741fbb2cc9e5e92955fd5a1b778a482830e80e8

show more ...


# 51f65b0c 06-Jan-2023 Ed Tanous <edtanous@google.com>

Remove a couple references to @odata.context

9440096005902d13e27fdb8911d33c657f8c7b77 removed all uses of
odata.context from the system, but there were a few left in static
files, that unfortunately

Remove a couple references to @odata.context

9440096005902d13e27fdb8911d33c657f8c7b77 removed all uses of
odata.context from the system, but there were a few left in static
files, that unfortunately got propagated to code when we did the
migration from static files. This commit fixes the last couple that
were left.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ifc77ff02939c663106029dc57807db3b8ad537b7

show more ...


# 079360ae 29-Jun-2022 Ed Tanous <edtanous@google.com>

Prepare for boost::url upgrade

The new boost URL now interops properly with std::string_view, which is
great, and cleans up a bunch of mediocre code to convert one to another.
It has also been pulle

Prepare for boost::url upgrade

The new boost URL now interops properly with std::string_view, which is
great, and cleans up a bunch of mediocre code to convert one to another.
It has also been pulled into boost-proper, so we no longer need a
boost-url dependency that's separate.

Unfortunately, boost url makes these improvements by changing
boost::string_view for boost::urls::const_string, which causes us to
have some compile errors on the missing type.

The bulk of these changes fall into a couple categories, and have to be
executed in one commit.
string() is replaced with buffer() on the url and url_view types
boost::string_view is replaced by std::string_view for many times, in
many cases removing a temporary that we had in the code previously.

Tested: Code compiles with boost 1.81.0 beta.
Redfish service validator passes.
Pretty good unit test coverage for URL-specific use cases.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I8d3dc89b53d1cc390887fe53605d4867f75f76fd

show more ...


# 0ea4b4e2 29-Aug-2022 Ed Tanous <edtanous@google.com>

Fix privileges on default handlers

Regardless of what privileges are allowed on a resource, we should
almost always be pulling from the PrivilegeRegistry for the information.
This corrects the handl

Fix privileges on default handlers

Regardless of what privileges are allowed on a resource, we should
almost always be pulling from the PrivilegeRegistry for the information.
This corrects the handlers in redfish_v1.hpp. Namely that
JsonSchemaCollection now pulls from the generated privilege registry
files, and the 404 handler now requires a valid login to hit the route.
This allows 401 to be returned on routes that would 404. Arguably users
should not be able to see what routes bmcweb implements if they are not
authenticated. Marking the 404 route as login is largely ceremonial and
for documentation, because there is a separate check for a user being
authenticated.

Tested:
Redfish service validator passes.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I4c03b0ae05d9fb7712d6ec3b6f2feaf034ca0750

show more ...


# d8a5d5d8 05-Aug-2022 Jiaqing Zhao <jiaqing.zhao@intel.com>

Update content of ResourceNotFound/ResourceAlreadyExists message

According to Redfish Base Message Registry definition [1], the first
argument of ResourceNotFound and ResourceAlreadyExists is the sc

Update content of ResourceNotFound/ResourceAlreadyExists message

According to Redfish Base Message Registry definition [1], the first
argument of ResourceNotFound and ResourceAlreadyExists is the schema
name of the resource. This patch changes the first argument to non-
versioned schema name treewide.

Tested:
Verified the error message matches the definition, and Redfish Service
Validator passed.

[1] https://redfish.dmtf.org/registries/Base.1.13.0.json

Change-Id: Ib5cd853578ef0bffda1184d10827241e94faaf68
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>

show more ...


# 44c70412 31-Jul-2022 Ed Tanous <edtanous@google.com>

Add 405 handler for redfish

Redfish has specific error messages for OperationNotSupported in the
Base registry. This commit allows bmcweb to return both the correct
return code (405) and the correc

Add 405 handler for redfish

Redfish has specific error messages for OperationNotSupported in the
Base registry. This commit allows bmcweb to return both the correct
return code (405) and the correct error message, while not effecting the
rest of the tree.

We didn't have the equivalent call in error_messages, so this adds the
required call.

Tested:
GET /redfish/v1 returns ServiceRoot
GET /redfish/v1/foo Returns 404
PATCH /redfish/v1 returns 405 OperationNotSupported
POST /redfish/v1/Chassis returns 405 OperationNotSupported
DELETE /redfish/v1/Chassis returns 405 ResourceCannotBeDeleted
POST /redfish/v1/foo/bar Returns 404

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I6f980af7307af602344b65a12a2b7589cc9ec959
Signed-off-by: Carson Labrado <clabrado@google.com>

show more ...


# 44e4518b 26-Jul-2022 Ed Tanous <edtanous@google.com>

Allow custom 404 handlers

Different HTTP protocols have different http responses for 404. This
commit adds support for registering a route designed to host a handler
meant for when a response would

Allow custom 404 handlers

Different HTTP protocols have different http responses for 404. This
commit adds support for registering a route designed to host a handler
meant for when a response would otherwise return. This allows
registering a custom 404 handler for Redfish, for which all routes will
now return a Redfish response.

This was in response to the 404 handler not working in all cases (in the
case of POST/PATCH/DELETE). Allowing an explicit registration helps to
give the intended behavior in all cases.

Tested:
GET /redfish/v1/foo returns 404 Not found
PATCH /redfish/v1/foo returns 404 Not found

GET /redfish/v1 returns 200 OK, and content
PATCH /redfish/v1 returns 405 Method Not Allowed

With Redfish Aggregation:
GET /redfish/v1/foo gets forwarded to satellite BMC
PATCH /redfish/v1/foo does not get forwarded and returns 404
PATCH /redfish/v1/foo/5B247A_bar gets forwarded

Unit tests pass

Redfish-service-validator passes

Redfish-Protocol-Validator fails 7 tests (same as before)

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I731a5b4e736a2480700d8f3e81f9c9c6cbe6efca
Signed-off-by: Carson Labrado <clabrado@google.com>

show more ...


# e9dd1d31 17-Jun-2022 Ed Tanous <edtanous@google.com>

Fix regression in JsonSchema/404 handler

81d523a7eeb2b5f9e066a9055faf436e7086873b
Move the JsonSchemas to be generated at runtime

And

8c623a96b43d69a4cfe95f9eac81be084d0a59b6
Handle redfish 404 wi

Fix regression in JsonSchema/404 handler

81d523a7eeb2b5f9e066a9055faf436e7086873b
Move the JsonSchemas to be generated at runtime

And

8c623a96b43d69a4cfe95f9eac81be084d0a59b6
Handle redfish 404 with a good message

Have collided in merge conflicts. The 404 handler needs to be
registered last.

This patchset reorders the handlers, and leaves a note for the next
user. This probably needs a better handling so nobody falls into this
trap again, but for the moment, this should unbreak the build.

Tested:
curl -vvvv --insecure --user root:0penBmc https://192.168.7.2/redfish/v1/JsonSchemas/
No longer returns 404

Redfish service validator passes in qemu.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I7b56e8c17bad7bdca3ebf38be622502ebc35f1ca

show more ...


# 81d523a7 25-May-2022 Ed Tanous <edtanous@google.com>

Move the JsonSchemas to be generated at runtime

Generating all of these index files at compile time is kind of wasteful,
considering that it's really not that much code to generate them. This
commi

Move the JsonSchemas to be generated at runtime

Generating all of these index files at compile time is kind of wasteful,
considering that it's really not that much code to generate them. This
commit modifies the update_schemas script to generate a C++ version of
the schemas that can then be used to generate a route. This allows
deleting a LOT of fixed files, for a very small incremental binary size
increase.

This change will cause two impacts that a user could possibly notice.

Expand will now work properly on JsonSchemas tree.
Keys on the JsonSchema schemas will now be sorted alphabetically, as we
do elsewhere.

All other things should remain the same.

Tested:
Redfish service validator passes.

curl --insecure --user root:0penBmc https://192.168.7.2/redfish/v1/JsonSchemas/Triggers
Returns the same object as before with changes above.

This adds 2512 bytes to the bmcweb binary size, and interestingly, adds
3764 bytes to the overall rootfs size, despite the level of file
deletion seen in the patch. While this is debatably "worse" than
what we had before in this regard, making JsonSchemas work similar
to how the rest of the Redfish tree operates, is worth the minor
increase in code size.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ic0d568112a3784821aa6867f7bcf50705dc586db

show more ...


# 686b7093 15-Jun-2022 Nan Zhou <nanzhoumails@gmail.com>

redfish_v1: fix setUpRedfishRoute

Tested: compiles

Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I91565293a1b176803df5b0811752a0dea667c324


12