1 /*
2 // Copyright (c) 2018-2019 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 
18 #include "account_service.hpp"
19 #include "aggregation_service.hpp"
20 #include "bios.hpp"
21 #include "cable.hpp"
22 #include "certificate_service.hpp"
23 #include "chassis.hpp"
24 #include "environment_metrics.hpp"
25 #include "ethernet.hpp"
26 #include "event_service.hpp"
27 #include "eventservice_sse.hpp"
28 #include "fabric_adapters.hpp"
29 #include "fan.hpp"
30 #include "hypervisor_system.hpp"
31 #include "log_services.hpp"
32 #include "manager_diagnostic_data.hpp"
33 #include "managers.hpp"
34 #include "memory.hpp"
35 #include "message_registries.hpp"
36 #include "metric_report.hpp"
37 #include "metric_report_definition.hpp"
38 #include "network_protocol.hpp"
39 #include "pcie.hpp"
40 #include "pcie_slots.hpp"
41 #include "power.hpp"
42 #include "power_subsystem.hpp"
43 #include "power_supply.hpp"
44 #include "processor.hpp"
45 #include "redfish_sessions.hpp"
46 #include "redfish_v1.hpp"
47 #include "roles.hpp"
48 #include "sensors.hpp"
49 #include "service_root.hpp"
50 #include "storage.hpp"
51 #include "systems.hpp"
52 #include "task.hpp"
53 #include "telemetry_service.hpp"
54 #include "thermal.hpp"
55 #include "thermal_metrics.hpp"
56 #include "thermal_subsystem.hpp"
57 #include "trigger.hpp"
58 #include "update_service.hpp"
59 #include "virtual_media.hpp"
60 
61 namespace redfish
62 {
63 /*
64  * @brief Top level class installing and providing Redfish services
65  */
66 class RedfishService
67 {
68   public:
69     /*
70      * @brief Redfish service constructor
71      *
72      * Loads Redfish configuration and installs schema resources
73      *
74      * @param[in] app   Crow app on which Redfish will initialize
75      */
76     explicit RedfishService(App& app)
77     {
78         requestAccountServiceRoutes(app);
79 #ifdef BMCWEB_ENABLE_REDFISH_AGGREGATION
80         requestRoutesAggregationService(app);
81         requestRoutesAggregationSourceCollection(app);
82         requestRoutesAggregationSource(app);
83 #endif
84         requestRoutesRoles(app);
85         requestRoutesRoleCollection(app);
86         requestRoutesServiceRoot(app);
87         requestRoutesNetworkProtocol(app);
88         requestRoutesSession(app);
89         requestEthernetInterfacesRoutes(app);
90 #ifdef BMCWEB_ALLOW_DEPRECATED_POWER_THERMAL
91         requestRoutesThermal(app);
92         requestRoutesPower(app);
93 #endif
94 #ifdef BMCWEB_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM
95         requestRoutesEnvironmentMetrics(app);
96         requestRoutesPowerSubsystem(app);
97         requestRoutesPowerSupply(app);
98         requestRoutesPowerSupplyCollection(app);
99         requestRoutesThermalMetrics(app);
100         requestRoutesThermalSubsystem(app);
101         requestRoutesFan(app);
102         requestRoutesFanCollection(app);
103 #endif
104         requestRoutesManagerCollection(app);
105         requestRoutesManager(app);
106         requestRoutesManagerResetAction(app);
107         requestRoutesManagerResetActionInfo(app);
108         requestRoutesManagerResetToDefaultsAction(app);
109         requestRoutesManagerDiagnosticData(app);
110         requestRoutesChassisCollection(app);
111         requestRoutesChassis(app);
112         requestRoutesChassisResetAction(app);
113         requestRoutesChassisResetActionInfo(app);
114         requestRoutesChassisDrive(app);
115         requestRoutesChassisDriveName(app);
116         requestRoutesUpdateService(app);
117         requestRoutesStorageCollection(app);
118         requestRoutesStorage(app);
119         requestRoutesStorageControllerCollection(app);
120         requestRoutesStorageController(app);
121         requestRoutesDrive(app);
122         requestRoutesCable(app);
123         requestRoutesCableCollection(app);
124 #ifdef BMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE
125         requestRoutesUpdateServiceActionsSimpleUpdate(app);
126 #endif
127         requestRoutesSoftwareInventoryCollection(app);
128         requestRoutesSoftwareInventory(app);
129 
130         requestRoutesSystemLogServiceCollection(app);
131         requestRoutesEventLogService(app);
132         requestRoutesPostCodesEntryAdditionalData(app);
133 
134         requestRoutesPostCodesLogService(app);
135         requestRoutesPostCodesClear(app);
136         requestRoutesPostCodesEntry(app);
137         requestRoutesPostCodesEntryCollection(app);
138 
139 #ifdef BMCWEB_ENABLE_REDFISH_DUMP_LOG
140         requestRoutesSystemDumpService(app);
141         requestRoutesSystemDumpEntryCollection(app);
142         requestRoutesSystemDumpEntry(app);
143         requestRoutesSystemDumpCreate(app);
144         requestRoutesSystemDumpClear(app);
145 
146         requestRoutesBMCDumpService(app);
147         requestRoutesBMCDumpEntryCollection(app);
148         requestRoutesBMCDumpEntry(app);
149         requestRoutesBMCDumpEntryDownload(app);
150         requestRoutesBMCDumpCreate(app);
151         requestRoutesBMCDumpClear(app);
152 
153         requestRoutesFaultLogDumpService(app);
154         requestRoutesFaultLogDumpEntryCollection(app);
155         requestRoutesFaultLogDumpEntry(app);
156         requestRoutesFaultLogDumpClear(app);
157 #endif
158 
159 #ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES
160         requestRoutesJournalEventLogEntryCollection(app);
161         requestRoutesJournalEventLogEntry(app);
162         requestRoutesJournalEventLogClear(app);
163 #endif
164 
165         requestRoutesBMCLogServiceCollection(app);
166 #ifdef BMCWEB_ENABLE_REDFISH_BMC_JOURNAL
167         requestRoutesBMCJournalLogService(app);
168         requestRoutesBMCJournalLogEntryCollection(app);
169         requestRoutesBMCJournalLogEntry(app);
170 #endif
171 
172 #ifdef BMCWEB_ENABLE_REDFISH_CPU_LOG
173         requestRoutesCrashdumpService(app);
174         requestRoutesCrashdumpEntryCollection(app);
175         requestRoutesCrashdumpEntry(app);
176         requestRoutesCrashdumpFile(app);
177         requestRoutesCrashdumpClear(app);
178         requestRoutesCrashdumpCollect(app);
179 #endif // BMCWEB_ENABLE_REDFISH_CPU_LOG
180 
181         requestRoutesProcessorCollection(app);
182         requestRoutesProcessor(app);
183         requestRoutesOperatingConfigCollection(app);
184         requestRoutesOperatingConfig(app);
185         requestRoutesMemoryCollection(app);
186         requestRoutesMemory(app);
187 
188         requestRoutesSystems(app);
189 
190         requestRoutesBiosService(app);
191         requestRoutesBiosReset(app);
192 
193 #ifdef BMCWEB_ENABLE_VM_NBDPROXY
194         requestNBDVirtualMediaRoutes(app);
195 #endif // BMCWEB_ENABLE_VM_NBDPROXY
196 
197 #ifdef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES
198         requestRoutesDBusLogServiceActionsClear(app);
199         requestRoutesDBusEventLogEntryCollection(app);
200         requestRoutesDBusEventLogEntry(app);
201         requestRoutesDBusEventLogEntryDownload(app);
202 #endif
203 
204 #ifdef BMCWEB_ENABLE_REDFISH_HOST_LOGGER
205         requestRoutesSystemHostLogger(app);
206         requestRoutesSystemHostLoggerCollection(app);
207         requestRoutesSystemHostLoggerLogEntry(app);
208 #endif
209 
210         requestRoutesMessageRegistryFileCollection(app);
211         requestRoutesMessageRegistryFile(app);
212         requestRoutesMessageRegistry(app);
213 
214         requestRoutesCertificateService(app);
215         requestRoutesHTTPSCertificate(app);
216         requestRoutesLDAPCertificate(app);
217         requestRoutesTrustStoreCertificate(app);
218 
219         requestRoutesSystemPCIeFunctionCollection(app);
220         requestRoutesSystemPCIeFunction(app);
221         requestRoutesSystemPCIeDeviceCollection(app);
222         requestRoutesSystemPCIeDevice(app);
223 
224         requestRoutesSensorCollection(app);
225         requestRoutesSensor(app);
226 
227         requestRoutesTaskMonitor(app);
228         requestRoutesTaskService(app);
229         requestRoutesTaskCollection(app);
230         requestRoutesTask(app);
231         requestRoutesEventService(app);
232         requestRoutesEventServiceSse(app);
233         requestRoutesEventDestinationCollection(app);
234         requestRoutesEventDestination(app);
235         requestRoutesFabricAdapters(app);
236         requestRoutesFabricAdapterCollection(app);
237         requestRoutesSubmitTestEvent(app);
238 
239         requestRoutesHypervisorSystems(app);
240 
241         requestRoutesTelemetryService(app);
242         requestRoutesMetricReportDefinitionCollection(app);
243         requestRoutesMetricReportDefinition(app);
244         requestRoutesMetricReportCollection(app);
245         requestRoutesMetricReport(app);
246         requestRoutesTriggerCollection(app);
247         requestRoutesTrigger(app);
248 
249         // Note, this must be the last route registered
250         requestRoutesRedfish(app);
251     }
252 };
253 
254 } // namespace redfish
255