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/tests/src/test_trigger_manager.cpp b/tests/src/test_trigger_manager.cpp
index 704c497..540bcbc 100644
--- a/tests/src/test_trigger_manager.cpp
+++ b/tests/src/test_trigger_manager.cpp
@@ -29,8 +29,7 @@
},
DbusEnvironment::serviceName(), TriggerManager::triggerManagerPath,
TriggerManager::triggerManagerIfaceName, "AddTrigger",
- params.name(), params.isDiscrete(), params.logToJournal(),
- params.logToRedfish(), params.updateReport(), sensorInfos,
+ params.name(), params.triggerActions(), sensorInfos,
params.reportNames(),
std::visit(utils::FromLabeledThresholdParamConversion(),
params.thresholdParams()));
@@ -80,7 +79,7 @@
{"discrete_threshold2", discrete::Severity::warning, 10, "12.0"},
{"discrete_threshold3", discrete::Severity::critical, 10, "13.0"}};
- triggerParamsDiscrete.thresholdParams(thresholds).isDiscrete(true);
+ triggerParamsDiscrete.thresholdParams(thresholds);
auto [ec, path] = addTrigger(triggerParamsDiscrete);
EXPECT_THAT(ec.value(), Eq(boost::system::errc::success));
@@ -92,7 +91,7 @@
TriggerParams triggerParamsDiscrete;
auto thresholds = std::vector<discrete::LabeledThresholdParam>();
- triggerParamsDiscrete.thresholdParams(thresholds).isDiscrete(true);
+ triggerParamsDiscrete.thresholdParams(thresholds);
auto [ec, path] = addTrigger(triggerParamsDiscrete);
EXPECT_THAT(ec.value(), Eq(boost::system::errc::success));
@@ -203,10 +202,7 @@
{"Name", TriggerParams().name()},
{"ThresholdParamsDiscriminator",
TriggerParams().thresholdParams().index()},
- {"IsDiscrete", TriggerParams().isDiscrete()},
- {"LogToJournal", TriggerParams().logToJournal()},
- {"LogToRedfish", TriggerParams().logToRedfish()},
- {"UpdateReport", TriggerParams().updateReport()},
+ {"TriggerActions", TriggerParams().triggerActions()},
{"ThresholdParams", utils::labeledThresholdParamsToJson(
TriggerParams().thresholdParams())},
{"ReportNames", TriggerParams().reportNames()},