Add telemetry messages to registry
One of Telemetry service's triggers' action is logging events to Redfish
log [1][2]. This change appends messages from DMTF schema [3] to
registry collection, so that they become available for Telemetry
service.
Tested:
- Telemetry subset present under /redfish/v1/Registries
- Telemetry registry details present under
/redfish/v1/Registries/Telemetry
- Telemetry messages present under
/redfish/v1/Registries/Telemetry/Telemetry
- Telemetry messages appear in event log
(/redfish/v1/Systems/<str>/LogServices/EventLog/Entries) after being
sent using phosphor-logging
[1] https://github.com/openbmc/docs/blob/master/designs/telemetry.md?plain=1#L423-L426
[2] https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/yaml/xyz/openbmc_project/Telemetry/Trigger.interface.yaml#L61-L62
[3] https://redfish.dmtf.org/registries/Telemetry.1.0.0.json
Change-Id: Ic0b82c695fc7755394becd120c301b6056e3ce19
Signed-off-by: Michal Orzel <michalx.orzel@intel.com>
diff --git a/redfish-core/lib/message_registries.hpp b/redfish-core/lib/message_registries.hpp
index 92721eb..94588ac 100644
--- a/redfish-core/lib/message_registries.hpp
+++ b/redfish-core/lib/message_registries.hpp
@@ -23,6 +23,7 @@
#include "registries/privilege_registry.hpp"
#include "registries/resource_event_message_registry.hpp"
#include "registries/task_event_message_registry.hpp"
+#include "registries/telemetry_message_registry.hpp"
#include <boost/url/format.hpp>
@@ -48,11 +49,11 @@
asyncResp->res.jsonValue["Name"] = "MessageRegistryFile Collection";
asyncResp->res.jsonValue["Description"] =
"Collection of MessageRegistryFiles";
- asyncResp->res.jsonValue["Members@odata.count"] = 4;
+ asyncResp->res.jsonValue["Members@odata.count"] = 5;
nlohmann::json& members = asyncResp->res.jsonValue["Members"];
- for (const char* memberName :
- std::to_array({"Base", "TaskEvent", "ResourceEvent", "OpenBMC"}))
+ for (const char* memberName : std::to_array(
+ {"Base", "TaskEvent", "ResourceEvent", "OpenBMC", "Telemetry"}))
{
nlohmann::json::object_t member;
member["@odata.id"] = boost::urls::format("/redfish/v1/Registries/{}",
@@ -105,6 +106,11 @@
header = ®istries::resource_event::header;
url = registries::resource_event::url;
}
+ else if (registry == "Telemetry")
+ {
+ header = ®istries::telemetry::header;
+ url = registries::telemetry::url;
+ }
else
{
messages::resourceNotFound(asyncResp->res, "MessageRegistryFile",
@@ -194,6 +200,15 @@
registryEntries.emplace_back(&entry);
}
}
+ else if (registry == "Telemetry")
+ {
+ header = ®istries::telemetry::header;
+ for (const registries::MessageEntry& entry :
+ registries::telemetry::registry)
+ {
+ registryEntries.emplace_back(&entry);
+ }
+ }
else
{
messages::resourceNotFound(asyncResp->res, "MessageRegistryFile",