blob: 63cc2109ea5d82ce4e6fe01b1d8714e7af53ea93 [file] [log] [blame]
Borawski.Lukaszb6df6dc2018-01-24 10:20:45 +01001/*
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
John Edward Broadbent7e860f12021-04-08 15:57:16 -070018#include <app.hpp>
John Edward Broadbent83388912021-06-29 10:46:46 -070019#include <persistent_data.hpp>
Ed Tanoused398212021-06-09 17:05:54 -070020#include <registries/privilege_registry.hpp>
Bernard Wong7bffdb72019-03-20 16:17:21 +080021#include <utils/systemd_utils.hpp>
Borawski.Lukaszb6df6dc2018-01-24 10:20:45 +010022
Ed Tanous1abe55e2018-09-05 08:30:59 -070023namespace redfish
24{
Ed Tanous3ebd75f2018-03-05 18:20:01 -080025
John Edward Broadbent83388912021-06-29 10:46:46 -070026inline void
27 handleServiceRootGet(const crow::Request&,
28 const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
29{
30
31 std::string uuid = persistent_data::getConfig().systemUuid;
32 asyncResp->res.jsonValue["@odata.type"] = "#ServiceRoot.v1_5_0.ServiceRoot";
33 asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1";
34 asyncResp->res.jsonValue["Id"] = "RootService";
35 asyncResp->res.jsonValue["Name"] = "Root Service";
36 asyncResp->res.jsonValue["RedfishVersion"] = "1.9.0";
37 asyncResp->res.jsonValue["Links"]["Sessions"] = {
38 {"@odata.id", "/redfish/v1/SessionService/Sessions"}};
39 asyncResp->res.jsonValue["AccountService"] = {
40 {"@odata.id", "/redfish/v1/AccountService"}};
41 asyncResp->res.jsonValue["Chassis"] = {
42 {"@odata.id", "/redfish/v1/Chassis"}};
43 asyncResp->res.jsonValue["JsonSchemas"] = {
44 {"@odata.id", "/redfish/v1/JsonSchemas"}};
45 asyncResp->res.jsonValue["Managers"] = {
46 {"@odata.id", "/redfish/v1/Managers"}};
47 asyncResp->res.jsonValue["SessionService"] = {
48 {"@odata.id", "/redfish/v1/SessionService"}};
49 asyncResp->res.jsonValue["Systems"] = {
50 {"@odata.id", "/redfish/v1/Systems"}};
51 asyncResp->res.jsonValue["Registries"] = {
52 {"@odata.id", "/redfish/v1/Registries"}};
53
54 asyncResp->res.jsonValue["UpdateService"] = {
55 {"@odata.id", "/redfish/v1/UpdateService"}};
56 asyncResp->res.jsonValue["UUID"] = uuid;
57 asyncResp->res.jsonValue["CertificateService"] = {
58 {"@odata.id", "/redfish/v1/CertificateService"}};
59 asyncResp->res.jsonValue["Tasks"] = {
60 {"@odata.id", "/redfish/v1/TaskService"}};
61 asyncResp->res.jsonValue["EventService"] = {
62 {"@odata.id", "/redfish/v1/EventService"}};
63 asyncResp->res.jsonValue["TelemetryService"] = {
64 {"@odata.id", "/redfish/v1/TelemetryService"}};
65}
66
John Edward Broadbent7e860f12021-04-08 15:57:16 -070067inline void requestRoutesServiceRoot(App& app)
Ed Tanous1abe55e2018-09-05 08:30:59 -070068{
John Edward Broadbent7e860f12021-04-08 15:57:16 -070069 BMCWEB_ROUTE(app, "/redfish/v1/")
Ed Tanoused398212021-06-09 17:05:54 -070070 .privileges(redfish::privileges::getServiceRoot)
John Edward Broadbent83388912021-06-29 10:46:46 -070071 .methods(boost::beast::http::verb::get)(handleServiceRootGet);
John Edward Broadbent7e860f12021-04-08 15:57:16 -070072}
Borawski.Lukaszb6df6dc2018-01-24 10:20:45 +010073
Ed Tanous1abe55e2018-09-05 08:30:59 -070074} // namespace redfish