Chassis: fix ResetActionInfo
There is a regression that "Parameters" in ActionInfo now become an
object rather than an array, as defined in the Schema,
https://redfish.dmtf.org/schemas/ActionInfo.v1_2_0.json
Tested:
1. On my mock environment,
{
"@odata.id": "/redfish/v1/Chassis/fake_chassis/ResetActionInfo",
"@odata.type": "#ActionInfo.v1_1_2.ActionInfo",
"Id": "ResetActionInfo",
"Name": "Reset Action Info",
"Parameters": [
{
"AllowableValues": [
"PowerCycle"
],
"DataType": "String",
"Name": "ResetType",
"Required": true
}
]
}
2. Redfish Service Validator passes
```
*** /redfish/v1/Chassis/fake_chassis/ResetActionInfo
Attempt 1 of /redfish/v1/Chassis/fake_chassis/ResetActionInfo
Response Time for GET to /redfish/v1/Chassis/fake_chassis/ResetActionInfo: 0.0017544100992381573 seconds.
Type (ActionInfo.v1_1_2.ActionInfo), GET SUCCESS (time: 0:00:00.001957)
PASS
```
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I85d1c14d6a37b6f360732ee107d0163c2d3ff15f
Signed-off-by: Ed Tanous <edtanous@google.com>
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index 181ef3d..f92a7d8 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -698,13 +698,16 @@
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 allowed;
allowed.push_back("PowerCycle");
- parameters["AllowableValues"] = std::move(allowed);
+ parameter["AllowableValues"] = std::move(allowed);
+ parameters.push_back(std::move(parameter));
+
asyncResp->res.jsonValue["Parameters"] = std::move(parameters);
});
}