Add ResetActionInfo for ResetType
OCP mandate the ResetActionInfo for convey the
parameter requirements and allowable values on
parameters for actions. So add ResetActionInfo
uri for below URI's.
/redfish/v1/Systems/system/ResetActionInfo
/redfish/v1/Managers/bmc/ResetActionInfo
/redfish/v1/Chassis/<id>/ResetActionInfo
Tested:
- All action uri's show correct @Redfish.ActionInfo
"Actions": {
"#ComputerSystem.Reset": {
"@Redfish.ActionInfo": "/redfish/v1/Systems/system/ResetActionInfo",
"target": "/redfish/v1/Systems/system/Actions/ComputerSystem.Reset"
}
}
- All /ResetActionInfo uri's show correct allowable
values.
{
"@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
}
}
- Ran redfish validator and its successful.
Change-Id: I656163dde300d97fe1923f1d58fa6d104c702d27
Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index 4a18028..7a7748a 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -326,7 +326,9 @@
asyncResp->res.jsonValue["Actions"]["#Chassis.Reset"] = {
{"target", "/redfish/v1/Chassis/" + chassisId +
"/Actions/Chassis.Reset"},
- {"ResetType@Redfish.AllowableValues", {"PowerCycle"}}};
+ {"@Redfish.ActionInfo", "/redfish/v1/Chassis/" +
+ chassisId +
+ "/ResetActionInfo"}};
asyncResp->res.jsonValue["PCIeDevices"] = {
{"@odata.id",
"/redfish/v1/Systems/system/PCIeDevices"}};
@@ -592,4 +594,56 @@
doChassisPowerCycle(asyncResp);
}
};
+
+/**
+ * ChassisResetActionInfo derived class for delivering Chassis
+ * ResetType AllowableValues using ResetInfo schema.
+ */
+class ChassisResetActionInfo : public Node
+{
+ public:
+ /*
+ * Default Constructor
+ */
+ ChassisResetActionInfo(CrowApp& app) :
+ Node(app, "/redfish/v1/Chassis/<str>/ResetActionInfo/", std::string())
+ {
+ entityPrivileges = {
+ {boost::beast::http::verb::get, {{"Login"}}},
+ {boost::beast::http::verb::head, {{"Login"}}},
+ {boost::beast::http::verb::patch, {{"ConfigureComponents"}}},
+ {boost::beast::http::verb::put, {{"ConfigureComponents"}}},
+ {boost::beast::http::verb::delete_, {{"ConfigureComponents"}}},
+ {boost::beast::http::verb::post, {{"ConfigureComponents"}}}};
+ }
+
+ private:
+ /**
+ * Functions triggers appropriate requests on DBus
+ */
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
+ {
+ if (params.size() != 1)
+ {
+ messages::internalError(res);
+ res.end();
+ return;
+ }
+ const std::string& chassisId = params[0];
+
+ res.jsonValue = {{"@odata.type", "#ActionInfo.v1_1_2.ActionInfo"},
+ {"@odata.id", "/redfish/v1/Chassis/" + chassisId +
+ "/ResetActionInfo"},
+ {"Name", "Reset Action Info"},
+ {"Id", "ResetActionInfo"},
+ {"Parameters",
+ {{{"Name", "ResetType"},
+ {"Required", true},
+ {"DataType", "String"},
+ {"AllowableValues", {"PowerCycle"}}}}}};
+ res.end();
+ }
+};
+
} // namespace redfish