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 <app.hpp> 19 #include <utils/systemd_utils.hpp> 20 21 namespace redfish 22 { 23 24 inline void requestRoutesServiceRoot(App& app) 25 { 26 std::string uuid = persistent_data::getConfig().systemUuid; 27 BMCWEB_ROUTE(app, "/redfish/v1/") 28 .privileges({}) 29 .methods(boost::beast::http::verb::get)( 30 [uuid](const crow::Request&, 31 const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { 32 asyncResp->res.jsonValue["@odata.type"] = 33 "#ServiceRoot.v1_5_0.ServiceRoot"; 34 asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1"; 35 asyncResp->res.jsonValue["Id"] = "RootService"; 36 asyncResp->res.jsonValue["Name"] = "Root Service"; 37 asyncResp->res.jsonValue["RedfishVersion"] = "1.9.0"; 38 asyncResp->res.jsonValue["Links"]["Sessions"] = { 39 {"@odata.id", "/redfish/v1/SessionService/Sessions"}}; 40 asyncResp->res.jsonValue["AccountService"] = { 41 {"@odata.id", "/redfish/v1/AccountService"}}; 42 asyncResp->res.jsonValue["Chassis"] = { 43 {"@odata.id", "/redfish/v1/Chassis"}}; 44 asyncResp->res.jsonValue["JsonSchemas"] = { 45 {"@odata.id", "/redfish/v1/JsonSchemas"}}; 46 asyncResp->res.jsonValue["Managers"] = { 47 {"@odata.id", "/redfish/v1/Managers"}}; 48 asyncResp->res.jsonValue["SessionService"] = { 49 {"@odata.id", "/redfish/v1/SessionService"}}; 50 asyncResp->res.jsonValue["Managers"] = { 51 {"@odata.id", "/redfish/v1/Managers"}}; 52 asyncResp->res.jsonValue["Systems"] = { 53 {"@odata.id", "/redfish/v1/Systems"}}; 54 asyncResp->res.jsonValue["Registries"] = { 55 {"@odata.id", "/redfish/v1/Registries"}}; 56 57 asyncResp->res.jsonValue["UpdateService"] = { 58 {"@odata.id", "/redfish/v1/UpdateService"}}; 59 asyncResp->res.jsonValue["UUID"] = uuid; 60 asyncResp->res.jsonValue["CertificateService"] = { 61 {"@odata.id", "/redfish/v1/CertificateService"}}; 62 asyncResp->res.jsonValue["Tasks"] = { 63 {"@odata.id", "/redfish/v1/TaskService"}}; 64 asyncResp->res.jsonValue["EventService"] = { 65 {"@odata.id", "/redfish/v1/EventService"}}; 66 asyncResp->res.jsonValue["TelemetryService"] = { 67 {"@odata.id", "/redfish/v1/TelemetryService"}}; 68 }); 69 } 70 71 } // namespace redfish 72