1b6df6dc7SBorawski.Lukasz /* 2b6df6dc7SBorawski.Lukasz // Copyright (c) 2018 Intel Corporation 3b6df6dc7SBorawski.Lukasz // 4b6df6dc7SBorawski.Lukasz // Licensed under the Apache License, Version 2.0 (the "License"); 5b6df6dc7SBorawski.Lukasz // you may not use this file except in compliance with the License. 6b6df6dc7SBorawski.Lukasz // You may obtain a copy of the License at 7b6df6dc7SBorawski.Lukasz // 8b6df6dc7SBorawski.Lukasz // http://www.apache.org/licenses/LICENSE-2.0 9b6df6dc7SBorawski.Lukasz // 10b6df6dc7SBorawski.Lukasz // Unless required by applicable law or agreed to in writing, software 11b6df6dc7SBorawski.Lukasz // distributed under the License is distributed on an "AS IS" BASIS, 12b6df6dc7SBorawski.Lukasz // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13b6df6dc7SBorawski.Lukasz // See the License for the specific language governing permissions and 14b6df6dc7SBorawski.Lukasz // limitations under the License. 15b6df6dc7SBorawski.Lukasz */ 16b6df6dc7SBorawski.Lukasz #pragma once 17b6df6dc7SBorawski.Lukasz 187e860f15SJohn Edward Broadbent #include <app.hpp> 19*9629907dSNan Zhou #include <async_resp.hpp> 20*9629907dSNan Zhou #include <http_request.hpp> 21*9629907dSNan Zhou #include <nlohmann/json.hpp> 228338891aSJohn Edward Broadbent #include <persistent_data.hpp> 23ed398213SEd Tanous #include <registries/privilege_registry.hpp> 247bffdb7eSBernard Wong #include <utils/systemd_utils.hpp> 25b6df6dc7SBorawski.Lukasz 261abe55efSEd Tanous namespace redfish 271abe55efSEd Tanous { 281abe55efSEd Tanous 298338891aSJohn Edward Broadbent inline void 30104f09c9SEd Tanous handleServiceRootGet(const crow::Request& /*req*/, 318338891aSJohn Edward Broadbent const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) 321abe55efSEd Tanous { 338338891aSJohn Edward Broadbent 347e860f15SJohn Edward Broadbent std::string uuid = persistent_data::getConfig().systemUuid; 359c929beaSShantappa Teekappanavar asyncResp->res.jsonValue["@odata.type"] = 369c929beaSShantappa Teekappanavar "#ServiceRoot.v1_11_0.ServiceRoot"; 378d1b46d7Szhanghch05 asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1"; 388d1b46d7Szhanghch05 asyncResp->res.jsonValue["Id"] = "RootService"; 398d1b46d7Szhanghch05 asyncResp->res.jsonValue["Name"] = "Root Service"; 408d1b46d7Szhanghch05 asyncResp->res.jsonValue["RedfishVersion"] = "1.9.0"; 418d1b46d7Szhanghch05 asyncResp->res.jsonValue["Links"]["Sessions"] = { 420f74e643SEd Tanous {"@odata.id", "/redfish/v1/SessionService/Sessions"}}; 438d1b46d7Szhanghch05 asyncResp->res.jsonValue["AccountService"] = { 440f74e643SEd Tanous {"@odata.id", "/redfish/v1/AccountService"}}; 458d1b46d7Szhanghch05 asyncResp->res.jsonValue["Chassis"] = { 468d1b46d7Szhanghch05 {"@odata.id", "/redfish/v1/Chassis"}}; 478d1b46d7Szhanghch05 asyncResp->res.jsonValue["JsonSchemas"] = { 480f74e643SEd Tanous {"@odata.id", "/redfish/v1/JsonSchemas"}}; 498d1b46d7Szhanghch05 asyncResp->res.jsonValue["Managers"] = { 508d1b46d7Szhanghch05 {"@odata.id", "/redfish/v1/Managers"}}; 518d1b46d7Szhanghch05 asyncResp->res.jsonValue["SessionService"] = { 528d3cae6bSGunnar Mills {"@odata.id", "/redfish/v1/SessionService"}}; 538d1b46d7Szhanghch05 asyncResp->res.jsonValue["Systems"] = { 548d1b46d7Szhanghch05 {"@odata.id", "/redfish/v1/Systems"}}; 558d1b46d7Szhanghch05 asyncResp->res.jsonValue["Registries"] = { 568d1b46d7Szhanghch05 {"@odata.id", "/redfish/v1/Registries"}}; 570f74e643SEd Tanous 588d1b46d7Szhanghch05 asyncResp->res.jsonValue["UpdateService"] = { 590f74e643SEd Tanous {"@odata.id", "/redfish/v1/UpdateService"}}; 608d1b46d7Szhanghch05 asyncResp->res.jsonValue["UUID"] = uuid; 618d1b46d7Szhanghch05 asyncResp->res.jsonValue["CertificateService"] = { 625968caeeSMarri Devender Rao {"@odata.id", "/redfish/v1/CertificateService"}}; 638d1b46d7Szhanghch05 asyncResp->res.jsonValue["Tasks"] = { 648d1b46d7Szhanghch05 {"@odata.id", "/redfish/v1/TaskService"}}; 658d1b46d7Szhanghch05 asyncResp->res.jsonValue["EventService"] = { 66e5aaf047SAppaRao Puli {"@odata.id", "/redfish/v1/EventService"}}; 678d1b46d7Szhanghch05 asyncResp->res.jsonValue["TelemetryService"] = { 68081ebf06SWludzik, Jozef {"@odata.id", "/redfish/v1/TelemetryService"}}; 699c929beaSShantappa Teekappanavar asyncResp->res.jsonValue["Cables"] = {{"@odata.id", "/redfish/v1/Cables"}}; 70*9629907dSNan Zhou 71*9629907dSNan Zhou nlohmann::json& protocolFeatures = 72*9629907dSNan Zhou asyncResp->res.jsonValue["ProtocolFeaturesSupported"]; 73*9629907dSNan Zhou protocolFeatures["ExcerptQuery"] = false; 74*9629907dSNan Zhou protocolFeatures["ExpandQuery"]["ExpandAll"] = false; 75*9629907dSNan Zhou protocolFeatures["ExpandQuery"]["Levels"] = false; 76*9629907dSNan Zhou protocolFeatures["ExpandQuery"]["Links"] = false; 77*9629907dSNan Zhou protocolFeatures["ExpandQuery"]["NoLinks"] = false; 78*9629907dSNan Zhou protocolFeatures["FilterQuery"] = false; 79*9629907dSNan Zhou protocolFeatures["OnlyMemberQuery"] = false; 80*9629907dSNan Zhou protocolFeatures["SelectQuery"] = false; 81*9629907dSNan Zhou protocolFeatures["DeepOperations"]["DeepPOST"] = false; 82*9629907dSNan Zhou protocolFeatures["DeepOperations"]["DeepPATCH"] = false; 838338891aSJohn Edward Broadbent } 848338891aSJohn Edward Broadbent 858338891aSJohn Edward Broadbent inline void requestRoutesServiceRoot(App& app) 868338891aSJohn Edward Broadbent { 878338891aSJohn Edward Broadbent BMCWEB_ROUTE(app, "/redfish/v1/") 888338891aSJohn Edward Broadbent .privileges(redfish::privileges::getServiceRoot) 898338891aSJohn Edward Broadbent .methods(boost::beast::http::verb::get)(handleServiceRootGet); 90b6df6dc7SBorawski.Lukasz } 913602e232SEd Tanous 92b6df6dc7SBorawski.Lukasz } // namespace redfish 93