Read persistent triggers from storage
Read json storage file for persistent triggers.
Add trigger to telemetry service.
Cover code with UTs.
Tested:
- Passed unit tests
- Tested on QEMU
* starting app without configuration
* restart app with configuration stored
* restart app with configuration in incorrect version
* restart app with configuration malformed
Change-Id: I2cb9324abdb8323be8a7f0c932ed7f70c5bc2891
Signed-off-by: Cezary Zwolak <cezary.zwolak@intel.com>
Signed-off-by: Lukasz Kazmierczak <lukasz.kazmierczak@intel.com>
diff --git a/src/trigger_manager.hpp b/src/trigger_manager.hpp
index 1db6d73..ec26bdc 100644
--- a/src/trigger_manager.hpp
+++ b/src/trigger_manager.hpp
@@ -30,6 +30,17 @@
std::unique_ptr<sdbusplus::asio::dbus_interface> managerIface;
std::vector<std::unique_ptr<interfaces::Trigger>> triggers;
+ void verifyAddTrigger(const std::string& triggerName, bool isDiscrete,
+ const LabeledTriggerThresholdParams& thresholdParams);
+
+ interfaces::Trigger&
+ addTrigger(const std::string& triggerName, bool isDiscrete,
+ bool logToJournal, bool logToRedfish, bool updateReport,
+ const std::vector<LabeledSensorInfo>& labeledSensors,
+ const std::vector<std::string>& reportNames,
+ const LabeledTriggerThresholdParams& labeledThresholdParams);
+ void loadFromPersistent();
+
public:
static constexpr size_t maxTriggers{TELEMETRY_MAX_TRIGGERS};
static constexpr const char* triggerManagerIfaceName =