summaryrefslogtreecommitdiff
path: root/redfish-core/lib/systems.hpp
AgeCommit message (Collapse)AuthorFilesLines
2021-10-15Add CoreCount to ProcessorSummaryAli Ahmed1-82/+112
In Redfish ComputerSystem schema, the ProcessorSummary parameter lists summary information of the Processors on the system. This commit adds the 'CoreCount' property to ProcessorSummary. Testing: 1. Redfish Validator Testing successfully passed. 2. Curl testing: curl -k -H "X-Auth-Token: $tok" https://$bmc/redfish/v1/Systems/system ... "ProcessorSummary": { "CoreCount": 24, "Count": 2, "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Disabled" } }, ... Signed-off-by: Ali Ahmed <ama213000@gmail.com> Change-Id: Idda4f20bd1bb3f5002791ad20787979c632ed5f0
2021-09-22Move TPMRequiredToBoot under Boot for PATCH callAli Ahmed1-11/+11
TrustedModuleRequiredToBoot is a sub-parameter of the 'Boot' parameter. Edits the patch code to make sure the patch happens under '{"Boot":{"TrustedModuleRequiredToBoot": false}}', instead of current: '{"TrustedModuleRequiredToBoot":false}'. Testing: 1) Curl testing: curl -k -H "X-Auth-Token: $token" -X PATCH \ -d '{"Boot":{"TrustedModuleRequiredToBoot": true}}' \ https://${bmc}/redfish/v1/Systems/system curl -k -H "X-Auth-Token: $token" \ https://${bmc}/redfish/v1/Systems/system { ... "Boot": { "AutomaticRetryAttempts": 3, "AutomaticRetryConfig": "Disabled", "AutomaticRetryConfig@Redfish.AllowableValues": [ "Disabled", "RetryAttempts" ], "BootSourceOverrideEnabled": "Disabled", "BootSourceOverrideTarget": "BiosSetup", "BootSourceOverrideTarget@Redfish.AllowableValues": [ "None", "Pxe", "Hdd", "Cd", "Diags", "BiosSetup", "Usb" ], "TrustedModuleRequiredToBoot": "Required" }, ... } Signed-off-by: Ali Ahmed <ama213000@gmail.com> Change-Id: I70b26a8e3c7282fa628dcc149d1328a8dc9f0b8b
2021-09-03Have ProcessorSummary correctly set StatusAli Ahmed1-125/+57
Remove unnecessary condition, and correctly get Status from Present and Functional properties. Removal of if, else code: 1. If condition never evaluates to false ('else' branch is never taken) Properties size will always be 7 as that's how it's defined here [1] Context: The 'if' code branch was originally there for a company that was NOT following the d-bus interfaces. See commit 57e8c9b [2] & gerrit [3]. Later, properties were added to the Inventory.Item.Cpu interface, so now everyone is hitting this 'if' branch. See commit 259f49e [4]. The code in the 'else' condition uses Inventory.Item Present and State.Decorator.OperationalStatus Function to determine Redfish "Count", "Status""State", "Status""Health", since this is the correct way to determine Redfish Status. Summary: 1) Removes the if/else condition, and 2) Retains the code that was in the else condition [1] https://github.com/openbmc/phosphor-dbus-interfaces/blob/master /yaml/xyz/openbmc_project/Inventory/Item/Cpu.interface.yaml [2] https://github.com/openbmc/bmcweb/commit/57e8c9b [3] https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/20572/4 [4] https://github.com/openbmc/phosphor-dbus-interfaces/commit/259f49e Tested: curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Systems/system Before: ... "ProcessorSummary": { "Count": 0, "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Disabled" } }, ... After: ... "ProcessorSummary": { "Count": 2, "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" } }, ... Signed-off-by: Ali Ahmed <ama213000@gmail.com> Change-Id: I1a38086b87f4f1e2ebbfa3b5058d95158d29002a
2021-08-20Add TrustedModuleRequiredToBoot setter functionAli Ahmed1-2/+98
TrustedModuleRequiredToBoot is a Redfish ComputerSystem v1_14_0 property, determining if a working TPM is required in order to boot the host. The TPM Required property is mapped to the "TPMEnable" D-Bus property. The possible values for the Redfish property are "Required" and "Disabled". This commit will add the PATCH operations to the TrustedModuleRequiredToBoot Redfish property. (See https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/43930 for the GET operations for this property). Testing: 1) Curl Testing: I manually tested retrieving the property: *Default value of TrustedModuleRequiredToBoot is ??Required?? curl -k -H "X-Auth-Token: $token" -X PATCH -d \ '{"TrustedModuleRequiredToBoot":false}' \ https://${bmc}/redfish/v1/Systems/system curl -k -H "X-Auth-Token: $token" \ https://${bmc}/redfish/v1/Systems/system { "@odata.id": "/redfish/v1/Systems/system", "@odata.type": "#ComputerSystem.v1_14_0.ComputerSystem", ... "Boot": { "AutomaticRetryAttempts": 3, ?? "RemainingAutomaticRetryAttempts": 3, "TrustedModuleRequiredToBoot": "Disabled" }, ... On HW: D-Bus TPMEnable shows up correctly as 'false' '# busctl get-property xyz.openbmc_project.Settings \ /xyz/openbmc_project/control/host0/TPMEnable \ xyz.openbmc_project.Control.TPM.Policy TPMEnable' b false 2) Redfish Validator Testing: Tested on ComputerSystem v1_14_0 schema Validator Test everything passed and 0 failures. Signed-off-by: Ali Ahmed <ama213000@gmail.com> Change-Id: Ie96a6afca179e45bef35813a3fa9c8a10cdf234e
2021-08-02Support new boot override setting designKonstantin Aladyshev1-245/+248
Add support for the new boot override setting design that was pushed in the commit: "phosphor-settings-manager: redesign boot setting override feature" (openbmc/openbmc/+/44226). The new design not only simplifies boot override settings handling, but also removes interdependency between BootType/BootSource/ BootMode parameters that was present in the handling code. In the old design there wasn't any place to encode boot override disabled state on a Dbus. Therefore bmcweb used implicit mapping of boot parameters to address the problem of encoding disabled override state: "BootSourceOverrideEnabled=Disabled" = "BootSourceOverrideMode=UEFI" + "BootSourceOverrideTarget=None" But with this approach if you set: "BootSourceOverrideEnabled=Once" "BootSourceOverrideMode=UEFI" "BootSourceOverrideTarget=None" You would later read: "BootSourceOverrideEnabled=Disabled" "BootSourceOverrideMode=UEFI" "BootSourceOverrideTarget=None" Which is not what is expected. Also this interdependency between boot parameters complicates the code. For example if we only try to set the boot mode, we need also to check the boot target and probably set the boot enabled state. If we only try to read boot enabled, we also need to check boot mode and boot target. This is also not good. In the new design there is a specific Dbus interface that is used to store overall override enabled state. With it is possible to remove the implicit mapping of boot parameters to disabled state and remove the unnecessary interdependency between the boot override parameters. Also now with the help of "Support all parameter combinations in Redfish boot tests" (openbmc-test-automation/+/44225) it it possible to test for all combinations of boot override parameters. Tested with the openbmc-test-automation with the aforementioned patch applied (openbmc-test-automation/+/44225) with "boot_type" feature present: robot -v PLATFORM_ARCH_TYPE:x86 \ -v OPENBMC_HOST:<BMC IP> \ redfish/systems/test_boot_devices.robot Also tested with the openbmc-test-automation with the aforementioned patch applied (openbmc-test-automation/+/44225) without "boot_type" feature present: robot -v OPENBMC_HOST:<BMC IP> \ redfish/systems/test_boot_devices.robot More information about boot source override design differences can be found at the mailing list discussions: https://lists.ozlabs.org/pipermail/openbmc/2021-May/026533.html and https://lists.ozlabs.org/pipermail/openbmc/2021-June/026759.html Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com> Change-Id: Id0b24b37a4519a2efbb97da597858c295d7c6c27 Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
2021-07-20Add support for the BootSourceOverrideModeKonstantin Aladyshev1-56/+260
BootSourceOverrideMode is the BIOS boot mode to use when the system boots from the BootSourceOverrideTarget boot source. Possible values are: -Legacy - The system boots in non-UEFI boot mode to the boot source override target -UEFI - The system boots in UEFI boot mode to the boot source override target For the architectures that don't implement Legacy/UEFI boot mode property (for example POWER), don't publish BootSourceOverrideMode interface at all. Redfish validator has been executed on this change and no new error was found. Also tested with the help of the openbmc-test-automation framework. When the Legacy/UEFI boot mode is present in the system command for testing is: robot -v PLATFORM_ARCH_TYPE:x86 \ -v OPENBMC_HOST:<BMC IP> \ redfish/systems/test_boot_devices.robot When the Legacy/UEFI boot mode is not present in the system command for testing is: robot -v OPENBMC_HOST:<BMC IP> \ redfish/systems/test_boot_devices.robot Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com> Change-Id: Id64e428752b820d481ce15d56566dd7b06738ec0
2021-07-13Make code compile with clang-13Ed Tanous1-5/+4
Clang-13 rightfully warns that the hasWebuiRoute variable isn't declared as static. This commit resolves that, and adds the static keyword so it can be used in multiple compile units. It also adds the static keyword to the privilege registry, and the inline keyword to many methods that now need it. clang-format is also updated to version 12 in parse_registies.py, as that's what CI uses, and what most people have installed. Tested: Followed clang-tidy instructions in README.md "bitbake bmcweb" step now succeeds. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Id43b13606754cb37a404799fce155599ac3a3240
2021-07-08Automate PrivilegeRegistry to codeEd Tanous1-5/+6
This commit attempts to automate the creation of our privileges structures from the redfish privilege registry. It accomplishes this by updating parse_registries.py to also pull down the privilege registry from DMTF. The script then generates privilege_registry.hpp, which include const defines for all the privilege registry entries in the same format that the Privileges struct accepts. This allows new clients to simply reference the variable to these privilege structures, instead of having to manually (ie error pronely) put the privileges in themselves. This commit updates all the routes. For the moment, override and OEM schemas are not considered. Today we don't have any OEM-specific Redfish routes, so the existing ones inherit their parents schema. Overrides have other issues, and are already incorrect as Redfish defines them. Binary size remains unchanged after this patchset. Tested: Ran redfish service validator Ran test case from f9a6708c4c6490257e2eb6a8c04458f500902476 to ensure that the new privileges constructor didn't cause us to regress the brace construction initializer. Checked binary size with: gzip -c $BBPATH/tmp/work/s7106-openbmc-linux-gnueabi/obmc-phosphor-image/1.0-r0/rootfs/usr/bin/bmcweb | wc -c 1244048 (tested on previous patchset) Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ideede3d5b39d50bffe7fe78a0848bdbc22ac387f
2021-07-01Systems: Add PowerMode supportChris Cain1-2/+266
The computer system power mode defines the behavior of a system based on the performance and power saving requirements. For example, a system could be set to MaximumPerformance to run as fast as possible without regard to power consumption. A system could also be configured to run in PowerSaving mode which would be running at slower speeds to try to save power. More information can be found at https://gerrit.openbmc-project.xyz/c/openbmc/docs/+/38786 This commit will allow GET / PATCH operations to the PowerMode property PowerMode was added in Redfish Release 2021.1: https://www.dmtf.org/content/redfish-release-20211-now-available Tested: I manually tested retrieving and setting the PowerMode property on a Rainier system (with good and bad values): # curl -k https://$bmc/redfish/v1/Systems/system { "@odata.id": "/redfish/v1/Systems/system", "@odata.type": "#ComputerSystem.v1_15_0.ComputerSystem ... "PartNumber": "", "PowerMode": "MaximumPerformance", "PowerMode@Redfish.AllowableValues": [ "Static", "MaximumPerformance", "PowerSaving" ], "PowerRestorePolicy": "AlwaysOff", ... # curl -k https://$bmc/xyz/openbmc_project/control/host0/power_mode { "data": { "PowerMode": "xyz.openbmc_project.Control.Power.Mode.PowerMode.MaximumPerformance" }, "message": "200 OK", "status": "ok" } # curl -k -X PATCH -d '{ "PowerMode":"Static"}' https://$bmc/redfish/v1/Systems/system curl -k https://$bmc/xyz/openbmc_project/control/host0/power_mode { "data": { "PowerMode": "xyz.openbmc_project.Control.Power.Mode.PowerMode.Static" }, "message": "200 OK", "status": "ok" } Ran Validator on hardware and all tests passed: Elapsed time: 0:05:07 Counter({'skipOptional': 7128, 'pass': 6020, 'metadataNamespaces': 2217, 'passGet': 315, 'warnDeprecated': 212, 'serviceNamespaces': 79, 'warningPresent': 47, 'warnTrailingSlashLink': 24, 'invalidPropertyValue': 18, 'passAction': 14, 'optionalAction': 11, 'repeat': 3, 'unverifiedComplexAdditional': 1}) Validation has succeeded. Signed-off-by: Chris Cain <cjcain@us.ibm.com> Change-Id: I5523a0ebe4a2a77ea4709a14863bff7b55f0303d
2021-07-01Add TrustedModuleRequiredToBoot getter functionAli Ahmed1-1/+104
TrustedModuleRequiredToBoot is a Redfish ComputerSystem v1_14_0 property, determining if a working TPM is required in order to boot the host. The TPM Required property is mapped to the "TPMEnable" D-Bus property. The possible values for the Redfish property are "Required" and "Disabled". This commit will add the GET operations to the TrustedModuleRequiredToBoot Redfish property. (See https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/44044 for the PATCH operations for this property). Testing: 1) Tested on HW: I manually tested retrieving the property: $ curl -k https://${bmc}/redfish/v1/Systems/system { "@odata.id": "/redfish/v1/Systems/system", "@odata.type": "#ComputerSystem.v1_14_0.ComputerSystem", ... "Boot": { "AutomaticRetryAttempts": 3, "AutomaticRetryConfig": "RetryAttempts", "AutomaticRetryConfig@Redfish.AllowableValues": [ "Disabled", "RetryAttempts" ], "BootSourceOverrideEnabled": "Disabled", "BootSourceOverrideMode": "Legacy", "BootSourceOverrideTarget": "None", "BootSourceOverrideTarget@Redfish.AllowableValues": [ "None", "Pxe", "Hdd", "Cd", "Diags", "BiosSetup", "Usb" ], "RemainingAutomaticRetryAttempts": 3, "TrustedModuleRequiredToBoot": "Required" }, ... TrustedModuleRequiredToBoot switches between 'Required' and 'Disabled' values when the relevant dbus property is changed. (D-Bus Interface: xyz.openbmc_project.Control.TPM.Policy) (D-Bus Property: TPMEnable) 2) Redfish Validator Testing: Tested on ComputerSystem v1_14_0 schema Validator Test everything passed and 0 failures. Signed-off-by: Ali Ahmed <ama213000@gmail.com> Change-Id: I7d0b9430e592d6d8ec95cd9090551fab802d8f54
2021-06-27Move Consoles to ComputerSystemGunnar Mills1-0/+23
2020.3 moved SerialConsole and GraphicalConsole to ComputerSystem. More information can be found on: http://www.dmtf.org/sites/default/files/Redfish_Release_2020.3_Overview.pdf These Consoles are readonly properties and were recently added. Figured no clients are looking for them, but the OCP profile does require SerialConsole so left them in Manager. The OCP profile has not released a new version in 18 months. Filed the following issue with the profile: https://github.com/opencomputeproject/OCP-Profiles/issues/23 After we remove from manager the following validator warning will go away: "SerialConsole: The given property is deprecated by revision: This property has been deprecated in favor of the SerialConsole property in the ComputerSystem resource." Tested: Passes Validator. "GraphicalConsole": { "ConnectTypesSupported": [ "KVMIP" ], "MaxConcurrentSessions": 4, "ServiceEnabled": true }, "SerialConsole": { "IPMI": { "ServiceEnabled": true }, "MaxConcurrentSessions": 15, "SSH": { "HotKeySequenceDisplay": "Press ~. to exit console", "Port": 2200, "ServiceEnabled": true } }, Change-Id: I1cc41c0da67e0d4123678f645828dfe1856d7a8f Signed-off-by: Gunnar Mills <gmills@us.ibm.com> Signed-off-by: Abhishek Patel <Abhishek.Patel@ibm.com>
2021-06-16Remove ambiguous privileges constructorEd Tanous1-5/+5
There are a number of endpoints that assume that a given routes privileges are governed by a single set of privileges, instead of multiple sets ORed together. To handle this, there were two overloads of the privileges() method, one that took a vector of Privileges, and one that took an initializer_list of const char*. Unfortunately, this leads some code in AccountService to pick the wrong overload when it's called like this .privileges( {{"ConfigureUsers"}, {"ConfigureManager"}, {"ConfigureSelf"}}) This is supposed to be "User must have ConfigureUsers, or ConfigureManager, or ConfigureSelf". Currently, because it selects the wrong overload, it computes to "User must have ConfigureUsers AND ConfigureManager AND ConfigureSelf. The double braces are supposed to cause this to form a vector of Privileges, but it appears that the initializer list gets consumed, and the single invocation of initializer list is called. Interestingly, trying to put in a privileges overload of intializer_list<initializer_list<const char*>> causes the compilation to fail with an ambiguous call error, which is what I would've expected to see previously in this case, but alas, I'm only a novice when it comes to how the C++ standard works in these edge cases. This is likely due in part to the fact that they were templates of an unused template param (seemingly copied from the previous method) and SFINAE rules around templates. This commit functionally removes one of the privileges overloads, and adds a second set of braces to every privileges call that previously had a single set of braces. Previous code will not compile now, which is IMO a good thing. This likely popped up in the Node class removal, because the Node class explicitly constructs a vector of Privilege objects, ensuing it can hit the right overload Tested: Ran Redfish service validator Tested the specific use case outlined on discord with: Creating a new user with operator privilege: ``` redfishtool -S Always -u root -p 0penBmc -vvvvvvvvv -r 192.168.7.2 AccountService adduser foo mysuperPass1 Operator ``` Then attempting to list accounts: ``` curl -vvvv --insecure --user foo:mysuperPass1 https://192.168.7.2/redfish/v1/AccountService/Accounts/foo ``` Which succeeded and returned the account in question. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I83e62b70e97f56dc57d43b9081f333a02fe85495
2021-06-03Remove Redfish Node classJohn Edward Broadbent1-403/+373
Reduces the total number of lines and will allow for easier testing of the redfish responses. A main purpose of the node class was to set app.routeDynamic(). However now app.routeDynamic can handle the complexity that was once in critical to node. The macro app.routeDynamic() provides a shorter cleaner interface to the unerlying app.routeDyanic call. The old pattern set permissions for 6 interfaces (get, head, patch, put, delete_, and post) even if only one interface is created. That pattern creates unneeded code that can be safely removed with no effect. Unit test for the responses would have to mock the node the class in order to fully test responses. see https://github.com/openbmc/bmcweb/issues/181 The following files still need node to be extracted. virtual_media.hpp account_service.hpp redfish_sessions.hpp ethernet.hpp The files above use a pattern that is not trivial to address. Often their responses call an async lambda capturing the inherited class. ie (https://github.com/openbmc/bmcweb/blob/ffed87b5ad1797ca966d030e7f979770 28d258fa/redfish-core/lib/account_service.hpp#L1393) At a later point I plan to remove node from the files above. Tested: I ran the docker unit test with the following command. WORKSPACE=$(pwd) UNIT_TEST_PKG=bmcweb ./openbmc-build-scripts/run-unit-test-docker.sh I ran the validator and this change did not create any issues. python3 RedfishServiceValidator.py -c config.ini Signed-off-by: John Edward Broadbent <jebr@google.com> Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I147a0289c52cb4198345b1ad9bfe6fdddf57f3df
2021-04-29Redfish: Update Powering On Status StateNoah Brewer1-1/+1
If the HostState is TransitioningToRunning, Redfish response should indicate Starting. Tested: - Changed HostState to TransitioningToRunning via busctl and get redfish/v1/Systems/system and verified Status State as "Starting" - Docker unit test passed - Redfish validator passed Signed-off-by: Noah Brewer <noah.t.brewer@gmail.com> Change-Id: I69719fdbb32247fd31327be9ad39068e2898c2db
2021-04-21Redfish : Return after InternalError instead of ContinueChicago Duan1-3/+3
"After setting response to internal error you should stop adding more content to response. Try to return instead of continuing a loop" https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/39970/9/redfish-core/lib/pcie_slots.hpp#169 Signed-off-by: Chicago Duan <duanzhijia01@inspur.com> Change-Id: Iadd3062ba7fef31ba61eea1e79eb3a903716b9e9
2021-04-08Using AsyncResp everywherezhanghch051-78/+86
Get the core using AsyncResp everywhere, and not have each individual handler creating its own object.We can call app.handle() without fear of the response getting ended after the first tree is done populating. Don't use res.end() anymore. Tested: 1. Validator passed. Signed-off-by: zhanghaicheng <zhanghch05@inspur.com> Change-Id: I867367ce4a0caf8c4b3f4e07e06c11feed0782e8
2021-03-19Fix Power Restore Policy not valid enum errorGunnar Mills1-4/+5
When the client passes a value that is not in list of accepted values use propertyValueNotInList. Tested: curl -k -X PATCH -d '{"PowerRestorePolicy":"badvalue"}'\ https://${bmc}/redfish/v1/Systems/system { "PowerRestorePolicy@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The value badvalue for the property PowerRestorePolicy is not in the list of acceptable values.", "MessageArgs": [ "badvalue", "PowerRestorePolicy" ], "MessageId": "Base.1.8.1.PropertyValueNotInList", Change-Id: Icfa910c9f79aa6ff0a87f748b55ad52d8ad411d8 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2021-01-08transition support for system stateAndrew Geissler1-0/+12
The following commit defined two new values for the host state: https://github.com/openbmc/phosphor-dbus-interfaces/commit/9f65dfeaa5ab22cae03db45c9916868da9864f83 These new state values, TransitioningToOff and TransitioningToRunning, map quite well to the Redfish system PowerState values of PoweringOff and PoweringOn. There have been requests from external users of our Redfish interfaces to know this level of detail, especially in the PoweringOff path due to the length of time it can take (up to 2 hours is allowed for the host to shut itself down gracefully). Tested: - Put host state D-Bus property in each of new states and verified Redfish API returned expected results. Change-Id: I0c43dc2fa8b057beea48bc6f3dcde80d094ccfdb Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
2021-01-06Fix Power Restore Policy to match D-BusGunnar Mills1-2/+2
The D-Bus Power Restore Policies are AlwaysOn, AlwaysOff, and Restore. https://github.com/openbmc/phosphor-dbus-interfaces/blob/32304979b404c24e32f195d08c667e65b9b34695/xyz/openbmc_project/Control/Power/RestorePolicy.interface.yaml#L23 The Redfish states are AlwaysOn, AlwaysOff, and LastState. Tested: Validator passes. curl -v -k -X PATCH -d '{"PowerRestorePolicy":"LastState"}' \ https://${bmc}/redfish/v1/Systems/system ... < HTTP/1.1 204 No Content curl -k https://${bmc}/redfish/v1/Systems/system { "@odata.id": "/redfish/v1/Systems/system", "@odata.type": "#ComputerSystem.v1_13_0.ComputerSystem", ... "Name": "system", "PowerRestorePolicy": "LastState", "PowerState": "Off", "ProcessorSummary": { "Count": 0, Change-Id: I4d91bd4480f626467e3bb9804fa0392bbafcc891 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-12-15IndicatorLED: Add a deprecated warning headerGunnar Mills1-0/+3
Added a warning header when IndicatorLED is patched telling the client it is deprecated and pointing to LocationIndicatorActive. Used the warning syntax from https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Warning Tested: curl -X PATCH -v -d '{ "IndicatorLED":"Off"}' \ -k https://$bmc/redfish/v1/Systems/system ... < HTTP/1.1 204 No Content < Warning: 299 - "IndicatorLED is deprecated. Use LocationIndicatorActive instead." < Strict-Transport-Security: max-age=31536000; includeSubdomains; preload < X-Frame-Options: DENY Change-Id: Ic25a02508b0a1bcada1fa71ffa413c493fad00c4 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-11-30boot-progress: support LastState propertyAndrew Geissler1-0/+102
This commit provides initial support for the LastState property within the Redfish BootProgress object. The design details of OpenBMC's implementation of this can be found here: https://github.com/openbmc/docs/blob/master/designs/boot-progress.md Tested: - Set each possible value for the D-Bus BootProgress property and verified the Redfish API returned the expected value. This includes setting it to MotherboardInit and verifying "None" was returned because this does not have a mapping to the new Redfish enumeration. - Verified Redfish Validator passed Signed-off-by: Andrew Geissler <geissonator@yahoo.com> Change-Id: I8bc6e7012f4afc3152a0af2c5ebf8a55b1112773
2020-11-20systems: fix Members@odata.count is incorrect even Members have contentsTim Lee1-1/+1
Issue symptom: Run automation test "Verify_Systems_Defaults" then we got ERROR as below. Verify Systems Defaults :: Verify systems defaults. | FAIL | **ERROR** Invalid variable value: systems['Members@odata.count']: 0 <int> Root cause: In Systems, doGet() didn't calculate count after ifaceArray.push_back({{"@odata.id", "/redfish/v1/Systems/system"}}) Solution: Increase count by ifaceArray.size() after ifaceArray.push_back() in Systems Tested: 1. Verified robot -t Verify_Systems_Defaults redfish/service_root/test_sessions_management.robot Verify Systems Defaults :: Verify systems defaults. | PASS | 2. Verified system detail from Redfish. Get https://<BMC-IP>/redfish/v1/Systems Response: { "@odata.id": "/redfish/v1/Systems", "@odata.type": "#ComputerSystemCollection.ComputerSystemCollection", "Members": [ { "@odata.id": "/redfish/v1/Systems/system" } ], "Members@odata.count": 1, "Name": "Computer System Collection" } Signed-off-by: Tim Lee <timlee660101@gmail.com> Change-Id: I9cdb5dac9e16851112085048bc674808511a4845
2020-11-10Add new Location Indicator propertyGunnar Mills1-5/+15
In ComputerSystem 1.13 and Chassis 1.14 as well as in many other schemas IndicatorLED is replaced with LocationIndicatorActive. LocationIndicatorActive is a bool while IndicatorLED had 3 states: Lit, Blink, and off. Map Lit and Blink both to LocationIndicatorActive true. led.hpp was calling both enclosure_identify_blink and enclosure_identify, continue this. Keep the deprecated IndicatorLED and implement the new LocationIndicatorActive property. Have both properties for the time being. This new property makes the same calls. This does add a new Redfish warning for the deprecated IndicatorLED. Other warning are there today. Tested: Validator passes Could use help testing on Chassis. Our systems don't have a IndicatorLED on chassis. See chassis bumped. curl -k https://$bmc/redfish/v1/Systems/system { "@odata.id": "/redfish/v1/Systems/system", "@odata.type": "#ComputerSystem.v1_13_0.ComputerSystem", ... "IndicatorLED": "Off", "LastResetTime": "2020-10-29T09:01:03+00:00", "Links": { "Chassis": [ { "@odata.id": "/redfish/v1/Chassis/chassis" } ], "ManagedBy": [ { "@odata.id": "/redfish/v1/Managers/bmc" } ] }, "LocationIndicatorActive": false, curl -X PATCH -d '{ "LocationIndicatorActive":true}' -k \ https://$bmc/redfish/v1/Systems/system curl -X PATCH -d '{ "IndicatorLED":"Off"}' -k \ https://$bmc/redfish/v1/Systems/system Change-Id: I105bed5794912c575aa9a00e0442461bfdee6180 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-11-10AssetTag: Add PATCH supportGunnar Mills1-1/+85
Use the same AssetTag logic from the GET. Look for xyz.openbmc_project.Inventory.Item.System interface then call that service and path to set the AssetTag. This assumes there is 1 "Item.System". Considered something like "if (!boost::ends_with(path, "system")) continue; " but no where else does bmcweb check that the Item.System is named "system" i.e. that /redfish/v1/Systems/system is actually named "system" on D-Bus. Considered looking that the service had the interface if not move to the next service but the GET code does not so just followed it. Tested: curl -k-X PATCH -d '{"AssetTag": "Paramo"}' https://${bmc}/redfish/v1/Systems/system/ curl -k https://${bmc}/redfish/v1/Systems/system/ { "@odata.id": "/redfish/v1/Systems/system", "@odata.type": "#ComputerSystem.v1_12_0.ComputerSystem", "Actions": { "#ComputerSystem.Reset": { "@Redfish.ActionInfo": "/redfish/v1/Systems/system/ResetActionInfo", "target": "/redfish/v1/Systems/system/Actions/ComputerSystem.Reset" } }, "AssetTag": "Paramo", ... Validator passes. Change-Id: I45f80a8a69457f76e6e83ad2333856abe61de933 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-11-09Redfish: getComputerSystem: Fix DoxygenGunnar Mills1-1/+1
Change-Id: I88aefe92ba2dab2c76c9e0ae14375591733f5e5a Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-10-29SubModel property under ComputerSystem Schema.SunnySrivastava19841-1/+2
This commit implement changes to publish SubModel property under ComputerSystem schema for BMCWeb. Redfish validator has been executed on this change and no new error was found. Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com> Change-Id: Ibfb9d30c6be3b0aa8a327d6a5f906ce46a33d9f4
2020-10-23Turn on ALL perf checksEd Tanous1-21/+18
1st, alphabetize the tidy-list for good housekeeping. Next, enable all the clang-tidy performance checks, and resolve all the issues. most of the issues boil down to: 1. Using std::move on const variables. This does nothing. 2. Passing big variables (like std::string) by value. 3. Using double quotes on a find call, which constructs an intermediate string, rather than using the character overload. Tested Loaded on system, logged in successfully and pulled down webui-vue. No new errors. Walked the Redfish tree a bit, and observed no new problems. Ran redfish service validator. Got no new failures (although there are a lot of log service deprecation warnings that we should look at). Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: I2238958c4b22c1e554e09a0a1787c744bdbca43e
2020-10-15Lots of performance improvementsEd Tanous1-19/+20
(In the voice of the kid from sixth sense) I see string copies... Apparently there are a lot of places we make unnecessary copies. This fixes all of them. Not sure how to split this up into smaller patches, or if it even needs split up. It seems pretty easy to review to me, because basically every diff is identical. Change-Id: I22b4ae4f96f7e4082d2bc701098a04f7bed95369 Signed-off-by: Ed Tanous <ed@tanous.net> Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
2020-10-09Write the clang-tidy file OpenBMC needsEd Tanous1-27/+21
Now that CI can handle clang-tidy, and a lot of the individual fixes have landed for the various static analysis checks, lets see how close we are. This includes bringing a bunch of the code up to par with the checks that require. Most of them fall into the category of extraneous else statements, const correctness problems, or extra copies. Tested: CI only. Unit tests pass. Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: I9fbd346560a75fdd3901fa40c57932486275e912
2020-10-05Implement bugprone-branch-clone complianceEd Tanous1-6/+1
As part of getting the clang-tidy bugprone tests running, these conditionals were found to have duplicate entries, or be somewhat nonsensical. Tested: clang-tidy now passes with the branch-compliance check set. Change-Id: Ibec106f3bbd866fc471a1fc56bd8cdd5d44024e0
2020-09-29Fix naming conventionsEd Tanous1-5/+5
Lots of code has been checked in that doesn't match the naming conventions. Lets fix that. Tested: Code compiles. Variable/function renames only. Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: I6bd107811d0b724f1fad990016113cdf035b604b
2020-09-25OemComputerSystems: add missing odata.typesJames Feist1-0/+4
odata.type wasn't added causing the validator to fail. Tested: Validator errors went away Change-Id: I26e2f4ba13051d6d3e18ddc94eac13bca1bad71c Signed-off-by: James Feist <james.feist@linux.intel.com>
2020-09-10fix processor summaryZhikui Ren1-5/+4
update processor summary to use cpu property correctly. Tested: 1. Verified redfish validator passed 2. Get cpu details from Redfish GET: https://<BMC-IP>/redfish/v1/Systems/system/Processors { "@odata.id": "/redfish/v1/Systems/system/Processors/", "@odata.type": "#ProcessorCollection.ProcessorCollection", "Members": [ { "@odata.id": "/redfish/v1/Systems/system/Processors/cpu0" } ], "Members@odata.count": 1, "Name": "Processor Collection" } Signed-off-by: Zhikui Ren <zhikui.ren@intel.com> Change-Id: I1f36118cdc80aabf05f2d678afc6ffc329d07872
2020-09-09update cpu information to cpu interfaceZhikui Ren1-27/+46
update cpu summary and cpu information to cpu interface. https://github.com/openbmc/phosphor-dbus-interfaces/commit/259f49e0c40b287d9ea79f77db1654da47161340 Tested: 1. Verified redfish validator passed *** /redfish/v1/Systems/system/Processors/cpu0 INFO - Type (#Processor.v1_9_0.Processor), GET SUCCESS (time: 1.091324) INFO - PASS INFO - *** /redfish/v1/Systems/system/Processors/cpu1 INFO - Type (#Processor.v1_9_0.Processor), GET SUCCESS (time: 0.993352) INFO - PASS INFO - 2. Get cpu details from Redfish GET: https://<BMC-IP>/redfish/v1/Systems/system/Processors/cpu0 Response: { "@odata.id": "/redfish/v1/Systems/system/Processors/cpu0", "@odata.type": "#Processor.v1_7_0.Processor", "Id": "cpu0", "InstructionSet": "x86-64", "Manufacturer": "Intel(R) Corporation", "MaxSpeedMHz": 4000, "Model": "QUZS", "Name": "Processor", "ProcessorArchitecture": "x86", "ProcessorId": { "EffectiveFamily": "Intel Xeon processor", "IdentificationRegisters": "13829424153406867109" }, "ProcessorType": "CPU", "SerialNumber": "6122cca2e8a2d5c", "Socket": "CPU0", "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" }, "TotalCores": 32, "TotalThreads": 64, "Type": "Central Processor", "Version": "Genuine Intel(R) CPU $0000%@" } GET: https://<BMC-IP>/redfish/v1/Systems/system/Processors/cpu1 { "@odata.id": "/redfish/v1/Systems/system/Processors/cpu1", "@odata.type": "#Processor.v1_9_0.Processor", "Id": "cpu1", "Manufacturer": "CPU1", "Name": "Processor", "ProcessorType": "CPU", "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Absent" }, "Version": "CPU1" } Signed-off-by: Zhikui Ren <zhikui.ren@intel.com> Change-Id: I06424c9adb1922ae70e0936c7cb33efcf522c100
2020-09-02Add "Links""SoftwareImages"Gunnar Mills1-1/+1
SoftwareImages was added in Manager in 1_6_0 and Bios in 1_1_0. Use the existing getActiveFwVersion function but rename to populateFirmwareInformation. Changed the mapper call from a GetObject to a GetSubTree. Added some debug to the function. Tested: Validator passes. curl -k https://$bmc/redfish/v1/Managers/bmc .... "Links": { "ActiveSoftwareImage": { "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/e4e1c69d" }, "ManagerForChassis": [ .... "@odata.id": "/redfish/v1/Chassis/chassis" }, "SoftwareImages": [ { "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/730944ed" }, { "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/e4e1c69d" } ], "SoftwareImages@odata.count": 2 }, ... Change-Id: I20798852a2f62575854820bff36175dda38c7dbc Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-08-17Enable unused variable warnings and resolveEd Tanous1-42/+39
This commit enables the "unused variables" warning in clang. Throughout this, it did point out several issues that would've been functional bugs, so I think it was worthwhile. It also cleaned up several unused variable from old constructs that no longer exist. Tested: Built with clang. Code no longer emits warnings. Downloaded bmcweb to system and pulled up the webui, observed webui loads and logs in properly. Change-Id: I51505f4222cc147d6f2b87b14d7e2ac4a74cafa8 Signed-off-by: Ed Tanous <ed@tanous.net>
2020-08-17Enable clang warningsEd Tanous1-27/+28
This commit enables clang warnings, and fixes all warnings that were found. Most of these fall into a couple categories: Variable shadow issues were fixed by renaming variables unused parameter warnings were resolved by either checking error codes that had been ignored, or removing the name of the variable from the scope. Other various warnings were fixed in the best way I was able to come up with. Note, the redfish Node class is especially insidious, as it causes all imlementers to have variables for parameters, regardless of whether or not they are used. Deprecating the Node class is on my list of things to do, as it adds extra overhead, and in general isn't a useful abstraction. For now, I have simply fixed all the handlers. Tested: Added the current meta-clang meta layer into bblayers.conf, and added TOOLCHAIN_pn-bmcweb = "clang" to my local.conf Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: Ia75b94010359170159c703e535d1c1af182fe700
2020-08-17Remove middlewaresEd Tanous1-4/+4
Middlewares, while kinda cool from an academic standpoint, make our build times even worse than they already are. Given that we only really use 1 real middleware today (token auth) and it needs to move into the parser mode anyway (for security limiting buffer sizes), we might as well use this as an opportunity to delete some code. Some other things that happen: 1. Persistent data now moves out of the crow namespace 2. App is no longer a template 3. All request_routes implementations no longer become templates. This should be a decent (unmeasured) win on compile times. This commit was part of a commit previously called "various cleanups". This separates ONLY the middleware deletion part of that. Note, this also deletes about 400 lines of hard to understand code. Change-Id: I4c19e25491a153a2aa2e4ef46fc797bcb5b3581a Signed-off-by: Ed Tanous <ed@tanous.net>
2020-07-24Firmware: Add ActiveSoftwareImage for the running imageGunnar Mills1-1/+1
ActiveSoftwareImage was added to Bios in v1_1_0 and Manager in v1_6_0. What Redfish calls active is the functional or running image in OpenBMC. Reused getActiveFwVersion which means less D-Bus calls when calling from Manager. From https://redfish.dmtf.org/schemas/v1/Manager.v1_9_0.json "ActiveSoftwareImage": { ... "description": "The link to the software inventory resource that represents the active firmware image for this manager.", "longDescription": "This property shall contain a link to a resource of type SoftwareInventory that represents the active firmware image for this manager.", "readonly": false, "versionAdded": "v1_6_0" PATCH support will come later. Tested: Validator passes Manager: ... "FirmwareVersion": "2.9.0-dev-515-g92efac612-dirty", ... "Links": { "ActiveSoftwareImage": { "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/82d3ec86" }, "ManagerForChassis": [ { "@odata.id": "/redfish/v1/Chassis/chassis" } ], ... System: "BiosVersion": "IBM-witherspoon-OP9-v2.3-rc2-3.28", Bios: "ActiveSoftwareImage": { "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/9f75c5ad" } }, Change-Id: Ia3583b4cb513bf36942a9dcbc4588615275bb2ad Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-07-21Add ResetActionInfo for ResetTypeAppaRao Puli1-3/+47
OCP mandate the ResetActionInfo for convey the parameter requirements and allowable values on parameters for actions. So add ResetActionInfo uri for below URI's. /redfish/v1/Systems/system/ResetActionInfo /redfish/v1/Managers/bmc/ResetActionInfo /redfish/v1/Chassis/<id>/ResetActionInfo Tested: - All action uri's show correct @Redfish.ActionInfo "Actions": { "#ComputerSystem.Reset": { "@Redfish.ActionInfo": "/redfish/v1/Systems/system/ResetActionInfo", "target": "/redfish/v1/Systems/system/Actions/ComputerSystem.Reset" } } - All /ResetActionInfo uri's show correct allowable values. { "@odata.id": "/redfish/v1/Systems/system/ResetActionInfo", "@odata.type": "#ActionInfo.v1_1_2.ActionInfo", "Id": "ResetActionInfo", "Name": "Reset Action Info", "Parameters": { "AllowableValues": [ "On", "ForceOff", "ForceOn", "ForceRestart", "GracefulRestart", "GracefulShutdown", "PowerCycle", "Nmi" ], "DataType": "String", "Name": "ResetType", "Required": true } } - Ran redfish validator and its successful. Change-Id: I656163dde300d97fe1923f1d58fa6d104c702d27 Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
2020-07-10Codespell redfish-core spelling fixesGunnar Mills1-2/+2
These spelling errors were found using https://github.com/codespell-project/codespell Tested: Top commit (along with this) was built and ran against validator. Change-Id: Ic9dce27b1de8567eedf7753164ef564d3aedf8ca Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-07-10Spelling: 's/Traslates/Translates/g'Gunnar Mills1-3/+3
Tested: Top commit (along with this) was built and ran against validator. Signed-off-by: Gunnar Mills <gmills@us.ibm.com> Change-Id: I1ae238769e7907b44cce8eae0ab5fe4d6faf88f6
2020-07-08Fix: ignore D-Bus error if not mandatory propertyAppaRao Puli1-3/+4
Some platforms doesn't have PFR support. In such case D-Bus service or object may not exist. So corrected code to set the default value of PFR provisioning status(NotProvisioned) and don't return error as this is not mandatory property. Tested: - Get on /redfish/v1/Systems/system is success in all platforms. Change-Id: I622bab7fd64fa71f91d39a62c5830e65fa821fb5 Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
2020-07-08Update the DBus path for hypervisor ethernet interfaceSunitha Harish1-1/+2
Tested by: GET commands for resource Systems-hypervisor Signed-off-by: Sunitha Harish <sunithaharish04@gmail.com> Change-Id: I7f6185d78b4867246b70e6e4a232afb287d1d962
2020-07-02System: LastResetTimeGunnar Mills1-1/+50
System LastResetTime was added in Redfish release 2020.2. It maps to LastStateChangeTime on D-Bus. "Reset" is an overloaded term in Redfish, "Reset" includes power on and power off. Even though this is the "system" Redfish object look at the chassis D-Bus interface for LastStateChangeTime since this has the property and gives the needed information. LastStateChangeTime on D-Bus is in epoch time, in milliseconds. Redfish uses the ISO 8601 standard for dates. Will be used on the OpenBMC GUI. Tested: Validator passes. curl -k https://$bmc/redfish/v1/Systems/system ... "LastResetTime": "2020-06-30T14:36:17+00:00", Took the epoch time at LastStateChangeTime and verified when converted it was the same. GMT: Tuesday, June 30, 2020 2:36:17.532 PM Change-Id: Iac12ea15915bb0fd1f0e4ca0b4a4281283c2a5b7 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-06-25Remove done TODOGunnar Mills1-1/+0
ForceRestart support was added here: https://github.com/openbmc/bmcweb/commit/d22c8396f0bcec4488d0c98eae3092384b3a5929 Change-Id: I631d465861fb423b1915f5fcc384b8117adf6bd5 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-06-11clang-format: update to latest from docs repoGunnar Mills1-118/+120
This is from openbmc/docs/style/cpp/.clang-format Other OpenBMC repos are doing the same. Tested: Built and validator passed. Change-Id: Ief26c755c9ce012823e16a506342b0547a53517a Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-05-21Redfish: Set AutomaticRetry (AutoReboot)Gunnar Mills1-8/+73
"AutomaticRetryConfig" can be 3 values, Disabled, RetryAlways, and RetryAttempts. OpenBMC only supports Disabled and RetryAttempts. Use AllowableValues to show this. "AutomaticRetryAttempts" is hardcoded in OpenBMC. "RemainingAutomaticRetryAttempts" is readonly in Redfish. Tested: Validator passes. PATCHing "Boot" "BootSourceOverrideEnabled" and "BootSourceOverrideTarget" still work. curl -k https://$bmc/redfish/v1/Systems/system ... "Boot": { "AutomaticRetryAttempts": 3, "AutomaticRetryConfig": "RetryAttempts", "AutomaticRetryConfig@Redfish.AllowableValues": [ "Disabled", "RetryAttempts" ], Can see the following two set correctly on Redfish and D-Bus: curl -k -v -X PATCH https://${bmc}/redfish/v1/Systems/system -d \ '{"Boot":{"AutomaticRetryConfig": "Disabled"}}' ... < HTTP/1.1 204 No Content curl -k -v -X PATCH https://${bmc}/redfish/v1/Systems/system -d \ '{"Boot":{"AutomaticRetryConfig": "RetryAttempts"}}' ... < HTTP/1.1 204 No Content Handles bad data: curl -k -v -X PATCH https://${bmc}/redfish/v1/Systems/system -d \ '{"Boot":{"AutomaticRetryConfig": "BadValue"}}' ... < HTTP/1.1 400 Bad Request ... "AutomaticRetryConfig@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_0_0.Message", "Message": "The value BadValue for the property AutomaticRetryConfig is not in the list of acceptable values.", "MessageArgs": [ "BadValue", "AutomaticRetryConfig" ], "MessageId": "Base.1.4.0.PropertyValueNotInList", Change-Id: I603ccce1a682ac40f2e496cba9172e2a6dfdb58d Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-05-20Redfish: AutomaticRetry (AutoReboot)Gunnar Mills1-1/+86
A new feature of 2020.1. Three properties to represent this: AutomaticRetryConfig (Enum with three values): Disabled RetryAttempts: "Automatic retrying of booting is based on a specified retry count." RetryAlways AutomaticRetryAttempts: "The number of attempts the system will automatically retry booting." RemainingAutomaticRetryAttempts: "The number of remaining automatic retry boots." Only the "GET". A later commit will allow PATCHing of AutomaticRetryConfig. AutomaticRetryAttempts is not on D-Bus and is instead hardcoded to 3. Tested: Validator passed. "Boot": { "AutomaticRetryAttempts": 3, "AutomaticRetryConfig": "RetryAttempts", ... "RemainingAutomaticRetryAttempts": 3 }, Change-Id: I7a098270411eef2112c47d129aae39cd2b419825 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-05-14sdbusplus: replace message::variant with std::variantPatrick Williams1-5/+4
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ia5d0845741f1d8d4bc6fd227c6d2e6f3a8d42b2e