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