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/certificate_service.hpp" 20 #include "../lib/chassis.hpp" 21 #include "../lib/cpudimm.hpp" 22 #include "../lib/ethernet.hpp" 23 #include "../lib/log_services.hpp" 24 #include "../lib/managers.hpp" 25 #include "../lib/message_registries.hpp" 26 #include "../lib/network_protocol.hpp" 27 #include "../lib/pcie.hpp" 28 #include "../lib/power.hpp" 29 #include "../lib/redfish_sessions.hpp" 30 #include "../lib/roles.hpp" 31 #include "../lib/sensors.hpp" 32 #include "../lib/service_root.hpp" 33 #include "../lib/systems.hpp" 34 #include "../lib/thermal.hpp" 35 #include "../lib/update_service.hpp" 36 #include "webserver_common.hpp" 37 38 namespace redfish 39 { 40 /* 41 * @brief Top level class installing and providing Redfish services 42 */ 43 class RedfishService 44 { 45 public: 46 /* 47 * @brief Redfish service constructor 48 * 49 * Loads Redfish configuration and installs schema resources 50 * 51 * @param[in] app Crow app on which Redfish will initialize 52 */ 53 RedfishService(CrowApp& app) 54 { 55 nodes.emplace_back(std::make_unique<AccountService>(app)); 56 nodes.emplace_back(std::make_unique<AccountsCollection>(app)); 57 nodes.emplace_back(std::make_unique<ManagerAccount>(app)); 58 nodes.emplace_back(std::make_unique<SessionCollection>(app)); 59 nodes.emplace_back(std::make_unique<Roles>(app)); 60 nodes.emplace_back(std::make_unique<RoleCollection>(app)); 61 nodes.emplace_back(std::make_unique<ServiceRoot>(app)); 62 nodes.emplace_back(std::make_unique<NetworkProtocol>(app)); 63 nodes.emplace_back(std::make_unique<SessionService>(app)); 64 nodes.emplace_back(std::make_unique<EthernetCollection>(app)); 65 nodes.emplace_back(std::make_unique<EthernetInterface>(app)); 66 nodes.emplace_back(std::make_unique<Thermal>(app)); 67 nodes.emplace_back(std::make_unique<ManagerCollection>(app)); 68 nodes.emplace_back(std::make_unique<Manager>(app)); 69 nodes.emplace_back(std::make_unique<ManagerActionsReset>(app)); 70 nodes.emplace_back(std::make_unique<Power>(app)); 71 nodes.emplace_back(std::make_unique<ChassisCollection>(app)); 72 nodes.emplace_back(std::make_unique<Chassis>(app)); 73 nodes.emplace_back(std::make_unique<UpdateService>(app)); 74 #ifdef BMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE 75 nodes.emplace_back( 76 std::make_unique<UpdateServiceActionsSimpleUpdate>(app)); 77 #endif 78 nodes.emplace_back(std::make_unique<SoftwareInventoryCollection>(app)); 79 nodes.emplace_back(std::make_unique<SoftwareInventory>(app)); 80 nodes.emplace_back( 81 std::make_unique<VlanNetworkInterfaceCollection>(app)); 82 nodes.emplace_back(std::make_unique<VlanNetworkInterface>(app)); 83 84 nodes.emplace_back(std::make_unique<SystemLogServiceCollection>(app)); 85 nodes.emplace_back(std::make_unique<EventLogService>(app)); 86 nodes.emplace_back(std::make_unique<EventLogClear>(app)); 87 #ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES 88 nodes.emplace_back( 89 std::make_unique<JournalEventLogEntryCollection>(app)); 90 nodes.emplace_back(std::make_unique<JournalEventLogEntry>(app)); 91 #endif 92 93 nodes.emplace_back(std::make_unique<BMCLogServiceCollection>(app)); 94 #ifdef BMCWEB_ENABLE_REDFISH_BMC_JOURNAL 95 nodes.emplace_back(std::make_unique<BMCJournalLogService>(app)); 96 nodes.emplace_back(std::make_unique<BMCJournalLogEntryCollection>(app)); 97 nodes.emplace_back(std::make_unique<BMCJournalLogEntry>(app)); 98 #endif 99 100 #ifdef BMCWEB_ENABLE_REDFISH_CPU_LOG 101 nodes.emplace_back(std::make_unique<CrashdumpService>(app)); 102 nodes.emplace_back(std::make_unique<CrashdumpEntryCollection>(app)); 103 nodes.emplace_back(std::make_unique<CrashdumpEntry>(app)); 104 nodes.emplace_back(std::make_unique<OnDemandCrashdump>(app)); 105 #ifdef BMCWEB_ENABLE_REDFISH_RAW_PECI 106 nodes.emplace_back(std::make_unique<SendRawPECI>(app)); 107 #endif // BMCWEB_ENABLE_REDFISH_RAW_PECI 108 #endif // BMCWEB_ENABLE_REDFISH_CPU_LOG 109 110 nodes.emplace_back(std::make_unique<ProcessorCollection>(app)); 111 nodes.emplace_back(std::make_unique<Processor>(app)); 112 nodes.emplace_back(std::make_unique<MemoryCollection>(app)); 113 nodes.emplace_back(std::make_unique<Memory>(app)); 114 115 nodes.emplace_back(std::make_unique<SystemsCollection>(app)); 116 nodes.emplace_back(std::make_unique<Systems>(app)); 117 nodes.emplace_back(std::make_unique<SystemActionsReset>(app)); 118 #ifdef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES 119 nodes.emplace_back(std::make_unique<DBusLogServiceActionsClear>(app)); 120 nodes.emplace_back(std::make_unique<DBusEventLogEntryCollection>(app)); 121 nodes.emplace_back(std::make_unique<DBusEventLogEntry>(app)); 122 #endif 123 124 nodes.emplace_back( 125 std::make_unique<MessageRegistryFileCollection>(app)); 126 nodes.emplace_back(std::make_unique<BaseMessageRegistryFile>(app)); 127 nodes.emplace_back(std::make_unique<BaseMessageRegistry>(app)); 128 nodes.emplace_back(std::make_unique<OpenBMCMessageRegistryFile>(app)); 129 nodes.emplace_back(std::make_unique<OpenBMCMessageRegistry>(app)); 130 nodes.emplace_back(std::make_unique<CertificateService>(app)); 131 nodes.emplace_back( 132 std::make_unique<CertificateActionsReplaceCertificate>(app)); 133 nodes.emplace_back(std::make_unique<CertificateLocations>(app)); 134 nodes.emplace_back(std::make_unique<HTTPSCertificateCollection>(app)); 135 nodes.emplace_back(std::make_unique<HTTPSCertificate>(app)); 136 nodes.emplace_back(std::make_unique<LDAPCertificateCollection>(app)); 137 nodes.emplace_back(std::make_unique<LDAPCertificate>(app)); 138 nodes.emplace_back(std::make_unique<CertificateActionGenerateCSR>(app)); 139 nodes.emplace_back( 140 std::make_unique<TrustStoreCertificateCollection>(app)); 141 nodes.emplace_back(std::make_unique<TrustStoreCertificate>(app)); 142 nodes.emplace_back(std::make_unique<SystemPCIeFunction>(app)); 143 nodes.emplace_back(std::make_unique<SystemPCIeDevice>(app)); 144 145 nodes.emplace_back(std::make_unique<SensorCollection>(app)); 146 nodes.emplace_back(std::make_unique<Sensor>(app)); 147 for (const auto& node : nodes) 148 { 149 node->initPrivileges(); 150 } 151 } 152 153 private: 154 std::vector<std::unique_ptr<Node>> nodes; 155 }; 156 157 } // namespace redfish 158