summaryrefslogtreecommitdiff
path: root/redfish-core/lib/systems.hpp
AgeCommit message (Collapse)AuthorFilesLines
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
2020-05-14sdbusplus: remove deprecated variant_nsPatrick Williams1-10/+6
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I86e11299512704fa1df1e5f6517ea25cc6eced8f
2020-05-05Add support for Quiesced stateGunnar Mills1-0/+6
OpenBMC has a Quiesced state, Redfish does as well. Set Redfish "Status""Sate" to Quiesced and "PowerState" to On, if the D-Bus HoseState is Quiesced. Tested: Validator passed on a Witherspoon system in this Quiesced state. "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Quiesced" }, Change-Id: I53299d51aa0ee065bb5794bab32f69b2a0f8acb2 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-04-24Map policy restore D-Bus interface to RedfishGeorge Liu1-1/+112
Tested: curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Systems/system { "@odata.id": "/redfish/v1/Systems/system", "@odata.type": "#ComputerSystem.v1_6_0.ComputerSystem", ... ... "PowerRestorePolicy": "AlwaysOff", ... ... } curl -k -H "X-Auth-Token: $token" -X PATCH -d '{"PowerRestorePolicy":"AlwaysOn"}' 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_6_0.ComputerSystem", ... ... "PowerRestorePolicy": "AlwaysOn", ... ... } curl -k -H "X-Auth-Token: $token" -X PATCH -d '{"PowerRestorePolicy":"TestPolicy"}' https://${bmc}/redfish/v1/Systems/system { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_0_0.Message", "Message": "The request failed due to an internal service error. The service is still operational.", "MessageArgs": [], "MessageId": "Base.1.4.0.InternalError", "Resolution": "Resubmit the request. If the problem persists, consider resetting the service.", "Severity": "Critical" } ], "code": "Base.1.4.0.InternalError", "message": "The request failed due to an internal service error. The service is still operational." } } Passed the validator: VERBO - ServiceRoot -> Systems.Systems -> Members.ComputerSystem#0, ComputerSystem.v1_10_0, ComputerSystem VERBO - @odata.id PASS VERBO - @odata.type PASS VERBO - Actions complex VERBO - Bios PASS VERBO - Boot complex VERBO - Description PASS VERBO - Id PASS VERBO - Links complex VERBO - LogServices PASS VERBO - Memory PASS VERBO - MemorySummary complex VERBO - Name PASS VERBO - PowerRestorePolicy PASS ... ... Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I75155c5cb930d6c4d9d5aad39f3315506db28e38
2020-04-21Adding Hypervisor system and Hypervisor InterfaceSunitha Harish1-4/+27
This commit implements the GET commands for Power hypervisor Virtual Management Interface's interface collection. Tested by: 1. GET https://${bmc}/redfish/v1/Systems 2. GET https://${bmc}/redfish/v1/Systems/hypervisor 3. GET https://${bmc}/redfish/v1/Systems/hypervisor/EthernetInterfaces 4. Successfully ran the Redfish Validator *** /redfish/v1/Systems Type (#ComputerSystemCollection.ComputerSystemCollection), GET SUCCESS (time: 0.335171) PASS *** /redfish/v1/Systems/hypervisor Type (#ComputerSystem.v1_6_0.ComputerSystem), GET SUCCESS (time: 0.341849) PASS *** /redfish/v1/Systems/hypervisor/EthernetInterfaces Type (#EthernetInterfaceCollection.EthernetInterfaceCollection), GET SUCCESS (time: 0.362111) PASS 5. Verified the hypervisor in not listed on BMC which does not implement the Hypervisor object Signed-off-by: Sunitha Harish <sunithaharish04@gmail.com> Change-Id: Ie1eb166808473137dd65df54fb4d748cfd1131d2
2020-04-16System: Remove 2nd setting of "Id"Gunnar Mills1-2/+1
Id was already set to "system". This changes the Id from the Serial number to "system". Id now matches the last segment of the URL/@odata.id. Could not find a hard rule to require the Id to match the last segment of the URL/@data.id but all Redfish mockups match this way, other bmcweb resources do as well, and redfishtool is easier to use if this is true. Tested: Validator passes. curl -k https://${bmc}/redfish/v1/Systems/system/ ... "Description": "Computer System", "Id": "system", "IndicatorLED": "Off", "Links": { "Chassis": [ { "@odata.id": "/redfish/v1/Chassis/chassis" } ], Change-Id: Ib2cc34f033accfe6ed6236d512801674153944fc Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-04-16System: Remove 2nd setting of "Name"Gunnar Mills1-2/+1
Computer System Name was already set on line 1571. Tested: The top commit was built with this commit and validator passed. Change-Id: I4669cb284880a597c068c6edcbd1cedb0b77ace9 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-02-20System: Remove odata.contextGunnar Mills1-5/+0
Redfish made odata.context optional (1.6.0 of DSP0266, Sept 2018). Redfish has removed odata.context from example payloads in the specification (1.7.0 of DSP0266), removed it from the mockups, and Redfish recommended not using. The reason for making optional and removing from mockups/examples, "no one could figure out how to use it and it did not add value". Don't see value in it for our implementation. Change-Id: Iee73d72d56237e8787e839ed06b979779c97d2f3 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-02-20diag-mode: return InTest if host is in diag modeAndrew Geissler1-0/+6
Per discussion with DMTF and clarification of InTest state within http://redfish.dmtf.org/schemas/v1/Resource.json#/definitions/Status it was determined that this would represent the situation where the host is collecting diagnostic data. This maps to the new DiagnosticMode state added to the xyz.openbmc_project.State.Host.HostState namespace. Tested: Verified that Redfish API returned expected result when in DiagnosticMode: "Status": { "Health": "OK", "HealthRollup": "OK", "State": "InTest" }, Change-Id: I1c5deb5fdc251a5dcd4d1d01f4eedb6c507ded0a Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
2020-02-13Update to the new ResetType mappingJason M. Bills1-5/+7
This updates Redfish ResetType with the new states added in the document below: ref: https://gerrit.openbmc-project.xyz/c/openbmc/docs/+/28706 Tested: Sent a POST with the updated ResetType values and confirmed the correct behavior: ForceRestart: host restarted using Host.ForceWarmReboot GracefulRestart: host restarted using Host.GracefulWarmReboot PowerCycle: host restarted using Host.Reboot Change-Id: I053919f2aaa709ba92685d67c1692bfc88b10d39 Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
2020-01-07Add IndicatorLed to Chassis SchemaJames Feist1-131/+1
This adds the indicator property to Chassis Schema, and moves the logic from systems.hpp to a common header to share the code. Tested: Passed the validator, was able to turn LED on Change-Id: I79458a2a4656d7ddf2939bb9f56845eb6d9a27ca Signed-off-by: James Feist <james.feist@linux.intel.com>
2019-12-10ProcSummary: Use NothrowJames Feist1-7/+21
Exceptions are compiled out, and json.get throws, change it to get_ptr. Tested: no functional change Change-Id: Ie2db7285b89b45b1fd61d8526561b772c85151b3 Signed-off-by: James Feist <james.feist@linux.intel.com>
2019-12-05Redfish: Implement ResetBios actionCarol Wang1-0/+3
This action resets the BIOS attributes to default. Tested: GET test: 1. $ curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Systems/system { ... "Bios": { "@odata.id": "/redfish/v1/Systems/system/Bios" }, ... } 2. $ curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Systems/system/Bios { "@odata.id": "/redfish/v1/Systems/system/Bios", "@odata.type": "#Bios.v1_1_0.Bios", "Actions": { "#Bios.ResetBios": { "target": "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios" } }, "Description": "BIOS Configuration Service", "Id": "BIOS", "Name": "BIOS Configuration" } POST test: 1. Change gard list: # ./gard list No GARD entries to display # ./gard create /Sys0/Node0/Proc1/EQ1/EX1/Core0 # ./gard list ID | Error | Type | Path ----------------------------------------------------------------------- 00000001 | 00000000 | Manual | /Sys0/Node0/Proc1/EQ1/EX1/Core0 ======================================================================= 2. Reset bios: # curl -k -H "X-Auth-Token: $token" -X POST https://${bmc}/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios 3. Check gard list again: # ./gard list No GARD entries to display Validator tool test: Counter({'pass': 3001, 'skipOptional': 2475, 'metadataNamespaces': 1605, 'passGet': 191, 'serviceNamespaces': 72, 'invalidPropertyValue': 10, 'passAction': 7, 'optionalAction': 6, 'warningPresent': 6, 'warnDeprecated': 2, 'unverifiedComplexAdditional': 1}) Validation has succeeded. Signed-off-by: Carol Wang <wangkair@cn.ibm.com> Change-Id: I0cba966bfde04566001b6df07ad15217f627c327