1*40e9b92eSEd Tanous // SPDX-License-Identifier: Apache-2.0 2*40e9b92eSEd 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, 480ec8b83dSEd Tanous }; 490ec8b83dSEd Tanous 500ec8b83dSEd Tanous enum class IndicatorLED{ 510ec8b83dSEd Tanous Invalid, 520ec8b83dSEd Tanous Lit, 530ec8b83dSEd Tanous Blinking, 540ec8b83dSEd Tanous Off, 550ec8b83dSEd Tanous }; 560ec8b83dSEd Tanous 570ec8b83dSEd Tanous enum class PowerState{ 580ec8b83dSEd Tanous Invalid, 590ec8b83dSEd Tanous On, 600ec8b83dSEd Tanous Off, 610ec8b83dSEd Tanous PoweringOn, 620ec8b83dSEd Tanous PoweringOff, 630ec8b83dSEd Tanous Paused, 640ec8b83dSEd Tanous }; 650ec8b83dSEd Tanous 660ec8b83dSEd Tanous enum class DurableNameFormat{ 670ec8b83dSEd Tanous Invalid, 680ec8b83dSEd Tanous NAA, 690ec8b83dSEd Tanous iQN, 700ec8b83dSEd Tanous FC_WWN, 710ec8b83dSEd Tanous UUID, 720ec8b83dSEd Tanous EUI, 730ec8b83dSEd Tanous NQN, 740ec8b83dSEd Tanous NSID, 750ec8b83dSEd Tanous NGUID, 760ec8b83dSEd Tanous MACAddress, 77a8d8f9d8SEd Tanous GCXLID, 780ec8b83dSEd Tanous }; 790ec8b83dSEd Tanous 800ec8b83dSEd Tanous enum class RackUnits{ 810ec8b83dSEd Tanous Invalid, 820ec8b83dSEd Tanous OpenU, 830ec8b83dSEd Tanous EIA_310, 840ec8b83dSEd Tanous }; 850ec8b83dSEd Tanous 860ec8b83dSEd Tanous enum class LocationType{ 870ec8b83dSEd Tanous Invalid, 880ec8b83dSEd Tanous Slot, 890ec8b83dSEd Tanous Bay, 900ec8b83dSEd Tanous Connector, 910ec8b83dSEd Tanous Socket, 920ec8b83dSEd Tanous Backplane, 930ec8b83dSEd Tanous Embedded, 940ec8b83dSEd Tanous }; 950ec8b83dSEd Tanous 960ec8b83dSEd Tanous enum class Reference{ 970ec8b83dSEd Tanous Invalid, 980ec8b83dSEd Tanous Top, 990ec8b83dSEd Tanous Bottom, 1000ec8b83dSEd Tanous Front, 1010ec8b83dSEd Tanous Rear, 1020ec8b83dSEd Tanous Left, 1030ec8b83dSEd Tanous Right, 1040ec8b83dSEd Tanous Middle, 1050ec8b83dSEd Tanous }; 1060ec8b83dSEd Tanous 1070ec8b83dSEd Tanous enum class Orientation{ 1080ec8b83dSEd Tanous Invalid, 1090ec8b83dSEd Tanous FrontToBack, 1100ec8b83dSEd Tanous BackToFront, 1110ec8b83dSEd Tanous TopToBottom, 1120ec8b83dSEd Tanous BottomToTop, 1130ec8b83dSEd Tanous LeftToRight, 1140ec8b83dSEd Tanous RightToLeft, 1150ec8b83dSEd Tanous }; 1160ec8b83dSEd Tanous 1170ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(State, { 1180ec8b83dSEd Tanous {State::Invalid, "Invalid"}, 1190ec8b83dSEd Tanous {State::Enabled, "Enabled"}, 1200ec8b83dSEd Tanous {State::Disabled, "Disabled"}, 1210ec8b83dSEd Tanous {State::StandbyOffline, "StandbyOffline"}, 1220ec8b83dSEd Tanous {State::StandbySpare, "StandbySpare"}, 1230ec8b83dSEd Tanous {State::InTest, "InTest"}, 1240ec8b83dSEd Tanous {State::Starting, "Starting"}, 1250ec8b83dSEd Tanous {State::Absent, "Absent"}, 1260ec8b83dSEd Tanous {State::UnavailableOffline, "UnavailableOffline"}, 1270ec8b83dSEd Tanous {State::Deferring, "Deferring"}, 1280ec8b83dSEd Tanous {State::Quiesced, "Quiesced"}, 1290ec8b83dSEd Tanous {State::Updating, "Updating"}, 1300ec8b83dSEd Tanous {State::Qualified, "Qualified"}, 131f2a8e57eSGunnar Mills {State::Degraded, "Degraded"}, 1320ec8b83dSEd Tanous }); 1330ec8b83dSEd Tanous 1340ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(Health, { 1350ec8b83dSEd Tanous {Health::Invalid, "Invalid"}, 1360ec8b83dSEd Tanous {Health::OK, "OK"}, 1370ec8b83dSEd Tanous {Health::Warning, "Warning"}, 1380ec8b83dSEd Tanous {Health::Critical, "Critical"}, 1390ec8b83dSEd Tanous }); 1400ec8b83dSEd Tanous 1410ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(ResetType, { 1420ec8b83dSEd Tanous {ResetType::Invalid, "Invalid"}, 1430ec8b83dSEd Tanous {ResetType::On, "On"}, 1440ec8b83dSEd Tanous {ResetType::ForceOff, "ForceOff"}, 1450ec8b83dSEd Tanous {ResetType::GracefulShutdown, "GracefulShutdown"}, 1460ec8b83dSEd Tanous {ResetType::GracefulRestart, "GracefulRestart"}, 1470ec8b83dSEd Tanous {ResetType::ForceRestart, "ForceRestart"}, 1480ec8b83dSEd Tanous {ResetType::Nmi, "Nmi"}, 1490ec8b83dSEd Tanous {ResetType::ForceOn, "ForceOn"}, 1500ec8b83dSEd Tanous {ResetType::PushPowerButton, "PushPowerButton"}, 1510ec8b83dSEd Tanous {ResetType::PowerCycle, "PowerCycle"}, 1520ec8b83dSEd Tanous {ResetType::Suspend, "Suspend"}, 1530ec8b83dSEd Tanous {ResetType::Pause, "Pause"}, 1540ec8b83dSEd Tanous {ResetType::Resume, "Resume"}, 1550ec8b83dSEd Tanous }); 1560ec8b83dSEd Tanous 1570ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(IndicatorLED, { 1580ec8b83dSEd Tanous {IndicatorLED::Invalid, "Invalid"}, 1590ec8b83dSEd Tanous {IndicatorLED::Lit, "Lit"}, 1600ec8b83dSEd Tanous {IndicatorLED::Blinking, "Blinking"}, 1610ec8b83dSEd Tanous {IndicatorLED::Off, "Off"}, 1620ec8b83dSEd Tanous }); 1630ec8b83dSEd Tanous 1640ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(PowerState, { 1650ec8b83dSEd Tanous {PowerState::Invalid, "Invalid"}, 1660ec8b83dSEd Tanous {PowerState::On, "On"}, 1670ec8b83dSEd Tanous {PowerState::Off, "Off"}, 1680ec8b83dSEd Tanous {PowerState::PoweringOn, "PoweringOn"}, 1690ec8b83dSEd Tanous {PowerState::PoweringOff, "PoweringOff"}, 1700ec8b83dSEd Tanous {PowerState::Paused, "Paused"}, 1710ec8b83dSEd Tanous }); 1720ec8b83dSEd Tanous 1730ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(DurableNameFormat, { 1740ec8b83dSEd Tanous {DurableNameFormat::Invalid, "Invalid"}, 1750ec8b83dSEd Tanous {DurableNameFormat::NAA, "NAA"}, 1760ec8b83dSEd Tanous {DurableNameFormat::iQN, "iQN"}, 1770ec8b83dSEd Tanous {DurableNameFormat::FC_WWN, "FC_WWN"}, 1780ec8b83dSEd Tanous {DurableNameFormat::UUID, "UUID"}, 1790ec8b83dSEd Tanous {DurableNameFormat::EUI, "EUI"}, 1800ec8b83dSEd Tanous {DurableNameFormat::NQN, "NQN"}, 1810ec8b83dSEd Tanous {DurableNameFormat::NSID, "NSID"}, 1820ec8b83dSEd Tanous {DurableNameFormat::NGUID, "NGUID"}, 1830ec8b83dSEd Tanous {DurableNameFormat::MACAddress, "MACAddress"}, 184a8d8f9d8SEd Tanous {DurableNameFormat::GCXLID, "GCXLID"}, 1850ec8b83dSEd Tanous }); 1860ec8b83dSEd Tanous 1870ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(RackUnits, { 1880ec8b83dSEd Tanous {RackUnits::Invalid, "Invalid"}, 1890ec8b83dSEd Tanous {RackUnits::OpenU, "OpenU"}, 1900ec8b83dSEd Tanous {RackUnits::EIA_310, "EIA_310"}, 1910ec8b83dSEd Tanous }); 1920ec8b83dSEd Tanous 1930ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(LocationType, { 1940ec8b83dSEd Tanous {LocationType::Invalid, "Invalid"}, 1950ec8b83dSEd Tanous {LocationType::Slot, "Slot"}, 1960ec8b83dSEd Tanous {LocationType::Bay, "Bay"}, 1970ec8b83dSEd Tanous {LocationType::Connector, "Connector"}, 1980ec8b83dSEd Tanous {LocationType::Socket, "Socket"}, 1990ec8b83dSEd Tanous {LocationType::Backplane, "Backplane"}, 2000ec8b83dSEd Tanous {LocationType::Embedded, "Embedded"}, 2010ec8b83dSEd Tanous }); 2020ec8b83dSEd Tanous 2030ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(Reference, { 2040ec8b83dSEd Tanous {Reference::Invalid, "Invalid"}, 2050ec8b83dSEd Tanous {Reference::Top, "Top"}, 2060ec8b83dSEd Tanous {Reference::Bottom, "Bottom"}, 2070ec8b83dSEd Tanous {Reference::Front, "Front"}, 2080ec8b83dSEd Tanous {Reference::Rear, "Rear"}, 2090ec8b83dSEd Tanous {Reference::Left, "Left"}, 2100ec8b83dSEd Tanous {Reference::Right, "Right"}, 2110ec8b83dSEd Tanous {Reference::Middle, "Middle"}, 2120ec8b83dSEd Tanous }); 2130ec8b83dSEd Tanous 2140ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(Orientation, { 2150ec8b83dSEd Tanous {Orientation::Invalid, "Invalid"}, 2160ec8b83dSEd Tanous {Orientation::FrontToBack, "FrontToBack"}, 2170ec8b83dSEd Tanous {Orientation::BackToFront, "BackToFront"}, 2180ec8b83dSEd Tanous {Orientation::TopToBottom, "TopToBottom"}, 2190ec8b83dSEd Tanous {Orientation::BottomToTop, "BottomToTop"}, 2200ec8b83dSEd Tanous {Orientation::LeftToRight, "LeftToRight"}, 2210ec8b83dSEd Tanous {Orientation::RightToLeft, "RightToLeft"}, 2220ec8b83dSEd Tanous }); 2230ec8b83dSEd Tanous 2240ec8b83dSEd Tanous } 2250ec8b83dSEd Tanous // clang-format on 226