summaryrefslogtreecommitdiff
path: root/redfish-core
AgeCommit message (Collapse)AuthorFilesLines
2023-10-23Update schemas to 2023.2Ed Tanous16-1/+284
To quote from The Redfish release [1] 2022.3 Redfish Schema Bundle – This .zip file contains the current versions of all Redfish schemas. The bundle includes 40 schema updates and developer resources. Added Compute Express Link (CXL) support (NEW) Extensions to Fabric, PCIeDevice, Processor, Memory, ComputerSystem, and Chassis schemas Defined by DMTF alliance partner Compute Express Link (CXL) Consortium Extensions to Fabric, PCIeDevice, Processor, Memory, ComputerSystem, and Chassis schemas New CXLLogicalDevice schema Added MultiFactorAuth to AccountService to configure a service for multi-factor authentication HTTP Basic authentication is not available for accounts configured for multi-factor authentication For client certificate authentication, the client provides their identity certificate during TLS handshaking For RSA SecurID, Google Authenticator, and Microsoft Authenticator, clients provide a new Token property in the session creation request Added Heater and HeaterMetrics resources [1] https://www.dmtf.org/content/redfish-release-20223-now-available Change-Id: Iefe80866bfb83e65ab98b2cf4ee2eacce5238c5b Signed-off-by: Ed Tanous <ed@tanous.net>
2023-10-20LogService: Retrieve dump generated by ManagerCarson Labrado2-108/+207
Adds support for retrieving the dump file that's generated by phosphor-debug-collector as a result of using the LogServices/Dump Action LogService.CollectDiagnosticData from the bmc Manager resource. Refactors the handling for /redfish/v1/Systems/<str>/LogServices/EventLog/Entries/<str>/attachment to use one of the new functions and remove the large lambda. Tested: I began the dump generation process by sending a POST request to /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData. That spawned a Task to track the dump being generated by phosphor-debug-collector. The dump was retrieved by querying the /redfish/v1/Managers/bmc/LogServices/Dump/Entries/<str>/attachment URI which is associated with the Task. Verified that an event log returned by querying /redfish/v1/Systems/<str>/LogServices/EventLog/Entries/<str>/attachment is the same as it was before this change. Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: I352b2628a9990bbde40f22e6134f02c89189c925
2023-10-11Fix update_schemas.py to add Oem JsonSchemasMyung Bae1-0/+4
GET on redfish/v1/JsonSchema does not show OEM schemas but shows only DMTF redfish schemas. It is because Oem schemas are not included into `schemas.hpp`. In addition, the explicit OEM JsonSchema gives the content of the file rather than the valid Json output. Tested: - Query JsonSchemas ``` curl -k -H "X-Auth-Token: $token" -X GET "https://$bmc/redfish/v1/JsonSchemas" curl -k -H "X-Auth-Token: $token" -X GET "https://$bmc/redfish/v1/JsonSchemas/<OemSchema>" e.g. curl -k -H "X-Auth-Token: $token" -X GET "https://$bmc/redfish/v1/JsonSchemas/OemManager" ``` - Redfish Service Validator passed Change-Id: I0fc9c3d4a48fb9c6ddec9591af12fd2c849331e3 Signed-off-by: Myung Bae <myungbae@us.ibm.com>
2023-10-05Update to boost 1.83.0Ed Tanous8-10/+10
In boost 1.83.0, the boost::url maintainers deprecated the header only usage of the library without warning. A discussion with the maintainers[1] made it clear that they removed the abiliy on purpose, and they're not going to add it back or add a deprecation strategy (they did say they would update the documentation to actually match the intent), and that from here on in we should be using the cmake boost project to pull in the non-header-only boost libraries we use (which at this point is ONLY boost url). This commit updates to remove the usage of boost::urls::result typedef, which was deprecated in this release (which causes a compile error) and moves it to boost::system::result. In addition, it updates our meson files to pull in the boost project as a cmake dependency. [1] https://cpplang.slack.com/archives/C01JR6C9C4U/p1696441238739129 Tested: Not yet. Change-Id: Ia7adfc0348588915440687c3ab83a1de3e6b845a Signed-off-by: Ed Tanous <edtanous@google.com>
2023-10-03Add trace when unknown user errorGunnar Mills1-0/+1
Have seen this internalError a few times. A trace would help debug why User Manager is returning an error. In line with https://github.com/openbmc/bmcweb/blob/master/DEVELOPING.md#logging-levels. IBM has bmcweb-logging=error enabled. Tested: None. Visual only. Change-Id: I16f56c3170fb92dcfb52e57c9a420cefabc4c763 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2023-09-28Refactor getCollectionMembersLakshmi Yadlapati7-52/+59
This commit refactors the getCollectionMembers function into smaller functions. Additionally, the 'subtree' parameter is no longer a default parameter but is explicitly required in the function. All calls to getCollectionMembers have been updated to pass the 'subtree' parameter. Tested: Validator passed ''' curl -k https://$bmc/redfish/v1/Systems/system/Storage { "@odata.id": "/redfish/v1/Systems/system/Storage", "@odata.type": "#StorageCollection.StorageCollection", "Members": [ { "@odata.id": "/redfish/v1/Systems/system/Storage/1" } ], "Members@odata.count": 1, "Name": "Storage Collection" } curl -k https://$bmc/redfish/v1/Cables { "@odata.id": "/redfish/v1/Cables", "@odata.type": "#CableCollection.CableCollection", "Description": "Collection of Cable Entries", "Members": [ { "@odata.id": "/redfish/v1/Cables/dp0_cable0" }, { "@odata.id": "/redfish/v1/Cables/dp0_cable1" }, { "@odata.id": "/redfish/v1/Cables/dp0_cable2" }, { "@odata.id": "/redfish/v1/Cables/dp0_cable3" } ], "Members@odata.count": 4, "Name": "Cable Collection" } curl -k https://$bmc/redfish/v1/Chassis { "@odata.id": "/redfish/v1/Chassis", "@odata.type": "#ChassisCollection.ChassisCollection", "Members": [ { "@odata.id": "/redfish/v1/Chassis/chassis" } ], "Members@odata.count": 1, "Name": "Chassis Collection" } curl -k https://$bmc/redfish/v1/Systems/system/Memory { "@odata.id": "/redfish/v1/Systems/system/Memory", "@odata.type": "#MemoryCollection.MemoryCollection", "Members": [ { "@odata.id": "/redfish/v1/Systems/system/Memory/dimm0" }, { "@odata.id": "/redfish/v1/Systems/system/Memory/dimm1" }, ...... { "@odata.id": "/redfish/v1/Systems/system/Memory/dimm31" } ], "Members@odata.count": 32, "Name": "Memory Module Collection" } ''' Change-Id: If5091431b548f371bff03b2897fd0aaf8b0ef203 Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-09-25Clean up vm CredentialPipeEd Tanous1-165/+24
This code is needlessly complicated for what it does. Even with the intent, which is secure buffer cleanup, it's trivial to encase all this into a single class that accepts the strings by rvalue reference, then cleans them up afterward. Doing this also cleans up a potential lifetime problem, where if the unix socket returned immediately, it would've invalidated the buffers that were being sent. It also moves to async_write, instead of async_write_some. The former could in theory fail if the socket blocks (unlikely in this scenario) but it's good to handle anyway. Tested: Need some help here. There's no backend for this, so we might just have to rely on inspection. Change-Id: I9032d458f8eb7a0689bee575aae611641bacee26 Signed-off-by: Ed Tanous <edtanous@google.com>
2023-09-25Adjust #LogService schema version to same for all routesJanet Adkins1-4/+4
Both the #LogService.v1_1_0.LogService and #LogService.v1_2_0.LogService schemas were being used. Follow what OpenBMC has done in the past and use the same version across all resources of that type. I've moved them all to use #LogService.v1_2_0.LogService. The original addition of #LogService.v1_2_0.LogService was here: https://gerrit.openbmc.org/c/openbmc/bmcweb/+/36638 Tested: Ran Redfish Validator with and without the change. No new failures seen. No failures in the #LogService routes. Change-Id: Ie9eaeca32d190d627b439e511e25dfeee4b7e4eb Signed-off-by: Janet Adkins <janeta@us.ibm.com>
2023-09-21Generate OpenBMC registryEd Tanous3-1864/+3801
We haven't been very good about maintaining this file, so lets generate it like we do everything else. This commit takes the existing, manually built openbmc_message_registry.hpp and copies the generated json from a working system, then hooks it into the parse_registries script to generate the hpp file. This results in a couple changes, and somewhat proves how bad our ability to manage this file manually is.. Tested: Looking for input on if this is the right direction. Change-Id: I5dc03021d194f0674e4a8f41421096b211462a0a Signed-off-by: Ed Tanous <edtanous@google.com>
2023-09-08Simplify datetime parsingEd Tanous3-27/+8299
This code as it stands pulls in the full datetime library from boost, including io, and a bunch of timezone code. The bmc doesn't make use of any of this, so we can rely on a much simplified version. Unfortunately for us, gcc still doesn't implement the c++20 std::chrono::parse[1]. There is a reference library available from [2] that backports the parse function to compilers that don't yet support it, and is the basis for the libc++ version. This commit opts to copy in the header as-written, under the assumption that we will never need to pull in new versions of this library, and will move to the std ersion as soon as it's available in the next gcc version. This commit simplifies things down to improve compile times and binary size. It saves ~22KB of compressed binary size, or about 3%. Tested: Unit tests pass. Pretty good coverage. [1] https://en.cppreference.com/w/cpp/chrono/parse [2] https://github.com/HowardHinnant/date/blob/master/include/date/date.h Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I706b91cc3d9df3f32068125bc47ff0c374eb8d87
2023-09-07Fix regression in ip address deleteEd Tanous1-3/+3
9c5e585c3faa73941cedcc70cdff680f403c17bc flipped around two parameters as part of a bug fix. This fixes #263. Tested: Inspection only. Change-Id: I2c8dea2e947fd34784475c0eb0144baa3b68dcb5 Signed-off-by: Ed Tanous <edtanous@google.com>
2023-09-04certificate_service: Fix garbled display caused by dangling referenceXinnan Xie1-1/+1
Post: ``` /redfish/v1/CertificateService/Actions/CertificateService.ReplaceCertificate ``` The "@odata.id" field in the response will appear garbled. This is caused by boost::urls::url_view outlives its original char sequence. Fix this issue. Tested: ``` 1.Get token 2.curl -k -H "X-Auth-Token: $token" -X POST https://${bmc}/redfish/v1/CertificateService/Actions/CertificateService.ReplaceCertificate -d '{"CertificateUri": {"@odata.id":"/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/1"}, "CertificateString":"...", "CertificateType": "PEM"}' { "@odata.id": "/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/1", ... } ``` Change-Id: I6b16cbfaf22f835488a54097c83cee8a1b9e9f6a Signed-off-by: Xinnan Xie <xiexinnan@bytedance.com>
2023-09-01Fix mounting in legacy mode in virtual mediaBoleslaw Ogonczyk Makowski1-6/+1
Mounting in legacy mode doesn't provide "TransferProtocolType" in json, the protocol is specified in the uri instead which means paramTransferProtocolType was empty and always failing the new check [1], that was added because of a clang-tidy warning (sounds like a clang-tidy bug). Restored original behavior and added checking paramTransferProtocolType explicitly. [1]: https://github.com/openbmc/bmcweb/commit/e01d0c36af115ed46d54b5dbbacfe3ad92226bd3#diff-3d181e155cfa7f397eface92af17130f3db87773ce4219d9c7e24e00b76b94acR767 Change-Id: I9bbebad262356933a9482f73b78597c838777f65 Signed-off-by: Boleslaw Ogonczyk Makowski <boleslawx.ogonczyk-makowski@intel.com>
2023-09-01Don't return failed password in Redfish error responseJason M. Bills1-3/+3
Even though the password failed, it's not great to return it in plain text in the Redfish error response (which is also displayed in a toast pop-up in webui-vue). This replaces the password text with null in the Redfish response to protect the password content. Tested: Set a bad password for a new user and an existing user and confirmed that the provided password text is no longer included in the error response. Change-Id: I1882667396006861c2211dbe27b554dd5a32c122 Signed-off-by: Jason M. Bills <jason.m.bills@intel.com>
2023-08-31System: Error log level when internalErrorGunnar Mills1-26/+33
In line with https://github.com/openbmc/bmcweb/blob/master/DEVELOPING.md#logging-levels. When there is an InternalError, set the logging level to Error. Added some additional traces to get the EC. Having the EC is really helpful when debugging. IBM has bmcweb-logging=error enabled. Tested: None. Visual only. Change-Id: I4ba2fb6be52696dc115c5f2ac54ec123926778af Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2023-08-30Fix incorrect response code for header size limitDivya Jyoti1-1/+1
In this commit the response code for the exceeding header size limit during event subscription(post request to /redfish/v1/EventService/Subscriptions) is changed to 400 (Bad Request) instead of 405 (Method not allowed) Tested: If header size in post body is large(>8096), then response code is returned as 400 Change-Id: Ie1301777c994dff64a49e625d7f4f7de72010610 Signed-off-by: Divya Jyoti <divya1.jyoti@intel.com>
2023-08-30Change authority D-Bus namesMichal Orzel1-2/+2
Changing authority service references in code from 'ldap' to more generic name, to comply with change in phosphor-certificate-manager. Related change: https://gerrit.openbmc.org/c/openbmc/phosphor-certificate-manager/+/65458 Tested: Adding, reading and removal of CA Certificate works without any noticeable regression. Change-Id: Ia3e7a13bf7093bb7a9964769847d769475ed3e61 Signed-off-by: Michal Orzel <michalx.orzel@intel.com>
2023-08-30Ignore Non-software-related events during UpdateMyung Bae1-3/+29
During code update, if another application (e.g. pldm[1]) logs an error unrelated to code update, this triggers an error event notification and causes the code update failure. ``` $ uri=$(curl -k https://${bmc}/redfish/v1/UpdateService | jq -r ' .HttpPushUri'); echo $uri $ curl -k -H "Content-Type: application/octet-stream" -X POST -T ${image} https://${bmc}${uri} { "error": { ... "code": "Base.1.13.0.InternalError", "message": "The request failed due to an internal service error. The service is still operational." } } ``` This commit is to filter out those non-update-related error events from concluding the code update as failure. The valid update-related errors are defined in - https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/yaml/xyz/openbmc_project/Software/Version.errors.yaml - https://github.com/openbmc/phosphor-bmc-code-mgmt/blob/master/xyz/openbmc_project/Software/Image.errors.yaml Tested: 1) Redfish validator passed 2) Error injection during Update. - Start the code update and wait for completion of update (e.g. using journalctl -f) ``` $ uri=$(curl -k https://${bmc}/redfish/v1/UpdateService | jq -r ' .HttpPushUri'); echo $uri $ curl -k -H "Content-Type: application/octet-stream" -X POST -T ${image} https://${bmc}${uri} ``` - As soon as the image is untarring, and issue busctl cmd to inject a non-update error ``` busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging \ xyz.openbmc_project.Logging.Create Create ssa{ss} \ xyz.openbmc_project.Host.Error.Event \ xyz.openbmc_project.Logging.Entry.Level.Error 1 RAWPEL \ /tmp/FILE_NBMC_UNRECOVERABLE ``` [1] https://github.com/openbmc/pldm/blob/master/oem/ibm/libpldmresponder/file_io_type_pel.cpp#L268 Change-Id: Ice54c403efacffa6a388e182bd04d97c3e2b97fc Signed-off-by: Myung Bae <myungbae@us.ibm.com>
2023-08-24Fix empty response when do the clearLogTony Lee1-0/+1
It won't show anything when do the POST /redfish/v1/Systems/<str>/LogServices/PostCodes/Actions/LogService.ClearLog Give a response which same as /redfish/v1/Systems/<str>/LogServices/EventLog/Actions/LogService.ClearLog Tested: curl -k -X POST http://${bmc}/redfish/v1/Systems/system/LogServices/PostCodes/Actions/LogService.ClearLog { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The request completed successfully.", "MessageArgs": [], "MessageId": "Base.1.13.0.Success", "MessageSeverity": "OK", "Resolution": "None" } ] } Change-Id: I35f41a82bba750397bd8d9af657036d4f03a61c8 Signed-off-by: Tony Lee <tony.lee@quantatw.com>
2023-08-24Fix typo `DBusInteracesMap` -> `DBusInterfacesMap`Michael Shen6-13/+14
Change-Id: I9a851076eccee9d79ad7bb036e58b717e06ad5d1 Signed-off-by: Michael Shen <gpgpgp@google.com>
2023-08-23Move http client to URLEd Tanous3-66/+66
Type safety is a good thing. In: https://gerrit.openbmc.org/c/openbmc/bmcweb/+/65606 It was found that splitting out the URI into encoded pieces in the early phase removed some information we needed, namely whether or not a URI was ipv6. This commit changes http client such that it passes all the information through, with the correct type, rather than passing in hostname, port, path, and ssl separately. Opportunistically, because a number of log lines are changing, this uses the opportunity to remove a number of calls to std::to_string, and rely on std::format instead. Now that we no longer use custom URI splitting code, the ValidateAndSplitUrl() method can be removed, given that our validation now happens in the URI class. Tested: Aggregation works properly when satellite URIs are queried. Change-Id: I9f605863179af54c5af2719bc5ce9d29cbfffab7 Signed-off-by: Ed Tanous <edtanous@google.com>
2023-08-21Use rangesEd Tanous21-151/+144
C++20 brought us std::ranges for a lot of algorithms. Most of these conversions were done using comby, similar to: ``` comby -verbose 'std::lower_bound(:[a].begin(),:[b].end(),:[c])' 'std::ranges::lower_bound(:[a], :[c])' $(git ls-files | grep "\.[hc]\(pp\)\?$") -in-place ``` Change-Id: I0c99c04e9368312555c08147d474ca93a5959e8d Signed-off-by: Ed Tanous <edtanous@google.com>
2023-08-17Refactor Update monitorForSoftwareAvailable functionMyung Bae1-95/+99
The scope of this code refactor is to limit the function of monitorForSoftwareAvailable() for the coming future code modifications in the area. Tested: - Compiles successfully. - Code update works as before (for success and failure cases) Change-Id: I90fd41caa6b88c97c2a0c47fcf4553d48905b886 Signed-off-by: Myung Bae <myungbae@us.ibm.com>
2023-08-16Update event_service and account_service URIEd Tanous2-8/+8
Use boost::urls::format. Boost::urls::format allows escaping URLs properly, and has been deployed in most places. This now includes users in that set. Tested: Inspection only. Change-Id: Ib16c8fceb7c58f4074f65df7634ac91af0633e2b Signed-off-by: Willy Tu <wltu@google.com> Signed-off-by: Ed Tanous <edtanous@google.com>
2023-08-14Fix FanRemoved MessageArgs numberJason M. Bills1-1/+1
FanRemoved MessageArgs was mistakenly changed from 1 to 0. This changes it back to 1 to fix getting Internal Server Error on events. Tested: Confirmed that FanRemoved events can be retrieved without getting a 500 error code. Change-Id: I9a2a55a5ee3d2bea073d7d55ed9fe53dc2aaee9d Signed-off-by: Jason M. Bills <jason.m.bills@intel.com>
2023-08-14Reduce some Error log severitiesCarson Labrado5-11/+17
There are instances of ERROR logs that would work better as WARNING or DEBUG since they do not actually result in bailing early and returning an error response. Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: I1e7bca0bb38487b26a4642ab72ce475170bb53c6
2023-08-11Add negation to logicAnjaliintel-211-1/+1
As the value of the PowerInputWatts and PowerOutputWatts are getting exchanged,so I added negation in the logic.This will correct the values. Tested: I have tested it and now the values are coming correct. Change-Id: I67bf6c5050ceb05c13419b370105d80f913b0c17 Signed-off-by: Anjaliintel-21 <anjali.ray@intel.com>
2023-08-11Fix for PowerSupplyPowerRestored MessageArgsJayaprakash Mutyala1-1/+1
Redfish event PowerSupplyPowerRestored has MessageArgs as 0 instead of 1. Due to this redfish events are not populated and getting Internal Server Error. So updated MessageArgs to 1. Tested: 1. Redfish validator - passed for this new change 2. Verified GET /redfish/v1/Systems/system/LogServices/EventLog/Entries. Able to populate Redfish event as expected. Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com> Change-Id: I9a2450cba5ff668ff495b7f2ba3b86b856581fff
2023-08-07Fix bugprone-unchecked-optional-access findingsEd Tanous5-56/+48
Clang-tidy has the aforementioned check, which shows a few places in the core where we ignored the required optional checks. Fix all uses. Note, we cannot enable the check that this time because of some weird code in health.hpp that crashes tidy[1]. That will need to be a future improvement. There are tests that call something like ASSERT(optional) EXPECT(optional->foo()) While this isn't an actual violation, clang-tidy doesn't seem to be smart enough to deal with it, so add some explicit checks. [1] https://github.com/llvm/llvm-project/issues/55530 Tested: Redfish service validator passes. Change-Id: Ied579cd0b957efc81aff5d5d1091a740a7a2d7e3 Signed-off-by: Ed Tanous <edtanous@google.com>
2023-08-03Show Update error type on logs if unknownMyung Bae1-0/+2
Update is failing due to unknown update dbus error type but the cause can not be determined as its value is not showing. This change is to add the error cause to journal in addition to CRITICAL internalError. ``` Aug 02 09:00:16 bmcweb[2476]: (2023-08-02 09:00:14) [ERROR "update_service.hpp":396] Unknown Software Image Error type = <XXX> Aug 02 09:00:16 bmcweb[2476]: (2023-08-02 09:00:14) [CRITICAL "error_messages.cpp":284] Internal Error ....` ``` Not tested but successfully compiled. Change-Id: I20833d24042bf8d2f7e2d8a8e4359e3d80af702a Signed-off-by: Myung Bae <myungbae@us.ibm.com>
2023-07-31Add PATCH for MetricReportDefinitionLukasz Kazmierczak2-63/+511
Support for PATCH method is added to Metric Report Definition, now selected read/write Report properties can be modified by PATCH method Tested: - Added Report via POST, overwrite editable properties via PATCH and fetched Report via GET checking if received data is properly modified Signed-off-by: Lukasz Kazmierczak <lukasz.kazmierczak@intel.com> Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com> Change-Id: If75110a92c55c9e4f2415f0ed4471baa802643ff
2023-07-28Fix RestorePolicy mapGunnar Mills1-1/+1
Before this code looked like: {"xyz.openbmc_project.Control.Power.RestorePolicy.Policy.Restore", "LastState"}, and that matches the PDI: https://github.com/openbmc/phosphor-dbus-interfaces/blob/d1484a1499bc241316853934e6e8b735166deee2/yaml/xyz/openbmc_project/Control/Power/RestorePolicy.interface.yaml#L33 https://gerrit.openbmc.org/c/openbmc/bmcweb/+/64334/2/redfish-core/lib/systems.hpp#1350 changed this to RestorePolicy.Policy.AlwaysRestore, I think just a copy mistake. Pointed out by Patrick Rudolph. Tested: None. Searching the enum now matches PDI and what was there before. Change-Id: I90e41d352dd1d1de3e465b4f2d5c9f78e0de5b3b Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2023-07-26chassis: Change intrusion sensor look up methodChau Ly1-1/+1
This commit changes to using the interface "xyz.openbmc_project.Chassis.Intrusion" to look up for the chassis intrusion sensor's DBus object path under "/xyz/openbmc_project" path, instead of specifying the complete object path. This helps remove the dependence on the object path and relies on the interface name instead. Change-Id: I046d1d2825f65f49b225c29239647c423b67242e Signed-off-by: Chau Ly <chaul@amperecomputing.com>
2023-07-25Add error code check for snmpEd Tanous1-1/+1
When SNMP isn't present, and the name is not activatable, (becuase snmp isn't installed) it returns a 113 error code. We should handle this silently, rather than returning an internal error, because snmp is optional. Tested: Ran redfish service validator on a system without phosphor-snmp installed, and observed no more error on /redfish/v1/EventService/Subscriptions. Change-Id: I2254d763de6c55c678a95765e1bc87fb9aaa9564 Signed-off-by: Ed Tanous <edtanous@google.com>
2023-07-25Fix unable to find sensor objectBan Feng1-1/+5
This is due to MemberId is the combination of sensorType+sensorName, and we only extract sensorName from objectsWithConnection. Therefore, prepend the sensorType to prevent this from occuring. Tested: code complies, and confirmed via curl, function works. Change-Id: Ic76607576475547030b9556a64c902e560aabf5d Signed-off-by: Ban Feng <kcfeng0@nuvoton.com> Signed-off-by: Ed Tanous <edtanous@google.com>
2023-07-21Rename aResp to asyncRespEd Tanous2-22/+22
We enforced this naming convention a while ago, but some new patchsets seem to have ignored it. Fix the naming convention. Tested: Code compiles. Trivial find and replace. Change-Id: I2921d80d9cdc536f99c2f9e522c60d12f4310a67 Signed-off-by: Ed Tanous <edtanous@google.com>
2023-07-20Report status state field for cable objectsAkshit Shah1-11/+35
Tested: Added and removed cables to see state field being reflected based on the presence. Change-Id: I0136b1407634ebc9033a7c3ea2da555018fd622b Signed-off-by: Akshit Shah <shahakshit@google.com>
2023-07-20Add IPv6 StatelessAddressAutoConfigurationRavi Teja1-12/+61
This commit has following changes 1.Adds "StatelessAddressAutoConfig" support as per latest EthernetInterface schema. 2.Remove support for deprecated Stateful and Stateless enums of DHCPv6 "OperatingMode" Tested by: ``` GET PATCH -d '{"StatelessAddressAutoConfig": {"IPv6AutoConfigEnabled": true}}' PATCH -d '{"StatelessAddressAutoConfig": { "IPv6AutoConfigEnabled": false}}' PATCH -d '{"DHCPv6" : {"OperatingMode":"Enabled"}}' PATCH -d '{"DHCPv6" : {"OperatingMode":"Disabled"}}' ``` Redfish Validator passed Change-Id: I29d471750ef513074bc5e49c31a16fa15d3d760c Signed-off-by: Ravi Teja <raviteja28031990@gmail.com>
2023-07-20Replace logging with std::formatEd Tanous53-1354/+1307
std::format is a much more modern logging solution, and gives us a lot more flexibility, and better compile times when doing logging. Unfortunately, given its level of compile time checks, it needs to be a method, instead of the stream style logging we had before. This requires a pretty substantial change. Fortunately, this change can be largely automated, via the script included in this commit under scripts/replace_logs.py. This is to aid people in moving their patchsets over to the new form in the short period where old patches will be based on the old logging. The intention is that this script eventually goes away. The old style logging (stream based) looked like. BMCWEB_LOG_DEBUG << "Foo " << foo; The new equivalent of the above would be: BMCWEB_LOG_DEBUG("Foo {}", foo); In the course of doing this, this also cleans up several ignored linter errors, including macro usage, and array to pointer deconstruction. Note, This patchset does remove the timestamp from the log message. In practice, this was duplicated between journald and bmcweb, and there's no need for both to exist. One design decision of note is the addition of logPtr. Because the compiler can't disambiguate between const char* and const MyThing*, it's necessary to add an explicit cast to void*. This is identical to how fmt handled it. Tested: compiled with logging meson_option enabled, and launched bmcweb Saw the usual logging, similar to what was present before: ``` [Error include/webassets.hpp:60] Unable to find or open /usr/share/www/ static file hosting disabled [Debug include/persistent_data.hpp:133] Restored Session Timeout: 1800 [Debug redfish-core/include/event_service_manager.hpp:671] Old eventService config not exist [Info src/webserver_main.cpp:59] Starting webserver on port 18080 [Error redfish-core/include/event_service_manager.hpp:1301] inotify_add_watch failed for redfish log file. [Info src/webserver_main.cpp:137] Start Hostname Monitor Service... ``` Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: I86a46aa2454be7fe80df608cb7e5573ca4029ec8
2023-07-18Remove PCIeInterface DeviceTypeEd Tanous1-9/+3
This code was added in 543f9a75a0819ca9e3541b2c48fe8b4d5cf6c4f7, which in the description claimed to only be a refactor, but moved the DeviceType record. Because DeviceType is an enum in Redfish, and a string in PDI, some amount of conversion is required, so this code can't be corrected easily. Remove the property for the moment. Tested: Redfish Validator passes. Change-Id: I60a68e45a69370112f454b1c520fde5b70ca8591 Signed-off-by: Ed Tanous <edtanous@google.com>
2023-07-13Add Location information for FanGeorge Liu1-0/+25
This commit is to add Location/PartLocation/ServiceLabel information according to the Redfish Fan schema. If the `xyz.openbmc_project.Inventory.Decorator.LocationCode` interface does not exist, the ServiceLabel information property is not displayed. ref: https://redfish.dmtf.org/schemas/v1/Fan.v1_3_0.json Tested: Validator passes ''' 1. doGet method to get Fan ServiceLabel information curl -k https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan0 { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan0", "@odata.type": "#Fan.v1_3_0.Fan", "Id": "fan0", "Manufacturer": "Delta", "Model": "7B5F", "Name": "Fan", "PartNumber": "02YK323", "SerialNumber": "YL12JP1C1234", "Slot": { "Location": { "PartLocation": { "ServiceLabel": "U78DB.ND0.WZS002U-A0" } } }, "SparePartNumber": "02YK323", "Status": { "Health": "OK", "State": "Enabled" } } ''' Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I1c3357d6dde654c71c8384139b8e3f03cf671e4e Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-07-13Add asset information for FanGeorge Liu1-0/+58
This commit is to add asset information according to the Redfish Fan schema. If the `xyz.openbmc_project.Inventory.Decorator.Asset` interface does not exist, the asset information property is not displayed. ref: https://redfish.dmtf.org/schemas/v1/Fan.v1_3_0.json Tested: Validator passes ''' 1. doGet method to get Fan asset information curl -k https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan0 { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan0", "@odata.type": "#Fan.v1_3_0.Fan", "Id": "fan0", "Manufacturer": "Delta", "Model": "7B5F", "Name": "Fan", "PartNumber": "02YK323", "SerialNumber": "YL12JP1C1234", "SparePartNumber": "02YK323", "Status": { "Health": "OK", "State": "Enabled" } } ''' Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I1840f2b372fea57ba6e5c499ba21c968f0005695 Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-07-13Add Status information for FanAlbert Zhang1-1/+56
This commit is to add Fan State/Health status according to the Redfish Fan schema. If the `xyz.openbmc_project.Inventory.Item` interface does not exist, the state status property is set to default "Present". If the `xyz.openbmc_project.State.Decorator.OperationalStatus` interface does not exist, the health status property is set to default "OK". ref: https://redfish.dmtf.org/schemas/v1/Fan.v1_3_0.json Code that updates the OperationalStatus for all the inventory https://github.com/openbmc/openpower-vpd-parser/blob/3fb026386546cfd288ab4f86156c9aa0ffa145d6/ibm_vpd_app.cpp#L620 Tested: Validator passes ''' 1.doGet method to get Fan curl -k https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan0 { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan0", "@odata.type": "#Fan.v1_3_0.Fan", "Id": "fan0", "Name": "Fan", "Status": { "Health": "OK", "State": "Enabled" } } 2.Enter the wrong fanId with the doGet method to get fan { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type Fan named 'fanx' was not found.", "MessageArgs": [ "Fan", "fanx" ], "MessageId": "Base.1.13.0.ResourceNotFound", "MessageSeverity": "Critical", "Resolution": "Provide a valid resource identifier and resubmit the request." } ], "code": "Base.1.13.0.ResourceNotFound", "message": "The requested resource of type Fan named 'fanx' was not found." } } ''' Signed-off-by: Albert Zhang <zhanghaodi@inspur.com> Change-Id: I52c465f745587233e43a2947c392d1435b2d980b Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-07-13Implements Fan schemaGeorge Liu2-0/+148
This commit implements the Redfish Fan schema and fetches basic information about each fan. The code first validates the chassis ID and then validates the fan ID by obtaining a list of fans through the endpoints of the cooled_by association. Additionally, common properties are added. Tested: Validator passes 1. doGet method to get Fan ''' curl -k https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan2 { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan2", "@odata.type": "#Fan.v1_3_0.Fan", "Id": "fan2", "Name": "Fan" } 2. Input the wrong chassisId with the doGet method to get Fan curl -k https://${bmc}/redfish/v1/Chassis2/chassis/ThermalSubsystem/Fans/fan3 { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type named 'fan3' was not found.", "MessageArgs": [ "", "fan3" ], "MessageId": "Base.1.13.0.ResourceNotFound", "MessageSeverity": "Critical", "Resolution": "Provide a valid resource identifier and resubmit the request." } ], "code": "Base.1.13.0.ResourceNotFound", "message": "The requested resource of type named 'fan3' was not found." } } 3. Input the wrong fanId with the doGet method to get fan curl -k https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan78 { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan78", "@odata.type": "#Fan.v1_3_0.Fan", "Id": "fan78", "Name": "Fan", "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type Fan named 'fan78' was not found.", "MessageArgs": [ "Fan", "fan78" ], "MessageId": "Base.1.13.0.ResourceNotFound", "MessageSeverity": "Critical", "Resolution": "Provide a valid resource identifier and resubmit the request." } ], "code": "Base.1.13.0.ResourceNotFound", "message": "The requested resource of type Fan named 'fan78' was not found." } } ''' Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I44994a998fd9c497d794e2568cc0148120bfbc15 Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-07-13Implements FanCollection schemaGeorge Liu3-0/+164
The FanCollection schema is a resource in Redifsh version 2022.2 [1] that represents the management properties for the monitoring and management of cooling fans implemented by Redfish [2]. This commit retrieves the fan collection by obtaining the endpoints of the `cooled_by` association. The `cooled_by` association represents the relationship between a chassis and the fans responsible for providing cooling to the chassis. ref: [1] https://www.dmtf.org/sites/default/files/standards/documents/DSP0268_2022.2.pdf [2] http://redfish.dmtf.org/schemas/v1/Fan.v1_3_0.json Redfish validator is currently failing. In order for the validator to pass, it is necessary to merge this commit with https://gerrit.openbmc.org/c/openbmc/bmcweb/+/57559 Tested: 1. doGet method to get FanCollection ``` curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans", "@odata.type": "#FanCollection.FanCollection", "Description": "The collection of Fan resource instances chassis", "Members": [ { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan5" }, { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan4" }, { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan3" }, { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan2" }, { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan1" }, { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan0" } ], "Members@odata.count": 6, "Name": "Fan Collection" } 2. Input the wrong chassisId with the doGet method curl -k https://${bmc}/redfish/v1/Chassis/chassis11/ThermalSubsystem/Fans { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type Chassis named 'chassis11' was not found.", "MessageArgs": [ "Chassis", "chassis11" ], "MessageId": "Base.1.13.0.ResourceNotFound", "MessageSeverity": "Critical", "Resolution": "Provide a valid resource identifier and resubmit the request." } ], "code": "Base.1.13.0.ResourceNotFound", "message": "The requested resource of type Chassis named 'chassis11' was not found." } } ``` Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: If5e9ff5655f444694c7ca1aea95d45e2c9222625 Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-07-12Use openssl random number generatorEd Tanous2-4/+4
We already have a generator class. We should use it. Wrap this into a function that can be unit tested, and add unit tests. Note, some files also needed to change name, because random.hpp conflicts with the built in random, and causes circular build problems. This commit changes it to ossl_random. Tested: Unit tests pass. Now has coverage. Redfish service validator passes. Change-Id: I5f8eee1af5f4843a352c6fd0e26d67fd3320ef53 Signed-off-by: Ed Tanous <edtanous@google.com>
2023-07-11Add MaxLanes and MaxPCIeType properties to the PCIeInterfaceKonstantin Aladyshev1-2/+34
According to the Redfish Data Model specification PCIeInterface (v1.3+) of the PCIeDevice model contains the following properties: MaxLanes (v1.3+) The number of PCIe lanes supported by this device. - This property shall contain the maximum number of PCIe lanes supported by this device. MaxPCIeType (v1.3+) The highest version of the PCIe specification supported by this device. - This property shall contain the maximum PCIe specification that this device supports. Since PCIeDevice interface from the phosphor-dbus-interfaces has these values in the 'MaxLanes' and 'GenerationSupported' properties, populate the fields to Redfish. Tested: Redfish validator passed Before: redfish/v1/Systems/system/PCIeDevices/Bus_c3_Device_00 { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/Bus_c3_Device_00", "@odata.type": "#PCIeDevice.v1_9_0.PCIeDevice", ... "PCIeInterface": { "LanesInUse": 4, "PCIeType": "Gen3" }, ... } After: redfish/v1/Systems/system/PCIeDevices/Bus_c3_Device_00 { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/Bus_c3_Device_00", "@odata.type": "#PCIeDevice.v1_9_0.PCIeDevice", ... "PCIeInterface": { "LanesInUse": 4, "MaxLanes": 4, "MaxPCIeType": "Gen3", "PCIeType": "Gen3" }, ... } Change-Id: Iec786e376cea8fd2aa516b5b2a3da4286e59627a Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
2023-07-11Omit Slot "Lanes" property if it is equal to 0Konstantin Aladyshev2-2/+5
In the context of a PCIeSlot the 0 value for the 'Lanes' property means undefined. According to the bmcweb guidelines, DBus properties with "unknown"/"unspecified" values should be omitted from the Redfish tree. Therefore don't populate 'Lanes' property if it is equal to 0. Tested: validator passed Change-Id: Ic3d142dd8b10da2367d73c370d5480208ba1510a Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
2023-07-11Correct type for the lanesInUse propertyKonstantin Aladyshev1-1/+1
According to the phosphor-dbus-interfaces 'LanesInUse' property in the PCIeDevice interface has a 'size_t' type. But the current bmcweb code uses 'int64_t' for that variable in the 'unpackPropertiesNoThrow' call. This causes function to fail. Correct variable type to fix the issue. Tested: validator passed Before: redfish/v1/Systems/system/PCIeDevices/Bus_c3_Device_00 { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/Bus_c3_Device_00", "@odata.type": "#PCIeDevice.v1_9_0.PCIeDevice", "Id": "Bus_c3_Device_00", "Manufacturer": "Intel Corporation", "Model": "", "Name": "PCIe Device", "PartNumber": "", "SerialNumber": "", "Status": { "Health": "OK", "State": "Enabled" }, "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The request failed due to an internal service error. The service is still operational.", "MessageArgs": [], "MessageId": "Base.1.16.0.InternalError", "MessageSeverity": "Critical", "Resolution": "Resubmit the request. If the problem persists, consider resetting the service." } ], "code": "Base.1.16.0.InternalError", "message": "The request failed due to an internal service error. The service is still operational." } } After: redfish/v1/Systems/system/PCIeDevices/Bus_c3_Device_00 { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/ Bus_c3_Device_00", "@odata.type": "#PCIeDevice.v1_9_0.PCIeDevice", "Id": "Bus_c3_Device_00", "Manufacturer": "Intel Corporation", "Model": "", "Name": "PCIe Device", "PCIeFunctions": { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/ Bus_c3_Device_00/PCIeFunctions" }, "PCIeInterface": { "DeviceType": "MultiFunction", "LanesInUse": 4, "PCIeType": "Gen3" }, "PartNumber": "", "SerialNumber": "", "Status": { "Health": "OK", "State": "Enabled" } } Change-Id: I3c7cda6027814ded5e85cfe3d37dbac1bbbc2044 Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
2023-07-11Add contains type tidy checkEd Tanous1-1/+1
On general container usage, contains() is more descriptive than count() > 0. We have one violation of this, fix it and enable the check. Tested: Clang-tidy passes. Change-Id: Ib5702ef97c6da033b6587c9cfebbe30dfbfe80b4 Signed-off-by: Ed Tanous <edtanous@google.com>