ComputerSystem: 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/Systems/system/ResetActionInfo",
"@odata.type": "#ActionInfo.v1_1_2.ActionInfo",
"Id": "ResetActionInfo",
"Name": "Reset Action Info",
"Parameters": [
{
"AllowableValues": [
"On",
"ForceOff",
"ForceOn",
"ForceRestart",
"GracefulRestart",
"GracefulShutdown",
"PowerCycle",
"Nmi"
],
"DataType": "String",
"Name": "ResetType",
"Required": true
}
]
}
```
2. Redfish Service Validator Passes
*** /redfish/v1/Systems/system/ResetActionInfo
Attempt 1 of /redfish/v1/Systems/system/ResetActionInfo
Response Time for GET to /redfish/v1/Systems/system/ResetActionInfo: 0.001620268914848566 seconds.
Type (ActionInfo.v1_1_2.ActionInfo), GET SUCCESS (time: 0:00:00.001832)
PASS
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I36db7fddaf565a2464378e31b18ecea688254f0e
Signed-off-by: Ed Tanous <edtanous@google.com>
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 9aac379..4d37f5e 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -3083,18 +3083,26 @@
"#ActionInfo.v1_1_2.ActionInfo";
asyncResp->res.jsonValue["Name"] = "Reset Action Info";
asyncResp->res.jsonValue["Id"] = "ResetActionInfo";
- asyncResp->res.jsonValue["Parameters"]["Name"] = "ResetType";
- asyncResp->res.jsonValue["Parameters"]["Required"] = true;
- asyncResp->res.jsonValue["Parameters"]["DataType"] = "String";
- asyncResp->res.jsonValue["Parameters"]["AllowableValues"] = {
- "On",
- "ForceOff",
- "ForceOn",
- "ForceRestart",
- "GracefulRestart",
- "GracefulShutdown",
- "PowerCycle",
- "Nmi"};
+
+ 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("On");
+ allowableValues.emplace_back("ForceOff");
+ allowableValues.emplace_back("ForceOn");
+ allowableValues.emplace_back("ForceRestart");
+ allowableValues.emplace_back("GracefulRestart");
+ allowableValues.emplace_back("GracefulShutdown");
+ allowableValues.emplace_back("PowerCycle");
+ allowableValues.emplace_back("Nmi");
+ parameter["AllowableValues"] = std::move(allowableValues);
+ parameters.emplace_back(std::move(parameter));
+
+ asyncResp->res.jsonValue["Parameters"] = std::move(parameters);
});
}
} // namespace redfish