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 NLOHMANN_JSON_SERIALIZE_ENUM(Id, { 135 {Id::Invalid, "Invalid"}, 136 }); 137 138 NLOHMANN_JSON_SERIALIZE_ENUM(Description, { 139 {Description::Invalid, "Invalid"}, 140 }); 141 142 NLOHMANN_JSON_SERIALIZE_ENUM(Name, { 143 {Name::Invalid, "Invalid"}, 144 }); 145 146 NLOHMANN_JSON_SERIALIZE_ENUM(UUID, { 147 {UUID::Invalid, "Invalid"}, 148 }); 149 150 NLOHMANN_JSON_SERIALIZE_ENUM(State, { 151 {State::Invalid, "Invalid"}, 152 {State::Enabled, "Enabled"}, 153 {State::Disabled, "Disabled"}, 154 {State::StandbyOffline, "StandbyOffline"}, 155 {State::StandbySpare, "StandbySpare"}, 156 {State::InTest, "InTest"}, 157 {State::Starting, "Starting"}, 158 {State::Absent, "Absent"}, 159 {State::UnavailableOffline, "UnavailableOffline"}, 160 {State::Deferring, "Deferring"}, 161 {State::Quiesced, "Quiesced"}, 162 {State::Updating, "Updating"}, 163 {State::Qualified, "Qualified"}, 164 {State::Degraded, "Degraded"}, 165 }); 166 167 NLOHMANN_JSON_SERIALIZE_ENUM(Health, { 168 {Health::Invalid, "Invalid"}, 169 {Health::OK, "OK"}, 170 {Health::Warning, "Warning"}, 171 {Health::Critical, "Critical"}, 172 }); 173 174 NLOHMANN_JSON_SERIALIZE_ENUM(ResetType, { 175 {ResetType::Invalid, "Invalid"}, 176 {ResetType::On, "On"}, 177 {ResetType::ForceOff, "ForceOff"}, 178 {ResetType::GracefulShutdown, "GracefulShutdown"}, 179 {ResetType::GracefulRestart, "GracefulRestart"}, 180 {ResetType::ForceRestart, "ForceRestart"}, 181 {ResetType::Nmi, "Nmi"}, 182 {ResetType::ForceOn, "ForceOn"}, 183 {ResetType::PushPowerButton, "PushPowerButton"}, 184 {ResetType::PowerCycle, "PowerCycle"}, 185 {ResetType::Suspend, "Suspend"}, 186 {ResetType::Pause, "Pause"}, 187 {ResetType::Resume, "Resume"}, 188 {ResetType::FullPowerCycle, "FullPowerCycle"}, 189 }); 190 191 NLOHMANN_JSON_SERIALIZE_ENUM(IndicatorLED, { 192 {IndicatorLED::Invalid, "Invalid"}, 193 {IndicatorLED::Lit, "Lit"}, 194 {IndicatorLED::Blinking, "Blinking"}, 195 {IndicatorLED::Off, "Off"}, 196 }); 197 198 NLOHMANN_JSON_SERIALIZE_ENUM(PowerState, { 199 {PowerState::Invalid, "Invalid"}, 200 {PowerState::On, "On"}, 201 {PowerState::Off, "Off"}, 202 {PowerState::PoweringOn, "PoweringOn"}, 203 {PowerState::PoweringOff, "PoweringOff"}, 204 {PowerState::Paused, "Paused"}, 205 }); 206 207 NLOHMANN_JSON_SERIALIZE_ENUM(DurableNameFormat, { 208 {DurableNameFormat::Invalid, "Invalid"}, 209 {DurableNameFormat::NAA, "NAA"}, 210 {DurableNameFormat::iQN, "iQN"}, 211 {DurableNameFormat::FC_WWN, "FC_WWN"}, 212 {DurableNameFormat::UUID, "UUID"}, 213 {DurableNameFormat::EUI, "EUI"}, 214 {DurableNameFormat::NQN, "NQN"}, 215 {DurableNameFormat::NSID, "NSID"}, 216 {DurableNameFormat::NGUID, "NGUID"}, 217 {DurableNameFormat::MACAddress, "MACAddress"}, 218 {DurableNameFormat::GCXLID, "GCXLID"}, 219 }); 220 221 NLOHMANN_JSON_SERIALIZE_ENUM(RackUnits, { 222 {RackUnits::Invalid, "Invalid"}, 223 {RackUnits::OpenU, "OpenU"}, 224 {RackUnits::EIA_310, "EIA_310"}, 225 }); 226 227 NLOHMANN_JSON_SERIALIZE_ENUM(LocationType, { 228 {LocationType::Invalid, "Invalid"}, 229 {LocationType::Slot, "Slot"}, 230 {LocationType::Bay, "Bay"}, 231 {LocationType::Connector, "Connector"}, 232 {LocationType::Socket, "Socket"}, 233 {LocationType::Backplane, "Backplane"}, 234 {LocationType::Embedded, "Embedded"}, 235 }); 236 237 NLOHMANN_JSON_SERIALIZE_ENUM(Reference, { 238 {Reference::Invalid, "Invalid"}, 239 {Reference::Top, "Top"}, 240 {Reference::Bottom, "Bottom"}, 241 {Reference::Front, "Front"}, 242 {Reference::Rear, "Rear"}, 243 {Reference::Left, "Left"}, 244 {Reference::Right, "Right"}, 245 {Reference::Middle, "Middle"}, 246 }); 247 248 NLOHMANN_JSON_SERIALIZE_ENUM(Orientation, { 249 {Orientation::Invalid, "Invalid"}, 250 {Orientation::FrontToBack, "FrontToBack"}, 251 {Orientation::BackToFront, "BackToFront"}, 252 {Orientation::TopToBottom, "TopToBottom"}, 253 {Orientation::BottomToTop, "BottomToTop"}, 254 {Orientation::LeftToRight, "LeftToRight"}, 255 {Orientation::RightToLeft, "RightToLeft"}, 256 }); 257 258 } 259 // clang-format on 260