summaryrefslogtreecommitdiff
path: root/redfish-core
AgeCommit message (Collapse)AuthorFilesLines
2024-04-03Call dump() lessEd Tanous1-15/+9
nlohmann::json::dump() is not an easy function to get the call parameters correct on. We should limit the places we use it. Luckily, both logging and redfish::messages support printing json values directly. Use them where appropriate. Tested: Error logging and out of range calls only of heavily used messages and logging calls. Inspection only. Change-Id: I57521d8791dd95250c93e8e3b2d4a959740ac713 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-03log_services: Move to setProperty dbus util methodAsmitha Karunanithi1-12/+4
This commit changes sdbusplus setProperty calls in log_services.hpp file to "setDbusProperty" method in Redfish namespace that handles all DBus errors in a consistent manner. Change-Id: Icd9b0f0326c75a1421756d515408b303bdd738e3 Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com>
2024-04-02Remove redfish-enable-proccessor-memory-statusGunnar Mills1-88/+4
The redfish-enable-proccessor-memory-status option was scheduled to be removed in 1Q 2024. It is now 2Q, so remove the option. No upstream layers enabled it and I could not find a downstream layer that did either. Redfish deprecated the Processor/Memory Summary Status (state, health, healthrollup) attributes. Discussion on discord, when disabling: [1]: https://discord.com/channels/775381525260664832/855566794994221117/1093939076710793296 Commit disabling this (merged 10 months ago): [2]: https://github.com/openbmc/bmcweb/commit/5fd0aafb0f14fb3011970e8575647bb608688c7c Tested: Code builds. Change-Id: I539cd5f384633afa7badf1cecfc6c7a87062f672 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2024-04-02Reduce multi-level calls of req.req membersMyung Bae1-4/+4
Several places access the members of `req` indirectly like `req.req.method()`. This can be simplified as `req.method()` . This would also make the code clearer. Tested: - Compiles - Redfish service validator passes Change-Id: Ie129564ff907cdea7ac224b1e3d80cc0dedfbd7b Signed-off-by: Myung Bae <myungbae@us.ibm.com>
2024-04-01Move where appropriateEd Tanous1-1/+2
Clang-tidy-18 has new checks that can find more cases where we've missed an opportunity to std::move. Fix them. Tested: Logging works, unit tests pass. Change-Id: I0cf58204ce7265828693b787a7b3a16484c3d5e5 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-01Enable readability checkEd Tanous1-3/+11
readability-avoid-nested-conditional-operator With one exception, we already pass this check. Update the log services code to make it pass, and update it to use the generated enums. Tested: Code inspection only. Change-Id: Ic80a7382beb0f541de4916d7b51e42ed5d5dc542 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-01hypervisor: Move to setProperty dbus util methodAsmitha Karunanithi1-81/+39
This commit changes sdbusplus setProperty calls in hypervisor_system.hpp file to "setDbusProperty" method in Redfish namespace that handles all DBus errors in a consistent manner. Change-Id: Iebca5eb4e28159d61cd4b13c0343b78efd0f1f39 Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com>
2024-04-01Remove duplicated includeEd Tanous1-1/+0
This include exists above. Tested: code compiles. Change-Id: I8e5d7bce292486d2f534da1b539212113c1e8d56 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-01Fix redundant inline operatorsEd Tanous1-1/+1
inline is not required on member methods. Clang-tidy has a check for this. Enable the check and fix the two bad usages. Tested: Code compiles. Change-Id: I3115b7c0c4005e1082e0005b818fbe6569511f49 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-01Use no-switch-default on clangEd Tanous2-1/+3
clang-18 improves this check so that we can actually use it. Enable it and fix all violations. Change-Id: Ibe4ce19c423d447a4cbe593d1abba948362426af Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-01Fix SSE socketsEd Tanous1-0/+5
Redfish protocol validatator has SSE tests that expose some bad coding practies in SSE handlers, namely, that there are several cases where we don't check for nullptr. Fix them. This appears to have been introduced in: https://gerrit.openbmc.org/c/openbmc/bmcweb/+/41319 Tested: Redfish service validator passes more tests. Change-Id: Id980725f007d044b7d120dbe0f4b625865cab6ba Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-01Cable: Fix Logging Level ErrorGunnar Mills1-1/+1
When we have an internal error, having the D-Bus response is really helpful. Follow our guide and have these be a Logging Level Error. Tested: None. Inspection only. Change-Id: Ie1d9f364c3af7f2a8839d878d68c82c10ddc0429 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2024-03-28ethernet: Move to setProperty dbus utility methodAsmitha Karunanithi1-35/+16
This commit changes sdbusplus setProperty calls in ethernet.hpp file to "setDbusProperty" method in Redfish namespace that handles all DBus errors in a consistent manner. Tested By: Tested a few PATCH operations on the redfish endpoints defined in this file and verified that bmcweb returns appropriate Redfish errors. Change-Id: Ie456db75d59dc247cdce5dd5cc0b2f6894f5265f Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com>
2024-03-28Create Redfish specific setProperty callEd Tanous8-558/+252
There are currently 78 sdbusplus::asio::setProperty calls in redfish-core. The error handler for nearly all of them looks something like: ``` if (ec) { const sd_bus_error* dbusError = msg.get_error(); if ((dbusError != nullptr) && (dbusError->name == std::string_view( "xyz.openbmc_project.Common.Error.InvalidArgument"))) { BMCWEB_LOG_WARNING("DBUS response error: {}", ec); messages::propertyValueIncorrect(asyncResp->res, "<PropertyName>", <PropertyValue>); return; } messages::internalError(asyncResp->res); return; } messages::success(asyncResp->res); ``` In some cases there are more errors handled that translate to more error messages, but the vast majority only handle InvalidArgument. Many of these, like the ones in account_service.hpp, do the error handling in a lambda, which causes readability problems. This commit starts to make things more consistent, and easier for trivial property sets. This commit invents a setDbusProperty method in the redfish namespace that tries to handle all DBus errors in a consistent manner. Looking for input on whether this will work before changing over the other 73 calls. Overall this is less code, fewer inline lambdas, and defaults that should work for MOST use cases of calling an OpenBMC daemon, and fall back to more generic errors when calling a "normal" dbus daemon. As part of this, I've ported over several examples. Some things that might be up in the air: 1. Do we always return 204 no_content on property sets? Today there's a mix of 200, with a Base::Success message, and 204, with an empty body. 2. Do all DBus response codes map to the same error? A majority are covered by xyz.openbmc_project.Common.Error.InvalidArgument, but there are likely differences. If we allow any daemon to return any return code, does that cause compatibility problems later? Tested: ``` curl -k --user "root:0penBmc" -H "Content-Type: application/json" -X PATCH -d '{"HostName":"openbmc@#"}' https://192.168.7.2/redfish/v1/Managers/bmc/EthernetInterfaces/eth0 ``` Returns the appropriate error in the response Base.1.16.0.PropertyValueIncorrect Change-Id: If033a1112ba516792c9386c997d090c8f9094f3a Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-28Add misc-include-cleanerEd Tanous4-1/+10
And fix the includes that are wrong. Note, there is a very large ignore list included in the .clang-tidy configcfile. These are things that clang-tidy doesn't yet handle well, like knowing about a details include. Change-Id: Ie3744f2c8cba68a8700b406449d6c2018a736952 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-28Fix clang-formatting in ethernetEd Tanous1-4/+4
Current code has //clang-format on When it should have // clang-format on The difference is subtle, but disables formatting for this whole file. Re-enable and fix the couple of problems. Tested: Whitespace only. Change-Id: Ia155226327d4d611eb2c0f5232274459866e81cc Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-27Check optionals in tidyEd Tanous2-33/+22
clang-tidy-18 makes this feature stable enough for us to use in general. Enable the check, and fix the couple of regressions that have snuck in since we last ran the check. Tidy seems to not be able to understand that ASSERT will not continue, so if we ASSERT a std::optional, it's not a bug. Add explicit checks to keep tidy happy. Tested: clang-tidy passes. Change-Id: I0986453851da5471056a7b47b8ad57a9801df259 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-27Fix unused variable warning in LDAPEd Tanous1-19/+28
It's not clear how this came to be the way it is, but tidy now warns that this variable is unused (which it is). Refactor the LDAP code to not use the variable, and to use concrete object_t and array_t Tested: Redfish service validator passes. Change-Id: I0c106d10594a396d506bf9865cb29d4a10a372a1 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-27Update indicator LED verificationGeorge Liu1-2/+4
Extend the hasIndicatorLed array and add xyz.openbmc_project.Inventory.Item.Chassis interface. Tested: ``` curl -k https://$bmc/redfish/v1/Chassis/chassis { "@odata.id": "/redfish/v1/Chassis/chassis", "@odata.type": "#Chassis.v1_22_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" } ] }, "Location": { "PartLocation": { "ServiceLabel": "U78DA.ND0.WZS004K" } }, "IndicatorLED": "Off", "LocationIndicatorActive": false, "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" } } ``` Signed-off-by: George Liu <liuxiwei@ieisystem.com> Change-Id: I02e77d56e555f9aee3f76015baeebbf1f4a292ab
2024-03-25Fix redundant init issuesEd Tanous3-10/+13
clang-tidy-18 must've fixed their checking for these in headers. Resolve as the robot commands. Tested: Noop changes made by tidy. Code compiles. Change-Id: I1de7686c597deffb0df91c30dae1a29f9ba7900e Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-21Clean up event service to use readJsonEd Tanous1-31/+32
Use multiple level direct read. Tested: Visual only. Need help if anyone wants to test. Change-Id: I8655e74d39edcbab43fcd2a8379b085e91ed00eb Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-21Clean up triggers to use readJsonEd Tanous1-109/+123
Use multiple level direct read Tested: Visual only. Need help if anyone wants to test. Change-Id: I2595a7024f1d02e02874310d1911cd4855b867be Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-21Clean up Manager to use readJsonEd Tanous1-107/+86
Change-Id: If4237a21aa0c5f414e20cd9e7eee2f1188097e14 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-21Clean up metric report definition to use readJsonObjectEd Tanous1-46/+29
Change-Id: I29a9ecbdc9011b6513dc6bfccd28e7e7158fed9b Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-21Clean up processor to use readJsonEd Tanous1-11/+6
Change-Id: I2e72f01821e931a8d6eeb812c314de9d1c52df78 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-21Clean up power/thermal to use readJsonObjectEd Tanous3-24/+17
Change-Id: I69ed29472b209e8782be63c3f0f2e8ca63dc14a4 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-21Clean up Certificate Service to use readJsonEd Tanous1-27/+12
Use multiple level direct read to simplify code. Tested: Visual only. Need help if anyone wants to test. Change-Id: Ib7c34daefbe2bb835cbe420b40861f27442d05b1 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-21Use readJson to simplify updateEd Tanous1-32/+24
Similar to other places where we've ported the depth-based readJson support forward, this commit ports the UpdateService handler to simplify the code. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ia9841a10b4414f81205d3f9b49ec8aab8f9d491d
2024-03-19Make readJson accept object_tEd Tanous1-18/+66
Redfish supports several type systems for json. This makes parsing into proper types a challenge. Nlohmann supports 3 core data types, nlohmann::json, which supports all json types (float, int, array, object). Nlohmann::json::object_t, which is a specific typedef of std::map, and nlohmann::json::array_t, which is a specific typedef of std::map. Redfish allows reading our arrays of complex objects, similar to NtpServers: [null, {}, "string"] Which makes it a challenge to support. This commit allows parsing out objects as a nlohmann::object_t, which gives the ability to later use it in a type safe manner, without having to call get_ptr<nlohmann::json::object_t later>. Tested: Unit tests pass. Change-Id: I4134338951ce27c2f56841a45b56bc64ad1753db Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-19Rename FileBody to HttpBodyEd Tanous1-9/+9
Now that our custom body type does things more than files, it makes sense to rename it. This commit renames the header itself, then all instances of the class. Tested: Basic GET requests succeed. Change-Id: If4361ac8992fc7c268f48a336707f96e68d3576c Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-19Call systemd SetTime directlyEd Tanous3-23/+47
Internally inside phosphor-time-manager, the elapsed(uint64) dbus call just forwards the request directly to systemd after static casting to int64_t (signed). bmcweb should just call systemd directly, for several reasons. phosphor-timesyncd might block on other calls, given it's a single threaded blocking design, due to bugs like #264. Calling systemd directly means that calls that don't require phosphor networkd won't be blocked. Calling systemd directly allows bmcweb to drop some code that parses a date as int64_t, then converts it to uint64_t to fulfill the phosphor datetime interface. We can now keep int64_t all the way through. Calling systemd directly allows bmcweb to give a more specific error code in the case there NTP is enabled, registering a PropertyValueConflict error, instead of a 500 InternalError. Tested: Patching DateTime property with NTP enabled returns 400, PropertyValueConflict ``` curl -vvvv -k --user "root:0penBmc" -H "Content-Type: application/json" -X PATCH -d '{"DateTime":"2020-12-15T15:40:52+00:00"}' https://192.168.7.2/redfish/v1/Managers/bmc ``` Disabling NTP using the following command: ``` curl -vvvv -k --user "root:0penBmc" -H "Content-Type: application/json" -X PATCH -d '{"NTP":{"ProtocolEnabled":false}}' https://192.168.7.2/redfish/v1/Managers/bmc/NetworkProtocol ``` Allows the prior command to succeed. [1] https://github.com/openbmc/phosphor-time-manager/blob/5ce9ac0e56440312997b25771507585905e8b360/bmc_epoch.cpp#L126 Change-Id: I6fbb6f63e17de8ab847ca5ed4eadc2bd313586d2 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-18Clean up power schemaEd Tanous1-279/+291
Remove some inline lambdas. This should have no impact on function, code was just moved. 4 tiers of inline lambdas are now down to 2. Ideally should be 1. Tested: Thank you Gaurav! Appears to work as intended. Change-Id: I3acd0b77bc59ece4ed5ecde5fe4257dc903456fb Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-16Fix PID Zone interface namePavanKumarIntel1-1/+1
The interface name is being loaded incorrectly which causes the DBus call to fail resulting in Internal server error. This commit changes the interface to the correct name. This is a regression caused by ea2b670d306d85d6975b6174024985491af04a89 TESTED: - PATCH /redfish/v1/Managers/bmc with below body succeeded { "Oem": { "OpenBmc": { "Fan": { "FanZones": { "Left": { "MinThermalOutput": 30.0 } } } } } } Change-Id: I0bcf858cd541dc11e802431ad983954a57d8c790 Signed-off-by: PavanKumarIntel <pavanx.kumar.martha@intel.com>
2024-03-15Remove link from Chassis to PCIeDeviceSunny Srivastava1-3/+0
The commit removes current support that assumes 1:1 system:Chassis for Chassis/PCIeDevices. Current implementation populates the same collection of PCIeDevices with chassis and with system. Since the path is /redfish/v1/Systems/system/PCIeDevices and we already have a link from /redfish/v1/Systems/system/, removing the link here in Chassis. The link from Chassis to /redfish/v1/Systems/system/PCIeDevices is unexpected. For systems with multiple chassis the current assumption does not hold true. It breaks there, as it assumes all PCIeDevices are in all Chassis. This is just a link and since another link from system resource already exists. The case of walking the whole tree isn't broke. And so, this should not break clients. Validator has been executed with no new errors. Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com> Change-Id: Id3af01ec99708c36b5fff2a63f04ffd722f6c3a2 Signed-off-by: Alpana Kumari <alpankum@in.ibm.com>
2024-03-13Correct Actions/Manager.ResetToDefaults parameter nameKonstantin Aladyshev1-10/+21
According to the Redfish Data Model specification the correct parameter name for the '/Actions/Manager.ResetToDefaults' action is not 'ResetToDefaults' but 'ResetType'. The mistake was originally introduced in the commit "Redfish: Manager: ResetToDefault" (3e40fc742265c3ec1384e7e5994e62aed356331f). Change parameter name to match with the specification. Leave some support for the old parameter name to keep the compatibility with the old clients. Tested: The POST request /redfish/v1/Managers/bmc/Actions/Manager.ResetToDefaults with {"ResetType": "ResetAll"} body accepted successfully. Redfish validator passed. Change-Id: I6aab20314f85dbda16ad3758091de8822943b761 Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
2024-03-11fix usage of std::ranges::replace_copyAlexander Hansen1-0/+2
As hinted at in the usage example [1], the destination range must have sufficient size to contain the elements. If the destination range has size 0, then it will be empty after the function call. Then the "Name" property in powersupply json will be "" and there will only be one powersupply because of the deduplication code. Tested: Powersupplies appear as usual References: [1] https://en.cppreference.com/w/cpp/algorithm/ranges/replace_copy Change-Id: I81dd21a2dd6eb9b29a67007d6d6229d3a752690f Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
2024-03-08Fix behavior when service is missingEd Tanous1-2/+3
Fix regression as part of 33e1f122b740c5de679dc0350b5f41e8d975499f AllowedHostTransitions: look for on dbus I have no idea why checking against .value() matters here, but on systems that doesn't have this daemon present, checking against ec == instead of ec.value() == causes this to return 500. Loaded on qemu, without an implementation of AllowedValues. ``` curl -vvvv -k --user "root:0penBmc" -H "Content-Type: application/json" https://192.168.7.2/redfish/v1/Systems/system/ResetActionInfo ``` Now succeeds. Change-Id: I05758c3f9fd9d0f1c90830ba005c74bc6f874bd6 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-06Support PATCH on IPv6StaticDefaultGatewaysSunitha Harish1-14/+292
Currently there is no support to setting up the Static Default IPv6 gateway via redfish. This commit adds IPv6StaticDefaultGateways parameter to the ethernet interface, on which user can send PATCH request and setup the Static IPv6 gateway for the interface. Tested: GET https://${bmc}/redfish/v1/Managers/bmc/EthernetInterfaces/<id> ``` "IPv6StaticDefaultGateways": [ { "Address": "2002:903:15F:325:9:3:29:1", "PrefixLength": 24 }, { "Address": "2002:90:15F:325:9:3:29:1", "PrefixLength": 24 } ], ``` PATCH https://${bmc}/redfish/v1/Managers/bmc/EthernetInterfaces/<id> -d '{"IPv6StaticDefaultGateways": [{"Address": "2002:903:15F:325:9:3:29:1", "PrefixLength": 24}]}' PATCH https://${bmc}/redfish/v1/Managers/bmc/EthernetInterfaces/<id> -d '{"IPv6StaticDefaultGateways": [{"Address": "2002:903:15F:325:9:3:29:1"}]}' PATCH https://${bmc}/redfish/v1/Managers/bmc/EthernetInterfaces/<id> -d '{"IPv6StaticDefaultGateways": [{}, {"Address": "2002:903:15F:325:9:3:29:1","PrefixLength": 24}]}' PATCH https://${bmc}/redfish/v1/Managers/bmc/EthernetInterfaces/<id> -d '{"IPv6StaticDefaultGateways": [null, {}]}' PATCH https://${bmc}/redfish/v1/Managers/bmc/EthernetInterfaces/<id> -d '{"IPv6StaticDefaultGateways": [{"PrefixLength": 24}]}' --> this will return PropertyMissing error Redfish validator passed. Change-Id: If6aaa6981a9272a733594f0ee313873a09f67758 Signed-off-by: Sunitha Harish <sunithaharish04@gmail.com> Signed-off-by: Ravi Teja <raviteja28031990@gmail.com> Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2024-03-05redfish-schema: add ProtocolPatrick Williams1-0/+1
The Drive schema indirectly references Protocol, but it is missing from the schema list. Modify `update_schemas.py` to include it and run, checking in the results. Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ic3adad00924d450d3b7062c94ec04fc26e4cc9b9
2024-03-05Sessions: Drop end / from odata.idGunnar Mills1-2/+2
Fix warnings around odata.id not matching. Was looking at old defects, and closed https://github.com/openbmc/bmcweb/issues/166 (closed since no longer see these warnings) but saw we have these warnings for sessions: ``` *** /redfish/v1/SessionService Attempt 1 of /redfish/v1/SessionService Response Time for GET to /redfish/v1/SessionService: 0.046112860552966595 seconds. /redfish/v1/SessionService @odata.id: Expected @odata.id to match URI link /redfish/v1/SessionService/ Type (SessionService.v1_0_2.SessionService), GET SUCCESS (time: 0:00:00.046476) Attempt 1 of /redfish/v1/SessionService/Sessions Response Time for GET to /redfish/v1/SessionService/Sessions: 0.005822769366204739 seconds. PASS *** /redfish/v1/SessionService/Sessions /redfish/v1/SessionService/Sessions @odata.id: Expected @odata.id to match URI link /redfish/v1/SessionService/Sessions/ Type (SessionCollection.SessionCollection), GET SUCCESS (time: 0:00:00.006165) ``` It looks like all other odata.ids don't end in a / https://github.com/search?q=repo%3Aopenbmc%2Fbmcweb%20odata.id&type=code Tested: NONE. Visual inspection only. Signed-off-by: Gunnar Mills <gmills@us.ibm.com> Change-Id: Ie1cde192a5774a86c96e6993c71e8b124c79739a
2024-03-05DHCP Conf: Fix UseDomainName configurationRavi Teja1-6/+26
This commit modifies to use DomainEnabled D-bus property Currently "UseDomainName" configuration is actually not controlling DomainName setting in the backend networkd and networkd. Networkd app does not have DomainName D-bus property implemented and wrong D-bus property is being used in the bmcweb. This fix make sure bmcweb uses DomainEnabled property and controls UseDomainName configuration. Here is backend networkd fix for DomainEnabled property https://gerrit.openbmc.org/c/openbmc/phosphor-networkd/+/69604 Tested by: Enabled DHCPv4 on one of the interface Enable/Disable UseDomainName Check if DHCP configured domain name configuration on BMC. Change-Id: I68b86d4107a17db921ec463f5660a58aaa1396e3 Signed-off-by: Ravi Teja <raviteja28031990@gmail.com>
2024-03-04AllowedHostTransitions: look for on dbusAndrew Geissler1-19/+104
Commit [1] introduced a new optional dbus property that OpenBMC developers can populate to define which redfish/v1/Systems/system/ResetActionInfo AllowableValues are. Look for that new property on dbus. If not found, hard code the previous values otherwise utilize the property to fill in the return value. Tested: - Put new property on dbus and confirmed Redfish API returned expected values: ``` curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Systems/system/ResetActionInfo { "@odata.id": "/redfish/v1/Systems/system/ResetActionInfo", "@odata.type": "#ActionInfo.v1_1_2.ActionInfo", "Id": "ResetActionInfo", "Name": "Reset Action Info", "Parameters": [ { "AllowableValues": [ "ForceOff", "PowerCycle", "Nmi", "On", "ForceOn", "ForceRestart", "GracefulRestart", "GracefulShutdown" ], "DataType": "String", "Name": "ResetType", "Required": true } ] } ``` - Did not run redfish validator as response was same as previous [1]: https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/68933 Change-Id: Iecece14e7ff55db98d96df71b106ecc9e3f0ac33 Signed-off-by: Andrew Geissler <geissonator@yahoo.com> Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2024-02-24Systems: Add support to read AllowedPowerModesChris Cain1-48/+85
Instead of hardcodeing the AllowedPowerModes property, the data will be read from dbus if it exists. If data is empty/not found, the property will be set to the default value: [ "MaximumPerformance", "PowerSaving", "Static" ] Tested on Rainier hardware and Validator passed When dbus property is empty, it will show default modes: ''' xyz.openbmc_project.Control.Power.Mode interface - - - .AllowedPowerModes property as 0 const .PowerMode property s "xyz.openbmc_project.Control.Power.Mode.PowerMode.MaximumPerformance" emits-change writable "PowerMode": "MaximumPerformance", "PowerMode@Redfish.AllowableValues": [ "MaximumPerformance", "PowerSaving", "Static" ], "PowerRestorePolicy": "AlwaysOff", ''' When dbus property populated with 6 modes: ''' - xyz.openbmc_project.Control.Power.Mode interface - - - .AllowedPowerModes property as 6 "xyz.openbmc_project.Control.Power.Mode.PowerMode.BalancedPerformance" "xyz.openbmc_project.Control.Power.Mode.PowerMode.EfficiencyFavorPerformance" "xyz.openbmc_project.Control.Power.Mode.PowerMode.EfficiencyFavorPower" "xyz.openbmc_project.Control.Power.Mode.PowerMode.MaximumPerformance" "xyz.openbmc_project.Control.Power.Mode.PowerMode.PowerSaving" "xyz.openbmc_project.Control.Power.Mode.PowerMode.Static" const .PowerMode property s "xyz.openbmc_project.Control.Power.Mode.PowerMode.MaximumPerformance" emits-change writable "PowerMode": "MaximumPerformance", "PowerMode@Redfish.AllowableValues": [ "BalancedPerformance", "EfficiencyFavorPerformance", "EfficiencyFavorPower", "MaximumPerformance", "PowerSaving", "Static" ], "PowerRestorePolicy": "AlwaysOff", ''' When dbus property not defined it will show default modes: ''' xyz.openbmc_project.Control.Power.Mode interface - - - .PowerMode property s "xyz.openbmc_project.Control.Power.Mode.PowerMode.MaximumPerformance" emits-change writable "PowerMode": "MaximumPerformance", "PowerMode@Redfish.AllowableValues": [ "MaximumPerformance", "PowerSaving", "Static" ], "PowerRestorePolicy": "AlwaysOff", ''' Signed-off-by: Chris Cain <cjcain@us.ibm.com> Change-Id: Ic9882d2760a39dd1a0ea353624eb3c8575f4c6a0
2024-02-23manager_diagnostic_data: add metric getJagpal Singh Gill1-0/+163
Add support to fetch MemoryStatistics, FreeStorageSpaceKiB and ProcessorStatistics for Manager Diagnostic Data. https://redfish.dmtf.org/schemas/v1/ManagerDiagnosticData.v1_2_1.json This change is in relation to following design and D-Bus interface - https://gerrit.openbmc.org/c/openbmc/docs/+/64917 https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/64914 Test: Redfish query output - { "@odata.id": "/redfish/v1/Managers/bmc/ManagerDiagnosticData", "@odata.type": "#ManagerDiagnosticData.v1_2_0.ManagerDiagnosticData", "FreeStorageSpaceKiB": 3772, "Id": "ManagerDiagnosticData", "MemoryStatistics": { "AvailableBytes": 354224066, "BuffersAndCacheBytes": 78984633, "SharedBytes": 11876066, "TotalBytes": 425516000 }, "Name": "Manager Diagnostic Data", "ProcessorStatistics": { "KernelPercent": 13.0234, "UserPercent": 5.7374 }, "ServiceRootUptimeSeconds": 2255.117 } Redfish service validator passing - Elapsed time: 0:03:12 metadataNamespaces: 3726 pass: 5133 passAction: 9 passGet: 205 passRedfishUri: 197 skipNoSchema: 3 skipOptional: 3492 warnDeprecated: 4 warningPresent: 7 Validation has succeeded. Change-Id: I43758a993eb7f342cb9ac5f5574498b37261c2cc Signed-off-by: Jagpal Singh Gill <paligill@gmail.com>
2024-02-23Refactor to pass dbus error code to callerMyung Bae1-59/+102
The aux function `getValidFabricAdapterPath()` currently handles the error uniformly for all callers. This commit is to make the function to pass the error conddition to the caller so that it can be handled appropriately in the caller's context. Tested: - Check `resourceNotFound` is generated by caller. ``` $ curl -k -X GET https://${bmc}:18080/redfish/v1/Systems/system/FabricAdapters/badAdapter [WARNING fabric_adapters.hpp:270] Adapter not found ``` - Validator passes Change-Id: I37a61a3a79138aa898ab18332f58e3007496e302 Signed-off-by: Myung Bae <myungbae@us.ibm.com>
2024-02-21Chassis: Add support for Version propertyCarson Labrado1-0/+19
Add support for the Version property of Chassis resources. That property was added in Chassis schema v1.21.0. This makes use of the "xyz.openbmc_project.Inventory.Decorator.Revision" interface that is already defined by phosphor-dbus-interfaces. Tested: Validator passed and Version property was correctly populated. No issues on other Chassis resources which do not have a Version property. I added this to an entity-manager json config: "xyz.openbmc_project.Inventory.Decorator.Revision": { "Version": "$PRODUCT_VERSION" } The PRODUCT_VERSION field from a given FRU eeprom was picked up by FruDevice and it was exposed under the associated Chassis resource: busctl get-property xyz.openbmc_project.FruDevice \ /xyz/openbmc_project/FruDevice/Test \ xyz.openbmc_project.FruDevice PRODUCT_VERSION s "V1.0" curl -s 'localhost/redfish/v1/Chassis/TestChassis' { "@odata.id": "/redfish/v1/Chassis/TestChassis", ... "Version": "V1.0" } Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: Ie1391d46e81fd8c503fe4b1e6d683dd4553a5419
2024-02-16Simplify bodyEd Tanous1-1/+0
Now that we have a custom boost http body class, we can use it in more cases. There's some significant overhead and code when switching to a file body, namely removing all the headers. Making the body class support strings would allow us to completely avoid that inefficiency. At the same time, it would mean that we can now use that class for all cases, including HttpClient, and http::Request. This leads to some code reduction overall, and means we're reliant on fewer beast structures. As an added benefit, we no longer have to take a dependency on boost::variant2. Tested: Redfish service validator passes, with the exception of badNamespaceInclude, which is showing warnings prior to this commit. Change-Id: I061883a73230d6085d951c15891465c2c8445969 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-02-16Configure DHCP4 and DHCP6 parameters independentlyJishnu CM1-75/+117
At present, DHCP parameters like DNSEnabled, NTPEnabled and HostNameEnabled are at the system level at the network backend. It is common across both IPv4 and IPv6 network types. Thus when a redfish command is sent to enable the DNSEnabled property for IPv4 on eth0 interface, it internally sets the DNSEnabled to true for both IPv4 and IPv6 on eth0 and eth1. Here the change in parameter value for a non-requested network type in the non-requested interface might be an unexpected behaviour for the user. Also, with the current implementation in bmcweb and networkd, the user has no option to configure DHCP parameters differently for different interfaces and network types though it is supported by the redfish. With this change, the Redfish query for updating DHCP parameters will only modify the requested parameter for the specified network type and interface. User must make separate requests to modify the DHCP parameters as per the DMTF schema Current behavior: Request: curl -k -H "X-Auth-Token: $bmc_token" -X PATCH -d '{"DHCPv4":{"UseDNSServers":false}}' https://${bmc}/redfish/v1/Managers/bmc/EthernetInterfaces/eth0 Result: UseDNSServers value is set to false for DHCPv4 and DHCPv6 for all interfaces. After this commit: Request: curl -k -H "X-Auth-Token: $bmc_token" -X PATCH -d '{"DHCPv4":{"UseDNSServers":false}}' https://${bmc}/redfish/v1/Managers/bmc/EthernetInterfaces/eth0 Result: UseDNSServers value is set to false only for DHCPv4 only in eth0 as mentioned in the redfish request. The DHCP configuration was in the network manager level earlier, it has been moved to interface level with https://gerrit.openbmc.org/c/openbmc/phosphor-networkd/+/63124. This bmcweb change is to separate out the values for IPv4 and IPv6 and to move the dbus object to the interface level. Tested by: Patching the DHCP parameters with redfish request: curl -k -H "X-Auth-Token: $bmc_token" -X PATCH -d '{"<network_type>":{"<DHCP_param>":<value>}}' https://${bmc}/redfish/v1/Managers/bmc/EthernetInterfaces/<interface_id> Verify the value is updated in the network configuration. Retrieve the DHCP parametrer value with the Get Request: curl -k -H "X-Auth-Token: $bmc_token" -X GET https://${bmc}/redfish/v1/Managers/bmc/EthernetInterfaces/<interface_id> Change-Id: I5db29b6dfc8966ff5af51041da11e5b79da7d1dd Signed-off-by: Jishnu CM <jishnunambiarcm@duck.com>
2024-02-08Systems: Add support for new eco power modesChris Cain1-11/+49
Add support for the following new power modes: - Efficiency Favor Performance - Efficiency Favor Power - Balanced Performance New modes were added in ComputerSystem schema to v1.22 Tested on Rainier and passed Validator ''' GET /redfish/v1/Systems/system: "@odata.type": "#ComputerSystem.v1_22_0.ComputerSystem", ... "PowerMode": "EfficiencyFavorPerformance", "PowerMode@Redfish.AllowableValues": [ "Static", "MaximumPerformance", "PowerSaving" ], PATCH -d '{ "PowerMode":"BalancedPerformance"}' https://$bmc/redfish/v1/Systems/system "PowerMode": "BalancedPerformance", PATCH -d '{ "PowerMode":"EfficiencyFavorPerformance"}' https://$bmc/redfish/v1/Systems/system "PowerMode": "EfficiencyFavorPerformance", PATCH -d '{ "PowerMode":"EfficiencyFavorPower"}' https://$bmc/redfish/v1/Systems/system "PowerMode": "EfficiencyFavorPower", PATCH -d '{ "PowerMode":"MaximumPerformance"}' https://$bmc/redfish/v1/Systems/system "PowerMode": "MaximumPerformance", PATCH -d '{ "PowerMode":"NotARealMode"}' https://$bmc/redfish/v1/Systems/system { "PowerMode@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The value '\"NotARealMode\"' for the property PowerMode is not in the list of acceptable values.", "MessageArgs": [ "\"NotARealMode\"", "PowerMode" ], "MessageId": "Base.1.13.0.PropertyValueNotInList", "MessageSeverity": "Warning", "Resolution": "Choose a value from the enumeration list that the implementation can support and resubmit the request if the operation failed." } ] ''' Validator Results: ''' Type (ComputerSystem.v1_22_0.ComputerSystem), GET SUCCESS (time: 0:00:00.107269) ... PASS ... Elapsed time: 0:15:07 invalidPropertyValue: 62 metadataNamespaces: 4324 pass: 14323 passAction: 20 passGet: 1051 passRedfishUri: 1002 skipNoSchema: 3 skipOptional: 25582 unverifiedAdditional.complex: 21 warnDeprecated: 8 warningPresent: 83 warnings: 67 Validation has succeeded. ''' Change-Id: I56296a524b01d64adccad2d3da1757056900b6db Signed-off-by: Chris Cain <cjcain@us.ibm.com>
2024-02-07Add StandbyOffline to Redfish sensor getStateMatt Simmering1-5/+28
Currently in Redfish a sensor's state will only be "Absent" or "Enabled". In the case where a sensor is marked as not available on D-Bus it would be more accurate and informative to have the state as "StandbyOffline". A sensor's availability will be published on its xyz.openbmc_project.State.Decorator.Availability interface. Tested on Intel system. Put sensors into an unavailable state by putting CPU into S5 power state, and verified that Redfish state is "StandbyOffline". Then when sensors are back in an available state their Redfish state is back to "Enabled". Change-Id: I4b846b678a0f90f60d182ac38f1becd21265cdd2 Signed-off-by: Matt Simmering <matthew.simmering@intel.com>