Make message registries use 2 digit versions
Redfish specification, section 9.5.11.2 says:
The MessageId property value shall be in the format:
<MessageRegistryPrefix>.<MajorVersion>.<MinorVersion>.<MessageKey>
bmcweb in certain places has incorrectly used the 3 digit version
instead of the 2 digit version. This commit fixes that by modifying the
parse_registries script to generate 3 separate struct entries to
represent the registry version, and parse them where appropriate.
MessageRegistryFileCollection uses the 3 digit version. No behavior
changes.
Message/event log entries use the 2 digit version. This will cause a
MessageId change from:
Base.1.19.0.InternalError
to
Base.1.19.InternalError
This is a breaking change, so a new option to allow the old behavior is
provided.
Tested: Redfish Service validator passes.
Heartbeat events on EventService show 2 digit versions.
Change-Id: I4165e994f73e200f13bed8ea76cb58bee2b69faa
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/redfish-core/lib/message_registries.hpp b/redfish-core/lib/message_registries.hpp
index a6e108e..b327d63 100644
--- a/redfish-core/lib/message_registries.hpp
+++ b/redfish-core/lib/message_registries.hpp
@@ -23,6 +23,7 @@
#include <boost/url/format.hpp>
#include <array>
+#include <format>
namespace redfish
{
@@ -106,7 +107,9 @@
asyncResp->res.jsonValue["Description"] =
dmtf + registry + " Message Registry File Location";
asyncResp->res.jsonValue["Id"] = header.registryPrefix;
- asyncResp->res.jsonValue["Registry"] = header.id;
+ asyncResp->res.jsonValue["Registry"] =
+ std::format("{}.{}.{}", header.registryPrefix, header.versionMajor,
+ header.versionMinor);
nlohmann::json::array_t languages;
languages.emplace_back(header.language);
asyncResp->res.jsonValue["Languages@odata.count"] = languages.size();
@@ -162,12 +165,16 @@
asyncResp->res.jsonValue["@Redfish.Copyright"] = header.copyright;
asyncResp->res.jsonValue["@odata.type"] = header.type;
- asyncResp->res.jsonValue["Id"] = header.id;
+ asyncResp->res.jsonValue["Id"] =
+ std::format("{}.{}.{}.{}", header.registryPrefix, header.versionMajor,
+ header.versionMinor, header.versionPatch);
asyncResp->res.jsonValue["Name"] = header.name;
asyncResp->res.jsonValue["Language"] = header.language;
asyncResp->res.jsonValue["Description"] = header.description;
asyncResp->res.jsonValue["RegistryPrefix"] = header.registryPrefix;
- asyncResp->res.jsonValue["RegistryVersion"] = header.registryVersion;
+ asyncResp->res.jsonValue["RegistryVersion"] =
+ std::format("{}.{}.{}", header.versionMajor, header.versionMinor,
+ header.versionPatch);
asyncResp->res.jsonValue["OwningEntity"] = header.owningEntity;
nlohmann::json& messageObj = asyncResp->res.jsonValue["Messages"];