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
diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp
index ea09231..65a3e9c 100644
--- a/redfish-core/lib/processor.hpp
+++ b/redfish-core/lib/processor.hpp
@@ -149,7 +149,7 @@
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 @@
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 @@
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 @@
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 @@
aResp->res.jsonValue["PartNumber"] = *partNumber;
}
- if (sparePartNumber != nullptr)
+ if (sparePartNumber != nullptr && !sparePartNumber->empty())
{
aResp->res.jsonValue["SparePartNumber"] = *sparePartNumber;
}