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