xref: /openbmc/bmcweb/features/redfish/include/redfish.hpp (revision 08777fb0eca7e0c3f52aeb829a9b8f4fa0bbdb73)
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 
1888d16c9aSLewanczyk, Dawid #include "../lib/account_service.hpp"
199c310685SBorawski.Lukasz #include "../lib/managers.hpp"
2070141561SBorawski.Lukasz #include "../lib/network_protocol.hpp"
212b7981f6SKowalski, Kamil #include "../lib/redfish_sessions.hpp"
224e49bd4bSLewanczyk, Dawid #include "../lib/roles.hpp"
23b6df6dc7SBorawski.Lukasz #include "../lib/service_root.hpp"
249391bb9cSRapkiewicz, Pawel #include "../lib/ethernet.hpp"
25*08777fb0SLewanczyk, Dawid #include "../lib/thermal.hpp"
26e37f8451SRapkiewicz, Pawel #include "../lib/chassis.hpp"
27c1a46bd2SBorawski.Lukasz #include "webserver_common.hpp"
28b6df6dc7SBorawski.Lukasz 
29b6df6dc7SBorawski.Lukasz namespace redfish {
30b6df6dc7SBorawski.Lukasz /*
31b6df6dc7SBorawski.Lukasz  * @brief Top level class installing and providing Redfish services
32b6df6dc7SBorawski.Lukasz  */
33b6df6dc7SBorawski.Lukasz class RedfishService {
34b6df6dc7SBorawski.Lukasz  public:
35b6df6dc7SBorawski.Lukasz   /*
36b6df6dc7SBorawski.Lukasz    * @brief Redfish service constructor
37b6df6dc7SBorawski.Lukasz    *
38b6df6dc7SBorawski.Lukasz    * Loads Redfish configuration and installs schema resources
39b6df6dc7SBorawski.Lukasz    *
40b6df6dc7SBorawski.Lukasz    * @param[in] app   Crow app on which Redfish will initialize
41b6df6dc7SBorawski.Lukasz    */
42b6df6dc7SBorawski.Lukasz   RedfishService(CrowApp& app) {
4343a095abSBorawski.Lukasz     nodes.emplace_back(std::make_unique<AccountService>(app));
4443a095abSBorawski.Lukasz     nodes.emplace_back(std::make_unique<SessionCollection>(app));
4543a095abSBorawski.Lukasz     nodes.emplace_back(std::make_unique<Roles>(app));
4643a095abSBorawski.Lukasz     nodes.emplace_back(std::make_unique<RoleCollection>(app));
4743a095abSBorawski.Lukasz     nodes.emplace_back(std::make_unique<ServiceRoot>(app));
4870141561SBorawski.Lukasz     nodes.emplace_back(std::make_unique<NetworkProtocol>(app));
495d27b854SBorawski.Lukasz     nodes.emplace_back(std::make_unique<SessionService>(app));
509391bb9cSRapkiewicz, Pawel     nodes.emplace_back(std::make_unique<EthernetCollection>(app));
519391bb9cSRapkiewicz, Pawel     nodes.emplace_back(std::make_unique<EthernetInterface>(app));
52*08777fb0SLewanczyk, Dawid     nodes.emplace_back(std::make_unique<Thermal>(app));
539c310685SBorawski.Lukasz     nodes.emplace_back(std::make_unique<ManagerCollection>(app));
54e37f8451SRapkiewicz, Pawel     nodes.emplace_back(std::make_unique<ChassisCollection>(app));
55e37f8451SRapkiewicz, Pawel     nodes.emplace_back(std::make_unique<Chassis>(app));
56c1a46bd2SBorawski.Lukasz 
57c1a46bd2SBorawski.Lukasz     for (auto& node : nodes) {
58c1a46bd2SBorawski.Lukasz       node->getSubRoutes(nodes);
59c1a46bd2SBorawski.Lukasz     }
60b6df6dc7SBorawski.Lukasz   }
61b6df6dc7SBorawski.Lukasz 
62b6df6dc7SBorawski.Lukasz  private:
634e49bd4bSLewanczyk, Dawid   std::vector<std::unique_ptr<Node>> nodes;
64b6df6dc7SBorawski.Lukasz };
65b6df6dc7SBorawski.Lukasz 
66b6df6dc7SBorawski.Lukasz }  // namespace redfish
67