blob: 1ce991ee168a7187bf02bf676d27f5e841fc7960 [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 Shelley8af9e462021-03-11 10:44:28 -06004#include <hei_main.hpp>
Zane Shelleyf685afd2021-02-15 15:39:44 -06005#include <nlohmann/json.hpp>
6
7namespace analyzer
8{
9
Zane Shelley64791cf2021-02-15 17:02:37 -060010/**
11 * @brief Data regarding required service actions based on the hardware error
12 * analysis.
13 */
14class ServiceData
15{
16 public:
Zane Shelley8af9e462021-03-11 10:44:28 -060017 /**
18 * @brief Constructor from components.
19 * @param The signature of the root cause attention.
Zane Shelleyca496192021-08-09 12:05:52 -050020 * @param True if the signature list contained a system checkstop attention.
21 * False, otherwise.
Zane Shelley8af9e462021-03-11 10:44:28 -060022 */
Zane Shelleyca496192021-08-09 12:05:52 -050023 ServiceData(const libhei::Signature& i_rootCause, bool i_isCheckstop) :
24 iv_rootCause(i_rootCause), iv_isCheckstop(i_isCheckstop)
Zane Shelley8af9e462021-03-11 10:44:28 -060025 {}
Zane Shelley64791cf2021-02-15 17:02:37 -060026
27 /** @brief Destructor. */
28 ~ServiceData() = default;
29
30 /** @brief Copy constructor. */
31 ServiceData(const ServiceData&) = default;
32
33 /** @brief Assignment operator. */
34 ServiceData& operator=(const ServiceData&) = default;
35
36 private:
Zane Shelley8af9e462021-03-11 10:44:28 -060037 /** The signature of the root cause attention. */
38 const libhei::Signature iv_rootCause;
39
Zane Shelleyca496192021-08-09 12:05:52 -050040 /** True if the signature list contained a system checkstop attention.
41 * False, otherwise. */
42 const bool iv_isCheckstop;
43
Zane Shelley64791cf2021-02-15 17:02:37 -060044 /** The list of callouts that will be added to a PEL. */
Zane Shelleyc85716c2021-08-17 10:54:06 -050045 nlohmann::json iv_calloutList = nlohmann::json::array();
Zane Shelley64791cf2021-02-15 17:02:37 -060046
Zane Shelley2d114322021-08-25 17:06:12 -050047 /** FFDC for callouts that would otherwise not be available in the
48 * callout list (unit paths, bus types, etc.). */
49 nlohmann::json iv_calloutFFDC = nlohmann::json::array();
50
Zane Shelley64791cf2021-02-15 17:02:37 -060051 public:
Zane Shelley8af9e462021-03-11 10:44:28 -060052 /** @return The signature of the root cause attention. */
53 const libhei::Signature& getRootCause() const
54 {
55 return iv_rootCause;
56 }
57
Zane Shelleyca496192021-08-09 12:05:52 -050058 /** @return True if the signature list contained a system checkstop
59 * attention. False, otherwise. */
60 bool queryCheckstop() const
61 {
62 return iv_isCheckstop;
63 }
64
Zane Shelleybf3326f2021-11-12 13:41:39 -060065 /** @return Returns the guard type based on current analysis policies. */
66 callout::GuardType queryGuardPolicy() const
67 {
68 // TODO: Manual execution of the analyzer (i.e. from the command line),
69 // will eventually require the ability to not guard. This is
70 // useful when we simply want to check for attentions in the
71 // hardware with no service action.
72
73 return queryCheckstop() ? callout::GuardType::UNRECOVERABLE
74 : callout::GuardType::PREDICTIVE;
75 }
76
Zane Shelleyc85716c2021-08-17 10:54:06 -050077 /**
78 * @brief Add callout information to the callout list.
79 * @param The JSON object for this callout.
80 */
Zane Shelley979e2872021-09-20 22:46:06 -050081 void addCallout(const nlohmann::json& i_callout);
Zane Shelley64791cf2021-02-15 17:02:37 -060082
Zane Shelley95135822021-08-23 09:00:05 -050083 /**
Zane Shelley2d114322021-08-25 17:06:12 -050084 * @brief Add FFDC for a callout that would otherwise not be available in
85 * the callout list (unit paths, bus types, etc.).
86 * @param The JSON object for this callout.
87 */
88 void addCalloutFFDC(const nlohmann::json& i_ffdc)
89 {
90 iv_calloutFFDC.push_back(i_ffdc);
91 }
92
Zane Shelleyc85716c2021-08-17 10:54:06 -050093 /** @brief Accessor to iv_calloutList. */
94 const nlohmann::json& getCalloutList() const
Zane Shelley64791cf2021-02-15 17:02:37 -060095 {
Zane Shelleyc85716c2021-08-17 10:54:06 -050096 return iv_calloutList;
Zane Shelley64791cf2021-02-15 17:02:37 -060097 }
Zane Shelley5f6e3de2021-02-23 13:57:37 -060098
Zane Shelley2d114322021-08-25 17:06:12 -050099 /** @brief Accessor to iv_calloutFFDC. */
100 const nlohmann::json& getCalloutFFDC() const
101 {
102 return iv_calloutFFDC;
103 }
Zane Shelley64791cf2021-02-15 17:02:37 -0600104};
105
Zane Shelleyf685afd2021-02-15 15:39:44 -0600106} // namespace analyzer