140e9b92eSEd Tanous // SPDX-License-Identifier: Apache-2.0 240e9b92eSEd Tanous // SPDX-FileCopyrightText: Copyright OpenBMC Authors 3853c0dc5SEd Tanous #pragma once 4853c0dc5SEd Tanous #include <nlohmann/json.hpp> 5853c0dc5SEd Tanous 6853c0dc5SEd Tanous namespace port 7853c0dc5SEd Tanous { 8853c0dc5SEd Tanous // clang-format off 9853c0dc5SEd Tanous 10853c0dc5SEd Tanous enum class PortType{ 11853c0dc5SEd Tanous Invalid, 12853c0dc5SEd Tanous UpstreamPort, 13853c0dc5SEd Tanous DownstreamPort, 14853c0dc5SEd Tanous InterswitchPort, 15853c0dc5SEd Tanous ManagementPort, 16853c0dc5SEd Tanous BidirectionalPort, 17853c0dc5SEd Tanous UnconfiguredPort, 18853c0dc5SEd Tanous }; 19853c0dc5SEd Tanous 20853c0dc5SEd Tanous enum class PortMedium{ 21853c0dc5SEd Tanous Invalid, 22853c0dc5SEd Tanous Electrical, 23853c0dc5SEd Tanous Optical, 24853c0dc5SEd Tanous }; 25853c0dc5SEd Tanous 26853c0dc5SEd Tanous enum class LinkState{ 27853c0dc5SEd Tanous Invalid, 28853c0dc5SEd Tanous Enabled, 29853c0dc5SEd Tanous Disabled, 30853c0dc5SEd Tanous }; 31853c0dc5SEd Tanous 32853c0dc5SEd Tanous enum class LinkStatus{ 33853c0dc5SEd Tanous Invalid, 34853c0dc5SEd Tanous LinkUp, 35853c0dc5SEd Tanous Starting, 36853c0dc5SEd Tanous Training, 37853c0dc5SEd Tanous LinkDown, 38853c0dc5SEd Tanous NoLink, 39853c0dc5SEd Tanous }; 40853c0dc5SEd Tanous 41853c0dc5SEd Tanous enum class LinkNetworkTechnology{ 42853c0dc5SEd Tanous Invalid, 43853c0dc5SEd Tanous Ethernet, 44853c0dc5SEd Tanous InfiniBand, 45853c0dc5SEd Tanous FibreChannel, 46853c0dc5SEd Tanous GenZ, 47a8d8f9d8SEd Tanous PCIe, 48853c0dc5SEd Tanous }; 49853c0dc5SEd Tanous 50853c0dc5SEd Tanous enum class PortConnectionType{ 51853c0dc5SEd Tanous Invalid, 52853c0dc5SEd Tanous NotConnected, 53853c0dc5SEd Tanous NPort, 54853c0dc5SEd Tanous PointToPoint, 55853c0dc5SEd Tanous PrivateLoop, 56853c0dc5SEd Tanous PublicLoop, 57853c0dc5SEd Tanous Generic, 58853c0dc5SEd Tanous ExtenderFabric, 59853c0dc5SEd Tanous FPort, 60853c0dc5SEd Tanous EPort, 61853c0dc5SEd Tanous TEPort, 62853c0dc5SEd Tanous NPPort, 63853c0dc5SEd Tanous GPort, 64853c0dc5SEd Tanous NLPort, 65853c0dc5SEd Tanous FLPort, 66853c0dc5SEd Tanous EXPort, 67853c0dc5SEd Tanous UPort, 68853c0dc5SEd Tanous DPort, 69853c0dc5SEd Tanous }; 70853c0dc5SEd Tanous 71853c0dc5SEd Tanous enum class SupportedEthernetCapabilities{ 72853c0dc5SEd Tanous Invalid, 73853c0dc5SEd Tanous WakeOnLAN, 74853c0dc5SEd Tanous EEE, 75853c0dc5SEd Tanous }; 76853c0dc5SEd Tanous 77853c0dc5SEd Tanous enum class FlowControl{ 78853c0dc5SEd Tanous Invalid, 79853c0dc5SEd Tanous None, 80853c0dc5SEd Tanous TX, 81853c0dc5SEd Tanous RX, 82853c0dc5SEd Tanous TX_RX, 83853c0dc5SEd Tanous }; 84853c0dc5SEd Tanous 85853c0dc5SEd Tanous enum class IEEE802IdSubtype{ 86853c0dc5SEd Tanous Invalid, 87853c0dc5SEd Tanous ChassisComp, 88853c0dc5SEd Tanous IfAlias, 89853c0dc5SEd Tanous PortComp, 90853c0dc5SEd Tanous MacAddr, 91853c0dc5SEd Tanous NetworkAddr, 92853c0dc5SEd Tanous IfName, 93853c0dc5SEd Tanous AgentId, 94853c0dc5SEd Tanous LocalAssign, 95853c0dc5SEd Tanous NotTransmitted, 96853c0dc5SEd Tanous }; 97853c0dc5SEd Tanous 98853c0dc5SEd Tanous enum class SFPType{ 99853c0dc5SEd Tanous Invalid, 100853c0dc5SEd Tanous SFP, 101853c0dc5SEd Tanous SFPPlus, 102853c0dc5SEd Tanous SFP28, 103853c0dc5SEd Tanous cSFP, 104853c0dc5SEd Tanous SFPDD, 105853c0dc5SEd Tanous QSFP, 106853c0dc5SEd Tanous QSFPPlus, 107853c0dc5SEd Tanous QSFP14, 108853c0dc5SEd Tanous QSFP28, 109853c0dc5SEd Tanous QSFP56, 110853c0dc5SEd Tanous MiniSASHD, 111f263e09cSEd Tanous QSFPDD, 112f263e09cSEd Tanous OSFP, 113853c0dc5SEd Tanous }; 114853c0dc5SEd Tanous 115853c0dc5SEd Tanous enum class MediumType{ 116853c0dc5SEd Tanous Invalid, 117853c0dc5SEd Tanous Copper, 118853c0dc5SEd Tanous FiberOptic, 119853c0dc5SEd Tanous }; 120853c0dc5SEd Tanous 121853c0dc5SEd Tanous enum class FiberConnectionType{ 122853c0dc5SEd Tanous Invalid, 123853c0dc5SEd Tanous SingleMode, 124853c0dc5SEd Tanous MultiMode, 125853c0dc5SEd Tanous }; 126853c0dc5SEd Tanous 127a8d8f9d8SEd Tanous enum class LLDPSystemCapabilities{ 128a8d8f9d8SEd Tanous Invalid, 129a8d8f9d8SEd Tanous None, 130a8d8f9d8SEd Tanous Bridge, 131a8d8f9d8SEd Tanous DOCSISCableDevice, 132a8d8f9d8SEd Tanous Other, 133a8d8f9d8SEd Tanous Repeater, 134a8d8f9d8SEd Tanous Router, 135a8d8f9d8SEd Tanous Station, 136a8d8f9d8SEd Tanous Telephone, 137a8d8f9d8SEd Tanous WLANAccessPoint, 138a8d8f9d8SEd Tanous }; 139a8d8f9d8SEd Tanous 140a8d8f9d8SEd Tanous enum class CurrentPortConfigurationState{ 141a8d8f9d8SEd Tanous Invalid, 142a8d8f9d8SEd Tanous Disabled, 143a8d8f9d8SEd Tanous BindInProgress, 144a8d8f9d8SEd Tanous UnbindInProgress, 145a8d8f9d8SEd Tanous DSP, 146a8d8f9d8SEd Tanous USP, 147a8d8f9d8SEd Tanous Reserved, 1482ae81db9SGunnar Mills FabricLink, 149a8d8f9d8SEd Tanous }; 150a8d8f9d8SEd Tanous 151a8d8f9d8SEd Tanous enum class ConnectedDeviceMode{ 152a8d8f9d8SEd Tanous Invalid, 153a8d8f9d8SEd Tanous Disconnected, 154a8d8f9d8SEd Tanous RCD, 155a8d8f9d8SEd Tanous CXL68BFlitAndVH, 156a8d8f9d8SEd Tanous Standard256BFlit, 157a8d8f9d8SEd Tanous CXLLatencyOptimized256BFlit, 158a8d8f9d8SEd Tanous PBR, 159a8d8f9d8SEd Tanous }; 160a8d8f9d8SEd Tanous 161a8d8f9d8SEd Tanous enum class ConnectedDeviceType{ 162a8d8f9d8SEd Tanous Invalid, 163a8d8f9d8SEd Tanous None, 164a8d8f9d8SEd Tanous PCIeDevice, 165a8d8f9d8SEd Tanous Type1, 166a8d8f9d8SEd Tanous Type2, 167a8d8f9d8SEd Tanous Type3SLD, 168a8d8f9d8SEd Tanous Type3MLD, 169a8d8f9d8SEd Tanous }; 170a8d8f9d8SEd Tanous 171*9b46bc0bSMyung Bae enum class HostDeviceType{ 172*9b46bc0bSMyung Bae Invalid, 173*9b46bc0bSMyung Bae None, 174*9b46bc0bSMyung Bae System, 175*9b46bc0bSMyung Bae Manager, 176*9b46bc0bSMyung Bae }; 177*9b46bc0bSMyung Bae 178853c0dc5SEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(PortType, { 179853c0dc5SEd Tanous {PortType::Invalid, "Invalid"}, 180853c0dc5SEd Tanous {PortType::UpstreamPort, "UpstreamPort"}, 181853c0dc5SEd Tanous {PortType::DownstreamPort, "DownstreamPort"}, 182853c0dc5SEd Tanous {PortType::InterswitchPort, "InterswitchPort"}, 183853c0dc5SEd Tanous {PortType::ManagementPort, "ManagementPort"}, 184853c0dc5SEd Tanous {PortType::BidirectionalPort, "BidirectionalPort"}, 185853c0dc5SEd Tanous {PortType::UnconfiguredPort, "UnconfiguredPort"}, 186853c0dc5SEd Tanous }); 187853c0dc5SEd Tanous 188853c0dc5SEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(PortMedium, { 189853c0dc5SEd Tanous {PortMedium::Invalid, "Invalid"}, 190853c0dc5SEd Tanous {PortMedium::Electrical, "Electrical"}, 191853c0dc5SEd Tanous {PortMedium::Optical, "Optical"}, 192853c0dc5SEd Tanous }); 193853c0dc5SEd Tanous 194853c0dc5SEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(LinkState, { 195853c0dc5SEd Tanous {LinkState::Invalid, "Invalid"}, 196853c0dc5SEd Tanous {LinkState::Enabled, "Enabled"}, 197853c0dc5SEd Tanous {LinkState::Disabled, "Disabled"}, 198853c0dc5SEd Tanous }); 199853c0dc5SEd Tanous 200853c0dc5SEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(LinkStatus, { 201853c0dc5SEd Tanous {LinkStatus::Invalid, "Invalid"}, 202853c0dc5SEd Tanous {LinkStatus::LinkUp, "LinkUp"}, 203853c0dc5SEd Tanous {LinkStatus::Starting, "Starting"}, 204853c0dc5SEd Tanous {LinkStatus::Training, "Training"}, 205853c0dc5SEd Tanous {LinkStatus::LinkDown, "LinkDown"}, 206853c0dc5SEd Tanous {LinkStatus::NoLink, "NoLink"}, 207853c0dc5SEd Tanous }); 208853c0dc5SEd Tanous 209853c0dc5SEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(LinkNetworkTechnology, { 210853c0dc5SEd Tanous {LinkNetworkTechnology::Invalid, "Invalid"}, 211853c0dc5SEd Tanous {LinkNetworkTechnology::Ethernet, "Ethernet"}, 212853c0dc5SEd Tanous {LinkNetworkTechnology::InfiniBand, "InfiniBand"}, 213853c0dc5SEd Tanous {LinkNetworkTechnology::FibreChannel, "FibreChannel"}, 214853c0dc5SEd Tanous {LinkNetworkTechnology::GenZ, "GenZ"}, 215a8d8f9d8SEd Tanous {LinkNetworkTechnology::PCIe, "PCIe"}, 216853c0dc5SEd Tanous }); 217853c0dc5SEd Tanous 218853c0dc5SEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(PortConnectionType, { 219853c0dc5SEd Tanous {PortConnectionType::Invalid, "Invalid"}, 220853c0dc5SEd Tanous {PortConnectionType::NotConnected, "NotConnected"}, 221853c0dc5SEd Tanous {PortConnectionType::NPort, "NPort"}, 222853c0dc5SEd Tanous {PortConnectionType::PointToPoint, "PointToPoint"}, 223853c0dc5SEd Tanous {PortConnectionType::PrivateLoop, "PrivateLoop"}, 224853c0dc5SEd Tanous {PortConnectionType::PublicLoop, "PublicLoop"}, 225853c0dc5SEd Tanous {PortConnectionType::Generic, "Generic"}, 226853c0dc5SEd Tanous {PortConnectionType::ExtenderFabric, "ExtenderFabric"}, 227853c0dc5SEd Tanous {PortConnectionType::FPort, "FPort"}, 228853c0dc5SEd Tanous {PortConnectionType::EPort, "EPort"}, 229853c0dc5SEd Tanous {PortConnectionType::TEPort, "TEPort"}, 230853c0dc5SEd Tanous {PortConnectionType::NPPort, "NPPort"}, 231853c0dc5SEd Tanous {PortConnectionType::GPort, "GPort"}, 232853c0dc5SEd Tanous {PortConnectionType::NLPort, "NLPort"}, 233853c0dc5SEd Tanous {PortConnectionType::FLPort, "FLPort"}, 234853c0dc5SEd Tanous {PortConnectionType::EXPort, "EXPort"}, 235853c0dc5SEd Tanous {PortConnectionType::UPort, "UPort"}, 236853c0dc5SEd Tanous {PortConnectionType::DPort, "DPort"}, 237853c0dc5SEd Tanous }); 238853c0dc5SEd Tanous 239853c0dc5SEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(SupportedEthernetCapabilities, { 240853c0dc5SEd Tanous {SupportedEthernetCapabilities::Invalid, "Invalid"}, 241853c0dc5SEd Tanous {SupportedEthernetCapabilities::WakeOnLAN, "WakeOnLAN"}, 242853c0dc5SEd Tanous {SupportedEthernetCapabilities::EEE, "EEE"}, 243853c0dc5SEd Tanous }); 244853c0dc5SEd Tanous 245853c0dc5SEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(FlowControl, { 246853c0dc5SEd Tanous {FlowControl::Invalid, "Invalid"}, 247853c0dc5SEd Tanous {FlowControl::None, "None"}, 248853c0dc5SEd Tanous {FlowControl::TX, "TX"}, 249853c0dc5SEd Tanous {FlowControl::RX, "RX"}, 250853c0dc5SEd Tanous {FlowControl::TX_RX, "TX_RX"}, 251853c0dc5SEd Tanous }); 252853c0dc5SEd Tanous 253853c0dc5SEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(IEEE802IdSubtype, { 254853c0dc5SEd Tanous {IEEE802IdSubtype::Invalid, "Invalid"}, 255853c0dc5SEd Tanous {IEEE802IdSubtype::ChassisComp, "ChassisComp"}, 256853c0dc5SEd Tanous {IEEE802IdSubtype::IfAlias, "IfAlias"}, 257853c0dc5SEd Tanous {IEEE802IdSubtype::PortComp, "PortComp"}, 258853c0dc5SEd Tanous {IEEE802IdSubtype::MacAddr, "MacAddr"}, 259853c0dc5SEd Tanous {IEEE802IdSubtype::NetworkAddr, "NetworkAddr"}, 260853c0dc5SEd Tanous {IEEE802IdSubtype::IfName, "IfName"}, 261853c0dc5SEd Tanous {IEEE802IdSubtype::AgentId, "AgentId"}, 262853c0dc5SEd Tanous {IEEE802IdSubtype::LocalAssign, "LocalAssign"}, 263853c0dc5SEd Tanous {IEEE802IdSubtype::NotTransmitted, "NotTransmitted"}, 264853c0dc5SEd Tanous }); 265853c0dc5SEd Tanous 266853c0dc5SEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(SFPType, { 267853c0dc5SEd Tanous {SFPType::Invalid, "Invalid"}, 268853c0dc5SEd Tanous {SFPType::SFP, "SFP"}, 269853c0dc5SEd Tanous {SFPType::SFPPlus, "SFPPlus"}, 270853c0dc5SEd Tanous {SFPType::SFP28, "SFP28"}, 271853c0dc5SEd Tanous {SFPType::cSFP, "cSFP"}, 272853c0dc5SEd Tanous {SFPType::SFPDD, "SFPDD"}, 273853c0dc5SEd Tanous {SFPType::QSFP, "QSFP"}, 274853c0dc5SEd Tanous {SFPType::QSFPPlus, "QSFPPlus"}, 275853c0dc5SEd Tanous {SFPType::QSFP14, "QSFP14"}, 276853c0dc5SEd Tanous {SFPType::QSFP28, "QSFP28"}, 277853c0dc5SEd Tanous {SFPType::QSFP56, "QSFP56"}, 278853c0dc5SEd Tanous {SFPType::MiniSASHD, "MiniSASHD"}, 279f263e09cSEd Tanous {SFPType::QSFPDD, "QSFPDD"}, 280f263e09cSEd Tanous {SFPType::OSFP, "OSFP"}, 281853c0dc5SEd Tanous }); 282853c0dc5SEd Tanous 283853c0dc5SEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(MediumType, { 284853c0dc5SEd Tanous {MediumType::Invalid, "Invalid"}, 285853c0dc5SEd Tanous {MediumType::Copper, "Copper"}, 286853c0dc5SEd Tanous {MediumType::FiberOptic, "FiberOptic"}, 287853c0dc5SEd Tanous }); 288853c0dc5SEd Tanous 289853c0dc5SEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(FiberConnectionType, { 290853c0dc5SEd Tanous {FiberConnectionType::Invalid, "Invalid"}, 291853c0dc5SEd Tanous {FiberConnectionType::SingleMode, "SingleMode"}, 292853c0dc5SEd Tanous {FiberConnectionType::MultiMode, "MultiMode"}, 293853c0dc5SEd Tanous }); 294853c0dc5SEd Tanous 295a8d8f9d8SEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(LLDPSystemCapabilities, { 296a8d8f9d8SEd Tanous {LLDPSystemCapabilities::Invalid, "Invalid"}, 297a8d8f9d8SEd Tanous {LLDPSystemCapabilities::None, "None"}, 298a8d8f9d8SEd Tanous {LLDPSystemCapabilities::Bridge, "Bridge"}, 299a8d8f9d8SEd Tanous {LLDPSystemCapabilities::DOCSISCableDevice, "DOCSISCableDevice"}, 300a8d8f9d8SEd Tanous {LLDPSystemCapabilities::Other, "Other"}, 301a8d8f9d8SEd Tanous {LLDPSystemCapabilities::Repeater, "Repeater"}, 302a8d8f9d8SEd Tanous {LLDPSystemCapabilities::Router, "Router"}, 303a8d8f9d8SEd Tanous {LLDPSystemCapabilities::Station, "Station"}, 304a8d8f9d8SEd Tanous {LLDPSystemCapabilities::Telephone, "Telephone"}, 305a8d8f9d8SEd Tanous {LLDPSystemCapabilities::WLANAccessPoint, "WLANAccessPoint"}, 306a8d8f9d8SEd Tanous }); 307a8d8f9d8SEd Tanous 308a8d8f9d8SEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(CurrentPortConfigurationState, { 309a8d8f9d8SEd Tanous {CurrentPortConfigurationState::Invalid, "Invalid"}, 310a8d8f9d8SEd Tanous {CurrentPortConfigurationState::Disabled, "Disabled"}, 311a8d8f9d8SEd Tanous {CurrentPortConfigurationState::BindInProgress, "BindInProgress"}, 312a8d8f9d8SEd Tanous {CurrentPortConfigurationState::UnbindInProgress, "UnbindInProgress"}, 313a8d8f9d8SEd Tanous {CurrentPortConfigurationState::DSP, "DSP"}, 314a8d8f9d8SEd Tanous {CurrentPortConfigurationState::USP, "USP"}, 315a8d8f9d8SEd Tanous {CurrentPortConfigurationState::Reserved, "Reserved"}, 3162ae81db9SGunnar Mills {CurrentPortConfigurationState::FabricLink, "FabricLink"}, 317a8d8f9d8SEd Tanous }); 318a8d8f9d8SEd Tanous 319a8d8f9d8SEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(ConnectedDeviceMode, { 320a8d8f9d8SEd Tanous {ConnectedDeviceMode::Invalid, "Invalid"}, 321a8d8f9d8SEd Tanous {ConnectedDeviceMode::Disconnected, "Disconnected"}, 322a8d8f9d8SEd Tanous {ConnectedDeviceMode::RCD, "RCD"}, 323a8d8f9d8SEd Tanous {ConnectedDeviceMode::CXL68BFlitAndVH, "CXL68BFlitAndVH"}, 324a8d8f9d8SEd Tanous {ConnectedDeviceMode::Standard256BFlit, "Standard256BFlit"}, 325a8d8f9d8SEd Tanous {ConnectedDeviceMode::CXLLatencyOptimized256BFlit, "CXLLatencyOptimized256BFlit"}, 326a8d8f9d8SEd Tanous {ConnectedDeviceMode::PBR, "PBR"}, 327a8d8f9d8SEd Tanous }); 328a8d8f9d8SEd Tanous 329a8d8f9d8SEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(ConnectedDeviceType, { 330a8d8f9d8SEd Tanous {ConnectedDeviceType::Invalid, "Invalid"}, 331a8d8f9d8SEd Tanous {ConnectedDeviceType::None, "None"}, 332a8d8f9d8SEd Tanous {ConnectedDeviceType::PCIeDevice, "PCIeDevice"}, 333a8d8f9d8SEd Tanous {ConnectedDeviceType::Type1, "Type1"}, 334a8d8f9d8SEd Tanous {ConnectedDeviceType::Type2, "Type2"}, 335a8d8f9d8SEd Tanous {ConnectedDeviceType::Type3SLD, "Type3SLD"}, 336a8d8f9d8SEd Tanous {ConnectedDeviceType::Type3MLD, "Type3MLD"}, 337a8d8f9d8SEd Tanous }); 338a8d8f9d8SEd Tanous 339*9b46bc0bSMyung Bae NLOHMANN_JSON_SERIALIZE_ENUM(HostDeviceType, { 340*9b46bc0bSMyung Bae {HostDeviceType::Invalid, "Invalid"}, 341*9b46bc0bSMyung Bae {HostDeviceType::None, "None"}, 342*9b46bc0bSMyung Bae {HostDeviceType::System, "System"}, 343*9b46bc0bSMyung Bae {HostDeviceType::Manager, "Manager"}, 344*9b46bc0bSMyung Bae }); 345*9b46bc0bSMyung Bae 346853c0dc5SEd Tanous } 347853c0dc5SEd Tanous // clang-format on 348