Lines Matching full:pel

23 #include "../pel.hpp"
46 using PELFunc = std::function<void(const PEL&, bool hexDump)>;
72 * @brief helper function to get PEL commit timestamp from file name
73 * @retrun uint64_t - PEL commit timestamp
168 * @brief helper function to get PEL id from file name
169 * @retrun uint32_t - PEL id
187 * @brief Check if the string ends with the PEL ID string passed in
188 * @param[in] str - string to check for PEL ID
189 * @param[in] pelID - PEL id string
214 * @brief get data form raw PEL file.
215 * @param[in] std::string Name of file with raw PEL
216 * @return std::vector<uint8_t> char vector read from raw PEL file.
289 * @brief Creates JSON string of a PEL entry if fullPEL is false or prints to
290 * stdout the full PEL in JSON if fullPEL is true
296 * @param[in] fullPEL - Boolean to print full JSON representation of PEL
297 * @param[in] foundPEL - Boolean to check if any PEL is present
300 * @param[in] hexDump - Boolean to print hexdump of PEL instead of JSON
301 * @return std::string - JSON string of PEL entry (empty if fullPEL is true)
328 log<level::ERR>("Empty PEL file", in genPELJSON()
332 PEL pel{data}; in genPELJSON() local
333 if (!pel.valid()) in genPELJSON()
337 if (!includeInfo && pel.userHeader().severity() == 0) in genPELJSON()
341 if (critSysTerm && pel.userHeader().severity() != critSysTermSeverity) in genPELJSON()
345 std::bitset<16> actionFlags{pel.userHeader().actionFlags()}; in genPELJSON()
350 if (pel.primarySRC() && scrubRegex) in genPELJSON()
352 val = pel.primarySRC().value()->asciiString(); in genPELJSON()
362 << dumpHex(std::data(pel.data()), pel.size(), 0, false).get() in genPELJSON()
376 pel.toJSON(registry, plugins); in genPELJSON()
382 getNumberString("0x%X", pel.privateHeader().id()) + in genPELJSON()
385 if (pel.primarySRC()) in genPELJSON()
387 val = pel.primarySRC().value()->asciiString(); in genPELJSON()
391 auto regVal = pel.primarySRC().value()->getErrorDetails( in genPELJSON()
406 getNumberString("0x%X", pel.privateHeader().plid()), 2); in genPELJSON()
410 getNumberString("%c", pel.privateHeader().creatorID()); in genPELJSON()
416 std::string subsystem = pv::getValue(pel.userHeader().subsystem(), in genPELJSON()
423 pel.privateHeader().commitTimestamp().month, in genPELJSON()
424 pel.privateHeader().commitTimestamp().day, in genPELJSON()
425 pel.privateHeader().commitTimestamp().yearMSB, in genPELJSON()
426 pel.privateHeader().commitTimestamp().yearLSB, in genPELJSON()
427 pel.privateHeader().commitTimestamp().hour, in genPELJSON()
428 pel.privateHeader().commitTimestamp().minutes, in genPELJSON()
429 pel.privateHeader().commitTimestamp().seconds); in genPELJSON()
433 std::string severity = pv::getValue(pel.userHeader().severity(), in genPELJSON()
440 getComponentName(pel.privateHeader().header().componentID, in genPELJSON()
441 pel.privateHeader().creatorID()), in genPELJSON()
455 log<level::ERR>("Hit exception while reading PEL File", in genPELJSON()
469 * @param[in] fullPEL - Boolean to print full PEL into a JSON array
471 * @param[in] hexDump - Boolean to print hexdump of PEL instead of JSON
552 * @brief Calls the function passed in on the PEL with the ID
555 * @param[in] id - The string version of the PEL or BMC Log ID, either with or
557 * @param[in] func - The std::function<void(const PEL&, bool hexDump)> function
559 * @param[in] useBMC - if true, search by BMC Log ID, else search by PEL ID
560 * @param[in] hexDump - Boolean to print hexdump of PEL instead of JSON
583 // The PEL ID is part of the filename, so use that to find the PEL if in callFunctionOnPEL()
584 // "useBMC" is set to false, otherwise we have to search within the PEL in callFunctionOnPEL()
596 PEL pel{data}; in callFunctionOnPEL() local
598 (useBMC && pel.obmcLogID() == std::stoul(id, nullptr, 0))) in callFunctionOnPEL()
603 func(pel, hexDump); in callFunctionOnPEL()
616 std::cerr << "Could not read PEL file\n"; in callFunctionOnPEL()
624 std::cerr << "PEL not found\n"; in callFunctionOnPEL()
630 * @brief Delete a PEL file.
632 * @param[in] id - The PEL ID to delete.
656 * @brief Delete all PEL files.
673 * @brief Display a single PEL
675 * @param[in] pel - the PEL to display
676 * @param[in] hexDump - Boolean to print hexdump of PEL instead of JSON
678 void displayPEL(const PEL& pel, bool hexDump) in displayPEL() argument
680 if (pel.valid()) in displayPEL()
685 dumpHex(std::data(pel.data()), pel.size(), 0, false).get(); in displayPEL()
691 pel.toJSON(registry, plugins); in displayPEL()
696 std::cerr << "PEL was malformed\n"; in displayPEL()
725 PEL pel{data}; in printPELCount() local
726 if (!pel.valid()) in printPELCount()
730 if (!includeInfo && pel.userHeader().severity() == 0) in printPELCount()
734 if (critSysTerm && pel.userHeader().severity() != critSysTermSeverity) in printPELCount()
738 std::bitset<16> actionFlags{pel.userHeader().actionFlags()}; in printPELCount()
743 if (pel.primarySRC() && scrubRegex) in printPELCount()
745 std::string val = pel.primarySRC().value()->asciiString(); in printPELCount()
843 CLI::App app{"OpenBMC PEL Tool"}; in main()
862 app.add_option("--file", fileName, "Display a PEL using its Raw PEL file"); in main()
863 app.add_option("-i, --id", idPEL, "Display a PEL based on its ID"); in main()
865 "Display a PEL based on its BMC Event ID"); in main()
874 app.add_option("-d, --delete", idToDelete, "Delete a PEL based on its ID"); in main()
878 app.add_flag("-x", hexDump, "Display PEL(s) in hexdump instead of JSON"); in main()
888 PEL pel{data}; in main() local
892 dumpHex(std::data(pel.data()), pel.size(), 0, false).get(); in main()
898 pel.toJSON(registry, plugins); in main()
904 "Raw PEL file can't be read."); in main()