blob: ac90707996b0e23aae0b75f088970da90256087a [file] [log] [blame]
Zane Shelleyf685afd2021-02-15 15:39:44 -06001#pragma once
2
Zane Shelleyc85716c2021-08-17 10:54:06 -05003#include <analyzer/callout.hpp>
Zane Shelley95135822021-08-23 09:00:05 -05004#include <analyzer/guard.hpp>
Zane Shelley8af9e462021-03-11 10:44:28 -06005#include <hei_main.hpp>
Zane Shelleyf685afd2021-02-15 15:39:44 -06006#include <nlohmann/json.hpp>
7
8namespace analyzer
9{
10
Zane Shelley64791cf2021-02-15 17:02:37 -060011/**
12 * @brief Data regarding required service actions based on the hardware error
13 * analysis.
14 */
15class ServiceData
16{
17 public:
Zane Shelley8af9e462021-03-11 10:44:28 -060018 /**
19 * @brief Constructor from components.
20 * @param The signature of the root cause attention.
Zane Shelleyca496192021-08-09 12:05:52 -050021 * @param True if the signature list contained a system checkstop attention.
22 * False, otherwise.
Zane Shelley8af9e462021-03-11 10:44:28 -060023 */
Zane Shelleyca496192021-08-09 12:05:52 -050024 ServiceData(const libhei::Signature& i_rootCause, bool i_isCheckstop) :
25 iv_rootCause(i_rootCause), iv_isCheckstop(i_isCheckstop)
Zane Shelley8af9e462021-03-11 10:44:28 -060026 {}
Zane Shelley64791cf2021-02-15 17:02:37 -060027
28 /** @brief Destructor. */
29 ~ServiceData() = default;
30
31 /** @brief Copy constructor. */
32 ServiceData(const ServiceData&) = default;
33
34 /** @brief Assignment operator. */
35 ServiceData& operator=(const ServiceData&) = default;
36
37 private:
Zane Shelley8af9e462021-03-11 10:44:28 -060038 /** The signature of the root cause attention. */
39 const libhei::Signature iv_rootCause;
40
Zane Shelleyca496192021-08-09 12:05:52 -050041 /** True if the signature list contained a system checkstop attention.
42 * False, otherwise. */
43 const bool iv_isCheckstop;
44
Zane Shelley64791cf2021-02-15 17:02:37 -060045 /** The list of callouts that will be added to a PEL. */
Zane Shelleyc85716c2021-08-17 10:54:06 -050046 nlohmann::json iv_calloutList = nlohmann::json::array();
Zane Shelley64791cf2021-02-15 17:02:37 -060047
Zane Shelley2d114322021-08-25 17:06:12 -050048 /** FFDC for callouts that would otherwise not be available in the
49 * callout list (unit paths, bus types, etc.). */
50 nlohmann::json iv_calloutFFDC = nlohmann::json::array();
51
Zane Shelley5f6e3de2021-02-23 13:57:37 -060052 /** The list of hardware guard requests. Some information will be added to
Zane Shelley95135822021-08-23 09:00:05 -050053 * the PEL, but the actual guard record will be created after submitting
54 * the PEL. */
55 std::vector<Guard> iv_guardList;
Zane Shelley5f6e3de2021-02-23 13:57:37 -060056
Zane Shelley64791cf2021-02-15 17:02:37 -060057 public:
Zane Shelley8af9e462021-03-11 10:44:28 -060058 /** @return The signature of the root cause attention. */
59 const libhei::Signature& getRootCause() const
60 {
61 return iv_rootCause;
62 }
63
Zane Shelleyca496192021-08-09 12:05:52 -050064 /** @return True if the signature list contained a system checkstop
65 * attention. False, otherwise. */
66 bool queryCheckstop() const
67 {
68 return iv_isCheckstop;
69 }
70
Zane Shelleyc85716c2021-08-17 10:54:06 -050071 /**
72 * @brief Add callout information to the callout list.
73 * @param The JSON object for this callout.
74 */
Zane Shelley979e2872021-09-20 22:46:06 -050075 void addCallout(const nlohmann::json& i_callout);
Zane Shelley64791cf2021-02-15 17:02:37 -060076
Zane Shelley95135822021-08-23 09:00:05 -050077 /**
Zane Shelley2d114322021-08-25 17:06:12 -050078 * @brief Add FFDC for a callout that would otherwise not be available in
79 * the callout list (unit paths, bus types, etc.).
80 * @param The JSON object for this callout.
81 */
82 void addCalloutFFDC(const nlohmann::json& i_ffdc)
83 {
84 iv_calloutFFDC.push_back(i_ffdc);
85 }
86
87 /**
Zane Shelley95135822021-08-23 09:00:05 -050088 * @brief Add a guard request to the guard list.
89 * @param i_path Entity path for the target part.
90 * @param i_guard True, if the part should be guarded. False, otherwise.
Zane Shelley2d114322021-08-25 17:06:12 -050091 * @return A reference to the object just added to the guard list.
Zane Shelley95135822021-08-23 09:00:05 -050092 */
Zane Shelley2d114322021-08-25 17:06:12 -050093 const Guard& addGuard(const std::string& i_path, bool i_guard)
Zane Shelley5f6e3de2021-02-23 13:57:37 -060094 {
Zane Shelley95135822021-08-23 09:00:05 -050095 Guard::Type guardType = Guard::Type::NONE;
96 if (i_guard)
97 {
98 // The guard type is dependent on the presence of a system checkstop
99 // attention.
100 guardType =
101 queryCheckstop() ? Guard::Type::FATAL : Guard::Type::NON_FATAL;
102 }
103
Zane Shelley2d114322021-08-25 17:06:12 -0500104 return iv_guardList.emplace_back(i_path, guardType);
Zane Shelley5f6e3de2021-02-23 13:57:37 -0600105 }
106
Zane Shelleyc85716c2021-08-17 10:54:06 -0500107 /** @brief Accessor to iv_calloutList. */
108 const nlohmann::json& getCalloutList() const
Zane Shelley64791cf2021-02-15 17:02:37 -0600109 {
Zane Shelleyc85716c2021-08-17 10:54:06 -0500110 return iv_calloutList;
Zane Shelley64791cf2021-02-15 17:02:37 -0600111 }
Zane Shelley5f6e3de2021-02-23 13:57:37 -0600112
Zane Shelley2d114322021-08-25 17:06:12 -0500113 /** @brief Accessor to iv_calloutFFDC. */
114 const nlohmann::json& getCalloutFFDC() const
115 {
116 return iv_calloutFFDC;
117 }
118
Zane Shelley95135822021-08-23 09:00:05 -0500119 /** @brief Accessor to iv_guardList. */
120 const std::vector<Guard>& getGuardList() const
Zane Shelley5f6e3de2021-02-23 13:57:37 -0600121 {
Zane Shelley95135822021-08-23 09:00:05 -0500122 return iv_guardList;
Zane Shelley5f6e3de2021-02-23 13:57:37 -0600123 }
Zane Shelley64791cf2021-02-15 17:02:37 -0600124};
125
Zane Shelleyf685afd2021-02-15 15:39:44 -0600126} // namespace analyzer