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