1 #pragma once 2 #include <nlohmann/json.hpp> 3 4 namespace resource 5 { 6 // clang-format off 7 8 enum class State{ 9 Invalid, 10 Enabled, 11 Disabled, 12 StandbyOffline, 13 StandbySpare, 14 InTest, 15 Starting, 16 Absent, 17 UnavailableOffline, 18 Deferring, 19 Quiesced, 20 Updating, 21 Qualified, 22 }; 23 24 enum class Health{ 25 Invalid, 26 OK, 27 Warning, 28 Critical, 29 }; 30 31 enum class ResetType{ 32 Invalid, 33 On, 34 ForceOff, 35 GracefulShutdown, 36 GracefulRestart, 37 ForceRestart, 38 Nmi, 39 ForceOn, 40 PushPowerButton, 41 PowerCycle, 42 Suspend, 43 Pause, 44 Resume, 45 }; 46 47 enum class IndicatorLED{ 48 Invalid, 49 Lit, 50 Blinking, 51 Off, 52 }; 53 54 enum class PowerState{ 55 Invalid, 56 On, 57 Off, 58 PoweringOn, 59 PoweringOff, 60 Paused, 61 }; 62 63 enum class DurableNameFormat{ 64 Invalid, 65 NAA, 66 iQN, 67 FC_WWN, 68 UUID, 69 EUI, 70 NQN, 71 NSID, 72 NGUID, 73 MACAddress, 74 }; 75 76 enum class RackUnits{ 77 Invalid, 78 OpenU, 79 EIA_310, 80 }; 81 82 enum class LocationType{ 83 Invalid, 84 Slot, 85 Bay, 86 Connector, 87 Socket, 88 Backplane, 89 Embedded, 90 }; 91 92 enum class Reference{ 93 Invalid, 94 Top, 95 Bottom, 96 Front, 97 Rear, 98 Left, 99 Right, 100 Middle, 101 }; 102 103 enum class Orientation{ 104 Invalid, 105 FrontToBack, 106 BackToFront, 107 TopToBottom, 108 BottomToTop, 109 LeftToRight, 110 RightToLeft, 111 }; 112 113 NLOHMANN_JSON_SERIALIZE_ENUM(State, { 114 {State::Invalid, "Invalid"}, 115 {State::Enabled, "Enabled"}, 116 {State::Disabled, "Disabled"}, 117 {State::StandbyOffline, "StandbyOffline"}, 118 {State::StandbySpare, "StandbySpare"}, 119 {State::InTest, "InTest"}, 120 {State::Starting, "Starting"}, 121 {State::Absent, "Absent"}, 122 {State::UnavailableOffline, "UnavailableOffline"}, 123 {State::Deferring, "Deferring"}, 124 {State::Quiesced, "Quiesced"}, 125 {State::Updating, "Updating"}, 126 {State::Qualified, "Qualified"}, 127 }); 128 129 NLOHMANN_JSON_SERIALIZE_ENUM(Health, { 130 {Health::Invalid, "Invalid"}, 131 {Health::OK, "OK"}, 132 {Health::Warning, "Warning"}, 133 {Health::Critical, "Critical"}, 134 }); 135 136 NLOHMANN_JSON_SERIALIZE_ENUM(ResetType, { 137 {ResetType::Invalid, "Invalid"}, 138 {ResetType::On, "On"}, 139 {ResetType::ForceOff, "ForceOff"}, 140 {ResetType::GracefulShutdown, "GracefulShutdown"}, 141 {ResetType::GracefulRestart, "GracefulRestart"}, 142 {ResetType::ForceRestart, "ForceRestart"}, 143 {ResetType::Nmi, "Nmi"}, 144 {ResetType::ForceOn, "ForceOn"}, 145 {ResetType::PushPowerButton, "PushPowerButton"}, 146 {ResetType::PowerCycle, "PowerCycle"}, 147 {ResetType::Suspend, "Suspend"}, 148 {ResetType::Pause, "Pause"}, 149 {ResetType::Resume, "Resume"}, 150 }); 151 152 NLOHMANN_JSON_SERIALIZE_ENUM(IndicatorLED, { 153 {IndicatorLED::Invalid, "Invalid"}, 154 {IndicatorLED::Lit, "Lit"}, 155 {IndicatorLED::Blinking, "Blinking"}, 156 {IndicatorLED::Off, "Off"}, 157 }); 158 159 NLOHMANN_JSON_SERIALIZE_ENUM(PowerState, { 160 {PowerState::Invalid, "Invalid"}, 161 {PowerState::On, "On"}, 162 {PowerState::Off, "Off"}, 163 {PowerState::PoweringOn, "PoweringOn"}, 164 {PowerState::PoweringOff, "PoweringOff"}, 165 {PowerState::Paused, "Paused"}, 166 }); 167 168 NLOHMANN_JSON_SERIALIZE_ENUM(DurableNameFormat, { 169 {DurableNameFormat::Invalid, "Invalid"}, 170 {DurableNameFormat::NAA, "NAA"}, 171 {DurableNameFormat::iQN, "iQN"}, 172 {DurableNameFormat::FC_WWN, "FC_WWN"}, 173 {DurableNameFormat::UUID, "UUID"}, 174 {DurableNameFormat::EUI, "EUI"}, 175 {DurableNameFormat::NQN, "NQN"}, 176 {DurableNameFormat::NSID, "NSID"}, 177 {DurableNameFormat::NGUID, "NGUID"}, 178 {DurableNameFormat::MACAddress, "MACAddress"}, 179 }); 180 181 NLOHMANN_JSON_SERIALIZE_ENUM(RackUnits, { 182 {RackUnits::Invalid, "Invalid"}, 183 {RackUnits::OpenU, "OpenU"}, 184 {RackUnits::EIA_310, "EIA_310"}, 185 }); 186 187 NLOHMANN_JSON_SERIALIZE_ENUM(LocationType, { 188 {LocationType::Invalid, "Invalid"}, 189 {LocationType::Slot, "Slot"}, 190 {LocationType::Bay, "Bay"}, 191 {LocationType::Connector, "Connector"}, 192 {LocationType::Socket, "Socket"}, 193 {LocationType::Backplane, "Backplane"}, 194 {LocationType::Embedded, "Embedded"}, 195 }); 196 197 NLOHMANN_JSON_SERIALIZE_ENUM(Reference, { 198 {Reference::Invalid, "Invalid"}, 199 {Reference::Top, "Top"}, 200 {Reference::Bottom, "Bottom"}, 201 {Reference::Front, "Front"}, 202 {Reference::Rear, "Rear"}, 203 {Reference::Left, "Left"}, 204 {Reference::Right, "Right"}, 205 {Reference::Middle, "Middle"}, 206 }); 207 208 NLOHMANN_JSON_SERIALIZE_ENUM(Orientation, { 209 {Orientation::Invalid, "Invalid"}, 210 {Orientation::FrontToBack, "FrontToBack"}, 211 {Orientation::BackToFront, "BackToFront"}, 212 {Orientation::TopToBottom, "TopToBottom"}, 213 {Orientation::BottomToTop, "BottomToTop"}, 214 {Orientation::LeftToRight, "LeftToRight"}, 215 {Orientation::RightToLeft, "RightToLeft"}, 216 }); 217 218 } 219 // clang-format on 220