History log of /openbmc/bmcweb/features/redfish/src/error_messages.cpp (Results 26 – 50 of 91)
Revision Date Author Comments
# d85418e3 23-Jun-2023 Patrick Williams <patrick@stwcx.xyz>

error_messages: remove source_location indirect

clang-16 now supports std::source_location so remove the indirection
that uses experimental::source_location in some cases.

Tested: Compiled with `CX

error_messages: remove source_location indirect

clang-16 now supports std::source_location so remove the indirection
that uses experimental::source_location in some cases.

Tested: Compiled with `CXX=clang++`.

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

show more ...


# 95b3ad73 27-Jun-2022 Ed Tanous <edtanous@google.com>

Make redfish::messages rely on typesafe structures

The previous patches modified these fields one at a time, for the cases
where we had code calling these in odd ways. This commit goes and
effects

Make redfish::messages rely on typesafe structures

The previous patches modified these fields one at a time, for the cases
where we had code calling these in odd ways. This commit goes and
effects the same change on the rest of the message handlers where it
makes sense.

Any input to a message function that mentions a "value" replaces the
value with a nlohmann::json object, to make calling this code easier.

The one exception is StringValueTooLong, which by definition, requires
the input value to be a string, so that is left as string_view
intentionally.

Tested: Dead unused code. Code compiles.

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

show more ...


# 14fbced6 27-Jun-2022 Ed Tanous <edtanous@google.com>

Make propertyValueIncorrect typesafe

Similar to the previous patches, make propertyValueIncorrect accept a
nlohmann::json object as input. This removes the need for the dump()
call, which oddly eno

Make propertyValueIncorrect typesafe

Similar to the previous patches, make propertyValueIncorrect accept a
nlohmann::json object as input. This removes the need for the dump()
call, which oddly enough, in our one usage, was actually incorrect, and
could cause bmcweb to throw an exception in parsing in theory.

Tested: Only used in one error condition. Code compiles.

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

show more ...


# f818b04d 27-Jun-2022 Ed Tanous <edtanous@google.com>

Make propertyValueFormatError more typesafe

Similar to other patches, make propertyValueFormatError accept a
nlohmann::json object, which removes a lot of the unsafe dump code that
we have littered

Make propertyValueFormatError more typesafe

Similar to other patches, make propertyValueFormatError accept a
nlohmann::json object, which removes a lot of the unsafe dump code that
we have littered about.

Tested: No easy to replicate error. Code is identical to previous
patchsets. Inspection and code compilation only.

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

show more ...


# 2e8c4bda 27-Jun-2022 Ed Tanous <edtanous@google.com>

Make propertyValueTypeError more typesafe

Similar to the prior patchset in this series, propertyValueTypeError can
be moved to safer constructs. This ensures that we are minimizing how
many places

Make propertyValueTypeError more typesafe

Similar to the prior patchset in this series, propertyValueTypeError can
be moved to safer constructs. This ensures that we are minimizing how
many places we are calling dump() from, and allows us to reduce the
amount of code written for error handling.

Tested:
PATCH /redfish/v1/SessionService {"SessionTimeout": "foo"}

Returns PropertyValueTypeError in the same behavior as prior to this
patch.

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

show more ...


# e2616cc5 27-Jun-2022 Ed Tanous <edtanous@google.com>

Make propertyValueNotInList typesafe

The error codes for this function accept a string_view, which has caused
a number of cases of users of this function to call dump() to_string()
and all manner of

Make propertyValueNotInList typesafe

The error codes for this function accept a string_view, which has caused
a number of cases of users of this function to call dump() to_string()
and all manner of other conversions. Considering that dump() is
something that's difficult to call correctly, and overly wordy, it would
be ideal if the message code just handled that for us.

Therefore, this commit changes the prototype to include a nlohmann::json
object as an argument instead of string_view, then audits the codebase
for all uses, and moves them to a more normalized usage, which allows
the calling code to call "dump" for them.

Tested: PATCH /redfish/v1/SessionService {"SessionTimeout": 1}

Returns the PropertyValueNotInList error as it did before.

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

show more ...


# c1c7b94b 02-Jun-2023 Ed Tanous <edtanous@google.com>

Remove duplicated stringValueTooLong

This prototype got added twice, once with int as a value, and once with
size_t. This builds fine in 64 bit, but in 32 bit, fails.

Tested: Code compiles

Signed

Remove duplicated stringValueTooLong

This prototype got added twice, once with int as a value, and once with
size_t. This builds fine in 64 bit, but in 32 bit, fails.

Tested: Code compiles

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

show more ...


# 600af5f1 06-Oct-2021 AppaRao Puli <apparao.puli@linux.intel.com>

Input parameter validation for Event Subscription

User input must be validated to avoid the out-of-memory issue. This
commit adds the size check on input parameters such as Context,
Destination and

Input parameter validation for Event Subscription

User input must be validated to avoid the out-of-memory issue. This
commit adds the size check on input parameters such as Context,
Destination and Header field while create or update the
EventDestination.

Added a generic error message "PropertySizeExceeded" in message registry
which is used as response when size limit is exceeded.

Tested
- Validated using POST on Event Subscription.
- When Context, Destination and Headers were too long,
received a error message denoting the same.

Change-Id: Ibab847ce0c99f445a76e6d3aee8074428bb7d30f
Signed-off-by: AppaRao Puli <apparao.puli@intel.com>
Signed-off-by: Ayushi Smriti <smriti.ayushi@intel.com>
Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com>
Signed-off-by: Ed Tanous <edtanous@google.com>

show more ...


# faf100f9 25-May-2023 Ed Tanous <edtanous@google.com>

Fix some includes

System includes should be included with <>, in-tree includes should be
included with "". This was found manually, with the help of the
following grep statement[1].

git grep -o -h

Fix some includes

System includes should be included with <>, in-tree includes should be
included with "". This was found manually, with the help of the
following grep statement[1].

git grep -o -h "#include .*" | sort | uniq

Tested:
Code compiles

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

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 ...


# d9f466b3 06-Mar-2023 Ed Tanous <edtanous@google.com>

Take url views by value

Any of our things taking URLs should be taking url_view by value,
similar to how we take string_view.

From the beast documentation:
"...it acts like a string_view in terms o

Take url views by value

Any of our things taking URLs should be taking url_view by value,
similar to how we take string_view.

From the beast documentation:
"...it acts like a string_view in terms of ownership." [1]
Therefore, we should treat it like we treat string_view, and take by value, not reference.

[1] https://www.boost.org/doc/libs/master/libs/url/doc/html/url/ref/boost__urls__url_view.html

Tested:
Stacked these patches. Redfish service validator passes.

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

show more ...


# 4ef82a15 03-Feb-2023 Alex Schendel <alex.schendel@intel.com>

Add Support for ActionParameterNotInList Message

This commit adds support for the ActionParameterNotInList Redfish DMTF
error message.

Change-Id: I7fd9b7c952e7ffa4c7c4c585ae28315b40556a21
Signed-of

Add Support for ActionParameterNotInList Message

This commit adds support for the ActionParameterNotInList Redfish DMTF
error message.

Change-Id: I7fd9b7c952e7ffa4c7c4c585ae28315b40556a21
Signed-off-by: Alex Schendel <alex.schendel@intel.com>

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 ...


# b4ad4c05 16-Sep-2022 Shantappa Teekappanavar <shantappa.teekappanavar@ibm.com>

bmcweb: Add strictAccountTypes error message

Error message to be thrown when StrictAccountTypes is true and the
specified value(s) for AccountTypes or OEMAccountTypes was not accepted.

Testing:
str

bmcweb: Add strictAccountTypes error message

Error message to be thrown when StrictAccountTypes is true and the
specified value(s) for AccountTypes or OEMAccountTypes was not accepted.

Testing:
strictAccountTypes() error message was tested while testing redfish
PATCH API for patching AccountTypes.

Signed-off-by: Shantappa Teekappanavar <shantappa.teekappanavar@ibm.com>
Change-Id: I13abcd142ddfb04a2a187c9373fa996ecfe987a1

show more ...


# 3590bd1d 12-Aug-2022 Nan Zhou <nanzhoumails@gmail.com>

query: propogate errors for expand

The existing code doesn't propogate errors of subqueries correctly.
This commit corrects the behavior, so that the final response gets all
error message of subquer

query: propogate errors for expand

The existing code doesn't propogate errors of subqueries correctly.
This commit corrects the behavior, so that the final response gets all
error message of subqueries and the "highest priority" HTTP code.

DMTF doesn't specify how expand queries handle error codes, since using
subqueries is an implementation choice that we made in this project.

What we did here follows existing behavior of this project, and follows
the error message section of the Redfish spec;
[1] https://redfish.dmtf.org/schemas/DSP0266_1.15.1.html#error-responses

As for now, this commit uses the worst HTTP code among all the error
code. See query_param.hpp, function |propogateErrorCode| for detailed
order of the errror codes.

Tested:
1. this is difficult to test, but I hijacked the code so it returns
errors in TaskServices, then I verified that "/redfish/v1?$expand=."
correctly returns 500 and the gets the error message set.
2. unit test so that when there are multiple errors, the final response
gets a generate error message.

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

show more ...


# 613dabea 09-Jul-2022 Ed Tanous <edtanous@google.com>

Remove nlohmann brace initialization

There's a few last places (outside of tests) where we still use
nlohmann brace initialization. Per the transforms we've been doing,
move these to constructing t

Remove nlohmann brace initialization

There's a few last places (outside of tests) where we still use
nlohmann brace initialization. Per the transforms we've been doing,
move these to constructing the objects explicitly, using operator[],
nlohmann::object_t and nlohmann::array_t. Theses were found by manual
inspection grepping for all uses of nlohmann::json.

This is done to reduce binary size and reduce the number of intermediate
objects being constructed. This commit saves a trivial amount of size
(~4KB, Half a percent of total) and in addition but makes our
construction consistent.

Tested:
Redfish service validator passes.

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

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 ...


# 0442ef92 18-Aug-2022 Nan Zhou <nanzhoumails@gmail.com>

error_message: iwyu

I found that error_messages.cpp missed headers when adding
insufficientResource errors. This commit is like the other incremental
iwyu effort. Now error message library is fixed.

error_message: iwyu

I found that error_messages.cpp missed headers when adding
insufficientResource errors. This commit is like the other incremental
iwyu effort. Now error message library is fixed.

Tetsted: compiles.

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

show more ...


# ae688313 15-Aug-2022 Nan Zhou <nanzhoumails@gmail.com>

error message: add insufficientStorage

In the spec, when a response is too large, we need a error messsage to
represent such error. The corresponding error is 507 Insufficient
Storage, which is alre

error message: add insufficientStorage

In the spec, when a response is too large, we need a error messsage to
represent such error. The corresponding error is 507 Insufficient
Storage, which is already in the base registry.

This commit adds that utility to error messages library.

Reference: redfish spec Section 7.3.2
```
If a service cannot return the payload due to its size, it shall return
the HTTP 507 Insufficient Storage status code.
```

Tested: code compies.

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

show more ...


# 65e4f1f7 08-Feb-2022 Ed Tanous <edtanous@google.com>

Optimize resource event schema

Very similar to how the base registry was optimized for binary size,
optimize the resource event registry, by making the getLogFromRegistry a
common method for both re

Optimize resource event schema

Very similar to how the base registry was optimized for binary size,
optimize the resource event registry, by making the getLogFromRegistry a
common method for both registries.

Tested: Only usage of these calls appears to be in management console.
The code and pattern we're using here is well unit tested, and seems
reasonable that we could rely on the compile time checks, but if not, I
could use some help testing this.

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

show more ...


# d9f6c621 17-Mar-2022 Ed Tanous <edtanous@google.com>

Use enum overload for field setting

There are two overloads of addHeader, one that takes a string, and one
that takes a boost enum. For most common headers, boost contains a
string table with all o

Use enum overload for field setting

There are two overloads of addHeader, one that takes a string, and one
that takes a boost enum. For most common headers, boost contains a
string table with all of those entries anyway, so there's no point in
duplicating the strings, and ensures that we don't make trivial
mistakes, like capitalization or - versus underscore that aren't caught
at compile time.

Tested:
This saves a trivial amount (572 bytes) of compressed binary size.

curl --insecure -vvv --user root:0penBmc https://192.168.7.2/redfish/v1

returns < Content-Type: application/json

curl --insecure -vvv -H "Accept: text/html" --user root:0penBmc https://192.168.7.2/redfish/v1

Returns
< Content-Type: text/html;charset=UTF-8

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

show more ...


# 7b1dd2f9 22-Jun-2022 Ed Tanous <edtanous@google.com>

Set UnknownProperty message to be an error

This normally wouldn't be so big of a deal, but the redfish-protocol
validator tests this case in the REQ_PATCH_BAD_PROP test.

From the specification:
'''

Set UnknownProperty message to be an error

This normally wouldn't be so big of a deal, but the redfish-protocol
validator tests this case in the REQ_PATCH_BAD_PROP test.

From the specification:
'''
If all properties in the update request are read-only, unknown, or
unsupported, but the resource can be updated, the service shall return
the HTTP 400 Bad Request status code and an error response with messages
that show the non-updatable properties.
'''

We wrote our code almost right for handling this case, but we put the
response into the per-property responses instead of the error responses.

In terms of backward compatibility, technically this is changing the
behavior, but considering that it's behavior in an error case, most
implementations only look at response code, and this is moving to be
compliant with the specification, it doesn't seem like there would be
any reason to provide both the old message and the new one, and this has
a low to zero likelihood of any actual impact. To hit this condition,
clients would have to be ignoring the error code response AND using a
property that's unknown to the BMC. Clients that make both mistakes
seems unlikely.

Tested:
Code now passes the REQ_PATCH_BAD_PROP test. 10 failing test cases down
to 8.

'''
curl -vvvv --insecure --user root:0penBmc https://192.168.7.2/redfish/v1/AccountService/ -X PATCH -d '{"foo": "bar"}'
'''

Returns an object with an "error" key in it.

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

show more ...


# 227a2b0a 24-Jun-2022 Jiaqing Zhao <jiaqing.zhao@intel.com>

error_messages: Add PropertyValueOutOfRange error

The PropertyValueOutOfRange error indicates that a property was given
the correct value type but the value of that property is outside the
supported

error_messages: Add PropertyValueOutOfRange error

The PropertyValueOutOfRange error indicates that a property was given
the correct value type but the value of that property is outside the
supported range.

Tested:
Build pass.

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

show more ...


# 8868776e 16-May-2022 Ed Tanous <edtanous@google.com>

Change operationFailed to return 502

Redfish base registry for operation failed says:
"Indicates that one of the internal operations necessary to complete the
request failed. Examples of this are w

Change operationFailed to return 502

Redfish base registry for operation failed says:
"Indicates that one of the internal operations necessary to complete the
request failed. Examples of this are when an internal service provider
is unable to complete the request, such as in aggregation or RDE."

In terms of return codes, this translates to 502, Bad Gateway, given
that we're talking about proxy behavior here.

There is currently one usage of messages::operationFailed, which
arguably should've used internalErrror, and will be fixed in the next
patchset.

Tested: Code compiles. No (correct) users.

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

show more ...


# 6a409c12 06-May-2022 Ed Tanous <edtanous@google.com>

Change query param errors to be 400 instead of 403

Any query param errors from the base registry being sent imply that the
user-provided parameters were bad, which should return bad request, not
for

Change query param errors to be 400 instead of 403

Any query param errors from the base registry being sent imply that the
user-provided parameters were bad, which should return bad request, not
forbidden. This is in line with the spec.

Luckily, the only usage of these parameters as of now is from within the
query params support model, so changing it shouldn't cause any backward
compatibility issues, and because these are meant for "bad request" type
messages, it's unlikely it would even be able to effect clients.

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

show more ...


1234