blob: e755c8143bec40b88b8eaee9ca2eb6bfc56c6e51 [file] [log] [blame]
Borawski.Lukaszb6df6dc2018-01-24 10:20:45 +01001/*
Jason M. Bills70304cb2019-03-27 12:03:59 -07002// Copyright (c) 2018-2019 Intel Corporation
Borawski.Lukaszb6df6dc2018-01-24 10:20:45 +01003//
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
Lewanczyk, Dawid88d16c92018-02-02 14:51:09 +010018#include "../lib/account_service.hpp"
Carol Wangd82a3ac2019-11-21 13:56:38 +080019#include "../lib/bios.hpp"
Marri Devender Rao5968cae2019-01-21 10:27:12 -060020#include "../lib/certificate_service.hpp"
Jennifer Lee729dae72018-04-24 15:59:34 -070021#include "../lib/chassis.hpp"
22#include "../lib/ethernet.hpp"
AppaRao Pulie5aaf042020-03-20 01:05:52 +053023#include "../lib/event_service.hpp"
Ed Tanous1da66f72018-07-27 16:13:37 -070024#include "../lib/log_services.hpp"
Borawski.Lukasz9c3106852018-02-09 15:24:22 +010025#include "../lib/managers.hpp"
Gunnar Millsac6a4442020-10-14 14:55:29 -050026#include "../lib/memory.hpp"
Jason M. Bills70304cb2019-03-27 12:03:59 -070027#include "../lib/message_registries.hpp"
Wludzik, Jozef081ebf02020-04-27 17:24:15 +020028#include "../lib/metric_report.hpp"
29#include "../lib/metric_report_definition.hpp"
Borawski.Lukasz70141562018-01-24 12:45:29 +010030#include "../lib/network_protocol.hpp"
Jason M. Billsf5c9f8b2018-12-18 16:51:18 -080031#include "../lib/pcie.hpp"
Ed Tanous2474adf2018-09-05 16:31:16 -070032#include "../lib/power.hpp"
Gunnar Millsac6a4442020-10-14 14:55:29 -050033#include "../lib/processor.hpp"
Kowalski, Kamil2b7981f2018-01-31 13:24:59 +010034#include "../lib/redfish_sessions.hpp"
Lewanczyk, Dawid4e49bd42018-01-25 11:30:19 +010035#include "../lib/roles.hpp"
Anthony Wilson95a3eca2019-06-11 10:44:47 -050036#include "../lib/sensors.hpp"
Borawski.Lukaszb6df6dc2018-01-24 10:20:45 +010037#include "../lib/service_root.hpp"
Nikhil Potadea25aecc2019-08-23 16:35:26 -070038#include "../lib/storage.hpp"
Lewanczyk, Dawidc5b2abe2018-05-30 16:59:42 +020039#include "../lib/systems.hpp"
James Feist46229572020-02-19 15:11:58 -080040#include "../lib/task.hpp"
Wludzik, Jozef081ebf02020-04-27 17:24:15 +020041#include "../lib/telemetry_service.hpp"
Lewanczyk, Dawid08777fb2018-03-22 23:33:49 +010042#include "../lib/thermal.hpp"
Jennifer Lee729dae72018-04-24 15:59:34 -070043#include "../lib/update_service.hpp"
Przemyslaw Czarnowski107077d2019-07-11 10:16:43 +020044#ifdef BMCWEB_ENABLE_VM_NBDPROXY
45#include "../lib/virtual_media.hpp"
46#endif // BMCWEB_ENABLE_VM_NBDPROXY
Andrew Geisslerd5afb2c2021-01-12 15:48:20 -060047#include "../lib/hypervisor_system.hpp"
Borawski.Lukaszb6df6dc2018-01-24 10:20:45 +010048
Ed Tanous1abe55e2018-09-05 08:30:59 -070049namespace redfish
50{
Borawski.Lukaszb6df6dc2018-01-24 10:20:45 +010051/*
52 * @brief Top level class installing and providing Redfish services
53 */
Ed Tanous1abe55e2018-09-05 08:30:59 -070054class RedfishService
55{
56 public:
57 /*
58 * @brief Redfish service constructor
59 *
60 * Loads Redfish configuration and installs schema resources
61 *
62 * @param[in] app Crow app on which Redfish will initialize
63 */
Ed Tanous52cc1122020-07-18 13:51:21 -070064 RedfishService(App& app)
Ed Tanous1abe55e2018-09-05 08:30:59 -070065 {
Ed Tanous6c51eab2021-06-03 12:30:29 -070066 requestAccountServiceRoutes(app);
John Edward Broadbent7e860f12021-04-08 15:57:16 -070067 requestRoutesRoles(app);
68 requestRoutesRoleCollection(app);
69 requestRoutesServiceRoot(app);
70 requestRoutesNetworkProtocol(app);
Ed Tanousfaa34cc2021-06-03 13:27:02 -070071 requestRoutesSession(app);
Ed Tanous1abe55e2018-09-05 08:30:59 -070072 nodes.emplace_back(std::make_unique<EthernetCollection>(app));
73 nodes.emplace_back(std::make_unique<EthernetInterface>(app));
John Edward Broadbent7e860f12021-04-08 15:57:16 -070074 requestRoutesThermal(app);
75 requestRoutesManagerCollection(app);
76 requestRoutesManager(app);
77 requestRoutesManagerResetAction(app);
78 requestRoutesManagerResetActionInfo(app);
79 requestRoutesManagerResetToDefaultsAction(app);
80 requestRoutesPower(app);
81 requestRoutesChassisCollection(app);
82 requestRoutesChassis(app);
83 requestRoutesChassisResetAction(app);
84 requestRoutesChassisResetActionInfo(app);
85 requestRoutesUpdateService(app);
86 requestRoutesStorageCollection(app);
87 requestRoutesStorage(app);
88 requestRoutesDrive(app);
Andrew Geissler0554c982019-04-23 14:40:12 -050089#ifdef BMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE
John Edward Broadbent7e860f12021-04-08 15:57:16 -070090 requestRoutesUpdateServiceActionsSimpleUpdate(app);
Andrew Geissler0554c982019-04-23 14:40:12 -050091#endif
John Edward Broadbent7e860f12021-04-08 15:57:16 -070092 requestRoutesSoftwareInventoryCollection(app);
93 requestRoutesSoftwareInventory(app);
Ed Tanous1abe55e2018-09-05 08:30:59 -070094 nodes.emplace_back(
95 std::make_unique<VlanNetworkInterfaceCollection>(app));
Ed Tanousc70f1532018-11-02 15:56:47 -070096 nodes.emplace_back(std::make_unique<VlanNetworkInterface>(app));
Jason M. Billsc4bf6372018-11-05 13:48:27 -080097
John Edward Broadbent7e860f12021-04-08 15:57:16 -070098 requestRoutesSystemLogServiceCollection(app);
99 requestRoutesEventLogService(app);
ZhikuiRena3316fc2020-01-29 14:58:08 -0800100
John Edward Broadbent7e860f12021-04-08 15:57:16 -0700101 requestRoutesPostCodesLogService(app);
102 requestRoutesPostCodesClear(app);
103 requestRoutesPostCodesEntry(app);
104 requestRoutesPostCodesEntryCollection(app);
ZhikuiRena3316fc2020-01-29 14:58:08 -0800105
Asmitha Karunanithi5cb1dd22020-05-07 04:35:02 -0500106#ifdef BMCWEB_ENABLE_REDFISH_DUMP_LOG
John Edward Broadbent7e860f12021-04-08 15:57:16 -0700107 requestRoutesSystemDumpService(app);
108 requestRoutesSystemDumpEntryCollection(app);
109 requestRoutesSystemDumpEntry(app);
110 requestRoutesSystemDumpCreate(app);
111 requestRoutesSystemDumpClear(app);
Asmitha Karunanithi5cb1dd22020-05-07 04:35:02 -0500112
John Edward Broadbent7e860f12021-04-08 15:57:16 -0700113 requestRoutesBMCDumpService(app);
114 requestRoutesBMCDumpEntryCollection(app);
115 requestRoutesBMCDumpEntry(app);
116 requestRoutesBMCDumpCreate(app);
117 requestRoutesBMCDumpClear(app);
raviteja-bc9bb6862020-02-03 11:53:32 -0600118#endif
119
Anthony Wilson08a4e4b2019-04-12 08:23:05 -0500120#ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES
John Edward Broadbent7e860f12021-04-08 15:57:16 -0700121 requestRoutesJournalEventLogEntryCollection(app);
122 requestRoutesJournalEventLogEntry(app);
123 requestRoutesJournalEventLogClear(app);
Anthony Wilson08a4e4b2019-04-12 08:23:05 -0500124#endif
Jason M. Billsc4bf6372018-11-05 13:48:27 -0800125
John Edward Broadbent7e860f12021-04-08 15:57:16 -0700126 requestRoutesBMCLogServiceCollection(app);
Jason M. Billsc4bf6372018-11-05 13:48:27 -0800127#ifdef BMCWEB_ENABLE_REDFISH_BMC_JOURNAL
John Edward Broadbent7e860f12021-04-08 15:57:16 -0700128 requestRoutesBMCJournalLogService(app);
129 requestRoutesBMCJournalLogEntryCollection(app);
130 requestRoutesBMCJournalLogEntry(app);
Jason M. Billsc4bf6372018-11-05 13:48:27 -0800131#endif
Ed Tanous1da66f72018-07-27 16:13:37 -0700132
133#ifdef BMCWEB_ENABLE_REDFISH_CPU_LOG
John Edward Broadbent7e860f12021-04-08 15:57:16 -0700134 requestRoutesCrashdumpService(app);
135 requestRoutesCrashdumpEntryCollection(app);
136 requestRoutesCrashdumpEntry(app);
137 requestRoutesCrashdumpFile(app);
138 requestRoutesCrashdumpClear(app);
139 requestRoutesCrashdumpCollect(app);
Ed Tanous1da66f72018-07-27 16:13:37 -0700140#endif // BMCWEB_ENABLE_REDFISH_CPU_LOG
141
John Edward Broadbent7e860f12021-04-08 15:57:16 -0700142 requestRoutesProcessorCollection(app);
143 requestRoutesProcessor(app);
144 requestRoutesOperatingConfigCollection(app);
145 requestRoutesOperatingConfig(app);
146 requestRoutesMemoryCollection(app);
147 requestRoutesMemory(app);
Rapkiewicz, Pawel443c2932018-10-22 15:08:49 +0200148
John Edward Broadbent7e860f12021-04-08 15:57:16 -0700149 requestRoutesSystemsCollection(app);
150 requestRoutesSystems(app);
151 requestRoutesSystemActionsReset(app);
152 requestRoutesSystemResetActionInfo(app);
153 requestRoutesBiosService(app);
154 requestRoutesBiosReset(app);
Przemyslaw Czarnowski107077d2019-07-11 10:16:43 +0200155#ifdef BMCWEB_ENABLE_VM_NBDPROXY
156 nodes.emplace_back(std::make_unique<VirtualMedia>(app));
157 nodes.emplace_back(std::make_unique<VirtualMediaCollection>(app));
Przemyslaw Czarnowskie13c2762019-09-02 17:32:43 +0200158 nodes.emplace_back(
159 std::make_unique<VirtualMediaActionInsertMedia>(app));
160 nodes.emplace_back(std::make_unique<VirtualMediaActionEjectMedia>(app));
Przemyslaw Czarnowski107077d2019-07-11 10:16:43 +0200161#endif // BMCWEB_ENABLE_VM_NBDPROXY
Andrew Geisslercb92c032018-08-17 07:56:14 -0700162#ifdef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES
John Edward Broadbent7e860f12021-04-08 15:57:16 -0700163 requestRoutesDBusLogServiceActionsClear(app);
164 requestRoutesDBusEventLogEntryCollection(app);
165 requestRoutesDBusEventLogEntry(app);
166 requestRoutesDBusEventLogEntryDownload(app);
Andrew Geisslercb92c032018-08-17 07:56:14 -0700167#endif
Tanousf00032d2018-11-05 01:18:10 -0300168
John Edward Broadbent7e860f12021-04-08 15:57:16 -0700169 requestRoutesMessageRegistryFileCollection(app);
170 requestRoutesMessageRegistryFile(app);
171 requestRoutesMessageRegistry(app);
Anthony Wilson95a3eca2019-06-11 10:44:47 -0500172
John Edward Broadbent7e860f12021-04-08 15:57:16 -0700173 requestRoutesCertificateService(app);
174 requestRoutesCertificateActionGenerateCSR(app);
175 requestRoutesCertificateActionsReplaceCertificate(app);
176 requestRoutesHTTPSCertificate(app);
177 requestRoutesHTTPSCertificateCollection(app);
178 requestRoutesCertificateLocations(app);
179 requestRoutesLDAPCertificateCollection(app);
180 requestRoutesLDAPCertificate(app);
181 requestRoutesTrustStoreCertificateCollection(app);
182 requestRoutesTrustStoreCertificate(app);
Sunitha Harish462023a2020-02-19 08:34:59 -0600183
John Edward Broadbent7e860f12021-04-08 15:57:16 -0700184 requestRoutesSystemPCIeFunctionCollection(app);
185 requestRoutesSystemPCIeFunction(app);
186 requestRoutesSystemPCIeDeviceCollection(app);
187 requestRoutesSystemPCIeDevice(app);
Sunitha Harish462023a2020-02-19 08:34:59 -0600188
John Edward Broadbent7e860f12021-04-08 15:57:16 -0700189 requestRoutesSensorCollection(app);
190 requestRoutesSensor(app);
Sunitha Harish462023a2020-02-19 08:34:59 -0600191
John Edward Broadbent7e860f12021-04-08 15:57:16 -0700192 requestRoutesTaskMonitor(app);
193 requestRoutesTaskService(app);
194 requestRoutesTaskCollection(app);
195 requestRoutesTask(app);
196 requestRoutesEventService(app);
197 requestRoutesEventDestinationCollection(app);
198 requestRoutesEventDestination(app);
199 requestRoutesSubmitTestEvent(app);
200
201 requestRoutesHypervisorSystems(app);
202
203 requestRoutesTelemetryService(app);
204 requestRoutesMetricReportDefinitionCollection(app);
205 requestRoutesMetricReportDefinition(app);
206 requestRoutesMetricReportCollection(app);
207 requestRoutesMetricReport(app);
Wludzik, Jozef081ebf02020-04-27 17:24:15 +0200208
Tanousf00032d2018-11-05 01:18:10 -0300209 for (const auto& node : nodes)
210 {
211 node->initPrivileges();
212 }
Borawski.Lukaszc1a46bd2018-02-08 13:31:59 +0100213 }
Borawski.Lukaszb6df6dc2018-01-24 10:20:45 +0100214
Ed Tanous1abe55e2018-09-05 08:30:59 -0700215 private:
216 std::vector<std::unique_ptr<Node>> nodes;
Borawski.Lukaszb6df6dc2018-01-24 10:20:45 +0100217};
218
Ed Tanous1abe55e2018-09-05 08:30:59 -0700219} // namespace redfish