1 #pragma once
2 #include <nlohmann/json.hpp>
3 
4 namespace port
5 {
6 // clang-format off
7 
8 enum class PortType{
9     Invalid,
10     UpstreamPort,
11     DownstreamPort,
12     InterswitchPort,
13     ManagementPort,
14     BidirectionalPort,
15     UnconfiguredPort,
16 };
17 
18 enum class PortMedium{
19     Invalid,
20     Electrical,
21     Optical,
22 };
23 
24 enum class LinkState{
25     Invalid,
26     Enabled,
27     Disabled,
28 };
29 
30 enum class LinkStatus{
31     Invalid,
32     LinkUp,
33     Starting,
34     Training,
35     LinkDown,
36     NoLink,
37 };
38 
39 enum class LinkNetworkTechnology{
40     Invalid,
41     Ethernet,
42     InfiniBand,
43     FibreChannel,
44     GenZ,
45     PCIe,
46 };
47 
48 enum class PortConnectionType{
49     Invalid,
50     NotConnected,
51     NPort,
52     PointToPoint,
53     PrivateLoop,
54     PublicLoop,
55     Generic,
56     ExtenderFabric,
57     FPort,
58     EPort,
59     TEPort,
60     NPPort,
61     GPort,
62     NLPort,
63     FLPort,
64     EXPort,
65     UPort,
66     DPort,
67 };
68 
69 enum class SupportedEthernetCapabilities{
70     Invalid,
71     WakeOnLAN,
72     EEE,
73 };
74 
75 enum class FlowControl{
76     Invalid,
77     None,
78     TX,
79     RX,
80     TX_RX,
81 };
82 
83 enum class IEEE802IdSubtype{
84     Invalid,
85     ChassisComp,
86     IfAlias,
87     PortComp,
88     MacAddr,
89     NetworkAddr,
90     IfName,
91     AgentId,
92     LocalAssign,
93     NotTransmitted,
94 };
95 
96 enum class SFPType{
97     Invalid,
98     SFP,
99     SFPPlus,
100     SFP28,
101     cSFP,
102     SFPDD,
103     QSFP,
104     QSFPPlus,
105     QSFP14,
106     QSFP28,
107     QSFP56,
108     MiniSASHD,
109     QSFPDD,
110     OSFP,
111 };
112 
113 enum class MediumType{
114     Invalid,
115     Copper,
116     FiberOptic,
117 };
118 
119 enum class FiberConnectionType{
120     Invalid,
121     SingleMode,
122     MultiMode,
123 };
124 
125 enum class LLDPSystemCapabilities{
126     Invalid,
127     None,
128     Bridge,
129     DOCSISCableDevice,
130     Other,
131     Repeater,
132     Router,
133     Station,
134     Telephone,
135     WLANAccessPoint,
136 };
137 
138 enum class CurrentPortConfigurationState{
139     Invalid,
140     Disabled,
141     BindInProgress,
142     UnbindInProgress,
143     DSP,
144     USP,
145     Reserved,
146 };
147 
148 enum class ConnectedDeviceMode{
149     Invalid,
150     Disconnected,
151     RCD,
152     CXL68BFlitAndVH,
153     Standard256BFlit,
154     CXLLatencyOptimized256BFlit,
155     PBR,
156 };
157 
158 enum class ConnectedDeviceType{
159     Invalid,
160     None,
161     PCIeDevice,
162     Type1,
163     Type2,
164     Type3SLD,
165     Type3MLD,
166 };
167 
168 NLOHMANN_JSON_SERIALIZE_ENUM(PortType, {
169     {PortType::Invalid, "Invalid"},
170     {PortType::UpstreamPort, "UpstreamPort"},
171     {PortType::DownstreamPort, "DownstreamPort"},
172     {PortType::InterswitchPort, "InterswitchPort"},
173     {PortType::ManagementPort, "ManagementPort"},
174     {PortType::BidirectionalPort, "BidirectionalPort"},
175     {PortType::UnconfiguredPort, "UnconfiguredPort"},
176 });
177 
178 NLOHMANN_JSON_SERIALIZE_ENUM(PortMedium, {
179     {PortMedium::Invalid, "Invalid"},
180     {PortMedium::Electrical, "Electrical"},
181     {PortMedium::Optical, "Optical"},
182 });
183 
184 NLOHMANN_JSON_SERIALIZE_ENUM(LinkState, {
185     {LinkState::Invalid, "Invalid"},
186     {LinkState::Enabled, "Enabled"},
187     {LinkState::Disabled, "Disabled"},
188 });
189 
190 NLOHMANN_JSON_SERIALIZE_ENUM(LinkStatus, {
191     {LinkStatus::Invalid, "Invalid"},
192     {LinkStatus::LinkUp, "LinkUp"},
193     {LinkStatus::Starting, "Starting"},
194     {LinkStatus::Training, "Training"},
195     {LinkStatus::LinkDown, "LinkDown"},
196     {LinkStatus::NoLink, "NoLink"},
197 });
198 
199 NLOHMANN_JSON_SERIALIZE_ENUM(LinkNetworkTechnology, {
200     {LinkNetworkTechnology::Invalid, "Invalid"},
201     {LinkNetworkTechnology::Ethernet, "Ethernet"},
202     {LinkNetworkTechnology::InfiniBand, "InfiniBand"},
203     {LinkNetworkTechnology::FibreChannel, "FibreChannel"},
204     {LinkNetworkTechnology::GenZ, "GenZ"},
205     {LinkNetworkTechnology::PCIe, "PCIe"},
206 });
207 
208 NLOHMANN_JSON_SERIALIZE_ENUM(PortConnectionType, {
209     {PortConnectionType::Invalid, "Invalid"},
210     {PortConnectionType::NotConnected, "NotConnected"},
211     {PortConnectionType::NPort, "NPort"},
212     {PortConnectionType::PointToPoint, "PointToPoint"},
213     {PortConnectionType::PrivateLoop, "PrivateLoop"},
214     {PortConnectionType::PublicLoop, "PublicLoop"},
215     {PortConnectionType::Generic, "Generic"},
216     {PortConnectionType::ExtenderFabric, "ExtenderFabric"},
217     {PortConnectionType::FPort, "FPort"},
218     {PortConnectionType::EPort, "EPort"},
219     {PortConnectionType::TEPort, "TEPort"},
220     {PortConnectionType::NPPort, "NPPort"},
221     {PortConnectionType::GPort, "GPort"},
222     {PortConnectionType::NLPort, "NLPort"},
223     {PortConnectionType::FLPort, "FLPort"},
224     {PortConnectionType::EXPort, "EXPort"},
225     {PortConnectionType::UPort, "UPort"},
226     {PortConnectionType::DPort, "DPort"},
227 });
228 
229 NLOHMANN_JSON_SERIALIZE_ENUM(SupportedEthernetCapabilities, {
230     {SupportedEthernetCapabilities::Invalid, "Invalid"},
231     {SupportedEthernetCapabilities::WakeOnLAN, "WakeOnLAN"},
232     {SupportedEthernetCapabilities::EEE, "EEE"},
233 });
234 
235 NLOHMANN_JSON_SERIALIZE_ENUM(FlowControl, {
236     {FlowControl::Invalid, "Invalid"},
237     {FlowControl::None, "None"},
238     {FlowControl::TX, "TX"},
239     {FlowControl::RX, "RX"},
240     {FlowControl::TX_RX, "TX_RX"},
241 });
242 
243 NLOHMANN_JSON_SERIALIZE_ENUM(IEEE802IdSubtype, {
244     {IEEE802IdSubtype::Invalid, "Invalid"},
245     {IEEE802IdSubtype::ChassisComp, "ChassisComp"},
246     {IEEE802IdSubtype::IfAlias, "IfAlias"},
247     {IEEE802IdSubtype::PortComp, "PortComp"},
248     {IEEE802IdSubtype::MacAddr, "MacAddr"},
249     {IEEE802IdSubtype::NetworkAddr, "NetworkAddr"},
250     {IEEE802IdSubtype::IfName, "IfName"},
251     {IEEE802IdSubtype::AgentId, "AgentId"},
252     {IEEE802IdSubtype::LocalAssign, "LocalAssign"},
253     {IEEE802IdSubtype::NotTransmitted, "NotTransmitted"},
254 });
255 
256 NLOHMANN_JSON_SERIALIZE_ENUM(SFPType, {
257     {SFPType::Invalid, "Invalid"},
258     {SFPType::SFP, "SFP"},
259     {SFPType::SFPPlus, "SFPPlus"},
260     {SFPType::SFP28, "SFP28"},
261     {SFPType::cSFP, "cSFP"},
262     {SFPType::SFPDD, "SFPDD"},
263     {SFPType::QSFP, "QSFP"},
264     {SFPType::QSFPPlus, "QSFPPlus"},
265     {SFPType::QSFP14, "QSFP14"},
266     {SFPType::QSFP28, "QSFP28"},
267     {SFPType::QSFP56, "QSFP56"},
268     {SFPType::MiniSASHD, "MiniSASHD"},
269     {SFPType::QSFPDD, "QSFPDD"},
270     {SFPType::OSFP, "OSFP"},
271 });
272 
273 NLOHMANN_JSON_SERIALIZE_ENUM(MediumType, {
274     {MediumType::Invalid, "Invalid"},
275     {MediumType::Copper, "Copper"},
276     {MediumType::FiberOptic, "FiberOptic"},
277 });
278 
279 NLOHMANN_JSON_SERIALIZE_ENUM(FiberConnectionType, {
280     {FiberConnectionType::Invalid, "Invalid"},
281     {FiberConnectionType::SingleMode, "SingleMode"},
282     {FiberConnectionType::MultiMode, "MultiMode"},
283 });
284 
285 NLOHMANN_JSON_SERIALIZE_ENUM(LLDPSystemCapabilities, {
286     {LLDPSystemCapabilities::Invalid, "Invalid"},
287     {LLDPSystemCapabilities::None, "None"},
288     {LLDPSystemCapabilities::Bridge, "Bridge"},
289     {LLDPSystemCapabilities::DOCSISCableDevice, "DOCSISCableDevice"},
290     {LLDPSystemCapabilities::Other, "Other"},
291     {LLDPSystemCapabilities::Repeater, "Repeater"},
292     {LLDPSystemCapabilities::Router, "Router"},
293     {LLDPSystemCapabilities::Station, "Station"},
294     {LLDPSystemCapabilities::Telephone, "Telephone"},
295     {LLDPSystemCapabilities::WLANAccessPoint, "WLANAccessPoint"},
296 });
297 
298 NLOHMANN_JSON_SERIALIZE_ENUM(CurrentPortConfigurationState, {
299     {CurrentPortConfigurationState::Invalid, "Invalid"},
300     {CurrentPortConfigurationState::Disabled, "Disabled"},
301     {CurrentPortConfigurationState::BindInProgress, "BindInProgress"},
302     {CurrentPortConfigurationState::UnbindInProgress, "UnbindInProgress"},
303     {CurrentPortConfigurationState::DSP, "DSP"},
304     {CurrentPortConfigurationState::USP, "USP"},
305     {CurrentPortConfigurationState::Reserved, "Reserved"},
306 });
307 
308 NLOHMANN_JSON_SERIALIZE_ENUM(ConnectedDeviceMode, {
309     {ConnectedDeviceMode::Invalid, "Invalid"},
310     {ConnectedDeviceMode::Disconnected, "Disconnected"},
311     {ConnectedDeviceMode::RCD, "RCD"},
312     {ConnectedDeviceMode::CXL68BFlitAndVH, "CXL68BFlitAndVH"},
313     {ConnectedDeviceMode::Standard256BFlit, "Standard256BFlit"},
314     {ConnectedDeviceMode::CXLLatencyOptimized256BFlit, "CXLLatencyOptimized256BFlit"},
315     {ConnectedDeviceMode::PBR, "PBR"},
316 });
317 
318 NLOHMANN_JSON_SERIALIZE_ENUM(ConnectedDeviceType, {
319     {ConnectedDeviceType::Invalid, "Invalid"},
320     {ConnectedDeviceType::None, "None"},
321     {ConnectedDeviceType::PCIeDevice, "PCIeDevice"},
322     {ConnectedDeviceType::Type1, "Type1"},
323     {ConnectedDeviceType::Type2, "Type2"},
324     {ConnectedDeviceType::Type3SLD, "Type3SLD"},
325     {ConnectedDeviceType::Type3MLD, "Type3MLD"},
326 });
327 
328 }
329 // clang-format on
330