Borawski.Lukasz | b6df6dc | 2018-01-24 10:20:45 +0100 | [diff] [blame] | 1 | /* |
| 2 | // Copyright (c) 2018 Intel Corporation |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | */ |
| 16 | #pragma once |
| 17 | |
| 18 | #include "node.hpp" |
| 19 | |
Bernard Wong | 7bffdb7 | 2019-03-20 16:17:21 +0800 | [diff] [blame] | 20 | #include <utils/systemd_utils.hpp> |
Borawski.Lukasz | b6df6dc | 2018-01-24 10:20:45 +0100 | [diff] [blame] | 21 | |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 22 | namespace redfish |
| 23 | { |
Ed Tanous | 3ebd75f | 2018-03-05 18:20:01 -0800 | [diff] [blame] | 24 | |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 25 | class ServiceRoot : public Node |
| 26 | { |
| 27 | public: |
Ed Tanous | 52cc112 | 2020-07-18 13:51:21 -0700 | [diff] [blame] | 28 | ServiceRoot(App& app) : Node(app, "/redfish/v1/") |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 29 | { |
Ed Tanous | 52cc112 | 2020-07-18 13:51:21 -0700 | [diff] [blame] | 30 | uuid = persistent_data::getConfig().systemUuid; |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 31 | entityPrivileges = { |
| 32 | {boost::beast::http::verb::get, {}}, |
| 33 | {boost::beast::http::verb::head, {}}, |
| 34 | {boost::beast::http::verb::patch, {{"ConfigureComponents"}}}, |
| 35 | {boost::beast::http::verb::put, {{"ConfigureComponents"}}}, |
| 36 | {boost::beast::http::verb::delete_, {{"ConfigureComponents"}}}, |
| 37 | {boost::beast::http::verb::post, {{"ConfigureComponents"}}}}; |
Ed Tanous | e062590 | 2018-05-16 13:35:08 -0700 | [diff] [blame] | 38 | } |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 39 | |
| 40 | private: |
zhanghch05 | 8d1b46d | 2021-04-01 11:18:24 +0800 | [diff] [blame] | 41 | void doGet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 42 | const crow::Request&, const std::vector<std::string>&) override |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 43 | { |
zhanghch05 | 8d1b46d | 2021-04-01 11:18:24 +0800 | [diff] [blame] | 44 | asyncResp->res.jsonValue["@odata.type"] = |
| 45 | "#ServiceRoot.v1_5_0.ServiceRoot"; |
| 46 | asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1"; |
| 47 | asyncResp->res.jsonValue["Id"] = "RootService"; |
| 48 | asyncResp->res.jsonValue["Name"] = "Root Service"; |
| 49 | asyncResp->res.jsonValue["RedfishVersion"] = "1.9.0"; |
| 50 | asyncResp->res.jsonValue["Links"]["Sessions"] = { |
Ed Tanous | 0f74e64 | 2018-11-12 15:17:05 -0800 | [diff] [blame] | 51 | {"@odata.id", "/redfish/v1/SessionService/Sessions"}}; |
zhanghch05 | 8d1b46d | 2021-04-01 11:18:24 +0800 | [diff] [blame] | 52 | asyncResp->res.jsonValue["AccountService"] = { |
Ed Tanous | 0f74e64 | 2018-11-12 15:17:05 -0800 | [diff] [blame] | 53 | {"@odata.id", "/redfish/v1/AccountService"}}; |
zhanghch05 | 8d1b46d | 2021-04-01 11:18:24 +0800 | [diff] [blame] | 54 | asyncResp->res.jsonValue["Chassis"] = { |
| 55 | {"@odata.id", "/redfish/v1/Chassis"}}; |
| 56 | asyncResp->res.jsonValue["JsonSchemas"] = { |
Ed Tanous | 0f74e64 | 2018-11-12 15:17:05 -0800 | [diff] [blame] | 57 | {"@odata.id", "/redfish/v1/JsonSchemas"}}; |
zhanghch05 | 8d1b46d | 2021-04-01 11:18:24 +0800 | [diff] [blame] | 58 | asyncResp->res.jsonValue["Managers"] = { |
| 59 | {"@odata.id", "/redfish/v1/Managers"}}; |
| 60 | asyncResp->res.jsonValue["SessionService"] = { |
Gunnar Mills | 8d3cae6 | 2018-12-13 16:22:42 -0600 | [diff] [blame] | 61 | {"@odata.id", "/redfish/v1/SessionService"}}; |
zhanghch05 | 8d1b46d | 2021-04-01 11:18:24 +0800 | [diff] [blame] | 62 | asyncResp->res.jsonValue["Managers"] = { |
| 63 | {"@odata.id", "/redfish/v1/Managers"}}; |
| 64 | asyncResp->res.jsonValue["Systems"] = { |
| 65 | {"@odata.id", "/redfish/v1/Systems"}}; |
| 66 | asyncResp->res.jsonValue["Registries"] = { |
| 67 | {"@odata.id", "/redfish/v1/Registries"}}; |
Ed Tanous | 0f74e64 | 2018-11-12 15:17:05 -0800 | [diff] [blame] | 68 | |
zhanghch05 | 8d1b46d | 2021-04-01 11:18:24 +0800 | [diff] [blame] | 69 | asyncResp->res.jsonValue["UpdateService"] = { |
Ed Tanous | 0f74e64 | 2018-11-12 15:17:05 -0800 | [diff] [blame] | 70 | {"@odata.id", "/redfish/v1/UpdateService"}}; |
zhanghch05 | 8d1b46d | 2021-04-01 11:18:24 +0800 | [diff] [blame] | 71 | asyncResp->res.jsonValue["UUID"] = uuid; |
| 72 | asyncResp->res.jsonValue["CertificateService"] = { |
Marri Devender Rao | 5968cae | 2019-01-21 10:27:12 -0600 | [diff] [blame] | 73 | {"@odata.id", "/redfish/v1/CertificateService"}}; |
zhanghch05 | 8d1b46d | 2021-04-01 11:18:24 +0800 | [diff] [blame] | 74 | asyncResp->res.jsonValue["Tasks"] = { |
| 75 | {"@odata.id", "/redfish/v1/TaskService"}}; |
| 76 | asyncResp->res.jsonValue["EventService"] = { |
AppaRao Puli | e5aaf04 | 2020-03-20 01:05:52 +0530 | [diff] [blame] | 77 | {"@odata.id", "/redfish/v1/EventService"}}; |
zhanghch05 | 8d1b46d | 2021-04-01 11:18:24 +0800 | [diff] [blame] | 78 | asyncResp->res.jsonValue["TelemetryService"] = { |
Wludzik, Jozef | 081ebf0 | 2020-04-27 17:24:15 +0200 | [diff] [blame] | 79 | {"@odata.id", "/redfish/v1/TelemetryService"}}; |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 80 | } |
Ed Tanous | 3602e23 | 2019-05-13 11:11:44 -0700 | [diff] [blame] | 81 | |
| 82 | std::string uuid; |
Borawski.Lukasz | b6df6dc | 2018-01-24 10:20:45 +0100 | [diff] [blame] | 83 | }; |
| 84 | |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 85 | } // namespace redfish |