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/mocks/trigger_factory_mock.hpp b/tests/src/mocks/trigger_factory_mock.hpp
index 3682a46..3df567e 100644
--- a/tests/src/mocks/trigger_factory_mock.hpp
+++ b/tests/src/mocks/trigger_factory_mock.hpp
@@ -15,15 +15,15 @@
{
using namespace testing;
- ON_CALL(*this, make(A<const std::string&>(), _, _, _, _, _, _, _, _, _))
+ ON_CALL(*this, make(A<const std::string&>(), _, _, _, _, _, _))
.WillByDefault(WithArgs<0>(Invoke([](const std::string& name) {
return std::make_unique<NiceMock<TriggerMock>>(name);
})));
}
MOCK_METHOD(std::unique_ptr<interfaces::Trigger>, make,
- (const std::string& name, bool isDiscrete, bool logToJournal,
- bool logToRedfish, bool updateReport,
+ (const std::string& name,
+ const std::vector<std::string>& triggerActions,
const std::vector<std::string>& reportNames,
interfaces::TriggerManager& triggerManager,
interfaces::JsonStorage& triggerStorage,
@@ -53,11 +53,9 @@
.WillByDefault(Return(params.sensors()));
return EXPECT_CALL(
- *this,
- make(params.name(), params.isDiscrete(), params.logToJournal(),
- params.logToRedfish(), params.updateReport(),
- params.reportNames(), tm, triggerStorage,
- params.thresholdParams(), params.sensors()));
+ *this, make(params.name(), params.triggerActions(),
+ params.reportNames(), tm, triggerStorage,
+ params.thresholdParams(), params.sensors()));
}
else
{
@@ -69,8 +67,8 @@
ON_CALL(*this, getLabeledSensorsInfo(_, _))
.WillByDefault(Return(dummy));
- return EXPECT_CALL(
- *this, make(_, _, _, _, _, _, tm, triggerStorage, _, dummy));
+ return EXPECT_CALL(*this,
+ make(_, _, _, tm, triggerStorage, _, dummy));
}
}
};