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     FabricLink,
147 };
148 
149 enum class ConnectedDeviceMode{
150     Invalid,
151     Disconnected,
152     RCD,
153     CXL68BFlitAndVH,
154     Standard256BFlit,
155     CXLLatencyOptimized256BFlit,
156     PBR,
157 };
158 
159 enum class ConnectedDeviceType{
160     Invalid,
161     None,
162     PCIeDevice,
163     Type1,
164     Type2,
165     Type3SLD,
166     Type3MLD,
167 };
168 
169 NLOHMANN_JSON_SERIALIZE_ENUM(PortType, {
170     {PortType::Invalid, "Invalid"},
171     {PortType::UpstreamPort, "UpstreamPort"},
172     {PortType::DownstreamPort, "DownstreamPort"},
173     {PortType::InterswitchPort, "InterswitchPort"},
174     {PortType::ManagementPort, "ManagementPort"},
175     {PortType::BidirectionalPort, "BidirectionalPort"},
176     {PortType::UnconfiguredPort, "UnconfiguredPort"},
177 });
178 
179 NLOHMANN_JSON_SERIALIZE_ENUM(PortMedium, {
180     {PortMedium::Invalid, "Invalid"},
181     {PortMedium::Electrical, "Electrical"},
182     {PortMedium::Optical, "Optical"},
183 });
184 
185 NLOHMANN_JSON_SERIALIZE_ENUM(LinkState, {
186     {LinkState::Invalid, "Invalid"},
187     {LinkState::Enabled, "Enabled"},
188     {LinkState::Disabled, "Disabled"},
189 });
190 
191 NLOHMANN_JSON_SERIALIZE_ENUM(LinkStatus, {
192     {LinkStatus::Invalid, "Invalid"},
193     {LinkStatus::LinkUp, "LinkUp"},
194     {LinkStatus::Starting, "Starting"},
195     {LinkStatus::Training, "Training"},
196     {LinkStatus::LinkDown, "LinkDown"},
197     {LinkStatus::NoLink, "NoLink"},
198 });
199 
200 NLOHMANN_JSON_SERIALIZE_ENUM(LinkNetworkTechnology, {
201     {LinkNetworkTechnology::Invalid, "Invalid"},
202     {LinkNetworkTechnology::Ethernet, "Ethernet"},
203     {LinkNetworkTechnology::InfiniBand, "InfiniBand"},
204     {LinkNetworkTechnology::FibreChannel, "FibreChannel"},
205     {LinkNetworkTechnology::GenZ, "GenZ"},
206     {LinkNetworkTechnology::PCIe, "PCIe"},
207 });
208 
209 NLOHMANN_JSON_SERIALIZE_ENUM(PortConnectionType, {
210     {PortConnectionType::Invalid, "Invalid"},
211     {PortConnectionType::NotConnected, "NotConnected"},
212     {PortConnectionType::NPort, "NPort"},
213     {PortConnectionType::PointToPoint, "PointToPoint"},
214     {PortConnectionType::PrivateLoop, "PrivateLoop"},
215     {PortConnectionType::PublicLoop, "PublicLoop"},
216     {PortConnectionType::Generic, "Generic"},
217     {PortConnectionType::ExtenderFabric, "ExtenderFabric"},
218     {PortConnectionType::FPort, "FPort"},
219     {PortConnectionType::EPort, "EPort"},
220     {PortConnectionType::TEPort, "TEPort"},
221     {PortConnectionType::NPPort, "NPPort"},
222     {PortConnectionType::GPort, "GPort"},
223     {PortConnectionType::NLPort, "NLPort"},
224     {PortConnectionType::FLPort, "FLPort"},
225     {PortConnectionType::EXPort, "EXPort"},
226     {PortConnectionType::UPort, "UPort"},
227     {PortConnectionType::DPort, "DPort"},
228 });
229 
230 NLOHMANN_JSON_SERIALIZE_ENUM(SupportedEthernetCapabilities, {
231     {SupportedEthernetCapabilities::Invalid, "Invalid"},
232     {SupportedEthernetCapabilities::WakeOnLAN, "WakeOnLAN"},
233     {SupportedEthernetCapabilities::EEE, "EEE"},
234 });
235 
236 NLOHMANN_JSON_SERIALIZE_ENUM(FlowControl, {
237     {FlowControl::Invalid, "Invalid"},
238     {FlowControl::None, "None"},
239     {FlowControl::TX, "TX"},
240     {FlowControl::RX, "RX"},
241     {FlowControl::TX_RX, "TX_RX"},
242 });
243 
244 NLOHMANN_JSON_SERIALIZE_ENUM(IEEE802IdSubtype, {
245     {IEEE802IdSubtype::Invalid, "Invalid"},
246     {IEEE802IdSubtype::ChassisComp, "ChassisComp"},
247     {IEEE802IdSubtype::IfAlias, "IfAlias"},
248     {IEEE802IdSubtype::PortComp, "PortComp"},
249     {IEEE802IdSubtype::MacAddr, "MacAddr"},
250     {IEEE802IdSubtype::NetworkAddr, "NetworkAddr"},
251     {IEEE802IdSubtype::IfName, "IfName"},
252     {IEEE802IdSubtype::AgentId, "AgentId"},
253     {IEEE802IdSubtype::LocalAssign, "LocalAssign"},
254     {IEEE802IdSubtype::NotTransmitted, "NotTransmitted"},
255 });
256 
257 NLOHMANN_JSON_SERIALIZE_ENUM(SFPType, {
258     {SFPType::Invalid, "Invalid"},
259     {SFPType::SFP, "SFP"},
260     {SFPType::SFPPlus, "SFPPlus"},
261     {SFPType::SFP28, "SFP28"},
262     {SFPType::cSFP, "cSFP"},
263     {SFPType::SFPDD, "SFPDD"},
264     {SFPType::QSFP, "QSFP"},
265     {SFPType::QSFPPlus, "QSFPPlus"},
266     {SFPType::QSFP14, "QSFP14"},
267     {SFPType::QSFP28, "QSFP28"},
268     {SFPType::QSFP56, "QSFP56"},
269     {SFPType::MiniSASHD, "MiniSASHD"},
270     {SFPType::QSFPDD, "QSFPDD"},
271     {SFPType::OSFP, "OSFP"},
272 });
273 
274 NLOHMANN_JSON_SERIALIZE_ENUM(MediumType, {
275     {MediumType::Invalid, "Invalid"},
276     {MediumType::Copper, "Copper"},
277     {MediumType::FiberOptic, "FiberOptic"},
278 });
279 
280 NLOHMANN_JSON_SERIALIZE_ENUM(FiberConnectionType, {
281     {FiberConnectionType::Invalid, "Invalid"},
282     {FiberConnectionType::SingleMode, "SingleMode"},
283     {FiberConnectionType::MultiMode, "MultiMode"},
284 });
285 
286 NLOHMANN_JSON_SERIALIZE_ENUM(LLDPSystemCapabilities, {
287     {LLDPSystemCapabilities::Invalid, "Invalid"},
288     {LLDPSystemCapabilities::None, "None"},
289     {LLDPSystemCapabilities::Bridge, "Bridge"},
290     {LLDPSystemCapabilities::DOCSISCableDevice, "DOCSISCableDevice"},
291     {LLDPSystemCapabilities::Other, "Other"},
292     {LLDPSystemCapabilities::Repeater, "Repeater"},
293     {LLDPSystemCapabilities::Router, "Router"},
294     {LLDPSystemCapabilities::Station, "Station"},
295     {LLDPSystemCapabilities::Telephone, "Telephone"},
296     {LLDPSystemCapabilities::WLANAccessPoint, "WLANAccessPoint"},
297 });
298 
299 NLOHMANN_JSON_SERIALIZE_ENUM(CurrentPortConfigurationState, {
300     {CurrentPortConfigurationState::Invalid, "Invalid"},
301     {CurrentPortConfigurationState::Disabled, "Disabled"},
302     {CurrentPortConfigurationState::BindInProgress, "BindInProgress"},
303     {CurrentPortConfigurationState::UnbindInProgress, "UnbindInProgress"},
304     {CurrentPortConfigurationState::DSP, "DSP"},
305     {CurrentPortConfigurationState::USP, "USP"},
306     {CurrentPortConfigurationState::Reserved, "Reserved"},
307     {CurrentPortConfigurationState::FabricLink, "FabricLink"},
308 });
309 
310 NLOHMANN_JSON_SERIALIZE_ENUM(ConnectedDeviceMode, {
311     {ConnectedDeviceMode::Invalid, "Invalid"},
312     {ConnectedDeviceMode::Disconnected, "Disconnected"},
313     {ConnectedDeviceMode::RCD, "RCD"},
314     {ConnectedDeviceMode::CXL68BFlitAndVH, "CXL68BFlitAndVH"},
315     {ConnectedDeviceMode::Standard256BFlit, "Standard256BFlit"},
316     {ConnectedDeviceMode::CXLLatencyOptimized256BFlit, "CXLLatencyOptimized256BFlit"},
317     {ConnectedDeviceMode::PBR, "PBR"},
318 });
319 
320 NLOHMANN_JSON_SERIALIZE_ENUM(ConnectedDeviceType, {
321     {ConnectedDeviceType::Invalid, "Invalid"},
322     {ConnectedDeviceType::None, "None"},
323     {ConnectedDeviceType::PCIeDevice, "PCIeDevice"},
324     {ConnectedDeviceType::Type1, "Type1"},
325     {ConnectedDeviceType::Type2, "Type2"},
326     {ConnectedDeviceType::Type3SLD, "Type3SLD"},
327     {ConnectedDeviceType::Type3MLD, "Type3MLD"},
328 });
329 
330 }
331 // clang-format on
332