summaryrefslogtreecommitdiff
path: root/include/redfish_v1.hpp
AgeCommit message (Collapse)AuthorFilesLines
2021-04-08Using AsyncResp everywherezhanghch051-4/+3
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-04-01Move requestRoutes to asyncRespEd Tanous1-1/+8
res.end() should be avoided where possible; This commit changes requestRoutes to remove the res.end() that's been present there for a long time. Tested: curl -vvvv --insecure --user root:0penBmc https://192.168.7.2/redfish/v1 returns 200 Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I798783d320cfb7bc7973a8d2c02c4a25906a3859
2021-03-29Make redfish namespace consistentEd Tanous1-3/+0
The requestRoutes somehow got put into the crow namespace, despite everything else being put into redfish. This commit makes the namespacing consistent, which is a good thing overall for complexity. Tested: curl -vvvv --insecure --user root:0penBmc https://192.168.7.2/redfish/v1 returns 200 Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I954e1a34893b1b5918eeee25d201c938ef4b55b6
2020-10-23fix include namesEd Tanous1-1/+1
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
2020-08-17Enable unused variable warnings and resolveEd Tanous1-1/+1
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-1/+1
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-08-17Remove middlewaresEd Tanous1-9/+1
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-16Deprecate the "" operator, and isEqPEd Tanous1-1/+1
While a cool example of how to do string matching in constexpr space, the set of verbs available to HTTP has been fixed for a very long time. This was ported over to beast a while back, but we kept the API for.... mediocre reasons of backward compatibility. Remove that, and delete the now unused code. Tested: Built and loaded on a Witherspoon. Validator passes. Signed-off-by: Ed Tanous <ed.tanous@intel.com> Change-Id: Iaf048e196f9b6e71983189877203bf80390df286 Signed-off-by: James Feist <james.feist@linux.intel.com> Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-07-16Rework Authorization flowJames Feist1-1/+0
Currently we parse the whole message before authenticating, allowing an attacker the ability to upload a large image, or keep a connection open for the max amount of time easier than it should be. This moves the authentication to the earliest point possible, and restricts unauthenticated users timeouts and max upload sizes. It also makes it so that unauthenticated users cannot keep the connection alive forever by refusing to close the connection. Tested: - login/logout - firmware update - large POST when unauthenticated - timeouts when unauthenticated - slowhttptest Change-Id: Ifa02d8db04eac1821e8950eb85e71634a9e6d265 Signed-off-by: James Feist <james.feist@linux.intel.com>
2020-06-11clang-format: update to latest from docs repoGunnar Mills1-3/+5
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>
2019-10-18Make references to crow less obviousEd Tanous1-1/+1
Recently, a number of people in the community have made the (admittedly easy) mistake that we use a significant portion of crow. Today, we use crow for the router, and the "app" structure, and even those have been significantly modified to meet the bmc needs. All other components have been replaced with Boost beast. This commit removes the crow mentions from the Readme, and moves the crow folder to "http" to camouflage it a little. No code content has changed. Tested: Code compiles. No functional change made to any executable code. Signed-off-by: Ed Tanous <ed.tanous@intel.com> Change-Id: Iceb57b26306cc8bdcfc77f3874246338864fd118
2018-10-08Move AccountService to node structureEd Tanous1-123/+0
AccountService was the last service hanging on to the old way of doing things. This moves it up to our current standard using the Node class. Tested by: Ran service validator. Saw no errors. Change-Id: I84d0097f48803cb06d2ec95171f18bff04661666 Signed-off-by: Ed Tanous <ed.tanous@intel.com>
2018-09-05Move to clang-format-6.0Ed Tanous1-108/+133
This commit moves the codebase to the lastest clang-format file from upstream, as well as clang-format-6.0. Change-Id: Ice8313468097c0c42317fbb9e10ddf036e8cff4c Signed-off-by: Ed Tanous <ed.tanous@intel.com>
2018-07-27Move over to upstream c++ styleEd Tanous1-29/+29
This patchset moves bmcweb over to the upstream style naming conventions for variables, classes, and functions, as well as imposes the latest clang-format file. This changeset was mostly built automatically by the included .clang-tidy file, which has the ability to autoformat and auto rename variables. At some point in the future I would like to see this in greater use, but for now, we will impose it on bmcweb, and see how it goes. Tested: Code still compiles, and appears to run, although other issues are possible and likely. Change-Id: If422a2e36df924e897736b3feffa89f411d9dac1 Signed-off-by: Ed Tanous <ed.tanous@intel.com>
2018-06-29Boost beastEd Tanous1-33/+3
This commit is the beginings of attempting to transition away from crow, and toward boost::beast. Unit tests are passing, and implementation appears to be slightly faster than crow. Change-Id: Ic8d946dc7a04f514c67b1098f181eee1ced69171
2018-06-29Move thermal interfaces to new schemaEd Tanous1-2/+2
With the change to entity manager, move the thermal componets to the proper inventory manager interfaces Change-Id: I520e65b1df53ca8d3fbc12253882ae69b708bbbf Signed-off-by: Ed Tanous <ed.tanous@intel.com>
2018-06-29Move bmcweb over to sdbusplusEd Tanous1-14/+15
This patchset moves bmcweb from using boost-dbus over entirely to sdbusplus. This has some nice improvements in performance (about 30% of CPU cycles saved in dbus transactions), as well as makes this project manuver closer to the upstream way of thinking. Changes to bmcweb are largely ceremonial, and fall into a few categories: 1. Moves async_method_call instances to the new format, and deletes any use of the "endpoint" object in leiu of the sdbusplus style interface 2. sdbus object_path object doesn't allow access to the string directly, so code that uses it moves to explicit casts. 3. The mapbox variant, while attempting to recreate boost::variant, misses a T* get<T*>() method implementation, which allows using variant without exceptions. Currently, there is an overload for mapbox::get_ptr implementation which replecates the functionality. Tested by: Booting the bmcweb on a target, iterating through redfish basic phosphor-webui usage, and websockets usage Change-Id: I2d95882908d6eb6dba00b9219a221dd96449ca7b Signed-off-by: Ed Tanous <ed.tanous@intel.com>
2018-04-22Minor fixes to make redfish pass compliance testsEd Tanous1-29/+66
1. Role members needs to be an array, not an object 2. Fix accounts schema to use the new user manager 3. Remove "status" field hardcodes 4. Hardcode chassisType to rackmount for now 5. Work around bug in get sub routes 6. Add ID to SessionService Schema Change-Id: Ibb13d6ace747ac028e840638868c3a01d65dedfa Signed-off-by: Ed Tanous <ed.tanous@intel.com>
2018-04-22Adding Chassis and ChassisCollection Schemas to RedfishRapkiewicz, Pawel1-28/+0
This commit: * removes previous redfish_v1 Chassis implementation * Adds Chassis and ChassisCollection implementation as Node way * Adds Chassis Provider class for retrieving data from EntityManager It was tested: * Wolfpass run, to see if previous functionality was not broken * Service Validator, which did not unveil any regression, and did verified that implemented schemas are complient. Change-Id: I75a9545a0abd8b85d6ce72329c523fc076affc28 Signed-off-by: Rapkiewicz, Pawel <pawel.rapkiewicz@intel.com> Signed-off-by: Ed Tanous <ed.tanous@intel.com> Signed-off-by: Rapkiewicz, Pawel <pawel.rapkiewicz@intel.com>
2018-03-28Redfish Manager and ManagerCollectionBorawski.Lukasz1-53/+0
Node version of the Manager and ManagerCollection implementation. Change-Id: I693fa57add670fb0ecfc0cf0046e06142571c543 Signed-off-by: Borawski.Lukasz <lukasz.borawski@intel.com>
2018-03-28Redfish SessionServiceBorawski.Lukasz1-22/+0
- added node version of the SessionService implementation - added a default timeout member and a get timeout method to the SessionStore class Change-Id: I532080789b3d687208510f8b748402735ed888d8 Signed-off-by: Borawski.Lukasz <lukasz.borawski@intel.com>
2018-03-28Redfish NetworkProtocolBorawski.Lukasz1-57/+0
Node version of the NetworkProtocol implementation. Change-Id: I6f52dca4e530917a5b815a32f1222b481059aa23 Signed-off-by: Borawski.Lukasz <lukasz.borawski@intel.com>
2018-03-28AccountServiceLewanczyk, Dawid1-23/+0
Initial version moved to separate node. Change-Id: I3fe4e2eb00bcb754ea81de0a0656f4de9eb9156c Signed-off-by: Lewanczyk, Dawid <dawid.lewanczyk@intel.com>
2018-03-07RolesLewanczyk, Dawid1-36/+0
Move roles and roles collection to new class based implementation Change-Id: I70f39bf8289fb45483a1e7f2c4eb3dbc1c7a7090 Signed-off-by: Lewanczyk, Dawid <dawid.lewanczyk@intel.com> Signed-off-by: Ed Tanous <ed.tanous@intel.com>
2018-02-06Session and SessionCollectionKowalski, Kamil1-110/+4
New Redfish-Core nodes added (removed from redfish_v1.hpp) - Session and SessionCollection. Tested manually on x86 VM and Wolfpass Platform. Behavior almost identical to what was before - differences: - SessionCollection - now only returns TIMEOUT presistence sessions, not SINGLE - Aquiring sessions from session storage now applies timeouts Change-Id: I68bf4fa7fa1c8371216a7d4daa30bbfb653cfa72 Signed-off-by: Kowalski, Kamil <kamil.kowalski@intel.com>
2018-01-24Service RootBorawski.Lukasz1-21/+0
Change-Id: Ibf9d463802d77014852a92ecfcb8096324f3670f Signed-off-by: Borawski.Lukasz <lukasz.borawski@intel.com>
2017-10-30Update get_routes to use trie for efficiencyEd Tanous1-4/+5
This commit updates the behavior of request_routes to actually use the trie data structure to find the appropriate routes. This function was originaly intended for debugging, but now with redfish, it is being used to look up routes. Also, update the prototype so it returns a string pointer to the main route in the trie instead of copying the whole list of stings. A future optimization should also give the ability to pick a "stop at" character, or a depth so that users can decide how deep into the tree they want to iterate, instead of getting the whole subtree and filtering after the fact. Change-Id: I8b98fb3f19f59a043ae6aa583ed62ab89be10eb8
2017-10-28Refactor session key storageEd Tanous1-28/+25
Refactor session key storage to actually have an interface that isn't map, and provide reasonable lookup functions, as well as update the consumers of those functions. This also implements session timeouts. Change-Id: Ica46716805782cfbb7c4ee5569bc7e468c260bc3
2017-10-27Implement Managers interface for redfishEd Tanous1-3/+126
This commit implements the manager interface schema for redfish, as well as the manager collection. Change-Id: Ide6d6b500b8758dc693d65bad5f263baac9f529f
2017-10-25Add the redfish static files to the buildEd Tanous1-255/+9
...And delete the old webserver static files from the repo. Move $metadata to a static file, as that's really where it belongs. Change-Id: I2caeee7cd779b7c07cfc10cd693459105656671f
2017-10-25Update WebserverEd Tanous1-81/+523
Upate get_routes to use the correct constness for its use case crow to set json_mode if json value is populated Delete std::array bytes API due to major efficiency issues. To be replaced with span API in near future Implement a catch block for handlers that can throw exceptions Implement direct handling of routes that end with / to better support redfish. /foo and /foo/ now invoke the same handler insead of issuing a 301 redirect Update nlohmann to latest version Implement one nlohmann endpoint with exceptions disabled Implement first pass at a IBM style rest-dbus interface Fix pam authentication to call dropbear auth methods Implements first pass at redfish interface. Shemas avaialble pass redfish validation 100% Use response json object rather than request json object. Update authorization middleware to be redfish compliant UPdate random token generation to be more efficient, and not base64 bytes, generate bytes directly Change-Id: I63cc2005c1a21f5c2f5168777a4e09f3c965a34f
2017-10-11Large updates to webserverEd Tanous1-18/+75
Do not merge yet Change-Id: I38c56844c1b0e3e8e5493c2705e62e6db7ee2102
2017-08-09Lots of updates to webserver.Ed Tanous1-0/+88
Make ssl keys consistent (and write to the correct location) Make sessions keyed by connection id Clean up logging frameworks Add new static files, and make firmware update work Make sensors work again Add better json handling Change-Id: I531a0fd7d583e049949cf27aa71544808fd7642d