Update Trigger Actions implementation
Dbus trigger action names were modified to reflect separation of
Telemetry Service from Redfish:
- LogToLogService is renamed to LogToJournal,
- RedfishEvent was renamed to LogToRedfishEventLog
Both of those logging actions, now also include trigger id and threshold
name. Threshold naming logic:
- For discrete triggers, it can be specified by user, if left empty it
will be changed to "{Severity} condition".
- Numeric triggers have no way of naming threshold, instead its type
will be converted to string, example "UpperWarning"
- Discrete OnChange threshold will always be named "OnChange"
Additionally, defect was found with timestamp attached to Trigger Logs:
it was a steady_clock timestamp instead of system_clock. The function
which was supposed to format it was also working incorrectly, and was
improved to work with milliseconds. This change required major refactor
of unit tests, especially for numeric threshold.
Testing done:
- LogToJournal action is working properly,
- LogToRedfishEventLog action is working properly,
- UTs are passing.
Signed-off-by: Szymon Dompke <szymon.dompke@intel.com>
Change-Id: Iae2490682f0e9e2a610b45fd8af5cc5e21e66f35
diff --git a/src/trigger.hpp b/src/trigger.hpp
index 6bd2556..832a277 100644
--- a/src/trigger.hpp
+++ b/src/trigger.hpp
@@ -18,7 +18,7 @@
public:
Trigger(boost::asio::io_context& ioc,
const std::shared_ptr<sdbusplus::asio::object_server>& objServer,
- const std::string& id, const std::string& name,
+ TriggerId&& id, const std::string& name,
const std::vector<TriggerAction>& triggerActions,
const std::shared_ptr<std::vector<std::string>> reportIds,
std::vector<std::shared_ptr<interfaces::Threshold>>&& thresholds,
@@ -34,7 +34,7 @@
std::string getId() const override
{
- return id;
+ return *id;
}
std::string getPath() const override
@@ -49,7 +49,7 @@
std::vector<LabeledThresholdParam> getLabeledThresholds() const;
bool isDiscreate() const;
- std::string id;
+ const TriggerId id;
std::string name;
std::vector<TriggerAction> triggerActions;
std::string path;
@@ -71,5 +71,5 @@
"/xyz/openbmc_project/Telemetry/Triggers/";
static constexpr const char* deleteIfaceName =
"xyz.openbmc_project.Object.Delete";
- static constexpr size_t triggerVersion = 1;
+ static constexpr size_t triggerVersion = 2;
};