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/interfaces/trigger_types.hpp b/src/interfaces/trigger_types.hpp
index 90c673d..1833171 100644
--- a/src/interfaces/trigger_types.hpp
+++ b/src/interfaces/trigger_types.hpp
@@ -1,6 +1,8 @@
#pragma once
#include "utils/conversion.hpp"
+#include "utils/labeled_tuple.hpp"
+#include "utils/tstring.hpp"
#include <string>
#include <tuple>
@@ -38,6 +40,12 @@
}
using ThresholdParam = std::tuple<std::string, std::string, uint64_t, double>;
+
+using LabeledThresholdParam =
+ utils::LabeledTuple<std::tuple<std::string, Severity, uint64_t, double>,
+ utils::tstring::UserId, utils::tstring::Severity,
+ utils::tstring::DwellTime,
+ utils::tstring::ThresholdValue>;
} // namespace discrete
namespace numeric
@@ -95,8 +103,22 @@
}
using ThresholdParam = std::tuple<std::string, uint64_t, std::string, double>;
+
+using LabeledThresholdParam =
+ utils::LabeledTuple<std::tuple<Type, uint64_t, Direction, double>,
+ utils::tstring::Type, utils::tstring::DwellTime,
+ utils::tstring::Direction,
+ utils::tstring::ThresholdValue>;
} // namespace numeric
+using TriggerSensors =
+ std::vector<std::pair<sdbusplus::message::object_path, std::string>>;
+
+using LabeledTriggerSensor =
+ utils::LabeledTuple<std::tuple<std::string, std::string>,
+ utils::tstring::SensorPath,
+ utils::tstring::SensorMetadata>;
+
using TriggerThresholdParams =
std::variant<std::vector<numeric::ThresholdParam>,
std::vector<discrete::ThresholdParam>>;