Trigger: make dbus properties writable

This change allows to modify 'Sensors', 'ReportNames' and 'Thresholds'
dbus properties of Trigger interface. They are required by Redfish to
implement PATCH functionality for Trigger schema.

Some backend changes were required to enable this functionality, and as
such few improvements were made for existing code:
- NumericThreshold and DiscreteThreshold now have common implementation
  where it was possible.
- Internal sensor info structure for Trigger is now the same as the one
  used for Report. This resulted in breaking compatibility with previous
  Trigger persistency data.
- Added getInfo / getParams methods for Sensor and Threshold interfaces.
  They are used by Trigger dbus getters and persistency mechanism now,
  instead of storing this data in Trigger object.

Testing done:
- Unit tests were expanded and are passing
- dbus setters for Sensors and Thresholds are working and modifications
  are reflected by calling appropriate getters.

Signed-off-by: Szymon Dompke <szymon.dompke@intel.com>
Change-Id: I7a14c15a30d78ce872342b5f938aba43c77be9c0
diff --git a/src/interfaces/sensor.hpp b/src/interfaces/sensor.hpp
index 6a6bcf7..7764b37 100644
--- a/src/interfaces/sensor.hpp
+++ b/src/interfaces/sensor.hpp
@@ -1,5 +1,7 @@
 #pragma once
 
+#include "types/sensor_types.hpp"
+
 #include <chrono>
 #include <memory>
 #include <ostream>
@@ -44,9 +46,12 @@
 
     virtual Id id() const = 0;
     virtual std::string metadata() const = 0;
+    virtual std::string getName() const = 0;
     virtual void registerForUpdates(const std::weak_ptr<SensorListener>&) = 0;
     virtual void
         unregisterFromUpdates(const std::weak_ptr<SensorListener>&) = 0;
+
+    virtual LabeledSensorInfo getLabeledSensorInfo() const = 0;
 };
 
 } // namespace interfaces
diff --git a/src/interfaces/threshold.hpp b/src/interfaces/threshold.hpp
index 23ff9d9..1efee2e 100644
--- a/src/interfaces/threshold.hpp
+++ b/src/interfaces/threshold.hpp
@@ -1,5 +1,8 @@
 #pragma once
 
+#include "interfaces/sensor.hpp"
+#include "types/trigger_types.hpp"
+
 namespace interfaces
 {
 
@@ -9,6 +12,8 @@
     virtual ~Threshold() = default;
 
     virtual void initialize() = 0;
+    virtual LabeledThresholdParam getThresholdParam() const = 0;
+    virtual void updateSensors(Sensors newSensors) = 0;
 };
 
 } // namespace interfaces
diff --git a/src/interfaces/trigger_factory.hpp b/src/interfaces/trigger_factory.hpp
index ee85063..0e7ac7f 100644
--- a/src/interfaces/trigger_factory.hpp
+++ b/src/interfaces/trigger_factory.hpp
@@ -1,8 +1,11 @@
 #pragma once
 
 #include "interfaces/json_storage.hpp"
+#include "interfaces/sensor.hpp"
+#include "interfaces/threshold.hpp"
 #include "interfaces/trigger.hpp"
 #include "interfaces/trigger_manager.hpp"
+#include "sensor.hpp"
 #include "types/trigger_types.hpp"
 
 #include <boost/asio/spawn.hpp>
@@ -31,6 +34,20 @@
     virtual std::vector<LabeledSensorInfo>
         getLabeledSensorsInfo(boost::asio::yield_context& yield,
                               const SensorsInfo& sensorsInfo) const = 0;
+
+    virtual std::vector<LabeledSensorInfo>
+        getLabeledSensorsInfo(const SensorsInfo& sensorsInfo) const = 0;
+
+    virtual void updateThresholds(
+        std::vector<std::shared_ptr<interfaces::Threshold>>& currentThresholds,
+        const std::vector<::TriggerAction>& triggerActions,
+        const std::shared_ptr<std::vector<std::string>>& reportIds,
+        const Sensors& sensors,
+        const LabeledTriggerThresholdParams& newParams) const = 0;
+
+    virtual void updateSensors(
+        Sensors& currentSensors,
+        const std::vector<LabeledSensorInfo>& labeledSensorsInfo) const = 0;
 };
 
 } // namespace interfaces