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