summaryrefslogtreecommitdiff
path: root/redfish-core/lib/update_service.hpp
AgeCommit message (Collapse)AuthorFilesLines
2021-09-18Make fewer copiesEd Tanous1-9/+11
There are apparently places where we make complete copies of the request structure, including the body data within it. Recently, 59b98b2222fddbea3d6f678d9e94006521f0c381 came along and made the size of the Request structure include the body payload. This is good for object ownership, but bad for code that wants to make a copy. This commit tries to do something less insane, and construct the Payload object (which only really includes the http headers, uri and method) before jumping into callback hell, thus meaning that the Payload object is copied 4 times instead of the Request object. Tested: Code compiles. Deleted the boost::beast::http::message copy constructor, and observed that new code now compiles without needing a copy. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ie81bade61fb1f6f392b163f98c84540e09a26690
2021-07-08Automate PrivilegeRegistry to codeEd Tanous1-6/+7
This commit attempts to automate the creation of our privileges structures from the redfish privilege registry. It accomplishes this by updating parse_registries.py to also pull down the privilege registry from DMTF. The script then generates privilege_registry.hpp, which include const defines for all the privilege registry entries in the same format that the Privileges struct accepts. This allows new clients to simply reference the variable to these privilege structures, instead of having to manually (ie error pronely) put the privileges in themselves. This commit updates all the routes. For the moment, override and OEM schemas are not considered. Today we don't have any OEM-specific Redfish routes, so the existing ones inherit their parents schema. Overrides have other issues, and are already incorrect as Redfish defines them. Binary size remains unchanged after this patchset. Tested: Ran redfish service validator Ran test case from f9a6708c4c6490257e2eb6a8c04458f500902476 to ensure that the new privileges constructor didn't cause us to regress the brace construction initializer. Checked binary size with: gzip -c $BBPATH/tmp/work/s7106-openbmc-linux-gnueabi/obmc-phosphor-image/1.0-r0/rootfs/usr/bin/bmcweb | wc -c 1244048 (tested on previous patchset) Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ideede3d5b39d50bffe7fe78a0848bdbc22ac387f
2021-06-16Remove ambiguous privileges constructorEd Tanous1-6/+6
There are a number of endpoints that assume that a given routes privileges are governed by a single set of privileges, instead of multiple sets ORed together. To handle this, there were two overloads of the privileges() method, one that took a vector of Privileges, and one that took an initializer_list of const char*. Unfortunately, this leads some code in AccountService to pick the wrong overload when it's called like this .privileges( {{"ConfigureUsers"}, {"ConfigureManager"}, {"ConfigureSelf"}}) This is supposed to be "User must have ConfigureUsers, or ConfigureManager, or ConfigureSelf". Currently, because it selects the wrong overload, it computes to "User must have ConfigureUsers AND ConfigureManager AND ConfigureSelf. The double braces are supposed to cause this to form a vector of Privileges, but it appears that the initializer list gets consumed, and the single invocation of initializer list is called. Interestingly, trying to put in a privileges overload of intializer_list<initializer_list<const char*>> causes the compilation to fail with an ambiguous call error, which is what I would've expected to see previously in this case, but alas, I'm only a novice when it comes to how the C++ standard works in these edge cases. This is likely due in part to the fact that they were templates of an unused template param (seemingly copied from the previous method) and SFINAE rules around templates. This commit functionally removes one of the privileges overloads, and adds a second set of braces to every privileges call that previously had a single set of braces. Previous code will not compile now, which is IMO a good thing. This likely popped up in the Node class removal, because the Node class explicitly constructs a vector of Privilege objects, ensuing it can hit the right overload Tested: Ran Redfish service validator Tested the specific use case outlined on discord with: Creating a new user with operator privilege: ``` redfishtool -S Always -u root -p 0penBmc -vvvvvvvvv -r 192.168.7.2 AccountService adduser foo mysuperPass1 Operator ``` Then attempting to list accounts: ``` curl -vvvv --insecure --user foo:mysuperPass1 https://192.168.7.2/redfish/v1/AccountService/Accounts/foo ``` Which succeeded and returned the account in question. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I83e62b70e97f56dc57d43b9081f333a02fe85495
2021-06-10Redfish: Fix bug that cause validator failedChicago Duan1-2/+2
MaxImageSizeBytes was added in this commit: https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/43775 but the UpdateService version number was not changed. MaxImageSizeBytes in UpdateService belongs to UpdateService.v1_5_0.json https://redfish.dmtf.org/schemas/v1/UpdateService.v1_5_0.json Tested: Validator passes Signed-off-by: Chicago Duan <duanzhijia01@inspur.com> Change-Id: I68f01ce5fb8f8e715c0e0fad6a34ab609acca01b
2021-06-09Add support for MaxImageSizeBytes in UpdateServiceTejas Patil1-0/+6
This commit adds the support for "MaxImageSizeBytes" property in the "/redfish/v1/UpdateService/" Redfish URI. This property indicates that, the maximum size of the software update image, that clients can send to this Update Service. Tested: - Redfish Validator Test passed. curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X GET https://${bmc}/redfish/v1/UpdateService { "@odata.id": "/redfish/v1/UpdateService", "@odata.type": "#UpdateService.v1_4_0.UpdateService", "Description": "Service for Software Update", "FirmwareInventory": { "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory" }, "HttpPushUri": "/redfish/v1/UpdateService", "HttpPushUriOptions": { "HttpPushUriApplyTime": { "ApplyTime": "OnReset" } }, "Id": "UpdateService", "MaxImageSizeBytes": 31457280, "Name": "Update Service", "ServiceEnabled": true } Signed-off-by: Tejas Patil <tejaspp@ami.com> Change-Id: Ibc0f3094a50ea7eb274436e4359e05c95d9cec36
2021-06-03Remove Redfish Node classJohn Edward Broadbent1-535/+500
Reduces the total number of lines and will allow for easier testing of the redfish responses. A main purpose of the node class was to set app.routeDynamic(). However now app.routeDynamic can handle the complexity that was once in critical to node. The macro app.routeDynamic() provides a shorter cleaner interface to the unerlying app.routeDyanic call. The old pattern set permissions for 6 interfaces (get, head, patch, put, delete_, and post) even if only one interface is created. That pattern creates unneeded code that can be safely removed with no effect. Unit test for the responses would have to mock the node the class in order to fully test responses. see https://github.com/openbmc/bmcweb/issues/181 The following files still need node to be extracted. virtual_media.hpp account_service.hpp redfish_sessions.hpp ethernet.hpp The files above use a pattern that is not trivial to address. Often their responses call an async lambda capturing the inherited class. ie (https://github.com/openbmc/bmcweb/blob/ffed87b5ad1797ca966d030e7f979770 28d258fa/redfish-core/lib/account_service.hpp#L1393) At a later point I plan to remove node from the files above. Tested: I ran the docker unit test with the following command. WORKSPACE=$(pwd) UNIT_TEST_PKG=bmcweb ./openbmc-build-scripts/run-unit-test-docker.sh I ran the validator and this change did not create any issues. python3 RedfishServiceValidator.py -c config.ini Signed-off-by: John Edward Broadbent <jebr@google.com> Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I147a0289c52cb4198345b1ad9bfe6fdddf57f3df
2021-05-28Adjust parameter name of FirmwareInventoryIdAbhishek Patel1-6/+8
redfish URL "/redfish/v1/UpdateService/FirmwareInventory/ {SoftwareInventoryId}" had parameter called "Members@odata.count". This parameter name is not appropriate because it retrieves data, count of Related Item, from "RelatedItem" parameter, so its name has to be "RelatedItem@odata.count". Implement: Updated name of JSON parameter, also updated code variable name. Tested: Validator passes - Keep primary data and other parameter deleted from JSON data Old JSON data: { "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/ {SoftwareInventoryId}, "@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory", "Description": "BMC image", "Members@odata.count": 1, "Name": "Software Inventory", "RelatedItem": [{ "@odata.id": "/redfish/v1/Managers/bmc" }], } new JSON data: { "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/ {SoftwareInventoryId}, "@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory", "Description": "BMC image", "RelatedItem@odata.count": 1, "Name": "Software Inventory", "RelatedItem": [{ "@odata.id": "/redfish/v1/Managers/bmc" }], } Signed-off-by: Abhishek Patel <Abhishek.Patel@ibm.com> Change-Id: I12c123fc78872890efe2949d2a3a55f882cdd09b
2021-04-08Using AsyncResp everywherezhanghch051-51/+49
Get the core using AsyncResp everywhere, and not have each individual handler creating its own object.We can call app.handle() without fear of the response getting ended after the first tree is done populating. Don't use res.end() anymore. Tested: 1. Validator passed. Signed-off-by: zhanghaicheng <zhanghch05@inspur.com> Change-Id: I867367ce4a0caf8c4b3f4e07e06c11feed0782e8
2021-02-19Start using sdbusplus::message::filename()Ed Tanous1-4/+3
Lots of code gets checked in that does this path checking incorrectly. So much so, that we have it documented in COMMON_ERRORS.md, yet, we persist. This patchset starts using the new object_path::filename() method that was added recently to sdbusplus. Overall, it deletes code, and makes for a much better developer experience. Tested: Pulled down several endpoints and verified that filename() method works properly, and the collections are returned as expected. curl -vvvv --insecure --user root:0penBmc https://192.168.7.2/redfish/v1/AccountService/Accounts Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ief1e0584394fb139678d3453265f7011bc931f3c
2021-01-25Tasks for TFTP uploadAlbert Zhang1-1/+1
This is to change the existing TFTP update into an asynchronous service that uses Redfish Tasks. Tested: TFTP Firmware update through redfish,and get the task to create. curl -k -H "X-Auth-Token: $token" -X POST https://${bmc}/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate -d '{"TransferProtocol":"TFTP","ImageURI":"xx.xx.xx.xx/obmc-phosphor-xxxxx"}' { "@odata.id": "/redfish/v1/TaskService/Tasks/0", "@odata.type": "#Task.v1_4_3.Task", "Id": "0", "TaskState": "Running", "TaskStatus": "OK" } Signed-off-by: Albert Zhang <zhanghaodi@inspur.com> Change-Id: I5d8683f38bf3e29177d90606c5c9fe747a26a876
2021-01-04Implement PercentComplete for code updateGeorge Liu1-0/+2
In order to implement full task support for code update, the PercentComplete property is added to the task service. Testd: Validator passes. curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/TaskService/Tasks/0 { "@odata.id": "/redfish/v1/TaskService/Tasks/0", "@odata.type": "#Task.v1_4_3.Task", ... ... "PercentComplete": 100, "TaskMonitor": "/redfish/v1/TaskService/Tasks/0/Monitor", "TaskState": "Completed", "TaskStatus": "OK" } Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I030bf0bbff098dec2f45158642f149711554285d
2020-12-30Look for Version Already Exists ErrorGunnar Mills1-2/+12
Look for Software.Version.Error.AlreadyExists and return Invalid Upload and Resource Already Exists. Heard from users it is hard to know why the image failed to upload in this case. Tested: Built with PDI and phosphor-bmc-code-mgmt changes and saw the error. curl -k -H "Content-Type: application/octet-stream" -X POST -T $image https://${bmc}/redfish/v1/UpdateService { "Version@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type UpdateService.v1_4_0.UpdateService with the property Version with the value uploaded version already exists.", "MessageArgs": [ "UpdateService.v1_4_0.UpdateService", "Version", "uploaded version" ], "MessageId": "Base.1.8.1.ResourceAlreadyExists", "MessageSeverity": "Critical", "Resolution": "Do not repeat the create operation as the resource has already been created." } ], "error": { "@Message.ExtendedInfo": [ { "@odata.type": "/redfish/v1/$metadata#Message.v1_1_1.Message", "Message": "Invalid file uploaded to /redfish/v1/UpdateService: Image version already exists.", "MessageArgs": [ "/redfish/v1/UpdateService", "Image version already exists" ], "MessageId": "OpenBMC.0.1.0.InvalidUpload", "MessageSeverity": "Warning", "Resolution": "None." } ], "code": "OpenBMC.0.1.0.InvalidUpload", "message": "Invalid file uploaded to /redfish/v1/UpdateService: Image version already exists." } } Change-Id: Ieab0116650dd64949da6b7ac93254193803f8f90 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-12-18Fix .clang-tidyEd Tanous1-10/+10
camelLower is not a type, camelBack is. Changes were made automatically with clang-tidy --fix-errors To be able to apply changes automatically, the only way I've found that works was to build the version of clang/clang-tidy that yocto has, and run the fix script within bitbake -c devshell bmcweb. Unfortunately, yocto has clang-tidy 11, which can apparently find a couple extra errors in tests we already had enabled. As such, a couple of those are also included. Tested: Ran clang-tidy-11 and got a clean result. Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: I9d1080b67f0342229c2f267160849445c065ca51
2020-11-12update_service: fix segmentation violation when updating imagesTim Lee1-3/+0
Symptom: Before repo this issue symptom, we need to enable bmcweb debug option. Due to this issue is relevant to timing about callback function lifecycle. Thus, enable debugging will increae issue repo rate almost 100%. Bmcweb.service was terminated abnormal after updating images via Redfish curl command. According debug log, bmcweb.service exited with status=11/SEGV (Segmentation Violation). That's usually a bug in a program such as pointer, null pointer, arrays and so on. The default action for a program upon receiving SIGSEGV is abnormal termination. Coredump analysis: From the backtrace result that is point to softwareInterfaceAdded() of caller: at/home/tim/git/runbmc/openbmc/olympus-build/tmp/work/armv7a-openbmc-linux-gnueabi/bmcweb/ 1.0+gitAUTOINC+72d566d9eb-r0/recipe-sysroot/usr/include/c++/10.1.0/bits/shared_ptr.h:149 at/home/tim/git/runbmc/openbmc/olympus-build/tmp/work/armv7a-openbmc-linux-gnueabi/bmcweb/ 1.0+gitAUTOINC+72d566d9eb-r0/git/redfish-core/include/../lib/update_service.hpp:315 SEGV happen after executing line 84 in softwareInterfaceAdded() line: 83 // Found our interface, disable callbacks line: 84 fwUpdateMatcher = nullptr; line: 86 // Retrieve service and activate line: 87 crow::connections::systemBus->async_method_call( Root cause: From coredump and backtrace result that segmentation violation issue in softwareInterfaceAdded(). softwareInterfaceAdded() is a callback function will be called by monitorForSoftwareAvailable(). When there is a signal relate to member is InterfacesAdded in object path /xyz/operbmc_project/software. However, this callback function pointer will set to NULL poniter in itself callback function. Thus, there is possible to hit SEGV issue when accessing to NULL function pointer. Solution: Set fwUpdateMatcher as nullptr should remove it from softwareInterfaceAdded(). And that will be set as nullptr by call cleanUp() in monitorForSoftwareAvailable() after got response. Thus, it save to remove this line and avoid this SEGV then cause bmcweb.service terminated abnormal. Tested: Update BMC image using UpdateService POST action: curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/octet-stream" -X POST -T tim/obmc-phosphor-image-olympus-nuvoton-20200921031720.static.mtd.tar https://${bmc}/redfish/v1/UpdateService Update BMC image using UpdateService.SimpleUpdate POST action: curl -k -H "X-Auth-Token: $token" -X POST https://${bmc}/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate -d '{"ImageURI":"tftp://10.103.61.175/obmc-phosphor-image-olympus-nuvoton-20200921031720.static.mtd.tar"}' Signed-off-by: Tim Lee <timlee660101@gmail.com> Change-Id: I01dcf56893b5ca64fe1d45f29f3f858761ccf2a8
2020-10-23Turn on ALL perf checksEd Tanous1-4/+4
1st, alphabetize the tidy-list for good housekeeping. Next, enable all the clang-tidy performance checks, and resolve all the issues. most of the issues boil down to: 1. Using std::move on const variables. This does nothing. 2. Passing big variables (like std::string) by value. 3. Using double quotes on a find call, which constructs an intermediate string, rather than using the character overload. Tested Loaded on system, logged in successfully and pulled down webui-vue. No new errors. Walked the Redfish tree a bit, and observed no new problems. Ran redfish service validator. Got no new failures (although there are a lot of log service deprecation warnings that we should look at). Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: I2238958c4b22c1e554e09a0a1787c744bdbca43e
2020-10-15Lots of performance improvementsEd Tanous1-6/+5
(In the voice of the kid from sixth sense) I see string copies... Apparently there are a lot of places we make unnecessary copies. This fixes all of them. Not sure how to split this up into smaller patches, or if it even needs split up. It seems pretty easy to review to me, because basically every diff is identical. Change-Id: I22b4ae4f96f7e4082d2bc701098a04f7bed95369 Signed-off-by: Ed Tanous <ed@tanous.net> Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
2020-08-24update_service: add sufficient delay for fw object to get createdChalapathi Venkataramashetty1-1/+1
Add support to increase timeoutTimeSeconds to 10 secs to allow firmware object to create successfully to proceed for firmware update. Tested: Redfish validator passed. Updated the firmware using redfish for 16 times continuously. POST: https://<BMC_IP>/redfish/v1/UpdateService/ with <BMC_signed_cap> binary file firmware updated. { "@odata.id": "/redfish/v1/TaskService/Tasks/0", "@odata.type": "#Task.v1_4_3.Task", "Id": "0", "TaskState": "Running", "TaskStatus": "OK" } Signed-off-by: Chalapathi Venkataramashetty <chalapathix.venkataramashetty@intel.com> Change-Id: If86862c0c6519b3591bfa7e04cbb1ff13659b0d5
2020-08-20Increase TFTP timeoutGunnar Mills1-3/+3
IBM, the only user of TFTP, has a system with 200MB images. https://github.com/openbmc/openbmc/blob/master/meta-ibm/recipes-phosphor/bmcweb/bmcweb_%25.bbappend#L2 In the future this system's images might grow even larger. Currently timed the TFTP transfer time at 2 min 37 sec on this system. Bumped to 10 min though for room for the image to grow and pad the timeout in case an even slower network. Considered a parameter, can add if it would ever get set to a different value. Tested: TFTP update from GUI works with https://gerrit.openbmc-project.xyz/c/openbmc/webui-vue/+/35738 Change-Id: I1eed110c9605ee1e116670e46f561c66676e5eed Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-08-17Enable unused variable warnings and resolveEd Tanous1-8/+8
This commit enables the "unused variables" warning in clang. Throughout this, it did point out several issues that would've been functional bugs, so I think it was worthwhile. It also cleaned up several unused variable from old constructs that no longer exist. Tested: Built with clang. Code no longer emits warnings. Downloaded bmcweb to system and pulled up the webui, observed webui loads and logs in properly. Change-Id: I51505f4222cc147d6f2b87b14d7e2ac4a74cafa8 Signed-off-by: Ed Tanous <ed@tanous.net>
2020-08-17Remove middlewaresEd Tanous1-6/+4
Middlewares, while kinda cool from an academic standpoint, make our build times even worse than they already are. Given that we only really use 1 real middleware today (token auth) and it needs to move into the parser mode anyway (for security limiting buffer sizes), we might as well use this as an opportunity to delete some code. Some other things that happen: 1. Persistent data now moves out of the crow namespace 2. App is no longer a template 3. All request_routes implementations no longer become templates. This should be a decent (unmeasured) win on compile times. This commit was part of a commit previously called "various cleanups". This separates ONLY the middleware deletion part of that. Note, this also deletes about 400 lines of hard to understand code. Change-Id: I4c19e25491a153a2aa2e4ef46fc797bcb5b3581a Signed-off-by: Ed Tanous <ed@tanous.net>
2020-07-10Codespell redfish-core spelling fixesGunnar Mills1-2/+2
These spelling errors were found using https://github.com/codespell-project/codespell Tested: Top commit (along with this) was built and ran against validator. Change-Id: Ic9dce27b1de8567eedf7753164ef564d3aedf8ca Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-06-27Update Service: Change error message based on error logsJames Feist1-2/+65
THis adds support for better error responses based on the logs generated by phosphor-software-manager. Tested: Got 400 error with different messages based on failure type { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message", "Message": "Invalid file uploaded to /redfish/v1/UpdateService: Invalid archive.", "MessageArgs": [ "/redfish/v1/UpdateService", "invalid archive" ], "MessageId": "OpenBMC.0.1.0.InvalidUpload", "Resolution": "None.", "Severity": "Warning" } ], "code": "OpenBMC.0.1.0.InvalidUpload", "message": "Invalid file uploaded to /redfish/v1/UpdateService: Invalid archive." } } { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message", "Message": "Invalid file uploaded to /redfish/v1/UpdateService: Invalid image format.", "MessageArgs": [ "/redfish/v1/UpdateService", "invalid image format" ], "MessageId": "OpenBMC.0.1.0.InvalidUpload", "Resolution": "None.", "Severity": "Warning" } ], "code": "OpenBMC.0.1.0.InvalidUpload", "message": "Invalid file uploaded to /redfish/v1/UpdateService: Invalid image format." } } { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_0_0.Message", "Message": "The resource /redfish/v1/UpdateService was unable to satisfy the request due to unavailability of resources.", "MessageArgs": [ "/redfish/v1/UpdateService" ], "MessageId": "Base.1.4.0.ResourceExhaustion", "Resolution": "Ensure that the resources are available and resubmit the request.", "Severity": "Critical" } ], "code": "Base.1.4.0.ResourceExhaustion", "message": "The resource /redfish/v1/UpdateService was unable to satisfy the request due to unavailability of resources." } } Change-Id: Ida9a23c10aedbf9a48c96f4050a04e06bddff284 Signed-off-by: James Feist <james.feist@linux.intel.com>
2020-06-11clang-format: update to latest from docs repoGunnar Mills1-52/+51
This is from openbmc/docs/style/cpp/.clang-format Other OpenBMC repos are doing the same. Tested: Built and validator passed. Change-Id: Ief26c755c9ce012823e16a506342b0547a53517a Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-05-28FW Update: Task: Update messagesJames Feist1-38/+85
This adds reporting of percent updated and changes "staged" to paused to indicate some further action must happen to change state to Completed. Tested: validator passed "Messages": [ { "@odata.type": "#Message.v1_0_0.Message", "Message": "The task with id 2 has started.", "MessageArgs": [ "2" ], "MessageId": "TaskEvent.1.0.1.TaskStarted", "Resolution": "None.", "Severity": "OK" }, { "@odata.type": "#Message.v1_0_0.Message", "Message": "The task with id 2 has changed to progress 5 percent complete.", "MessageArgs": [ "2", 5 ], "MessageId": "TaskEvent.1.0.1.TaskProgressChanged", "Resolution": "None.", "Severity": "OK" }, { "@odata.type": "#Message.v1_0_0.Message", "Message": "The task with id 2 has changed to progress 10 percent complete.", "MessageArgs": [ "2", 10 ], "MessageId": "TaskEvent.1.0.1.TaskProgressChanged", "Resolution": "None.", "Severity": "OK" }, { "@odata.type": "#Message.v1_0_0.Message", "Message": "The task with id 2 has changed to progress 15 percent complete.", "MessageArgs": [ "2", 15 ], "MessageId": "TaskEvent.1.0.1.TaskProgressChanged", "Resolution": "None.", "Severity": "OK" }, { "@odata.type": "#Message.v1_0_0.Message", "Message": "The task with id 2 has changed to progress 20 percent complete.", "MessageArgs": [ "2", 20 ], "MessageId": "TaskEvent.1.0.1.TaskProgressChanged", "Resolution": "None.", "Severity": "OK" }, { "@odata.type": "#Message.v1_0_0.Message", "Message": "The task with id 2 has changed to progress 25 percent complete.", "MessageArgs": [ "2", 25 ], "MessageId": "TaskEvent.1.0.1.TaskProgressChanged", "Resolution": "None.", "Severity": "OK" }, { "@odata.type": "#Message.v1_0_0.Message", "Message": "The task with id 2 has changed to progress 30 percent complete.", "MessageArgs": [ "2", 30 ], "MessageId": "TaskEvent.1.0.1.TaskProgressChanged", "Resolution": "None.", "Severity": "OK" }, { "@odata.type": "#Message.v1_0_0.Message", "Message": "The task with id 2 has changed to progress 35 percent complete.", "MessageArgs": [ "2", 35 ], "MessageId": "TaskEvent.1.0.1.TaskProgressChanged", "Resolution": "None.", "Severity": "OK" }, { "@odata.type": "#Message.v1_0_0.Message", "Message": "The task with id 2 has changed to progress 40 percent complete.", "MessageArgs": [ "2", 40 ], "MessageId": "TaskEvent.1.0.1.TaskProgressChanged", "Resolution": "None.", "Severity": "OK" }, { "@odata.type": "#Message.v1_0_0.Message", "Message": "The task with id 2 has changed to progress 45 percent complete.", "MessageArgs": [ "2", 45 ], "MessageId": "TaskEvent.1.0.1.TaskProgressChanged", "Resolution": "None.", "Severity": "OK" }, { "@odata.type": "#Message.v1_0_0.Message", "Message": "The task with id 2 has changed to progress 50 percent complete.", "MessageArgs": [ "2", 50 ], "MessageId": "TaskEvent.1.0.1.TaskProgressChanged", "Resolution": "None.", "Severity": "OK" }, { "@odata.type": "#Message.v1_0_0.Message", "Message": "The task with id 2 has changed to progress 55 percent complete.", "MessageArgs": [ "2", 55 ], "MessageId": "TaskEvent.1.0.1.TaskProgressChanged", "Resolution": "None.", "Severity": "OK" }, { "@odata.type": "#Message.v1_0_0.Message", "Message": "The task with id 2 has changed to progress 60 percent complete.", "MessageArgs": [ "2", 60 ], "MessageId": "TaskEvent.1.0.1.TaskProgressChanged", "Resolution": "None.", "Severity": "OK" }, { "@odata.type": "#Message.v1_0_0.Message", "Message": "The task with id 2 has changed to progress 65 percent complete.", "MessageArgs": [ "2", 65 ], "MessageId": "TaskEvent.1.0.1.TaskProgressChanged", "Resolution": "None.", "Severity": "OK" }, { "@odata.type": "#Message.v1_0_0.Message", "Message": "The task with id 2 has changed to progress 70 percent complete.", "MessageArgs": [ "2", 70 ], "MessageId": "TaskEvent.1.0.1.TaskProgressChanged", "Resolution": "None.", "Severity": "OK" }, { "@odata.type": "#Message.v1_0_0.Message", "Message": "The task with id 2 has changed to progress 75 percent complete.", "MessageArgs": [ "2", 75 ], "MessageId": "TaskEvent.1.0.1.TaskProgressChanged", "Resolution": "None.", "Severity": "OK" }, { "@odata.type": "#Message.v1_0_0.Message", "Message": "The task with id 2 has changed to progress 80 percent complete.", "MessageArgs": [ "2", 80 ], "MessageId": "TaskEvent.1.0.1.TaskProgressChanged", "Resolution": "None.", "Severity": "OK" }, { "@odata.type": "#Message.v1_0_0.Message", "Message": "The task with id 2 has changed to progress 85 percent complete.", "MessageArgs": [ "2", 85 ], "MessageId": "TaskEvent.1.0.1.TaskProgressChanged", "Resolution": "None.", "Severity": "OK" }, { "@odata.type": "#Message.v1_0_0.Message", "Message": "The task with id 2 has changed to progress 90 percent complete.", "MessageArgs": [ "2", 90 ], "MessageId": "TaskEvent.1.0.1.TaskProgressChanged", "Resolution": "None.", "Severity": "OK" }, { "@odata.type": "#Message.v1_0_0.Message", "Message": "The task with id 2 has changed to progress 95 percent complete.", "MessageArgs": [ "2", 95 ], "MessageId": "TaskEvent.1.0.1.TaskProgressChanged", "Resolution": "None.", "Severity": "OK" }, { "@odata.type": "#Message.v1_0_0.Message", "Message": "The task with id 2 has changed to progress 100 percent complete.", "MessageArgs": [ "2", 100 ], "MessageId": "TaskEvent.1.0.1.TaskProgressChanged", "Resolution": "None.", "Severity": "OK" }, { "@odata.type": "#Message.v1_0_0.Message", "Message": "The task with id 2 has been paused.", "MessageArgs": [ "2" ], "MessageId": "TaskEvent.1.0.1.TaskPaused", "Resolution": "None.", "Severity": "Warning" }, { "@odata.type": "#Message.v1_0_0.Message", "Message": "The task with id 2 has Completed.", "MessageArgs": [ "2" ], "MessageId": "TaskEvent.1.0.1.TaskCompletedOK", "Resolution": "None.", "Severity": "OK" } ], Change-Id: I32103e53486d459fe945a8b451d2092232c12e83 Signed-off-by: James Feist <james.feist@linux.intel.com>
2020-05-14Task: Use TaskEvent messagesJames Feist1-3/+5
Task registry messages make more sense to use for task events then standard registry entries when applicable. Use them. Tested: "Messages": [ { "@odata.type": "#Message.v1_0_0.Message", "Message": "The task with id 0 has started.", "MessageArgs": [ "0" ], "MessageId": "TaskEvent.1.0.1.TaskStarted", "Resolution": "None.", "Severity": "OK" } ], Validator passed Change-Id: I707492544e18def2833e8a2e2216ce803c42c775 Signed-off-by: James Feist <james.feist@linux.intel.com>
2020-03-17Task: Add payload supportJames Feist1-7/+9
This adds the payload values to task responses. Tested: passed validator Change-Id: I50467e28ce8142d198f916ea0c63bd413edcd524 Signed-off-by: James Feist <james.feist@linux.intel.com>
2020-03-12task: add fwupdate supportJames Feist1-1/+71
This adds firmware update task service support. It adds a match and updates the task value when the interface changes. Tested: On successful fwupdate task was created and updated correctly. On failed fwupdate the status went to failed. Change-Id: Id12cc5d5270e8e45498b665e78601c5c30775323 Signed-off-by: James Feist <james.feist@linux.intel.com>
2020-02-27SoftwareInventory: Implement Bios Related ItemGunnar Mills1-6/+4
Was a TODO here with the code commented out. Bios was implemented here: https://github.com/openbmc/bmcweb/commit/d82a3acd1abc04a13f90cef5234416c3e18da0e1 Tested: Ran validator curl -k https://${bmc}/redfish/v1/UpdateService/FirmwareInventory/9f75c5ad { "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/9f75c5ad", "@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory", "Description": "Host image", "Id": "9f75c5ad", "Members@odata.count": 1, "Name": "Software Inventory", "RelatedItem": [ { "@odata.id": "/redfish/v1/Systems/system/Bios" } ], Change-Id: Ifa6148731582cdc7f177e38b19f02fea966738fc Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-02-20Update service: Remove odata.contextGunnar Mills1-7/+0
Redfish made odata.context optional (1.6.0 of DSP0266, Sept 2018). Redfish has removed odata.context from example payloads in the specification (1.7.0 of DSP0266), removed it from the mockups, and Redfish recommended not using. The reason for making optional and removing from mockups/examples, "no one could figure out how to use it and it did not add value". Don't see value in it for our implementation. Change-Id: I0dbf424c8fb91f448da19ce12b0dadb512880204 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-02-03Add support to fetch the 'Updateable' componentsAppaRao Puli1-1/+3
Currently 'Updateable' property value in SoftwareInventory schema is hardcoded. Added support to look through the updateable software associations objects and use it for 'Updateable' Redfish property in SoftwareInventory. Tested: - Checked 'Updateable' Property value for both programmable and non-programmable firmware inventory components and it works as expected. - Ran the Redfish validator and no new issues found. Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> Change-Id: Ia24f942f3afe49674ec3628cac0356a5496ef337
2020-01-07only return fw images in FirmwareInventoryAndrew Geissler1-2/+6
Some systems create a xyz.openbmc_project.Software.Version D-bus object for reasons other then storing a FirmwareInventory object. For example the phosphor-logging code can add it to a log to track what level of code was running when a log was created. These should not show up in the Redfish FirmwareInventory API. Tested: Before this change, 3 and 4 correlated to phosphor-logs on system curl -k -H "X-Auth-Token: $TOKEN" -X GET https://${BMC_IP}/redfish/v1/UpdateService/FirmwareInventory/ { "@odata.context": "/redfish/v1/$metadata#SoftwareInventoryCollection.SoftwareInventoryCollection", "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory", "@odata.type": "#SoftwareInventoryCollection.SoftwareInventoryCollection", "Members": [ { "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/3" }, { "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/4" }, { "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/224cd310" }, { "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/3b296352" }, { "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/e9b7a436" } ], "Members@odata.count": 5, "Name": "Software Inventory Collection" } After: Verified 3 and 4 were no longer returned in FirmwareInventory curl -k -H "X-Auth-Token: $TOKEN" -X GET https://${BMC_IP}/redfish/v1/UpdateService/FirmwareInventory/ { "@odata.context": "/redfish/v1/$metadata#SoftwareInventoryCollection.SoftwareInventoryCollection", "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory", "@odata.type": "#SoftwareInventoryCollection.SoftwareInventoryCollection", "Members": [ { "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/224cd310" }, { "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/2d556644" }, { "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/7432374c" } ], "Members@odata.count": 3, "Name": "Software Inventory Collection" } Ran Redfish validator and ensured no errors Change-Id: I3e99fe7570b87b83f75918873267fb1587add182 Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
2019-12-12Redfish: Support health status of firmware inventory objectsCarol Wang1-1/+0
Support health status of firmware inventory objects based on the mapping relationship: [dbus status] [redfish state] [redfish health] Ready Disabled OK Activating Updating OK Active Enabled OK NotReady Disabled Warning Invalid Disabled Warning Failed Disabled Warning Tested: [dbus status] --> [redfish state] --> [redfish health] 1. Ready --> Disabled --> OK $ curl -k -H "X-Auth-Token: $token" https://$bmc/xyz/openbmc_project/software/enumerate { ... "/xyz/openbmc_project/software/9557fe67": { "Activation": "xyz.openbmc_project.Software.Activation.Activations.Ready", ... } $curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/UpdateService/FirmwareInventory/9557fe67 { "@odata.context": "/redfish/v1/$metadata#SoftwareInventory.SoftwareInventory", "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/9557fe67", ... "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Disabled" }, ... } 2. Activating --> Updating --> OK $ curl -k -H "X-Auth-Token: $token" https://$bmc/xyz/openbmc_project/software/enumerate { ... "/xyz/openbmc_project/software/9557fe67": { "Activation": "xyz.openbmc_project.Software.Activation.Activations.Activating", ... } $curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/UpdateService/FirmwareInventory/9557fe67 { "@odata.context": "/redfish/v1/$metadata#SoftwareInventory.SoftwareInventory", "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/9557fe67", ... "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Updating" }, ... } 3. Active --> Enabled --> OK $ curl -k -H "X-Auth-Token: $token" https://$bmc/xyz/openbmc_project/software/enumerate { "data": { "/xyz/openbmc_project/software/9557fe67": { "Activation": "xyz.openbmc_project.Software.Activation.Activations.Active", ... } $ curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/UpdateService/FirmwareInventory/9557fe67 { "@odata.context": "/redfish/v1/$metadata#SoftwareInventory.SoftwareInventory", "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/9557fe67", ... "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" }, ... } 4. Invalid --> Disabled --> Warning # busctl call xyz.openbmc_project.Software.BMC.Updater /xyz/openbmc_project/software/c0bbba12 \ org.freedesktop.DBus.Properties Set ssv xyz.openbmc_project.Software.Activation Activation s \ xyz.openbmc_project.Software.Activation.Activations.Invalid $ curl -k -H "X-Auth-Token: $token" https://$bmc/xyz/openbmc_project/software/enumerate { ... "/xyz/openbmc_project/software/c0bbba12": { "Activation": "xyz.openbmc_project.Software.Activation.Activations.Invalid", ... } $ curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/UpdateService/FirmwareInventory/c0bbba12 { "@odata.context": "/redfish/v1/$metadata#SoftwareInventory.SoftwareInventory", "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/c0bbba12", ... "Status": { "Health": "Warning", "HealthRollup": "OK", "State": "Disabled" }, ... } 5. NotReady --> Disabled --> Warning # busctl call xyz.openbmc_project.Software.BMC.Updater /xyz/openbmc_project/software/c0bbba12 \ org.freedesktop.DBus.Properties Set ssv xyz.openbmc_project.Software.Activation Activation s \ xyz.openbmc_project.Software.Activation.Activations.NotReady $ curl -k -H "X-Auth-Token: $token" https://$bmc/xyz/openbmc_project/software/enumerate { ... "/xyz/openbmc_project/software/c0bbba12": { "Activation": "xyz.openbmc_project.Software.Activation.Activations.NotReady", ... } $ curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/UpdateService/FirmwareInventory/c0bbba12 { "@odata.context": "/redfish/v1/$metadata#SoftwareInventory.SoftwareInventory", "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/c0bbba12", ... "Status": { "Health": "Warning", "HealthRollup": "OK", "State": "Disabled" }, ... } 6. Failed --> Disabled --> Warning # busctl call xyz.openbmc_project.Software.BMC.Updater /xyz/openbmc_project/software/c0bbba12 \ org.freedesktop.DBus.Properties Set ssv xyz.openbmc_project.Software.Activation Activation s \ xyz.openbmc_project.Software.Activation.Activations.Failed $ curl -k -H "X-Auth-Token: $token" https://$bmc/xyz/openbmc_project/software/enumerate { ... "/xyz/openbmc_project/software/c0bbba12": { "Activation": "xyz.openbmc_project.Software.Activation.Activations.Failed", ... } $ curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/UpdateService/FirmwareInventory/c0bbba12 { "@odata.context": "/redfish/v1/$metadata#SoftwareInventory.SoftwareInventory", "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/c0bbba12", ... "Status": { "Health": "Warning", "HealthRollup": "OK", "State": "Disabled" }, ... } Validator tool result: Counter({'pass': 2992, 'skipOptional': 2470, 'metadataNamespaces': 1605, 'passGet': 189, 'serviceNamespaces': 71, 'invalidPropertyValue': 10, 'warningPresent': 6, 'passAction': 6, 'optionalAction': 5, 'warnDeprecated': 2, 'unverifiedComplexAdditional': 1}) Validation has succeeded. Change-Id: Ic475f56d19c0be01ca7aebf67a3f6814d35bcacd Signed-off-by: Carol Wang <wangkair@cn.ibm.com>
2019-12-04Redfish: ApplyTime property GET and PATCH supportJayashankar Padath1-33/+96
This change is to GET and PATCH the ApplyTime property using the UpdateServce redfish schema. GET request can be used to check the value before initiating the BMC image upload and activation. PATCH request can be used to update the ApplyTime value. If the ApplyTime value is Immediate, force-reboot.service gets called which reboots the BMC. If the ApplyTime value is OnReset, no force reboot will be triggered and the new BMC image will be functional till the user decideds to reboot the BMC manually. Tested: Changes passed the Redfish-Service-Validator test. Success Scenarios: 1. If the value of ApplyTime is Immediate (GET request) GET https://$bmc/redfish/v1/UpdateService { "@odata.context": "/redfish/v1/$metadata#UpdateService.UpdateService", "@odata.id": "/redfish/v1/UpdateService", "@odata.type": "#UpdateService.v1_2_0.UpdateService", "ApplyTime": "Immediate", "Description": "Service for Software Update", "FirmwareInventory": { "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory" }, "HttpPushUri": "/redfish/v1/UpdateService", "Id": "UpdateService", "Name": "Update Service", "ServiceEnabled": true } 2. PATCH request to change value to OnReset: PATCH -d '{ "HttpPushUriOptions": { "HttpPushUriApplyTime": { "ApplyTime""OnReset"}}}' https://${bmc}/redfish/v1/UpdateService { "@Message.ExtendedInfo": [ { "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message", "Message": "Successfully Completed Request", "MessageArgs": [], "MessageId": "Base.1.4.0.Success", "Resolution": "None", "Severity": "OK" } ] } Error Scenarios: 1. Test by giving wrong HttpPushUriOptions name [Given as "HttpPushUriOptions1"] PATCH -d '{ "HttpPushUriOptions1": { "HttpPushUriApplyTime": { "ApplyTime":"Immediate"}}}' https://${bmc}/redfish/v1/UpdateService { "HttpPushUriOptions1@Message.ExtendedInfo": [ { "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message", "Message": "The property HttpPushUriOptions1 is not in the list of valid properties for the resource.", "MessageArgs": [ "HttpPushUriOptions1" ], "MessageId": "Base.1.4.0.PropertyUnknown", "Resolution": "Remove the unknown property from the request body and resubmit the request if the operation failed.", "Severity": "Warning" } ] } 2. Test by giving wrong HttpPushUriApplyTime name [Given as "HttpPushUriApplyTime1"] PATCH -d '{ "HttpPushUriOptions": { "HttpPushUriApplyTime1": { "ApplyTime:"Immediate"}}}' https://${bmc}/redfish/v1/UpdateService { "HttpPushUriApplyTime1@Message.ExtendedInfo": [ { "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message", "Message": "The property HttpPushUriApplyTime1 is not in the list of valid properties for the resource.", "MessageArgs": [ "HttpPushUriApplyTime1" ], "MessageId": "Base.1.4.0.PropertyUnknown", "Resolution": "Remove the unknown property from the request body and resubmit the request if the operation failed.", "Severity": "Warning" } ] } 3. Test by giving wrong ApplyTime name [Given as "ApplyTime1"] PATCH -d '{ "HttpPushUriOptions": { "HttpPushUriApplyTime": { "ApplyTime1":"Immediate"}}}' https://${bmc}/redfish/v1/UpdateService { "ApplyTime1@Message.ExtendedInfo": [ { "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message", "Message": "The property ApplyTime1 is not in the list of valid properties for the resource.", "MessageArgs": [ "ApplyTime1" ], "MessageId": "Base.1.4.0.PropertyUnknown", "Resolution": "Remove the unknown property from the request body and resubmit the request if the operation failed.", "Severity": "Warning" } ] } 4. Giving wrong ApplyTime value ["Immediat" instead of "Immediate"] PATCH -d '{ "HttpPushUriOptions": { "HttpPushUriApplyTime": { "ApplyTime":"Immediat"}}}' https://${bmc}/redfish/v1/UpdateService { "ApplyTime@Message.ExtendedInfo": [ { "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message", "Message": "The value Immediat for the property ApplyTime is not in the list of acceptable values.", "MessageArgs": [ "Immediat", "ApplyTime" ], "MessageId": "Base.1.4.0.PropertyValueNotInList", "Resolution": "Choose a value from the enumeration list that the implementation can support and resubmit the request if the operation failed.", "Severity": "Warning" } ] } 5. NULL value given for "HttpPushUriOptions" PATCH -d '{ "HttpPushUriOptions": ""}' https://${bmc}/redfish/v1/UpdateSrvice { "HttpPushUriOptions@Message.ExtendedInfo": [ { "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message", "Message": "The value \"\" for the property HttpPushUriOptions is of a different type than the property can accept.", "MessageArgs": [ "\"\"", "HttpPushUriOptions" ], "MessageId": "Base.1.4.0.PropertyValueTypeError", "Resolution": "Correct the value for the property in the request body and resubmit the request if the operation failed.", "Severity": "Warning" } ] } 6. NULL value given for "HttpPushUriApplyTime" PATCH -d '{ "HttpPushUriOptions": { "HttpPushUriApplyTime":""}}' https:/${bmc}/redfish/v1/UpdateService { "HttpPushUriApplyTime@Message.ExtendedInfo": [ { "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message", "Message": "The value \"\" for the property HttpPushUriApplyTime is of a different type than the property can accept.", "MessageArgs": [ "\"\"", "HttpPushUriApplyTime" ], "MessageId": "Base.1.4.0.PropertyValueTypeError", "Resolution": "Correct the value for the property in the request body and resubmit the request if the operation failed.", "Severity": "Warning" } ] } 7. NULL value given for "HttpPushUriApplyTime" PATCH -d '{ "HttpPushUriOptions": { "HttpPushUriApplyTime":{ "ApplyTime":""}}}' https://${bmc}/redfish/v1/UpdateService { "ApplyTime@Message.ExtendedInfo": [ { "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message", "Message": "The value for the property ApplyTime is not in the list of acceptable values.", "MessageArgs": [ "", "ApplyTime" ], "MessageId": "Base.1.4.0.PropertyValueNotInList", "Resolution": "Choose a value from the enumeration list that the implementation can support and resubmit the request if the operation failed.", "Severity": "Warning" } ] } Signed-off-by: Jayashankar Padath <jayashankar.padath@in.ibm.com> Change-Id: Icd01bb6c102c0a24285c79ccf4d41fd5fe53f0ed
2019-12-02Add "Retry-After" header for temporarily unavailable messagesJason M. Bills1-1/+0
Whenever the Redfish response is that a service is temporarily unavailable, the "Retry-After" header is added with the same value, so just set the header automatically with the response. Tested: Confirmed that the "Retry-After" header is set correctly with the Redfish temporarily unavailable message. Change-Id: I9c940be94d9d284b9633c5caa2ce71ade76d22d5 Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
2019-10-11Fix a bunch of warningsEd Tanous1-10/+7
using the list of warnings from here: https://github.com/lefticus/cppbestpractices/blob/e73393f25a85f83fed7399d8b65cb117d00b2231/02-Use_the_Tools_Available.md#L100 Seems like a good place to start, and would improve things a bit type-wise. This patchset attempts to correct all the issues in one shot. Tested: It builds. Will test various subsystems that have been touched Signed-off-by: Ed Tanous <ed.tanous@intel.com> Change-Id: I588c26440e5a97f718a0f0ea74cc84107d53aa1e
2019-10-10SoftwareInventory: Catch more interfacesJames Feist1-4/+2
Expand the path to a larger namespace, and allow non updateable interfaces to not error out. Tested: More interfaces appeared without error Change-Id: I4a6e3092c868cb5f3fe66401269d5c99f69328c8 Signed-off-by: James Feist <james.feist@linux.intel.com>
2019-10-08update_service: s/update/imageJames Feist1-2/+2
Not all firmware is updateable, rename it to make sense. Tested: "Description": "ME image" Change-Id: I7f78032726e9e102e9626ae1c788b7be30db2651 Signed-off-by: James Feist <james.feist@linux.intel.com>
2019-09-23Fix: Only return error info in invalid URI caseAyushi Smriti1-8/+8
Collection schemas return some valuable parameter information values on get query, even when the URI is invalid and 404/400 error code is returned. Fix for the same is provided by packing the json response at proper places and returning only the required error info, for security reasons. Tested: Verified by redfish GET query for invalid uri cases. Only error msg and info is returned. Signed-off-by: Ayushi Smriti <smriti.ayushi@linux.intel.com> Change-Id: Iae45da86c2d2adbc39d78f7c267d551d4e6525f2
2019-07-03Return error on invalid swIdAndrew Geissler1-0/+11
Tested: Before: curl -k -H "X-Auth-Token: $TOKEN" -X GET https://${BMC_IP}/redfish/v1/UpdateService/FirmwareInventory/invalidSwId { "@odata.context": "/redfish/v1/$metadata#SoftwareInventory.SoftwareInventory", "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/invalidSwId", "@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory", "Name": "Software Inventory", "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" }, "Updateable": false } After: curl -k -H "X-Auth-Token: $TOKEN" -X GET https://${BMC_IP}/redfish/v1/UpdateService/FirmwareInventory/invalidSwId { "@odata.context": "/redfish/v1/$metadata#SoftwareInventory.SoftwareInventory", "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/invalidSwId", "@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory", "Name": "Software Inventory", "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" }, "Updateable": false, "error": { "@Message.ExtendedInfo": [ { "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message", "Message": "The resource at the URI /redfish/v1/UpdateService/FirmwareInventory/invalidSwId was not found.", "MessageArgs": [ "/redfish/v1/UpdateService/FirmwareInventory/invalidSwId" ], "MessageId": "Base.1.4.0.ResourceMissingAtURI", "Resolution": "Place a valid resource at the URI or correct the URI and resubmit the request.", "Severity": "Critical" } ], "code": "Base.1.4.0.ResourceMissingAtURI", "message": "The resource at the URI /redfish/v1/UpdateService/FirmwareInventory/invalidSwId was not found." } } Change-Id: I4dbf535301d55ffff8f2a652d112e08db040d1b1 Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
2019-07-02fwstatus: Enhance state of firmware inventoryAndrew Geissler1-53/+10
Currently there is no mechanism for a user to know the status of their firmware update over redfish. The primary focus of this commit is to provide status of a firmware update. There is still some ongoing discussion on using the Health field to better explain error conditions. A forum post with DMTF has been opened for clarification in this area but this commit does get things going in the right direction. It provides a user with the status of their update and gives them a simple Enabled/Disabled to know if it worked. Tested: - Firmware update in progress curl -k -H "X-Auth-Token: $TOKEN" -X GET https://${BMC_IP}/redfish/v1/UpdateService/FirmwareInventory/92e57fc7 { "@odata.context": "/redfish/v1/$metadata#SoftwareInventory.SoftwareInventory", "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/92e57fc7", "@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory", "Description": "BMC update", "Id": "92e57fc7", "Members@odata.count": 1, "Name": "Software Inventory", "RelatedItem": [ { "@odata.id": "/redfish/v1/Managers/bmc" } ], "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Updating" }, "Updateable": false, "Version": "2.7.0-dev-926-g79ca37b3d" } - Firmware update complete curl -k -H "X-Auth-Token: $TOKEN" -X GET https://${BMC_IP}/redfish/v1/UpdateService/FirmwareInventory/92e57fc7 { "@odata.context": "/redfish/v1/$metadata#SoftwareInventory.SoftwareInventory", "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/92e57fc7", "@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory", "Description": "BMC update", "Id": "92e57fc7", "Members@odata.count": 1, "Name": "Software Inventory", "RelatedItem": [ { "@odata.id": "/redfish/v1/Managers/bmc" } ], "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" }, "Updateable": false, "Version": "2.7.0-dev-926-g79ca37b3d" } - Firmware update failed (xyz.openbmc_project.Software.Activation.Activations.Failed) curl -k -H "X-Auth-Token: $TOKEN" -X GET https://${BMC_IP}/redfish/v1/UpdateService/FirmwareInventory/3d02a163 { "@odata.context": "/redfish/v1/$metadata#SoftwareInventory.SoftwareInventory", "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/3d02a163", "@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory", "Description": "BMC update", "Id": "3d02a163", "Members@odata.count": 1, "Name": "Software Inventory", "RelatedItem": [ { "@odata.id": "/redfish/v1/Managers/bmc" } ], "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Disabled" }, "Updateable": false, "Version": "2.7.0-dev-940-geb79ec582" } - Firmware update status of Host curl -k -H "X-Auth-Token: $TOKEN" -X GET https://${BMC_IP}/redfish/v1/UpdateService/FirmwareInventory/9a8028ec { "@odata.context": "/redfish/v1/$metadata#SoftwareInventory.SoftwareInventory", "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/9a8028ec", "@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory", "Description": "Host update", "Id": "9a8028ec", "Name": "Software Inventory", "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" }, "Updateable": false, "Version": "IBM-witherspoon-OP9-v2.0.14-2.6" } Redfish validator had no additional errors Change-Id: I26273227448cab1a20a20a7edd9d85d223727bb8 Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
2019-06-26simpleupdate: Basic support of SimpleUpdateAndrew Geissler1-11/+172
This is TFTP only since that is all the OpenBMC back end currently supports Design Doc Ref: https://gerrit.openbmc-project.xyz/c/openbmc/docs/+/20700 Tested: 1) Verified BMC image update via new SimpleUpdate interface worked curl -k -H "X-Auth-Token: $TOKEN" -d '{"ImageURI":"XXX.XX.X.X/obmc-phosphor-image-witherspoon.ubi.mtd.tar","TransferProtocol":"TFTP"}' -X POST https://${BMC_IP}/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate { "@Message.ExtendedInfo": [ { "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message", "Message": "Successfully Completed Request", "MessageArgs": [], "MessageId": "Base.1.4.0.Success", "Resolution": "None", "Severity": "OK" } ] } 2) Verified encoding the protocol in ImageURI worked curl -k -H "X-Auth-Token: $TOKEN" -X POST https://${BMC_IP}/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate -d '{"ImageURI":"tftp://${TFTP_IP}/obmc-phosphor-image-witherspoon.ubi.mtd.tar"}' { "@Message.ExtendedInfo": [ { "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message", "Message": "Successfully Completed Request", "MessageArgs": [], "MessageId": "Base.1.4.0.Success", "Resolution": "None", "Severity": "OK" } ] } Jun 12 20:52:20 witherspoon bmcweb[2470]: (2019-06-12 20:52:20) [DEBUG ] Enter UpdateService.SimpleUpdate doPost Jun 12 20:52:20 witherspoon bmcweb[2470]: (2019-06-12 20:52:20) [DEBUG ] Encoded transfer protocol tftp Jun 12 20:52:20 witherspoon bmcweb[2470]: (2019-06-12 20:52:20) [DEBUG ] Adjusted imageUri ${BMC_IP}/obmc-phosphor-image-witherspoon.ubi.mtd.tar Jun 12 20:52:20 witherspoon bmcweb[2470]: (2019-06-12 20:52:20) [DEBUG ] Server: ${TFTP_IP} File: obmc-phosphor-image-witherspoon.ubi.mtd.tar Jun 12 20:52:20 witherspoon bmcweb[2470]: (2019-06-12 20:52:20) [DEBUG ] Exit UpdateService.SimpleUpdate doPost 3) Verified if no transfer protocol, error returned curl -k -H "X-Auth-Token: $TOKEN" -X POST https://${BMC_IP}/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate -d '{"ImageURI":”${TFTP_IP}/obmc-phosphor-image-witherspoon.ubi.mtd.tar"}' { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message", "Message": "The value ${TFTP_IP}/obmc-phosphor-image-witherspoon.ubi.mtd.tar for the parameter ImageURI in the action UpdateService.SimpleUpdate is of a different type than the parameter can accept.", "MessageArgs": [ “${TFTP_IP}/obmc-phosphor-image-witherspoon.ubi.mtd.tar", "ImageURI", "UpdateService.SimpleUpdate" ], "MessageId": "Base.1.4.0.ActionParameterValueTypeError", "Resolution": "Correct the value for the parameter in the request body and resubmit the request if the operation failed.", "Severity": "Warning" } ], "code": "Base.1.4.0.ActionParameterValueTypeError", "message": "The value ${TFTP_IP}/obmc-phosphor-image-witherspoon.ubi.mtd.tar for the parameter ImageURI in the action UpdateService.SimpleUpdate is of a different type than the parameter can accept." } } 4) Verified no new error in Redfish Validator 5) Verified error return when parameter missing: curl -k -H "X-Auth-Token: $TOKEN" -d '{"TransferProtocol":"TFTP"}' -X POST https://${BMC_IP}/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate { "ImageURI@Message.ExtendedInfo": [ { "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message", "Message": "The property ImageURI is a required property and must be included in the request.", "MessageArgs": [ "ImageURI" ], "MessageId": "Base.1.4.0.PropertyMissing", "Resolution": "Ensure that the property is in the request body and has a valid value and resubmit the request if the operation failed.", "Severity": "Warning" } ] } 6) Verified that by default, the new Action is not available Change-Id: I67ea91e181380e6da7ff63a37f02408a318602b7 Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
2019-06-14Redfish: ApplyTime property patch supportJayashankar Padath1-0/+53
This change is to set the ApplyTime property using the UpdateServce redfish schema before initiating the BMC image upload and activation. Verified sequence flow: 1. The user sets the desired ApplyTime value (OnReset/Immediate) using the PATCH request 2. Execute "POST -T ./obmc-phosphor-image-witherspoon-20190522045427.ubi.mtd.tar https://${bmc}/redfish/v1/UpdateService" 3. During the end of activation, if the ApplyTime value is Immediate, force-reboot.service gets called which reboots the BMC. If the ApplyTime value is OnReset, no force reboot will be triggered and the new BMC image will be functional when the user decideds to reboot the BMC manually. Tested: PATCH -d '{ "ApplyTime":"OnReset"}' https://${bmc}/redfish/v1/UpdateServce { "@Message.ExtendedInfo": [ { "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message", "Message": "Successfully Completed Request", "MessageArgs": [], "MessageId": "Base.1.4.0.Success", "Resolution": "None", "Severity": "OK" } ] } PATCH -d '{ "ApplyTime":"OnRset"}' https://${bmc}/redfish/v1/UpdateServie { "ApplyTime@Message.ExtendedInfo": [ { "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message", "Message": "The value OnRset for the property ApplyTime is not in the list of acceptable values.", "MessageArgs": [ "OnRset", "ApplyTime" ], "MessageId": "Base.1.4.0.PropertyValueNotInList", "Resolution": "Choose a value from the enumeration list that the implementation can support and resubmit the request if the operation failed.", "Severity": "Warning" } ] } Signed-off-by: Jayashankar Padath <jayashankar.padath@in.ibm.com> Change-Id: If79934f7db450c2ad3bea60307419b17981e4dfe
2019-05-09simpleupdate: Move code around for future re-useAndrew Geissler1-140/+143
A lot of the existing code for the UpdateService path can be used for SimpleUpdate. Move the common code into static functions so that both paths can call them. Tested: Verified good path code update still works against UpdateService Change-Id: Ie69b2bdc7b286b9d0596a2ca193810270a3f7dbb Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
2019-04-11fw-update: Support host image updateAndrew Geissler1-50/+92
Per the Redfish schema for the UpdateService, it supports all SoftwareInventory targets. On OpenBMC this is currently the BMC and the Host (BIOS) firmware. Introduced a new fwUpdateInProgress static variable so that the signal subscription could be disabled once the required interface was added. This prevented multiple call backs and multiple activations of the same image. Tested: Verified that a host and BMC image update worked as expected on a witherspoon system. $ curl -k -H "X-Auth-Token: $TOKEN" -H "Content-Type: application/octet-stream" -X POST -T ./obmc-phosphor-image-witherspoon.ubi.mtd.tar https://${BMC_IP}/redfish/v1/UpdateService { "@Message.ExtendedInfo": [ { "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message", "Message": "Successfully Completed Request", "MessageArgs": [], "MessageId": "Base.1.4.0.Success", "Resolution": "None", "Severity": "OK" } ] } Change-Id: I7bb9381f1b79bf65604464b628ef98646951d840 Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
2019-04-11fw-inventory: Add RelatedItem to inventoryAndrew Geissler1-0/+27
Added TODO reference for BIOS reference. This commit is required: https://gerrit.openbmc-project.xyz/#/c/openbmc/bmcweb/+/16775/ Tested: VERBO - SoftwareInventory.v1_1_0.SoftwareInventory:RelatedItem VERBO - value: [OrderedDict([('@odata.id', '/redfish/v1/Managers/bmc')])] <class 'list'> VERBO - has Type: Collection(Resource.Item) entity VERBO - is Optional VERBO - permission OData.Permission/Read VERBO - is Collection VERBO - Success curl -k -H "X-Auth-Token: $TOKEN" -X GET https://${BMC_IP}/redfish/v1/UpdateService/FirmwareInventory/969635f8 { "@odata.context": "/redfish/v1/$metadata#SoftwareInventory.SoftwareInventory", "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/969635f8", "@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory", "Description": "BMC update", "Id": "969635f8", "Members@odata.count": 1, "Name": "Software Inventory", "RelatedItem": [ { "@odata.id": "/redfish/v1/Managers/bmc" } ], "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" }, "Updateable": false, "Version": "2.6.0-rc1-312-g8d6abcd6d" } With the TODO code un-commented, this is the output: curl -k -H "X-Auth-Token: $TOKEN" -X GET https://${BMC_IP}/redfish/v1/UpdateService/FirmwareInventory/ace821ef { "@odata.context": "/redfish/v1/$metadata#SoftwareInventory.SoftwareInventory", "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/ace821ef", "@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory", "Description": "Host update", "Id": "ace821ef", "Members@odata.count": 1, "Name": "Software Inventory", "RelatedItem": [ { "@odata.id": "/redfish/v1/Systems/system/BIOS" } ], "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" }, "Updateable": false, "Version": "IBM-witherspoon-OP9-v2.0.10-2.22" } Change-Id: Iae563a938532c6f53f41c8fc5c758693155be1a0 Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
2019-03-30fw-inventory: description of FirmwareInventory objAndrew Geissler1-0/+21
This will allow one to identify what a firmware inventory object represents. The Purpose was already being pulled from the Dbus data but not put into anything. The description field looks like the best fit for it. Schema Reference: http://redfish.dmtf.org/schemas/v1/SoftwareInventory.v1_2_1.json#/definitions/SoftwareInventory Other Implementations: Not a lot of reference material out there for what other implementers have used for this field. HP: "Description": "SystemBMC" "Description": "SystemRomActive" SuperMicro: <BMC description not available> "Description: "Description of SUPERMICRO BIOS" Tested: - Verified RedfishServiceValidator.py shows no new errors VERBO - Resource.v1_0_0.Resource:Description VERBO - value: BMC update <class 'str'> VERBO - has Type: Resource.Description Edm.String VERBO - is Optional VERBO - permission OData.Permission/Read VERBO - Success - Description now correctly returned in data $ curl -k -H "X-Auth-Token: $TOKEN" -X GET https://${BMC_IP}/redfish/v1/UpdateService/FirmwareInventory/58a9b6db { "@odata.context": "/redfish/v1/$metadata#SoftwareInventory.SoftwareInventory", "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/58a9b6db", "@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory", "Description": "BMC update", "Id": "58a9b6db", "Name": "Software Inventory", "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" }, "Updateable": false, "Version": "2.6.0-rc1-265-gfb721b2" } Change-Id: I55d1b1a5901878da2566713de9dc72e88a8c6359 Signed-off-by: Andrew Geissler <geissonator@yahoo.com> Signed-off-by: Ed Tanous <ed.tanous@intel.com>
2019-02-21bmcweb: fix compiler warningsEd Tanous1-1/+0
This patchset attempts to fix all compiler warnings in bmcweb owned files. There are 2 warnings left, both in sdbusplus, which will be resolved in a patchset there. Tested By: Recompiled, observed warning count went from 30, to zero. Change-Id: Ife90207aa5773bc28faa8b04c732cafa5a56e4e4 Signed-off-by: Ed Tanous <ed@tanous.net>
2019-02-09bmcweb: move variant usage to std namespaceEd Tanous1-9/+6
Change-Id: I9d7069668f91f2ac72d2f4a440f63e0e85dd5269 Signed-off-by: Ed Tanous <ed.tanous@intel.com>
2018-12-10Remove custom version of getPtrEd Tanous1-4/+6
Now that sdbusplus variant supports std::get_if, we can remove our custom, mapbox namespaced implementation that does the same thing. Change-Id: I854c473003e28e41dd45dba08ca683433f1c1774 Signed-off-by: Ed Tanous <ed.tanous@intel.com>
2018-11-26bmcweb: Redfish away from json cacheEd Tanous1-33/+29
In the original incarnation of bmcweb, route registration was done automatically. This has proved to be a terrible idea, wraught with corner cases and issues. The route registration is currently the only user of the redfish::Node::json element. Unfortunately, as written, this structure consumes a lot of memory that's duplicated and not very useful. From a performance perspective, there is almost no difference between rebuilding the structure for each GET request, and having the "cache" that needs to be copied into the response and modified before it can be useful. In the programming tradeoffs for bmc, lower memory usage is more important than latency, especially at these levels. Change-Id: I785e8352123e5e886acf05cd59cb23648f93839d Signed-off-by: Ed Tanous <ed.tanous@intel.com>