Age | Commit message (Collapse) | Author | Files | Lines |
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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>
|
|
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
|
|
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
|
|
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
|
|
Per cpp core guidelines, these should be methods.
Tested: on last patchset of the series.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ib16479db9d2b68da68e7ad6e825c7e205c64f1de
|
|
This change moves getMessage and getMessageFromRegistry to a .cpp file
so that they can be easily tested.
Tested: Unit test passes
Signed-off-by: Sui Chen <suichen@google.com>
Change-Id: Ia9fc91e5a47036198bf013ff3ea21ea9f6d5259a
|
|
For systems implementing to the OWASP security guidelines[1] (of which all
should ideally) we should be checking the content-type header all times
that we parse a request as JSON.
This commit adds an option for parsing content-type, and sets a default
of "must get content-type". Ideally this would not be a breaking
change, but given the number of guides and scripts that omit the content
type, it seems worthwhile to add a trapdoor, such that people can opt
into their own model on how they would like to see this checking work.
Tested:
```
curl --insecure -H "Content-Type: application/json" -X POST -D headers.txt https://${bmc}/redfish/v1/SessionService/Sessions -d '{"UserName":"root", "Password":"0penBmc"}'
```
Succeeds.
Removing Content-Type argument causes bmc to return
Base.1.13.0.UnrecognizedRequestBody.
[1] cheatsheetseries.owasp.org/cheatsheets/REST_Security_Cheat_Sheet.html
Change-Id: Iaa47dd563b40036ff2fc2cacb70d941fd8853038
Signed-off-by: Ed Tanous <edtanous@google.com>
|
|
This commit adds support for the ActionParameterNotInList Redfish DMTF
error message.
Change-Id: I7fd9b7c952e7ffa4c7c4c585ae28315b40556a21
Signed-off-by: Alex Schendel <alex.schendel@intel.com>
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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>
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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>
|
|
This file is empty and is not referenced anywhere. So just delete it.
Tested: code compiles.
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: Ib2c743cf6ff06b8a68b7a887da5eee28a6d481f0
|
|
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
|
|
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
|
|
Brace initialization of json objects, while quite interesting from an
academic sense, are very difficult for people to grok, and lead to
inconsistencies. This patchset aims to remove a majority of them in
lieu of operator[]. Interestingly, this saves about 1% of the binary
size of bmcweb.
This also has an added benefit that as a design pattern, we're never
constructing a new object, then moving it into place, we're always
adding to the existing object, which in the future _could_ make things
like OEM schemas or properties easier, as there's no case where we're
completely replacing the response object.
Tested:
Ran redfish service validator. No new failures.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Iae409b0a40ddd3ae6112cb2d52c6f6ab388595fe
|
|
Section 7.3 of the Redfish specification lays out a feature called
"expand" that allows users to expand portions of the Redfish tree
automatically on the server side. This commit implements them to the
specification.
To accomplish this, a new class, MultiAsyncResp is created, that allows
RAII objects to handle lifetime properly. When an expand query is
generated, a MultiAsyncResp object is instantiated, which allows "new"
requests to attach themselves to the multi object, and keep the request
alive until they all complete. This also allows requests to be created,
while requests are in flight, which is required for queries above
depth=1.
Negatives:
Similar to the previous $only commit, this requires that all nodes
redfish nodes now capture App by reference. This is common, but does
interfere with some of our other patterns, and attempts to improve the
syntactic sugar for this proved unworkable.
This commit only adds the above to service root and Computer systems, in
hopes that we find a better syntax before this merges.
Left to future patches in series:
Merging the error json structures in responses.
The Redfish spec isn't very clear on how errors propagate for expanded
queries, and in a conforming we shouldn't ever hit them, but
nonetheless, I suspect the behavior we have is sub-optimal (attaching an
error node to every place in the tree that had an issue) and we should
attempt to do better in the future.
Tested (on previous patch):
curl --insecure --user root:0penBmc https://localhost:18080/redfish/v1\?\$expand\=.\(\$levels\=255\)
Returns the full tree
Setting $levels=1 query returns only a depth of 1 tree being returned.
Unit tests passing
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I874aabfaa9df5dbf832a80ec62ae65369284791d
|
|
- 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
|
|
- 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
|
|
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
|
|
In the way we store the message registry, we store both Severity and
MessageSeverity. Severity as a field is deprecated, and in every case
in every registry both fields have the same value. We shouldn't
duplicate data in that way. This commit changes the parse_registries.py
script to stop producing the Severity field into the struct. The few
uses we have left are moved over to use MessageRegistry.
Tested:
Redfish service validator shows no errors on the
/redfish/v1/Registries tree. Other errors present that were there
previously and are unchanged.
This saves a trivial amount: about 1kB on our compressed binary size.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ibbaf533dc59eb08365d6ed309aba16b54bc40ca1
|
|
The message_registries namespace is overly wordy, and results in very
long defines. Doing this one minor change reduces the code by 50 lines.
This seems worthwhile.
Tested: Unit tests pass. Namespace change only.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ib1401580b3fa47596eb56cdc86e60eeeb1c2f952
|
|
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
|
|
Internally to bmcweb, we actually store two copies of every string in
the base privilege registry. As history played out, the
error_messages.cpp was created first, then when logging was added, we
needed more fine grained programatic lookups into the message
registries, so we invented the constexpr array. Previously, it was
thought that xz basically deduplicated the duplicated strings. While
this is true to some extent, it using the actual processing code seems
to be a win on binary size.
This is also a -500 line diff, so it's reducing the amount of code we
have at the same time.
Note, the "InvalidUpload" message is incorrect per the standard, which
this patchset sort of teases out, as it's the only one that can't be
updated. This patchset leaves it as-written.
Tested:
xz compressed bmcweb went from 1174632 bytes, down to 1157040 bytes, or
a 1.4% (17592 bytes) reduction in compressed binary size.
curl --insecure --user root:0penBmc https://192.168.7.2/redfish/v1/Chassis/foobar
{
"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.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 #Chassis.v1_16_0.Chassis named 'foobar' was not found."
}
}
Note, the MessageId property has changed its version from Base.1.8 to
Base.1.11. This is correct and matches the version of the registry we
use. Also, the second argument is now quoted, as the ResourceNotFound
schema requires.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ifd0bd71a26eebeba8ba89704a1eca425f0776aa8
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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>
|
|
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
|
|
Tested By:
Code compiles
The error message is as follows:
{
"error": {
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The operation failed because the service at /redfish/v1/Systems/system/LogServices/Dump/ is disabled and cannot accept requests.",
"MessageArgs": [
"/redfish/v1/Systems/system/LogServices/Dump/"
],
"MessageId": "Base.1.11.0.ServiceDisabled",
"MessageSeverity": "Warning",
"Resolution": "Enable the service and resubmit the request if the operation failed."
}
],
"code": "Base.1.11.0.ServiceDisabled",
"message": "he operation failed because the service at /redfish/v1/Systems/system/LogServices/Dump/ is disabled and cannot accept requests."
}
}
Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com>
Change-Id: I923892ecd785e3b6c071fa663fee14a2754d5ef1
|
|
- The Message argument in the BIOSPOSTCode Message Entry
uses short form wording for TS (Time Stamp) & without any time unit.
- As the Message argument is directly displayed on OpenBMC GUI
as it is, word "TS" would create customer confusion due to it
not being a well known acronym. Also a field like this that
captures a physical quantity(time) should have units.
- Redfish clients should not be parsing the message argument, so
changing this wording should not break them.
- Also, this commit changes ":" to ";" in the Message argument to
makes things look consistent.
- As we changed the content of Message in the Message Entry, we had to
bump up the minor version of the Message registry.
Tested By:
1. Redfish Validator Passed.
Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
Change-Id: I17924c2dfdcf34563f8f8cd325011e13cb70e476
|
|
From the redfish specification:
Redfish Services shall process the OData-Version header in the
following table as defined by the HTTP 1.1 specification.
<Table omitted, but shows "yes" for service requirements>
Services shall reject requests that specify an unsupported OData
version.
This code implements compliance with those two statements.
Tested:
curl -vvvv --insecure --user root:0penBmc -H "OData-Version: 4.1" https://<ip>/redfish/v1
Returns 412 Precondition Failed
curl -vvvv --insecure --user root:0penBmc -H "OData-Version: 4.0" https://<ip>/redfish/v1
returns 200
curl -vvvv --insecure --user root:0penBmc https://<ip>/redfish/v1
returns 200
The equivalent Redfish-Protocol-Validator tests now pass
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I50350b913f17ae35588e2f0606c56164f00dc2a9
|
|
The odata.type of the message, included in the error response JSON
is changed to point to the latest one (Message.v1_1_1) as there was
conflict in the code, where it points to v1_0_0 schema and a property
- MessageSeverity has been used (introduced in v1_1_0)
Tested By:
{
"error": {
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The request failed due to an internal service error. The service is still operational.",
.
.
.
}
],
"code": "Base.1.4.0.InternalError",
"message": "The request failed due to an internal service error. The service is still operational."
}
}
Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com>
Change-Id: I57546adaffc2370c0314a2c2184799c387ec7272
|
|
cppcheck isn't smart enough to recognize these are c++ headers, not c
headers. Considering we're already inconsistent about our naming, it's
easier to just be consistent, and move the last few files to use .hpp
instead of .h.
Tested:
Code builds, no changes.
Signed-off-by: Ed Tanous <ed@tanous.net>
Change-Id: Ic348d695f8527fa4a0ded53f433e1558c319db40
|
|
https://github.com/openbmc/bmcweb/issues/150
Return code should be 503 Service Unavailable, not 403, unauthorized.
The user is authorized, but resources aren't available.
Tested:
Looking for help here.
Signed-off-by: Ed Tanous <ed@tanous.net>
Change-Id: I839df925d1d27411986cb01ffbd19a3ee8ffb1b2
|
|
The Base message registry has updated to 1.8.1. This updates our
error_messages files to match.
This changes from the deprecated 'Severity' to the new
'MessageSeverity' property.
It also adds a script to compare our error_messages.cpp messages
against the Base message registry and flag any differences.
Tested:
Ran the Redfish Validator and confirmed that this change does
not introduce any new failures.
Change-Id: I2e5101a5b4d0c0963569493451f99521e42b0f4d
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
|
|
Add MutualExclusiveProperties message registry entry
and error message.
As per redfish specification, "RegistryPrefixes" and
"MessageIds" are mutually exclusive. So add check for
same in EventService and return MutualExclusiveProperties
error message.
Tested:
- Create subscription failed with error(bad request)
when the request body contain both "RegistryPrefixes"
and "MessageIds".
Change-Id: I4c14f946977bce2ced8a7f96eb85855117fde9a8
Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
|