From 6169de2c39d2b08451a64fbf45798ae8cb5624fb Mon Sep 17 00:00:00 2001 From: Brad Bishop Date: Wed, 14 Sep 2022 13:08:32 -0400 Subject: processor: Don't display DBus defaults EffectiveFamily, EffectiveModel, MicrocodeInfo, Id, and SparePartNumber all have default values specified in the OpenBMC DBus data model. Do not populate these attributes as outlined in DBUS_USAGE.md. Tested: Compiled. bmcweb does not crash at startup. Signed-off-by: Brad Bishop Change-Id: I8bfb7a8fef28d2ab6a7d77fb809c0b3e51e368f8 --- redfish-core/lib/processor.hpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp index ea09231fa3..65a3e9cea8 100644 --- a/redfish-core/lib/processor.hpp +++ b/redfish-core/lib/processor.hpp @@ -149,7 +149,7 @@ inline void getCpuDataByInterface( else if (property.first == "EffectiveFamily") { const uint16_t* value = std::get_if(&property.second); - if (value != nullptr) + if (value != nullptr && *value != 2) { aResp->res.jsonValue["ProcessorId"]["EffectiveFamily"] = "0x" + intToHexString(*value, 4); @@ -163,8 +163,11 @@ inline void getCpuDataByInterface( messages::internalError(aResp->res); return; } - aResp->res.jsonValue["ProcessorId"]["EffectiveModel"] = - "0x" + intToHexString(*value, 4); + if (*value != 0) + { + aResp->res.jsonValue["ProcessorId"]["EffectiveModel"] = + "0x" + intToHexString(*value, 4); + } } else if (property.first == "Id") { @@ -184,8 +187,11 @@ inline void getCpuDataByInterface( messages::internalError(aResp->res); return; } - aResp->res.jsonValue["ProcessorId"]["MicrocodeInfo"] = - "0x" + intToHexString(*value, 8); + if (*value != 0) + { + aResp->res.jsonValue["ProcessorId"]["MicrocodeInfo"] = + "0x" + intToHexString(*value, 8); + } } else if (property.first == "Step") { @@ -195,8 +201,11 @@ inline void getCpuDataByInterface( messages::internalError(aResp->res); return; } - aResp->res.jsonValue["ProcessorId"]["Step"] = - "0x" + intToHexString(*value, 4); + if (*value != 0) + { + aResp->res.jsonValue["ProcessorId"]["Step"] = + "0x" + intToHexString(*value, 4); + } } } } @@ -344,7 +353,7 @@ inline void getCpuAssetData(std::shared_ptr aResp, aResp->res.jsonValue["PartNumber"] = *partNumber; } - if (sparePartNumber != nullptr) + if (sparePartNumber != nullptr && !sparePartNumber->empty()) { aResp->res.jsonValue["SparePartNumber"] = *sparePartNumber; } -- cgit v1.2.3