1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
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 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
with MetricReport connected to it.
Tested:
- Succesfully passed RedfishServiceValidator.py
- Validated DELETE action by removing exisiting
MetricReportDefinitions from MonitoringService
- Validated DELETE action with negative cases when
MetricReportDefinition does not exist
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 c6b09f8..3191a8f 100644
--- a/redfish-core/lib/metric_report_definition.hpp
+++ b/redfish-core/lib/metric_report_definition.hpp
@@ -531,6 +531,38 @@ class MetricReportDefinition : public Node
"xyz.openbmc_project.MonitoringService.Report");
}
+ void doDelete(crow::Response& res, const crow::Request&,
+ const std::vector<std::string>& params) override
+ {
+ auto asyncResp = std::make_shared<AsyncResp>(res);
+ if (params.size() != 1)
+ {
+ messages::internalError(asyncResp->res);
+ return;
+ }
+
+ const std::string& id = params[0];
+ telemetry::getReport(asyncResp, id, schemaType, deleteReport);
+ }
+
+ static void deleteReport(const std::shared_ptr<AsyncResp>& asyncResp,
+ const std::string& path, const std::string&)
+ {
+ crow::connections::systemBus->async_method_call(
+ [asyncResp](const boost::system::error_code ec) {
+ if (ec)
+ {
+ BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
+ messages::internalError(asyncResp->res);
+ return;
+ }
+
+ asyncResp->res.result(boost::beast::http::status::no_content);
+ },
+ "xyz.openbmc_project.MonitoringService", path,
+ "xyz.openbmc_project.Object.Delete", "Delete");
+ }
+
public:
static constexpr const char* schemaType =
"#MetricReportDefinition.v1_3_0.MetricReportDefinition";
--
2.16.6
|