blob: eac9360210d82f1e9b341e30ec04ae67756507e1 [file] [log] [blame]
Stephane Barbarie14088962017-06-01 16:56:55 -04001#ifndef VOLTHA_DEFS
2#define VOLTHA_DEFS
3
4#include <stdint.h>
5
6typedef enum {
7 OUTPUT = 0,
8 MPLS_TTL = 1,
9 PUSH = 2,
10 POP_MPLS = 3,
11 GROUP = 4,
12 NW_TTL = 5,
13 SET_FIELD = 6,
14 EXPERIMENTER = 7
15} isOfpAction_ActionEnum;
16
17typedef enum {
18 DEBUG = 0,
19 INFO = 1,
20 WARNING = 2,
21 ERROR = 3,
22 CRITICAL = 4
23} LogLevelEnum;
24
25typedef enum {
26 OFPIT_INVALID = 0,
27 OFPIT_GOTO_TABLE = 1,
28 OFPIT_WRITE_METADATA = 2,
29 OFPIT_WRITE_ACTIONS = 3,
30 OFPIT_APPLY_ACTIONS = 4,
31 OFPIT_CLEAR_ACTIONS = 5,
32 OFPIT_METER = 6,
33 OFPIT_EXPERIMENTER = 7
34} isOfpInstruction_DataEnum;
35
36typedef enum {
37 OFB_FIELD = 0,
38 EXPERIMENTER_FIELD = 1
39} isOfpOxmField_FieldEnum;
40
41typedef enum {
42 MAC = 0,
43 IPV4 = 1,
44 IPV6 = 2,
45 HOST_AND_PORT = 3
46} isDevice_AddressEnum;
47
48typedef enum {
49 HEALTHY = 0,
50 OVERLOADED = 1,
51 DYING = 1
52} HealthStatusEnum;
53
54typedef struct {
55 char* State;
56} HealthStatus;
57
58typedef struct {
59 char* MfrDesc;
60 char* HwDesc;
61 char* SwDesc;
62 char* SerialNum;
63 char* DpDesc;
64} OfpDesc;
65
66typedef struct {
67 uint32_t NBuffers;
68 uint32_t NTables;
69 uint32_t AuxiliaryId;
70 uint32_t Capabilities;
71 uint64_t DatapathId;
72} OfpSwitchFeatures;
73
74typedef struct {
75 char* Value;
76 int Type;
77} isOfpOxmField_Field;
78
79typedef struct {
80 int32_t OxmClass;
81 isOfpOxmField_Field Field;
82} OfpOxmField;
83
84typedef struct {
85 OfpOxmField* items;
86 int size;
87} OfpOxmFieldArray;
88
89typedef struct {
90 int32_t Type;
91 OfpOxmFieldArray OxmFields;
92} OfpMatch;
93
94typedef struct {
95 int Type;
96 char* Value;
97} isOfpAction_Action;
98
99typedef struct {
100 int32_t Type;
101 isOfpAction_Action Action;
102} OfpAction;
103
104typedef struct {
105 int Type;
106 char* Value;
107} isOfpInstruction_Data;
108
109typedef struct {
110 isOfpInstruction_Data Data;
111 uint32_t Type;
112} OfpInstruction;
113
114typedef struct {
115 OfpInstruction* items;
116 int size;
117} OfpInstructionArray;
118
119typedef struct {
120 uint64_t PacketCount;
121 uint64_t ByteCount;
122 OfpMatch* Match;
123 uint64_t Id;
124 uint32_t DurationSec;
125 uint32_t Priority;
126 uint32_t HardTimeout;
127 uint32_t Flags;
128 uint32_t TableId;
129 uint32_t DurationNsec;
130 uint32_t IdleTimeout;
131 uint64_t Cookie;
132 OfpInstructionArray Instructions;
133} OfpFlowStats;
134
135typedef struct {
136 OfpFlowStats* items;
137 int size;
138} OfpFlowStatsArray;
139
140typedef struct {
141 OfpFlowStatsArray Items;
142} Flows;
143
144typedef struct {
145 OfpAction* items;
146 int size;
147} OfpActionArray;
148
149typedef struct {
150 OfpActionArray Actions;
151 uint32_t Weight;
152 uint32_t WatchPort;
153 uint32_t WatchGroup;
154} OfpBucket;
155
156typedef struct {
157 OfpBucket* items;
158 int size;
159} OfpBucketArray;
160
161typedef struct {
162 int32_t Type;
163 uint32_t GroupId;
164 OfpBucketArray Buckets;
165} OfpGroupDesc;
166
167typedef struct {
168 uint64_t PacketCount;
169 uint64_t ByteCount;
170} OfpBucketCounter;
171
172typedef struct {
173 OfpBucketCounter* items;
174 int size;
175} OfpBucketCounterArray;
176
177typedef struct {
178 uint32_t RefCount;
179 uint64_t PacketCount;
180 uint64_t ByteCount;
181 uint32_t DurationSec;
182 uint32_t DurationNsec;
183 OfpBucketCounterArray BucketStats;
184 uint32_t GroupId;
185} OfpGroupStats;
186
187typedef struct {
188 OfpGroupDesc* Desc;
189 OfpGroupStats* Stats;
190} OfpGroupEntry;
191
192typedef struct {
193 OfpGroupEntry* items;
194 int size;
195} OfpGroupEntryArray;
196
197typedef struct {
198 OfpGroupEntryArray Items;
199} FlowGroups;
200
201typedef struct {
202 uint32_t SampleFreq;
203 char* Name;
204 int32_t Type;
205 int Enabled;
206} PmConfig;
207
208typedef struct {
209 PmConfig* items;
210 int size;
211} PmConfigArray;
212
213typedef struct {
214 char* GroupName;
215 uint32_t GroupFreq;
216 int Enabled;
217 PmConfigArray Metrics;
218} PmGroupConfig;
219
220typedef struct {
221 PmGroupConfig* items;
222 int size;
223} PmGroupConfigArray;
224
225typedef struct {
226 uint32_t items;
227 int size;
228} uint32Array;
229
230typedef struct {
231 uint32Array HwAddr;
232 uint32_t State;
233 uint32_t Curr;
234 uint32_t MaxSpeed;
235 uint32_t PortNo;
236 char* Name;
237 uint32_t Config;
238 uint32_t Advertised;
239 uint32_t Supported;
240 uint32_t Peer;
241 uint32_t CurrSpeed;
242} OfpPort;
243
244typedef struct {
245 char* Value;
246 int Type;
247} isDevice_Address;
248
249typedef struct {
250 char* DeviceId;
251 uint32_t ChannelId;
252 uint32_t OnuId;
253 uint32_t OnuSessionId;
254} Device_ProxyAddress;
255
256typedef struct {
257 char** items;
258 int size;
259} stringArray;
260
261typedef struct {
262 uint8_t* items;
263 int size;
264} uint8Array;
265
266typedef struct {
267 uint8Array Value;
268 char* TypeUrl;
269} Any;
270
271typedef struct {
272 int32_t LogLevel;
273 Any* AdditionalConfig;
274} AdapterConfig;
275
276typedef struct {
277 AdapterConfig* Config;
278 Any* AdditionalDescription;
279 stringArray LogicalDeviceIds;
280 char* Id;
281 char* Vendor;
282 char* Version;
283} Adapter;
284
285typedef struct {
286 int32_t Key;
287 char* Value;
288} AlarmFilterRule;
289
290typedef struct {
291 AlarmFilterRule* items;
292 int size;
293} AlarmFilterRuleArray;
294
295typedef struct {
296 char* Id;
297 AlarmFilterRuleArray Rules;
298} AlarmFilter;
299
300typedef struct {
301 AlarmFilter* items;
302 int size;
303} AlarmFilterArray;
304
305typedef struct {
306 char* Id;
307 OfpPort* OfpPort;
308 char* DeviceId;
309 uint32_t DevicePortNo;
310 int RootPort;
311} LogicalPort;
312
313typedef struct {
314 LogicalPort* items;
315 int size;
316} LogicalPortArray;
317
318typedef struct {
319 FlowGroups* FlowGroups;
320 char* Id;
321 uint64_t DatapathId;
322 OfpDesc* Desc;
323 OfpSwitchFeatures* SwitchFeatures;
324 char* RootDeviceId;
325 LogicalPortArray Ports;
326 Flows* Flows;
327} LogicalDevice;
328
329typedef struct {
330 LogicalDevice* items;
331 int size;
332} LogicalDeviceArray;
333
334typedef struct {
335 uint32_t PortNo;
336 char* DeviceId;
337} Port_PeerPort;
338
339typedef struct {
340 Port_PeerPort* items;
341 int size;
342} Port_PeerPortArray;
343
344typedef struct {
345 uint32_t PortNo;
346 char* Label;
347 int32_t Type;
348 int32_t AdminState;
349 int32_t OperStatus;
350 char* DeviceId;
351 Port_PeerPortArray Peers;
352} Port;
353
354typedef struct {
355 Port* items;
356 int size;
357} PortArray;
358
359typedef struct {
360 uint32_t DefaultFreq;
361 int Grouped;
362 int FreqOverride;
363 PmGroupConfigArray Groups;
364 PmConfigArray Metrics;
365 char* Id;
366} PmConfigs;
367
368typedef struct {
369 char* Id;
370 char* Adapter;
371 int AcceptsBulkFlowUpdate;
372 int AcceptsAddRemoveFlowUpdates;
373} DeviceType;
374
375typedef struct {
376 DeviceType* items;
377 int size;
378} DeviceTypeArray;
379
380typedef struct {
381 char* Reason;
382 char* ConnectStatus;
383 FlowGroups* FlowGroups;
384 char* Id;
385 char* Model;
386 Device_ProxyAddress* ProxyAddress;
387 char* OperStatus;
388 uint32_t ParentPortNo;
389 char* HardwareVersion;
390 Flows* Flows;
391 PmConfigs* PmConfigs;
392 char* AdminState;
393 char* Type;
394 char* ParentId;
395 char* Vendor;
396 char* SerialNumber;
397 uint32_t Vlan;
398 isDevice_Address Address;
399 Any* Custom;
400 PortArray Ports;
401 int Root;
402 char* FirmwareVersion;
403 char* SoftwareVersion;
404 char* Adapter;
405} Device;
406
407typedef struct {
408 Device* items;
409 int size;
410} DeviceArray;
411
412typedef struct {
413 char* Id;
414 LogicalDeviceArray LogicalDevices;
415 DeviceArray Devices;
416} DeviceGroup;
417
418typedef struct {
419 DeviceGroup* items;
420 int size;
421} DeviceGroupArray;
422
423typedef struct {
424 Adapter* items;
425 int size;
426} AdapterArray;
427
428typedef struct {
429 AlarmFilterArray AlarmFilters;
430 char* InstanceId;
431 HealthStatus Health;
432 AdapterArray Adapters;
433 LogicalDeviceArray LogicalDevices;
434 DeviceGroupArray DeviceGroups;
435 char* Version;
436 char* LogLevel;
437 DeviceArray Devices;
438 DeviceTypeArray DeviceTypes;
439} VolthaInstance;
440
441typedef struct {
442 VolthaInstance* items;
443 int size;
444} VolthaInstanceArray;
445
446typedef struct {
447 char* Version;
448 char* LogLevel;
449 VolthaInstanceArray Instances;
450 AdapterArray Adapters;
451 LogicalDeviceArray LogicalDevices;
452 DeviceArray Devices;
453 DeviceGroupArray DeviceGroups;
454} Voltha;
455
456#endif