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 "../lib/account_service.hpp" 19 #include "../lib/bios.hpp" 20 #include "../lib/certificate_service.hpp" 21 #include "../lib/chassis.hpp" 22 #include "../lib/ethernet.hpp" 23 #include "../lib/event_service.hpp" 24 #include "../lib/log_services.hpp" 25 #include "../lib/managers.hpp" 26 #include "../lib/memory.hpp" 27 #include "../lib/message_registries.hpp" 28 #include "../lib/metric_report.hpp" 29 #include "../lib/metric_report_definition.hpp" 30 #include "../lib/network_protocol.hpp" 31 #include "../lib/pcie.hpp" 32 #include "../lib/power.hpp" 33 #include "../lib/processor.hpp" 34 #include "../lib/redfish_sessions.hpp" 35 #include "../lib/roles.hpp" 36 #include "../lib/sensors.hpp" 37 #include "../lib/service_root.hpp" 38 #include "../lib/storage.hpp" 39 #include "../lib/systems.hpp" 40 #include "../lib/task.hpp" 41 #include "../lib/telemetry_service.hpp" 42 #include "../lib/thermal.hpp" 43 #include "../lib/update_service.hpp" 44 #ifdef BMCWEB_ENABLE_VM_NBDPROXY 45 #include "../lib/virtual_media.hpp" 46 #endif // BMCWEB_ENABLE_VM_NBDPROXY 47 #include "../lib/hypervisor_system.hpp" 48 49 namespace redfish 50 { 51 /* 52 * @brief Top level class installing and providing Redfish services 53 */ 54 class 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 */ 64 RedfishService(App& app) 65 { 66 nodes.emplace_back(std::make_unique<AccountService>(app)); 67 nodes.emplace_back(std::make_unique<AccountsCollection>(app)); 68 nodes.emplace_back(std::make_unique<ManagerAccount>(app)); 69 nodes.emplace_back(std::make_unique<SessionCollection>(app)); 70 nodes.emplace_back(std::make_unique<Roles>(app)); 71 nodes.emplace_back(std::make_unique<RoleCollection>(app)); 72 nodes.emplace_back(std::make_unique<ServiceRoot>(app)); 73 nodes.emplace_back(std::make_unique<NetworkProtocol>(app)); 74 nodes.emplace_back(std::make_unique<SessionService>(app)); 75 nodes.emplace_back(std::make_unique<EthernetCollection>(app)); 76 nodes.emplace_back(std::make_unique<EthernetInterface>(app)); 77 nodes.emplace_back(std::make_unique<Thermal>(app)); 78 nodes.emplace_back(std::make_unique<ManagerCollection>(app)); 79 nodes.emplace_back(std::make_unique<Manager>(app)); 80 nodes.emplace_back(std::make_unique<ManagerResetAction>(app)); 81 nodes.emplace_back(std::make_unique<ManagerResetActionInfo>(app)); 82 nodes.emplace_back(std::make_unique<ManagerResetToDefaultsAction>(app)); 83 nodes.emplace_back(std::make_unique<Power>(app)); 84 nodes.emplace_back(std::make_unique<ChassisCollection>(app)); 85 nodes.emplace_back(std::make_unique<Chassis>(app)); 86 nodes.emplace_back(std::make_unique<ChassisResetAction>(app)); 87 nodes.emplace_back(std::make_unique<ChassisResetActionInfo>(app)); 88 nodes.emplace_back(std::make_unique<UpdateService>(app)); 89 nodes.emplace_back(std::make_unique<StorageCollection>(app)); 90 nodes.emplace_back(std::make_unique<Storage>(app)); 91 nodes.emplace_back(std::make_unique<Drive>(app)); 92 #ifdef BMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE 93 nodes.emplace_back( 94 std::make_unique<UpdateServiceActionsSimpleUpdate>(app)); 95 #endif 96 nodes.emplace_back(std::make_unique<SoftwareInventoryCollection>(app)); 97 nodes.emplace_back(std::make_unique<SoftwareInventory>(app)); 98 nodes.emplace_back( 99 std::make_unique<VlanNetworkInterfaceCollection>(app)); 100 nodes.emplace_back(std::make_unique<VlanNetworkInterface>(app)); 101 102 nodes.emplace_back(std::make_unique<SystemLogServiceCollection>(app)); 103 nodes.emplace_back(std::make_unique<EventLogService>(app)); 104 105 nodes.emplace_back(std::make_unique<PostCodesLogService>(app)); 106 nodes.emplace_back(std::make_unique<PostCodesClear>(app)); 107 nodes.emplace_back(std::make_unique<PostCodesEntry>(app)); 108 nodes.emplace_back(std::make_unique<PostCodesEntryCollection>(app)); 109 110 #ifdef BMCWEB_ENABLE_REDFISH_DUMP_LOG 111 nodes.emplace_back(std::make_unique<SystemDumpService>(app)); 112 nodes.emplace_back(std::make_unique<SystemDumpEntryCollection>(app)); 113 nodes.emplace_back(std::make_unique<SystemDumpEntry>(app)); 114 nodes.emplace_back(std::make_unique<SystemDumpCreate>(app)); 115 nodes.emplace_back(std::make_unique<SystemDumpClear>(app)); 116 117 nodes.emplace_back(std::make_unique<BMCDumpService>(app)); 118 nodes.emplace_back(std::make_unique<BMCDumpEntryCollection>(app)); 119 nodes.emplace_back(std::make_unique<BMCDumpEntry>(app)); 120 nodes.emplace_back(std::make_unique<BMCDumpCreate>(app)); 121 nodes.emplace_back(std::make_unique<BMCDumpClear>(app)); 122 #endif 123 124 #ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES 125 nodes.emplace_back( 126 std::make_unique<JournalEventLogEntryCollection>(app)); 127 nodes.emplace_back(std::make_unique<JournalEventLogEntry>(app)); 128 nodes.emplace_back(std::make_unique<JournalEventLogClear>(app)); 129 #endif 130 131 nodes.emplace_back(std::make_unique<BMCLogServiceCollection>(app)); 132 #ifdef BMCWEB_ENABLE_REDFISH_BMC_JOURNAL 133 nodes.emplace_back(std::make_unique<BMCJournalLogService>(app)); 134 nodes.emplace_back(std::make_unique<BMCJournalLogEntryCollection>(app)); 135 nodes.emplace_back(std::make_unique<BMCJournalLogEntry>(app)); 136 #endif 137 138 #ifdef BMCWEB_ENABLE_REDFISH_CPU_LOG 139 nodes.emplace_back(std::make_unique<CrashdumpService>(app)); 140 nodes.emplace_back(std::make_unique<CrashdumpEntryCollection>(app)); 141 nodes.emplace_back(std::make_unique<CrashdumpEntry>(app)); 142 nodes.emplace_back(std::make_unique<CrashdumpFile>(app)); 143 nodes.emplace_back(std::make_unique<CrashdumpClear>(app)); 144 nodes.emplace_back(std::make_unique<OnDemandCrashdump>(app)); 145 nodes.emplace_back(std::make_unique<TelemetryCrashdump>(app)); 146 #ifdef BMCWEB_ENABLE_REDFISH_RAW_PECI 147 nodes.emplace_back(std::make_unique<SendRawPECI>(app)); 148 #endif // BMCWEB_ENABLE_REDFISH_RAW_PECI 149 #endif // BMCWEB_ENABLE_REDFISH_CPU_LOG 150 151 nodes.emplace_back(std::make_unique<ProcessorCollection>(app)); 152 nodes.emplace_back(std::make_unique<Processor>(app)); 153 nodes.emplace_back(std::make_unique<OperatingConfigCollection>(app)); 154 nodes.emplace_back(std::make_unique<OperatingConfig>(app)); 155 nodes.emplace_back(std::make_unique<MemoryCollection>(app)); 156 nodes.emplace_back(std::make_unique<Memory>(app)); 157 158 nodes.emplace_back(std::make_unique<SystemsCollection>(app)); 159 nodes.emplace_back(std::make_unique<Systems>(app)); 160 nodes.emplace_back(std::make_unique<SystemActionsReset>(app)); 161 nodes.emplace_back(std::make_unique<SystemResetActionInfo>(app)); 162 nodes.emplace_back(std::make_unique<BiosService>(app)); 163 nodes.emplace_back(std::make_unique<BiosReset>(app)); 164 #ifdef BMCWEB_ENABLE_VM_NBDPROXY 165 nodes.emplace_back(std::make_unique<VirtualMedia>(app)); 166 nodes.emplace_back(std::make_unique<VirtualMediaCollection>(app)); 167 nodes.emplace_back( 168 std::make_unique<VirtualMediaActionInsertMedia>(app)); 169 nodes.emplace_back(std::make_unique<VirtualMediaActionEjectMedia>(app)); 170 #endif // BMCWEB_ENABLE_VM_NBDPROXY 171 #ifdef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES 172 nodes.emplace_back(std::make_unique<DBusLogServiceActionsClear>(app)); 173 nodes.emplace_back(std::make_unique<DBusEventLogEntryCollection>(app)); 174 nodes.emplace_back(std::make_unique<DBusEventLogEntry>(app)); 175 #endif 176 177 nodes.emplace_back( 178 std::make_unique<MessageRegistryFileCollection>(app)); 179 nodes.emplace_back(std::make_unique<MessageRegistryFile>(app)); 180 nodes.emplace_back(std::make_unique<MessageRegistry>(app)); 181 nodes.emplace_back(std::make_unique<CertificateService>(app)); 182 nodes.emplace_back( 183 std::make_unique<CertificateActionsReplaceCertificate>(app)); 184 nodes.emplace_back(std::make_unique<CertificateLocations>(app)); 185 nodes.emplace_back(std::make_unique<HTTPSCertificateCollection>(app)); 186 nodes.emplace_back(std::make_unique<HTTPSCertificate>(app)); 187 nodes.emplace_back(std::make_unique<LDAPCertificateCollection>(app)); 188 nodes.emplace_back(std::make_unique<LDAPCertificate>(app)); 189 nodes.emplace_back(std::make_unique<CertificateActionGenerateCSR>(app)); 190 nodes.emplace_back( 191 std::make_unique<TrustStoreCertificateCollection>(app)); 192 nodes.emplace_back(std::make_unique<TrustStoreCertificate>(app)); 193 nodes.emplace_back(std::make_unique<SystemPCIeFunctionCollection>(app)); 194 nodes.emplace_back(std::make_unique<SystemPCIeFunction>(app)); 195 nodes.emplace_back(std::make_unique<SystemPCIeDeviceCollection>(app)); 196 nodes.emplace_back(std::make_unique<SystemPCIeDevice>(app)); 197 198 nodes.emplace_back(std::make_unique<SensorCollection>(app)); 199 nodes.emplace_back(std::make_unique<Sensor>(app)); 200 201 nodes.emplace_back(std::make_unique<TaskMonitor>(app)); 202 nodes.emplace_back(std::make_unique<TaskService>(app)); 203 nodes.emplace_back(std::make_unique<TaskCollection>(app)); 204 nodes.emplace_back(std::make_unique<Task>(app)); 205 nodes.emplace_back(std::make_unique<EventService>(app)); 206 nodes.emplace_back(std::make_unique<EventDestinationCollection>(app)); 207 nodes.emplace_back(std::make_unique<EventDestination>(app)); 208 nodes.emplace_back(std::make_unique<SubmitTestEvent>(app)); 209 210 nodes.emplace_back( 211 std::make_unique<HypervisorInterfaceCollection>(app)); 212 nodes.emplace_back(std::make_unique<HypervisorInterface>(app)); 213 nodes.emplace_back(std::make_unique<HypervisorSystem>(app)); 214 215 nodes.emplace_back(std::make_unique<TelemetryService>(app)); 216 nodes.emplace_back( 217 std::make_unique<MetricReportDefinitionCollection>(app)); 218 nodes.emplace_back(std::make_unique<MetricReportDefinition>(app)); 219 nodes.emplace_back(std::make_unique<MetricReportCollection>(app)); 220 nodes.emplace_back(std::make_unique<MetricReport>(app)); 221 222 for (const auto& node : nodes) 223 { 224 node->initPrivileges(); 225 } 226 } 227 228 private: 229 std::vector<std::unique_ptr<Node>> nodes; 230 }; 231 232 } // namespace redfish 233