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