| /* |
| // Copyright (c) 2018 Intel Corporation |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| */ |
| #pragma once |
| |
| #include "app.hpp" |
| #include "query.hpp" |
| |
| #include <cstdint> |
| |
| namespace redfish |
| { |
| |
| using BootTimeCheckpoint = std::tuple<std::string, int64_t, int64_t>; |
| using BootTimeDuration = std::tuple<std::string, int64_t>; |
| |
| enum class DumpType : std::uint8_t |
| { |
| BMC_DUMP = 0, |
| SYSTEM_DUMP, |
| BMC_FAULT_LOG, |
| SYSTEM_FAULT_LOG, |
| }; |
| |
| enum class LogParseError : std::uint8_t |
| { |
| success, |
| parseFailed, |
| messageIdNotInRegistry, |
| }; |
| |
| // The index of the string is the integer value of the DumpType enum |
| constexpr std::array<std::string_view, 4> dumpTypeStrings{ |
| {"BMC", "System", "FaultLog", "FaultLog"}}; |
| |
| struct Dump |
| { |
| DumpType type = DumpType::BMC_DUMP; |
| std::optional<std::string> systemName = std::nullopt; |
| }; |
| |
| enum class BootTimeDataType : std::uint8_t |
| { |
| CHECKPOINT, |
| DURATION, |
| STATISTIC |
| }; |
| |
| constexpr std::array<std::string_view, 3> bootTimeDataTypeString{ |
| {"Checkpoint", "Duration", "Statistic"}}; |
| |
| std::string dumpTypeToString(DumpType dumpType); |
| |
| inline std::string bootTimeDataTypeToString(BootTimeDataType dataType); |
| |
| namespace internal |
| { |
| void getDumpServiceInfo(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| const Dump& dump); |
| } // namespace internal |
| |
| void getDumpEntryCollection(App& app, const crow::Request& req, |
| const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| const Dump& dump, |
| const query_param::Query& delegatedQuery); |
| |
| inline void |
| getDumpEntryCollection(const crow::Request& req, |
| const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| const Dump& dump, |
| const query_param::Query& delegatedQuery) |
| { |
| getDumpEntryCollection(*crow::globalBmcWebApp, req, asyncResp, dump, |
| delegatedQuery); |
| } |
| |
| void queryFaultCollection( |
| App& app, const crow::Request& origReq, |
| const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| const std::string& collectionUri, |
| std::unordered_map<std::string, nlohmann::json::json_pointer>& |
| faultLogEntries, |
| nlohmann::json& originalMembers); |
| |
| inline void queryFaultCollection( |
| const crow::Request& origReq, |
| const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| const std::string& collectionUri, |
| std::unordered_map<std::string, nlohmann::json::json_pointer>& |
| faultLogEntries, |
| nlohmann::json& originalMembers) |
| { |
| queryFaultCollection(*crow::globalBmcWebApp, origReq, asyncResp, |
| collectionUri, faultLogEntries, originalMembers); |
| } |
| |
| inline bool getHostLoggerEntries( |
| const std::vector<std::filesystem::path>& hostLoggerFiles, uint64_t skip, |
| uint64_t top, std::vector<std::string>& logEntries, size_t& logCount); |
| |
| void handleDeleteEventLogEntry( |
| App& app, const crow::Request& req, |
| const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| const std::string& systemName, const std::string& param); |
| |
| void handlePatchEventLogEntry( |
| App& app, const crow::Request& req, |
| const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| const std::string& systemName, const std::string& entryId); |
| |
| void handleLogServiceFaultLogEntriesGet( |
| App& app, const crow::Request& req, |
| const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| const std::string& systemName); |
| |
| void handleLogServicesRasManagerEntriesCollectionGet( |
| App& app, const crow::Request& req, |
| const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| const std::string& systemName); |
| |
| void requestRoutesSystemLogServiceCollection(App& app); |
| void requestRoutesEventLogService(App& app); |
| void requestRoutesJournalEventLogClear(App& app); |
| void requestRoutesJournalEventLogEntryCollection(App& app); |
| void requestRoutesJournalEventLogEntry(App& app); |
| void requestRoutesDBusEventLogEntryCollection(App& app); |
| void requestRoutesDBusEventLogEntry(App& app); |
| void requestRoutesDBusEventLogEntryDownload(App& app); |
| void requestRoutesSystemHostLogger(App& app); |
| void requestRoutesSystemHostLoggerCollection(App& app); |
| void requestRoutesSystemHostLoggerLogEntry(App& app); |
| void requestRoutesBMCLogServiceCollection(App& app); |
| void requestRoutesBMCJournalLogService(App& app); |
| void requestRoutesBMCJournalLogEntryCollection(App& app); |
| void requestRoutesBMCJournalLogEntry(App& app); |
| void requestRoutesRasManagerLogService(App& app); |
| void requestRoutesRasManagerLogEntryCollection(App& app); |
| void requestRoutesRasManagerLogEntry(App& app); |
| void requestRoutesRasManagerLogClear(App& app); |
| void requestRoutesBMCDumpService(App& app); |
| void requestRoutesBMCDumpEntryCollection(App& app); |
| void requestRoutesBMCDumpEntry(App& app); |
| void requestRoutesBMCDumpEntryDownload(App& app); |
| void requestRoutesBMCDumpCreate(App& app); |
| void requestRoutesBMCDumpClear(App& app); |
| void requestRoutesFaultLogDumpService(App& app); |
| void requestRoutesFaultLogDumpEntryCollection(App& app); |
| void requestRoutesFaultLogDumpEntry(App& app); |
| void requestRoutesFaultLogDumpClear(App& app); |
| void requestRoutesSystemDumpService(App& app); |
| void requestRoutesSystemDumpEntryCollection(App& app); |
| void requestRoutesSystemDumpEntry(App& app); |
| void requestRoutesSystemDumpCreate(App& app); |
| void requestRoutesSystemDumpClear(App& app); |
| void requestRoutesCrashdumpService(App& app); |
| void requestRoutesCrashdumpClear(App& app); |
| void requestRoutesCrashdumpEntryCollection(App& app); |
| void requestRoutesCrashdumpEntry(App& app); |
| void requestRoutesCrashdumpFile(App& app); |
| void requestRoutesCrashdumpCollect(App& app); |
| void requestRoutesPPRService(App& app); |
| void requestRoutesPPRStatus(App& app); |
| void requestRoutesPPRFile(App& app); |
| void requestRoutesPPRConfig(App& app); |
| void requestRoutesDBusLogServiceActionsClear(App& app); |
| void requestRoutesPostCodesLogService(App& app); |
| void requestRoutesPostCodesClear(App& app); |
| void requestRoutesPostCodesEntryCollection(App& app); |
| void requestRoutesPostCodesEntryAdditionalData(App& app); |
| void requestRoutesPostCodesEntry(App& app); |
| void handleSystemBootTimeLogServiceGet( |
| App& app, const crow::Request& req, |
| const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| const std::string& systemName); |
| void handleManagerBootTimeLogServiceGet( |
| App& app, const crow::Request& req, |
| const std::shared_ptr<bmcweb::AsyncResp>& asyncResp); |
| void handleSystemBootTimeLogsEntryCollectionGet( |
| App& app, const crow::Request& req, |
| const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| const std::string& systemName); |
| void handleManagerBootTimeLogsEntryCollectionGet( |
| App& app, const crow::Request& req, |
| const std::shared_ptr<bmcweb::AsyncResp>& asyncResp); |
| void requestRoutesBootTimeLogService(App& app); |
| void requestRoutesBootTimeLogEntryCollection(App& app); |
| void handleSystemBootTimeLogsEntryGet( |
| App& app, const crow::Request& req, |
| const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| const std::string& systemName, const std::string& entryId); |
| void handleManagerBootTimeLogsEntryGet( |
| App& app, const crow::Request& req, |
| const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| const std::string& entryId); |
| void requestRoutesBootTimeLogEntry(App& app); |
| void handlePPRServiceGet(App& app, const crow::Request& req, |
| const std::shared_ptr<bmcweb::AsyncResp>& asyncResp); |
| void getPostPackageRepairStatus( |
| const std::shared_ptr<bmcweb::AsyncResp>& asyncResp); |
| void handlePPRStatusGet(App& app, const crow::Request& req, |
| const std::shared_ptr<bmcweb::AsyncResp>& asyncResp); |
| void setPostPackageRepairData( |
| const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, uint16_t Index, |
| uint16_t repairEntryNum, uint16_t repairType, uint16_t socNum, |
| std::vector<uint16_t>& payload); |
| void handlePPRFilePatch(App& app, const crow::Request& req, |
| const std::shared_ptr<bmcweb::AsyncResp>& asyncResp); |
| void getPostPackageRepairConfig( |
| const std::shared_ptr<bmcweb::AsyncResp>& aResp); |
| void setPostPackageRepairConfig( |
| const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const uint16_t& flag, |
| const bool& data); |
| void handlePPRConfigGet(App& app, const crow::Request& req, |
| const std::shared_ptr<bmcweb::AsyncResp>& asyncResp); |
| void handlePPRConfigPatch(App& app, const crow::Request& req, |
| const std::shared_ptr<bmcweb::AsyncResp>& asyncResp); |
| } // namespace redfish |