Save persistent triggers to storage
Create json storage file for persistent triggers.
Handle persistent dbus property.
Save/remove persistent triggers on add/delete.
Cover code with UTs.
Tested:
- Passed unit tests
- Tested on QEMU
* adding new valid and invalid trigger from cli
* verifying if valid trigger is properly stored
* deleting existed trigger from storage
Change-Id: I243326e84833a8cb22075fbf565573b62b205b4a
Signed-off-by: Cezary Zwolak <cezary.zwolak@intel.com>
Signed-off-by: Lukasz Kazmierczak <lukasz.kazmierczak@intel.com>
diff --git a/src/trigger_factory.cpp b/src/trigger_factory.cpp
index 3114e9a..e039e1f 100644
--- a/src/trigger_factory.cpp
+++ b/src/trigger_factory.cpp
@@ -17,14 +17,15 @@
reportManager(reportManager)
{}
-std::unique_ptr<interfaces::Trigger> TriggerFactory::make(
- boost::asio::yield_context& yield, const std::string& name, bool isDiscrete,
- bool logToJournal, bool logToRedfish, bool updateReport,
- const std::vector<std::pair<sdbusplus::message::object_path, std::string>>&
- sensorPaths,
- const std::vector<std::string>& reportNames,
- const TriggerThresholdParams& thresholdParams,
- interfaces::TriggerManager& triggerManager) const
+std::unique_ptr<interfaces::Trigger>
+ TriggerFactory::make(boost::asio::yield_context& yield,
+ const std::string& name, bool isDiscrete,
+ bool logToJournal, bool logToRedfish,
+ bool updateReport, const TriggerSensors& sensorPaths,
+ const std::vector<std::string>& reportNames,
+ const TriggerThresholdParams& thresholdParams,
+ interfaces::TriggerManager& triggerManager,
+ interfaces::JsonStorage& triggerStorage) const
{
auto [sensors, sensorNames] = getSensors(yield, sensorPaths);
std::vector<std::shared_ptr<interfaces::Threshold>> thresholds;
@@ -121,7 +122,7 @@
return std::make_unique<Trigger>(
bus->get_io_context(), objServer, name, isDiscrete, logToJournal,
logToRedfish, updateReport, sensorPaths, reportNames, thresholdParams,
- std::move(thresholds), triggerManager);
+ std::move(thresholds), triggerManager, triggerStorage);
}
std::pair<std::vector<std::shared_ptr<interfaces::Sensor>>,