summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-12-16error_messages: Use int64_t in invalidIndexJosh Lehan2-4/+4
Using int64_t instead of int, to permit 64-bit indices. This is to support ExternalStorer, a new project I am working on, which uses a 64-bit sequence number for long-term robustness. Change-Id: I00121933067030fd722f6b02c2d2dbd1854dff1c Signed-off-by: Josh Lehan <krellan@google.com>
2021-12-15Implement connection limitEd Tanous1-7/+9
Now that we rely on normal steady_timer, bmcweb doesn't limit http connections. This commit moves the connectionCount variable out of the debug ifdefs, and into the "normal" build. Then additionally, add a check to ensure that less than 100 connections are started at a time. This count is intended to match the code in timer_queue.hpp that limited this to 100 timers at a given time. Tested: /redfish/v1 returns properly. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I93ceaf8319d09d911b36cb7b21bba0cf64a9f7b8
2021-12-15Deduplicate doAccept codeEd Tanous1-28/+15
doAccept does essentially the same code in two ways. boost::beast::lowest_layer is used elsewhere to deduplicate this code. Use it here as well. Tested: curl -vvvv --insecure -u root:0penBmc "https://192.168.7.2:443/redfish/v1" succeeds. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Idfb0cd8f62ffbc09d6e248c677c24ea1abcb7a5b
2021-12-15Make timer system use boostEd Tanous4-227/+56
The original crow timeout system had a timer queue setup for handling many thousands of connections at a time efficiently. The most common use cases for the bmc involve a handful of connections, so this code doesn't help us much. These days, boost asio also implements a very similar timer queue https://www.boost.org/doc/libs/1_72_0/boost/asio/detail/timer_queue.hpp internally, so the only thing we're loosing here is the "fuzzy" coalescing of timeout actions, for which it's tough to say if anyone will even notice. This commit implements a timer system that's self contained within each connection, using steady_timer. This is much more "normal" and how most of the beast examples implement timers. Tested: Minimal touch testing to ensure that things work, but more testing is required, probably using sloworis to ensure that our timeouts are no longer issues. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I19156411ce46adff6c88ad97ee8f6af8c858fe3c
2021-12-15Change DateOffset from Z to +00:00Nan Zhou2-6/+6
I missed that getDateTimeOffsetNow is extracting the last 5 chars for DateTimeOffset. So this patch changes the offset to the original "+00:00" one. Tested: 1. unit tests 2. Redfish Validator Tests: no errors found on DateTime or DateTimeLocalOffset. ``` DateTime 1970-01-01T00:13:27+00:00 date Yes PASS DateTimeLocalOffset +00:00 string Yes PASS ``` All other errors are not related. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: I24977c476f18c88515d759e278ec56e5cbb73b3a
2021-12-15ssl_key_handler: support OpenSSL 3.0 for key verificationPatrick Williams1-0/+24
Loading and checking of keys is one area where OpenSSL 1.0 and 3.0 are not compatible. Many of the functions currently used in the ssl_key_handler are deprecated in 3.0, but the APIs necessary for conversion also do not exist in 1.0. Until OpenSSL 3.0 is widely used in Linux distributions we therefore need to support both APIs. Add a #define on the OPENSSL_VERSION_NUMBER to identify 3.x (or greater) support and switch between the two API sets. Tested: Added to a Yocto test build for the subtree update that includes OpenSSL 3.x and confirmed Romulus QEMU test is successful. Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I22bc77753bb32d1b92932f9918d64856a4e52af8
2021-12-15ssl_key_handler: use OpenSSL 3.0 API for keygenPatrick Williams1-0/+41
The APIs for generating an EC key for have changed between OpenSSL 1.x and OpenSSL 3.x. Create a separate implementation for OpenSSL 3.x. Tested: Copied code from phosphor-certificate-manager, which was tested using unit tests, and confirmed it builds and runs when compiled with the OpenSSL 3.x library. Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I6df0fb5429e0812763dad4a208bb914fb285fd78
2021-12-15Fix - RedFish response for non-manufacturing modeJayaprakash Mutyala1-50/+56
Issue: If system is not in manufacturing mode, RedFish response is success but sensor value is not updated Fix: If the system is not in manufacturing mode, return proper error as actionNotSupported. Tested: 1. Redfish validator - passed for this new change 2. Verified RedFish response when system in not manufacturing mode. Patch: https://<BMC-IP>/redfish/v1/Chassis/<Baseboard>/Thermal Body: { "Temperatures": [ { "MemberId": "BMC_Temp", "ReadingCelsius": 34.313 }] } Response: { "@odata.id": "/redfish/v1/Chassis/<Baseboard>/Thermal", "@odata.type": "#Thermal.v1_4_0.Thermal", "Fans": [], "Id": "Thermal", "Name": "Thermal", "Temperatures": [], "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "There are insufficient privileges for the account or credentials associated with the current session to perform the requested operation.", "MessageArgs": [], "MessageId": "Base.1.8.1.InsufficientPrivilege", "MessageSeverity": "Critical", "Resolution": "Either abandon the operation or change the associated access rights and resubmit the request if the operation failed." } ], "code": "Base.1.8.1.InsufficientPrivilege", "message": "There are insufficient privileges for the account or credentials associated with the current session to perform the requested operation." } } Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com> Change-Id: I3c6bfc9d37e1e8648ad0ff713929ad3fd06f437b
2021-12-14hostlogger_test.py: reformat with blackPatrick Williams1-12/+16
pycodestyle was throwing errors in CI. Run 'black' to reformat the script. Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I5138493c1e0641f0e927d0cc463ff6023f54454a
2021-12-13Add Spare Part Number for ChassisAlpana Kumari1-5/+20
Spare part number field is missing from Chassis URI via Redfish This commit added that. Test: curl -k -H "X-Auth-Token: $bmc_token" -X GET https://${bmc}:${port}/redfish/v1/Chassis/chassis { "@odata.id": "/redfish/v1/Chassis/chassis", "@odata.type": "#Chassis.v1_14_0.Chassis", "Actions": { "#Chassis.Reset": { "@Redfish.ActionInfo": "/redfish/v1/Chassis/chassis/ResetActionInfo", "target": "/redfish/v1/Chassis/chassis/Actions/Chassis.Reset" } }, "ChassisType": "RackMount", "Id": "chassis", ... "Location": { "PartLocation": { "ServiceLabel": "U78DA.ND0.WZS0066" } }, "Manufacturer": "", "Model": "2E2D", "Name": "chassis", ... "PartNumber": "03KP024", ... "PowerState": "Off", ... "SerialNumber": "YF32UF18C00A", "SparePartNumber": "02WG677", <-------------------SparePartNumber "Status": { "Health": "OK", "HealthRollup": "OK", "State": "StandbyOffline" }, Signed-off-by: Alpana Kumari <alpankum@in.ibm.com> Change-Id: Ia29c8d76b3c110f150cd7dbaf7937a0bc9922b98
2021-12-11fix the year 2038 problem in getDateTimeNan Zhou8-48/+62
The existing codes cast uint64_t into time_t which is int32_t in most 32-bit systems. It results overflow if the timestamp is larger than INT_MAX. time_t will be 64 bits in future releases of glibc. See https://sourceware.org/bugzilla/show_bug.cgi?id=28182. This change workarounds the year 2038 problem via boost's ptime. std::chrono doesn't help since it is still 32 bits. Tested on QEMU. Example output for certificate: { "Name": "HTTPS Certificate", "Subject": null, "ValidNotAfter": "2106-01-28T20:40:31Z", "ValidNotBefore": "2106-02-06T18:28:16Z" } Previously, the format is like "1969-12-31T12:00:00+00:00". Note that the ending "+00:00" is the time zone, not ms. Tested the schema on QEMU. No new Redfish Service Validator errors. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I8ef0bee3d724184d96253c23f3919447828d3f82
2021-12-10Add logging to internal errorEd Tanous3-2/+34
Internal error call sites are propagated through the code, and might be triggered multiple times in the course of a request, which makes them difficult to track the source of. This commit changes the internalError() method to include a print of which invocation within bmcweb triggered the error, using c++20s std::source_location mechanism. Note: clang-13 still doesn't implement std::source_location, so this commit pulls source_location.hpp from lg2 to be able to support all compilers. Tested: Loaded in qemu, and added an internalError() call into systems.hpp for the /redfish/v1/Systems handler. Observed that [CRITICAL "error_messages.cpp":234] Internal Error ../../../../../../workspace/sources/bmcweb/redfish-core/include/../lib/systems.hpp(2820:40) `redfish::requestRoutesSystemsCollection(App&)::<lambda(const crow::Request&, const std::shared_ptr<bmcweb::AsyncResp>&)>`: Got printed to the bmcweb logs. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ic1b4240422445357bc87404de814ad14f86b9edf
2021-12-10Clean up meson listsEd Tanous1-46/+35
Alphabetize all lists. Being alphabetical allows us to be more consistent, improves readability for some of the larger lists, and decreases the likelihood that patches conflict when doing inserts into lists. At the same time, some elements were duplicated between the lists, so deduplicate them. Note, for lists where order matters, like the c++ warnings, -Wno-* are put in the lists after the -W* options. Tested: Code builds. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I1fe715c412d3b49bee58d0269a415bf919d62064
2021-12-10Redfish: Script to Expose Host Log EntriesSpencerKu1-0/+88
Simple script to expose host serial console logs, Search and get the log via redfish in every 5 seconds option: --host : Host to connect to --cert : File path to cert --username : Username to connect with --password : Password to use Signed-off-by: SpencerKu <Spencer.Ku@quantatw.com> Change-Id: Ia95735e2f03a4361ee876774b5906df18ab013b8
2021-12-10Remove non-standard IPv6StaticAddress propertiesJiaqing Zhao1-3/+1
AddressOrigin and AddressState are not defined in redfish schema of IPv6StaticAddress, which causes redfish validator error, so remove them. Tested: Redfish validator passed. Change-Id: I165f22662cecf25cefb2c0f6ce4777eb681e9b23 Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2021-12-10Convert IPv4-mapped IPv6 ClientIP back to IPv4Jiaqing Zhao8-12/+66
Current HTTP server creates an IPv6 acceptor to accept both IPv4 and IPv6 connections. In this way, IPv4 address will be presented as IPv6 address in IPv4-mapped format. This patch converts it back to IPv4. Tested: Verified the ClientOriginIP in Session is shown in native IPv4 format instead of IPv4-mapped IPv6 format. Change-Id: Icd51260b2d4572d52f5c670128b7f07f6b5e6912 Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2021-12-10Restructure Redfish EventLog Transmit code flowP Dheeraj Srujan Kumar1-42/+50
In the current implementation: 1. When Event service is disabled and enabled back after a while, all the logs during this time span between disable to enable are dumped to the Event listener. 2. When two(or more) events occur very close (in terms of microseconds) and they trigger multiple iNotify events, the listener receives all of these events with the same Event ID. This occurs as the last log timestamp read from redfish file and previous time stamp used to generate Event ID's are not being updated continuously. This commit fixes this issue by tweaking the logic to continuously update the time stamp values (even when Event Service is disabled), and also replaces multiple string operations with file operations. i.e. Instead of looping through the entire Redfish file until last timestamp read is reached, this fix makes use of seekg to get to the last read position. Tested: - Subscribed to an event and successfully received Event Logs. - No Event Logs were received when Event Service was disabled. - No Dump of past Events after Event Service was enabled. - Redfish Validator passed Change-Id: Id8407ff7e9fc48e7810c9193ef43f707b9615c36 Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> Signed-off-by: Ankita Vilas Gawade <ankita.gawade@intel.com>
2021-12-09Fix bmcweb core-dump caused by Split up authenticatezhanghaicheng1-11/+0
Ed changed the code from req.emplace(parser->release()) to req.reset() in line 728 of the http/http_connection.hpp file in this patch https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/47122. So req cannot be used in doReadHeaders(). These codes are not necessary, so I choose to delete them. Tested: 1. Keep these codes and set bmcweb-logging=enabled, then log in to bmcweb using webui. Bmcweb will core-dump. 2. Delete these codes, bmcweb works normally. Signed-off-by: zhanghaicheng <zhanghch05@inspur.com> Change-Id: I1875a3fe4fa1d03656631435508b3876d8a42e54
2021-12-08Fix bmcweb crash problem when no-authJunLin Chen1-2/+5
After insecure-disable-auth=enabled. it is not needed to do login and establish session before request. GET /redfish/v1/AccountService/Accounts won't get any status code and cause the bmcweb service crashed. Set the default string value for `thisUser`. Assign the user only if the session is not nullptr. Test: Use no-auth: curl -k -X GET https://<bmcip>/redfish/v1/AccountService/Accounts { "@odata.id": "/redfish/v1/AccountService/Accounts", "@odata.type": "#ManagerAccountCollection.ManagerAccountCollection", "Description": "BMC User Accounts", "Members": [], "Members@odata.count": 0, "Name": "Accounts Collection" } Use basic-auth: curl -k -u root:0penBmc -X GET https://<bmcip>/redfish/v1/AccountService/Accounts { "@odata.id": "/redfish/v1/AccountService/Accounts", "@odata.type": "#ManagerAccountCollection.ManagerAccountCollection", "Description": "BMC User Accounts", "Members": [ { "@odata.id": "/redfish/v1/AccountService/Accounts/root" } ], "Members@odata.count": 1, "Name": "Accounts Collection" } Signed-off-by: JunLin Chen <Jun-Lin.Chen@quantatw.com> Change-Id: Ifa9844c4dbc2f172338b24fba7a09ae013b6d473 Signed-off-by: Willy Tu <wltu@google.com>
2021-12-08span: clean up stray boost headers.Patrick Williams2-1/+2
We recently switched from boost::beast::span to std::span, but a few header tweaks were not complete and we were still including beast::span. Remove the header file and add a '#include <span>' for one header which uses span but was missing. Tested: Compiles and unit tests pass. Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I675c55df1abf78dfa244fced3d50679ffe1b6d91
2021-12-07fixed errors in EventServiceKrzysztof Grobelny1-4/+2
- Initialized boost::circular_buffer_space_optimized<std::string> which was not initialized. It prevented any event from being send. - Removed line 'parser->skip(true)' which cause all received responses to be interpreted as errors. It was triggering retry which resulted in sensing same event multiple times. Tested: POST redfish/v1/EventService/Subscriptions, body: { "Destination": "https://127.0.0.1:4042/", "Protocol": "Redfish", "EventFormatType": "MetricReport" } { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The resource has been created successfully", "MessageArgs": [], "MessageId": "Base.1.8.1.Created", "MessageSeverity": "OK", "Resolution": "None" } ] } POST redfish/v1/TelemetryService/MetricReportDefinitions, body: { "Id": "TestReport", "Metrics": [ { "MetricId": "TestMetric", "MetricProperties": [ "/redfish/v1/Chassis/chassis/Thermal#/Temperatures/7/ReadingCelsius" ] } ], "MetricReportDefinitionType": "OnRequest", "ReportActions": [ "RedfishEvent", "LogToMetricReportsCollection" ] } { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The resource has been created successfully", "MessageArgs": [], "MessageId": "Base.1.8.1.Created", "MessageSeverity": "OK", "Resolution": "None" } ] } GET redfish/v1/TelemetryService/MetricReports/TestReport { "@odata.id": "/redfish/v1/TelemetryService/MetricReports/TestReport", "@odata.type": "#MetricReport.v1_3_0.MetricReport", "Id": "TestReport", "MetricReportDefinition": { "@odata.id": "/redfish/v1/TelemetryService/MetricReportDefinitions/TestReport" }, "MetricValues": [ { "MetricId": "TestMetric", "MetricProperty": "/redfish/v1/Chassis/chassis/Thermal#/Temperatures/7/ReadingCelsius", "MetricValue": "-8388608000.000000", "Timestamp": "1970-04-12T02:28:53+00:00" } ], "Name": "TestReport", "Timestamp": "1970-04-12T06:08:17+00:00" } EVENT RECEIVED { "@odata.id": "/redfish/v1/TelemetryService/MetricReports/TestReport", "@odata.type": "#MetricReport.v1_3_0.MetricReport", "Id": "TestReport", "MetricReportDefinition": { "@odata.id": "/redfish/v1/TelemetryService/MetricReportDefinitions/TestReport" }, "MetricValues": [ { "MetricId": "TestMetric", "MetricProperty": "/redfish/v1/Chassis/chassis/Thermal#/Temperatures/7/ReadingCelsius", "MetricValue": "-8388608000.000000", "Timestamp": "1970-04-12T02:28:53+00:00" } ], "Name": "TestReport", "Timestamp": "1970-04-12T06:08:17+00:00" } Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com> Change-Id: I4912853c3b59593e7032424d0b48aca7a36889b3
2021-12-07Delete the copy constructor on the Request objectEd Tanous1-0/+3
This code was in the codebase previously, and at some point got removed to make copies. Considering the previous commits to this one, making copies of the request object is a bad idea, and should be avoided. Therefore, this commit deletes the copy constructor for the Request object, making request copies fail to compile. It should be noted, it does leave the move constructor, which I don't think it's really used, but as a rule isn't an anti-pattern. Tested: Code compiles. No functional change. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ib38ed79a7c60340fb00f922f29265a3c3c7beca8
2021-12-07Remove copies from log services and virtual mediaEd Tanous2-62/+62
Both of these entries make complete copies of the Request object. Following the pattern in the prior commit, move these to more modern patterns. For log service, this simply means constructing a payload object earlier. For virtual media, it means doing the readJson call and parameter validation much earlier, which generally is the pattern we should strive for, validating and unpacking the structs in the first scope, then dealing with them as structures. To do this, this commit also creates a secondary struct to store the param data in to make the lambdas cleaner. Tested: From Ashmitha POST https://${bmc}/redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData -d '{"DiagnosticDataType":"Manager"}' { "@odata.id": "/redfish/v1/TaskService/Tasks/0", "@odata.type": "#Task.v1_4_3.Task", "Id": "0", "TaskState": "Running", "TaskStatus": "OK" } ----------------------------------------------------------------- On task completion: GET https://${bmc}/redfish/v1/TaskService/Tasks/0 { "@odata.id": "/redfish/v1/TaskService/Tasks/0", "@odata.type": "#Task.v1_4_3.Task", "EndTime": "2021-12-03T13:40:58+00:00", "Id": "0", "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" }, { "@odata.type": "#Message.v1_1_1.Message", "Message": "Successfully Completed Request", "MessageArgs": [], "MessageId": "Base.1.8.1.Success", "MessageSeverity": "OK", "Resolution": "None" } ], "Name": "Task 0", "Payload": { "HttpHeaders": [ "Host: 9.3.29.238", "User-Agent: curl/7.71.1", "Accept: */*", "Content-Length: 32", "Location: /redfish/v1/Managers/bmc/LogServices/Dump/Entries/32" ], "HttpOperation": "POST", "JsonBody": "{\n \"DiagnosticDataType\": \"Manager\"\n}", "TargetUri": "/redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData" }, "PercentComplete": 0, "StartTime": "2021-12-03T13:38:20+00:00", "TaskMonitor": "/redfish/v1/TaskService/Tasks/0/Monitor", "TaskState": "Completed", "TaskStatus": "OK" } Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I178a3a7a7b27dfd34ec50a06398ac243a9d4ab67
2021-12-07Enable stringop warningsEd Tanous1-5/+0
The bug mentioned in the meson file has long since been closed, so reenable the compiler option. Tested: Code builds without warnings. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ie88b7e40d7a56718b9be29a6bfccf2b9a0831b30
2021-12-07/s/boost::beast::span/std::spanEd Tanous3-26/+26
std::span is now available in c++ 20 builds, and should be a drop in replacement for boost::span we were using previously. This commit sed replaces it, and changes reference to cbegin and cend to begin and end respectively. Tested: Ran redfish-service-validator. No new failures, and all nodes within /redfish/v1/Registries that would be effected by this change respond with 200 and the same content as previously. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Iace89473b7c20f32106eae9d872c16cfae5f17f6
2021-12-05Enhance logs for networkd, hypervisor networkd appAsmitha Karunanithi2-0/+16
Everytime a user does a GET on the ethernet interface redfish endpoint the journal logs gets filled with errors like the following: curl command: GET https://${bmc}/redfish/v1/Managers/bmc/EthernetInterfaces/eth1 GET https://${bmc}/redfish/v1/Systems/hypervisor/EthernetInterfaces/eth1 [ERROR "hyperv \ isor_system.hpp":211] Got extra property: Type on the /xyz/openbmc_pr \ oject/network/hypervisor/eth0/ipv4/addr0 object [ERROR "ethernet.hpp":499] Got extra property: Type on the \ /xyz/openbmc_project/network/hypervisor/eth0/ipv4/addr0 object While extracting the ip object, the properties Type & Gateway in the implementation are logged as errors, but they are not. The reason is, these two properties are not used but only the origin, prefix length, and address are fetched from the dbus to fill the ipv<4/6>config object. This commit avoids logging the above properties as errors. If there are properties other than these, then error will logged. Tested By: Before the changes: Nov 26 06:10:46 bmc bmcweb[264]: (2021-11-26 06:10:46) [ERROR "hyperv \ isor_system.hpp":211] Got extra property: Type on the /xyz/openbmc_pr \ oject/network/hypervisor/eth0/ipv4/addr0 object Nov 26 06:10:46 bmc bmcweb[264]: (2021-11-26 06:10:46) [ERROR "hyperv \ isor_system.hpp":211] Got extra property: Origin on the /xyz/openbmc_ \ project/network/hypervisor/eth1/ipv4/addr0 object Nov 26 06:10:46 bmc bmcweb[264]: (2021-11-26 06:10:46) [ERROR "hyperv \ isor_system.hpp":211] Got extra property: Type on the /xyz/openbmc_pr \ oject/network/hypervisor/eth1/ipv4/addr0 object After changes: These traces wont be logged as errors. Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com> Change-Id: I7160d3f71121a9758124a7c29517176e396c333e
2021-12-04test: time_utils: fix negative testPatrick Williams1-1/+1
On systems with newer libc, the previously failing time conversion test is now successful: ../redfish-core/ut/time_utils_test.cpp:27: Failure Expected equality of these values: fromDurationString("P99999999999999999DT") Which is: (8-byte object <00-A4 D9-92 19-D6 A8-56>) std::nullopt Which is: 1-byte object <00> Add some more 9s to make the test fail again. Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ib7d336ef4f334bd2263c408bd0c333f20a908e39
2021-12-01Make OWNERS match MAINTAINERSGunnar Mills1-0/+3
Krzysztof was added as a reviewer in the MAINTAINERS file but not OWNERS file as part of 4576ec1. Add Krzysztof as a reviewer in OWNERS. One day this should mean Krzysztof is automatically added to bmcweb reviews, after support for automatically adding Reviewers is added. Copied syntax from other repos OWNERS. E.g. https://github.com/openbmc/docs/blob/master/OWNERS#L39 Change-Id: I6b721fe5d6eb1c45a9476c2b89d25b6998f6bb1d Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2021-12-01Move to 2021.3Gunnar Mills24-61/+765
Update the script to point at 2021.3, change the path of the files since they moved again, and run the script. Since we have an exclude list, this only brings in new versions of schemas bmcweb already uses. Overview of 2021.3: https://www.dmtf.org/sites/default/files/Redfish_Release_2021.3_Overview.pdf Overall, the release wasn't huge. IBM plans to use: PCIeSlot to Processor FabricAdapter to PCIeDevice Tested: See new schemas. No new validator errors. curl -k https://$bmc/redfish/v1/JsonSchemas/Certificate/Certificate.json { "$id": "http://redfish.dmtf.org/schemas/v1/Certificate.v1_5_0.json", Change-Id: Idf28cb164d220b059dace91e352fee732bf0c842 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2021-12-01Sync Telmetry service with EventServiceWludzik, Jozef2-105/+59
Synced the latest changes in Telemetry service with Event Service code. Now assembling MetricReport is covered in single place in code. Updated method of fetching Readings from Telemetry by Event Service. Using ReportUpdate signal is no longer supported. Now Event Service monitors for PropertiesChanged signal from /xyz/openbmc_project/Telemetry/Reports path. Tested: - Verified that EventListener received MetricReport response from Event Service in insecure http push style eventing mode Change-Id: I2fc1841a6c9259a8bff30b34bddc0d4aabd41912 Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com> Signed-off-by: Lukasz Kazmierczak <lukasz.kazmierczak@intel.com>
2021-12-01Add Krzysztof as a reviewerKrzysztof Grobelny1-0/+1
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com> Change-Id: I5122392652b95e7b9f4c1f153db304b2a770bf72
2021-12-01redfish-core: processor: Add Model, Microcode, StepBrandon Kim1-4/+36
Add implementation of ProcessorId from Processor DMTF Schema. "EffectiveModel", "MicrocodeInfo" and "Step" are mapped to "Model", "Microcode" and "Step" from phosphor-dbus-interfaces Tested: With some of the information redacted as XX, we can see: ``` { "@odata.id": "/redfish/v1/Systems/system/Processors/cpu0", "@odata.type": "#Processor.v1_11_0.Processor", "Id": "cpu0", "MaxSpeedMHz": 0, "Name": "Processor", "ProcessorId": { "EffectiveFamily": "X", "EffectiveModel": "XX", "MicrocodeInfo": "XXX", "Step": "X" }, "ProcessorType": "CPU", "Socket": "0", "Status": { "Health": "OK", "State": "Enabled" }, "TotalCores": XX, "TotalThreads": XXX } ``` The Redfish-Service-Validator passed for Processors: ``` *** /redfish/v1/Systems/system/Processors Type (#ProcessorCollection.ProcessorCollection), GET SUCCESS (time: 0.286532) ... ... *** /redfish/v1/Systems/system/Processors/cpu0 Type (#Processor.v1_11_0.Processor), GET SUCCESS (time: 0.434741) PASS ... ... *** /redfish/v1/JsonSchemas/Processor Type (#JsonSchemaFile.v1_0_2.JsonSchemaFile), GET SUCCESS (time: 0.134821) PASS ``` Signed-off-by: Brandon Kim <brandonkim@google.com> Change-Id: Ie770bfcdb8bf9d5efbf90cc9d9c09daaf8447a6f
2021-11-23Remove obsolete Boost preprocessor optionsJonathan Doman1-7/+0
* SYSTEM_NO_DEPRECATED no longer exists and was replaced by the opposite option SYSTEM_ENABLE_DEPRECATED * ERROR_CODE_HEADER_ONLY no longer exists. * NO_RTTI and NO_TYPEID are auto-detected and should not be set by user. * COROUTINES_NO_DEPRECATION_WARNING no longer exists. * URL_STANDALONE no longer exists. * URL_HEADER_ONLY no longer exists. Tested: compiled bmcweb binary is exactly the same before and after change, both built within OpenBMC yocto and externally. Signed-off-by: Jonathan Doman <jonathan.doman@intel.com> Change-Id: I09fcab614452b9f011e84e4f7fa57908f57057a6
2021-11-19Update clang-formatGeorge Liu20-1458/+1396
refer: https://github.com/openbmc/docs/blob/master/style/cpp/.clang-format `Don't break long string literals` Tested: built bmcweb successfully and RedfishValidator Passed. Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: Ib58f7c942fd3838592e043c57e0b6ffcdc3d963b
2021-11-18Remove Jason as a maintainerJason M. Bills2-2/+0
I have not been able to dedicate the amount of time to bmcweb that I would like to as a maintainer, so I am removing myself. Change-Id: Ie9fdf0b6cf5074d6454e88d61c2c24925f69202d Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
2021-11-18meson_options: implement disable-auth; delete pamNan Zhou4-13/+15
Implemented the disable-auth option. This patch also removed the pam option which never worked. Tested: With disable-auth, ``` ~# wget -qO- http://localhost/redfish/v1/Systems/ { "@odata.id": "/redfish/v1/Systems", "@odata.type": "#ComputerSystemCollection.ComputerSystemCollection", "Members": [ { "@odata.id": "/redfish/v1/Systems/system" } ], "Members@odata.count": 1, "Name": "Computer System Collection" } ``` Without disable-auth, ``` ~# wget -qO- http://localhost/redfish/ { "v1": "/redfish/v1/" } ~# wget -qO- http://localhost/redfish/v1/Systems/system wget: server returned error: HTTP/1.1 401 Unauthorized ``` Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: I88e4e6fa6ed71096bc866b42b9af283645a65988
2021-11-18chassis: Remove boost::ends_with methodGeorge Liu1-2/+4
The boost::ends_with method should be replaced with sdbusplus::message::object_path. Tested: curl -k https://$bmc/redfish/v1/Chassis/chassis { "@odata.id": "/redfish/v1/Chassis/chassis", "@odata.type": "#Chassis.v1_14_0.Chassis", "Actions": { "#Chassis.Reset": { "@Redfish.ActionInfo": "/redfish/v1/Chassis/chassis/ResetActionInfo", "target": "/redfish/v1/Chassis/chassis/Actions/Chassis.Reset" } }, "ChassisType": "RackMount", "Id": "chassis", "Links": { "ComputerSystems": [ { "@odata.id": "/redfish/v1/Systems/system" } ], "ManagedBy": [ { "@odata.id": "/redfish/v1/Managers/bmc" } ] }, "Manufacturer": "", "Model": "23", "Name": "chassis", "PCIeDevices": { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices" }, "PartNumber": "", "Power": { "@odata.id": "/redfish/v1/Chassis/chassis/Power" }, "PowerState": "Off", "Sensors": { "@odata.id": "/redfish/v1/Chassis/chassis/Sensors" }, "SerialNumber": "", "Status": { "Health": "OK", "HealthRollup": "OK", "State": "StandbyOffline" }, "Thermal": { "@odata.id": "/redfish/v1/Chassis/chassis/Thermal" } } curl -k https://$bmc/redfish/v1/Chassis/chassis15363 { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type #Chassis.v1_14_0.Chassis named chassis15363 was not found.", "MessageArgs": [ "#Chassis.v1_14_0.Chassis", "chassis15363" ], "MessageId": "Base.1.8.1.ResourceNotFound", "MessageSeverity": "Critical", "Resolution": "Provide a valid resource identifier and resubmit the request." } ], "code": "Base.1.8.1.ResourceNotFound", "message": "The requested resource of type #Chassis.v1_14_0.Chassis named chassis15363 was not found." } } Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: Ieb9e9b02f1d66529e237815610365c33d7d8a079
2021-11-18EventService: Pass httpHeaders to subscriberSunitha Harish2-8/+13
Custom http headers provided by the subscriber was not passed on to the http client request header This commit passes the http headers to the Subscriber constructor Tested by: Subscribe to events with custom headers Verify the event request packet sending the custom header to the subscriber Verified persistency of the subscription Signed-off-by: Sunitha Harish <sunharis@in.ibm.com> Change-Id: I9a4f59b6e9477fae96b380565885f4ac51e2a628
2021-11-17chassis: refactor chassis property to prepare for future supportWilly Tu1-70/+71
Move `LocationCode` and `UUID` to a method to cleanup the the main Chassis handler. Tested: RedfishValidator Passed ``` *** /redfish/v1/Chassis/chassis0 INFO - Type (#Chassis.v1_14_0.Chassis), GET SUCCESS (time: 0.405691) WARNING - Thermal: The given property is deprecated by revision: This link has been deprecated in favor of the ThermalSubsystem link property. WARNING - Power: The given property is deprecated by revision: This link has been deprecated in favor of the PowerSubsystem link property. INFO - PASS INFO - ... *** /redfish/v1/Chassis/chassis1 INFO - Type (#Chassis.v1_14_0.Chassis), GET SUCCESS (time: 0.406565) WARNING - Thermal: The given property is deprecated by revision: This link has been deprecated in favor of the ThermalSubsystem link property. WARNING - Power: The given property is deprecated by revision: This link has been deprecated in favor of the PowerSubsystem link property. INFO - PASS INFO - *** /redfish/v1/Chassis/chassis1/Sensors INFO - Type (#SensorCollection.SensorCollection), GET SUCCESS (time: 0.358176) INFO - PASS INFO - *** /redfish/v1/Chassis/chassis1/ResetActionInfo INFO - Type (#ActionInfo.v1_1_2.ActionInfo), GET SUCCESS (time: 0.369962) INFO - PASS ... ``` Example, ``` $ curl -u root:0penBmc -X GET http://localhost:3967/redfish/v1/Chassis/chassis1 { "@odata.id": "/redfish/v1/Chassis/chassis1", "@odata.type": "#Chassis.v1_14_0.Chassis", "Actions": { "#Chassis.Reset": { "@Redfish.ActionInfo": "/redfish/v1/Chassis/chassis1/ResetActionInfo", "target": "/redfish/v1/Chassis/chassis1/Actions/Chassis.Reset" } }, "ChassisType": "RackMount", "Id": "chassis1", "Links": { "ComputerSystems": [ { "@odata.id": "/redfish/v1/Systems/system" } ], "ManagedBy": [ { "@odata.id": "/redfish/v1/Managers/bmc" } ] }, "Location": { "PartLocation": { "ServiceLabel": "PE0" } }, "Manufacturer": "manufacturer1", "Model": "model1", "Name": "chassis1", "PCIeDevices": { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices" }, "Power": { "@odata.id": "/redfish/v1/Chassis/chassis1/Power" }, ... } ``` Change-Id: I7a26530d3d718ce8fbf4182ee565f9fe9d94c5b5 Signed-off-by: Willy Tu <wltu@google.com>
2021-11-17Revert "Adds new redfish unit testing for serviceroot"Ed Tanous2-65/+1
This reverts commit d8f8b2ef4c73f38ec466861b753b71eaabae271c. Reason for revert: Broke the build. Other patches got reverted. Change-Id: I4922f516ca08660f5fdc725b2c3ec8831386b4dd
2021-11-17Adds new redfish unit testing for servicerootJohn Edward Broadbent2-1/+65
This type of testing can validate bmcwebs generated redfish. The ability to validate the output of bmcweb is extremely useful because it will guarantee correctness in certain cases. This is an example of redfish unit testing. The long term goal is to apply this type of testing to several other redfish responses. To make this change many previous changes were needed * Break serviceroot callback into the free function. * Change ownership of the request and response objects. * Change setCompleteRequestHandler logic Signed-off-by: John Edward Broadbent <jebr@google.com> Change-Id: I560cbb0309c25670cacd81c32bccae3445ccca7b
2021-11-16reduce error traces in connection and auth codeAndrew Geissler2-4/+12
These logs are reported in good paths (at least web interfaces are working fine when they are logged). Convert them to warnings so they do not show up as false errors when debugging bmcweb. Here's the log we were getting: Oct 08 19:20:48 p10bmc bmcweb[15348]: (2021-10-08 19:20:48) [ERROR "http_connection.hpp":537] 0x14bd360 Error while reading: end of stream Oct 08 19:20:48 p10bmc bmcweb[15348]: (2021-10-08 19:20:48) [ERROR "http_connection.hpp":531] 0x14910b0 async_read_header 308 Bytes Oct 08 19:20:48 p10bmc bmcweb[15348]: (2021-10-08 19:20:48) [ERROR "authorization.hpp":292] authHeader= These code paths, and why they are not real errors, is not totally clear to me. Hoping for some discussion on it in this review. Tested: - Verified these no longer show up when doing basic system management with just error traces enabled in bmcweb Change-Id: If357aeb93ff28ef02e135a888524e057cb188871 Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
2021-11-16Revert "Change the completionhandler to accept Res"Gunnar Mills6-56/+52
This reverts commit 91995f3272010875e1559397e98ca93354066a0e. Seeing bumps fail. https://gerrit.openbmc-project.xyz/c/openbmc/openbmc/+/48864 Please fix, test, and resubmit. Change-Id: Id539fe66d5a093caf8f22a393f7af7b58ead5247 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2021-11-16Revert "Remove AsyncResp from openHandler"Gunnar Mills7-15/+28
This reverts commit 0f3d3a01aed4040ef73a977a958ecdf4f68111f6. Seeing bumps fail. Change-Id: Ida7b1bae48abbed2e00a5259e8f94b64168d4788 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2021-11-16Remove AsyncResp from openHandlerzhanghch057-28/+15
This change, moving the openHandler back to only supporting websocket disconnects and not 404s.Because AsyncResp is removed from openHandler. Tested: Opened KVM in webui-vue and it works. Signed-off-by: zhanghaicheng <zhanghch05@inspur.com> Change-Id: I90811f4ab91ad41cb298877f76252dce80932b2b
2021-11-16reduce error traces in priv and chassis codeAndrew Geissler2-4/+4
These are not error paths so do not log them as errors Tested: - None other then CI. Changes are very simple. Change-Id: I65b99b466ba2d59c304cd80c88c2c81b940829b9 Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
2021-11-16Change the completionhandler to accept Reszhanghch056-52/+56
These modifications are from WIP:Redfish:Query parameters:Only (https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/47474). And they will be used in Redfish:Query Parameters:Only. (https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/38952) The code changed the completion handle to accept Res to be able to recall handle with a new Response object. AsyncResp owns a new res, so there is no need to pass in a res. Tested: 1.Basic and Token auth both still work. 2.Use scripts/websocket_test.py to test websockets. It is still work correctly. python3 websocket_test.py --host 127.0.0.1:2443 This modification is a public part, so you can use any URL to test this function. The response is the same as before. Signed-off-by: zhanghaicheng <zhanghch05@inspur.com> Change-Id: I570e32fb47a9a90fe111fcd1f4054060cd21def3
2021-11-16Fix build on clangEd Tanous1-2/+2
New code was missing an inline parameter on a method. Tested: Code now compiles on clang. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I1256c70d37df82c92080667531e98c49b35e7d0b
2021-11-16Redfish: Repair the wrong change made by non-adminEd Tanous1-21/+24
In Redfish spec, the Operator and Readonly group should only change their own passwd using patch in ManagerAccount. (because of their ConfigureSelf privilege) But now they can even modify their RoleId in the code. https://www.dmtf.org/sites/default/files/standards/documents/DSP2046_2021.2.pdf Test: the 'xiao' is a Operator ~ curl -k -H "X-Auth-Token: $token" -X PATCH -d '{"RoleId":"ReadOnly"}' https://${bmc}/redfish/v1/AccountService/Accounts/xiao { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "There are insufficient privileges for the account or credentials associated with the current session to perform the requested operation.", "MessageArgs": [], "MessageId": "Base.1.8.1.InsufficientPrivilege", "MessageSeverity": "Critical", "Resolution": "Either abandon the operation or change the associated access rights and resubmit the request if the operation failed." } ], "code": "Base.1.8.1.InsufficientPrivilege", "message": "There are insufficient privileges for the account or credentials associated with the current session to perform the requested operation." } }% Signed-off-by: Xiaochao Ma <maxiaochao@inspur.com> Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I9befcd94ee3a0b55f1ae7af38eb40e5f92fc3264
2021-11-13Drive: Refactor Drive property request functionsWilly Tu1-110/+127
Refactor the drive resource and reorganized the code. Tested: Passed Redfish Validator with no new error. ``` *** /redfish/v1/Systems/system/Storage/storage0/Drives/drive0 Type (#Drive.v1_7_0.Drive), GET SUCCESS (time: 0.307086) PASS ``` ``` { "@odata.id": "/redfish/v1/Systems/system/Storage/storage0/Drives/drive0", "@odata.type": "#Drive.v1_7_0.Drive", "Id": "drive0", "Name": "drive0", "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" } } ``` Change-Id: Iceba90b39bd2d7a423c7fae03760b81a8e010606 Signed-off-by: Willy Tu <wltu@google.com>