#
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 ...
|
#
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 ...
|
#
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 ...
|
#
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 ...
|
#
02fea7a7
|
| 07-Jul-2022 |
Ed Tanous <edtanous@google.com> |
Use more specific include
boost/urls/urls.hpp pulls in all of boost url, when in this context, we only want url_view.hpp. Per the coding standard (specifically in regards to boost) pull in the more
Use more specific include
boost/urls/urls.hpp pulls in all of boost url, when in this context, we only want url_view.hpp. Per the coding standard (specifically in regards to boost) pull in the more specific header
Tested: Code compiles.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I85bc45bdfcc7bc1d8e87be23fe4884b6ec8c4227
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 ...
|
#
24861a28
|
| 29-Mar-2022 |
Ramesh Iyyar <rameshi1@in.ibm.com> |
registry: Add PropertyValueExternalConflict registry
- Added the PropertyValueExternalConflict message registry that might used to send when the request is failed due to some other resource stat
registry: Add PropertyValueExternalConflict registry
- Added the PropertyValueExternalConflict message registry that might used to send when the request is failed due to some other resource state or configuration.
Signed-off-by: Ramesh Iyyar <rameshi1@in.ibm.com> Change-Id: Ibdb8c21e285079dbaea54b99f207f45892b24ea9
show more ...
|
#
2a6af81c
|
| 17-Mar-2022 |
Ramesh Iyyar <rameshi1@in.ibm.com> |
registry: Add PropertyValueResourceConflict registry
- Added the PropertyValueResourceConflict message registry that might used to send when the request is failed due to some other resource stat
registry: Add PropertyValueResourceConflict registry
- Added the PropertyValueResourceConflict message registry that might used to send when the request is failed due to some other resource state or configuration.
Signed-off-by: Ramesh Iyyar <rameshi1@in.ibm.com> Change-Id: I2c03aee88442f6abe55f2a9f574211b8214aa30c
show more ...
|
#
f7725d79
|
| 07-Mar-2022 |
Ed Tanous <edtanous@google.com> |
Make code compile on clang again
There are a couple places we missed inline/static on our headers, and a couple unused message entry callbacks for which their parameters were incorrect (which clang
Make code compile on clang again
There are a couple places we missed inline/static on our headers, and a couple unused message entry callbacks for which their parameters were incorrect (which clang caught). Fix all of them.
Tested: Code compiles on clang. No-op changes.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I12c9c04d3b773c4991c6cd92d0cfd42b348762d6
show more ...
|
#
1668ce6d
|
| 08-Feb-2022 |
Ed Tanous <edtanous@google.com> |
Move error messages to string_view
using std::string_view on these lets us call them in more contexts, and allows us to inline some previously more complex code. In general, for APIs like this, std
Move error messages to string_view
using std::string_view on these lets us call them in more contexts, and allows us to inline some previously more complex code. In general, for APIs like this, std::string_view should be preferred as it gives more flexibility in calling conventions.
Tested: curl --insecure "https://localhost:18080/redfish/v1/AccountService/Roles/foobar" ✔ { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type Role named 'foobar' was not found.", "MessageArgs": [ "Role", "foobar" ], "MessageId": "Base.1.11.0.ResourceNotFound", "MessageSeverity": "Critical", "Resolution": "Provide a valid resource identifier and resubmit the request." } ], "code": "Base.1.11.0.ResourceNotFound", "message": "The requested resource of type Role named 'foobar' was not found." } }
This is the same response as previously.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I8ee17120c42d2a13677648c3395aa4f9ec2bd51a
show more ...
|
#
ace85d60
|
| 26-Oct-2021 |
Ed Tanous <edtanous@google.com> |
Add url type safety to message registry
There are a number of places where we use message registry messages incorrectly. This patchset attempts to fix them, and invoke some type safety when they're
Add url type safety to message registry
There are a number of places where we use message registry messages incorrectly. This patchset attempts to fix them, and invoke some type safety when they're used such that they're more obvious to use.
Namely, it changes a number of the message registry methods to accept a boost::urls::url_view for its argument instead of a const std::string&. This forces the calling code to correctly encode a URL to use the method, which should make it obvious that it's not for an ID, a property name, or anything else. In the course of doing this, several places were found to be using the first argument incorrectly.
Tested: curl --insecure --user root:0penBmc https://192.168.7.2/redfish/v1/Chassis/foobar
Returns: { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type #Chassis.v1_16_0.Chassis named foobar was not found.", "MessageArgs": [ "#Chassis.v1_16_0.Chassis", "foobar" ], "MessageId": "Base.1.8.1.ResourceNotFound", "MessageSeverity": "Critical", "Resolution": "Provide a valid resource identifier and resubmit the request." } ], "code": "Base.1.8.1.ResourceNotFound", "message": "The requested resource of type #Chassis.v1_16_0.Chassis named foobar was not found." }
Identically to previously.
Also tested with IDs that contained % encoded characters, like foobar%10, which gave the same result.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Icbb3bce5d190a260610087c9ef35e7becc5a50c7
show more ...
|
#
0a4304cf
|
| 07-Feb-2022 |
Ed Tanous <edtanous@google.com> |
Remove invalid base log message
The redfish base registry does not include a definition of this message, which generating type-safe models has teased out. Replace the MutuallyExclusiveProperties me
Remove invalid base log message
The redfish base registry does not include a definition of this message, which generating type-safe models has teased out. Replace the MutuallyExclusiveProperties message with two "PropertyValueConflict" messages. This seems like the closest thing, but in lieu of the things not being in the standard, this seems like the best compromise.
Tested: curl --insecure -X POST --user root:0penBmc https://192.168.7.2/redfish/v1/EventService/Subscriptions -d '{"MessageIds":[""],"RegistryPrefixes":[""],"Destination":"","Protocol":""}'
Returns: { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The property 'MessageIds' could not be written because its value would conflict with the value of the 'RegistryPrefixes' property.", "MessageArgs": [ "MessageIds", "RegistryPrefixes" ], "MessageId": "Base.1.8.1.PropertyValueConflict", "MessageSeverity": "Warning", "Resolution": "No resolution is required." } ], "code": "Base.1.8.1.PropertyValueConflict", "message": "The property 'MessageIds' could not be written because its value would conflict with the value of the 'RegistryPrefixes' property." } }
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I1eaf4d06b6f5b85909392c48970e3f353af3a41e
show more ...
|
#
9eb808c1
|
| 25-Jan-2022 |
Ed Tanous <edtanous@google.com> |
Enable readability-avoid-const-params-in-decls
This check involves explicitly declaring variables const when they're declared auto, which helps in readability, and makes it more clear that the varia
Enable readability-avoid-const-params-in-decls
This check involves explicitly declaring variables const when they're declared auto, which helps in readability, and makes it more clear that the variables are const.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I71198ea03850384a389a56ad26f2c4a48c75b148
show more ...
|
#
331b2017
|
| 07-Feb-2022 |
Ed Tanous <edtanous@google.com> |
Capture int by value in stringValueTooLong
Per the coding standard, we should be capturing this by int, not const int&.
Tested: There are no uses of stringValueTooLong(), so noop change to binary.
Capture int by value in stringValueTooLong
Per the coding standard, we should be capturing this by int, not const int&.
Tested: There are no uses of stringValueTooLong(), so noop change to binary.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Idfcb05c962e0a0d489db263a6f845bb1789b5842
show more ...
|
#
9ea15c35
|
| 04-Jan-2022 |
Ed Tanous <edtanous@google.com> |
Include what you use
Do a partial update from the include what you use tool.
While ideally we'd be able to do this as part of CI, there's still quite a bit of noise in the output that requires manu
Include what you use
Do a partial update from the include what you use tool.
While ideally we'd be able to do this as part of CI, there's still quite a bit of noise in the output that requires manual intervention.
Tested: Code compiles
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Iaaeb7a9199f64b5d6913c3abab4779b252768ed8
show more ...
|
#
5187e09b
|
| 14-Dec-2021 |
Josh Lehan <krellan@google.com> |
error_messages: Use int64_t in invalidIndex
Using int64_t instead of int, to permit 64-bit indices.
This is to support ExternalStorer, a new project I am working on, which uses a 64-bit sequence nu
error_messages: Use int64_t in invalidIndex
Using int64_t instead of int, to permit 64-bit indices.
This is to support ExternalStorer, a new project I am working on, which uses a 64-bit sequence number for long-term robustness.
Change-Id: I00121933067030fd722f6b02c2d2dbd1854dff1c Signed-off-by: Josh Lehan <krellan@google.com>
show more ...
|
#
df5415fc
|
| 01-Dec-2021 |
Ed Tanous <edtanous@google.com> |
Add logging to internal error
Internal error call sites are propagated through the code, and might be triggered multiple times in the course of a request, which makes them difficult to track the sou
Add logging to internal error
Internal error call sites are propagated through the code, and might be triggered multiple times in the course of a request, which makes them difficult to track the source of.
This commit changes the internalError() method to include a print of which invocation within bmcweb triggered the error, using c++20s std::source_location mechanism.
Note: clang-13 still doesn't implement std::source_location, so this commit pulls source_location.hpp from lg2 to be able to support all compilers.
Tested: Loaded in qemu, and added an internalError() call into systems.hpp for the /redfish/v1/Systems handler. Observed that [CRITICAL "error_messages.cpp":234] Internal Error ../../../../../../workspace/sources/bmcweb/redfish-core/include/../lib/systems.hpp(2820:40) `redfish::requestRoutesSystemsCollection(App&)::<lambda(const crow::Request&, const std::shared_ptr<bmcweb::AsyncResp>&)>`:
Got printed to the bmcweb logs.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ic1b4240422445357bc87404de814ad14f86b9edf
show more ...
|