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