bmcweb: Fix Drive ResetActionInfo Output
The Parameters should be an array of parameter instead of a single one.
Tested:
```
wget -qO- http://localhost:80/redfish/v1/Chassis/chassis_1/Drives/chassis_1/ResetActionInfo
{
"@odata.id": "/redfish/v1/Chassis/chassis_1/Drives/chassis_1/ResetActionInfo",
"@odata.type": "#ActionInfo.v1_1_2.ActionInfo",
"Id": "ResetActionInfo",
"Name": "Reset Action Info",
"Parameters": [
{
"AllowableValues": [
"PowerCycle",
"ForceRestart"
],
"DataType": "String",
"Name": "ResetType",
"Required": true
}
]
}
```
Google-Bug-Id: 269367593
Change-Id: I322bc40562eedd10d84344748dee21b5bf9e9d8d
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/recipes-phosphor/interfaces/bmcweb/0005-Drive-Add-Reset-Action-for-drive.patch b/recipes-phosphor/interfaces/bmcweb/0005-Drive-Add-Reset-Action-for-drive.patch
index 738f547..24b3a7d 100644
--- a/recipes-phosphor/interfaces/bmcweb/0005-Drive-Add-Reset-Action-for-drive.patch
+++ b/recipes-phosphor/interfaces/bmcweb/0005-Drive-Add-Reset-Action-for-drive.patch
@@ -1,4 +1,4 @@
-From d0f6848cb7b0a0e219716d0ac62372d6eaf35196 Mon Sep 17 00:00:00 2001
+From 54e8b5d9580936eb2f467ce82e353004bc61df24 Mon Sep 17 00:00:00 2001
From: Willy Tu <wltu@google.com>
Date: Thu, 10 Jun 2021 14:35:51 -0700
Subject: [PATCH] Drive: Add Reset Action for drive
@@ -108,22 +108,20 @@
Patch Tracking Bug: b/232035990
Upstream info / review: http://go/openbmccl/43986
Upstream-Status: Submitted
-Justification:
- Feature support for storage integration to support Drive reset.
+Justification: Feature support for storage integration to support Drive reset.
Need to refactor it and plan to submit it by late Q12023.
Change-Id: Icf4a6c177c94aba31d9072a61d4d9d569e7e67cb
Signed-off-by: Willy Tu <wltu@google.com>
-
---
redfish-core/include/redfish.hpp | 2 +
- redfish-core/lib/storage.hpp | 494 ++++++++++++++++++++++++++++---
- 2 files changed, 461 insertions(+), 35 deletions(-)
+ redfish-core/lib/storage.hpp | 496 ++++++++++++++++++++++++++++---
+ 2 files changed, 463 insertions(+), 35 deletions(-)
diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp
-index 58e0a4b3..591e9b55 100644
+index b2c6322f..c658d5ba 100644
--- a/redfish-core/include/redfish.hpp
+++ b/redfish-core/include/redfish.hpp
-@@ -100,6 +100,8 @@ class RedfishService
+@@ -102,6 +102,8 @@ class RedfishService
requestRoutesDrive(app);
requestRoutesCable(app);
requestRoutesCableCollection(app);
@@ -133,7 +131,7 @@
requestRoutesUpdateServiceActionsSimpleUpdate(app);
#endif
diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp
-index 46516aad..68c6268e 100644
+index 421a68bc..c40ea9b2 100644
--- a/redfish-core/lib/storage.hpp
+++ b/redfish-core/lib/storage.hpp
@@ -29,6 +29,7 @@
@@ -347,7 +345,7 @@
/**
* This URL will show the drive interface for the specific drive in the chassis
*/
-@@ -1284,4 +1332,380 @@ inline void requestRoutesChassisDriveName(App& app)
+@@ -1284,4 +1332,382 @@ inline void requestRoutesChassisDriveName(App& app)
std::bind_front(handleChassisDriveGet, std::ref(app)));
}
@@ -707,14 +705,16 @@
+ driveId, "ResetActionInfo");
+ asyncResp->res.jsonValue["Name"] = "Reset Action Info";
+ asyncResp->res.jsonValue["Id"] = "ResetActionInfo";
-+ nlohmann::json::object_t parameters;
-+ parameters["Name"] = "ResetType";
-+ parameters["Required"] = true;
-+ parameters["DataType"] = "String";
++ nlohmann::json::array_t parameters;
++ nlohmann::json::object_t parameter;
++ parameter["Name"] = "ResetType";
++ parameter["Required"] = true;
++ parameter["DataType"] = "String";
+ nlohmann::json::array_t allowableValues;
+ allowableValues.emplace_back("PowerCycle");
+ allowableValues.emplace_back("ForceRestart");
-+ parameters["AllowableValues"] = std::move(allowableValues);
++ parameter["AllowableValues"] = std::move(allowableValues);
++ parameters.emplace_back(parameter);
+ asyncResp->res.jsonValue["Parameters"] =
+ std::move(parameters);
+ });
@@ -729,5 +729,5 @@
+
} // namespace redfish
--
-2.39.0.rc1.256.g54fd8350bd-goog
+2.39.1.581.gbfd45094c4-goog