summaryrefslogtreecommitdiff
path: root/redfish-core/lib/systems.hpp
diff options
context:
space:
mode:
authorZhikui Ren <zhikui.ren@intel.com>2020-08-26 01:21:41 +0300
committerZhikui Ren <zhikui.ren@intel.com>2020-09-09 00:30:03 +0300
commit029cc1f4106968f7e871d17a8bcb71a303a12ffa (patch)
tree502d27c47b8a209aa8d651d6e0b2728017167445 /redfish-core/lib/systems.hpp
parent3d2b2c0bdcb184fcbb10665980e2bb61ab6be1f7 (diff)
downloadbmcweb-029cc1f4106968f7e871d17a8bcb71a303a12ffa.tar.xz
update cpu information to cpu interface
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
Diffstat (limited to 'redfish-core/lib/systems.hpp')
-rw-r--r--redfish-core/lib/systems.hpp73
1 files changed, 46 insertions, 27 deletions
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 5d96649141..da92be3fca 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -326,40 +326,59 @@ inline void getComputerSystem(std::shared_ptr<AsyncResp> aResp,
if (properties.size() > 0)
{
+ const uint32_t* processorId = nullptr;
+ const std::string* procFamily = nullptr;
+ nlohmann::json& procSummary =
+ aResp->res.jsonValue["ProcessorSumm"
+ "ary"];
+ nlohmann::json& procCount =
+ procSummary["Count"];
+
+ auto procCountPtr = procCount.get_ptr<
+ nlohmann::json::
+ number_integer_t*>();
+ if (procCountPtr == nullptr)
+ {
+ messages::internalError(aResp->res);
+ return;
+ }
for (const auto& property : properties)
{
+
+ if (property.first == "ProcessorId")
+ {
+ processorId =
+ std::get_if<uint32_t>(
+ &property.second);
+ if (nullptr != procFamily)
+ break;
+ continue;
+ }
+
if (property.first ==
"ProcessorFamily")
{
- const std::string* value =
+ procFamily =
std::get_if<std::string>(
&property.second);
- if (value != nullptr)
- {
- nlohmann::json&
- procSummary =
- aResp->res.jsonValue
- ["ProcessorSumm"
- "ary"];
- nlohmann::json& procCount =
- procSummary["Count"];
-
- auto procCountPtr =
- procCount.get_ptr<
- nlohmann::json::
- number_integer_t*>();
- if (procCountPtr != nullptr)
- {
- // shouldn't be possible
- // to be nullptr
- *procCountPtr += 1;
- }
- procSummary["Status"]
- ["State"] =
- "Enabled";
- procSummary["Model"] =
- *value;
- }
+ if (nullptr != processorId)
+ break;
+ continue;
+ }
+ }
+
+ if (procFamily != nullptr &&
+ processorId != nullptr)
+ {
+ if (procCountPtr != nullptr &&
+ *processorId != 0)
+ {
+ *procCountPtr += 1;
+ procSummary["Status"]["State"] =
+ "Enabled";
+
+ procSummary["Model"] =
+ *procFamily;
}
}
}