blob: 20511cc8b030c0dee9efd7347af3a6a1c2ac3247 [file] [log] [blame]
alshabib9f50e482014-08-23 17:10:57 -05001// Copyright 2013, Big Switch Networks, Inc.
2//
3// LoxiGen is licensed under the Eclipse Public License, version 1.0 (EPL), with
4// the following special exception:
5//
6// LOXI Exception
7//
8// As a special exception to the terms of the EPL, you may distribute libraries
9// generated by LoxiGen (LoxiGen Libraries) under the terms of your choice, provided
10// that copyright and licensing notices generated by LoxiGen are not altered or removed
11// from the LoxiGen Libraries and the notice provided below is (i) included in
12// the LoxiGen Libraries, if distributed in source code form and (ii) included in any
13// documentation for the LoxiGen Libraries, if distributed in binary form.
14//
15// Notice: "Copyright 2013, Big Switch Networks, Inc. This library was generated by the LoxiGen Compiler."
16//
17// You may not use this file except in compliance with the EPL or LOXI Exception. You may obtain
18// a copy of the EPL at:
19//
20// http://www.eclipse.org/legal/epl-v10.html
21//
22// Unless required by applicable law or agreed to in writing, software
23// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
24// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
25// EPL for the specific language governing permissions and limitations
26// under the EPL.
27//
28// Also derived from the OpenFlow header files which have these copyrights:
29// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
30// Copyright (c) 2011, 2012 Open Networking Foundation
31
32#version 5
33
34enum macro_definitions {
35 OFP_MAX_TABLE_NAME_LEN = 32,
36 OFP_MAX_PORT_NAME_LEN = 16,
37
38 OFP_TCP_PORT = 6653,
39 OFP_SSL_PORT = 6653,
40
41 OFP_ETH_ALEN = 6,
42
43 OFP_DEFAULT_MISS_SEND_LEN = 128,
44
45 OFP_VLAN_NONE = 0,
46
47 OFP_FLOW_PERMANENT = 0,
48
49 OFP_DEFAULT_PRIORITY = 0x8000,
50
51 OFP_NO_BUFFER = 0xffffffff,
52
53 DESC_STR_LEN = 256,
54 SERIAL_NUM_LEN = 32,
55
56 OFPQ_ALL = 0xffffffff,
57 OFPQ_MAX_RATE_UNCFG = 0xffff,
58 OFPQ_MIN_RATE_UNCFG = 0xffff,
59};
60
61enum ofp_port(wire_type=uint32_t) {
62 OFPP_MAX = 0xffffff00,
63 OFPP_IN_PORT = 0xfffffff8,
64 OFPP_TABLE = 0xfffffff9,
65 OFPP_NORMAL = 0xfffffffa,
66 OFPP_FLOOD = 0xfffffffb,
67 OFPP_ALL = 0xfffffffc,
68 OFPP_CONTROLLER = 0xfffffffd,
69 OFPP_LOCAL = 0xfffffffe,
70 OFPP_ANY = 0xffffffff,
71};
72
73enum ofp_type(wire_type=uint8_t) {
74 OFPT_HELLO = 0,
75 OFPT_ERROR = 1,
76 OFPT_ECHO_REQUEST = 2,
77 OFPT_ECHO_REPLY = 3,
78 OFPT_EXPERIMENTER = 4,
79 OFPT_FEATURES_REQUEST = 5,
80 OFPT_FEATURES_REPLY = 6,
81 OFPT_GET_CONFIG_REQUEST = 7,
82 OFPT_GET_CONFIG_REPLY = 8,
83 OFPT_SET_CONFIG = 9,
84 OFPT_PACKET_IN = 10,
85 OFPT_FLOW_REMOVED = 11,
86 OFPT_PORT_STATUS = 12,
87 OFPT_PACKET_OUT = 13,
88 OFPT_FLOW_MOD = 14,
89 OFPT_GROUP_MOD = 15,
90 OFPT_PORT_MOD = 16,
91 OFPT_TABLE_MOD = 17,
92 OFPT_STATS_REQUEST = 18,
93 OFPT_STATS_REPLY = 19,
94 OFPT_BARRIER_REQUEST = 20,
95 OFPT_BARRIER_REPLY = 21,
96 OFPT_ROLE_REQUEST = 24,
97 OFPT_ROLE_REPLY = 25,
98 OFPT_GET_ASYNC_REQUEST = 26,
99 OFPT_GET_ASYNC_REPLY = 27,
100 OFPT_SET_ASYNC = 28,
101 OFPT_METER_MOD = 29,
102 OFPT_ROLE_STATUS = 30,
103 OFPT_TABLE_STATUS = 31,
Rich Lane457bc452014-10-17 18:04:56 -0700104 OFPT_REQUESTFORWARD = 32,
alshabib9f50e482014-08-23 17:10:57 -0500105 OFPT_BUNDLE_CONTROL = 33,
106 OFPT_BUNDLE_ADD_MESSAGE = 34,
107};
108
109enum ofp_config_flags(wire_type=uint16_t, bitmask=True) {
110 OFPC_FRAG_NORMAL = 0,
111 OFPC_FRAG_DROP = 1,
112 OFPC_FRAG_REASM = 2,
113 OFPC_FRAG_MASK = 3,
114};
115
116enum ofp_table_config(wire_type=uint32_t, bitmask=True) {
117 OFPTC_DEPRECATED_MASK = 0x3,
118 OFPTC_EVICTION = 0x4,
119 OFPTC_VACANCY_EVENTS = 0x8,
120};
121
122enum ofp_table(wire_type=uint8_t, complete=False) {
123 OFPTT_MAX = 0xfe,
124 OFPTT_ALL = 0xff,
125};
126
127enum ofp_capabilities(wire_type=uint32_t, bitmask=True) {
128 OFPC_FLOW_STATS = 0x1,
129 OFPC_TABLE_STATS = 0x2,
130 OFPC_PORT_STATS = 0x4,
131 OFPC_GROUP_STATS = 0x8,
132 OFPC_IP_REASM = 0x20,
133 OFPC_QUEUE_STATS = 0x40,
134 OFPC_PORT_BLOCKED = 0x100,
135};
136
137enum ofp_port_config(wire_type=uint32_t, bitmask=True) {
138 OFPPC_PORT_DOWN = 0x1,
139 OFPPC_NO_RECV = 0x4,
140 OFPPC_NO_FWD = 0x20,
141 OFPPC_NO_PACKET_IN = 0x40,
142 OFPPC_BSN_MIRROR_DEST = 0x80000000,
143};
144
145enum ofp_port_state(wire_type=uint32_t, bitmask=True) {
146 OFPPS_LINK_DOWN = 0x1,
147 OFPPS_BLOCKED = 0x2,
148 OFPPS_LIVE = 0x4,
149};
150
151enum ofp_port_features(wire_type=uint32_t, bitmask=True) {
152 OFPPF_10MB_HD = 0x1,
153 OFPPF_10MB_FD = 0x2,
154 OFPPF_100MB_HD = 0x4,
155 OFPPF_100MB_FD = 0x8,
156 OFPPF_1GB_HD = 0x10,
157 OFPPF_1GB_FD = 0x20,
158 OFPPF_10GB_FD = 0x40,
159 OFPPF_40GB_FD = 0x80,
160 OFPPF_100GB_FD = 0x100,
161 OFPPF_1TB_FD = 0x200,
162 OFPPF_OTHER = 0x400,
163 OFPPF_COPPER = 0x800,
164 OFPPF_FIBER = 0x1000,
165 OFPPF_AUTONEG = 0x2000,
166 OFPPF_PAUSE = 0x4000,
167 OFPPF_PAUSE_ASYM = 0x8000,
Vishnu Emmadi98bcb892014-12-10 18:29:17 -0800168 OFPPF_BSN_BREAKOUT_CAPABLE = 0x80000000,
alshabib9f50e482014-08-23 17:10:57 -0500169};
170
171enum ofp_port_reason(wire_type=uint8_t) {
172 OFPPR_ADD = 0,
173 OFPPR_DELETE = 1,
174 OFPPR_MODIFY = 2,
175};
176
177enum ofp_match_type(wire_type=uint16_t) {
178 OFPMT_STANDARD = 0,
179 OFPMT_OXM = 1,
180};
181
182enum ofp_oxm_class(wire_type=uint16_t) {
183 OFPXMC_NXM_0 = 0,
184 OFPXMC_NXM_1 = 1,
185 OFPXMC_OPENFLOW_BASIC = 0x8000,
186 OFPXMC_EXPERIMENTER = 0xffff,
187};
188
189enum ofp_vlan_id(wire_type=uint16_t) {
190 OFPVID_NONE = 0,
191 OFPVID_PRESENT = 0x1000,
192};
193
194// FIXME: OF spec specified this as '9' bits, implicitly adding
195// to full byte
196enum ofp_ipv6exthdr_flags(wire_type=uint16_t, bitmask=True) {
197 OFPIEH_NONEXT = 0x1,
198 OFPIEH_ESP = 0x2,
199 OFPIEH_AUTH = 0x4,
200 OFPIEH_DEST = 0x8,
201 OFPIEH_FRAG = 0x10,
202 OFPIEH_ROUTER = 0x20,
203 OFPIEH_HOP = 0x40,
204 OFPIEH_UNREP = 0x80,
205 OFPIEH_UNSEQ = 0x100,
206};
207
208enum ofp_action_type(wire_type=uint16_t) {
209 OFPAT_OUTPUT = 0,
210 OFPAT_COPY_TTL_OUT = 0xb,
211 OFPAT_COPY_TTL_IN = 0xc,
212 OFPAT_SET_MPLS_TTL = 0xf,
213 OFPAT_DEC_MPLS_TTL = 0x10,
214 OFPAT_PUSH_VLAN = 0x11,
215 OFPAT_POP_VLAN = 0x12,
216 OFPAT_PUSH_MPLS = 0x13,
217 OFPAT_POP_MPLS = 0x14,
218 OFPAT_SET_QUEUE = 0x15,
219 OFPAT_GROUP = 0x16,
220 OFPAT_SET_NW_TTL = 0x17,
221 OFPAT_DEC_NW_TTL = 0x18,
222 OFPAT_SET_FIELD = 0x19,
223 OFPAT_PUSH_PBB = 0x1a,
224 OFPAT_POP_PBB = 0x1b,
225 OFPAT_EXPERIMENTER = 0xffff,
226};
227
228enum ofp_controller_max_len(wire_type=uint16_t, complete=False) {
229 OFPCML_MAX = 0xffe5,
230 OFPCML_NO_BUFFER = 0xffff,
231};
232
233enum ofp_instruction_type(wire_type=uint16_t, bitmask=True) {
234 OFPIT_GOTO_TABLE = 0x1,
235 OFPIT_WRITE_METADATA = 0x2,
236 OFPIT_WRITE_ACTIONS = 0x3,
237 OFPIT_APPLY_ACTIONS = 0x4,
238 OFPIT_CLEAR_ACTIONS = 0x5,
239 OFPIT_METER = 0x6,
240 OFPIT_EXPERIMENTER = 0xffff,
241};
242
243enum ofp_flow_mod_command(wire_type=uint8_t) {
244 OFPFC_ADD = 0,
245 OFPFC_MODIFY = 1,
246 OFPFC_MODIFY_STRICT = 2,
247 OFPFC_DELETE = 3,
248 OFPFC_DELETE_STRICT = 4,
249};
250
251enum ofp_flow_mod_flags(wire_type=uint16_t, bitmask=True) {
252 OFPFF_SEND_FLOW_REM = 0x1,
253 OFPFF_CHECK_OVERLAP = 0x2,
254 OFPFF_RESET_COUNTS = 0x4,
255 OFPFF_NO_PKT_COUNTS = 0x8,
256 OFPFF_NO_BYT_COUNTS = 0x10,
257
258 /* Non-standard, enabled by an experimenter message */
259 /* See the bsn_flow_idle input file */
260 OFPFF_BSN_SEND_IDLE = 0x80,
261};
262
263enum ofp_group(wire_type=uint32_t, complete=False) {
264 OFPG_MAX = 0xffffff00,
265 OFPG_ALL = 0xfffffffc,
266 OFPG_ANY = 0xffffffff,
267};
268
269enum ofp_group_mod_command(wire_type=uint16_t) {
270 OFPGC_ADD = 0,
271 OFPGC_MODIFY = 1,
272 OFPGC_DELETE = 2,
273};
274
275enum ofp_group_type(wire_type=uint8_t) {
276 OFPGT_ALL = 0,
277 OFPGT_SELECT = 1,
278 OFPGT_INDIRECT = 2,
279 OFPGT_FF = 3,
280};
281
282enum ofp_packet_in_reason(wire_type=uint8_t) {
283 OFPR_NO_MATCH = 0,
284 OFPR_ACTION = 1,
285 OFPR_INVALID_TTL = 2,
286 OFPR_ACTION_SET = 3,
287 OFPR_GROUP = 4,
288 OFPR_PACKET_OUT = 5,
289
290 // non-standard BSN extensions. OF does not have a standard-conformant
291 // way to extend the set of packet_in reasons
292 OFPR_BSN_NEW_HOST = 128,
293 OFPR_BSN_STATION_MOVE = 129,
294 OFPR_BSN_BAD_VLAN = 130,
295 OFPR_BSN_DESTINATION_LOOKUP_FAILURE = 131,
296 OFPR_BSN_NO_ROUTE = 132,
297 OFPR_BSN_ICMP_ECHO_REQUEST = 133,
298 OFPR_BSN_DEST_NETWORK_UNREACHABLE = 134,
299 OFPR_BSN_DEST_HOST_UNREACHABLE = 135,
300 OFPR_BSN_DEST_PORT_UNREACHABLE = 136,
301 OFPR_BSN_FRAGMENTATION_REQUIRED = 137,
302 OFPR_BSN_ARP = 139,
303 OFPR_BSN_DHCP = 140,
304 OFPR_BSN_DEBUG = 141,
305 OFPR_BSN_PACKET_OF_DEATH = 142,
306};
307
308enum ofp_flow_removed_reason(wire_type=uint8_t) {
309 OFPRR_IDLE_TIMEOUT = 0,
310 OFPRR_HARD_TIMEOUT = 1,
311 OFPRR_DELETE = 2,
312 OFPRR_GROUP_DELETE = 3,
313 OFPRR_METER_DELETE = 4,
314 OFPRR_EVICTION = 5,
315};
316
317enum ofp_meter(wire_type=uint32_t, complete=False) {
318 OFPM_MAX = 0xffff0000,
319 OFPM_SLOWPATH = 0xfffffffd,
320 OFPM_CONTROLLER = 0xfffffffe,
321 OFPM_ALL = 0xffffffff,
322};
323
324enum ofp_meter_band_type(wire_type=uint16_t) {
325 OFPMBT_DROP = 0x1,
326 OFPMBT_DSCP_REMARK = 0x2,
327 OFPMBT_EXPERIMENTER = 0xffff,
328};
329
330enum ofp_meter_mod_command(wire_type=uint16_t) {
331 OFPMC_ADD = 0,
332 OFPMC_MODIFY = 1,
333 OFPMC_DELETE = 2,
334};
335
336enum ofp_meter_flags(wire_type=uint16_t, bitmask=True) {
337 OFPMF_KBPS = 0x1,
338 OFPMF_PKTPS = 0x2,
339 OFPMF_BURST = 0x4,
340 OFPMF_STATS = 0x8,
341};
342
343enum ofp_error_type(wire_type=uint16_t) {
344 OFPET_HELLO_FAILED = 0,
345 OFPET_BAD_REQUEST = 1,
346 OFPET_BAD_ACTION = 2,
347 OFPET_BAD_INSTRUCTION = 3,
348 OFPET_BAD_MATCH = 4,
349 OFPET_FLOW_MOD_FAILED = 5,
350 OFPET_GROUP_MOD_FAILED = 6,
351 OFPET_PORT_MOD_FAILED = 7,
352 OFPET_TABLE_MOD_FAILED = 8,
353 OFPET_QUEUE_OP_FAILED = 9,
354 OFPET_SWITCH_CONFIG_FAILED = 10,
355 OFPET_ROLE_REQUEST_FAILED = 11,
356 OFPET_METER_MOD_FAILED = 12,
357 OFPET_TABLE_FEATURES_FAILED = 13,
358 OFPET_BAD_PROPERTY = 14,
359 OFPET_ASYNC_CONFIG_FAILED = 15,
360 OFPET_FLOW_MONITOR_FAILED = 16,
361 OFPET_BUNDLE_FAILED = 17,
362 OFPET_EXPERIMENTER = 0xffff,
363};
364
365enum ofp_hello_failed_code(wire_type=uint16_t) {
366 OFPHFC_INCOMPATIBLE = 0,
367 OFPHFC_EPERM = 1,
368};
369
370enum ofp_bad_request_code(wire_type=uint16_t) {
371 OFPBRC_BAD_VERSION = 0,
372 OFPBRC_BAD_TYPE = 1,
373 OFPBRC_BAD_STAT = 2,
374 OFPBRC_BAD_EXPERIMENTER = 3,
375 OFPBRC_BAD_EXPERIMENTER_TYPE = 4,
376 OFPBRC_EPERM = 5,
377 OFPBRC_BAD_LEN = 6,
378 OFPBRC_BUFFER_EMPTY = 7,
379 OFPBRC_BUFFER_UNKNOWN = 8,
380 OFPBRC_BAD_TABLE_ID = 9,
381 OFPBRC_IS_SLAVE = 10,
382 OFPBRC_BAD_PORT = 11,
383 OFPBRC_BAD_PACKET = 12,
384 OFPBRC_MULTIPART_BUFFER_OVERFLOW = 13,
385 OFPBRC_MULTIPART_REQUEST_TIMEOUT = 14,
386 OFPBRC_MULTIPART_REPLY_TIMEOUT = 15,
387};
388
389enum ofp_bad_action_code(wire_type=uint16_t) {
390 OFPBAC_BAD_TYPE = 0,
391 OFPBAC_BAD_LEN = 1,
392 OFPBAC_BAD_EXPERIMENTER = 2,
393 OFPBAC_BAD_EXPERIMENTER_TYPE = 3,
394 OFPBAC_BAD_OUT_PORT = 4,
395 OFPBAC_BAD_ARGUMENT = 5,
396 OFPBAC_EPERM = 6,
397 OFPBAC_TOO_MANY = 7,
398 OFPBAC_BAD_QUEUE = 8,
399 OFPBAC_BAD_OUT_GROUP = 9,
400 OFPBAC_MATCH_INCONSISTENT = 10,
401 OFPBAC_UNSUPPORTED_ORDER = 11,
402 OFPBAC_BAD_TAG = 12,
403 OFPBAC_BAD_SET_TYPE = 13,
404 OFPBAC_BAD_SET_LEN = 14,
405 OFPBAC_BAD_SET_ARGUMENT = 15,
406};
407
408enum ofp_bad_instruction_code(wire_type=uint16_t) {
409 OFPBIC_UNKNOWN_INST = 0,
410 OFPBIC_UNSUP_INST = 1,
411 OFPBIC_BAD_TABLE_ID = 2,
412 OFPBIC_UNSUP_METADATA = 3,
413 OFPBIC_UNSUP_METADATA_MASK = 4,
414 OFPBIC_BAD_EXPERIMENTER = 5,
415 OFPBIC_BAD_EXPERIMENTER_TYPE = 6,
416 OFPBIC_BAD_LEN = 7,
417 OFPBIC_EPERM = 8,
418 OFPBIC_DUP_INST = 9,
419};
420
421enum ofp_bad_match_code(wire_type=uint16_t) {
422 OFPBMC_BAD_TYPE = 0,
423 OFPBMC_BAD_LEN = 1,
424 OFPBMC_BAD_TAG = 2,
425 OFPBMC_BAD_DL_ADDR_MASK = 3,
426 OFPBMC_BAD_NW_ADDR_MASK = 4,
427 OFPBMC_BAD_WILDCARDS = 5,
428 OFPBMC_BAD_FIELD = 6,
429 OFPBMC_BAD_VALUE = 7,
430 OFPBMC_BAD_MASK = 8,
431 OFPBMC_BAD_PREREQ = 9,
432 OFPBMC_DUP_FIELD = 10,
433 OFPBMC_EPERM = 11,
434};
435
436enum ofp_flow_mod_failed_code(wire_type=uint16_t) {
437 OFPFMFC_UNKNOWN = 0,
438 OFPFMFC_TABLE_FULL = 1,
439 OFPFMFC_BAD_TABLE_ID = 2,
440 OFPFMFC_OVERLAP = 3,
441 OFPFMFC_EPERM = 4,
442 OFPFMFC_BAD_TIMEOUT = 5,
443 OFPFMFC_BAD_COMMAND = 6,
444 OFPFMFC_BAD_FLAGS = 7,
445 OFPFMFC_CANT_SYNC = 8,
446 OFPFMFC_BAD_PRIORITY = 9,
447};
448
449enum ofp_group_mod_failed_code(wire_type=uint16_t) {
450 OFPGMFC_GROUP_EXISTS = 0,
451 OFPGMFC_INVALID_GROUP = 1,
452 OFPGMFC_WEIGHT_UNSUPPORTED = 2,
453 OFPGMFC_OUT_OF_GROUPS = 3,
454 OFPGMFC_OUT_OF_BUCKETS = 4,
455 OFPGMFC_CHAINING_UNSUPPORTED = 5,
456 OFPGMFC_WATCH_UNSUPPORTED = 6,
457 OFPGMFC_LOOP = 7,
458 OFPGMFC_UNKNOWN_GROUP = 8,
459 OFPGMFC_CHAINED_GROUP = 9,
460 OFPGMFC_BAD_TYPE = 10,
461 OFPGMFC_BAD_COMMAND = 11,
462 OFPGMFC_BAD_BUCKET = 12,
463 OFPGMFC_BAD_WATCH = 13,
464 OFPGMFC_EPERM = 14,
465};
466
467enum ofp_port_mod_failed_code(wire_type=uint16_t) {
468 OFPPMFC_BAD_PORT = 0,
469 OFPPMFC_BAD_HW_ADDR = 1,
470 OFPPMFC_BAD_CONFIG = 2,
471 OFPPMFC_BAD_ADVERTISE = 3,
472 OFPPMFC_EPERM = 4,
473};
474
475enum ofp_table_mod_failed_code(wire_type=uint16_t) {
476 OFPTMFC_BAD_TABLE = 0,
477 OFPTMFC_BAD_CONFIG = 1,
478 OFPTMFC_EPERM = 2,
479};
480
481enum ofp_queue_op_failed_code(wire_type=uint16_t) {
482 OFPQOFC_BAD_PORT = 0,
483 OFPQOFC_BAD_QUEUE = 1,
484 OFPQOFC_EPERM = 2,
485};
486
487enum ofp_switch_config_failed_code(wire_type=uint16_t) {
488 OFPSCFC_BAD_FLAGS = 0,
489 OFPSCFC_BAD_LEN = 1,
490 OFPSCFC_EPERM = 2,
491};
492
493enum ofp_role_request_failed_code(wire_type=uint16_t){
494 OFPRRFC_STALE = 0,
495 OFPRRFC_UNSUP = 1,
496 OFPRRFC_BAD_ROLE = 2,
497};
498
499enum ofp_meter_mod_failed_code(wire_type=uint16_t) {
500 OFPMMFC_UNKNOWN = 0,
501 OFPMMFC_METER_EXISTS = 1,
502 OFPMMFC_INVALID_METER = 2,
503 OFPMMFC_UNKNOWN_METER = 3,
504 OFPMMFC_BAD_COMMAND = 4,
505 OFPMMFC_BAD_FLAGS = 5,
506 OFPMMFC_BAD_RATE = 6,
507 OFPMMFC_BAD_BURST = 7,
508 OFPMMFC_BAD_BAND = 8,
509 OFPMMFC_BAD_BAND_VALUE = 9,
510 OFPMMFC_OUT_OF_METERS = 10,
511 OFPMMFC_OUT_OF_BANDS = 11,
512};
513
514enum ofp_table_features_failed_code(wire_type=uint16_t) {
515 OFPTFFC_BAD_TABLE = 0,
516 OFPTFFC_BAD_METADATA = 1,
517 OFPTFFC_EPERM = 5,
518};
519
520enum ofp_bad_property_code(wire_type=uint16_t) {
521 OFPBPC_BAD_TYPE = 0, /* Unknown property type. */
522 OFPBPC_BAD_LEN = 1, /* Length problem in property. */
523 OFPBPC_BAD_VALUE = 2, /* Unsupported property value. */
524 OFPBPC_TOO_MANY = 3, /* Can’t handle this many properties. */
525 OFPBPC_DUP_TYPE = 4, /* A property type was duplicated. */
526 OFPBPC_BAD_EXPERIMENTER = 5, /* Unknown experimenter id specified. */
527 OFPBPC_BAD_EXP_TYPE = 6, /* Unknown exp_type for experimenter id. */
528 OFPBPC_BAD_EXP_VALUE = 7, /* Unknown value for experimenter id. */
529 OFPBPC_EPERM = 8, /* Permissions error. */
530};
531
532
533enum ofp_async_config_failed_code(wire_type=uint16_t) {
534 OFPACFC_INVALID = 0, /* One mask is invalid. */
535 OFPACFC_UNSUPPORTED = 1, /* Requested configuration not supported. */
536 OFPACFC_EPERM = 2, /* Permissions error. */
537};
538
539enum ofp_flow_monitor_failed_code(wire_type=uint16_t) {
540 OFPMOFC_UNKNOWN = 0, /* Unspecified error. */
541 OFPMOFC_MONITOR_EXISTS = 1, /* Monitor not added because a Monitor ADD
542 * attempted to replace an existing Monitor. */
543 OFPMOFC_INVALID_MONITOR = 2, /* Monitor not added because Monitor specified
544 * is invalid. */
545 OFPMOFC_UNKNOWN_MONITOR = 3, /* Monitor not modified because a Monitor
546 MODIFY attempted to modify a non-existent
547 Monitor. */
548 OFPMOFC_BAD_COMMAND = 4, /* Unsupported or unknown command. */
549 OFPMOFC_BAD_FLAGS = 5, /* Flag configuration unsupported. */
550 OFPMOFC_BAD_TABLE_ID = 6, /* Specified table does not exist. */
551 OFPMOFC_BAD_OUT = 7, /* Error in output port/group. */
552};
553
554enum ofp_bundle_failed_code(wire_type=uint16_t) {
555 OFPBFC_UNKNOWN = 0, /* Unspecified error. */
556 OFPBFC_EPERM = 1, /* Permissions error. */
557 OFPBFC_BAD_ID = 2, /* Bundle ID doesn’t exist. */
558 OFPBFC_BUNDLE_EXIST = 3, /* Bundle ID already exist. */
559 OFPBFC_BUNDLE_CLOSED = 4, /* Bundle ID is closed. */
560 OFPBFC_OUT_OF_BUNDLES = 5, /* Too many bundles IDs. */
561 OFPBFC_BAD_TYPE = 6, /* Unsupported or unknown message control type. */
562 OFPBFC_BAD_FLAGS = 7, /* Unsupported, unknown, or inconsistent flags. */
563 OFPBFC_MSG_BAD_LEN = 8, /* Length problem in included message. */
564 OFPBFC_MSG_BAD_XID = 9, /* Inconsistent or duplicate XID. */
565 OFPBFC_MSG_UNSUP = 10, /* Unsupported message in this bundle. */
566 OFPBFC_MSG_CONFLICT = 11, /* Unsupported message combination in this bundle. */
567 OFPBFC_MSG_TOO_MANY = 12, /* Cant handle this many messages in bundle. */
568 OFPBFC_MSG_FAILED = 13, /* One message in bundle failed. */
569 OFPBFC_TIMEOUT = 14, /* Bundle is taking too long. */
570 OFPBFC_BUNDLE_IN_PROGRESS = 15, /* Bundle is locking the resource. */
571};
572
573/* Port stats property types.
574 */
575enum ofp_port_stats_prop_type(wire_type=uint16_t) {
576 OFPPSPT_ETHERNET = 0, /* Ethernet property. */
577 OFPPSPT_OPTICAL = 1, /* Optical property. */
578 OFPPSPT_EXPERIMENTER = 0xFFFF, /* Experimenter property. */
579};
580
581
582enum ofp_stats_type(wire_type=uint16_t) {
583 OFPST_DESC = 0,
584 OFPST_FLOW = 1,
585 OFPST_AGGREGATE = 2,
586 OFPST_TABLE = 3,
587 OFPST_PORT = 4,
588 OFPST_QUEUE = 5,
589 OFPST_GROUP = 6,
590 OFPST_GROUP_DESC = 7,
591 OFPST_GROUP_FEATURES = 8,
592 OFPST_METER = 9,
593 OFPST_METER_CONFIG = 10,
594 OFPST_METER_FEATURES = 11,
595 OFPST_TABLE_FEATURES = 12,
596 OFPST_PORT_DESC = 13,
597 OFPMP_TABLE_DESC = 14,
598 OFPMP_QUEUE_DESC = 15,
599 OFPMP_FLOW_MONITOR = 16,
600 OFPST_EXPERIMENTER = 0xffff,
601};
602
603enum ofp_stats_request_flags(wire_type=uint16_t, bitmask=True) {
604 OFPSF_REQ_MORE = 0x1,
605};
606
607enum ofp_stats_reply_flags(wire_type=uint16_t, bitmask=True) {
608 OFPSF_REPLY_MORE = 0x1,
609};
610
611enum ofp_table_feature_prop_type(wire_type=uint16_t) {
612 OFPTFPT_INSTRUCTIONS = 0,
613 OFPTFPT_INSTRUCTIONS_MISS = 1,
614 OFPTFPT_NEXT_TABLES = 2,
615 OFPTFPT_NEXT_TABLES_MISS = 3,
616 OFPTFPT_WRITE_ACTIONS = 4,
617 OFPTFPT_WRITE_ACTIONS_MISS = 5,
618 OFPTFPT_APPLY_ACTIONS = 6,
619 OFPTFPT_APPLY_ACTIONS_MISS = 7,
620 OFPTFPT_MATCH = 8,
621 OFPTFPT_WILDCARDS = 0xa,
622 OFPTFPT_WRITE_SETFIELD = 0xc,
623 OFPTFPT_WRITE_SETFIELD_MISS = 0xd,
624 OFPTFPT_APPLY_SETFIELD = 0xe,
625 OFPTFPT_APPLY_SETFIELD_MISS = 0xf,
626 OFPTFPT_TABLE_SYNC_FROM = 0x10,
627 OFPTFPT_EXPERIMENTER = 0xfffe,
628 OFPTFPT_EXPERIMENTER_MISS = 0xffff,
629};
630
631enum ofp_group_capabilities(wire_type=uint32_t, bitmask=True) {
632 OFPGFC_SELECT_WEIGHT = 0x1,
633 OFPGFC_SELECT_LIVENESS = 0x2,
634 OFPGFC_CHAINING = 0x4,
635 OFPGFC_CHAINING_CHECKS = 0x8,
636};
637
638enum ofp_controller_role(wire_type=uint32_t) {
639 OFPCR_ROLE_NOCHANGE = 0,
640 OFPCR_ROLE_EQUAL = 1,
641 OFPCR_ROLE_MASTER = 2,
642 OFPCR_ROLE_SLAVE = 3,
643};
644
645enum ofp_hello_elem_type(wire_type=uint16_t) {
646 OFPHET_VERSIONBITMAP = 1,
647};
648
Rich Lane888d58d2014-10-17 18:04:07 -0700649enum ofp_optical_port_features(wire_type=uint32_t, bitmask=True) {
650 OFPOPF_RX_TUNE = 0x1,
651 OFPOPF_TX_TUNE = 0x2,
652 OFPOPF_TX_PWR = 0x4,
653 OFPOPF_USE_FREQ = 0x8,
654};
655
656enum ofp_table_mod_prop_eviction_flag(wire_type=uint32_t, bitmask=True) {
657 OFPTMPEF_OTHER = 0x1,
658 OFPTMPEF_IMPORTANCE = 0x2,
659 OFPTMPEF_LIFETIME = 0x4,
660};
661
662enum ofp_port_stats_optical_flags(wire_type=uint32_t, bitmask=True) {
663 OFPOSF_RX_TUNE = 0x1,
664 OFPOSF_TX_TUNE = 0x2,
665 OFPOSF_TX_PWR = 0x4,
666 OFPOSF_RX_PWR = 0x10,
667 OFPOSF_TX_BIAS = 0x20,
668 OFPOSF_TX_TEMP = 0x40,
669};
670
671enum ofp_bundle_ctrl_type(wire_type=uint16_t) {
672 OFPBCT_OPEN_REQUEST = 0,
673 OFPBCT_OPEN_REPLY = 1,
674 OFPBCT_CLOSE_REQUEST = 2,
675 OFPBCT_CLOSE_REPLY = 3,
676 OFPBCT_COMMIT_REQUEST = 4,
677 OFPBCT_COMMIT_REPLY = 5,
678 OFPBCT_DISCARD_REQUEST = 6,
679 OFPBCT_DISCARD_REPLY = 7,
680};
681
682enum ofp_bundle_flags(wire_type=uint16_t, bitmask=True) {
683 OFPBF_ATOMIC = 1,
684 OFPBF_ORDERED = 2,
685};
686
687enum ofp_controller_role_reason(wire_type=uint8_t) {
688 OFPCRR_MASTER_REQUEST = 0,
689 OFPCRR_CONFIG = 1,
690 OFPCRR_EXPERIMENTER = 2,
691};
692
693enum ofp_table_reason(wire_type=uint8_t) {
694 OFPTR_VACANCY_DOWN = 3,
695 OFPTR_VACANCY_UP = 4,
696};
697
698enum ofp_requestforward_reason {
699 OFPRFR_GROUP_MOD = 0,
700 OFPRFR_METER_MOD = 1,
701};
702
alshabib9f50e482014-08-23 17:10:57 -0500703/* XXX rename to of_message */
704struct of_header {
705 uint8_t version;
706 uint8_t type == ?;
707 uint16_t length;
708 uint32_t xid;
709};
710
711struct of_uint64 {
712 uint64_t value;
713};
714
715// Special structures used for managing scalar list elements
716struct of_uint32 {
717 uint32_t value;
718};
719
720// Special structures used for managing scalar list elements
721struct of_uint8 {
722 uint8_t value;
723};
724
725struct of_hello_elem {
726 uint16_t type == ?;
727 uint16_t length;
728};
729
730struct of_hello_elem_versionbitmap : of_hello_elem {
731 uint16_t type == 1;
732 uint16_t length;
733 list(of_uint32_t) bitmaps;
734};
735
736struct of_hello : of_header {
737 uint8_t version;
738 uint8_t type == 0;
739 uint16_t length;
740 uint32_t xid;
741 list(of_hello_elem_t) elements;
742};
743
744struct of_echo_request : of_header {
745 uint8_t version;
746 uint8_t type == 2;
747 uint16_t length;
748 uint32_t xid;
749 of_octets_t data;
750};
751
752struct of_echo_reply : of_header {
753 uint8_t version;
754 uint8_t type == 3;
755 uint16_t length;
756 uint32_t xid;
757 of_octets_t data;
758};
759
760struct of_experimenter : of_header {
761 uint8_t version;
762 uint8_t type == 4;
763 uint16_t length;
764 uint32_t xid;
765 uint32_t experimenter == ?;
766 uint32_t subtype;
767 of_octets_t data;
768};
769
770struct of_barrier_request : of_header {
771 uint8_t version;
772 uint8_t type == 20;
773 uint16_t length;
774 uint32_t xid;
775};
776
777struct of_barrier_reply : of_header {
778 uint8_t version;
779 uint8_t type == 21;
780 uint16_t length;
781 uint32_t xid;
782};
783
784struct of_get_config_request : of_header {
785 uint8_t version;
786 uint8_t type == 7;
787 uint16_t length;
788 uint32_t xid;
789};
790
791struct of_get_config_reply : of_header {
792 uint8_t version;
793 uint8_t type == 8;
794 uint16_t length;
795 uint32_t xid;
796 enum ofp_config_flags flags;
797 uint16_t miss_send_len;
798};
799
800struct of_set_config : of_header {
801 uint8_t version;
802 uint8_t type == 9;
803 uint16_t length;
804 uint32_t xid;
805 enum ofp_config_flags flags;
806 uint16_t miss_send_len;
807};
808
Rich Lane7f503ee2014-09-26 14:18:58 -0700809struct of_table_mod_prop {
810 uint16_t type == ?; /* One of OFPTMPT_*. */
alshabib9f50e482014-08-23 17:10:57 -0500811 uint16_t length; /* Length in bytes of this property. */
812};
813
Rich Lane888d58d2014-10-17 18:04:07 -0700814struct of_table_mod_prop_eviction {
815 uint16_t type == 2;
816 uint16_t length;
817 enum ofp_table_mod_prop_eviction_flag flags;
818};
819
820struct of_table_mod_prop_vacancy {
821 uint16_t type == 3;
822 uint16_t length;
823 uint8_t vacancy_down;
824 uint8_t vacancy_up;
825 uint8_t vacancy;
826 pad(1);
827};
828
829struct of_table_mod_prop_experimenter {
830 uint16_t type == 0xffff;
831 uint16_t length;
832 uint32_t experimenter == ?;
833 uint32_t exp_type;
834};
835
alshabib9f50e482014-08-23 17:10:57 -0500836struct of_table_mod : of_header {
837 uint8_t version;
838 uint8_t type == 17;
839 uint16_t length;
840 uint32_t xid;
841 uint8_t table_id;
842 pad(3);
843 uint32_t config;
Rich Lane7f503ee2014-09-26 14:18:58 -0700844 list(of_table_mod_prop_t) properties;
alshabib9f50e482014-08-23 17:10:57 -0500845};
846
Rich Lane7f503ee2014-09-26 14:18:58 -0700847struct of_port_desc_prop {
848 uint16_t type == ?; /* One of OFPPDPT_*. */
alshabib9f50e482014-08-23 17:10:57 -0500849 uint16_t length; /* Length in bytes of this property. */
850};
851
Rich Lanec6463c32014-10-10 17:13:27 -0700852struct of_port_desc_prop_ethernet : of_port_desc_prop {
853 uint16_t type == 0;
854 uint16_t length;
855 pad(4);
856 uint32_t curr;
857 uint32_t advertised;
858 uint32_t supported;
859 uint32_t peer;
860 uint32_t curr_speed;
861 uint32_t max_speed;
862};
863
Rich Lane888d58d2014-10-17 18:04:07 -0700864struct of_port_desc_prop_optical : of_port_desc_prop {
865 uint16_t type == 1;
866 uint16_t length;
867 pad(4);
868 uint32_t supported;
869 uint32_t tx_min_freq_lmda;
870 uint32_t tx_max_freq_lmda;
871 uint32_t tx_grid_freq_lmda;
872 uint32_t rx_min_freq_lmda;
873 uint32_t rx_max_freq_lmda;
874 uint32_t rx_grid_freq_lmda;
875 uint32_t tx_pwr_min;
876 uint32_t tx_pwr_max;
877};
878
879struct of_port_desc_prop_experimenter : of_port_desc_prop {
880 uint16_t type == 0xffff;
881 uint16_t length;
882 uint32_t experimenter == ?;
Rich Lanebe233662015-07-13 15:15:36 -0700883 //uint32_t exp_type;
Rich Lane888d58d2014-10-17 18:04:07 -0700884};
885
alshabib9f50e482014-08-23 17:10:57 -0500886struct of_port_desc {
887 of_port_no_t port_no;
888 uint16_t length;
889 pad(2);
Rich Lane457bc452014-10-17 18:04:56 -0700890 of_mac_addr_t hw_addr;
alshabib9f50e482014-08-23 17:10:57 -0500891 pad(2);
892 of_port_name_t name;
893 enum ofp_port_config config; /* Bitmap of OFPPC_* flags. */
894 enum ofp_port_state state; /* Bitmap of OFPPS_* flags. */
Rich Lane7f503ee2014-09-26 14:18:58 -0700895 list(of_port_desc_prop_t) properties;
alshabib9f50e482014-08-23 17:10:57 -0500896};
897
898struct of_features_request : of_header {
899 uint8_t version;
900 uint8_t type == 5;
901 uint16_t length;
902 uint32_t xid;
903};
904
905struct of_features_reply : of_header {
906 uint8_t version;
907 uint8_t type == 6;
908 uint16_t length;
909 uint32_t xid;
910 uint64_t datapath_id;
911 uint32_t n_buffers;
912 uint8_t n_tables;
913 uint8_t auxiliary_id;
914 pad(2);
915 enum ofp_capabilities capabilities;
916 uint32_t reserved;
917};
918
919struct of_port_status : of_header {
920 uint8_t version;
921 uint8_t type == 12;
922 uint16_t length;
923 uint32_t xid;
924 enum ofp_port_reason reason;
925 pad(7);
926 of_port_desc_t desc;
927};
928
Rich Lane7f503ee2014-09-26 14:18:58 -0700929struct of_port_mod_prop {
930 uint16_t type == ?; /* One of OFPPMPT_*. */
alshabib9f50e482014-08-23 17:10:57 -0500931 uint16_t length; /* Length in bytes of this property. */
932};
933
Rich Lane23e5c822014-10-14 10:47:29 -0700934struct of_port_mod_prop_ethernet : of_port_mod_prop {
935 uint16_t type == 0;
936 uint16_t length;
937 uint32_t advertise;
938};
939
940struct of_port_mod_prop_optical : of_port_mod_prop {
941 uint16_t type == 1;
942 uint16_t length;
943 uint32_t configure;
944 uint32_t freq_ldma;
945 uint32_t fl_offset; /* TODO signed */
946 uint32_t grid_span;
947 uint32_t tx_pwr;
948};
949
Rich Lane888d58d2014-10-17 18:04:07 -0700950struct of_port_mod_prop_experimenter : of_port_mod_prop {
951 uint16_t type == 0xffff;
952 uint16_t length;
953 uint32_t experimenter == ?;
954 uint32_t exp_type;
955};
956
alshabib9f50e482014-08-23 17:10:57 -0500957struct of_port_mod : of_header {
958 uint8_t version;
959 uint8_t type == 16;
960 uint16_t length;
961 uint32_t xid;
962 of_port_no_t port_no;
963 pad(4);
964 of_mac_addr_t hw_addr;
965 pad(2);
966 uint32_t config;
967 uint32_t mask;
Rich Lane7f503ee2014-09-26 14:18:58 -0700968 list(of_port_mod_prop_t) properties;
alshabib9f50e482014-08-23 17:10:57 -0500969};
970
Rich Laneb4d24df2014-10-10 15:58:03 -0700971struct of_match_v3(align=8, length_includes_align=False) {
alshabib9f50e482014-08-23 17:10:57 -0500972 uint16_t type == 1;
973 uint16_t length;
974 list(of_oxm_t) oxm_list;
975};
976
Rich Lane457bc452014-10-17 18:04:56 -0700977// This looks like an action header, but is standalone. See
alshabib9f50e482014-08-23 17:10:57 -0500978// ofp_table_features_prop_actions
979struct of_action_id {
980 uint16_t type;
981 uint16_t len;
Rich Lane7f503ee2014-09-26 14:18:58 -0700982 of_octets_t exp_data;
alshabib9f50e482014-08-23 17:10:57 -0500983};
984
985struct of_action_output : of_action {
986 uint16_t type == 0;
987 uint16_t len;
988 of_port_no_t port;
989 uint16_t max_len;
990 pad(6);
991};
992
993struct of_action_copy_ttl_out : of_action {
994 uint16_t type == 11;
995 uint16_t len;
996 pad(4);
997};
998
999struct of_action_copy_ttl_in : of_action {
1000 uint16_t type == 12;
1001 uint16_t len;
1002 pad(4);
1003};
1004
1005struct of_action_set_mpls_ttl : of_action {
1006 uint16_t type == 15;
1007 uint16_t len;
1008 uint8_t mpls_ttl;
1009 pad(3);
1010};
1011
1012struct of_action_dec_mpls_ttl : of_action {
1013 uint16_t type == 16;
1014 uint16_t len;
1015 pad(4);
1016};
1017
1018struct of_action_push_vlan : of_action {
1019 uint16_t type == 17;
1020 uint16_t len;
1021 uint16_t ethertype;
1022 pad(2);
1023};
1024
1025struct of_action_pop_vlan : of_action {
1026 uint16_t type == 18;
1027 uint16_t len;
1028 pad(4);
1029};
1030
1031struct of_action_push_mpls : of_action {
1032 uint16_t type == 19;
1033 uint16_t len;
1034 uint16_t ethertype;
1035 pad(2);
1036};
1037
1038struct of_action_pop_mpls : of_action {
1039 uint16_t type == 20;
1040 uint16_t len;
1041 uint16_t ethertype;
1042 pad(2);
1043};
1044
1045struct of_action_set_queue : of_action {
1046 uint16_t type == 21;
1047 uint16_t len;
1048 uint32_t queue_id;
1049};
1050
1051struct of_action_group : of_action {
1052 uint16_t type == 22;
1053 uint16_t len;
1054 uint32_t group_id;
1055};
1056
1057struct of_action_set_nw_ttl : of_action {
1058 uint16_t type == 23;
1059 uint16_t len;
1060 uint8_t nw_ttl;
1061 pad(3);
1062};
1063
1064struct of_action_dec_nw_ttl : of_action {
1065 uint16_t type == 24;
1066 uint16_t len;
1067 pad(4);
1068};
1069
1070struct of_action_set_field(align=8, length_includes_align=True) : of_action {
1071 uint16_t type == 25;
1072 uint16_t len;
1073 of_oxm_t field;
1074};
1075
1076struct of_action_experimenter(align=8, length_includes_align=True): of_action {
1077 uint16_t type == 65535;
1078 uint16_t len;
1079 uint32_t experimenter == ?;
1080 of_octets_t data;
1081};
1082
1083struct of_action_pop_pbb : of_action {
1084 uint16_t type == 27;
1085 uint16_t len;
1086 pad(4);
1087};
1088
1089struct of_action_push_pbb : of_action {
1090 uint16_t type == 26;
1091 uint16_t len;
1092 uint16_t ethertype;
1093 pad(2);
1094};
1095
1096struct of_action {
1097 uint16_t type == ?;
1098 uint16_t len;
1099 pad(4);
1100};
1101
1102struct of_instruction_id {
1103 uint16_t type;
1104 uint16_t len;
1105};
1106
1107struct of_instruction {
1108 uint16_t type == ?;
1109 uint16_t len;
1110};
1111
1112struct of_instruction_goto_table : of_instruction {
1113 uint16_t type == 1;
1114 uint16_t len;
Rich Lane94af3782014-10-10 15:59:36 -07001115 uint8_t table_id;
1116 pad(3);
alshabib9f50e482014-08-23 17:10:57 -05001117};
1118
1119struct of_instruction_write_metadata : of_instruction {
1120 uint16_t type == 2;
1121 uint16_t len;
1122 pad(4);
1123 uint64_t metadata;
1124 uint64_t metadata_mask;
1125};
1126
1127struct of_instruction_write_actions : of_instruction {
1128 uint16_t type == 3;
1129 uint16_t len;
1130 pad(4);
1131 list(of_action_t) actions;
1132};
1133
1134struct of_instruction_apply_actions : of_instruction {
1135 uint16_t type == 4;
1136 uint16_t len;
1137 pad(4);
1138 list(of_action_t) actions;
1139};
1140
1141struct of_instruction_clear_actions : of_instruction {
1142 uint16_t type == 5;
1143 uint16_t len;
1144 pad(4);
1145};
1146
1147struct of_instruction_meter : of_instruction {
1148 uint16_t type == 6;
1149 uint16_t len;
1150 uint32_t meter_id;
1151};
1152
1153struct of_instruction_experimenter : of_instruction {
1154 uint16_t type == 65535;
1155 uint16_t len;
1156 uint32_t experimenter == ?;
1157 of_octets_t data;
1158};
1159
1160struct of_flow_mod : of_header {
1161 uint8_t version;
1162 uint8_t type == 14;
1163 uint16_t length;
1164 uint32_t xid;
1165 uint64_t cookie;
1166 uint64_t cookie_mask;
1167 uint8_t table_id;
1168 of_fm_cmd_t _command == ?;
1169 uint16_t idle_timeout;
1170 uint16_t hard_timeout;
1171 uint16_t priority;
1172 uint32_t buffer_id;
1173 of_port_no_t out_port;
1174 uint32_t out_group;
1175 enum ofp_flow_mod_flags flags;
1176 pad(2);
1177 of_match_t match;
1178 list(of_instruction_t) instructions;
1179};
1180
1181struct of_flow_add : of_flow_mod {
1182 uint8_t version;
1183 uint8_t type == 14;
1184 uint16_t length;
1185 uint32_t xid;
1186 uint64_t cookie;
1187 uint64_t cookie_mask;
1188 uint8_t table_id;
1189 of_fm_cmd_t _command == 0;
1190 uint16_t idle_timeout;
1191 uint16_t hard_timeout;
1192 uint16_t priority;
1193 uint32_t buffer_id;
1194 of_port_no_t out_port;
1195 uint32_t out_group;
1196 enum ofp_flow_mod_flags flags;
1197 uint16_t importance;
1198 of_match_t match;
1199 list(of_instruction_t) instructions;
1200};
1201
1202struct of_flow_modify : of_flow_mod {
1203 uint8_t version;
1204 uint8_t type == 14;
1205 uint16_t length;
1206 uint32_t xid;
1207 uint64_t cookie;
1208 uint64_t cookie_mask;
1209 uint8_t table_id;
1210 of_fm_cmd_t _command == 1;
1211 uint16_t idle_timeout;
1212 uint16_t hard_timeout;
1213 uint16_t priority;
1214 uint32_t buffer_id;
1215 of_port_no_t out_port;
1216 uint32_t out_group;
1217 enum ofp_flow_mod_flags flags;
1218 uint16_t importance;
1219 of_match_t match;
1220 list(of_instruction_t) instructions;
1221};
1222
1223struct of_flow_modify_strict : of_flow_mod {
1224 uint8_t version;
1225 uint8_t type == 14;
1226 uint16_t length;
1227 uint32_t xid;
1228 uint64_t cookie;
1229 uint64_t cookie_mask;
1230 uint8_t table_id;
1231 of_fm_cmd_t _command == 2;
1232 uint16_t idle_timeout;
1233 uint16_t hard_timeout;
1234 uint16_t priority;
1235 uint32_t buffer_id;
1236 of_port_no_t out_port;
1237 uint32_t out_group;
1238 enum ofp_flow_mod_flags flags;
Rich Lane457bc452014-10-17 18:04:56 -07001239 uint16_t importance;
alshabib9f50e482014-08-23 17:10:57 -05001240 of_match_t match;
1241 list(of_instruction_t) instructions;
1242};
1243
1244struct of_flow_delete : of_flow_mod {
1245 uint8_t version;
1246 uint8_t type == 14;
1247 uint16_t length;
1248 uint32_t xid;
1249 uint64_t cookie;
1250 uint64_t cookie_mask;
1251 uint8_t table_id;
1252 of_fm_cmd_t _command == 3;
1253 uint16_t idle_timeout;
1254 uint16_t hard_timeout;
1255 uint16_t priority;
1256 uint32_t buffer_id;
1257 of_port_no_t out_port;
1258 uint32_t out_group;
1259 enum ofp_flow_mod_flags flags;
1260 uint16_t importance;
1261 of_match_t match;
1262 list(of_instruction_t) instructions;
1263};
1264
1265struct of_flow_delete_strict : of_flow_mod {
1266 uint8_t version;
1267 uint8_t type == 14;
1268 uint16_t length;
1269 uint32_t xid;
1270 uint64_t cookie;
1271 uint64_t cookie_mask;
1272 uint8_t table_id;
1273 of_fm_cmd_t _command == 4;
1274 uint16_t idle_timeout;
1275 uint16_t hard_timeout;
1276 uint16_t priority;
1277 uint32_t buffer_id;
1278 of_port_no_t out_port;
1279 uint32_t out_group;
1280 enum ofp_flow_mod_flags flags;
1281 uint16_t importance;
1282 of_match_t match;
1283 list(of_instruction_t) instructions;
1284};
1285
1286struct of_bucket {
1287 uint16_t len;
1288 uint16_t weight;
1289 of_port_no_t watch_port;
1290 uint32_t watch_group;
1291 pad(4);
1292 list(of_action_t) actions;
1293};
1294
1295struct of_group_mod : of_header {
1296 uint8_t version;
1297 uint8_t type == 15;
1298 uint16_t length;
1299 uint32_t xid;
1300 enum ofp_group_mod_command command == ?;
1301 enum ofp_group_type group_type;
1302 pad(1);
1303 uint32_t group_id;
1304 list(of_bucket_t) buckets;
1305};
1306
1307struct of_group_add : of_group_mod {
1308 uint8_t version;
1309 uint8_t type == 15;
1310 uint16_t length;
1311 uint32_t xid;
1312 enum ofp_group_mod_command command == 0;
1313 enum ofp_group_type group_type;
1314 pad(1);
1315 uint32_t group_id;
1316 list(of_bucket_t) buckets;
1317};
1318
1319struct of_group_modify : of_group_mod {
1320 uint8_t version;
1321 uint8_t type == 15;
1322 uint16_t length;
1323 uint32_t xid;
1324 enum ofp_group_mod_command command == 1;
1325 enum ofp_group_type group_type;
1326 pad(1);
1327 uint32_t group_id;
1328 list(of_bucket_t) buckets;
1329};
1330
1331struct of_group_delete : of_group_mod {
1332 uint8_t version;
1333 uint8_t type == 15;
1334 uint16_t length;
1335 uint32_t xid;
1336 enum ofp_group_mod_command command == 2;
1337 enum ofp_group_type group_type;
1338 pad(1);
1339 uint32_t group_id;
1340 list(of_bucket_t) buckets;
1341};
1342
1343struct of_packet_out : of_header {
1344 uint8_t version;
1345 uint8_t type == 13;
1346 uint16_t length;
1347 uint32_t xid;
1348 uint32_t buffer_id;
1349 of_port_no_t in_port;
1350 uint16_t actions_len;
1351 pad(6);
1352 list(of_action_t) actions;
1353 of_octets_t data;
1354};
1355
1356struct of_packet_in : of_header {
1357 uint8_t version;
1358 uint8_t type == 10;
1359 uint16_t length;
1360 uint32_t xid;
1361 uint32_t buffer_id;
1362 uint16_t total_len;
1363 uint8_t reason;
1364 uint8_t table_id;
1365 uint64_t cookie;
1366 of_match_t match;
1367 pad(2);
Rich Lane457bc452014-10-17 18:04:56 -07001368 of_octets_t data;
alshabib9f50e482014-08-23 17:10:57 -05001369};
1370
1371struct of_flow_removed : of_header {
1372 uint8_t version;
1373 uint8_t type == 11;
1374 uint16_t length;
1375 uint32_t xid;
1376 uint64_t cookie;
1377 uint16_t priority;
1378 uint8_t reason;
1379 uint8_t table_id;
1380 uint32_t duration_sec;
1381 uint32_t duration_nsec;
1382 uint16_t idle_timeout;
1383 uint16_t hard_timeout;
1384 uint64_t packet_count;
1385 uint64_t byte_count;
1386 of_match_t match;
1387};
1388
1389struct of_meter_band {
1390 uint16_t type == ?;
1391 uint16_t len;
1392// uint32_t rate; // These are excluded b/c this is the header
1393// uint32_t burst_size; // These are excluded b/c this is the header
1394};
1395
1396struct of_meter_band_drop : of_meter_band {
1397 uint16_t type == 1;
1398 uint16_t len;
1399 uint32_t rate;
1400 uint32_t burst_size;
1401 pad(4);
1402};
1403
1404struct of_meter_band_dscp_remark : of_meter_band {
1405 uint16_t type == 2;
1406 uint16_t len;
1407 uint32_t rate;
1408 uint32_t burst_size;
1409 uint8_t prec_level;
1410 pad(3);
1411};
1412
1413struct of_meter_band_experimenter : of_meter_band {
1414 uint16_t type == 65535;
1415 uint16_t len;
1416 uint32_t rate;
1417 uint32_t burst_size;
1418 uint32_t experimenter;
1419};
1420
1421struct of_meter_mod : of_header {
1422 uint8_t version;
1423 uint8_t type == 29;
1424 uint16_t length;
1425 uint32_t xid;
1426 uint16_t command;
1427 uint16_t flags;
1428 uint32_t meter_id;
1429 list(of_meter_band_t) bands;
1430};
1431
1432struct of_error_msg : of_header {
1433 uint8_t version;
1434 uint8_t type == 1;
1435 uint16_t length;
1436 uint32_t xid;
1437 uint16_t err_type == ?;
1438};
1439
1440struct of_hello_failed_error_msg : of_error_msg {
1441 uint8_t version;
1442 uint8_t type == 1;
1443 uint16_t length;
1444 uint32_t xid;
1445 uint16_t err_type == 0;
1446 enum ofp_hello_failed_code code;
1447 of_octets_t data;
1448};
1449
1450struct of_bad_request_error_msg : of_error_msg {
1451 uint8_t version;
1452 uint8_t type == 1;
1453 uint16_t length;
1454 uint32_t xid;
1455 uint16_t err_type == 1;
1456 enum ofp_bad_request_code code;
1457 of_octets_t data;
1458};
1459
1460struct of_bad_action_error_msg : of_error_msg {
1461 uint8_t version;
1462 uint8_t type == 1;
1463 uint16_t length;
1464 uint32_t xid;
1465 uint16_t err_type == 2;
1466 enum ofp_bad_action_code code;
1467 of_octets_t data;
1468};
1469
1470struct of_bad_instruction_error_msg : of_error_msg {
1471 uint8_t version;
1472 uint8_t type == 1;
1473 uint16_t length;
1474 uint32_t xid;
1475 uint16_t err_type == 3;
1476 enum ofp_bad_instruction_code code;
1477 of_octets_t data;
1478};
1479
1480struct of_bad_match_error_msg : of_error_msg {
1481 uint8_t version;
1482 uint8_t type == 1;
1483 uint16_t length;
1484 uint32_t xid;
1485 uint16_t err_type == 4;
1486 enum ofp_bad_match_code code;
1487 of_octets_t data;
1488};
1489
1490struct of_flow_mod_failed_error_msg : of_error_msg {
1491 uint8_t version;
1492 uint8_t type == 1;
1493 uint16_t length;
1494 uint32_t xid;
1495 uint16_t err_type == 5;
1496 enum ofp_flow_mod_failed_code code;
1497 of_octets_t data;
1498};
1499
1500struct of_group_mod_failed_error_msg : of_error_msg {
1501 uint8_t version;
1502 uint8_t type == 1;
1503 uint16_t length;
1504 uint32_t xid;
1505 uint16_t err_type == 6;
1506 enum ofp_group_mod_failed_code code;
1507 of_octets_t data;
1508};
1509
1510struct of_port_mod_failed_error_msg : of_error_msg {
1511 uint8_t version;
1512 uint8_t type == 1;
1513 uint16_t length;
1514 uint32_t xid;
1515 uint16_t err_type == 7;
1516 enum ofp_port_mod_failed_code code;
1517 of_octets_t data;
1518};
1519
1520struct of_table_mod_failed_error_msg : of_error_msg {
1521 uint8_t version;
1522 uint8_t type == 1;
1523 uint16_t length;
1524 uint32_t xid;
1525 uint16_t err_type == 8;
1526 enum ofp_table_mod_failed_code code;
1527 of_octets_t data;
1528};
1529
1530struct of_queue_op_failed_error_msg : of_error_msg {
1531 uint8_t version;
1532 uint8_t type == 1;
1533 uint16_t length;
1534 uint32_t xid;
1535 uint16_t err_type == 9;
1536 enum ofp_queue_op_failed_code code;
1537 of_octets_t data;
1538};
1539
1540struct of_switch_config_failed_error_msg : of_error_msg {
1541 uint8_t version;
1542 uint8_t type == 1;
1543 uint16_t length;
1544 uint32_t xid;
1545 uint16_t err_type == 10;
1546 enum ofp_switch_config_failed_code code;
1547 of_octets_t data;
1548};
1549
1550struct of_role_request_failed_error_msg : of_error_msg {
1551 uint8_t version;
1552 uint8_t type == 1;
1553 uint16_t length;
1554 uint32_t xid;
1555 uint16_t err_type == 11;
1556 enum ofp_role_request_failed_code code;
1557 of_octets_t data;
1558};
1559
1560struct of_meter_mod_failed_error_msg : of_error_msg {
1561 uint8_t version;
1562 uint8_t type == 1;
1563 uint16_t length;
1564 uint32_t xid;
1565 uint16_t err_type == 12;
1566 enum ofp_meter_mod_failed_code code;
1567 of_octets_t data;
1568};
1569
1570struct of_table_features_failed_error_msg : of_error_msg {
1571 uint8_t version;
1572 uint8_t type == 1;
1573 uint16_t length;
1574 uint32_t xid;
1575 uint16_t err_type == 13;
1576 enum ofp_table_features_failed_code code;
1577 of_octets_t data;
1578};
1579
Rich Lane1f2162d2014-10-31 16:25:02 -07001580struct of_bad_property_error_msg : of_error_msg {
1581 uint8_t version;
1582 uint8_t type == 1;
1583 uint16_t length;
1584 uint32_t xid;
1585 uint16_t err_type == 14;
1586 enum ofp_bad_property_code code;
1587 of_octets_t data;
1588};
1589
1590struct of_async_config_failed_error_msg : of_error_msg {
1591 uint8_t version;
1592 uint8_t type == 1;
1593 uint16_t length;
1594 uint32_t xid;
1595 uint16_t err_type == 15;
1596 enum ofp_async_config_failed_code code;
1597 of_octets_t data;
1598};
1599
1600struct of_flow_monitor_failed_error_msg : of_error_msg {
1601 uint8_t version;
1602 uint8_t type == 1;
1603 uint16_t length;
1604 uint32_t xid;
1605 uint16_t err_type == 16;
1606 enum ofp_flow_monitor_failed_code code;
1607 of_octets_t data;
1608};
1609
1610struct of_bundle_failed_error_msg : of_error_msg {
1611 uint8_t version;
1612 uint8_t type == 1;
1613 uint16_t length;
1614 uint32_t xid;
1615 uint16_t err_type == 17;
1616 enum ofp_bundle_failed_code code;
1617 of_octets_t data;
1618};
1619
alshabib9f50e482014-08-23 17:10:57 -05001620struct of_experimenter_error_msg : of_error_msg {
1621 uint8_t version;
1622 uint8_t type == 1;
1623 uint16_t length;
1624 uint32_t xid;
1625 uint16_t err_type == 0xffff;
1626 uint16_t subtype;
1627 uint32_t experimenter;
1628 of_octets_t data;
1629};
1630
1631// STATS ENTRIES: flow, table, port, queue, group stats, group desc stats
1632
1633struct of_flow_stats_entry {
1634 uint16_t length;
1635 uint8_t table_id;
1636 pad(1);
1637 uint32_t duration_sec;
1638 uint32_t duration_nsec;
1639 uint16_t priority;
1640 uint16_t idle_timeout;
1641 uint16_t hard_timeout;
1642 enum ofp_flow_mod_flags flags;
1643 uint16_t importance;
1644 pad(2);
1645 uint64_t cookie;
1646 uint64_t packet_count;
1647 uint64_t byte_count;
1648 of_match_t match;
1649 list(of_instruction_t) instructions;
1650};
1651
1652
1653struct of_table_stats_entry {
1654 uint8_t table_id;
1655 pad(3);
1656 uint32_t active_count;
1657 uint64_t lookup_count;
1658 uint64_t matched_count;
1659};
1660
1661/* Common header for all port stats properties. */
Rich Lane7f503ee2014-09-26 14:18:58 -07001662struct of_port_stats_prop {
1663 uint16_t type == ?; /* One of OFPPSPT_*. */
alshabib9f50e482014-08-23 17:10:57 -05001664 uint16_t length; /* Length in bytes of this property. */
1665};
1666
1667/* Ethernet port stats property. */
Rich Lane7f503ee2014-09-26 14:18:58 -07001668struct of_port_stats_prop_ethernet : of_port_stats_prop {
1669 uint16_t type == 0; /* OFPPSPT_ETHERNET. */
alshabib9f50e482014-08-23 17:10:57 -05001670 uint16_t length; /* Length in bytes of this property. */
1671 pad(4);
1672
1673 uint64_t rx_frame_err; /* Number of frame alignment errors. */
1674 uint64_t rx_over_err; /* Number of packets with RX overrun. */
1675 uint64_t rx_crc_err; /* Number of CRC errors. */
1676 uint64_t collisions; /* Number of collisions. */
1677};
1678
1679/* Optical port stats property. */
Rich Lane7f503ee2014-09-26 14:18:58 -07001680struct of_port_stats_prop_optical : of_port_stats_prop {
1681 uint16_t type == 1;
alshabib9f50e482014-08-23 17:10:57 -05001682 uint16_t length;
1683 pad(4);
1684
1685 uint32_t flags;
1686 uint32_t tx_freq_lmda;
Rich Lane457bc452014-10-17 18:04:56 -07001687 uint32_t tx_offset;
alshabib9f50e482014-08-23 17:10:57 -05001688 uint32_t tx_grid_span;
1689 uint32_t rx_freq_lmda;
1690 uint32_t rx_offset;
1691 uint32_t rx_grid_span;
Rich Lane457bc452014-10-17 18:04:56 -07001692 uint16_t tx_pwr;
alshabib9f50e482014-08-23 17:10:57 -05001693 uint16_t rx_pwr;
1694 uint16_t bias_current;
1695 uint16_t temperature;
1696};
1697
1698/* Experimenter port stats property. */
Rich Lane7f503ee2014-09-26 14:18:58 -07001699struct of_port_stats_prop_experimenter : of_port_stats_prop {
1700 uint16_t type == 0xffff;
Rich Lane457bc452014-10-17 18:04:56 -07001701 uint16_t length;
Rich Lane7f503ee2014-09-26 14:18:58 -07001702 uint32_t experimenter == ?;
alshabib9f50e482014-08-23 17:10:57 -05001703 uint32_t exp_type;
Rich Lane7f503ee2014-09-26 14:18:58 -07001704 of_octets_t experimenter_data;
alshabib9f50e482014-08-23 17:10:57 -05001705};
1706
1707struct of_port_stats_entry {
1708 uint16_t length;
1709 pad(2);
1710 of_port_no_t port_no;
Rich Lane90651c42014-10-10 16:19:30 -07001711 uint32_t duration_sec;
1712 uint32_t duration_nsec;
alshabib9f50e482014-08-23 17:10:57 -05001713 uint64_t rx_packets;
1714 uint64_t tx_packets;
1715 uint64_t rx_bytes;
1716 uint64_t tx_bytes;
1717 uint64_t rx_dropped;
1718 uint64_t tx_dropped;
1719 uint64_t rx_errors;
1720 uint64_t tx_errors;
Rich Lane7f503ee2014-09-26 14:18:58 -07001721 list(of_port_stats_prop_t) properties;
alshabib9f50e482014-08-23 17:10:57 -05001722};
1723
Rich Lane7f503ee2014-09-26 14:18:58 -07001724struct of_queue_stats_prop {
1725 uint16_t type == ?;
alshabib9f50e482014-08-23 17:10:57 -05001726 uint16_t length;
1727};
1728
Rich Lane888d58d2014-10-17 18:04:07 -07001729struct of_queue_stats_prop_experimenter : of_queue_stats_prop {
1730 uint16_t type == 0xffff;
1731 uint16_t length;
1732 uint32_t experimenter == ?;
1733 uint32_t exp_type;
1734};
1735
alshabib9f50e482014-08-23 17:10:57 -05001736struct of_queue_stats_entry {
Rich Lane457bc452014-10-17 18:04:56 -07001737 uint16_t length;
1738 pad(6);
alshabib9f50e482014-08-23 17:10:57 -05001739 of_port_no_t port_no;
Rich Lane457bc452014-10-17 18:04:56 -07001740 uint32_t queue_id;
1741 uint64_t tx_bytes;
alshabib9f50e482014-08-23 17:10:57 -05001742 uint64_t tx_packets;
1743 uint64_t tx_errors;
1744 uint32_t duration_sec;
1745 uint32_t duration_nsec;
Rich Lane7f503ee2014-09-26 14:18:58 -07001746 list(of_queue_stats_prop_t) properties;
alshabib9f50e482014-08-23 17:10:57 -05001747};
1748
1749struct of_bucket_counter {
1750 uint64_t packet_count;
1751 uint64_t byte_count;
1752};
1753
1754struct of_group_stats_entry {
1755 uint16_t length;
1756 pad(2);
1757 uint32_t group_id;
1758 uint32_t ref_count;
1759 pad(4);
1760 uint64_t packet_count;
1761 uint64_t byte_count;
1762 uint32_t duration_sec;
1763 uint32_t duration_nsec;
1764 list(of_bucket_counter_t) bucket_stats;
1765};
1766
1767struct of_group_desc_stats_entry {
1768 uint16_t length;
1769 enum ofp_group_type group_type;
1770 pad(1);
1771 uint32_t group_id;
1772 list(of_bucket_t) buckets;
1773};
1774
Rich Lane457bc452014-10-17 18:04:56 -07001775// STATS:
alshabib9f50e482014-08-23 17:10:57 -05001776// Desc, flow, agg, table, port, queue, group, group_desc, group_feat, experi
1777
1778struct of_stats_request : of_header {
1779 uint8_t version;
1780 uint8_t type == 18;
1781 uint16_t length;
1782 uint32_t xid;
1783 uint16_t stats_type == ?;
1784 enum ofp_stats_request_flags flags;
1785 pad(4);
1786};
1787
1788struct of_stats_reply : of_header {
1789 uint8_t version;
1790 uint8_t type == 19;
1791 uint16_t length;
1792 uint32_t xid;
1793 uint16_t stats_type == ?;
1794 enum ofp_stats_reply_flags flags;
1795 pad(4);
1796};
1797
1798struct of_desc_stats_request : of_stats_request {
1799 uint8_t version;
1800 uint8_t type == 18;
1801 uint16_t length;
1802 uint32_t xid;
1803 uint16_t stats_type == 0;
1804 enum ofp_stats_request_flags flags;
1805 pad(4);
1806};
1807
1808struct of_desc_stats_reply : of_stats_reply {
1809 uint8_t version;
1810 uint8_t type == 19;
1811 uint16_t length;
1812 uint32_t xid;
1813 uint16_t stats_type == 0;
1814 enum ofp_stats_reply_flags flags;
1815 pad(4);
1816 of_desc_str_t mfr_desc;
1817 of_desc_str_t hw_desc;
1818 of_desc_str_t sw_desc;
1819 of_serial_num_t serial_num;
1820 of_desc_str_t dp_desc;
1821};
1822
1823struct of_flow_stats_request : of_stats_request {
1824 uint8_t version;
1825 uint8_t type == 18;
1826 uint16_t length;
1827 uint32_t xid;
1828 uint16_t stats_type == 1;
1829 enum ofp_stats_request_flags flags;
1830 pad(4);
1831 uint8_t table_id;
1832 pad(3);
1833 of_port_no_t out_port;
1834 uint32_t out_group;
1835 pad(4);
1836 uint64_t cookie;
1837 uint64_t cookie_mask;
1838 of_match_t match;
1839};
1840
1841struct of_flow_stats_reply : of_stats_reply {
1842 uint8_t version;
1843 uint8_t type == 19;
1844 uint16_t length;
1845 uint32_t xid;
1846 uint16_t stats_type == 1;
1847 enum ofp_stats_reply_flags flags;
1848 pad(4);
1849 list(of_flow_stats_entry_t) entries;
1850};
1851
1852struct of_aggregate_stats_request : of_stats_request {
1853 uint8_t version;
1854 uint8_t type == 18;
1855 uint16_t length;
1856 uint32_t xid;
1857 uint16_t stats_type == 2;
1858 enum ofp_stats_request_flags flags;
1859 pad(4);
1860 uint8_t table_id;
1861 pad(3);
1862 of_port_no_t out_port;
1863 uint32_t out_group;
1864 pad(4);
1865 uint64_t cookie;
1866 uint64_t cookie_mask;
1867 of_match_t match;
1868};
1869
1870struct of_aggregate_stats_reply : of_stats_reply {
1871 uint8_t version;
1872 uint8_t type == 19;
1873 uint16_t length;
1874 uint32_t xid;
1875 uint16_t stats_type == 2;
1876 enum ofp_stats_reply_flags flags;
1877 pad(4);
1878 uint64_t packet_count;
1879 uint64_t byte_count;
1880 uint32_t flow_count;
1881 pad(4);
1882};
1883
1884struct of_table_stats_request : of_stats_request {
1885 uint8_t version;
1886 uint8_t type == 18;
1887 uint16_t length;
1888 uint32_t xid;
1889 uint16_t stats_type == 3;
1890 enum ofp_stats_request_flags flags;
1891 pad(4);
1892};
1893
1894struct of_table_stats_reply : of_stats_reply {
1895 uint8_t version;
1896 uint8_t type == 19;
1897 uint16_t length;
1898 uint32_t xid;
1899 uint16_t stats_type == 3;
1900 enum ofp_stats_reply_flags flags;
1901 pad(4);
1902 list(of_table_stats_entry_t) entries;
1903};
1904
1905struct of_experimenter_stats_request : of_stats_request {
1906 uint8_t version;
1907 uint8_t type == 18;
1908 uint16_t length;
1909 uint32_t xid;
1910 uint16_t stats_type == 0xffff;
1911 enum ofp_stats_request_flags flags;
1912 pad(4);
1913 uint32_t experimenter == ?;
1914 uint32_t subtype;
1915};
1916
1917struct of_experimenter_stats_reply : of_stats_reply {
1918 uint8_t version;
1919 uint8_t type == 19;
1920 uint16_t length;
1921 uint32_t xid;
1922 uint16_t stats_type == 0xffff;
1923 enum ofp_stats_reply_flags flags;
1924 pad(4);
1925 uint32_t experimenter == ?;
1926 uint32_t subtype;
1927};
1928
1929// FIXME: These are padded to 8 byte align beyond the length indicated
1930
1931struct of_table_feature_prop {
1932 uint16_t type == ?;
1933 uint16_t length;
1934};
1935
1936struct of_table_feature_prop_instructions : of_table_feature_prop {
1937 uint16_t type == 0;
1938 uint16_t length;
1939 // FIXME Check if instruction_t is right for ids here
1940 list(of_instruction_id_t) instruction_ids;
1941};
1942
1943struct of_table_feature_prop_instructions_miss : of_table_feature_prop {
1944 uint16_t type == 1;
1945 uint16_t length;
1946 list(of_instruction_id_t) instruction_ids;
1947};
1948
1949struct of_table_feature_prop_next_tables : of_table_feature_prop {
1950 uint16_t type == 2;
1951 uint16_t length;
1952 list(of_uint8_t) next_table_ids;
1953};
1954
1955struct of_table_feature_prop_next_tables_miss : of_table_feature_prop {
1956 uint16_t type == 3;
1957 uint16_t length;
1958 list(of_uint8_t) next_table_ids;
1959};
1960
1961struct of_table_feature_prop_write_actions : of_table_feature_prop {
1962 uint16_t type == 4;
1963 uint16_t length;
1964 list(of_action_id_t) action_ids;
1965};
1966
1967struct of_table_feature_prop_write_actions_miss : of_table_feature_prop {
1968 uint16_t type == 5;
1969 uint16_t length;
1970 list(of_action_id_t) action_ids;
1971};
1972
1973struct of_table_feature_prop_apply_actions : of_table_feature_prop {
1974 uint16_t type == 6;
1975 uint16_t length;
1976 list(of_action_id_t) action_ids;
1977};
1978
1979struct of_table_feature_prop_apply_actions_miss : of_table_feature_prop {
1980 uint16_t type == 7;
1981 uint16_t length;
1982 list(of_action_id_t) action_ids;
1983};
1984
1985struct of_table_feature_prop_match : of_table_feature_prop {
1986 uint16_t type == 8;
1987 uint16_t length;
1988 list(of_uint32_t) oxm_ids;
1989};
1990
1991struct of_table_feature_prop_wildcards : of_table_feature_prop {
1992 uint16_t type == 10;
1993 uint16_t length;
1994 list(of_uint32_t) oxm_ids;
1995};
1996
1997struct of_table_feature_prop_write_setfield : of_table_feature_prop {
1998 uint16_t type == 12;
1999 uint16_t length;
2000 list(of_uint32_t) oxm_ids;
2001};
2002
2003struct of_table_feature_prop_write_setfield_miss : of_table_feature_prop {
2004 uint16_t type == 13;
2005 uint16_t length;
2006 list(of_uint32_t) oxm_ids;
2007};
2008
2009struct of_table_feature_prop_apply_setfield : of_table_feature_prop {
2010 uint16_t type == 14;
2011 uint16_t length;
2012 list(of_uint32_t) oxm_ids;
2013};
2014
2015struct of_table_feature_prop_apply_setfield_miss : of_table_feature_prop {
2016 uint16_t type == 15;
2017 uint16_t length;
2018 list(of_uint32_t) oxm_ids;
2019};
2020
Rich Lane888d58d2014-10-17 18:04:07 -07002021struct of_table_feature_prop_table_sync_from : of_table_feature_prop {
2022 uint16_t type == 16;
2023 uint16_t length;
2024 list(of_uint8_t) table_ids;
2025};
2026
alshabib9f50e482014-08-23 17:10:57 -05002027struct of_table_feature_prop_experimenter : of_table_feature_prop {
2028 uint16_t type == 65534;
2029 uint16_t length;
Rich Lane7f503ee2014-09-26 14:18:58 -07002030 uint32_t experimenter == ?;
alshabib9f50e482014-08-23 17:10:57 -05002031 uint32_t subtype;
2032 of_octets_t experimenter_data;
2033};
2034
2035struct of_table_feature_prop_experimenter_miss : of_table_feature_prop {
2036 uint16_t type == 65535;
2037 uint16_t length;
Rich Lane7f503ee2014-09-26 14:18:58 -07002038 uint32_t experimenter == ?;
alshabib9f50e482014-08-23 17:10:57 -05002039 uint32_t subtype;
2040 of_octets_t experimenter_data;
2041};
2042
2043struct of_table_features {
2044 uint16_t length;
2045 uint8_t table_id;
2046 pad(5);
2047 of_table_name_t name;
2048 uint64_t metadata_match;
2049 uint64_t metadata_write;
2050 uint32_t config;
2051 uint32_t max_entries;
2052 list(of_table_feature_prop_t) properties;
2053};
2054
2055struct of_meter_features {
2056 uint32_t max_meter;
2057 uint32_t band_types;
2058 uint32_t capabilities;
2059 uint8_t max_bands;
2060 uint8_t max_color;
2061 pad(2);
2062};
2063
2064struct of_port_stats_request : of_stats_request {
2065 uint8_t version;
2066 uint8_t type == 18;
2067 uint16_t length;
2068 uint32_t xid;
2069 uint16_t stats_type == 4;
2070 enum ofp_stats_request_flags flags;
2071 pad(4);
2072 of_port_no_t port_no;
2073 pad(4);
2074};
2075
2076struct of_port_stats_reply : of_stats_reply {
2077 uint8_t version;
2078 uint8_t type == 19;
2079 uint16_t length;
2080 uint32_t xid;
2081 uint16_t stats_type == 4;
2082 enum ofp_stats_reply_flags flags;
2083 pad(4);
2084 list(of_port_stats_entry_t) entries;
2085};
2086
2087struct of_queue_stats_request : of_stats_request {
2088 uint8_t version;
2089 uint8_t type == 18;
2090 uint16_t length;
2091 uint32_t xid;
2092 uint16_t stats_type == 5;
2093 enum ofp_stats_request_flags flags;
2094 pad(4);
2095 of_port_no_t port_no;
2096 uint32_t queue_id;
2097};
2098
2099struct of_queue_stats_reply : of_stats_reply {
2100 uint8_t version;
2101 uint8_t type == 19;
2102 uint16_t length;
2103 uint32_t xid;
2104 uint16_t stats_type == 5;
2105 enum ofp_stats_reply_flags flags;
2106 pad(4);
2107 list(of_queue_stats_entry_t) entries;
2108};
2109
2110struct of_group_stats_request : of_stats_request {
2111 uint8_t version;
2112 uint8_t type == 18;
2113 uint16_t length;
2114 uint32_t xid;
2115 uint16_t stats_type == 6;
2116 enum ofp_stats_request_flags flags;
2117 pad(4);
2118 uint32_t group_id;
2119 pad(4);
2120};
2121
2122struct of_group_stats_reply : of_stats_reply {
2123 uint8_t version;
2124 uint8_t type == 19;
2125 uint16_t length;
2126 uint32_t xid;
2127 uint16_t stats_type == 6;
2128 enum ofp_stats_reply_flags flags;
2129 pad(4);
2130 list(of_group_stats_entry_t) entries;
2131};
2132
2133struct of_group_desc_stats_request : of_stats_request {
2134 uint8_t version;
2135 uint8_t type == 18;
2136 uint16_t length;
2137 uint32_t xid;
2138 uint16_t stats_type == 7;
2139 enum ofp_stats_request_flags flags;
2140 pad(4);
2141};
2142
2143struct of_group_desc_stats_reply : of_stats_reply {
2144 uint8_t version;
2145 uint8_t type == 19;
2146 uint16_t length;
2147 uint32_t xid;
2148 uint16_t stats_type == 7;
2149 enum ofp_stats_reply_flags flags;
2150 pad(4);
2151 list(of_group_desc_stats_entry_t) entries;
2152};
2153
2154struct of_group_features_stats_request : of_stats_request {
2155 uint8_t version;
2156 uint8_t type == 18;
2157 uint16_t length;
2158 uint32_t xid;
2159 uint16_t stats_type == 8;
2160 enum ofp_stats_request_flags flags;
2161 pad(4);
2162};
2163
2164struct of_group_features_stats_reply : of_stats_reply {
2165 uint8_t version;
2166 uint8_t type == 19;
2167 uint16_t length;
2168 uint32_t xid;
2169 uint16_t stats_type == 8;
2170 enum ofp_stats_reply_flags flags;
2171 pad(4);
2172 uint32_t types;
2173 uint32_t capabilities;
2174 uint32_t max_groups_all;
2175 uint32_t max_groups_select;
2176 uint32_t max_groups_indirect;
2177 uint32_t max_groups_ff;
2178 uint32_t actions_all;
2179 uint32_t actions_select;
2180 uint32_t actions_indirect;
2181 uint32_t actions_ff;
2182};
2183
2184struct of_meter_stats_request : of_stats_request {
2185 uint8_t version;
2186 uint8_t type == 18;
2187 uint16_t length;
2188 uint32_t xid;
2189 uint16_t stats_type == 9;
2190 enum ofp_stats_request_flags flags;
2191 pad(4);
2192 uint32_t meter_id;
2193 pad(4);
2194};
2195
2196struct of_meter_stats_reply : of_stats_reply {
2197 uint8_t version;
2198 uint8_t type == 19;
2199 uint16_t length;
2200 uint32_t xid;
2201 uint16_t stats_type == 9;
2202 enum ofp_stats_reply_flags flags;
2203 pad(4);
2204 list(of_meter_stats_t) entries;
2205};
2206
2207struct of_meter_config_stats_request : of_stats_request {
2208 uint8_t version;
2209 uint8_t type == 18;
2210 uint16_t length;
2211 uint32_t xid;
2212 uint16_t stats_type == 10;
2213 enum ofp_stats_request_flags flags;
2214 pad(4);
2215 uint32_t meter_id;
2216 pad(4);
2217};
2218
2219struct of_meter_config_stats_reply : of_stats_reply {
2220 uint8_t version;
2221 uint8_t type == 19;
2222 uint16_t length;
2223 uint32_t xid;
2224 uint16_t stats_type == 10;
2225 enum ofp_stats_reply_flags flags;
2226 pad(4);
alshabib4d69d682015-08-21 13:54:45 -07002227 list(of_meter_config_t) entries;
alshabib9f50e482014-08-23 17:10:57 -05002228};
2229
2230// FIXME stats added to get things working
2231struct of_meter_features_stats_request : of_stats_request {
2232 uint8_t version;
2233 uint8_t type == 18;
2234 uint16_t length;
2235 uint32_t xid;
2236 uint16_t stats_type == 11;
2237 enum ofp_stats_request_flags flags;
2238 pad(4);
2239};
2240
2241// FIXME stats added to get things working
2242struct of_meter_features_stats_reply : of_stats_reply {
2243 uint8_t version;
2244 uint8_t type == 19;
2245 uint16_t length;
2246 uint32_t xid;
2247 uint16_t stats_type == 11;
2248 enum ofp_stats_reply_flags flags;
2249 pad(4);
2250 of_meter_features_t features;
2251};
2252
2253// FIXME stats added to get things working
2254struct of_table_features_stats_request : of_stats_request {
2255 uint8_t version;
2256 uint8_t type == 18;
2257 uint16_t length;
2258 uint32_t xid;
2259 uint16_t stats_type == 12;
2260 enum ofp_stats_request_flags flags;
2261 pad(4);
2262 list(of_table_features_t) entries;
2263};
2264
2265// FIXME stats added to get things working
2266struct of_table_features_stats_reply : of_stats_reply {
2267 uint8_t version;
2268 uint8_t type == 19;
2269 uint16_t length;
2270 uint32_t xid;
2271 uint16_t stats_type == 12;
2272 enum ofp_stats_reply_flags flags;
2273 pad(4);
2274 list(of_table_features_t) entries;
2275};
2276
2277// FIXME stats added to get things working
2278struct of_port_desc_stats_request : of_stats_request {
2279 uint8_t version;
2280 uint8_t type == 18;
2281 uint16_t length;
2282 uint32_t xid;
2283 uint16_t stats_type == 13;
2284 enum ofp_stats_request_flags flags;
2285 pad(4);
2286};
2287
2288// FIXME stats added to get things working
2289struct of_port_desc_stats_reply : of_stats_reply {
2290 uint8_t version;
2291 uint8_t type == 19;
2292 uint16_t length;
2293 uint32_t xid;
2294 uint16_t stats_type == 13;
2295 enum ofp_stats_reply_flags flags;
2296 pad(4);
2297 list(of_port_desc_t) entries;
2298};
2299
Rich Lane888d58d2014-10-17 18:04:07 -07002300struct of_table_desc_stats_request : of_stats_request {
2301 uint8_t version;
2302 uint8_t type == 18;
2303 uint16_t length;
2304 uint32_t xid;
2305 uint16_t stats_type == 14;
2306 enum ofp_stats_request_flags flags;
2307 pad(4);
2308};
2309
2310struct of_table_desc {
2311 uint16_t length;
2312 uint8_t table_id;
2313 pad(1);
2314 enum ofp_table_config config;
2315};
2316
2317struct of_table_desc_stats_reply : of_stats_reply {
2318 uint8_t version;
2319 uint8_t type == 19;
2320 uint16_t length;
2321 uint32_t xid;
2322 uint16_t stats_type == 14;
2323 enum ofp_stats_reply_flags flags;
2324 pad(4);
2325 list(of_table_desc_t) entries;
2326};
2327
2328struct of_queue_desc_stats_request : of_stats_request {
2329 uint8_t version;
2330 uint8_t type == 18;
2331 uint16_t length;
2332 uint32_t xid;
2333 uint16_t stats_type == 15;
2334 enum ofp_stats_request_flags flags;
2335 pad(4);
2336};
2337
2338struct of_queue_desc_prop {
2339 uint16_t type == ?;
2340 uint16_t length;
2341};
2342
2343struct of_queue_desc_prop_min_rate : of_queue_desc_prop {
2344 uint16_t type == 1;
2345 uint16_t length;
2346 uint16_t rate;
2347 pad(2);
2348};
2349
2350struct of_queue_desc_prop_max_rate : of_queue_desc_prop {
2351 uint16_t type == 2;
2352 uint16_t length;
2353 uint16_t rate;
2354 pad(2);
2355};
2356
2357struct of_queue_desc_prop_experimenter : of_queue_desc_prop {
2358 uint16_t type == 0xffff;
2359 uint16_t length;
2360 uint32_t experimenter == ?;
2361 uint32_t exp_type;
2362};
2363
2364struct of_queue_desc {
2365 uint32_t port_no;
2366 uint32_t queue_id;
2367 uint16_t length;
2368 pad(6);
2369 list(of_queue_desc_prop_t) properties;
2370};
2371
2372struct of_queue_desc_stats_reply : of_stats_reply {
2373 uint8_t version;
2374 uint8_t type == 19;
2375 uint16_t length;
2376 uint32_t xid;
2377 uint16_t stats_type == 15;
2378 enum ofp_stats_reply_flags flags;
2379 pad(4);
2380 list(of_queue_desc_t) entries;
2381};
2382
2383/*
2384 * Not supporting the flow monitor multipart messages. This message is
2385 * poorly designed because it includes a variable length match inside a
2386 * struct (ofp_flow_monitor_request) with no explicit length member.
2387 * I'm not writing the special case code to figure out the total length.
2388 */
2389
alshabib9f50e482014-08-23 17:10:57 -05002390struct of_meter_band_stats {
2391 uint64_t packet_band_count;
2392 uint64_t byte_band_count;
2393};
2394
2395struct of_meter_stats {
2396 uint32_t meter_id;
2397 uint16_t len;
2398 pad(6);
2399 uint32_t flow_count;
2400 uint64_t packet_in_count;
2401 uint64_t byte_in_count;
2402 uint32_t duration_sec;
2403 uint32_t duration_nsec;
2404 list(of_meter_band_stats_t) band_stats;
2405};
2406
2407struct of_meter_config {
2408 uint16_t length;
2409 uint16_t flags;
2410 uint32_t meter_id;
2411 list(of_meter_band_t) entries;
2412};
2413
2414// END OF STATS OBJECTS
2415
2416struct of_queue_prop {
2417 uint16_t type == ?;
2418 uint16_t len;
2419 pad(4);
2420};
2421
2422struct of_queue_prop_min_rate : of_queue_prop {
2423 uint16_t type == 1;
2424 uint16_t len;
2425 pad(4);
2426 uint16_t rate;
2427 pad(6);
2428};
2429
2430struct of_queue_prop_max_rate : of_queue_prop {
2431 uint16_t type == 2;
2432 uint16_t len;
2433 pad(4);
2434 uint16_t rate;
2435 pad(6);
2436};
2437
2438struct of_queue_prop_experimenter : of_queue_prop {
2439 uint16_t type == 65535;
2440 uint16_t len;
2441 pad(4);
2442 uint32_t experimenter == ?;
2443 pad(4);
2444 of_octets_t data;
2445};
2446
2447struct of_packet_queue {
2448 uint32_t queue_id;
2449 of_port_no_t port;
2450 uint16_t len;
2451 pad(6);
2452 list(of_queue_prop_t) properties;
2453};
2454
alshabib9f50e482014-08-23 17:10:57 -05002455struct of_role_request : of_header {
2456 uint8_t version;
2457 uint8_t type == 24;
2458 uint16_t length;
2459 uint32_t xid;
2460 enum ofp_controller_role role;
2461 pad(4);
2462 uint64_t generation_id;
2463};
2464
2465struct of_role_reply : of_header {
2466 uint8_t version;
2467 uint8_t type == 25;
2468 uint16_t length;
2469 uint32_t xid;
2470 enum ofp_controller_role role;
2471 pad(4);
2472 uint64_t generation_id;
2473};
2474
Rich Lane888d58d2014-10-17 18:04:07 -07002475/* Bundle messages */
2476
2477struct of_bundle_prop {
2478 uint16_t type == ?;
2479 uint16_t length;
2480};
2481
2482struct of_bundle_prop_experimenter : of_bundle_prop {
2483 uint16_t type == 0xffff;
2484 uint16_t length;
2485 uint32_t experimenter == ?;
2486 uint32_t exp_type;
2487};
2488
2489struct of_bundle_ctrl_msg : of_header {
2490 uint8_t version;
2491 uint8_t type == 33;
2492 uint16_t length;
2493 uint32_t xid;
2494 uint32_t bundle_id;
2495 enum ofp_bundle_ctrl_type bundle_ctrl_type;
2496 enum ofp_bundle_flags flags;
2497 list(of_bundle_prop_t) properties;
2498};
2499
2500struct of_bundle_add_msg : of_header {
2501 uint8_t version;
2502 uint8_t type == 34;
2503 uint16_t length;
2504 uint32_t xid;
2505 uint32_t bundle_id;
2506 pad(2);
2507 enum ofp_bundle_flags flags;
2508 // TODO support embedding of_header
2509 of_octets_t data;
2510 // TODO support trailing properties
2511};
2512
2513/* Async config messages */
2514
2515struct of_async_config_prop {
2516 uint16_t type == ?;
2517 uint16_t length;
2518};
2519
2520struct of_async_config_prop_packet_in_slave : of_async_config_prop {
2521 uint16_t type == 0;
2522 uint16_t length;
2523 uint32_t mask;
2524};
2525
2526struct of_async_config_prop_packet_in_master : of_async_config_prop {
2527 uint16_t type == 1;
2528 uint16_t length;
2529 uint32_t mask;
2530};
2531
2532struct of_async_config_prop_port_status_slave : of_async_config_prop {
2533 uint16_t type == 2;
2534 uint16_t length;
2535 uint32_t mask;
2536};
2537
2538struct of_async_config_prop_port_status_master : of_async_config_prop {
2539 uint16_t type == 3;
2540 uint16_t length;
2541 uint32_t mask;
2542};
2543
2544struct of_async_config_prop_flow_removed_slave : of_async_config_prop {
2545 uint16_t type == 4;
2546 uint16_t length;
2547 uint32_t mask;
2548};
2549
2550struct of_async_config_prop_flow_removed_master : of_async_config_prop {
2551 uint16_t type == 5;
2552 uint16_t length;
2553 uint32_t mask;
2554};
2555
2556struct of_async_config_prop_role_status_slave : of_async_config_prop {
2557 uint16_t type == 6;
2558 uint16_t length;
2559 uint32_t mask;
2560};
2561
2562struct of_async_config_prop_role_status_master : of_async_config_prop {
2563 uint16_t type == 7;
2564 uint16_t length;
2565 uint32_t mask;
2566};
2567
2568struct of_async_config_prop_table_status_slave : of_async_config_prop {
2569 uint16_t type == 8;
2570 uint16_t length;
2571 uint32_t mask;
2572};
2573
2574struct of_async_config_prop_table_status_master : of_async_config_prop {
2575 uint16_t type == 9;
2576 uint16_t length;
2577 uint32_t mask;
2578};
2579
2580struct of_async_config_prop_requestforward_slave : of_async_config_prop {
2581 uint16_t type == 10;
2582 uint16_t length;
2583 uint32_t mask;
2584};
2585
2586struct of_async_config_prop_requestforward_master : of_async_config_prop {
2587 uint16_t type == 11;
2588 uint16_t length;
2589 uint32_t mask;
2590};
2591
2592struct of_async_config_prop_experimenter_slave : of_async_config_prop {
2593 uint16_t type == 0xfffe;
2594 uint16_t length;
2595};
2596
2597struct of_async_config_prop_experimenter_master : of_async_config_prop {
2598 uint16_t type == 0xffff;
2599 uint16_t length;
2600};
alshabib9f50e482014-08-23 17:10:57 -05002601
2602struct of_async_get_request : of_header {
2603 uint8_t version;
2604 uint8_t type == 26;
2605 uint16_t length;
2606 uint32_t xid;
Rich Lane888d58d2014-10-17 18:04:07 -07002607 list(of_async_config_prop_t) properties;
alshabib9f50e482014-08-23 17:10:57 -05002608};
2609
2610struct of_async_get_reply : of_header {
2611 uint8_t version;
2612 uint8_t type == 27;
2613 uint16_t length;
2614 uint32_t xid;
Rich Lane888d58d2014-10-17 18:04:07 -07002615 list(of_async_config_prop_t) properties;
alshabib9f50e482014-08-23 17:10:57 -05002616};
2617
2618struct of_async_set : of_header {
2619 uint8_t version;
2620 uint8_t type == 28;
2621 uint16_t length;
2622 uint32_t xid;
Rich Lane888d58d2014-10-17 18:04:07 -07002623 list(of_async_config_prop_t) properties;
2624};
2625
2626/* Role status message */
2627
2628struct of_role_prop {
2629 uint16_t type == ?;
2630 uint16_t length;
2631};
2632
2633struct of_role_prop_experimenter : of_role_prop {
2634 uint16_t type == 0xffff;
2635 uint16_t length;
2636 uint32_t experimenter == ?;
2637 uint32_t exp_type;
2638};
2639
2640struct of_role_status : of_header {
2641 uint8_t version;
2642 uint8_t type == 30;
2643 uint16_t length;
2644 uint32_t xid;
2645 uint32_t role;
2646 enum ofp_controller_role_reason reason;
2647 pad(3);
2648 uint64_t generation_id;
2649 list(of_role_prop_t) properties;
2650};
2651
2652/* Table status messages */
2653
2654struct of_table_status : of_header {
2655 uint8_t version;
2656 uint8_t type == 31;
2657 uint16_t length;
2658 uint32_t xid;
2659 uint32_t role;
2660 enum ofp_table_reason reason;
2661 pad(7);
2662 of_table_desc_t table;
2663};
2664
2665/* Request forward message */
2666
2667struct of_requestforward : of_header {
2668 uint8_t version;
2669 uint8_t type == 32;
2670 uint16_t length;
2671 uint32_t xid;
2672 uint32_t role;
2673 // TODO support embedding of_header
2674 of_octets_t data;
alshabib9f50e482014-08-23 17:10:57 -05002675};