summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-02-06Fix CI; Run blackGunnar Mills1-4/+4
Seeing CI fails: ``` Running beautysh Running black reformatted scripts/websocket_test.py ``` ``` diff --git a/scripts/websocket_test.py b/scripts/websocket_test.py index 21c7f160..fce9cd7e 100755 --- a/scripts/websocket_test.py +++ b/scripts/websocket_test.py @@ -45,10 +45,10 @@ async def hello(): authbytes = "{}:{}".format(args.username, args.password).encode("ascii") auth = "Basic {}".format(base64.b64encode(authbytes).decode("ascii")) headers = {"Authorization": auth} - async with websockets.connect( - uri, ssl=ssl_context, extra_headers=headers - ) if args.ssl else websockets.connect( - uri, extra_headers=headers + async with ( + websockets.connect(uri, ssl=ssl_context, extra_headers=headers) + if args.ssl + else websockets.connect(uri, extra_headers=headers) ) as websocket: request = json.dumps( { Format: FAILED ``` Change-Id: I8020716f2f9b9f1745d817728d3fe1eccd0bf778 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2023-02-03Add Support for ActionParameterNotInList MessageAlex Schendel2-0/+42
This commit adds support for the ActionParameterNotInList Redfish DMTF error message. Change-Id: I7fd9b7c952e7ffa4c7c4c585ae28315b40556a21 Signed-off-by: Alex Schendel <alex.schendel@intel.com>
2023-02-03Aggregation: Better handle dropped requestsCarson Labrado3-1/+230
It's possible for HTTP client's request buffer to become full (especially when $expand is used). Instead of ignoring the requests we should provide a 429 Too Many Requests response for the provided callback to process. The aggregator's response handling also needs to account for this possibility so that it only completely overwrites the asyncResp object when it receives a response from a satellite. Also added more test cases for the response processing functions. Tested: Unit tests passed Flooded aggregator with requests for satellite resources. Requests began returning 429 Too Many Requests errors after the request buffer became full. Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: Ib052dc0454d759de7fae761977ca26d6b8d208e5
2023-02-02Fix some warnings by cppcheckGeorge Liu2-6/+3
Warning message: redfish-core/include/redfish_aggregator.hpp:800:21: style: The scope of the variable 'collectionItem' can be reduced. [variableScope] std::string collectionItem; ^ redfish-core/lib/power.hpp:279:33: style: The scope of the variable 'value' can be reduced. [variableScope] nlohmann::json& value = ^ Tested: Verify that there are no such warnings in local CI. Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: Ie379dcb04a22a00b495f9ab3948d97e2e537f395
2023-02-02Update schema pack to 2022.3Ed Tanous111-593/+5025
Update scripts/update_schemas.py to point at 2022.3 and run. Schema pack 2022.3 is the latest Redfish release, released 01/23/2023. It contains several new schemas and support for Multi-factor Authentication and CXL support along other things. Update done by automation. Tested: Redfish service validator passes. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I55a64d7cda26572e7b75135acc324cb44d316fe6
2023-01-31Set state to Absent on Present == falseWilly Tu1-6/+6
- State=Absent means this function or resource is either not present or detected. - State=Disabled means that the device exists, but has been disabled. Tested: Redfish Validator Passed Verified that absence of Drive shows [Status][State] = "Absent" ``` wget -qO- http://localhost:80/redfish/v1/Chassis/mychassis/Drives/Drive_0 { "@odata.id": "/redfish/v1/Chassis/mychassis/Drives/Drive_0", "@odata.type": "#Drive.v1_7_0.Drive", "Id": "Drive_0", "Links": { "Chassis": { "@odata.id": "/redfish/v1/Chassis/mychassis" } }, ....., ....., ....., "Protocol": "....", "Status": { "State": "Absent" } } ``` Change-Id: I99217c1c3c94df5c10fb158d3d1ef65d70d0ebb3 Signed-off-by: Willy Tu <wltu@google.com> Signed-off-by: Nikhil Namjoshi <nikhilnamjoshi@google.com>
2023-01-28Fix handleAccounttDelete spellingGunnar Mills1-4/+4
Extra t, make the method match others like handleAccountPatch. 1ef4c3423f1f13ba6a804f72427641e6f8287dba has this wrong. Tested: None. It builds. Change-Id: I7e465d525ddb3ce89567b6918933e41726a4faa4 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2023-01-27Remove unused variablesEd Tanous1-3/+0
These were found by inspection. Tested: Code Compiles. Dead code elimination. Change-Id: I53455672f96faa44ad0e94146baf2d28daf8e10a Signed-off-by: Ed Tanous <edtanous@google.com>
2023-01-25Timer not started if user session is logged inNinad Palsule1-1/+0
In startDeadline(), If user session is logged in then we simply return without starting the timer. This fix fixes that issue. Tested: Loaded code change on system and verified timeout now works. Change-Id: Ia4359b6dffb3015eb20a2a9d0ff2e5e6dab3500d Signed-off-by: Ninad Palsule <ninadpalsule@us.ibm.com>
2023-01-24Refactor GetSubTree methodGeorge Liu16-348/+275
Since the GetSubTree method has been implemented in dbus_utility and this commit is to integrate all the places where the GetSubTree method is called, and use the method in dbus_utility uniformly. Tested: Redfish Validator Passed Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: If3852b487d74e7cd8f123e0efffbd4affe92743c
2023-01-23Break out set time function and unit test itEd Tanous3-37/+80
This function is something that's easily unit tested. Do it. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I8d664c77ec4b3a9886128597449c5f9c041b86b3
2023-01-23Retab OemVirtualMedia schemaEd Tanous1-6/+6
The tabs in this file were wrong. Fix them. Tested: Whitespace only. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I796852e09fb927998bdab15d31ae93bc14c7337c
2023-01-21Aggregation: Aggregate top level collectionsCarson Labrado1-62/+80
Adds aggregation support for all top level collections which do not follow the usual form of /redfish/v1/<collection>. As part of this change we no longer forward all requests that fit the above format such as /redfish/v1/UpdateService. We now skip the forwarding rather than sending a request. Previously we forwarded all potential collection requests and then relied on the lack of a "Members" array in the response to denote that the request was not actually for a valid collection. Tested: We aggregate or try to aggregate these URIs as collections: /redfish/v1/Chassis /redfish/v1/Chassis/ /redfish/v1/Fabrics /redfish/v1/Fabrics/ /redfish/v1/TelemetryService/MetricReports /redfish/v1/TelemetryService/MetricReports/ We aggregate or try to aggregate these URIs as satellite resources /redfish/v1/Chassis/5B247A_<chassisID> /redfish/v1/TelemetryService/MetricReports/5B247A_reportID /redfish/v1/UpdateService/FirmwareInventory/5B247A_firmwareID We do not attempt to aggregate these URIs at all: /redfish/v1/Fake /redfish/v1/Fake/ /redfish/v1/Fake/5B247A_fakeID /redfish/v1/TelemetryService /redfish/v1/TelemetryService/ /redfish/v1/TelemetryService/5B247A_fakeID Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: I133503ab3e4df7777df094768786e511880ca70f
2023-01-21Replace "Fix keepalive false" with patchset 3Ed Tanous1-3/+6
This reverts commit 5ae6f9254161f7229216c08b591e31eaf10f69e4. And replaces it with patchset 3 from the same review, for which was tested to work properly. This commit was merged erroneously. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I201924ad27d33923d43bdf82ecb016a0f214b4dd
2023-01-19Remove OemSession from metadataEd Tanous2-13/+0
In d678d4fc59f131cf9820c1783f86a4a6ede32995 I forgot to remove OemSession from the metadata, and it now returns invalid. This was missed in testsing, because this was originally stacked with patches that remove the $metadata hardcoding entirely, so with that patch, this error wasn't present. Tested: CI can catch this just fine. Regression fix. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I56ad68846174d42004565dd3bc75f3008720d58a
2023-01-19Remove proprietary OEMSession supportEd Tanous3-115/+1
Per https://gerrit.openbmc.org/c/openbmc/bmcweb/+/56088, this feature would be supported to the end of 2022, at which point people will have moved over to the standard Context parameter in the DMTF-published Session schema. Tested: Code removal. Code compiles. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I0ae832bde740b025150242085bf1d2909ed1ec21
2023-01-19Aggregation: Fix and forward all responsesCarson Labrado2-37/+127
We only attempt prefix matching when we receive a 200 response. For the retry policy we consider 2XX and 404 to be valid codes. Instead we should forward all responses to the client and let them decide what action they want to take. As part of that we should always attempt to do prefix fixing on the response. Also fixes an oversight where we attempt to do prefix fixing on "OriginOfCondition" properties. That property is only a URI when it is an Action parameter in a SubmitTestEvent request. It is an object when it appears as a response property. Adds test cases for the above fixes. Tested: Tests pass. Queries to top level collections and aggregated URIs still return expected results with added prefixes. Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: Ic76324ceab618160061be5f3c687af20a857fa25
2023-01-19Removed checking cookie in mTLS authenticationKarol Niczyj1-16/+10
mTLS authentication should have the highest priority (according to code in [1]) so it shouldn't be affected by cookies. If you provide a valid certificate and a dummy cookie value, request will fail which means cookies had higher priority than mTLS. Tested: Follow the guide in [2] to create a valid certificate for a user that can access some resource (for example /redfish/v1/Chassis) and make two requests: curl --cert client-cert.pem --key client-key.pem -vvv --cacert CA-cert.pem https://BMC_IP/redfish/v1/Chassis curl --cert client-cert.pem --key client-key.pem -vvv --cacert CA-cert.pem https://BMC_IP/redfish/v1/Chassis -H "Cookie: SESSION=123" Before this change second request would fail with "401 Unauthorized" [1]: https://github.com/openbmc/bmcweb/blob/bb759e3aeaadfec9f3aac4485f253bcc8a523e4c/include/authentication.hpp#L275 [2]: https://github.com/openbmc/docs/blob/f4febd002df578bad816239b70950f84ea4567e8/security/TLS-configuration.md Signed-off-by: Karol Niczyj <karol.niczyj@intel.com> Signed-off-by: Boleslaw Ogonczyk Makowski <boleslawx.ogonczyk-makowski@intel.com> Change-Id: I5d6267332b7b97c11f638850108e671d0baa26fd
2023-01-19Add the GetObject method to dbus_utilityGeorge Liu7-102/+90
There are currently many files that use the GetObject method. Since they are a general method, they are defined in the dbus_utility.hpp file and refactors them. Tested: Built bmcweb successfully and Validator passes. Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: If2af77294389b023b611987252ee6149906fcd25
2023-01-19Add Get for PCIe property LanesInUseMyung Bae2-1/+15
Added Redfish property 'LanesInUse' to PCIeDevices under redfish/v1/Systems. LanesInUse maps to dbus LanesInUse property for the Inventory.Item.PCIeDevice interface. Note: GUI might map this property to 'LinkWidth' Tested: 1) Redfish validator passed 2) Curl testing curl -k <token> \ https://$bmc/redfish/v1/Systems/system/PCIeDevices/pcie_card8 { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card8", "@odata.type": "#PCIeDevice.v1_9_0.PCIeDevice", ... "PCIeInterface": { "LanesInUse": 16, "PCIeType": "Gen4" }, ... } Signed-off-by: Myung Bae <myungbae@us.ibm.com> Change-Id: I896abe44f55414f25d01c5a93a31bb585264657e
2023-01-18Fix a boatload of #includesEd Tanous81-297/+378
Most of these missing includes were found by running clang-tidy on all files, including headers. The existing scripts just run clang-tidy on source files, which doesn't catch most of these. Tested: Code compiles Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ic741fbb2cc9e5e92955fd5a1b778a482830e80e8
2023-01-17Refactor ipv4VerifyIpAndGetBitcountEd Tanous1-64/+54
Boost has a number of ip related functions that can do a lot of this parsing for us, we should make use of them. Unfortunately, boost::asio::network_v4[1] doesn't have a no-throw variant of this constructor. It's not clear if this was an intentional omission, but for the moment, this patchset chooses to reimplement the mask code in-place for the moment. Even with this, the code is still simpler than what was present. [1] https://www.boost.org/doc/libs/1_80_0/doc/html/boost_asio/reference/ip__network_v4/network_v4.html Tested: Unit tests pass. Pretty good coverage. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ia50b50ce0096a5acbb9da814ee15aa8edbfe0e31
2023-01-17Add unit tests for ipv4VerifyIpAndGetBitcountEd Tanous1-1/+89
Per the title, add unit tests for this function. Tested: Unit tests pass Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ifdd9c314d2fa62ae3fa3b8f8150fcdd224a7eb03
2023-01-17Add check for globalsEd Tanous18-24/+55
We don't follow this cpp core guidelines rule well. This is something that we should aspire to cleaning up in the future, but for the moment, lets turn the rule on in clang-tidy to stop the bleeding, add ignores for the things that we know need some better abstractions, and work on these over time. Most of this commit is just adding NOLINTNEXTLINE exceptions for all of our globals. There was one case in the sensor code where clang correctly noted that those globals weren't actually const, which got missed because of the use of auto. Tested: CI should be good enough for this. Passes clang-tidy. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ieda08fee69a3b209d4b3e9771809a6c41524f066
2023-01-14LogService: Use DeleteAll DBus method in clearDumpClaire Weinan2-113/+38
Update the clearDump() implementation to call the DeleteAll D-Bus method instead of iterating through D-Bus objects representing individual log entries and calling the Delete D-Bus method on each one. (It's more efficient for phosphor-debug-collector to iterate through entries in its DeleteAll method handler than for bmcweb to iterate through them.) It seems like clearDump() wasn't originally implemented using DeleteAll because dumps of various types were under the same D-Bus path namespace at the time and there wasn't a way to selectively clear dumps of only a specific type. The commit at [1] put different dump types under different path namespaces (enabling us to now use DeleteAll). Now clients should see a bit of performance improvement when running the ClearLog action on dump LogServices, due to the reduced number of D-Bus method calls needed to execute ClearLog. Also updated getDumpServiceInfo() to populate the ClearLog action for dump LogServices based on whether their dump manager object implements xyz.openbmc_project.Collection.DeleteAll. Tested: Cleared the fault log containing 100 entries. Ran with the time command several times before and after the change: ``` time curl -k -H "X-Auth-Token: $token" -X POST http://${bmc}/redfish/v1/Managers/bmc/LogServices/FaultLog/Actions/LogService.ClearLog ``` Before the change, "real" time reported was ~1.2s. After the change, "real" time reported was ~0.4s. Forced creation of dump entries and then ran Redfish ClearLog action on each dump type: ``` curl -k -H "X-Auth-Token: $token" -X POST http://${bmc}/redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.ClearLog curl -k -H "X-Auth-Token: $token" -X POST http://${bmc}/redfish/v1/Managers/bmc/LogServices/FaultLog/Actions/LogService.ClearLog curl -k -H "X-Auth-Token: $token" -X POST http://${bmc}/redfish/v1/Systems/system/LogServices/Dump/Actions/LogService.ClearLog ``` Then verified that there were no dump LogService entries afterwards: ``` curl -k -H "X-Auth-Token: $token" -X GET http://${bmc}/redfish/v1/Managers/bmc/LogServices/Dump/Entries curl -k -H "X-Auth-Token: $token" -X GET http://${bmc}/redfish/v1/Managers/bmc/LogServices/FaultLog/Entries curl -k -H "X-Auth-Token: $token" -X GET http://${bmc}/redfish/v1/Systems/system/LogServices/Dump/Entries ``` Also verified that the corresponding D-Bus objects were gone from the D-Bus tree after running ClearLog on each dump type: Before ClearLog: busctl tree xyz.openbmc_project.Dump.Manager `-/xyz `-/xyz/openbmc_project `-/xyz/openbmc_project/dump |-/xyz/openbmc_project/dump/bmc | `-/xyz/openbmc_project/dump/bmc/entry | `-/xyz/openbmc_project/dump/bmc/entry/101 |-/xyz/openbmc_project/dump/faultlog | `-/xyz/openbmc_project/dump/faultlog/entry | |-/xyz/openbmc_project/dump/faultlog/entry/11 | |-/xyz/openbmc_project/dump/faultlog/entry/12 | |-/xyz/openbmc_project/dump/faultlog/entry/13 | |-/xyz/openbmc_project/dump/faultlog/entry/14 | |-/xyz/openbmc_project/dump/faultlog/entry/15 | |-/xyz/openbmc_project/dump/faultlog/entry/16 | |-/xyz/openbmc_project/dump/faultlog/entry/17 | |-/xyz/openbmc_project/dump/faultlog/entry/18 | |-/xyz/openbmc_project/dump/faultlog/entry/19 | `-/xyz/openbmc_project/dump/faultlog/entry/20 |-/xyz/openbmc_project/dump/internal | `-/xyz/openbmc_project/dump/internal/manager `-/xyz/openbmc_project/dump/system `-/xyz/openbmc_project/dump/system/entry |-/xyz/openbmc_project/dump/system/entry/3 `-/xyz/openbmc_project/dump/system/entry/4 After ClearLog: busctl tree xyz.openbmc_project.Dump.Manager `-/xyz `-/xyz/openbmc_project `-/xyz/openbmc_project/dump |-/xyz/openbmc_project/dump/bmc |-/xyz/openbmc_project/dump/faultlog |-/xyz/openbmc_project/dump/internal | `-/xyz/openbmc_project/dump/internal/manager `-/xyz/openbmc_project/dump/system Confirmed that ClearLog action is listed for the following LogServices: /redfish/v1/Managers/bmc/LogServices/Dump /redfish/v1/Managers/bmc/LogServices/FaultLog /redfish/v1/Systems/system/LogServices/Dump Then ran "systemctl stop xyz.openbmc_project.Dump.Manager" (which removes dump manager objects including their xyz.openbmc_project.Collection.DeleteAll interface) and saw that the ClearLog action was no longer listed. Also locally built a version of phosphor-debug-collecor with the interface xyz.openbmc_project.Collection.DeleteAll removed from dump managers and ran it and saw that the ClearLog action wasn't listed. Redfish Service Validator passed on the following URIs (with service xyz.openbmc_project.Dump.Manager running): /redfish/v1/Managers/bmc/LogServices/Dump /redfish/v1/Managers/bmc/LogServices/FaultLog /redfish/v1/Systems/system/LogServices/Dump Note: Most dump LogService unit tests were removed in this patchset since this patchset adds a D-Bus call to getDumpServiceInfo(), and we haven't decided how to mock D-Bus calls for unit testing yet. [1] https://github.com/openbmc/phosphor-debug-collector/commit/fef66a951fe6fe283515480b2c493dfdc2275a95 Signed-off-by: Claire Weinan <cweinan@google.com> Change-Id: Ic5f8f9e3528f521887766d8710bd77f969d8236a
2023-01-13Remove a couple references to @odata.contextEd Tanous1-4/+0
9440096005902d13e27fdb8911d33c657f8c7b77 removed all uses of odata.context from the system, but there were a few left in static files, that unfortunately got propagated to code when we did the migration from static files. This commit fixes the last couple that were left. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ifc77ff02939c663106029dc57807db3b8ad537b7
2023-01-12Fix keepalive falseEd Tanous1-4/+4
When we changed [1] to using a std::move of the Request object instead of an unsafe reference, we missed one spot where we were using the request object, post handle. This commit moves the keepalive function to be set on the response object before calling handle. Tested: curl request with -H "Connection: close", -H "Connection: keep-alive" and no header all return the correct values. [1] 2d6cb56b6b47c3fbb0d234ade5c1208edb69ef1f Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I91fe32162407f1e1bdfcc06f1751e02d11f8a697
2023-01-12Add FabricAdapter schemaLakshmi Yadlapati7-0/+926
Will be used in commit https://gerrit.openbmc.org/c/openbmc/bmcweb/+/41216 From the Redfish schema "A FabricAdapter represents the physical fabric adapter capable of connecting to an interconnect fabric. Examples include but are not limited to Ethernet, NVMe over Fabrics, Gen-Z, and SAS fabric adapters." Tested: built bmcweb successfully and validator passes Change-Id: I9f8fb3bfc5b68a86b078b1261445437bdd5c550a Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-01-12Clean up http end_of_stream tracesMyung Bae1-1/+2
http::end_of_stream log is not properly detected and thus it is being traced as error. It will be fixed to be traced as warning so they do not show up when just error traces are enabled (new default) Here's the log we was getting: Jan 10 13:34:32 ever6bmc bmcweb[2496]: (2023-01-10 13:34:32) \ [ERROR "http_connection.hpp":784] 0x14bd360 Error while \ reading: end of stream Change-Id: I6ecee813c4f7806a676ba0ad3e4ab1a8f78747fd Signed-off-by: Myung Bae <myungbae@us.ibm.com>
2023-01-12Aggregation: Improve prefix fixup matchingCarson Labrado4-87/+192
Utilize the new array of top level collection URIs to determine if a given URI in the response needs to have the aggregation prefix added. This removes the need to check for specific collections like /redfish/v1/UpdateService/FirmwareInventory which do not fit the generic format of /redfish/v1/<collection>. Future patches will use this same approach to improve the logic for initially determining if and how a request should be aggregated. This patch also adds a series of unit tests for the function responsible for adding a prefix to a given URI. Cases covered include valid URIs that involve a selection of aggregated resources, top level collection URIs, other invalid URIs, and URIs with a trailing "/". Tested: Unit tests pass. Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: I676983d3c77ae3126c04e9f57ad8698c51df2675
2023-01-12Refactor mtls callbacks into their own fileEd Tanous2-161/+174
Mutual TLS is non-trivial enough that it definitely shouldn't be done in an inline lambda method. This commit moves the code. Tested: WIP. This is a pretty negligible code move; Minimal touch testing should be good. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I7a15a6bc66f4d8fb090411509549628f6d1045a5
2023-01-12Optimize task event registryEd Tanous1-79/+46
Very similar to the optimizations done for the other registries, do the same for task service, using the common implementations of the registries to deduplicate the strings present in the registry. Tested: GET /redfish/v1/Registries/TaskEvent/TaskEvent Returns the same result as previously, with the exception of an updated schema version. Redfish service validator passes. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I25bfda5d60f9dee584c9e47a5b7b995b7a14f841
2023-01-11Fix parameter type for calling getSubTreePaths methodGeorge Liu1-1/+1
The interface attribute type that calls the getSubTreePaths method should use std::string_view instead of const char*. bump is failing. https://gerrit.openbmc.org/c/openbmc/openbmc/+/60221 https://jenkins.openbmc.org/job/ci-openbmc/15513/distro=ubuntu,label=docker-builder,target=witherspoon/console Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I9dc4a710da0bdcec91a73ded89a253baa04a3550
2023-01-11Refactor GetSubTreePaths methodGeorge Liu22-192/+202
Since the GetSubTreePaths method has been implemented in dbus_utility and this commit is to integrate all the places where the GetSubTreePaths method is called, and use the method in dbus_utility uniformly. Requires https://gerrit.openbmc.org/c/openbmc/sdbusplus/+/60020 to build. Tested: Redfish Validator Passed Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: Ie4140d4484a7e4f4b943013f4371ffd2d44a22e9
2023-01-10Use actionParams struct instead of fieldsPrzemyslaw Czarnowski1-37/+33
Make validateParams use of actionParams (InsertMediaActionParams structure) instead of fields one by one. This will make possible to remove reference to crow::Response in lambda containing vaildateParams structure. Tested: none, code change Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com> Change-Id: I0f2ac76f6f7e578cb29527cd1e8f1d8ba9e94960
2023-01-10Use intermediate bmcweb object filesEd Tanous1-2/+11
If you look at an OpenBMC build, every source file is compiled for every source unit. This is pretty wasteful, but meson documents how to reuse object files between link units. This has a couple benefits: - Source files are only compiled once - There are less likely to be unit-test specific binary differences (if, for example, the unit tests used different compiler flags). - Errors in a source file only appear once in the output, instead of 10 times. On my 36 core Xeon, a normal build went from 2m38s down to 2m34s, which is quite underwhelming, and less than you'd expect from a change this large, but it turns out that if you have more parallelism than you have compile units, building things twice doesn't appear to matter much. With that said, if I simulate a smaller machine, using -J 8, the build time with this commit remains at 2m38s, whereas the commit previous to this takes 4m48s, so clearly there's some benefit here. This regression appears to have been caused by 0ad63df8aa8ab60f74395794d8ffce64c82ee031 which caused us to build multiple executables (one per unit test). This fixes the regression. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ib77e8679b69e0f2242f65c20b129f2fb8e370edb
2023-01-08Aggregation: Generate collections from schemaCarson Labrado4-0/+357
In aggregation we need to account for when a satellite BMC supports a resource collection that the aggregating BMC does not. We need to add links in responses from upstream resources to indicate that these satellite only resources exist. These top level collections do not always have the location format of /redfish/v1/<collection_id>. We determine all of those from the schema rather than hardcoding a few choice exceptions that do not fit that format such as /redfish/v1/UpdateService/FirmwareInventory. This patch is the first step in accomplishing this. We parse all xml schema files in order to determine what are the top level collection URIs. For URIs that are upstream from top level collections we'll be able to derive what URIs could appear in the response which are also on the same path to a top level collection. The xml files for resources that aren't currently supported by bmcweb are ignored when creating the schema index and later deleted once the above parsing completes. Later patches will use this information to make sure that we are properly handling all schema defined top level collections. Tested: Compiles with aggregation enabled Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: Icff825f4e4e9d84c96254561350f82839abdc074
2023-01-05Add ServiceProviderNotifyAbhishek Patel1-2/+46
Add ServiceProviderNotify property that can be used to indicate that this event log should be notified to the service provider, if that is implemented on the system. ServiceProviderNotify is an enum. Supported options are - "NotSupported", "Notify" and "Inhibit". The dbus interface and all implementations have been moved to an enum with the default value of NotSupported. When the value is NotSupported, this property is left off Redfish. For more details refer to https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/47683 Tested: Manually tested on the system, Run Redfish validator. Found no error. ''' curl -k https://$bmc/redfish/v1/Systems/system/LogServices/EventLog/Entries { "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries", "@odata.type": "#LogEntryCollection.LogEntryCollection", "Description": "Collection of System Event Log Entries", "Members": [ { "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/1", "@odata.type": "#LogEntry.v1_9_0.LogEntry", "AdditionalDataURI": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/1/attachment", "Created": "1970-01-01T00:04:20.865+00:00", "EntryType": "Event", "Id": "1", "Message": "xyz.openbmc_project.Software.Image.Error.ImageFailure", "Modified": "1970-01-01T00:04:20.865+00:00", "Name": "System Event Log Entry", "Resolved": false, "Severity": "Critical" }, .... .... ], "Members@odata.count": 49, "Name": "System Event Log Entries" } ''' busctl set-property xyz.openbmc_project.Logging /xyz/openbmc_project/logging/entry/99 xyz.openbmc_project.Logging.Entry ServiceProviderNotify s xyz.openbmc_project.Logging.Entry.Notify.Notify busctl get-property xyz.openbmc_project.Logging /xyz/openbmc_project/logging/entry/99 xyz.openbmc_project.Logging.Entry ServiceProviderNotify Entry ServiceProviderNotify Signed-off-by: Abhishek Patel <Abhishek.Patel@ibm.com> Change-Id: I774bfec157481ccc9b4966bf5e8cc8f7d9a06fd0 Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-01-04Problem with RemoteRoleMapping JSONJorge Cisneros1-9/+2
The current LDAP group map on /redfish/v1/AccountService is incorrect and is creating a bad JSON response. instead of an array of objects, is creating a nested array of objects. The problem is visible on the website adding a new LDAP group map, it will show 2 empty rows instead of one with the correct data. The current JSON data is: "RemoteRoleMapping": [ [ { "RemoteGroup": "groupname" } ], [ { "LocalRole": "Operator" } ] ], The correct JSON is: "RemoteRoleMapping": [ { "LocalRole": "Operator", "RemoteGroup": "groupname" } ], The tests redfish/account_service/test_ldap_configuration crashed BMCWEB generates around 9 core dump files. Tested: redfish/account_service/test_ldap_configuration passed the tests Adding a new LDAP group map on the website, showing the correct data, Change-Id: I5de7db372ceff1cc596da2b04f5fd730415f7216 Signed-off-by: Jorge Cisneros <jcisneros3@lenovo.com>
2023-01-03Remove old TODOEd Tanous1-5/+0
This TODO was implemented long ago by DMTF. Remove the comment. Tested: Comment only. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I4b0fc7c6fefa316d1cf824711d542f17a6f1a682
2023-01-03Ignore clang warningEd Tanous1-0/+1
Clang warns on this enum no matter what we do. Rather than adding all 27 entries of the boost::beast::verb to this, lets just ignore the warning. Tested: Code compiles on clang without warnings Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Iba5809d8f855abe7f040d81d6052eb385be8f5a1
2023-01-03Remove extra semi colonsEd Tanous1-8/+0
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I710b68218f5df32088a0ce90250763cd765b054a
2023-01-03Add missing inline on function prototypeEd Tanous1-1/+1
Clang correctly notes that this function is missing an inline definition. Tested: Code compiles further on clang (other failures still present). Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I7d6420e2bb1c0c9360ff8427857aa916142c5a66
2023-01-03Fix sensor overrideEd Tanous3-16/+69
c1d019a6056a2a0ef50e577b3139ab5a8dc49355 Sensor Optimization Recently changed the way Ids were calculated in the sensor subsystem. Unfortunately, it wasn't clear to the author that this would effect the sensor override system, which relies on matching up a member ID with a dbus path, and was broken by this change. This commit breaks out the code to calculate the type and name from a given URI segment into a helper method. Tested: Inspection only. Very few systems support this feature. Code appears more correct than previously, which is known broken, so the lack of testing here seems reasonable. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I9aa8099a947a36b5ce914bc07ae60f1ebf0d209b
2022-12-29cppcheck: Fix Ineffective call of function 'substr'Ed Tanous1-2/+2
This likely has no performance implications in practice, but getting a clean cppcheck run is good. Suggestion was implemented per cppcheck. Tested: This is in the deprecated rest API. Not sure how much testing we need to do. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I1658697730ac07c7cdefd2b73c80ee65fba4dedb
2022-12-29Add missing const in update serviceEd Tanous1-1/+1
Per cpp core guidelines, this type should be const. Tested: Code compiles. Trivial const change. cppcheck no longer warns on this line. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I04aae41701ba1203ff4a68f0b06df2459ee7bb2f
2022-12-28Generate includes for all schemasEd Tanous42-8/+2569
Even for schemas we ignore, we should still generate the enums for them, just to keep changes like [1] smaller. Tested: Code compiles. No functional binary change. [1] https://gerrit.openbmc.org/c/openbmc/bmcweb/+/55215 Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I78adf1204a319bc14900152f94161afea21f2e07
2022-12-28Add CBOR supportEd Tanous2-4/+11
CBOR is a more efficient way to represent json, and something that, as you can see from this patch, is relatively trivial to implement in our current nlohmann json handlers. This allows users that specify an accepts header of "application/cbor" to request the BMC produce a cbor response. This feature adds 1520 bytes (1.48KB) to the binary size of bmcweb. For ServiceRoot GET /redfish/v1 Accepts: application/json - returns json GET /redfish/v1 Accepts: application/cbor - returns cbor GET /redfish/v1 Accepts: */* - returns json GET /redfish/v1 Accepts: text/html - returns html GET /redfish/v1 no-accepts header - returns json For service root, CBOR encoding drops the payload size from 1520 bytes on my system, to 1021 byes, which is a significant improvement in the number of bytes we need to compress. Redfish-service-validator passes. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I847e678cf79dfd7d55e6d3b26960c419e47063af
2022-12-28Add missing usage of new verb class in routerSnehalatha Venkatesh1-4/+4
Despite introduction of a new enum class containing method verbs, some functions were still using the one from Boost. This had caused erratic behaviour when trying to create a websocket (e.g. /nbd/<str>), because enum value of old type was compared to the one of new type. This change fixes that. Tested: Verified that websockets are now created without errors. Change-Id: I52c874de9b02463618143d3b031f5c795dd42ad8 Signed-off-by: Michal Orzel <michalx.orzel@intel.com> Signed-off-by: Snehalatha Venkatesh <snehalathax.v@intel.com>
2022-12-28Fix some use-after-move issuesEd Tanous1-79/+77
This diff looks bad. The only thing that changed functionally is changing: password(std::move(password)), roleId(std::move(roleId)) in the labmda capture to password, roldId because password and roleid are getting used later. Unfortunately, clang decides to rearrange this whole lambda. Tested: Passes cppcheck. ''' curl -vvvv --insecure --user root:0penBmc -X PATCH -d '{"Password": "0penBmc1"}' https://192.168.7.2/redfish/v1/AccountService/Accounts/root ''' Succeeds at patching the root password. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I97b10a40d0b271b211bf4e6c09888d3cd568a3d0