140e9b92eSEd Tanous // SPDX-License-Identifier: Apache-2.0 240e9b92eSEd Tanous // SPDX-FileCopyrightText: Copyright OpenBMC Authors 30ec8b83dSEd Tanous #pragma once 40ec8b83dSEd Tanous #include <nlohmann/json.hpp> 50ec8b83dSEd Tanous 60ec8b83dSEd Tanous namespace resource 70ec8b83dSEd Tanous { 80ec8b83dSEd Tanous // clang-format off 90ec8b83dSEd Tanous 100ec8b83dSEd Tanous enum class State{ 110ec8b83dSEd Tanous Invalid, 120ec8b83dSEd Tanous Enabled, 130ec8b83dSEd Tanous Disabled, 140ec8b83dSEd Tanous StandbyOffline, 150ec8b83dSEd Tanous StandbySpare, 160ec8b83dSEd Tanous InTest, 170ec8b83dSEd Tanous Starting, 180ec8b83dSEd Tanous Absent, 190ec8b83dSEd Tanous UnavailableOffline, 200ec8b83dSEd Tanous Deferring, 210ec8b83dSEd Tanous Quiesced, 220ec8b83dSEd Tanous Updating, 230ec8b83dSEd Tanous Qualified, 24f2a8e57eSGunnar Mills Degraded, 250ec8b83dSEd Tanous }; 260ec8b83dSEd Tanous 270ec8b83dSEd Tanous enum class Health{ 280ec8b83dSEd Tanous Invalid, 290ec8b83dSEd Tanous OK, 300ec8b83dSEd Tanous Warning, 310ec8b83dSEd Tanous Critical, 320ec8b83dSEd Tanous }; 330ec8b83dSEd Tanous 340ec8b83dSEd Tanous enum class ResetType{ 350ec8b83dSEd Tanous Invalid, 360ec8b83dSEd Tanous On, 370ec8b83dSEd Tanous ForceOff, 380ec8b83dSEd Tanous GracefulShutdown, 390ec8b83dSEd Tanous GracefulRestart, 400ec8b83dSEd Tanous ForceRestart, 410ec8b83dSEd Tanous Nmi, 420ec8b83dSEd Tanous ForceOn, 430ec8b83dSEd Tanous PushPowerButton, 440ec8b83dSEd Tanous PowerCycle, 450ec8b83dSEd Tanous Suspend, 460ec8b83dSEd Tanous Pause, 470ec8b83dSEd Tanous Resume, 48*9b46bc0bSMyung Bae FullPowerCycle, 490ec8b83dSEd Tanous }; 500ec8b83dSEd Tanous 510ec8b83dSEd Tanous enum class IndicatorLED{ 520ec8b83dSEd Tanous Invalid, 530ec8b83dSEd Tanous Lit, 540ec8b83dSEd Tanous Blinking, 550ec8b83dSEd Tanous Off, 560ec8b83dSEd Tanous }; 570ec8b83dSEd Tanous 580ec8b83dSEd Tanous enum class PowerState{ 590ec8b83dSEd Tanous Invalid, 600ec8b83dSEd Tanous On, 610ec8b83dSEd Tanous Off, 620ec8b83dSEd Tanous PoweringOn, 630ec8b83dSEd Tanous PoweringOff, 640ec8b83dSEd Tanous Paused, 650ec8b83dSEd Tanous }; 660ec8b83dSEd Tanous 670ec8b83dSEd Tanous enum class DurableNameFormat{ 680ec8b83dSEd Tanous Invalid, 690ec8b83dSEd Tanous NAA, 700ec8b83dSEd Tanous iQN, 710ec8b83dSEd Tanous FC_WWN, 720ec8b83dSEd Tanous UUID, 730ec8b83dSEd Tanous EUI, 740ec8b83dSEd Tanous NQN, 750ec8b83dSEd Tanous NSID, 760ec8b83dSEd Tanous NGUID, 770ec8b83dSEd Tanous MACAddress, 78a8d8f9d8SEd Tanous GCXLID, 790ec8b83dSEd Tanous }; 800ec8b83dSEd Tanous 810ec8b83dSEd Tanous enum class RackUnits{ 820ec8b83dSEd Tanous Invalid, 830ec8b83dSEd Tanous OpenU, 840ec8b83dSEd Tanous EIA_310, 850ec8b83dSEd Tanous }; 860ec8b83dSEd Tanous 870ec8b83dSEd Tanous enum class LocationType{ 880ec8b83dSEd Tanous Invalid, 890ec8b83dSEd Tanous Slot, 900ec8b83dSEd Tanous Bay, 910ec8b83dSEd Tanous Connector, 920ec8b83dSEd Tanous Socket, 930ec8b83dSEd Tanous Backplane, 940ec8b83dSEd Tanous Embedded, 950ec8b83dSEd Tanous }; 960ec8b83dSEd Tanous 970ec8b83dSEd Tanous enum class Reference{ 980ec8b83dSEd Tanous Invalid, 990ec8b83dSEd Tanous Top, 1000ec8b83dSEd Tanous Bottom, 1010ec8b83dSEd Tanous Front, 1020ec8b83dSEd Tanous Rear, 1030ec8b83dSEd Tanous Left, 1040ec8b83dSEd Tanous Right, 1050ec8b83dSEd Tanous Middle, 1060ec8b83dSEd Tanous }; 1070ec8b83dSEd Tanous 1080ec8b83dSEd Tanous enum class Orientation{ 1090ec8b83dSEd Tanous Invalid, 1100ec8b83dSEd Tanous FrontToBack, 1110ec8b83dSEd Tanous BackToFront, 1120ec8b83dSEd Tanous TopToBottom, 1130ec8b83dSEd Tanous BottomToTop, 1140ec8b83dSEd Tanous LeftToRight, 1150ec8b83dSEd Tanous RightToLeft, 1160ec8b83dSEd Tanous }; 1170ec8b83dSEd Tanous 1180ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(State, { 1190ec8b83dSEd Tanous {State::Invalid, "Invalid"}, 1200ec8b83dSEd Tanous {State::Enabled, "Enabled"}, 1210ec8b83dSEd Tanous {State::Disabled, "Disabled"}, 1220ec8b83dSEd Tanous {State::StandbyOffline, "StandbyOffline"}, 1230ec8b83dSEd Tanous {State::StandbySpare, "StandbySpare"}, 1240ec8b83dSEd Tanous {State::InTest, "InTest"}, 1250ec8b83dSEd Tanous {State::Starting, "Starting"}, 1260ec8b83dSEd Tanous {State::Absent, "Absent"}, 1270ec8b83dSEd Tanous {State::UnavailableOffline, "UnavailableOffline"}, 1280ec8b83dSEd Tanous {State::Deferring, "Deferring"}, 1290ec8b83dSEd Tanous {State::Quiesced, "Quiesced"}, 1300ec8b83dSEd Tanous {State::Updating, "Updating"}, 1310ec8b83dSEd Tanous {State::Qualified, "Qualified"}, 132f2a8e57eSGunnar Mills {State::Degraded, "Degraded"}, 1330ec8b83dSEd Tanous }); 1340ec8b83dSEd Tanous 1350ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(Health, { 1360ec8b83dSEd Tanous {Health::Invalid, "Invalid"}, 1370ec8b83dSEd Tanous {Health::OK, "OK"}, 1380ec8b83dSEd Tanous {Health::Warning, "Warning"}, 1390ec8b83dSEd Tanous {Health::Critical, "Critical"}, 1400ec8b83dSEd Tanous }); 1410ec8b83dSEd Tanous 1420ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(ResetType, { 1430ec8b83dSEd Tanous {ResetType::Invalid, "Invalid"}, 1440ec8b83dSEd Tanous {ResetType::On, "On"}, 1450ec8b83dSEd Tanous {ResetType::ForceOff, "ForceOff"}, 1460ec8b83dSEd Tanous {ResetType::GracefulShutdown, "GracefulShutdown"}, 1470ec8b83dSEd Tanous {ResetType::GracefulRestart, "GracefulRestart"}, 1480ec8b83dSEd Tanous {ResetType::ForceRestart, "ForceRestart"}, 1490ec8b83dSEd Tanous {ResetType::Nmi, "Nmi"}, 1500ec8b83dSEd Tanous {ResetType::ForceOn, "ForceOn"}, 1510ec8b83dSEd Tanous {ResetType::PushPowerButton, "PushPowerButton"}, 1520ec8b83dSEd Tanous {ResetType::PowerCycle, "PowerCycle"}, 1530ec8b83dSEd Tanous {ResetType::Suspend, "Suspend"}, 1540ec8b83dSEd Tanous {ResetType::Pause, "Pause"}, 1550ec8b83dSEd Tanous {ResetType::Resume, "Resume"}, 156*9b46bc0bSMyung Bae {ResetType::FullPowerCycle, "FullPowerCycle"}, 1570ec8b83dSEd Tanous }); 1580ec8b83dSEd Tanous 1590ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(IndicatorLED, { 1600ec8b83dSEd Tanous {IndicatorLED::Invalid, "Invalid"}, 1610ec8b83dSEd Tanous {IndicatorLED::Lit, "Lit"}, 1620ec8b83dSEd Tanous {IndicatorLED::Blinking, "Blinking"}, 1630ec8b83dSEd Tanous {IndicatorLED::Off, "Off"}, 1640ec8b83dSEd Tanous }); 1650ec8b83dSEd Tanous 1660ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(PowerState, { 1670ec8b83dSEd Tanous {PowerState::Invalid, "Invalid"}, 1680ec8b83dSEd Tanous {PowerState::On, "On"}, 1690ec8b83dSEd Tanous {PowerState::Off, "Off"}, 1700ec8b83dSEd Tanous {PowerState::PoweringOn, "PoweringOn"}, 1710ec8b83dSEd Tanous {PowerState::PoweringOff, "PoweringOff"}, 1720ec8b83dSEd Tanous {PowerState::Paused, "Paused"}, 1730ec8b83dSEd Tanous }); 1740ec8b83dSEd Tanous 1750ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(DurableNameFormat, { 1760ec8b83dSEd Tanous {DurableNameFormat::Invalid, "Invalid"}, 1770ec8b83dSEd Tanous {DurableNameFormat::NAA, "NAA"}, 1780ec8b83dSEd Tanous {DurableNameFormat::iQN, "iQN"}, 1790ec8b83dSEd Tanous {DurableNameFormat::FC_WWN, "FC_WWN"}, 1800ec8b83dSEd Tanous {DurableNameFormat::UUID, "UUID"}, 1810ec8b83dSEd Tanous {DurableNameFormat::EUI, "EUI"}, 1820ec8b83dSEd Tanous {DurableNameFormat::NQN, "NQN"}, 1830ec8b83dSEd Tanous {DurableNameFormat::NSID, "NSID"}, 1840ec8b83dSEd Tanous {DurableNameFormat::NGUID, "NGUID"}, 1850ec8b83dSEd Tanous {DurableNameFormat::MACAddress, "MACAddress"}, 186a8d8f9d8SEd Tanous {DurableNameFormat::GCXLID, "GCXLID"}, 1870ec8b83dSEd Tanous }); 1880ec8b83dSEd Tanous 1890ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(RackUnits, { 1900ec8b83dSEd Tanous {RackUnits::Invalid, "Invalid"}, 1910ec8b83dSEd Tanous {RackUnits::OpenU, "OpenU"}, 1920ec8b83dSEd Tanous {RackUnits::EIA_310, "EIA_310"}, 1930ec8b83dSEd Tanous }); 1940ec8b83dSEd Tanous 1950ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(LocationType, { 1960ec8b83dSEd Tanous {LocationType::Invalid, "Invalid"}, 1970ec8b83dSEd Tanous {LocationType::Slot, "Slot"}, 1980ec8b83dSEd Tanous {LocationType::Bay, "Bay"}, 1990ec8b83dSEd Tanous {LocationType::Connector, "Connector"}, 2000ec8b83dSEd Tanous {LocationType::Socket, "Socket"}, 2010ec8b83dSEd Tanous {LocationType::Backplane, "Backplane"}, 2020ec8b83dSEd Tanous {LocationType::Embedded, "Embedded"}, 2030ec8b83dSEd Tanous }); 2040ec8b83dSEd Tanous 2050ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(Reference, { 2060ec8b83dSEd Tanous {Reference::Invalid, "Invalid"}, 2070ec8b83dSEd Tanous {Reference::Top, "Top"}, 2080ec8b83dSEd Tanous {Reference::Bottom, "Bottom"}, 2090ec8b83dSEd Tanous {Reference::Front, "Front"}, 2100ec8b83dSEd Tanous {Reference::Rear, "Rear"}, 2110ec8b83dSEd Tanous {Reference::Left, "Left"}, 2120ec8b83dSEd Tanous {Reference::Right, "Right"}, 2130ec8b83dSEd Tanous {Reference::Middle, "Middle"}, 2140ec8b83dSEd Tanous }); 2150ec8b83dSEd Tanous 2160ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(Orientation, { 2170ec8b83dSEd Tanous {Orientation::Invalid, "Invalid"}, 2180ec8b83dSEd Tanous {Orientation::FrontToBack, "FrontToBack"}, 2190ec8b83dSEd Tanous {Orientation::BackToFront, "BackToFront"}, 2200ec8b83dSEd Tanous {Orientation::TopToBottom, "TopToBottom"}, 2210ec8b83dSEd Tanous {Orientation::BottomToTop, "BottomToTop"}, 2220ec8b83dSEd Tanous {Orientation::LeftToRight, "LeftToRight"}, 2230ec8b83dSEd Tanous {Orientation::RightToLeft, "RightToLeft"}, 2240ec8b83dSEd Tanous }); 2250ec8b83dSEd Tanous 2260ec8b83dSEd Tanous } 2270ec8b83dSEd Tanous // clang-format on 228