diff options
author | AppaRao Puli <apparao.puli@linux.intel.com> | 2020-07-17 21:08:57 +0300 |
---|---|---|
committer | AppaRao Puli <apparao.puli@linux.intel.com> | 2020-07-21 21:33:31 +0300 |
commit | 1cb1a9e651c8a38ce3c60028a36c5d415d4afd79 (patch) | |
tree | 217fa4353b9ef9b84dc7ff55e3e8e8d8d5691e26 /redfish-core/lib | |
parent | 54d8bb1354da6d4770d4d092f719f42e918f8bbf (diff) | |
download | bmcweb-1cb1a9e651c8a38ce3c60028a36c5d415d4afd79.tar.xz |
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>
Diffstat (limited to 'redfish-core/lib')
-rw-r--r-- | redfish-core/lib/chassis.hpp | 56 | ||||
-rw-r--r-- | redfish-core/lib/managers.hpp | 46 | ||||
-rw-r--r-- | redfish-core/lib/systems.hpp | 50 |
3 files changed, 147 insertions, 5 deletions
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp index 4a18028b00..7a7748ac6d 100644 --- a/redfish-core/lib/chassis.hpp +++ b/redfish-core/lib/chassis.hpp @@ -326,7 +326,9 @@ class Chassis : public Node 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 @@ class ChassisResetAction : public Node 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 diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp index 2056d1041b..bb7165eb4f 100644 --- a/redfish-core/lib/managers.hpp +++ b/redfish-core/lib/managers.hpp @@ -183,6 +183,49 @@ class ManagerResetToDefaultsAction : public Node } }; +/** + * ManagerResetActionInfo derived class for delivering Manager + * ResetType AllowableValues using ResetInfo schema. + */ +class ManagerResetActionInfo : public Node +{ + public: + /* + * Default Constructor + */ + ManagerResetActionInfo(CrowApp& app) : + Node(app, "/redfish/v1/Managers/bmc/ResetActionInfo/") + { + 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 + { + res.jsonValue = { + {"@odata.type", "#ActionInfo.v1_1_2.ActionInfo"}, + {"@odata.id", "/redfish/v1/Managers/bmc/ResetActionInfo"}, + {"Name", "Reset Action Info"}, + {"Id", "ResetActionInfo"}, + {"Parameters", + {{{"Name", "ResetType"}, + {"Required", true}, + {"DataType", "String"}, + {"AllowableValues", {"GracefulRestart"}}}}}}; + res.end(); + } +}; + static constexpr const char* objectManagerIface = "org.freedesktop.DBus.ObjectManager"; static constexpr const char* pidConfigurationIface = @@ -1674,7 +1717,8 @@ class Manager : public Node res.jsonValue["Actions"]["#Manager.Reset"]; managerReset["target"] = "/redfish/v1/Managers/bmc/Actions/Manager.Reset"; - managerReset["ResetType@Redfish.AllowableValues"] = {"GracefulRestart"}; + managerReset["@Redfish.ActionInfo"] = + "/redfish/v1/Managers/bmc/ResetActionInfo"; // ResetToDefaults (Factory Reset) has values like // PreserveNetworkAndUsers and PreserveNetwork that aren't supported diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp index 422b2f75de..50e2b93a9c 100644 --- a/redfish-core/lib/systems.hpp +++ b/redfish-core/lib/systems.hpp @@ -1906,9 +1906,8 @@ class Systems : public Node res.jsonValue["Actions"]["#ComputerSystem.Reset"] = { {"target", "/redfish/v1/Systems/system/Actions/ComputerSystem.Reset"}, - {"ResetType@Redfish.AllowableValues", - {"On", "ForceOff", "ForceOn", "ForceRestart", "GracefulRestart", - "GracefulShutdown", "PowerCycle", "Nmi"}}}; + {"@Redfish.ActionInfo", + "/redfish/v1/Systems/system/ResetActionInfo"}}; res.jsonValue["LogServices"] = { {"@odata.id", "/redfish/v1/Systems/system/LogServices"}}; @@ -2038,4 +2037,49 @@ class Systems : public Node } } }; + +/** + * SystemResetActionInfo derived class for delivering Computer Systems + * ResetType AllowableValues using ResetInfo schema. + */ +class SystemResetActionInfo : public Node +{ + public: + /* + * Default Constructor + */ + SystemResetActionInfo(CrowApp& app) : + Node(app, "/redfish/v1/Systems/system/ResetActionInfo/") + { + 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 + { + res.jsonValue = { + {"@odata.type", "#ActionInfo.v1_1_2.ActionInfo"}, + {"@odata.id", "/redfish/v1/Systems/system/ResetActionInfo"}, + {"Name", "Reset Action Info"}, + {"Id", "ResetActionInfo"}, + {"Parameters", + {{{"Name", "ResetType"}, + {"Required", true}, + {"DataType", "String"}, + {"AllowableValues", + {"On", "ForceOff", "ForceOn", "ForceRestart", "GracefulRestart", + "GracefulShutdown", "PowerCycle", "Nmi"}}}}}}; + res.end(); + } +}; } // namespace redfish |