created AddReportFutureVersion dbus method
New method will support CollectionTimeScope, CollectionDuration
In order to make not breaking interface changes bmcweb will switch to
AddReportFutureVersion, then AddReport will be changed to match
AddReportFutureVersion, then redfish will switch back to use AddReport,
then AddReportFutureVersion will be removed.
Change-Id: I9cc906cc1fa7cdf27be7e433390c516f6bae3c50
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
diff --git a/tests/src/helpers/interfaces/labeled_reading_parameter_helpers.hpp b/tests/src/helpers/interfaces/labeled_reading_parameter_helpers.hpp
index 9a46d0c..d0b1fff 100644
--- a/tests/src/helpers/interfaces/labeled_reading_parameter_helpers.hpp
+++ b/tests/src/helpers/interfaces/labeled_reading_parameter_helpers.hpp
@@ -1,7 +1,7 @@
#pragma once
#include "helpers/interfaces/labeled_sensor_parameter_helpers.hpp"
-#include "interfaces/types.hpp"
+#include "types/types.hpp"
#include <ostream>
diff --git a/tests/src/helpers/interfaces/labeled_sensor_parameter_helpers.hpp b/tests/src/helpers/interfaces/labeled_sensor_parameter_helpers.hpp
index ef2eb6b..395f8d1 100644
--- a/tests/src/helpers/interfaces/labeled_sensor_parameter_helpers.hpp
+++ b/tests/src/helpers/interfaces/labeled_sensor_parameter_helpers.hpp
@@ -1,6 +1,6 @@
#pragma once
-#include "interfaces/types.hpp"
+#include "types/types.hpp"
#include <ostream>
diff --git a/tests/src/params/report_params.hpp b/tests/src/params/report_params.hpp
index 25422bc..bf78add 100644
--- a/tests/src/params/report_params.hpp
+++ b/tests/src/params/report_params.hpp
@@ -1,7 +1,7 @@
#pragma once
-#include "interfaces/types.hpp"
#include "report_manager.hpp"
+#include "types/types.hpp"
#include <chrono>
#include <string>
@@ -86,10 +86,14 @@
"/xyz/openbmc_project/sensors/power/p1")},
utils::enumToString(OperationType::single),
"MetricId1",
- "Metadata1"},
+ "Metadata1",
+ utils::enumToString(CollectionTimeScope::point),
+ 0u},
{{sdbusplus::message::object_path(
"/xyz/openbmc_project/sensors/power/p2")},
utils::enumToString(OperationType::single),
"MetricId2",
- "Metadata2"}};
+ "Metadata2",
+ utils::enumToString(CollectionTimeScope::point),
+ 0u}};
};
diff --git a/tests/src/test_metric.cpp b/tests/src/test_metric.cpp
index e91750d..786f025 100644
--- a/tests/src/test_metric.cpp
+++ b/tests/src/test_metric.cpp
@@ -8,6 +8,8 @@
#include <gmock/gmock.h>
using namespace testing;
+using namespace std::chrono_literals;
+
namespace tstring = utils::tstring;
using Timestamp = uint64_t;
@@ -19,7 +21,8 @@
std::make_shared<NiceMock<SensorMock>>();
std::shared_ptr<Metric> sut = std::make_shared<Metric>(
- sensorMock, OperationType::avg, "id", "metadata");
+ sensorMock, OperationType::avg, "id", "metadata",
+ CollectionTimeScope::point, CollectionDuration(0ms));
};
TEST_F(TestMetric, subscribesForSensorDuringInitialization)
diff --git a/tests/src/test_report.cpp b/tests/src/test_report.cpp
index 5378f48..90043bd 100644
--- a/tests/src/test_report.cpp
+++ b/tests/src/test_report.cpp
@@ -53,7 +53,8 @@
LabeledSensorParameters("service"s + id, "path"s + id);
auto metricParameters = LabeledMetricParameters(
std::move(sensorParameters), utils::toOperationType(i),
- "id"s + id, "metadata"s + id);
+ "id"s + id, "metadata"s + id, CollectionTimeScope::point,
+ CollectionDuration(0ms));
ON_CALL(*metricMocks[i], dumpConfiguration())
.WillByDefault(Return(std::move(metricParameters)));
@@ -258,20 +259,32 @@
"ReadingParameters",
nlohmann::json(
{{{tstring::SensorPath::str(),
- {{"service", "service0"}, {"path", "path0"}}},
+ {{tstring::Service::str(), "service0"},
+ {tstring::Path::str(), "path0"}}},
{tstring::OperationType::str(), OperationType::single},
{tstring::Id::str(), "id0"},
- {tstring::MetricMetadata::str(), "metadata0"}},
+ {tstring::MetricMetadata::str(), "metadata0"},
+ {tstring::CollectionTimeScope::str(),
+ CollectionTimeScope::point},
+ {tstring::CollectionDuration::str(), 0}},
{{tstring::SensorPath::str(),
- {{"service", "service1"}, {"path", "path1"}}},
+ {{tstring::Service::str(), "service1"},
+ {tstring::Path::str(), "path1"}}},
{tstring::OperationType::str(), OperationType::max},
{tstring::Id::str(), "id1"},
- {tstring::MetricMetadata::str(), "metadata1"}},
+ {tstring::MetricMetadata::str(), "metadata1"},
+ {tstring::CollectionTimeScope::str(),
+ CollectionTimeScope::point},
+ {tstring::CollectionDuration::str(), 0}},
{{tstring::SensorPath::str(),
- {{"service", "service2"}, {"path", "path2"}}},
+ {{tstring::Service::str(), "service2"},
+ {tstring::Path::str(), "path2"}}},
{tstring::OperationType::str(), OperationType::min},
{tstring::Id::str(), "id2"},
- {tstring::MetricMetadata::str(), "metadata2"}}}))));
+ {tstring::MetricMetadata::str(), "metadata2"},
+ {tstring::CollectionTimeScope::str(),
+ CollectionTimeScope::point},
+ {tstring::CollectionDuration::str(), 0}}}))));
TEST_P(TestReportStore, settingPersistencyToTrueStoresReport)
{
diff --git a/tests/src/test_report_manager.cpp b/tests/src/test_report_manager.cpp
index 65e48f4..19760fe 100644
--- a/tests/src/test_report_manager.cpp
+++ b/tests/src/test_report_manager.cpp
@@ -56,7 +56,7 @@
addReportPromise.set_value({ec, path});
},
DbusEnvironment::serviceName(), ReportManager::reportManagerPath,
- ReportManager::reportManagerIfaceName, "AddReport",
+ ReportManager::reportManagerIfaceName, "AddReportFutureVersion",
params.reportName(), params.reportingType(),
params.emitReadingUpdate(), params.logToMetricReportCollection(),
static_cast<uint64_t>(params.interval().count()),
@@ -269,7 +269,9 @@
"/xyz/openbmc_project/sensors/power/p1")},
utils::enumToString(operationType),
"MetricId1",
- "Metadata1"}});
+ "Metadata1",
+ utils::enumToString(CollectionTimeScope::point),
+ 0u}});
reportFactoryMock.expectMake(_, reportParams, Ref(*sut), Ref(storageMock))
.WillOnce(Return(ByMove(std::move(reportMockPtr))));
@@ -307,7 +309,10 @@
return LabeledMetricParameters(
LabeledSensorParameters("service", std::get<0>(item)),
utils::stringToOperationType(std::get<1>(item)),
- std::get<2>(item), std::get<3>(item));
+ std::get<2>(item), std::get<3>(item),
+ utils::stringToCollectionTimeScope(std::get<4>(item)),
+ CollectionDuration(
+ std::chrono::milliseconds(std::get<5>(item))));
});
}