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 18*f4c99e70SEd Tanous #include <bmcweb_config.h> 19*f4c99e70SEd Tanous 207e860f15SJohn Edward Broadbent #include <app.hpp> 219629907dSNan Zhou #include <async_resp.hpp> 229629907dSNan Zhou #include <http_request.hpp> 239629907dSNan Zhou #include <nlohmann/json.hpp> 248338891aSJohn Edward Broadbent #include <persistent_data.hpp> 25ed398213SEd Tanous #include <registries/privilege_registry.hpp> 267bffdb7eSBernard Wong #include <utils/systemd_utils.hpp> 27b6df6dc7SBorawski.Lukasz 281abe55efSEd Tanous namespace redfish 291abe55efSEd Tanous { 301abe55efSEd Tanous 318338891aSJohn Edward Broadbent inline void 32104f09c9SEd Tanous handleServiceRootGet(const crow::Request& /*req*/, 338338891aSJohn Edward Broadbent const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) 341abe55efSEd Tanous { 358338891aSJohn Edward Broadbent 367e860f15SJohn Edward Broadbent std::string uuid = persistent_data::getConfig().systemUuid; 379c929beaSShantappa Teekappanavar asyncResp->res.jsonValue["@odata.type"] = 389c929beaSShantappa Teekappanavar "#ServiceRoot.v1_11_0.ServiceRoot"; 398d1b46d7Szhanghch05 asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1"; 408d1b46d7Szhanghch05 asyncResp->res.jsonValue["Id"] = "RootService"; 418d1b46d7Szhanghch05 asyncResp->res.jsonValue["Name"] = "Root Service"; 428d1b46d7Szhanghch05 asyncResp->res.jsonValue["RedfishVersion"] = "1.9.0"; 438d1b46d7Szhanghch05 asyncResp->res.jsonValue["Links"]["Sessions"] = { 440f74e643SEd Tanous {"@odata.id", "/redfish/v1/SessionService/Sessions"}}; 458d1b46d7Szhanghch05 asyncResp->res.jsonValue["AccountService"] = { 460f74e643SEd Tanous {"@odata.id", "/redfish/v1/AccountService"}}; 478d1b46d7Szhanghch05 asyncResp->res.jsonValue["Chassis"] = { 488d1b46d7Szhanghch05 {"@odata.id", "/redfish/v1/Chassis"}}; 498d1b46d7Szhanghch05 asyncResp->res.jsonValue["JsonSchemas"] = { 500f74e643SEd Tanous {"@odata.id", "/redfish/v1/JsonSchemas"}}; 518d1b46d7Szhanghch05 asyncResp->res.jsonValue["Managers"] = { 528d1b46d7Szhanghch05 {"@odata.id", "/redfish/v1/Managers"}}; 538d1b46d7Szhanghch05 asyncResp->res.jsonValue["SessionService"] = { 548d3cae6bSGunnar Mills {"@odata.id", "/redfish/v1/SessionService"}}; 558d1b46d7Szhanghch05 asyncResp->res.jsonValue["Systems"] = { 568d1b46d7Szhanghch05 {"@odata.id", "/redfish/v1/Systems"}}; 578d1b46d7Szhanghch05 asyncResp->res.jsonValue["Registries"] = { 588d1b46d7Szhanghch05 {"@odata.id", "/redfish/v1/Registries"}}; 590f74e643SEd Tanous 608d1b46d7Szhanghch05 asyncResp->res.jsonValue["UpdateService"] = { 610f74e643SEd Tanous {"@odata.id", "/redfish/v1/UpdateService"}}; 628d1b46d7Szhanghch05 asyncResp->res.jsonValue["UUID"] = uuid; 638d1b46d7Szhanghch05 asyncResp->res.jsonValue["CertificateService"] = { 645968caeeSMarri Devender Rao {"@odata.id", "/redfish/v1/CertificateService"}}; 658d1b46d7Szhanghch05 asyncResp->res.jsonValue["Tasks"] = { 668d1b46d7Szhanghch05 {"@odata.id", "/redfish/v1/TaskService"}}; 678d1b46d7Szhanghch05 asyncResp->res.jsonValue["EventService"] = { 68e5aaf047SAppaRao Puli {"@odata.id", "/redfish/v1/EventService"}}; 698d1b46d7Szhanghch05 asyncResp->res.jsonValue["TelemetryService"] = { 70081ebf06SWludzik, Jozef {"@odata.id", "/redfish/v1/TelemetryService"}}; 719c929beaSShantappa Teekappanavar asyncResp->res.jsonValue["Cables"] = {{"@odata.id", "/redfish/v1/Cables"}}; 729629907dSNan Zhou 739629907dSNan Zhou nlohmann::json& protocolFeatures = 749629907dSNan Zhou asyncResp->res.jsonValue["ProtocolFeaturesSupported"]; 759629907dSNan Zhou protocolFeatures["ExcerptQuery"] = false; 769629907dSNan Zhou protocolFeatures["ExpandQuery"]["ExpandAll"] = false; 779629907dSNan Zhou protocolFeatures["ExpandQuery"]["Levels"] = false; 789629907dSNan Zhou protocolFeatures["ExpandQuery"]["Links"] = false; 799629907dSNan Zhou protocolFeatures["ExpandQuery"]["NoLinks"] = false; 809629907dSNan Zhou protocolFeatures["FilterQuery"] = false; 81*f4c99e70SEd Tanous protocolFeatures["OnlyMemberQuery"] = bmcwebInsecureEnableQueryParams; 829629907dSNan Zhou protocolFeatures["SelectQuery"] = false; 839629907dSNan Zhou protocolFeatures["DeepOperations"]["DeepPOST"] = false; 849629907dSNan Zhou protocolFeatures["DeepOperations"]["DeepPATCH"] = false; 858338891aSJohn Edward Broadbent } 868338891aSJohn Edward Broadbent 878338891aSJohn Edward Broadbent inline void requestRoutesServiceRoot(App& app) 888338891aSJohn Edward Broadbent { 898338891aSJohn Edward Broadbent BMCWEB_ROUTE(app, "/redfish/v1/") 908338891aSJohn Edward Broadbent .privileges(redfish::privileges::getServiceRoot) 918338891aSJohn Edward Broadbent .methods(boost::beast::http::verb::get)(handleServiceRootGet); 92b6df6dc7SBorawski.Lukasz } 933602e232SEd Tanous 94b6df6dc7SBorawski.Lukasz } // namespace redfish 95