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/interfaces/trigger_factory.hpp b/src/interfaces/trigger_factory.hpp
index d493b4a..b84ce73 100644
--- a/src/interfaces/trigger_factory.hpp
+++ b/src/interfaces/trigger_factory.hpp
@@ -20,15 +20,17 @@
virtual ~TriggerFactory() = default;
virtual std::unique_ptr<interfaces::Trigger> 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>>& sensors,
+ const std::string& name, bool isDiscrete, bool logToJournal,
+ bool logToRedfish, bool updateReport,
const std::vector<std::string>& reportNames,
- const TriggerThresholdParams& thresholdParams,
interfaces::TriggerManager& triggerManager,
- interfaces::JsonStorage& triggerStorage) const = 0;
+ interfaces::JsonStorage& triggerStorage,
+ const LabeledTriggerThresholdParams& labeledThresholdParams,
+ const std::vector<LabeledSensorInfo>& labeledSensorsInfo) const = 0;
+
+ virtual std::vector<LabeledSensorInfo>
+ getLabeledSensorsInfo(boost::asio::yield_context& yield,
+ const SensorsInfo& sensorsInfo) const = 0;
};
} // namespace interfaces
diff --git a/src/interfaces/trigger_types.hpp b/src/interfaces/trigger_types.hpp
index 1833171..568756f 100644
--- a/src/interfaces/trigger_types.hpp
+++ b/src/interfaces/trigger_types.hpp
@@ -111,14 +111,22 @@
utils::tstring::ThresholdValue>;
} // namespace numeric
-using TriggerSensors =
+using SensorsInfo =
std::vector<std::pair<sdbusplus::message::object_path, std::string>>;
-using LabeledTriggerSensor =
- utils::LabeledTuple<std::tuple<std::string, std::string>,
- utils::tstring::SensorPath,
+using LabeledSensorInfo =
+ utils::LabeledTuple<std::tuple<std::string, std::string, std::string>,
+ utils::tstring::Service, utils::tstring::SensorPath,
utils::tstring::SensorMetadata>;
+using TriggerThresholdParamsExt =
+ std::variant<std::monostate, std::vector<numeric::ThresholdParam>,
+ std::vector<discrete::ThresholdParam>>;
+
using TriggerThresholdParams =
std::variant<std::vector<numeric::ThresholdParam>,
std::vector<discrete::ThresholdParam>>;
+
+using LabeledTriggerThresholdParams =
+ std::variant<std::vector<numeric::LabeledThresholdParam>,
+ std::vector<discrete::LabeledThresholdParam>>;