summaryrefslogtreecommitdiff
path: root/redfish-core/lib/led.hpp
AgeCommit message (Collapse)AuthorFilesLines
2021-06-03Remove Redfish Node classJohn Edward Broadbent1-0/+2
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-04-08Using AsyncResp everywherezhanghch051-6/+10
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-03-12led: Fix for Chassis IndicatorLED patch responseJayaprakash Mutyala1-0/+1
While Patching Chassis Indicator LED from Redfish, response is showing as empty but HTTPS status code is "200 OK" on successful case. So provided fix for Proper response on Success. Tested: 1. Verified RedFish validator passed 2. Verified the response on Redfish by updating IndicatorLED status. PATCH: https://<BMC-IP>/redfish/v1/Chassis/<Baseboard-ID> Body: { "IndicatorLED": "Blinking" } Response: { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "Successfully Completed Request", "MessageArgs": [], "MessageId": "Base.1.8.1.Success", "MessageSeverity": "OK", "Resolution": "None" } ] } Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com> Change-Id: I2e1281e6c06c445fe8d0c350bb74ea18f3461a35
2020-11-10Add new Location Indicator propertyGunnar Mills1-0/+114
In ComputerSystem 1.13 and Chassis 1.14 as well as in many other schemas IndicatorLED is replaced with LocationIndicatorActive. LocationIndicatorActive is a bool while IndicatorLED had 3 states: Lit, Blink, and off. Map Lit and Blink both to LocationIndicatorActive true. led.hpp was calling both enclosure_identify_blink and enclosure_identify, continue this. Keep the deprecated IndicatorLED and implement the new LocationIndicatorActive property. Have both properties for the time being. This new property makes the same calls. This does add a new Redfish warning for the deprecated IndicatorLED. Other warning are there today. Tested: Validator passes Could use help testing on Chassis. Our systems don't have a IndicatorLED on chassis. See chassis bumped. curl -k https://$bmc/redfish/v1/Systems/system { "@odata.id": "/redfish/v1/Systems/system", "@odata.type": "#ComputerSystem.v1_13_0.ComputerSystem", ... "IndicatorLED": "Off", "LastResetTime": "2020-10-29T09:01:03+00:00", "Links": { "Chassis": [ { "@odata.id": "/redfish/v1/Chassis/chassis" } ], "ManagedBy": [ { "@odata.id": "/redfish/v1/Managers/bmc" } ] }, "LocationIndicatorActive": false, curl -X PATCH -d '{ "LocationIndicatorActive":true}' -k \ https://$bmc/redfish/v1/Systems/system curl -X PATCH -d '{ "IndicatorLED":"Off"}' -k \ https://$bmc/redfish/v1/Systems/system Change-Id: I105bed5794912c575aa9a00e0442461bfdee6180 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-10-15Lots of performance improvementsEd Tanous1-2/+2
(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-17Enable unused variable warnings and resolveEd Tanous1-4/+2
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-17Enable clang warningsEd Tanous1-12/+12
This commit enables clang warnings, and fixes all warnings that were found. Most of these fall into a couple categories: Variable shadow issues were fixed by renaming variables unused parameter warnings were resolved by either checking error codes that had been ignored, or removing the name of the variable from the scope. Other various warnings were fixed in the best way I was able to come up with. Note, the redfish Node class is especially insidious, as it causes all imlementers to have variables for parameters, regardless of whether or not they are used. Deprecating the Node class is on my list of things to do, as it adds extra overhead, and in general isn't a useful abstraction. For now, I have simply fixed all the handlers. Tested: Added the current meta-clang meta layer into bblayers.conf, and added TOOLCHAIN_pn-bmcweb = "clang" to my local.conf Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: Ia75b94010359170159c703e535d1c1af182fe700
2020-06-11clang-format: update to latest from docs repoGunnar Mills1-3/+3
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-01-07Add IndicatorLed to Chassis SchemaJames Feist1-0/+157
This adds the indicator property to Chassis Schema, and moves the logic from systems.hpp to a common header to share the code. Tested: Passed the validator, was able to turn LED on Change-Id: I79458a2a4656d7ddf2939bb9f56845eb6d9a27ca Signed-off-by: James Feist <james.feist@linux.intel.com>