| #
002d39b4
|
| 31-May-2022 |
Ed Tanous <edtanous@google.com> |
Try to fix the lambda formatting issue
clang-tidy has a setting, LambdaBodyIndentation, which it says: "For callback-heavy code, it may improve readability to have the signature indented two levels
Try to fix the lambda formatting issue
clang-tidy has a setting, LambdaBodyIndentation, which it says: "For callback-heavy code, it may improve readability to have the signature indented two levels and to use OuterScope."
bmcweb is very callback heavy code. Try to enable it and see if that improves things. There are many cases where the length of a lambda call will change, and reindent the entire lambda function. This is really bad for code reviews, as it's difficult to see the lines changed. This commit should resolve it. This does have the downside of reindenting a lot of functions, which is unfortunate, but probably worth it in the long run.
All changes except for the .clang-format file were made by the robot.
Tested: Code compiles, whitespace changes only.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ib4aa2f1391fada981febd25b67dcdb9143827f43
show more ...
|
| #
c02a74f8
|
| 11-May-2022 |
Ed Tanous <edtanous@google.com> |
Return OData.Version with responses
The Redfish specification section 8.1 lists header values that should be returned from responses. It lists OData.Version: 4.0 as required in this same section.
Return OData.Version with responses
The Redfish specification section 8.1 lists header values that should be returned from responses. It lists OData.Version: 4.0 as required in this same section.
Implement this to the specification.
Tested: Redfish protocol validator RESP_HEADERS_ODATA_VERSION test now passes.
curl --vvv https://$bmc/redfish/v1 shows Odata.Version header set in response.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Id02ec218299524905fbd91cb161bfe727a51fc65
show more ...
|
| #
5e52870b
|
| 26-Apr-2022 |
Ed Tanous <edtanous@google.com> |
Make insecure-enable-redfish-query more specific
insecure-enable-redfish-query is really only intended to protect the user from things that might run the system out of resources, like expand, or com
Make insecure-enable-redfish-query more specific
insecure-enable-redfish-query is really only intended to protect the user from things that might run the system out of resources, like expand, or complex filter queries (ie queries that might pop the stack). This commit message moves the location where the parameters are enabled/disabled into the parser itself, such that some parameters (like top and skip in the next commit) can be executed outside of this option flag.
Because of moving the expand support deeper in the call stack, some unit tests now need to be aware of whether or not expand is supported in the configuration.
Tested: Enabled query option through local.conf with EXTRA_OEMESON:pn-bmcweb:append = "-Dinsecure-enable-redfish-query='enabled'"
Then did: curl --insecure --user root:0penBmc https://192.168.7.2/redfish/v1\?\$expand\=\*
Query expanded as expected;
set insecure-enable-redfish-query='disabled'
and observed that the same curl query returned QueryParameterValueFormatError, which is expected.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I24fbc2c9f64628d6457dd117b61ff22b276b0682
show more ...
|
| #
a6b9125f
|
| 04-Apr-2022 |
Nan Zhou <nanzhoumails@gmail.com> |
query parameter: add a way to delegate certain parameter
The generic query parameter handlers might not be performant, e.g., Expand in the sensor collections. This change adds a way to delegate quer
query parameter: add a way to delegate certain parameter
The generic query parameter handlers might not be performant, e.g., Expand in the sensor collections. This change adds a way to delegate query parameter processsing to redfish-core codes:
1. introduced a separate struct in the setUpRedfishRoute function, with which redfish-core codes can easily set delegation for each parameter; for example, the children patch of this PR will implement an efficient handler for sensor collection Expand, top, and skip. 2. introduced a separate Redfish route for delegation; this routes takes the struct described above and changes the query object so that query parameters are delegated. 3. in order to avoid copying Query objects and run delegation check twice, the |setUpRedfishRouteWithDelegation| function sets |delegated| so that callers can directly use it to determinte if delegation is needed, and what delegated Queries are
Tested: 1. added unit tests 2. the default redfish route is still working correctly
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: I77597ad7e8b40ac179d86dc9be1a35767cc61284
show more ...
|
| #
142ec9ae
|
| 24-Mar-2022 |
Ed Tanous <edtanous@google.com> |
Implement odata-version checks
The redfish protocol validator is a cruel.... cruel test. In it, it attempts to send odata-version headers that are not supported by the spec. bmcweb has never had a
Implement odata-version checks
The redfish protocol validator is a cruel.... cruel test. In it, it attempts to send odata-version headers that are not supported by the spec. bmcweb has never had a use for those headers, and they are optional to send, so bmcweb ignored them. This patchset fixes that. The exact wording of the standard is in the patch.
Tested: curl --insecure --user root:0penBmc https://192.168.7.2/redfish/v1 Returns service root
curl --insecure --user root:0penBmc -H "Odata-version: 4.0" https://192.168.7.2/redfish/v1 returns service root
curl --insecure --user root:0penBmc -H "Odata-version: 4.1" https://192.168.7.2/redfish/v1 returns precondition failed message from base registry, and 501 code.
Redfish protocol validator now shows REQ_HEADERS_ODATA_VERSION test passing.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I7d2f4bd9f6b7f03655d7e169ee20f45f9aaa73e3
show more ...
|
| #
7cf436c9
|
| 23-Mar-2022 |
Ed Tanous <edtanous@google.com> |
Implement Expand
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 i
Implement Expand
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
show more ...
|
| #
f4c99e70
|
| 04-Oct-2021 |
Ed Tanous <edtanous@google.com> |
Redfish: Query parameters: Only
Add the query parameter "only" for redfish. The specification is based on DSP0266_1.8.0.
This commit is inspired by the commit that carries the same title, but is la
Redfish: Query parameters: Only
Add the query parameter "only" for redfish. The specification is based on DSP0266_1.8.0.
This commit is inspired by the commit that carries the same title, but is largely unique, namely, in that it adds the core feature to be able to recall handle with a new Response object, and make sure the result gets to the connection. It does this by swapping the handlers and implementing move semantics on the Response object. It definitely needs broken up into a few smaller patches, but it does pass the below tests without any apparent seg faults or ownership issues.
It implements a number of cleanups that deserve their own patches, and will be split up accordingly, but for the moment, I think this is a good start to getting filter and expand support in the future.
Tested: Validator passes (on previous patchset) ~$ curl -i -k -H "X-Auth-Token: $token" -X GET "https://${bmc}/redfish/v1/Systems"
~$ curl -i -k -H "X-Auth-Token: $token" -X GET "https://${bmc}/redfish/v1/Systems?only"
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I123d8ab8bcd88a0b63ff131f6b98548951989755
show more ...
|