diff options
author | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2022-09-14 20:08:32 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2022-09-16 00:21:40 +0300 |
commit | 6169de2c39d2b08451a64fbf45798ae8cb5624fb (patch) | |
tree | 7f9fac8e4ebbdb070d1d921ff69ddab0a6a25597 | |
parent | ce34d514150c0e4aa8f127dad8ede8b428c56930 (diff) | |
download | bmcweb-6169de2c39d2b08451a64fbf45798ae8cb5624fb.tar.xz |
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 <bradleyb@fuzziesquirrel.com>
Change-Id: I8bfb7a8fef28d2ab6a7d77fb809c0b3e51e368f8
-rw-r--r-- | redfish-core/lib/processor.hpp | 25 |
1 files 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<uint16_t>(&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<bmcweb::AsyncResp> aResp, aResp->res.jsonValue["PartNumber"] = *partNumber; } - if (sparePartNumber != nullptr) + if (sparePartNumber != nullptr && !sparePartNumber->empty()) { aResp->res.jsonValue["SparePartNumber"] = *sparePartNumber; } |