Modify Trigger dbus api
'AddTrigger' method is now using array of strings for actions instead
of boolean flags. The action names are following:
- 'UpdateReport' (same as old flag)
- 'LogToLogService' (old 'LogToJournal' flag)
- 'RedfishEvent' (old 'LogToRedfish' flag)
Additionally, isDiscrete flag was removed from 'AddTrigger' call, as
this value can be extracted depending on threshold.
As a result new 'AddTrigger" signature is: "sasa{os}asv"
Example call parameters:
- TestTrigger 1 UpdateReport 0 0 "a(stsd)" 1 LowerWarning 1000
Either 42.7'
- TestTrigger 2 UpdateReport RedfishEvent 0 0 "a(ssts)" 1 userId_1
Warning 10 15.2'
'Trigger' properties were also modified. Instead of action bool
properties (same as mentioned above), new property was introduced
'TriggerActions' - which has same values as those used in 'AddTrigger'
method. This also affects persistence: store/load functionality was
modified accordingly.
As a side change - isDiscrete is no longer stored, as this can be easily
recreated in the runtime.
Tested:
- Trigger was successfully created using dbus.
- busctl introspect was called on test trigger and properties are
modified and working as intended.
- persistency mechanic is working propetly.
Signed-off-by: Szymon Dompke <szymon.dompke@intel.com>
Change-Id: Icd64d4032fd6d446d9b6ad248e28e9031af1fed7
diff --git a/src/trigger.hpp b/src/trigger.hpp
index 09b5dc8..904f520 100644
--- a/src/trigger.hpp
+++ b/src/trigger.hpp
@@ -16,9 +16,8 @@
public:
Trigger(boost::asio::io_context& ioc,
const std::shared_ptr<sdbusplus::asio::object_server>& objServer,
- const std::string& name, const bool isDiscrete,
- const bool logToJournal, const bool logToRedfish,
- const bool updateReport,
+ const std::string& name,
+ const std::vector<std::string>& triggerActions,
const std::vector<std::string>& reportNames,
const std::vector<LabeledSensorInfo>& LabeledSensorsInfoIn,
const LabeledTriggerThresholdParams& labeledThresholdParamsIn,
@@ -45,10 +44,7 @@
private:
const std::string name;
- bool isDiscrete;
- bool logToJournal;
- bool logToRedfish;
- bool updateReport;
+ std::vector<std::string> triggerActions;
const std::string path;
bool persistent = false;
std::vector<std::string> reportNames;