summaryrefslogtreecommitdiff
path: root/redfish-core/lib/ut
AgeCommit message (Collapse)AuthorFilesLines
2022-04-05Implement ExpandEd Tanous1-7/+21
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
2022-04-05Redfish: Query parameters: OnlyEd Tanous1-1/+2
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
2022-03-29service root: add ProtocolFeaturesSupportedNan Zhou1-1/+18
This commits adds a dummy ProtocolFeaturesSupported object in the service root. It indicates that none of the Query Parameter is supported. Future commits will add supports for OnlyMemberQuery, ExpandQuery, and so on. Tested: 1. unit test 2. passed QEMU Redfish (which contains Redfish Validator) test This commit is split from these changes: https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/38952 https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/47474 Credits to maxiaochao@inspur.com, ed@tanous.net, and zhanghch05@inspur.com. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I81ff856514528f63a462558a8f18fefe4369edae
2022-03-12Make code compile on clang againEd Tanous1-1/+1
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
2022-03-01Adds new redfish unit testing for servicerootJohn Edward Broadbent1-0/+78
This type of testing can validate bmcwebs generated redfish. The ability to validate the output of bmcweb is extremely useful because it will guarantee correctness in certain cases. This is an example of redfish unit testing. The long term goal is to apply this type of testing to several other redfish responses. To make this change many previous changes were needed * Break serviceroot callback into the free function. * Change ownership of the request and response objects. * Change setCompleteRequestHandler logic Signed-off-by: John Edward Broadbent <jebr@google.com> Change-Id: I324daef0d80eb86f0f7383663727d64776f45279
2021-11-17Revert "Adds new redfish unit testing for serviceroot"Ed Tanous1-63/+0
This reverts commit d8f8b2ef4c73f38ec466861b753b71eaabae271c. Reason for revert: Broke the build. Other patches got reverted. Change-Id: I4922f516ca08660f5fdc725b2c3ec8831386b4dd
2021-11-17Adds new redfish unit testing for servicerootJohn Edward Broadbent1-0/+63
This type of testing can validate bmcwebs generated redfish. The ability to validate the output of bmcweb is extremely useful because it will guarantee correctness in certain cases. This is an example of redfish unit testing. The long term goal is to apply this type of testing to several other redfish responses. To make this change many previous changes were needed * Break serviceroot callback into the free function. * Change ownership of the request and response objects. * Change setCompleteRequestHandler logic Signed-off-by: John Edward Broadbent <jebr@google.com> Change-Id: I560cbb0309c25670cacd81c32bccae3445ccca7b