summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry
diff options
context:
space:
mode:
authorJason M. Bills <jason.m.bills@linux.intel.com>2020-12-08 00:45:20 +0300
committerJason M. Bills <jason.m.bills@linux.intel.com>2020-12-10 01:15:05 +0300
commit82dbc15a05125a812c140a3c8cff81c366482229 (patch)
tree9c8f1ad262a2e281f20340cf8646aca6f8596044 /meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry
parent8d6ae7f2a817751fad151168fa10ce28ee0869d8 (diff)
downloadopenbmc-82dbc15a05125a812c140a3c8cff81c366482229.tar.xz
Update to internal 0.26
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry')
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Redfish-TelemetryService-schema-implementation.patch79
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Add-support-for-POST-in-MetricReportDefinitions.patch18
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-DELETE-in-MetricReportDefinitions-st.patch16
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Add-support-for-OnRequest-in-MetricReportDefinition.patch16
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0005-Add-support-for-MetricDefinition-scheme.patch38
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0006-Fix-MetricReport-timestamp-for-EventService.patch78
6 files changed, 91 insertions, 154 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Redfish-TelemetryService-schema-implementation.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Redfish-TelemetryService-schema-implementation.patch
index 3850c8fa8..9157f1bf1 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Redfish-TelemetryService-schema-implementation.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Redfish-TelemetryService-schema-implementation.patch
@@ -1,7 +1,7 @@
-From 7820421433349df28bd393e8d610d1848af0f1c8 Mon Sep 17 00:00:00 2001
+From d8b7e2f4eae85cd76d480970e888a50548523fc2 Mon Sep 17 00:00:00 2001
From: "Wludzik, Jozef" <jozef.wludzik@intel.com>
Date: Mon, 27 Apr 2020 17:24:15 +0200
-Subject: [PATCH 1/5] Redfish TelemetryService schema implementation
+Subject: [PATCH 05/10] Redfish TelemetryService schema implementation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
@@ -24,6 +24,10 @@ Tested:
Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
Signed-off-by: Adrian Ambrożewicz <adrian.ambrozewicz@linux.intel.com>
Change-Id: Ie6b0b49f4ef5eeaef07d1209b6c349270c04d570
+
+%% original patch: 0001-Redfish-TelemetryService-schema-implementation.patch
+
+Change-Id: I547073faef9228e8dc5350ea28d06cdd3c5341f6
---
include/dbus_utility.hpp | 21 +++
redfish-core/include/redfish.hpp | 10 ++
@@ -31,10 +35,10 @@ Change-Id: Ie6b0b49f4ef5eeaef07d1209b6c349270c04d570
redfish-core/include/utils/telemetry_utils.hpp | 100 +++++++++++++
redfish-core/include/utils/time_utils.hpp | 97 +++++++++++++
redfish-core/lib/metric_report.hpp | 149 +++++++++++++++++++
- redfish-core/lib/metric_report_definition.hpp | 193 +++++++++++++++++++++++++
+ redfish-core/lib/metric_report_definition.hpp | 191 +++++++++++++++++++++++++
redfish-core/lib/service_root.hpp | 2 +
redfish-core/lib/telemetry_service.hpp | 92 ++++++++++++
- 9 files changed, 765 insertions(+)
+ 9 files changed, 763 insertions(+)
create mode 100644 redfish-core/include/utils/telemetry_utils.hpp
create mode 100644 redfish-core/include/utils/time_utils.hpp
create mode 100644 redfish-core/lib/metric_report.hpp
@@ -42,10 +46,10 @@ Change-Id: Ie6b0b49f4ef5eeaef07d1209b6c349270c04d570
create mode 100644 redfish-core/lib/telemetry_service.hpp
diff --git a/include/dbus_utility.hpp b/include/dbus_utility.hpp
-index e1360f7..3df88d8 100644
+index 8ba9a57..ef3438b 100644
--- a/include/dbus_utility.hpp
+++ b/include/dbus_utility.hpp
-@@ -109,5 +109,26 @@ inline void checkDbusPathExists(const std::string& path, Callback&& callback)
+@@ -99,5 +99,26 @@ inline void checkDbusPathExists(const std::string& path, Callback&& callback)
std::array<std::string, 0>());
}
@@ -73,19 +77,19 @@ index e1360f7..3df88d8 100644
} // namespace utility
} // namespace dbus
diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp
-index cc98e1a..3d4c117 100644
+index 54d5d0e..2587b37 100644
--- a/redfish-core/include/redfish.hpp
+++ b/redfish-core/include/redfish.hpp
@@ -25,6 +25,8 @@
- #include "../lib/log_services.hpp"
#include "../lib/managers.hpp"
+ #include "../lib/memory.hpp"
#include "../lib/message_registries.hpp"
+#include "../lib/metric_report.hpp"
+#include "../lib/metric_report_definition.hpp"
#include "../lib/network_protocol.hpp"
#include "../lib/pcie.hpp"
#include "../lib/power.hpp"
-@@ -35,6 +37,7 @@
+@@ -36,6 +38,7 @@
#include "../lib/storage.hpp"
#include "../lib/systems.hpp"
#include "../lib/task.hpp"
@@ -93,7 +97,7 @@ index cc98e1a..3d4c117 100644
#include "../lib/thermal.hpp"
#include "../lib/update_service.hpp"
#ifdef BMCWEB_ENABLE_VM_NBDPROXY
-@@ -202,6 +205,13 @@ class RedfishService
+@@ -207,6 +210,13 @@ class RedfishService
nodes.emplace_back(std::make_unique<HypervisorInterface>(app));
nodes.emplace_back(std::make_unique<HypervisorSystem>(app));
@@ -108,21 +112,20 @@ index cc98e1a..3d4c117 100644
{
node->initPrivileges();
diff --git a/redfish-core/include/utils/json_utils.hpp b/redfish-core/include/utils/json_utils.hpp
-index d578de4..fbb259d 100644
+index c355000..c866a2f 100644
--- a/redfish-core/include/utils/json_utils.hpp
+++ b/redfish-core/include/utils/json_utils.hpp
-@@ -13,15 +13,19 @@
+@@ -13,14 +13,18 @@
// See the License for the specific language governing permissions and
// limitations under the License.
*/
+
#pragma once
- #include <http_request.h>
- #include <http_response.h>
-
+#include <boost/container/flat_map.hpp>
#include <error_messages.hpp>
+ #include <http_request.hpp>
+ #include <http_response.hpp>
#include <nlohmann/json.hpp>
#include <bitset>
@@ -131,7 +134,7 @@ index d578de4..fbb259d 100644
namespace redfish
{
-@@ -436,5 +440,102 @@ bool getValueFromJsonObject(nlohmann::json& jsonData, const std::string& key,
+@@ -425,5 +429,102 @@ bool getValueFromJsonObject(nlohmann::json& jsonData, const std::string& key,
return details::unpackValue(jsonValue, key, value);
}
@@ -445,7 +448,7 @@ index 0000000..0256b3f
+} // namespace redfish
diff --git a/redfish-core/lib/metric_report.hpp b/redfish-core/lib/metric_report.hpp
new file mode 100644
-index 0000000..a52d680
+index 0000000..4d1c4e5
--- /dev/null
+++ b/redfish-core/lib/metric_report.hpp
@@ -0,0 +1,149 @@
@@ -481,7 +484,7 @@ index 0000000..a52d680
+class MetricReportCollection : public Node
+{
+ public:
-+ MetricReportCollection(CrowApp& app) : Node(app, telemetry::metricReportUri)
++ MetricReportCollection(App& app) : Node(app, telemetry::metricReportUri)
+ {
+ entityPrivileges = {
+ {boost::beast::http::verb::get, {{"Login"}}},
@@ -493,8 +496,8 @@ index 0000000..a52d680
+ }
+
+ private:
-+ void doGet(crow::Response& res, const crow::Request& req,
-+ const std::vector<std::string>& params) override
++ void doGet(crow::Response& res, const crow::Request&,
++ const std::vector<std::string>&) override
+ {
+ res.jsonValue["@odata.type"] =
+ "#MetricReportCollection.MetricReportCollection";
@@ -510,7 +513,7 @@ index 0000000..a52d680
+class MetricReport : public Node
+{
+ public:
-+ MetricReport(CrowApp& app) :
++ MetricReport(App& app) :
+ Node(app, std::string(telemetry::metricReportUri) + "<str>/",
+ std::string())
+ {
@@ -524,7 +527,7 @@ index 0000000..a52d680
+ }
+
+ private:
-+ void doGet(crow::Response& res, const crow::Request& req,
++ void doGet(crow::Response& res, const crow::Request&,
+ const std::vector<std::string>& params) override
+ {
+ auto asyncResp = std::make_shared<AsyncResp>(res);
@@ -600,10 +603,10 @@ index 0000000..a52d680
+} // namespace redfish
diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp
new file mode 100644
-index 0000000..d82ae59
+index 0000000..72e62e9
--- /dev/null
+++ b/redfish-core/lib/metric_report_definition.hpp
-@@ -0,0 +1,193 @@
+@@ -0,0 +1,191 @@
+/*
+// Copyright (c) 2018-2020 Intel Corporation
+//
@@ -637,7 +640,7 @@ index 0000000..d82ae59
+class MetricReportDefinitionCollection : public Node
+{
+ public:
-+ MetricReportDefinitionCollection(CrowApp& app) :
++ MetricReportDefinitionCollection(App& app) :
+ Node(app, telemetry::metricReportDefinitionUri)
+ {
+ entityPrivileges = {
@@ -650,8 +653,8 @@ index 0000000..d82ae59
+ }
+
+ private:
-+ void doGet(crow::Response& res, const crow::Request& req,
-+ const std::vector<std::string>& params) override
++ void doGet(crow::Response& res, const crow::Request&,
++ const std::vector<std::string>&) override
+ {
+ res.jsonValue["@odata.type"] = "#MetricReportDefinitionCollection."
+ "MetricReportDefinitionCollection";
@@ -668,7 +671,7 @@ index 0000000..d82ae59
+class MetricReportDefinition : public Node
+{
+ public:
-+ MetricReportDefinition(CrowApp& app) :
++ MetricReportDefinition(App& app) :
+ Node(app, std::string(telemetry::metricReportDefinitionUri) + "<str>/",
+ std::string())
+ {
@@ -682,7 +685,7 @@ index 0000000..d82ae59
+ }
+
+ private:
-+ void doGet(crow::Response& res, const crow::Request& req,
++ void doGet(crow::Response& res, const crow::Request&,
+ const std::vector<std::string>& params) override
+ {
+ auto asyncResp = std::make_shared<AsyncResp>(res);
@@ -723,12 +726,10 @@ index 0000000..d82ae59
+ using ReadingParameters =
+ std::vector<std::tuple<std::vector<sdbusplus::message::object_path>,
+ std::string, std::string, std::string>>;
-+ using Metrics = std::vector<std::map<
-+ std::string, std::variant<std::string, std::vector<std::string>>>>;
+
-+ static Metrics toMetrics(const ReadingParameters& params)
++ static nlohmann::json toMetrics(const ReadingParameters& params)
+ {
-+ Metrics metrics;
++ nlohmann::json metrics = nlohmann::json::array();
+
+ for (auto& [sensorPaths, operationType, id, metadata] : params)
+ {
@@ -798,10 +799,10 @@ index 0000000..d82ae59
+};
+} // namespace redfish
diff --git a/redfish-core/lib/service_root.hpp b/redfish-core/lib/service_root.hpp
-index b6bd6e0..3302390 100644
+index 629280c..3df5ec5 100644
--- a/redfish-core/lib/service_root.hpp
+++ b/redfish-core/lib/service_root.hpp
-@@ -69,6 +69,8 @@ class ServiceRoot : public Node
+@@ -68,6 +68,8 @@ class ServiceRoot : public Node
res.jsonValue["Tasks"] = {{"@odata.id", "/redfish/v1/TaskService"}};
res.jsonValue["EventService"] = {
{"@odata.id", "/redfish/v1/EventService"}};
@@ -812,7 +813,7 @@ index b6bd6e0..3302390 100644
diff --git a/redfish-core/lib/telemetry_service.hpp b/redfish-core/lib/telemetry_service.hpp
new file mode 100644
-index 0000000..a410700
+index 0000000..b849781
--- /dev/null
+++ b/redfish-core/lib/telemetry_service.hpp
@@ -0,0 +1,92 @@
@@ -847,7 +848,7 @@ index 0000000..a410700
+class TelemetryService : public Node
+{
+ public:
-+ TelemetryService(CrowApp& app) : Node(app, "/redfish/v1/TelemetryService/")
++ TelemetryService(App& app) : Node(app, "/redfish/v1/TelemetryService/")
+ {
+ entityPrivileges = {
+ {boost::beast::http::verb::get, {{"Login"}}},
@@ -859,8 +860,8 @@ index 0000000..a410700
+ }
+
+ private:
-+ void doGet(crow::Response& res, const crow::Request& req,
-+ const std::vector<std::string>& params) override
++ void doGet(crow::Response& res, const crow::Request&,
++ const std::vector<std::string>&) override
+ {
+ res.jsonValue["@odata.type"] =
+ "#TelemetryService.v1_2_0.TelemetryService";
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Add-support-for-POST-in-MetricReportDefinitions.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Add-support-for-POST-in-MetricReportDefinitions.patch
index 8a8690bf3..c24352de5 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Add-support-for-POST-in-MetricReportDefinitions.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Add-support-for-POST-in-MetricReportDefinitions.patch
@@ -1,7 +1,7 @@
-From 941be2c7d819b4a55d5a8b67948e53658d907789 Mon Sep 17 00:00:00 2001
+From 00806052b1e9440809ce727523ffcc66083f6417 Mon Sep 17 00:00:00 2001
From: "Wludzik, Jozef" <jozef.wludzik@intel.com>
Date: Mon, 18 May 2020 11:56:57 +0200
-Subject: [PATCH 2/5] Add support for POST in MetricReportDefinitions
+Subject: [PATCH 06/10] Add support for POST in MetricReportDefinitions
Added POST action in MetricReportDefinitions node to allow user
to add new MetricReportDefinition. Using minimal set of
@@ -19,6 +19,10 @@ Tested:
Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
Change-Id: I2fed96848594451e22fde686f8c066d7770cc65a
+
+%% original patch: 0002-Add-support-for-POST-in-MetricReportDefinitions.patch
+
+Change-Id: I55032bc1086b60800d19bd1c0fa14fdb891f5a5b
---
redfish-core/include/utils/time_utils.hpp | 49 +++
.../include/utils/validate_params_length.hpp | 109 +++++++
@@ -208,7 +212,7 @@ index 0000000..c4e0569
+
+} // namespace redfish
diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp
-index d82ae59..ecbab0c 100644
+index 72e62e9..c6b09f8 100644
--- a/redfish-core/lib/metric_report_definition.hpp
+++ b/redfish-core/lib/metric_report_definition.hpp
@@ -17,16 +17,29 @@
@@ -261,7 +265,7 @@ index d82ae59..ecbab0c 100644
+ MetricParams>;
+
+ void doPost(crow::Response& res, const crow::Request& req,
-+ const std::vector<std::string>& params) override
++ const std::vector<std::string>&) override
+ {
+ auto asyncResp = std::make_shared<AsyncResp>(res);
+ AddReportArgs addReportArgs;
@@ -287,7 +291,7 @@ index d82ae59..ecbab0c 100644
+ retrieveUriToDbusMap(
+ chassis, sensorType,
+ [asyncResp, addReportReq](
-+ const boost::beast::http::status status,
++ const boost::beast::http::status,
+ const boost::container::flat_map<std::string, std::string>&
+ uriToDbus) { *addReportReq += uriToDbus; });
+ }
@@ -518,7 +522,7 @@ index d82ae59..ecbab0c 100644
+
+ crow::connections::systemBus->async_method_call(
+ [asyncResp, name](const boost::system::error_code ec,
-+ const std::string ret) {
++ const std::string) {
+ if (ec == boost::system::errc::file_exists)
+ {
+ messages::resourceAlreadyExists(
@@ -581,7 +585,7 @@ index d82ae59..ecbab0c 100644
};
class MetricReportDefinition : public Node
-@@ -148,6 +494,7 @@ class MetricReportDefinition : public Node
+@@ -146,6 +492,7 @@ class MetricReportDefinition : public Node
asyncResp->res.jsonValue["MetricReport"]["@odata.id"] =
telemetry::metricReportUri + id;
asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-DELETE-in-MetricReportDefinitions-st.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-DELETE-in-MetricReportDefinitions-st.patch
index 4c49b0cd3..dee5a158b 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-DELETE-in-MetricReportDefinitions-st.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-DELETE-in-MetricReportDefinitions-st.patch
@@ -1,7 +1,7 @@
-From 8b2f4a6fe57bf2410cdb22f8c3c695e98d583040 Mon Sep 17 00:00:00 2001
+From 5a1eef4a6c74c29d9b9026676e59e6cdf0a7e8bd Mon Sep 17 00:00:00 2001
From: "Wludzik, Jozef" <jozef.wludzik@intel.com>
Date: Mon, 18 May 2020 12:40:15 +0200
-Subject: [PATCH 3/5] Add support for DELETE in MetricReportDefinitions/<str>
+Subject: [PATCH 07/10] Add support for DELETE in MetricReportDefinitions/<str>
Added support for DELETE action in MetricReportDefinitions/<str>
node. It allows user to remove MetricReportDefinition together
@@ -16,19 +16,23 @@ Tested:
Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
Change-Id: Iffde9f7bbf2955376e9714ac8d833967bd25eaa3
+
+%% original patch: 0003-Add-support-for-DELETE-in-MetricReportDefinitions-st.patch
+
+Change-Id: I2930b9354fd4cf1f8d9a97af33b81c7b689fe0ef
---
redfish-core/lib/metric_report_definition.hpp | 32 +++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp
-index ecbab0c..8e04ac8 100644
+index c6b09f8..3191a8f 100644
--- a/redfish-core/lib/metric_report_definition.hpp
+++ b/redfish-core/lib/metric_report_definition.hpp
-@@ -533,6 +533,38 @@ class MetricReportDefinition : public Node
+@@ -531,6 +531,38 @@ class MetricReportDefinition : public Node
"xyz.openbmc_project.MonitoringService.Report");
}
-+ void doDelete(crow::Response& res, const crow::Request& req,
++ void doDelete(crow::Response& res, const crow::Request&,
+ const std::vector<std::string>& params) override
+ {
+ auto asyncResp = std::make_shared<AsyncResp>(res);
@@ -43,7 +47,7 @@ index ecbab0c..8e04ac8 100644
+ }
+
+ static void deleteReport(const std::shared_ptr<AsyncResp>& asyncResp,
-+ const std::string& path, const std::string& id)
++ const std::string& path, const std::string&)
+ {
+ crow::connections::systemBus->async_method_call(
+ [asyncResp](const boost::system::error_code ec) {
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Add-support-for-OnRequest-in-MetricReportDefinition.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Add-support-for-OnRequest-in-MetricReportDefinition.patch
index e996ac585..c6c6a8f09 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Add-support-for-OnRequest-in-MetricReportDefinition.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Add-support-for-OnRequest-in-MetricReportDefinition.patch
@@ -1,7 +1,7 @@
-From 9fc7d722b3192df9940062185b40ebb0fabad518 Mon Sep 17 00:00:00 2001
+From d206ea5049057fe4842186777231b9eb8468ec86 Mon Sep 17 00:00:00 2001
From: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
Date: Mon, 8 Jun 2020 15:16:10 +0200
-Subject: [PATCH 4/5] Add support for "OnRequest" in MetricReportDefinition
+Subject: [PATCH 08/10] Add support for "OnRequest" in MetricReportDefinition
Added support for "OnRequest" of ReportingType property in
MetricReportDefinition node. Now user is able to create
@@ -14,6 +14,8 @@ Tested:
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
Change-Id: I1cdfe47e56fdc5ec9753558145d0bf3645160aaf
+
+%% original patch: 0004-Add-support-for-OnRequest-in-MetricReportDefinition.patch
---
include/dbus_utility.hpp | 30 +++++++++++++++
redfish-core/include/utils/telemetry_utils.hpp | 8 ++--
@@ -21,18 +23,18 @@ Change-Id: I1cdfe47e56fdc5ec9753558145d0bf3645160aaf
3 files changed, 87 insertions(+), 4 deletions(-)
diff --git a/include/dbus_utility.hpp b/include/dbus_utility.hpp
-index 3df88d8..029d8d8 100644
+index ef3438b..80f8bcd 100644
--- a/include/dbus_utility.hpp
+++ b/include/dbus_utility.hpp
-@@ -17,6 +17,7 @@
-
+@@ -18,6 +18,7 @@
#include <sdbusplus/message.hpp>
+ #include <filesystem>
+#include <functional>
#include <regex>
namespace dbus
-@@ -130,5 +131,34 @@ inline void getAllProperties(Callback&& callback, const std::string& service,
+@@ -120,5 +121,34 @@ inline void getAllProperties(Callback&& callback, const std::string& service,
interface);
}
@@ -94,7 +96,7 @@ index 05ed00f..6c4e810 100644
{
messages::resourceNotFound(asyncResp->res, schemaType, id);
diff --git a/redfish-core/lib/metric_report.hpp b/redfish-core/lib/metric_report.hpp
-index a52d680..877e7f1 100644
+index 4d1c4e5..768cce9 100644
--- a/redfish-core/lib/metric_report.hpp
+++ b/redfish-core/lib/metric_report.hpp
@@ -85,7 +85,7 @@ class MetricReport : public Node
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0005-Add-support-for-MetricDefinition-scheme.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0005-Add-support-for-MetricDefinition-scheme.patch
index f7da8a556..5b1d93664 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0005-Add-support-for-MetricDefinition-scheme.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0005-Add-support-for-MetricDefinition-scheme.patch
@@ -1,7 +1,7 @@
-From b1da8901b5985d6a77b63ca9eb0570b46528f0bd Mon Sep 17 00:00:00 2001
+From b369c09460b46902878da10a106e3b3400fd776e Mon Sep 17 00:00:00 2001
From: "Wludzik, Jozef" <jozef.wludzik@intel.com>
Date: Mon, 8 Jun 2020 17:15:54 +0200
-Subject: [PATCH 5/5] Add support for MetricDefinition scheme
+Subject: [PATCH 09/10] Add support for MetricDefinition scheme
Added MetricDefinition node to redfish core. Now user is able to
get all possible metrics that are present in system and are
@@ -14,6 +14,10 @@ Tested:
Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
Change-Id: I3086e1302e1ba2e5442d1367939fd5507a0cbc00
+
+%% original patch: 0005-Add-support-for-MetricDefinition-scheme.patch
+
+Change-Id: Ibcb7a858c9118c8af5ff1167a055b044f0d8db77
---
redfish-core/include/redfish.hpp | 3 +
redfish-core/include/utils/telemetry_utils.hpp | 2 +
@@ -25,18 +29,18 @@ Change-Id: I3086e1302e1ba2e5442d1367939fd5507a0cbc00
create mode 100644 redfish-core/lib/metric_definition.hpp
diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp
-index 3d4c117..2a12bf9 100644
+index 2587b37..705f490 100644
--- a/redfish-core/include/redfish.hpp
+++ b/redfish-core/include/redfish.hpp
@@ -25,6 +25,7 @@
- #include "../lib/log_services.hpp"
#include "../lib/managers.hpp"
+ #include "../lib/memory.hpp"
#include "../lib/message_registries.hpp"
+#include "../lib/metric_definition.hpp"
#include "../lib/metric_report.hpp"
#include "../lib/metric_report_definition.hpp"
#include "../lib/network_protocol.hpp"
-@@ -206,6 +207,8 @@ class RedfishService
+@@ -211,6 +212,8 @@ class RedfishService
nodes.emplace_back(std::make_unique<HypervisorSystem>(app));
nodes.emplace_back(std::make_unique<TelemetryService>(app));
@@ -60,7 +64,7 @@ index 6c4e810..bb747c4 100644
static constexpr const char* metricReportUri =
diff --git a/redfish-core/lib/metric_definition.hpp b/redfish-core/lib/metric_definition.hpp
new file mode 100644
-index 0000000..837a068
+index 0000000..1417efa
--- /dev/null
+++ b/redfish-core/lib/metric_definition.hpp
@@ -0,0 +1,300 @@
@@ -127,7 +131,7 @@ index 0000000..837a068
+class MetricDefinitionCollection : public Node
+{
+ public:
-+ MetricDefinitionCollection(CrowApp& app) :
++ MetricDefinitionCollection(App& app) :
+ Node(app, "/redfish/v1/TelemetryService/MetricDefinitions")
+ {
+ entityPrivileges = {
@@ -140,8 +144,8 @@ index 0000000..837a068
+ }
+
+ private:
-+ void doGet(crow::Response& res, const crow::Request& req,
-+ const std::vector<std::string>& params) override
++ void doGet(crow::Response& res, const crow::Request&,
++ const std::vector<std::string>&) override
+ {
+ res.jsonValue["@odata.type"] = "#MetricDefinitionCollection."
+ "MetricDefinitionCollection";
@@ -165,7 +169,7 @@ index 0000000..837a068
+ retrieveUriToDbusMap(
+ chassisName, sensorNode.data(),
+ [asyncResp, collectionReduce](
-+ const boost::beast::http::status status,
++ const boost::beast::http::status,
+ const boost::container::flat_map<
+ std::string, std::string>& uriToDbus) {
+ *collectionReduce += uriToDbus;
@@ -219,7 +223,7 @@ index 0000000..837a068
+class MetricDefinition : public Node
+{
+ public:
-+ MetricDefinition(CrowApp& app) :
++ MetricDefinition(App& app) :
+ Node(app, std::string(telemetry::metricDefinitionUri) + "<str>/",
+ std::string())
+ {
@@ -233,7 +237,7 @@ index 0000000..837a068
+ }
+
+ private:
-+ void doGet(crow::Response& res, const crow::Request& req,
++ void doGet(crow::Response& res, const crow::Request&,
+ const std::vector<std::string>& params) override
+ {
+ auto asyncResp = std::make_shared<AsyncResp>(res);
@@ -280,7 +284,7 @@ index 0000000..837a068
+ retrieveUriToDbusMap(
+ chassisName, sensorNode.data(),
+ [asyncResp, definitionGather](
-+ const boost::beast::http::status status,
++ const boost::beast::http::status,
+ const boost::container::flat_map<
+ std::string, std::string>& uriToDbus) {
+ *definitionGather += uriToDbus;
@@ -365,7 +369,7 @@ index 0000000..837a068
+
+} // namespace redfish
diff --git a/redfish-core/lib/metric_report.hpp b/redfish-core/lib/metric_report.hpp
-index 877e7f1..be72b18 100644
+index 768cce9..bcb0d3e 100644
--- a/redfish-core/lib/metric_report.hpp
+++ b/redfish-core/lib/metric_report.hpp
@@ -91,6 +91,9 @@ class MetricReport : public Node
@@ -462,10 +466,10 @@ index 877e7f1..be72b18 100644
"xyz.openbmc_project.MonitoringService", reportPath,
"xyz.openbmc_project.MonitoringService.Report");
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
-index f12bbe0..1fa1009 100644
+index 567cb0c..2f7f70b 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
-@@ -53,20 +53,39 @@ static constexpr std::string_view thermal = "Thermal";
+@@ -54,20 +54,39 @@ static constexpr std::string_view thermal = "Thermal";
namespace dbus
{
@@ -518,7 +522,7 @@ index f12bbe0..1fa1009 100644
/**
diff --git a/redfish-core/lib/telemetry_service.hpp b/redfish-core/lib/telemetry_service.hpp
-index a410700..79e4154 100644
+index b849781..efbef6e 100644
--- a/redfish-core/lib/telemetry_service.hpp
+++ b/redfish-core/lib/telemetry_service.hpp
@@ -52,6 +52,8 @@ class TelemetryService : public Node
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0006-Fix-MetricReport-timestamp-for-EventService.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0006-Fix-MetricReport-timestamp-for-EventService.patch
deleted file mode 100644
index 75d49b6d6..000000000
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0006-Fix-MetricReport-timestamp-for-EventService.patch
+++ /dev/null
@@ -1,78 +0,0 @@
-From b71f087a173c36a16526156fa34581673e2b860c Mon Sep 17 00:00:00 2001
-From: "Wludzik, Jozef" <jozef.wludzik@intel.com>
-Date: Fri, 24 Jul 2020 17:05:38 +0200
-Subject: [PATCH 6/6] Fix MetricReport timestamp for EventService
-
-Changed MetricReport timestamp type from std::string to int32_t.
-
-Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
-Change-Id: I0a52b6963e7bedda89a216256f64764cd8799bf1
----
- redfish-core/include/event_service_manager.hpp | 23 +++++++++++++----------
- 1 file changed, 13 insertions(+), 10 deletions(-)
-
-diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
-index d2f4f2a..dc04ccb 100644
---- a/redfish-core/include/event_service_manager.hpp
-+++ b/redfish-core/include/event_service_manager.hpp
-@@ -38,7 +38,7 @@ namespace redfish
- {
-
- using ReadingsObjType =
-- std::vector<std::tuple<std::string, std::string, double, std::string>>;
-+ std::vector<std::tuple<std::string, std::string, double, int32_t>>;
- using EventServiceConfig = std::tuple<bool, uint32_t, uint32_t>;
-
- static constexpr const char* eventFormatType = "Event";
-@@ -532,10 +532,12 @@ class Subscription
- metricValuesArray.push_back({});
- nlohmann::json& entry = metricValuesArray.back();
-
-- entry = {{"MetricId", std::get<0>(it)},
-- {"MetricProperty", std::get<1>(it)},
-- {"MetricValue", std::to_string(std::get<2>(it))},
-- {"Timestamp", std::get<3>(it)}};
-+ auto& [id, property, value, timestamp] = it;
-+
-+ entry = {{"MetricId", id},
-+ {"MetricProperty", property},
-+ {"MetricValue", value},
-+ {"Timestamp", crow::utility::getDateTime(timestamp)}};
- }
-
- nlohmann::json msg = {
-@@ -1266,7 +1268,7 @@ class EventServiceManager
- [idStr{std::move(idStr)}](
- const boost::system::error_code ec,
- boost::container::flat_map<
-- std::string, std::variant<std::string, ReadingsObjType>>&
-+ std::string, std::variant<int32_t, ReadingsObjType>>&
- resp) {
- if (ec)
- {
-@@ -1275,8 +1277,8 @@ class EventServiceManager
- return;
- }
-
-- const std::string* timestampPtr =
-- std::get_if<std::string>(&resp["Timestamp"]);
-+ const int32_t* timestampPtr =
-+ std::get_if<int32_t>(&resp["Timestamp"]);
- if (!timestampPtr)
- {
- BMCWEB_LOG_DEBUG << "Failed to Get timestamp.";
-@@ -1303,8 +1305,9 @@ class EventServiceManager
- std::shared_ptr<Subscription> entry = it.second;
- if (entry->eventFormatType == metricReportFormatType)
- {
-- entry->filterAndSendReports(idStr, *timestampPtr,
-- *readingsPtr);
-+ entry->filterAndSendReports(
-+ idStr, crow::utility::getDateTime(*timestampPtr),
-+ *readingsPtr);
- }
- }
- },
---
-2.16.6
-