summaryrefslogtreecommitdiff
path: root/redfish-core/lib/processor.hpp
AgeCommit message (Collapse)AuthorFilesLines
2021-06-03Remove Redfish Node classJohn Edward Broadbent1-256/+187
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-05-15Handle Processor.AppliedOperatingConfig PATCHJonathan Doman1-0/+169
Allow client to PATCH the URI pointing to the active OperatingConfig for a given processor, in order to dynamically change the processor's configuration. The OperatingConfig related properties are only available if a supporting backend daemon is running - currently we have the Intel cpuinfoapp in the smbios-mdr repo. This change does basic validation on input data, then sets the D-Bus property and translates any return errors into Redfish error messages. Tested: - PATCH non-existent Processor -> ResourceNotFound - PATCH with string/int -> PropertyValueTypeError - PATCH with object w/o @odata.id -> PropertyMissing+Unknown - PATCH with config from different Processor -> PropertyValueIncorrect - PATCH with non-existent config -> PropertyValueIncorrect - PATCH with valid config -> OK, see new config on next GET - Hack cpuinfoapp backend service to return all possible error codes and verify that correct Redfish error is returned. Change-Id: I19d8b461fac25682f1883fe769d840f18f4141a8 Signed-off-by: Jonathan Doman <jonathan.doman@intel.com>
2021-04-30Redfish: Fix the health and state properties of processorChicago Duan1-34/+30
The processor resource needs to look at Present and Functional to determine state and health. This is how other resources do it. It should not look at totalCores to determine present / State. HealthPopulate is not used. We use Functional to determine health status. Functional is a bool that HealthPopulate cannot handle. Signed-off-by: Chicago Duan <duanzhijia01@inspur.com> Change-Id: Iff900061254fdd991b2dfa573b364a04decd8f98
2021-04-08Using AsyncResp everywherezhanghch051-43/+37
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-20Refactor Processor object lookupJonathan Doman1-56/+101
In order to reuse the D-Bus lookup logic for both GET and PATCH requests, separate the GetSubTree call from the processing loop. This way, we can have one common place to determine if 404 Not Found should be returned for any type of Processor request. This also improves 404 handling by filtering out those objects which don't implement Item.Cpu or Item.Accelerator. Previously it was possible to request e.g. /redfish/v1/Systems/system/Processors/dimm0 and get back some information about that DIMM. This change will ensure non-CPU items return a 404. Tested: - All links in the ProcessorCollection return the same data that they did before this change. - Invalid Processor IDs (e.g. dimm0 from above) now return 404 error message. Signed-off-by: Jonathan Doman <jonathan.doman@intel.com> Change-Id: I0f09ba1189b7a068c8c0ffe136d19e9587765d18
2021-02-17Add additional Redfish Processor propertiesSunnySrivastava19841-2/+73
This commit adds the following inventory properties for the Processor resource in bmcweb: a) LocationCode, a free form, implementation-defined string to provide the location of the processor. This is needed so an implementation can identify the processor via system diagrams. b) SparePartNumber, also field-replaceable unit (FRU) Part Number, is a part number that identifies the FRU for replacement specifically ordering of a new part. c) PartNumber, also called a Marketing Number, describes a specific part within a specific system among a manufactures various product lines. These numbers tell IT infrastructure technicians exactly which parts are included in their servers, storage and networking equipment. These properties are essential to locate and replace the FRU. Validator has been executed and no new error has been found. Sample Output: { "@odata.id": "/redfish/v1/Systems/system/Processors/cpu0", "@odata.type": "#Processor.v1_11_0.Processor", "Id": "cpu0", "Location": { "PartLocation": { "ServiceLabel": "Ufcs-P0-C15" } }, "Manufacturer": "", "Model": "AB41", "Name": "Processor", "PartNumber": "2345678", "ProcessorType": "CPU", "SerialNumber": "YLAB41010000", "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Absent" } } Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com> Change-Id: Ifc0e13fd7eb94e86eade223608a1ecad2487ed37
2020-12-04Add support for Redfish OperatingConfig resourcesJonathan Doman1-2/+448
- Update Processor GET handler to look for a matching CurrentOperatingConfig interface on D-Bus. - Add OperatingConfig node and implement GET handler to look for matching OperatingConfig interface on D-Bus. - Add OperatingConfigCollection node and implement GET handler to look for all OperatingConfig interfaces on D-Bus under the given cpu. Tested: - Ran Redfish Service Validator and verified no errors or warnings on Processor, OperatingConfig, and OperatingConfigCollection. - Browsed OperatingConfig links and resources in browser, confirmed nonexistent configs returned 404 and didn't crash bmcweb. - Killed D-Bus provider service and verified bmcweb didn't crash and still served Processor as before, and passed service validator. Change-Id: Iab94b7fd49a9462cb0eca6f8ea0754f5fb241053 Signed-off-by: Jonathan Doman <jonathan.doman@intel.com>
2020-12-04Refactor getProcessorDataJonathan Doman1-45/+50
- Move list of interfaces to search for next to the result callback, so that it's easier to catch mismatches. And add 1 missing interface to GetSubTree request. - Use vector instead of map for GetSubTree response - Use structured bindings to make the loop variables easier to understand. - Reorganize logic to save an indent. Tested: As part of child change Iab94b7fd49a9462cb0eca6f8ea0754f5fb241053 Signed-off-by: Jonathan Doman <jonathan.doman@intel.com> Change-Id: Iccf76ca0ddf944b053ebcf904f872e7960f2b508
2020-10-28Restore missing/broken Processor fieldsJonathan Doman1-1/+9
Couple of properties taken from xyz.openbmc_project.Inventory.Item.Cpu got accidentally broken by refactoring in 5fb91ba400e04828. Tested: Browsed to https://<bmc>/redfish/v1/Systems/system/Processors/cpu0 and verified that exactly the two properties were now added. Signed-off-by: Jonathan Doman <jonathan.doman@intel.com> Change-Id: I5e5c96b80e952d6eb58ea00b3f2ecb3f59a792e9
2020-10-16Processors: Remove / at end of odata.idGunnar Mills1-1/+1
Matches mockups and other places in code. Tested: curl -k https://$bmc/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" }, ... Change-Id: I828e49013e09b9f40e189fd736103595ddb19a42 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-10-16Fix up Function to Populate collection MembersGunnar Mills1-2/+2
Added Doxygen comments, renamed the funciton, renamed several variables, and made more generic. Tested: Top commit passes validator and resources look good. Change-Id: I9a13176b7f4c8611ae38c6563b0e119e0f66edf2 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-10-16cpudimm.hpp: Separate Memory and Processor functionalityGunnar Mills1-0/+527
To match other files move Redfish Memory classes and functions to a separate memory.hpp file. This naming "memory" (after the Redfish schemas) matches other filenames. Do the same with Processor classes and functions, moving to a separate processor.hpp. cpudimm.hpp had grown to 1300+ lines. Makes development and review easier. Tested: Validator passes. Resources look the same. Change-Id: I7e23ecaf9b4b69cc72aad6d94ad3a555ee76b28a Signed-off-by: Gunnar Mills <gmills@us.ibm.com>