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_actions.hpp b/src/trigger_actions.hpp
index fdf07fe..a74cc7a 100644
--- a/src/trigger_actions.hpp
+++ b/src/trigger_actions.hpp
@@ -8,6 +8,19 @@
 namespace action
 {
 
+namespace redfish_message_ids
+{
+constexpr const char* TriggerNumericWarning =
+    "OpenBMC.0.1.TriggerNumericWarning";
+constexpr const char* TriggerNumericCritical =
+    "OpenBMC.0.1.TriggerNumericCritical";
+constexpr const char* TriggerDiscreteOK = "OpenBMC.0.1.TriggerDiscreteOK";
+constexpr const char* TriggerDiscreteWarning =
+    "OpenBMC.0.1.TriggerDiscreteWarning";
+constexpr const char* TriggerDiscreteCritical =
+    "OpenBMC.0.1.TriggerDiscreteCritical";
+} // namespace redfish_message_ids
+
 namespace numeric
 {
 class LogToJournal : public interfaces::TriggerAction
@@ -16,28 +29,31 @@
     LogToJournal(::numeric::Type type, double val) : type(type), threshold(val)
     {}
 
-    void commit(const std::string& id, Milliseconds timestamp,
-                double value) override;
+    void commit(const std::string& triggerId, const ThresholdName thresholdName,
+                const std::string& sensorName, const Milliseconds timestamp,
+                const TriggerValue value) override;
 
   private:
-    ::numeric::Type type;
-    double threshold;
+    const ::numeric::Type type;
+    const double threshold;
 };
 
-class LogToRedfish : public interfaces::TriggerAction
+class LogToRedfishEventLog : public interfaces::TriggerAction
 {
   public:
-    LogToRedfish(::numeric::Type type, double val) : type(type), threshold(val)
+    LogToRedfishEventLog(::numeric::Type type, double val) :
+        type(type), threshold(val)
     {}
 
-    void commit(const std::string& id, Milliseconds timestamp,
-                double value) override;
+    void commit(const std::string& triggerId, const ThresholdName thresholdName,
+                const std::string& sensorName, const Milliseconds timestamp,
+                const TriggerValue value) override;
 
   private:
-    ::numeric::Type type;
-    double threshold;
+    const ::numeric::Type type;
+    const double threshold;
 
-    const char* getMessageId() const;
+    const char* getRedfishMessageId() const;
 };
 
 void fillActions(
@@ -55,26 +71,29 @@
     explicit LogToJournal(::discrete::Severity severity) : severity(severity)
     {}
 
-    void commit(const std::string& id, Milliseconds timestamp,
-                double value) override;
+    void commit(const std::string& triggerId, const ThresholdName thresholdName,
+                const std::string& sensorName, const Milliseconds timestamp,
+                const TriggerValue value) override;
 
   private:
-    ::discrete::Severity severity;
+    const ::discrete::Severity severity;
 };
 
-class LogToRedfish : public interfaces::TriggerAction
+class LogToRedfishEventLog : public interfaces::TriggerAction
 {
   public:
-    explicit LogToRedfish(::discrete::Severity severity) : severity(severity)
+    explicit LogToRedfishEventLog(::discrete::Severity severity) :
+        severity(severity)
     {}
 
-    void commit(const std::string& id, Milliseconds timestamp,
-                double value) override;
+    void commit(const std::string& triggerId, const ThresholdName thresholdName,
+                const std::string& sensorName, const Milliseconds timestamp,
+                const TriggerValue value) override;
 
   private:
-    ::discrete::Severity severity;
+    const ::discrete::Severity severity;
 
-    const char* getMessageId() const;
+    const char* getRedfishMessageId() const;
 };
 
 void fillActions(
@@ -91,18 +110,20 @@
     LogToJournal()
     {}
 
-    void commit(const std::string& id, Milliseconds timestamp,
-                double value) override;
+    void commit(const std::string& triggerId, const ThresholdName thresholdName,
+                const std::string& sensorName, const Milliseconds timestamp,
+                const TriggerValue value) override;
 };
 
-class LogToRedfish : public interfaces::TriggerAction
+class LogToRedfishEventLog : public interfaces::TriggerAction
 {
   public:
-    LogToRedfish()
+    LogToRedfishEventLog()
     {}
 
-    void commit(const std::string& id, Milliseconds timestamp,
-                double value) override;
+    void commit(const std::string& triggerId, const ThresholdName thresholdName,
+                const std::string& sensorName, const Milliseconds timestamp,
+                const TriggerValue value) override;
 };
 
 void fillActions(
@@ -122,8 +143,9 @@
         reportIds(std::move(ids))
     {}
 
-    void commit(const std::string& id, Milliseconds timestamp,
-                double value) override;
+    void commit(const std::string& triggerId, const ThresholdName thresholdName,
+                const std::string& sensorName, const Milliseconds timestamp,
+                const TriggerValue value) override;
 
   private:
     boost::asio::io_context& ioc;