blob: 0e403fd05117cac13179f55b35c5494e81dd62a6 [file] [log] [blame]
Khen Nursimuluaaac7ee2016-12-11 22:03:52 -05001/* Copyright (c) 2008 The Board of Trustees of The Leland Stanford
2 * Junior University
3 * Copyright (c) 2011, 2012 Open Networking Foundation
4 *
5 * We are making the OpenFlow specification and associated documentation
6 * (Software) available for public use and benefit with the expectation
7 * that others will use, modify and enhance the Software and contribute
8 * those enhancements back to the community. However, since we would
9 * like to make the Software available for broadest use, with as few
10 * restrictions as possible permission is hereby granted, free of
11 * charge, to any person obtaining a copy of this Software to deal in
12 * the Software under the copyrights without restriction, including
13 * without limitation the rights to use, copy, modify, merge, publish,
14 * distribute, sublicense, and/or sell copies of the Software, and to
15 * permit persons to whom the Software is furnished to do so, subject to
16 * the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be
19 * included in all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
25 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
26 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
27 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28 * SOFTWARE.
29 *
30 * The name and trademarks of copyright holder(s) may NOT be used in
31 * advertising or publicity pertaining to the Software or any
32 * derivatives without specific, written prior permission.
33 */
34
35/* OpenFlow: protocol between controller and datapath. */
36
37/*
38 * This is a relatively straightforward rendering of OpenFlow message
39 * definitions into protocol buffer messages. We preserved the snake
40 * case syntax, and made the following changes:
41 * - all pad fields dropped
42 * - for each enum value above 0x7fffffff the MSB is dropped. For example,
43 * 0xffffffff is now 0x7fffffff.
44 * - '<type> thing[...]' is replaced with 'repeated <type> thing'
45 * - 'char thing[...]' is replaced with 'string thing'
46 * - 'uint8_t data[...]' is replaced with 'bytes data'
47 * - the following systematic changes are done to various integer types:
48 * uint8_t -> uint32
49 * uint16_t -> uint32
50 * uint32_t -> uint32
51 * uint64_t -> uint64
52 * - removed most length, len, size fields where these values can be determined
53 * from the explicitly encoded length of "repeated" protobuf fields.
54 * - explicit use of enum types whereever it is unambigous (and not used as
55 * bitmask/flags value.
56 *
57 */
58syntax = "proto3";
59
60package openflow_13;
61
62
63/* Version number:
64 * OpenFlow versions released: 0x01 = 1.0 ; 0x02 = 1.1 ; 0x03 = 1.2
65 * 0x04 = 1.3
66 */
67/* The most significant bit in the version field is reserved and must
68 * be set to zero.
69 */
70//#define OFP_VERSION 0x04
71//#define PIPELINE_TABLES 64
72//#define OFP_MAX_TABLE_NAME_LEN 32
73//#define OFP_MAX_PORT_NAME_LEN 16
74/* Official IANA registered port for OpenFlow. */
75//#define OFP_TCP_PORT 6653
76//#define OFP_SSL_PORT 6653
77
78//#define OFP_ETH_ALEN 6 /* Bytes in an Ethernet address. */
79
80/* Port numbering. Ports are numbered starting from 1. */
81enum ofp_port_no {
82 OFPP_INVALID = 0;
83
84 /* Maximum number of physical and logical switch ports. */
85 OFPP_MAX = 0x7fffff00;
86
87 /* Reserved OpenFlow Port (fake output "ports"). */
88 OFPP_IN_PORT = 0x7ffffff8; /* Send the packet out the input port. This
89 reserved port must be explicitly used
90 in order to send back out of the input
91 port. */
92 OFPP_TABLE = 0x7ffffff9; /* Submit the packet to the first flow table
93 NB: This destination port can only be
94 used in packet-out messages. */
95 OFPP_NORMAL = 0x7ffffffa; /* Forward using non-OpenFlow pipeline. */
96 OFPP_FLOOD = 0x7ffffffb; /* Flood using non-OpenFlow pipeline. */
97 OFPP_ALL = 0x7ffffffc; /* All standard ports except input port. */
98 OFPP_CONTROLLER = 0x7ffffffd; /* Send to controller. */
99 OFPP_LOCAL = 0x7ffffffe; /* Local openflow "port". */
100 OFPP_ANY = 0x7fffffff; /* Special value used in some requests when
101 no port is specified (i.e. wildcarded).*/
102};
103
104enum ofp_type {
105
106 /* Immutable messages. */
107 OFPT_HELLO = 0; /* Symmetric message */
108 OFPT_ERROR = 1; /* Symmetric message */
109 OFPT_ECHO_REQUEST = 2; /* Symmetric message */
110 OFPT_ECHO_REPLY = 3; /* Symmetric message */
111 OFPT_EXPERIMENTER = 4; /* Symmetric message */
112
113 /* Switch configuration messages. */
114 OFPT_FEATURES_REQUEST = 5; /* Controller/switch message */
115 OFPT_FEATURES_REPLY = 6; /* Controller/switch message */
116 OFPT_GET_CONFIG_REQUEST = 7; /* Controller/switch message */
117 OFPT_GET_CONFIG_REPLY = 8; /* Controller/switch message */
118 OFPT_SET_CONFIG = 9; /* Controller/switch message */
119
120 /* Asynchronous messages. */
121 OFPT_PACKET_IN = 10; /* Async message */
122 OFPT_FLOW_REMOVED = 11; /* Async message */
123 OFPT_PORT_STATUS = 12; /* Async message */
124
125 /* Controller command messages. */
126 OFPT_PACKET_OUT = 13; /* Controller/switch message */
127 OFPT_FLOW_MOD = 14; /* Controller/switch message */
128 OFPT_GROUP_MOD = 15; /* Controller/switch message */
129 OFPT_PORT_MOD = 16; /* Controller/switch message */
130 OFPT_TABLE_MOD = 17; /* Controller/switch message */
131
132 /* Multipart messages. */
133 OFPT_MULTIPART_REQUEST = 18; /* Controller/switch message */
134 OFPT_MULTIPART_REPLY = 19; /* Controller/switch message */
135
136 /* Barrier messages. */
137 OFPT_BARRIER_REQUEST = 20; /* Controller/switch message */
138 OFPT_BARRIER_REPLY = 21; /* Controller/switch message */
139
140 /* Queue Configuration messages. */
141 OFPT_QUEUE_GET_CONFIG_REQUEST = 22; /* Controller/switch message */
142 OFPT_QUEUE_GET_CONFIG_REPLY = 23; /* Controller/switch message */
143
144 /* Controller role change request messages. */
145 OFPT_ROLE_REQUEST = 24; /* Controller/switch message */
146 OFPT_ROLE_REPLY = 25; /* Controller/switch message */
147
148 /* Asynchronous message configuration. */
149 OFPT_GET_ASYNC_REQUEST = 26; /* Controller/switch message */
150 OFPT_GET_ASYNC_REPLY = 27; /* Controller/switch message */
151 OFPT_SET_ASYNC = 28; /* Controller/switch message */
152
153 /* Meters and rate limiters configuration messages. */
154 OFPT_METER_MOD = 29; /* Controller/switch message */
155};
156
157/* Header on all OpenFlow packets. */
158message ofp_header {
159 uint32 version = 1; /* OFP_VERSION. */
160 ofp_type type = 2; /* One of the OFPT_ constants. */
161 uint32 xid = 3; /* Transaction id associated with this packet.
162 Replies use the same id as was in the request
163 to facilitate pairing. */
164};
165
166/* Hello elements types.
167 */
168enum ofp_hello_elem_type {
169 OFPHET_INVALID = 0;
170 OFPHET_VERSIONBITMAP = 1; /* Bitmap of version supported. */
171};
172
173/* Common header for all Hello Elements */
174message ofp_hello_elem_header {
175 ofp_hello_elem_type type = 1; /* One of OFPHET_*. */
176 oneof element {
177 ofp_hello_elem_versionbitmap versionbitmap = 2;
178 }
179};
180
181/* Version bitmap Hello Element */
182message ofp_hello_elem_versionbitmap {
183 repeated uint32 bitmaps = 2; /* List of bitmaps - supported versions */
184};
185
186/* OFPT_HELLO. This message includes zero or more hello elements having
187 * variable size. Unknown elements types must be ignored/skipped, to allow
188 * for future extensions. */
189message ofp_hello {
190 //ofp_header header;
191 /* Hello element list */
192 repeated ofp_hello_elem_header elements = 1; /* 0 or more */
193};
194
195//#define OFP_DEFAULT_MISS_SEND_LEN 128
196
197enum ofp_config_flags {
198 /* Handling of IP fragments. */
199 OFPC_FRAG_NORMAL = 0; /* No special handling for fragments. */
200 OFPC_FRAG_DROP = 1; /* Drop fragments. */
201 OFPC_FRAG_REASM = 2; /* Reassemble (only if OFPC_IP_REASM set). */
202 OFPC_FRAG_MASK = 3; /* Bitmask of flags dealing with frag. */
203};
204
205/* Switch configuration. */
206message ofp_switch_config {
207 //ofp_header header;
208 uint32 flags = 1; /* Bitmap of OFPC_* flags. */
209 uint32 miss_send_len = 2; /* Max bytes of packet that datapath
210 should send to the controller. See
211 ofp_controller_max_len for valid values.
212 */
213};
214
215/* Flags to configure the table. Reserved for future use. */
216enum ofp_table_config {
217 OFPTC_INVALID = 0;
218 OFPTC_DEPRECATED_MASK = 3; /* Deprecated bits */
219};
220
221/* Table numbering. Tables can use any number up to OFPT_MAX. */
222enum ofp_table {
223
224 OFPTT_INVALID = 0;
225
226 /* Last usable table number. */
227 OFPTT_MAX = 0xfe;
228
229 /* Fake tables. */
230 OFPTT_ALL = 0xff; /* Wildcard table used for table config,
231 flow stats and flow deletes. */
232};
233
234
235/* Configure/Modify behavior of a flow table */
236message ofp_table_mod {
237 //ofp_header header;
238 uint32 table_id = 1; /* ID of the table, OFPTT_ALL indicates all tables */
239 uint32 config = 2; /* Bitmap of OFPTC_* flags */
240};
241
242/* Capabilities supported by the datapath. */
243enum ofp_capabilities {
244 OFPC_INVALID = 0;
245 OFPC_FLOW_STATS = 1; /* Flow statistics. */
246 OFPC_TABLE_STATS = 2; /* Table statistics. */
247 OFPC_PORT_STATS = 4; /* Port statistics. */
248 OFPC_GROUP_STATS = 8; /* Group statistics. */
249 OFPC_IP_REASM = 32; /* Can reassemble IP fragments. */
250 OFPC_QUEUE_STATS = 64; /* Queue statistics. */
251 OFPC_PORT_BLOCKED = 256; /* Switch will block looping ports. */
252};
253
254/* Flags to indicate behavior of the physical port. These flags are
255 * used in ofp_port to describe the current configuration. They are
256 * used in the ofp_port_mod message to configure the port's behavior.
257 */
258enum ofp_port_config {
259 OFPPC_INVALID = 0;
260 OFPPC_PORT_DOWN = 1; /* Port is administratively down. */
261
262 OFPPC_NO_RECV = 4; /* Drop all packets received by port. */
263 OFPPC_NO_FWD = 32; /* Drop packets forwarded to port. */
264 OFPPC_NO_PACKET_IN = 64; /* Do not send packet-in msgs for port. */
265};
266
267/* Current state of the physical port. These are not configurable from
268 * the controller.
269 */
270enum ofp_port_state {
271 OFPPS_INVALID = 0;
272 OFPPS_LINK_DOWN = 1; /* No physical link present. */
273 OFPPS_BLOCKED = 2; /* Port is blocked */
274 OFPPS_LIVE = 4; /* Live for Fast Failover Group. */
275};
276
277/* Features of ports available in a datapath. */
278enum ofp_port_features {
279 OFPPF_INVALID = 0;
280 OFPPF_10MB_HD = 1; /* 10 Mb half-duplex rate support. */
281 OFPPF_10MB_FD = 2; /* 10 Mb full-duplex rate support. */
282 OFPPF_100MB_HD = 4; /* 100 Mb half-duplex rate support. */
283 OFPPF_100MB_FD = 8; /* 100 Mb full-duplex rate support. */
284 OFPPF_1GB_HD = 16; /* 1 Gb half-duplex rate support. */
285 OFPPF_1GB_FD = 32; /* 1 Gb full-duplex rate support. */
286 OFPPF_10GB_FD = 64; /* 10 Gb full-duplex rate support. */
287 OFPPF_40GB_FD = 128; /* 40 Gb full-duplex rate support. */
288 OFPPF_100GB_FD = 256; /* 100 Gb full-duplex rate support. */
289 OFPPF_1TB_FD = 512; /* 1 Tb full-duplex rate support. */
290 OFPPF_OTHER = 1024; /* Other rate, not in the list. */
291 OFPPF_COPPER = 2048; /* Copper medium. */
292 OFPPF_FIBER = 4096; /* Fiber medium. */
293 OFPPF_AUTONEG = 8192; /* Auto-negotiation. */
294 OFPPF_PAUSE = 16384; /* Pause. */
295 OFPPF_PAUSE_ASYM = 32768; /* Asymmetric pause. */
296};
297
298/* Description of a port */
299message ofp_port {
300 uint32 port_no = 1;
301 repeated uint32 hw_addr = 2; // [OFP_ETH_ALEN];
302 string name = 3; /* Null-terminated */
303
304 uint32 config = 4; /* Bitmap of OFPPC_* flags. */
305 uint32 state = 5; /* Bitmap of OFPPS_* flags. */
306
307 /* Bitmaps of OFPPF_* that describe features. All bits zeroed if
308 * unsupported or unavailable. */
309 uint32 curr = 6; /* Current features. */
310 uint32 advertised = 7; /* Features being advertised by the port. */
311 uint32 supported = 8; /* Features supported by the port. */
312 uint32 peer = 9; /* Features advertised by peer. */
313 uint32 curr_speed = 10; /* Current port bitrate in kbps. */
314 uint32 max_speed = 11; /* Max port bitrate in kbps */
315};
316
317/* Switch features. */
318message ofp_switch_features {
319 //ofp_header header;
320 uint64 datapath_id = 1; /* Datapath unique ID. The lower 48-bits are for
321 a MAC address, while the upper 16-bits are
322 implementer-defined. */
323
324 uint32 n_buffers = 2; /* Max packets buffered at once. */
325
326 uint32 n_tables = 3; /* Number of tables supported by datapath. */
327 uint32 auxiliary_id = 4; /* Identify auxiliary connections */
328
329 /* Features. */
330 uint32 capabilities = 5; /* Bitmap of support "ofp_capabilities". */
331};
332
333/* What changed about the physical port */
334enum ofp_port_reason {
335 OFPPR_ADD = 0; /* The port was added. */
336 OFPPR_DELETE = 1; /* The port was removed. */
337 OFPPR_MODIFY = 2; /* Some attribute of the port has changed. */
338};
339
340/* A physical port has changed in the datapath */
341message ofp_port_status {
342 //ofp_header header;
343 ofp_port_reason reason = 1; /* One of OFPPR_*. */
344 ofp_port desc = 2;
345};
346
347/* Modify behavior of the physical port */
348message ofp_port_mod {
349 //ofp_header header;
350 uint32 port_no = 1;
351 repeated uint32 hw_addr = 2; //[OFP_ETH_ALEN];
352 /* The hardware address is not
353 configurable. This is used to
354 sanity-check the request, so it must
355 be the same as returned in an
356 ofp_port struct. */
357 uint32 config = 3; /* Bitmap of OFPPC_* flags. */
358 uint32 mask = 4; /* Bitmap of OFPPC_* flags to be changed. */
359
360 uint32 advertise = 5; /* Bitmap of OFPPF_*. Zero all bits to prevent
361 any action taking place. */
362};
363
364/* ## -------------------------- ## */
365/* ## OpenFlow Extensible Match. ## */
366/* ## -------------------------- ## */
367
368/* The match type indicates the match structure (set of fields that compose the
369 * match) in use. The match type is placed in the type field at the beginning
370 * of all match structures. The "OpenFlow Extensible Match" type corresponds
371 * to OXM TLV format described below and must be supported by all OpenFlow
372 * switches. Extensions that define other match types may be published on the
373 * ONF wiki. Support for extensions is optional.
374 */
375enum ofp_match_type {
376 OFPMT_STANDARD = 0; /* Deprecated. */
377 OFPMT_OXM = 1; /* OpenFlow Extensible Match */
378};
379
380/* Fields to match against flows */
381message ofp_match {
382 ofp_match_type type = 1; /* One of OFPMT_* */
383 repeated ofp_oxm_field oxm_fields = 2; /* 0 or more */
384};
385
386/* Components of a OXM TLV header.
387 * Those macros are not valid for the experimenter class, macros for the
388 * experimenter class will depend on the experimenter header used. */
389//#define OXM_HEADER__(CLASS, FIELD, HASMASK, LENGTH) \
390// (((CLASS) << 16) | ((FIELD) << 9) | ((HASMASK) << 8) | (LENGTH))
391//#define OXM_HEADER(CLASS, FIELD, LENGTH) \
392// OXM_HEADER__(CLASS, FIELD, 0, LENGTH)
393//#define OXM_HEADER_W(CLASS, FIELD, LENGTH) \
394// OXM_HEADER__(CLASS, FIELD, 1, (LENGTH) * 2)
395//#define OXM_CLASS(HEADER) ((HEADER) >> 16)
396//#define OXM_FIELD(HEADER) (((HEADER) >> 9) & 0x7f)
397//#define OXM_TYPE(HEADER) (((HEADER) >> 9) & 0x7fffff)
398//#define OXM_HASMASK(HEADER) (((HEADER) >> 8) & 1)
399//#define OXM_LENGTH(HEADER) ((HEADER) & 0xff)
400//
401//#define OXM_MAKE_WILD_HEADER(HEADER) \
402// OXM_HEADER_W(OXM_CLASS(HEADER), OXM_FIELD(HEADER), OXM_LENGTH(HEADER))
403
404/* OXM Class IDs.
405 * The high order bit differentiate reserved classes from member classes.
406 * Classes 0x0000 to 0x7FFF are member classes, allocated by ONF.
407 * Classes 0x8000 to 0xFFFE are reserved classes, reserved for standardisation.
408 */
409enum ofp_oxm_class {
410 OFPXMC_NXM_0 = 0x0000; /* Backward compatibility with NXM */
411 OFPXMC_NXM_1 = 0x0001; /* Backward compatibility with NXM */
412 OFPXMC_OPENFLOW_BASIC = 0x8000; /* Basic class for OpenFlow */
413 OFPXMC_EXPERIMENTER = 0xFFFF; /* Experimenter class */
414};
415
416/* OXM Flow field types for OpenFlow basic class. */
417enum oxm_ofb_field_types {
418 OFPXMT_OFB_IN_PORT = 0; /* Switch input port. */
419 OFPXMT_OFB_IN_PHY_PORT = 1; /* Switch physical input port. */
420 OFPXMT_OFB_METADATA = 2; /* Metadata passed between tables. */
421 OFPXMT_OFB_ETH_DST = 3; /* Ethernet destination address. */
422 OFPXMT_OFB_ETH_SRC = 4; /* Ethernet source address. */
423 OFPXMT_OFB_ETH_TYPE = 5; /* Ethernet frame type. */
424 OFPXMT_OFB_VLAN_VID = 6; /* VLAN id. */
425 OFPXMT_OFB_VLAN_PCP = 7; /* VLAN priority. */
426 OFPXMT_OFB_IP_DSCP = 8; /* IP DSCP (6 bits in ToS field). */
427 OFPXMT_OFB_IP_ECN = 9; /* IP ECN (2 bits in ToS field). */
428 OFPXMT_OFB_IP_PROTO = 10; /* IP protocol. */
429 OFPXMT_OFB_IPV4_SRC = 11; /* IPv4 source address. */
430 OFPXMT_OFB_IPV4_DST = 12; /* IPv4 destination address. */
431 OFPXMT_OFB_TCP_SRC = 13; /* TCP source port. */
432 OFPXMT_OFB_TCP_DST = 14; /* TCP destination port. */
433 OFPXMT_OFB_UDP_SRC = 15; /* UDP source port. */
434 OFPXMT_OFB_UDP_DST = 16; /* UDP destination port. */
435 OFPXMT_OFB_SCTP_SRC = 17; /* SCTP source port. */
436 OFPXMT_OFB_SCTP_DST = 18; /* SCTP destination port. */
437 OFPXMT_OFB_ICMPV4_TYPE = 19; /* ICMP type. */
438 OFPXMT_OFB_ICMPV4_CODE = 20; /* ICMP code. */
439 OFPXMT_OFB_ARP_OP = 21; /* ARP opcode. */
440 OFPXMT_OFB_ARP_SPA = 22; /* ARP source IPv4 address. */
441 OFPXMT_OFB_ARP_TPA = 23; /* ARP target IPv4 address. */
442 OFPXMT_OFB_ARP_SHA = 24; /* ARP source hardware address. */
443 OFPXMT_OFB_ARP_THA = 25; /* ARP target hardware address. */
444 OFPXMT_OFB_IPV6_SRC = 26; /* IPv6 source address. */
445 OFPXMT_OFB_IPV6_DST = 27; /* IPv6 destination address. */
446 OFPXMT_OFB_IPV6_FLABEL = 28; /* IPv6 Flow Label */
447 OFPXMT_OFB_ICMPV6_TYPE = 29; /* ICMPv6 type. */
448 OFPXMT_OFB_ICMPV6_CODE = 30; /* ICMPv6 code. */
449 OFPXMT_OFB_IPV6_ND_TARGET = 31; /* Target address for ND. */
450 OFPXMT_OFB_IPV6_ND_SLL = 32; /* Source link-layer for ND. */
451 OFPXMT_OFB_IPV6_ND_TLL = 33; /* Target link-layer for ND. */
452 OFPXMT_OFB_MPLS_LABEL = 34; /* MPLS label. */
453 OFPXMT_OFB_MPLS_TC = 35; /* MPLS TC. */
454 OFPXMT_OFB_MPLS_BOS = 36; /* MPLS BoS bit. */
455 OFPXMT_OFB_PBB_ISID = 37; /* PBB I-SID. */
456 OFPXMT_OFB_TUNNEL_ID = 38; /* Logical Port Metadata. */
457 OFPXMT_OFB_IPV6_EXTHDR = 39; /* IPv6 Extension Header pseudo-field */
458};
459
460/* OXM Flow match fields */
461message ofp_oxm_field {
462 ofp_oxm_class oxm_class = 1;
463 oneof field {
464 /* 2 and 3 reserved for NXM_0 and NXM-1 OXM classes */
465 ofp_oxm_ofb_field ofb_field = 4;
466 ofp_oxm_experimenter_field experimenter_field = 5;
467 }
468}
469
470/* OXM OpenFlow Basic Match Field */
471message ofp_oxm_ofb_field {
472 oxm_ofb_field_types type = 1;
473 bool has_mask = 2;
474 oneof value {
475
476 /* OpenFlow port on which the packet was received.
477 * May be a physical port, a logical port, or the reserved port OFPP_LOCAL
478 *
479 * Prereqs: None.
480 *
481 * Format: 32-bit integer in network byte order.
482 *
483 * Masking: Not maskable. */
484 //#define OXM_OF_IN_PORT OXM_HEADER (0x8000, OFPXMT_OFB_IN_PORT, 4)
485 uint32 port = 3; /* Used for OFPXMT_OFB_IN_PORT */
486
487 /* Physical port on which the packet was received.
488 *
489 * Consider a packet received on a tunnel interface defined over a link
490 * aggregation group (LAG) with two physical port members. If the tunnel
491 * interface is the logical port bound to OpenFlow. In this case,
492 * OFPXMT_OF_IN_PORT is the tunnel's port number and OFPXMT_OF_IN_PHY_PORT is
493 * the physical port number of the LAG on which the tunnel is configured.
494 *
495 * When a packet is received directly on a physical port and not processed by a
496 * logical port, OFPXMT_OF_IN_PORT and OFPXMT_OF_IN_PHY_PORT have the same
497 * value.
498 *
499 * This field is usually not available in a regular match and only available
500 * in ofp_packet_in messages when it's different from OXM_OF_IN_PORT.
501 *
502 * Prereqs: OXM_OF_IN_PORT must be present.
503 *
504 * Format: 32-bit integer in network byte order.
505 *
506 * Masking: Not maskable. */
507 //#define OXM_OF_IN_PHY_PORT OXM_HEADER (0x8000, OFPXMT_OFB_IN_PHY_PORT, 4)
508 uint32 physical_port = 4; /* Used for OFPXMT_OF_IN_PHY_PORT */
509
510 /* Table metadata.
511 *
512 * Prereqs: None.
513 *
514 * Format: 64-bit integer in network byte order.
515 *
516 * Masking: Arbitrary masks.
517 */
518 //#define OXM_OF_METADATA OXM_HEADER (0x8000, OFPXMT_OFB_METADATA, 8)
519 //#define OXM_OF_METADATA_W OXM_HEADER_W(0x8000, OFPXMT_OFB_METADATA, 8)
520 uint64 table_metadata = 5; /* Used for OFPXMT_OFB_METADATA */
521
522 /* Source or destination address in Ethernet header.
523 *
524 * Prereqs: None.
525 *
526 * Format: 48-bit Ethernet MAC address.
527 *
528 * Masking: Arbitrary masks. */
529 //#define OXM_OF_ETH_DST OXM_HEADER (0x8000, OFPXMT_OFB_ETH_DST, 6)
530 //#define OXM_OF_ETH_DST_W OXM_HEADER_W(0x8000, OFPXMT_OFB_ETH_DST, 6)
531 //#define OXM_OF_ETH_SRC OXM_HEADER (0x8000, OFPXMT_OFB_ETH_SRC, 6)
532 //#define OXM_OF_ETH_SRC_W OXM_HEADER_W(0x8000, OFPXMT_OFB_ETH_SRC, 6)
533 bytes eth_dst = 6; /* Used for OFPXMT_OFB_ETH_DST (exactly 6 bytes) */
534 bytes eth_src = 7; /* Used for OFPXMT_OFB_ETH_SRC (exactly 6 bytes) */
535
536 /* Packet's Ethernet type.
537 *
538 * Prereqs: None.
539 *
540 * Format: 16-bit integer in network byte order.
541 *
542 * Masking: Not maskable. */
543 //#define OXM_OF_ETH_TYPE OXM_HEADER (0x8000, OFPXMT_OFB_ETH_TYPE,2)
544 uint32 eth_type = 8; /* Used for OFPXMT_OFB_ETH_TYPE */
545
546 /* 802.1Q VID.
547 *
548 * For a packet with an 802.1Q header, this is the VLAN-ID (VID) from the
549 * outermost tag, with the CFI bit forced to 1. For a packet with no 802.1Q
550 * header, this has value OFPVID_NONE.
551 *
552 * Prereqs: None.
553 *
554 * Format: 16-bit integer in network byte order with bit 13 indicating
555 * presence of VLAN header and 3 most-significant bits forced to 0.
556 * Only the lower 13 bits have meaning.
557 *
558 * Masking: Arbitrary masks.
559 *
560 * This field can be used in various ways:
561 *
562 * - If it is not constrained at all, the nx_match matches packets without
563 * an 802.1Q header or with an 802.1Q header that has any VID value.
564 *
565 * - Testing for an exact match with 0x0 matches only packets without
566 * an 802.1Q header.
567 *
568 * - Testing for an exact match with a VID value with CFI=1 matches packets
569 * that have an 802.1Q header with a specified VID.
570 *
571 * - Testing for an exact match with a nonzero VID value with CFI=0 does
572 * not make sense. The switch may reject this combination.
573 *
574 * - Testing with nxm_value=0, nxm_mask=0x0fff matches packets with no 802.1Q
575 * header or with an 802.1Q header with a VID of 0.
576 *
577 * - Testing with nxm_value=0x1000, nxm_mask=0x1000 matches packets with
578 * an 802.1Q header that has any VID value.
579 */
580 //#define OXM_OF_VLAN_VID OXM_HEADER (0x8000, OFPXMT_OFB_VLAN_VID, 2)
581 //#define OXM_OF_VLAN_VID_W OXM_HEADER_W(0x8000, OFPXMT_OFB_VLAN_VID, 2)
582 uint32 vlan_vid = 9; /* Used for OFPXMT_OFB_VLAN_VID */
583
584 /* 802.1Q PCP.
585 *
586 * For a packet with an 802.1Q header, this is the VLAN-PCP from the
587 * outermost tag. For a packet with no 802.1Q header, this has value
588 * 0.
589 *
590 * Prereqs: OXM_OF_VLAN_VID must be different from OFPVID_NONE.
591 *
592 * Format: 8-bit integer with 5 most-significant bits forced to 0.
593 * Only the lower 3 bits have meaning.
594 *
595 * Masking: Not maskable.
596 */
597 //#define OXM_OF_VLAN_PCP OXM_HEADER (0x8000, OFPXMT_OFB_VLAN_PCP, 1)
598 uint32 vlan_pcp = 10; /* Used for OFPXMT_OFB_VLAN_PCP */
599
600 /* The Diff Serv Code Point (DSCP) bits of the IP header.
601 * Part of the IPv4 ToS field or the IPv6 Traffic Class field.
602 *
603 * Prereqs: OXM_OF_ETH_TYPE must be either 0x0800 or 0x86dd.
604 *
605 * Format: 8-bit integer with 2 most-significant bits forced to 0.
606 * Only the lower 6 bits have meaning.
607 *
608 * Masking: Not maskable. */
609 //#define OXM_OF_IP_DSCP OXM_HEADER (0x8000, OFPXMT_OFB_IP_DSCP, 1)
610 uint32 ip_dscp = 11; /* Used for OFPXMT_OFB_IP_DSCP */
611
612 /* The ECN bits of the IP header.
613 * Part of the IPv4 ToS field or the IPv6 Traffic Class field.
614 *
615 * Prereqs: OXM_OF_ETH_TYPE must be either 0x0800 or 0x86dd.
616 *
617 * Format: 8-bit integer with 6 most-significant bits forced to 0.
618 * Only the lower 2 bits have meaning.
619 *
620 * Masking: Not maskable. */
621 //#define OXM_OF_IP_ECN OXM_HEADER (0x8000, OFPXMT_OFB_IP_ECN, 1)
622 uint32 ip_ecn = 12; /* Used for OFPXMT_OFB_IP_ECN */
623
624 /* The "protocol" byte in the IP header.
625 *
626 * Prereqs: OXM_OF_ETH_TYPE must be either 0x0800 or 0x86dd.
627 *
628 * Format: 8-bit integer.
629 *
630 * Masking: Not maskable. */
631 //#define OXM_OF_IP_PROTO OXM_HEADER (0x8000, OFPXMT_OFB_IP_PROTO, 1)
632 uint32 ip_proto = 13; /* Used for OFPXMT_OFB_IP_PROTO */
633
634 /* The source or destination address in the IP header.
635 *
636 * Prereqs: OXM_OF_ETH_TYPE must match 0x0800 exactly.
637 *
638 * Format: 32-bit integer in network byte order.
639 *
640 * Masking: Arbitrary masks.
641 */
642 //#define OXM_OF_IPV4_SRC OXM_HEADER (0x8000, OFPXMT_OFB_IPV4_SRC, 4)
643 //#define OXM_OF_IPV4_SRC_W OXM_HEADER_W(0x8000, OFPXMT_OFB_IPV4_SRC, 4)
644 //#define OXM_OF_IPV4_DST OXM_HEADER (0x8000, OFPXMT_OFB_IPV4_DST, 4)
645 //#define OXM_OF_IPV4_DST_W OXM_HEADER_W(0x8000, OFPXMT_OFB_IPV4_DST, 4)
646 uint32 ipv4_src = 14; /* Used for OFPXMT_OFB_IPV4_SRC */
647 uint32 ipv4_dst = 15; /* Used for OFPXMT_OFB_IPV4_DST */
648
649 /* The source or destination port in the TCP header.
650 *
651 * Prereqs:
652 * OXM_OF_ETH_TYPE must be either 0x0800 or 0x86dd.
653 * OXM_OF_IP_PROTO must match 6 exactly.
654 *
655 * Format: 16-bit integer in network byte order.
656 *
657 * Masking: Not maskable. */
658 //#define OXM_OF_TCP_SRC OXM_HEADER (0x8000, OFPXMT_OFB_TCP_SRC, 2)
659 //#define OXM_OF_TCP_DST OXM_HEADER (0x8000, OFPXMT_OFB_TCP_DST, 2)
660 uint32 tcp_src = 16; /* Used for OFPXMT_OFB_TCP_SRC */
661 uint32 tcp_dst = 17; /* Used for OFPXMT_OFB_TCP_DST */
662
663 /* The source or destination port in the UDP header.
664 *
665 * Prereqs:
666 * OXM_OF_ETH_TYPE must match either 0x0800 or 0x86dd.
667 * OXM_OF_IP_PROTO must match 17 exactly.
668 *
669 * Format: 16-bit integer in network byte order.
670 *
671 * Masking: Not maskable. */
672 //#define OXM_OF_UDP_SRC OXM_HEADER (0x8000, OFPXMT_OFB_UDP_SRC, 2)
673 //#define OXM_OF_UDP_DST OXM_HEADER (0x8000, OFPXMT_OFB_UDP_DST, 2)
674 uint32 udp_src = 18; /* Used for OFPXMT_OFB_UDP_SRC */
675 uint32 udp_dst = 19; /* Used for OFPXMT_OFB_UDP_DST */
676
677 /* The source or destination port in the SCTP header.
678 *
679 * Prereqs:
680 * OXM_OF_ETH_TYPE must match either 0x0800 or 0x86dd.
681 * OXM_OF_IP_PROTO must match 132 exactly.
682 *
683 * Format: 16-bit integer in network byte order.
684 *
685 * Masking: Not maskable. */
686 //#define OXM_OF_SCTP_SRC OXM_HEADER (0x8000, OFPXMT_OFB_SCTP_SRC, 2)
687 //#define OXM_OF_SCTP_DST OXM_HEADER (0x8000, OFPXMT_OFB_SCTP_DST, 2)
688 uint32 sctp_src = 20; /* Used for OFPXMT_OFB_SCTP_SRC */
689 uint32 sctp_dst = 21; /* Used for OFPXMT_OFB_SCTP_DST */
690
691 /* The type or code in the ICMP header.
692 *
693 * Prereqs:
694 * OXM_OF_ETH_TYPE must match 0x0800 exactly.
695 * OXM_OF_IP_PROTO must match 1 exactly.
696 *
697 * Format: 8-bit integer.
698 *
699 * Masking: Not maskable. */
700 //#define OXM_OF_ICMPV4_TYPE OXM_HEADER (0x8000, OFPXMT_OFB_ICMPV4_TYPE, 1)
701 //#define OXM_OF_ICMPV4_CODE OXM_HEADER (0x8000, OFPXMT_OFB_ICMPV4_CODE, 1)
702 uint32 icmpv4_type = 22; /* Used for OFPXMT_OFB_ICMPV4_TYPE */
703 uint32 icmpv4_code = 23; /* Used for OFPXMT_OFB_ICMPV4_CODE */
704
705 /* ARP opcode.
706 *
707 * For an Ethernet+IP ARP packet, the opcode in the ARP header. Always 0
708 * otherwise.
709 *
710 * Prereqs: OXM_OF_ETH_TYPE must match 0x0806 exactly.
711 *
712 * Format: 16-bit integer in network byte order.
713 *
714 * Masking: Not maskable. */
715 //#define OXM_OF_ARP_OP OXM_HEADER (0x8000, OFPXMT_OFB_ARP_OP, 2)
716 uint32 arp_op = 24; /* Used for OFPXMT_OFB_ARP_OP */
717
718 /* For an Ethernet+IP ARP packet, the source or target protocol address
719 * in the ARP header. Always 0 otherwise.
720 *
721 * Prereqs: OXM_OF_ETH_TYPE must match 0x0806 exactly.
722 *
723 * Format: 32-bit integer in network byte order.
724 *
725 * Masking: Arbitrary masks.
726 */
727 //#define OXM_OF_ARP_SPA OXM_HEADER (0x8000, OFPXMT_OFB_ARP_SPA, 4)
728 //#define OXM_OF_ARP_SPA_W OXM_HEADER_W(0x8000, OFPXMT_OFB_ARP_SPA, 4)
729 //#define OXM_OF_ARP_TPA OXM_HEADER (0x8000, OFPXMT_OFB_ARP_TPA, 4)
730 //#define OXM_OF_ARP_TPA_W OXM_HEADER_W(0x8000, OFPXMT_OFB_ARP_TPA, 4)
731 uint32 arp_spa = 25; /* For OFPXMT_OFB_ARP_SPA */
732 uint32 arp_tpa = 26; /* For OFPXMT_OFB_ARP_TPA */
733
734 /* For an Ethernet+IP ARP packet, the source or target hardware address
735 * in the ARP header. Always 0 otherwise.
736 *
737 * Prereqs: OXM_OF_ETH_TYPE must match 0x0806 exactly.
738 *
739 * Format: 48-bit Ethernet MAC address.
740 *
741 * Masking: Not maskable. */
742 //#define OXM_OF_ARP_SHA OXM_HEADER (0x8000, OFPXMT_OFB_ARP_SHA, 6)
743 //#define OXM_OF_ARP_SHA_W OXM_HEADER_W (0x8000, OFPXMT_OFB_ARP_SHA, 6)
744 //#define OXM_OF_ARP_THA OXM_HEADER (0x8000, OFPXMT_OFB_ARP_THA, 6)
745 //#define OXM_OF_ARP_THA_W OXM_HEADER_W (0x8000, OFPXMT_OFB_ARP_THA, 6)
746 bytes arp_sha = 27; /* For OFPXMT_OFB_ARP_SHA (6 bytes) */
747 bytes arp_tha = 28; /* For OFPXMT_OFB_ARP_THA (6 bytes) */
748
749 /* The source or destination address in the IPv6 header.
750 *
751 * Prereqs: OXM_OF_ETH_TYPE must match 0x86dd exactly.
752 *
753 * Format: 128-bit IPv6 address.
754 *
755 * Masking: Arbitrary masks.
756 */
757 //#define OXM_OF_IPV6_SRC OXM_HEADER (0x8000, OFPXMT_OFB_IPV6_SRC, 16)
758 //#define OXM_OF_IPV6_SRC_W OXM_HEADER_W(0x8000, OFPXMT_OFB_IPV6_SRC, 16)
759 //#define OXM_OF_IPV6_DST OXM_HEADER (0x8000, OFPXMT_OFB_IPV6_DST, 16)
760 //#define OXM_OF_IPV6_DST_W OXM_HEADER_W(0x8000, OFPXMT_OFB_IPV6_DST, 16)
761 bytes ipv6_src = 29; /* For OFPXMT_OFB_IPV6_SRC */
762 bytes ipv6_dst = 30; /* For OFPXMT_OFB_IPV6_DST */
763
764 /* The IPv6 Flow Label
765 *
766 * Prereqs:
767 * OXM_OF_ETH_TYPE must match 0x86dd exactly
768 *
769 * Format: 32-bit integer with 12 most-significant bits forced to 0.
770 * Only the lower 20 bits have meaning.
771 *
772 * Masking: Arbitrary masks.
773 */
774 //#define OXM_OF_IPV6_FLABEL OXM_HEADER (0x8000, OFPXMT_OFB_IPV6_FLABEL, 4)
775 //#define OXM_OF_IPV6_FLABEL_W OXM_HEADER_W(0x8000, OFPXMT_OFB_IPV6_FLABEL, 4)
776 uint32 ipv6_flabel = 31; /* For OFPXMT_OFB_IPV6_FLABEL */
777
778 /* The type or code in the ICMPv6 header.
779 *
780 * Prereqs:
781 * OXM_OF_ETH_TYPE must match 0x86dd exactly.
782 * OXM_OF_IP_PROTO must match 58 exactly.
783 *
784 * Format: 8-bit integer.
785 *
786 * Masking: Not maskable. */
787 //#define OXM_OF_ICMPV6_TYPE OXM_HEADER (0x8000, OFPXMT_OFB_ICMPV6_TYPE, 1)
788 //#define OXM_OF_ICMPV6_CODE OXM_HEADER (0x8000, OFPXMT_OFB_ICMPV6_CODE, 1)
789 uint32 icmpv6_type = 32; /* For OFPXMT_OFB_ICMPV6_TYPE */
790 uint32 icmpv6_code = 33; /* For OFPXMT_OFB_ICMPV6_CODE */
791
792 /* The target address in an IPv6 Neighbor Discovery message.
793 *
794 * Prereqs:
795 * OXM_OF_ETH_TYPE must match 0x86dd exactly.
796 * OXM_OF_IP_PROTO must match 58 exactly.
797 * OXM_OF_ICMPV6_TYPE must be either 135 or 136.
798 *
799 * Format: 128-bit IPv6 address.
800 *
801 * Masking: Not maskable. */
802 //#define OXM_OF_IPV6_ND_TARGET OXM_HEADER \
803 // (0x8000, OFPXMT_OFB_IPV6_ND_TARGET, 16)
804 bytes ipv6_nd_target = 34; /* For OFPXMT_OFB_IPV6_ND_TARGET */
805
806 /* The source link-layer address option in an IPv6 Neighbor Discovery
807 * message.
808 *
809 * Prereqs:
810 * OXM_OF_ETH_TYPE must match 0x86dd exactly.
811 * OXM_OF_IP_PROTO must match 58 exactly.
812 * OXM_OF_ICMPV6_TYPE must be exactly 135.
813 *
814 * Format: 48-bit Ethernet MAC address.
815 *
816 * Masking: Not maskable. */
817 //#define OXM_OF_IPV6_ND_SLL OXM_HEADER (0x8000, OFPXMT_OFB_IPV6_ND_SLL, 6)
818 bytes ipv6_nd_ssl = 35; /* For OFPXMT_OFB_IPV6_ND_SLL */
819
820 /* The target link-layer address option in an IPv6 Neighbor Discovery
821 * message.
822 *
823 * Prereqs:
824 * OXM_OF_ETH_TYPE must match 0x86dd exactly.
825 * OXM_OF_IP_PROTO must match 58 exactly.
826 * OXM_OF_ICMPV6_TYPE must be exactly 136.
827 *
828 * Format: 48-bit Ethernet MAC address.
829 *
830 * Masking: Not maskable. */
831 //#define OXM_OF_IPV6_ND_TLL OXM_HEADER (0x8000, OFPXMT_OFB_IPV6_ND_TLL, 6)
832 bytes ipv6_nd_tll = 36; /* For OFPXMT_OFB_IPV6_ND_TLL */
833
834 /* The LABEL in the first MPLS shim header.
835 *
836 * Prereqs:
837 * OXM_OF_ETH_TYPE must match 0x8847 or 0x8848 exactly.
838 *
839 * Format: 32-bit integer in network byte order with 12 most-significant
840 * bits forced to 0. Only the lower 20 bits have meaning.
841 *
842 * Masking: Not maskable. */
843 //#define OXM_OF_MPLS_LABEL OXM_HEADER (0x8000, OFPXMT_OFB_MPLS_LABEL, 4)
844 uint32 mpls_label = 37; /* For OFPXMT_OFB_MPLS_LABEL */
845
846 /* The TC in the first MPLS shim header.
847 *
848 * Prereqs:
849 * OXM_OF_ETH_TYPE must match 0x8847 or 0x8848 exactly.
850 *
851 * Format: 8-bit integer with 5 most-significant bits forced to 0.
852 * Only the lower 3 bits have meaning.
853 *
854 * Masking: Not maskable. */
855 //#define OXM_OF_MPLS_TC OXM_HEADER (0x8000, OFPXMT_OFB_MPLS_TC, 1)
856 uint32 mpls_tc = 38; /* For OFPXMT_OFB_MPLS_TC */
857
858 /* The BoS bit in the first MPLS shim header.
859 *
860 * Prereqs:
861 * OXM_OF_ETH_TYPE must match 0x8847 or 0x8848 exactly.
862 *
863 * Format: 8-bit integer with 7 most-significant bits forced to 0.
864 * Only the lowest bit have a meaning.
865 *
866 * Masking: Not maskable. */
867 //#define OXM_OF_MPLS_BOS OXM_HEADER (0x8000, OFPXMT_OFB_MPLS_BOS, 1)
868 uint32 mpls_bos = 39; /* For OFPXMT_OFB_MPLS_BOS */
869
870 /* IEEE 802.1ah I-SID.
871 *
872 * For a packet with a PBB header, this is the I-SID from the
873 * outermost service tag.
874 *
875 * Prereqs:
876 * OXM_OF_ETH_TYPE must match 0x88E7 exactly.
877 *
878 * Format: 24-bit integer in network byte order.
879 *
880 * Masking: Arbitrary masks. */
881 //#define OXM_OF_PBB_ISID OXM_HEADER (0x8000, OFPXMT_OFB_PBB_ISID, 3)
882 //#define OXM_OF_PBB_ISID_W OXM_HEADER_W(0x8000, OFPXMT_OFB_PBB_ISID, 3)
883 uint32 pbb_isid = 40; /* For OFPXMT_OFB_PBB_ISID */
884
885 /* Logical Port Metadata.
886 *
887 * Metadata associated with a logical port.
888 * If the logical port performs encapsulation and decapsulation, this
889 * is the demultiplexing field from the encapsulation header.
890 * For example, for a packet received via GRE tunnel including a (32-bit) key,
891 * the key is stored in the low 32-bits and the high bits are zeroed.
892 * For a MPLS logical port, the low 20 bits represent the MPLS Label.
893 * For a VxLAN logical port, the low 24 bits represent the VNI.
894 * If the packet is not received through a logical port, the value is 0.
895 *
896 * Prereqs: None.
897 *
898 * Format: 64-bit integer in network byte order.
899 *
900 * Masking: Arbitrary masks. */
901 //#define OXM_OF_TUNNEL_ID OXM_HEADER (0x8000, OFPXMT_OFB_TUNNEL_ID, 8)
902 //#define OXM_OF_TUNNEL_ID_W OXM_HEADER_W(0x8000, OFPXMT_OFB_TUNNEL_ID, 8)
903 uint64 tunnel_id = 41; /* For OFPXMT_OFB_TUNNEL_ID */
904
905 /* The IPv6 Extension Header pseudo-field.
906 *
907 * Prereqs:
908 * OXM_OF_ETH_TYPE must match 0x86dd exactly
909 *
910 * Format: 16-bit integer with 7 most-significant bits forced to 0.
911 * Only the lower 9 bits have meaning.
912 *
913 * Masking: Maskable. */
914 //#define OXM_OF_IPV6_EXTHDR OXM_HEADER (0x8000, OFPXMT_OFB_IPV6_EXTHDR, 2)
915 //#define OXM_OF_IPV6_EXTHDR_W OXM_HEADER_W(0x8000, OFPXMT_OFB_IPV6_EXTHDR, 2)
916 uint32 ipv6_exthdr = 42; /* For OFPXMT_OFB_IPV6_EXTHDR */
917
918 }
919
920 /* Optional mask values (must be present when has_mask is true */
921 oneof mask {
922 uint64 table_metadata_mask = 105; /* For OFPXMT_OFB_METADATA */
923
924 bytes eth_dst_mask = 106; /* For OFPXMT_OFB_ETH_DST (exactly 6 bytes)*/
925 bytes eth_src_mask = 107; /* For OFPXMT_OFB_ETH_SRC (exactly 6 bytes)*/
926
927 uint32 vlan_vid_mask = 109; /* For OFPXMT_OFB_VLAN_VID */
928
929 uint32 ipv4_src_mask = 114; /* For OFPXMT_OFB_IPV4_SRC */
930 uint32 ipv4_dst_mask = 115; /* For OFPXMT_OFB_IPV4_DST */
931
932 uint32 arp_spa_mask = 125; /* For OFPXMT_OFB_ARP_SPA */
933 uint32 arp_tpa_mask = 126; /* For OFPXMT_OFB_ARP_TPA */
934
935 bytes ipv6_src_mask = 129; /* For OFPXMT_OFB_IPV6_SRC */
936 bytes ipv6_dst_mask = 130; /* For OFPXMT_OFB_IPV6_DST */
937
938 uint32 ipv6_flabel_mask = 131; /* For OFPXMT_OFB_IPV6_FLABEL */
939
940 uint32 pbb_isid_mask = 140; /* For OFPXMT_OFB_PBB_ISID */
941
942 uint64 tunnel_id_mask = 141; /* For OFPXMT_OFB_TUNNEL_ID */
943
944 uint32 ipv6_exthdr_mask = 142; /* For OFPXMT_OFB_IPV6_EXTHDR */
945 }
946
947}
948//#define OFPXMT_OFB_ALL ((UINT64_C(1) << 40) - 1)
949
950
951/* The VLAN id is 12-bits, so we can use the entire 16 bits to indicate
952 * special conditions.
953 */
954enum ofp_vlan_id {
955 OFPVID_NONE = 0x0000; /* No VLAN id was set. */
956 OFPVID_PRESENT = 0x1000; /* Bit that indicate that a VLAN id is set */
957};
958/* Define for compatibility */
959//#define OFP_VLAN_NONE OFPVID_NONE
960
961/* Bit definitions for IPv6 Extension Header pseudo-field. */
962enum ofp_ipv6exthdr_flags {
963 OFPIEH_INVALID = 0;
964 OFPIEH_NONEXT = 1; /* "No next header" encountered. */
965 OFPIEH_ESP = 2; /* Encrypted Sec Payload header present. */
966 OFPIEH_AUTH = 4; /* Authentication header present. */
967 OFPIEH_DEST = 8; /* 1 or 2 dest headers present. */
968 OFPIEH_FRAG = 16; /* Fragment header present. */
969 OFPIEH_ROUTER = 32; /* Router header present. */
970 OFPIEH_HOP = 64; /* Hop-by-hop header present. */
971 OFPIEH_UNREP = 128; /* Unexpected repeats encountered. */
972 OFPIEH_UNSEQ = 256; /* Unexpected sequencing encountered. */
973};
974
975/* Header for OXM experimenter match fields.
976 * The experimenter class should not use OXM_HEADER() macros for defining
977 * fields due to this extra header. */
978message ofp_oxm_experimenter_field {
979 uint32 oxm_header = 1; /* oxm_class = OFPXMC_EXPERIMENTER */
980 uint32 experimenter = 2; /* Experimenter ID which takes the same
981 form as in struct ofp_experimenter_header. */
982};
983
984/* ## ----------------- ## */
985/* ## OpenFlow Actions. ## */
986/* ## ----------------- ## */
987
988enum ofp_action_type {
989 OFPAT_OUTPUT = 0; /* Output to switch port. */
990 OFPAT_COPY_TTL_OUT = 11; /* Copy TTL "outwards" -- from next-to-outermost
991 to outermost */
992 OFPAT_COPY_TTL_IN = 12; /* Copy TTL "inwards" -- from outermost to
993 next-to-outermost */
994 OFPAT_SET_MPLS_TTL = 15; /* MPLS TTL */
995 OFPAT_DEC_MPLS_TTL = 16; /* Decrement MPLS TTL */
996
997 OFPAT_PUSH_VLAN = 17; /* Push a new VLAN tag */
998 OFPAT_POP_VLAN = 18; /* Pop the outer VLAN tag */
999 OFPAT_PUSH_MPLS = 19; /* Push a new MPLS tag */
1000 OFPAT_POP_MPLS = 20; /* Pop the outer MPLS tag */
1001 OFPAT_SET_QUEUE = 21; /* Set queue id when outputting to a port */
1002 OFPAT_GROUP = 22; /* Apply group. */
1003 OFPAT_SET_NW_TTL = 23; /* IP TTL. */
1004 OFPAT_DEC_NW_TTL = 24; /* Decrement IP TTL. */
1005 OFPAT_SET_FIELD = 25; /* Set a header field using OXM TLV format. */
1006 OFPAT_PUSH_PBB = 26; /* Push a new PBB service tag (I-TAG) */
1007 OFPAT_POP_PBB = 27; /* Pop the outer PBB service tag (I-TAG) */
1008 OFPAT_EXPERIMENTER = 0xffff;
1009};
1010
1011/* Action header that is common to all actions. The length includes the
1012 * header and any padding used to make the action 64-bit aligned.
1013 * NB: The length of an action *must* always be a multiple of eight. */
1014message ofp_action {
1015 ofp_action_type type = 1; /* One of OFPAT_*. */
1016 oneof action {
1017 ofp_action_output output = 2;
1018 ofp_action_mpls_ttl mpls_ttl = 3;
1019 ofp_action_push push = 4;
1020 ofp_action_pop_mpls pop_mpls = 5;
1021 ofp_action_group group = 6;
1022 ofp_action_nw_ttl nw_ttl = 7;
1023 ofp_action_set_field set_field = 8;
1024 ofp_action_experimenter experimenter = 9;
1025 }
1026};
1027
1028enum ofp_controller_max_len {
1029 OFPCML_INVALID = 0;
1030 OFPCML_MAX = 0xffe5; /* maximum max_len value which can be used
1031 to request a specific byte length. */
1032 OFPCML_NO_BUFFER = 0xffff; /* indicates that no buffering should be
1033 applied and the whole packet is to be
1034 sent to the controller. */
1035};
1036
1037/* Action structure for OFPAT_OUTPUT, which sends packets out 'port'.
1038 * When the 'port' is the OFPP_CONTROLLER, 'max_len' indicates the max
1039 * number of bytes to send. A 'max_len' of zero means no bytes of the
1040 * packet should be sent. A 'max_len' of OFPCML_NO_BUFFER means that
1041 * the packet is not buffered and the complete packet is to be sent to
1042 * the controller. */
1043message ofp_action_output {
1044 uint32 port = 1; /* Output port. */
1045 uint32 max_len = 2; /* Max length to send to controller. */
1046};
1047
1048/* Action structure for OFPAT_SET_MPLS_TTL. */
1049message ofp_action_mpls_ttl {
1050 uint32 mpls_ttl = 1; /* MPLS TTL */
1051};
1052
1053/* Action structure for OFPAT_PUSH_VLAN/MPLS/PBB. */
1054message ofp_action_push {
1055 uint32 ethertype = 1; /* Ethertype */
1056};
1057
1058/* Action structure for OFPAT_POP_MPLS. */
1059message ofp_action_pop_mpls {
1060 uint32 ethertype = 1; /* Ethertype */
1061};
1062
1063/* Action structure for OFPAT_GROUP. */
1064message ofp_action_group {
1065 uint32 group_id = 1; /* Group identifier. */
1066};
1067
1068/* Action structure for OFPAT_SET_NW_TTL. */
1069message ofp_action_nw_ttl {
1070 uint32 nw_ttl = 1; /* IP TTL */
1071};
1072
1073/* Action structure for OFPAT_SET_FIELD. */
1074message ofp_action_set_field {
1075 ofp_oxm_field field = 1;
1076};
1077
1078/* Action header for OFPAT_EXPERIMENTER.
1079 * The rest of the body is experimenter-defined. */
1080message ofp_action_experimenter {
1081 uint32 experimenter = 1; /* Experimenter ID which takes the same
1082 form as in struct
1083 ofp_experimenter_header. */
1084 bytes data = 2;
1085};
1086
1087/* ## ---------------------- ## */
1088/* ## OpenFlow Instructions. ## */
1089/* ## ---------------------- ## */
1090
1091enum ofp_instruction_type {
1092 OFPIT_INVALID = 0;
1093 OFPIT_GOTO_TABLE = 1; /* Setup the next table in the lookup
1094 pipeline */
1095 OFPIT_WRITE_METADATA = 2; /* Setup the metadata field for use later in
1096 pipeline */
1097 OFPIT_WRITE_ACTIONS = 3; /* Write the action(s) onto the datapath action
1098 set */
1099 OFPIT_APPLY_ACTIONS = 4; /* Applies the action(s) immediately */
1100 OFPIT_CLEAR_ACTIONS = 5; /* Clears all actions from the datapath
1101 action set */
1102 OFPIT_METER = 6; /* Apply meter (rate limiter) */
1103
1104 OFPIT_EXPERIMENTER = 0xFFFF; /* Experimenter instruction */
1105};
1106
1107/* Instruction header that is common to all instructions. The length includes
1108 * the header and any padding used to make the instruction 64-bit aligned.
1109 * NB: The length of an instruction *must* always be a multiple of eight. */
1110message ofp_instruction {
1111 uint32 type = 1; /* Instruction type */
1112 oneof data {
1113 ofp_instruction_goto_table goto_table = 2;
1114 ofp_instruction_write_metadata write_metadata = 3;
1115 ofp_instruction_actions actions = 4;
1116 ofp_instruction_meter meter = 5;
1117 ofp_instruction_experimenter experimenter = 6;
1118 }
1119};
1120
1121/* Instruction structure for OFPIT_GOTO_TABLE */
1122message ofp_instruction_goto_table {
1123 uint32 table_id = 1; /* Set next table in the lookup pipeline */
1124};
1125
1126/* Instruction structure for OFPIT_WRITE_METADATA */
1127message ofp_instruction_write_metadata {
1128 uint64 metadata = 1; /* Metadata value to write */
1129 uint64 metadata_mask = 2; /* Metadata write bitmask */
1130};
1131
1132/* Instruction structure for OFPIT_WRITE/APPLY/CLEAR_ACTIONS */
1133message ofp_instruction_actions {
1134 repeated ofp_action actions = 1; /* 0 or more actions associated
1135 with OFPIT_WRITE_ACTIONS and
1136 OFPIT_APPLY_ACTIONS */
1137};
1138
1139/* Instruction structure for OFPIT_METER */
1140message ofp_instruction_meter {
1141 uint32 meter_id = 1; /* Meter instance. */
1142};
1143
1144/* Instruction structure for experimental instructions */
1145message ofp_instruction_experimenter {
1146 uint32 experimenter = 1; /* Experimenter ID which takes the same form
1147 as in struct ofp_experimenter_header. */
1148 /* Experimenter-defined arbitrary additional data. */
1149 bytes data = 2;
1150};
1151
1152/* ## --------------------------- ## */
1153/* ## OpenFlow Flow Modification. ## */
1154/* ## --------------------------- ## */
1155
1156enum ofp_flow_mod_command {
1157 OFPFC_ADD = 0; /* New flow. */
1158 OFPFC_MODIFY = 1; /* Modify all matching flows. */
1159 OFPFC_MODIFY_STRICT = 2; /* Modify entry strictly matching wildcards and
1160 priority. */
1161 OFPFC_DELETE = 3; /* Delete all matching flows. */
1162 OFPFC_DELETE_STRICT = 4; /* Delete entry strictly matching wildcards and
1163 priority. */
1164};
1165
1166/* Value used in "idle_timeout" and "hard_timeout" to indicate that the entry
1167 * is permanent. */
1168//#define OFP_FLOW_PERMANENT 0
1169
1170/* By default, choose a priority in the middle. */
1171//#define OFP_DEFAULT_PRIORITY 0x8000
1172
1173enum ofp_flow_mod_flags {
1174 OFPFF_INVALID = 0;
1175 OFPFF_SEND_FLOW_REM = 1; /* Send flow removed message when flow
1176 * expires or is deleted. */
1177 OFPFF_CHECK_OVERLAP = 2; /* Check for overlapping entries first. */
1178 OFPFF_RESET_COUNTS = 4; /* Reset flow packet and byte counts. */
1179 OFPFF_NO_PKT_COUNTS = 8; /* Don't keep track of packet count. */
1180 OFPFF_NO_BYT_COUNTS = 16; /* Don't keep track of byte count. */
1181};
1182
1183/* Flow setup and teardown (controller -> datapath). */
1184message ofp_flow_mod {
1185 //ofp_header header;
1186 uint64 cookie = 1; /* Opaque controller-issued identifier. */
1187 uint64 cookie_mask = 2; /* Mask used to restrict the cookie bits
1188 that must match when the command is
1189 OFPFC_MODIFY* or OFPFC_DELETE*. A value
1190 of 0 indicates no restriction. */
1191 uint32 table_id = 3; /* ID of the table to put the flow in.
1192 For OFPFC_DELETE_* commands, OFPTT_ALL
1193 can also be used to delete matching
1194 flows from all tables. */
1195 ofp_flow_mod_command command = 4; /* One of OFPFC_*. */
1196 uint32 idle_timeout = 5; /* Idle time before discarding (seconds). */
1197 uint32 hard_timeout = 6; /* Max time before discarding (seconds). */
1198 uint32 priority = 7; /* Priority level of flow entry. */
1199 uint32 buffer_id = 8; /* Buffered packet to apply to, or
1200 OFP_NO_BUFFER.
1201 Not meaningful for OFPFC_DELETE*. */
1202 uint32 out_port = 9; /* For OFPFC_DELETE* commands, require
1203 matching entries to include this as an
1204 output port. A value of OFPP_ANY
1205 indicates no restriction. */
1206 uint32 out_group = 10; /* For OFPFC_DELETE* commands, require
1207 matching entries to include this as an
1208 output group. A value of OFPG_ANY
1209 indicates no restriction. */
1210 uint32 flags = 11; /* Bitmap of OFPFF_* flags. */
1211 ofp_match match = 12; /* Fields to match. Variable size. */
1212 repeated ofp_instruction instructions = 13; /* 0 or more. */
1213};
1214
1215/* Group numbering. Groups can use any number up to OFPG_MAX. */
1216enum ofp_group {
1217
1218 OFPG_INVALID = 0;
1219
1220 /* Last usable group number. */
1221 OFPG_MAX = 0x7fffff00;
1222
1223 /* Fake groups. */
1224 OFPG_ALL = 0x7ffffffc; /* Represents all groups for group delete
1225 commands. */
1226 OFPG_ANY = 0x7fffffff; /* Special wildcard: no group specified. */
1227};
1228
1229/* Group commands */
1230enum ofp_group_mod_command {
1231 OFPGC_ADD = 0; /* New group. */
1232 OFPGC_MODIFY = 1; /* Modify all matching groups. */
1233 OFPGC_DELETE = 2; /* Delete all matching groups. */
1234};
1235
1236/* Bucket for use in groups. */
1237message ofp_bucket {
1238 uint32 weight = 1; /* Relative weight of bucket. Only
1239 defined for select groups. */
1240 uint32 watch_port = 2; /* Port whose state affects whether this
1241 bucket is live. Only required for fast
1242 failover groups. */
1243 uint32 watch_group = 3; /* Group whose state affects whether this
1244 bucket is live. Only required for fast
1245 failover groups. */
1246 repeated ofp_action actions = 4;
1247};
1248
1249/* Group setup and teardown (controller -> datapath). */
1250message ofp_group_mod {
1251 //ofp_header header;
1252 ofp_group_mod_command command = 1; /* One of OFPGC_*. */
1253 ofp_group_type type = 2; /* One of OFPGT_*. */
1254 uint32 group_id = 3; /* Group identifier. */
1255 repeated ofp_bucket buckets = 4;
1256};
1257
1258/* Group types. Values in the range [128; 255] are reserved for experimental
1259 * use. */
1260enum ofp_group_type {
1261 OFPGT_ALL = 0; /* All (multicast/broadcast) group. */
1262 OFPGT_SELECT = 1; /* Select group. */
1263 OFPGT_INDIRECT = 2; /* Indirect group. */
1264 OFPGT_FF = 3; /* Fast failover group. */
1265};
1266
1267/* Special buffer-id to indicate 'no buffer' */
1268//#define OFP_NO_BUFFER 0xffffffff
1269
1270/* Send packet (controller -> datapath). */
1271message ofp_packet_out {
1272 //ofp_header header;
1273 uint32 buffer_id = 1; /* ID assigned by datapath (OFP_NO_BUFFER
1274 if none). */
1275 uint32 in_port = 2; /* Packet's input port or OFPP_CONTROLLER.*/
1276 repeated ofp_action actions = 3; /* Action list - 0 or more. */
1277 /* The variable size action list is optionally followed by packet data.
1278 * This data is only present and meaningful if buffer_id == -1. */
1279 bytes data = 4; /* Packet data. */
1280};
1281
1282/* Why is this packet being sent to the controller? */
1283enum ofp_packet_in_reason {
1284 OFPR_NO_MATCH = 0; /* No matching flow (table-miss flow entry). */
1285 OFPR_ACTION = 1; /* Action explicitly output to controller. */
1286 OFPR_INVALID_TTL = 2; /* Packet has invalid TTL */
1287};
1288
1289/* Packet received on port (datapath -> controller). */
1290message ofp_packet_in {
1291 //ofp_header header;
1292 uint32 buffer_id = 1; /* ID assigned by datapath. */
1293 ofp_packet_in_reason reason = 2; /* Reason packet is being sent */
1294 uint32 table_id = 3; /* ID of the table that was looked up */
1295 uint64 cookie = 4; /* Cookie of the flow entry that was looked up. */
1296 ofp_match match = 5; /* Packet metadata. Variable size. */
1297 bytes data = 6; /* Ethernet frame */
1298};
1299
1300/* Why was this flow removed? */
1301enum ofp_flow_removed_reason {
1302 OFPRR_IDLE_TIMEOUT = 0; /* Flow idle time exceeded idle_timeout. */
1303 OFPRR_HARD_TIMEOUT = 1; /* Time exceeded hard_timeout. */
1304 OFPRR_DELETE = 2; /* Evicted by a DELETE flow mod. */
1305 OFPRR_GROUP_DELETE = 3; /* Group was removed. */
1306 OFPRR_METER_DELETE = 4; /* Meter was removed */
1307};
1308
1309/* Flow removed (datapath -> controller). */
1310message ofp_flow_removed {
1311 //ofp_header header;
1312 uint64 cookie = 1; /* Opaque controller-issued identifier. */
1313
1314 uint32 priority = 2; /* Priority level of flow entry. */
1315 ofp_flow_removed_reason reason = 3; /* One of OFPRR_*. */
1316 uint32 table_id = 4; /* ID of the table */
1317
1318 uint32 duration_sec = 5; /* Time flow was alive in seconds. */
1319 uint32 duration_nsec = 6; /* Time flow was alive in nanoseconds beyond
1320 duration_sec. */
1321 uint32 idle_timeout = 7; /* Idle timeout from original flow mod. */
1322 uint32 hard_timeout = 8; /* Hard timeout from original flow mod. */
1323 uint64 packet_count = 9;
1324 uint64 byte_count = 10;
1325 ofp_match match = 121; /* Description of fields. Variable size. */
1326};
1327
1328/* Meter numbering. Flow meters can use any number up to OFPM_MAX. */
1329enum ofp_meter {
1330 OFPM_ZERO = 0;
1331 /* Last usable meter. */
1332 OFPM_MAX = 0x7fff0000;
1333
1334 /* Virtual meters. */
1335 OFPM_SLOWPATH = 0x7ffffffd; /* Meter for slow datapath. */
1336 OFPM_CONTROLLER = 0x7ffffffe; /* Meter for controller connection. */
1337 OFPM_ALL = 0x7fffffff; /* Represents all meters for stat requests
1338 commands. */
1339};
1340
1341/* Meter band types */
1342enum ofp_meter_band_type {
1343 OFPMBT_INVALID = 0;
1344 OFPMBT_DROP = 1; /* Drop packet. */
1345 OFPMBT_DSCP_REMARK = 2; /* Remark DSCP in the IP header. */
1346 OFPMBT_EXPERIMENTER = 0xFFFF; /* Experimenter meter band. */
1347};
1348
1349/* Common header for all meter bands */
1350message ofp_meter_band_header {
1351 ofp_meter_band_type type = 1; /* One of OFPMBT_*. */
1352 uint32 len = 2; /* Length in bytes of this band. */
1353 uint32 rate = 3; /* Rate for this band. */
1354 uint32 burst_size = 4;/* Size of bursts. */
1355};
1356
1357/* OFPMBT_DROP band - drop packets */
1358message ofp_meter_band_drop {
1359 uint32 type = 1; /* OFPMBT_DROP. */
1360 uint32 len = 2; /* Length in bytes of this band. */
1361 uint32 rate = 3; /* Rate for dropping packets. */
1362 uint32 burst_size = 4;/* Size of bursts. */
1363};
1364
1365/* OFPMBT_DSCP_REMARK band - Remark DSCP in the IP header */
1366message ofp_meter_band_dscp_remark {
1367 uint32 type = 1; /* OFPMBT_DSCP_REMARK. */
1368 uint32 len = 2; /* Length in bytes of this band. */
1369 uint32 rate = 3; /* Rate for remarking packets. */
1370 uint32 burst_size = 4; /* Size of bursts. */
1371 uint32 prec_level = 5; /* Number of drop precedence level to add. */
1372};
1373
1374/* OFPMBT_EXPERIMENTER band - Experimenter type.
1375 * The rest of the band is experimenter-defined. */
1376message ofp_meter_band_experimenter {
1377 ofp_meter_band_type type = 1; /* One of OFPMBT_*. */
1378 uint32 len = 2; /* Length in bytes of this band. */
1379 uint32 rate = 3; /* Rate for this band. */
1380 uint32 burst_size = 4; /* Size of bursts. */
1381 uint32 experimenter = 5;/* Experimenter ID which takes the
1382 same form as in struct
1383 ofp_experimenter_header. */
1384};
1385
1386/* Meter commands */
1387enum ofp_meter_mod_command {
1388 OFPMC_ADD = 0; /* New meter. */
1389 OFPMC_MODIFY = 1; /* Modify specified meter. */
1390 OFPMC_DELETE = 2; /* Delete specified meter. */
1391};
1392
1393/* Meter configuration flags */
1394enum ofp_meter_flags {
1395 OFPMF_INVALID = 0;
1396 OFPMF_KBPS = 1; /* Rate value in kb/s (kilo-bit per second). */
1397 OFPMF_PKTPS = 2; /* Rate value in packet/sec. */
1398 OFPMF_BURST = 4; /* Do burst size. */
1399 OFPMF_STATS = 8; /* Collect statistics. */
1400};
1401
1402/* Meter configuration. OFPT_METER_MOD. */
1403message ofp_meter_mod {
1404// ofp_header header = 1;
1405 ofp_meter_mod_command command = 1; /* One of OFPMC_*. */
1406 uint32 flags = 2; /* Bitmap of OFPMF_* flags. */
1407 uint32 meter_id = 3; /* Meter instance. */
1408 repeated ofp_meter_band_header bands = 4; /* The band list length is
1409 inferred from the length field
1410 in the header. */
1411};
1412
1413/* Values for 'type' in ofp_error_message. These values are immutable: they
1414 * will not change in future versions of the protocol (although new values may
1415 * be added). */
1416enum ofp_error_type {
1417 OFPET_HELLO_FAILED = 0; /* Hello protocol failed. */
1418 OFPET_BAD_REQUEST = 1; /* Request was not understood. */
1419 OFPET_BAD_ACTION = 2; /* Error in action description. */
1420 OFPET_BAD_INSTRUCTION = 3; /* Error in instruction list. */
1421 OFPET_BAD_MATCH = 4; /* Error in match. */
1422 OFPET_FLOW_MOD_FAILED = 5; /* Problem modifying flow entry. */
1423 OFPET_GROUP_MOD_FAILED = 6; /* Problem modifying group entry. */
1424 OFPET_PORT_MOD_FAILED = 7; /* Port mod request failed. */
1425 OFPET_TABLE_MOD_FAILED = 8; /* Table mod request failed. */
1426 OFPET_QUEUE_OP_FAILED = 9; /* Queue operation failed. */
1427 OFPET_SWITCH_CONFIG_FAILED = 10; /* Switch config request failed. */
1428 OFPET_ROLE_REQUEST_FAILED = 11; /* Controller Role request failed. */
1429 OFPET_METER_MOD_FAILED = 12; /* Error in meter. */
1430 OFPET_TABLE_FEATURES_FAILED = 13; /* Setting table features failed. */
1431 OFPET_EXPERIMENTER = 0xffff; /* Experimenter error messages. */
1432};
1433
1434/* ofp_error_msg 'code' values for OFPET_HELLO_FAILED. 'data' contains an
1435 * ASCII text string that may give failure details. */
1436enum ofp_hello_failed_code {
1437 OFPHFC_INCOMPATIBLE = 0; /* No compatible version. */
1438 OFPHFC_EPERM = 1; /* Permissions error. */
1439};
1440
1441/* ofp_error_msg 'code' values for OFPET_BAD_REQUEST. 'data' contains at least
1442 * the first 64 bytes of the failed request. */
1443enum ofp_bad_request_code {
1444 OFPBRC_BAD_VERSION = 0; /* ofp_header.version not supported. */
1445 OFPBRC_BAD_TYPE = 1; /* ofp_header.type not supported. */
1446 OFPBRC_BAD_MULTIPART = 2; /* ofp_multipart_request.type not supported.
1447 */
1448 OFPBRC_BAD_EXPERIMENTER = 3; /* Experimenter id not supported
1449 * (in ofp_experimenter_header or
1450 * ofp_multipart_request or
1451 * ofp_multipart_reply). */
1452 OFPBRC_BAD_EXP_TYPE = 4; /* Experimenter type not supported. */
1453 OFPBRC_EPERM = 5; /* Permissions error. */
1454 OFPBRC_BAD_LEN = 6; /* Wrong request length for type. */
1455 OFPBRC_BUFFER_EMPTY = 7; /* Specified buffer has already been used. */
1456 OFPBRC_BUFFER_UNKNOWN = 8; /* Specified buffer does not exist. */
1457 OFPBRC_BAD_TABLE_ID = 9; /* Specified table-id invalid or does not
1458 * exist. */
1459 OFPBRC_IS_SLAVE = 10; /* Denied because controller is slave. */
1460 OFPBRC_BAD_PORT = 11; /* Invalid port. */
1461 OFPBRC_BAD_PACKET = 12; /* Invalid packet in packet-out. */
1462 OFPBRC_MULTIPART_BUFFER_OVERFLOW = 13; /* ofp_multipart_request
1463 overflowed the assigned buffer. */
1464};
1465
1466/* ofp_error_msg 'code' values for OFPET_BAD_ACTION. 'data' contains at least
1467 * the first 64 bytes of the failed request. */
1468enum ofp_bad_action_code {
1469 OFPBAC_BAD_TYPE = 0; /* Unknown or unsupported action type. */
1470 OFPBAC_BAD_LEN = 1; /* Length problem in actions. */
1471 OFPBAC_BAD_EXPERIMENTER = 2; /* Unknown experimenter id specified. */
1472 OFPBAC_BAD_EXP_TYPE = 3; /* Unknown action for experimenter id. */
1473 OFPBAC_BAD_OUT_PORT = 4; /* Problem validating output port. */
1474 OFPBAC_BAD_ARGUMENT = 5; /* Bad action argument. */
1475 OFPBAC_EPERM = 6; /* Permissions error. */
1476 OFPBAC_TOO_MANY = 7; /* Can't handle this many actions. */
1477 OFPBAC_BAD_QUEUE = 8; /* Problem validating output queue. */
1478 OFPBAC_BAD_OUT_GROUP = 9; /* Invalid group id in forward action. */
1479 OFPBAC_MATCH_INCONSISTENT = 10; /* Action can't apply for this match,
1480 or Set-Field missing prerequisite. */
1481 OFPBAC_UNSUPPORTED_ORDER = 11; /* Action order is unsupported for the
1482 action list in an Apply-Actions instruction */
1483 OFPBAC_BAD_TAG = 12; /* Actions uses an unsupported
1484 tag/encap. */
1485 OFPBAC_BAD_SET_TYPE = 13; /* Unsupported type in SET_FIELD action. */
1486 OFPBAC_BAD_SET_LEN = 14; /* Length problem in SET_FIELD action. */
1487 OFPBAC_BAD_SET_ARGUMENT = 15; /* Bad argument in SET_FIELD action. */
1488};
1489
1490/* ofp_error_msg 'code' values for OFPET_BAD_INSTRUCTION. 'data' contains at
1491 * least the first 64 bytes of the failed request. */
1492enum ofp_bad_instruction_code {
1493 OFPBIC_UNKNOWN_INST = 0; /* Unknown instruction. */
1494 OFPBIC_UNSUP_INST = 1; /* Switch or table does not support the
1495 instruction. */
1496 OFPBIC_BAD_TABLE_ID = 2; /* Invalid Table-ID specified. */
1497 OFPBIC_UNSUP_METADATA = 3; /* Metadata value unsupported by datapath. */
1498 OFPBIC_UNSUP_METADATA_MASK = 4; /* Metadata mask value unsupported by
1499 datapath. */
1500 OFPBIC_BAD_EXPERIMENTER = 5; /* Unknown experimenter id specified. */
1501 OFPBIC_BAD_EXP_TYPE = 6; /* Unknown instruction for experimenter id. */
1502 OFPBIC_BAD_LEN = 7; /* Length problem in instructions. */
1503 OFPBIC_EPERM = 8; /* Permissions error. */
1504};
1505
1506/* ofp_error_msg 'code' values for OFPET_BAD_MATCH. 'data' contains at least
1507 * the first 64 bytes of the failed request. */
1508enum ofp_bad_match_code {
1509 OFPBMC_BAD_TYPE = 0; /* Unsupported match type specified by the
1510 match */
1511 OFPBMC_BAD_LEN = 1; /* Length problem in match. */
1512 OFPBMC_BAD_TAG = 2; /* Match uses an unsupported tag/encap. */
1513 OFPBMC_BAD_DL_ADDR_MASK = 3; /* Unsupported datalink addr mask - switch
1514 does not support arbitrary datalink
1515 address mask. */
1516 OFPBMC_BAD_NW_ADDR_MASK = 4; /* Unsupported network addr mask - switch
1517 does not support arbitrary network
1518 address mask. */
1519 OFPBMC_BAD_WILDCARDS = 5; /* Unsupported combination of fields masked
1520 or omitted in the match. */
1521 OFPBMC_BAD_FIELD = 6; /* Unsupported field type in the match. */
1522 OFPBMC_BAD_VALUE = 7; /* Unsupported value in a match field. */
1523 OFPBMC_BAD_MASK = 8; /* Unsupported mask specified in the match,
1524 field is not dl-address or nw-address. */
1525 OFPBMC_BAD_PREREQ = 9; /* A prerequisite was not met. */
1526 OFPBMC_DUP_FIELD = 10; /* A field type was duplicated. */
1527 OFPBMC_EPERM = 11; /* Permissions error. */
1528};
1529
1530/* ofp_error_msg 'code' values for OFPET_FLOW_MOD_FAILED. 'data' contains
1531 * at least the first 64 bytes of the failed request. */
1532enum ofp_flow_mod_failed_code {
1533 OFPFMFC_UNKNOWN = 0; /* Unspecified error. */
1534 OFPFMFC_TABLE_FULL = 1; /* Flow not added because table was full. */
1535 OFPFMFC_BAD_TABLE_ID = 2; /* Table does not exist */
1536 OFPFMFC_OVERLAP = 3; /* Attempted to add overlapping flow with
1537 CHECK_OVERLAP flag set. */
1538 OFPFMFC_EPERM = 4; /* Permissions error. */
1539 OFPFMFC_BAD_TIMEOUT = 5; /* Flow not added because of unsupported
1540 idle/hard timeout. */
1541 OFPFMFC_BAD_COMMAND = 6; /* Unsupported or unknown command. */
1542 OFPFMFC_BAD_FLAGS = 7; /* Unsupported or unknown flags. */
1543};
1544
1545/* ofp_error_msg 'code' values for OFPET_GROUP_MOD_FAILED. 'data' contains
1546 * at least the first 64 bytes of the failed request. */
1547enum ofp_group_mod_failed_code {
1548 OFPGMFC_GROUP_EXISTS = 0; /* Group not added because a group ADD
1549 attempted to replace an
1550 already-present group. */
1551 OFPGMFC_INVALID_GROUP = 1; /* Group not added because Group
1552 specified is invalid. */
1553 OFPGMFC_WEIGHT_UNSUPPORTED = 2; /* Switch does not support unequal load
1554 sharing with select groups. */
1555 OFPGMFC_OUT_OF_GROUPS = 3; /* The group table is full. */
1556 OFPGMFC_OUT_OF_BUCKETS = 4; /* The maximum number of action buckets
1557 for a group has been exceeded. */
1558 OFPGMFC_CHAINING_UNSUPPORTED = 5; /* Switch does not support groups that
1559 forward to groups. */
1560 OFPGMFC_WATCH_UNSUPPORTED = 6; /* This group cannot watch the
1561 watch_port or watch_group specified.
1562 */
1563 OFPGMFC_LOOP = 7; /* Group entry would cause a loop. */
1564 OFPGMFC_UNKNOWN_GROUP = 8; /* Group not modified because a group
1565 MODIFY attempted to modify a
1566 non-existent group. */
1567 OFPGMFC_CHAINED_GROUP = 9; /* Group not deleted because another
1568 group is forwarding to it. */
1569 OFPGMFC_BAD_TYPE = 10; /* Unsupported or unknown group type. */
1570 OFPGMFC_BAD_COMMAND = 11; /* Unsupported or unknown command. */
1571 OFPGMFC_BAD_BUCKET = 12; /* Error in bucket. */
1572 OFPGMFC_BAD_WATCH = 13; /* Error in watch port/group. */
1573 OFPGMFC_EPERM = 14; /* Permissions error. */
1574};
1575
1576/* ofp_error_msg 'code' values for OFPET_PORT_MOD_FAILED. 'data' contains
1577 * at least the first 64 bytes of the failed request. */
1578enum ofp_port_mod_failed_code {
1579 OFPPMFC_BAD_PORT = 0; /* Specified port number does not exist. */
1580 OFPPMFC_BAD_HW_ADDR = 1; /* Specified hardware address does not
1581 * match the port number. */
1582 OFPPMFC_BAD_CONFIG = 2; /* Specified config is invalid. */
1583 OFPPMFC_BAD_ADVERTISE = 3; /* Specified advertise is invalid. */
1584 OFPPMFC_EPERM = 4; /* Permissions error. */
1585};
1586
1587/* ofp_error_msg 'code' values for OFPET_TABLE_MOD_FAILED. 'data' contains
1588 * at least the first 64 bytes of the failed request. */
1589enum ofp_table_mod_failed_code {
1590 OFPTMFC_BAD_TABLE = 0; /* Specified table does not exist. */
1591 OFPTMFC_BAD_CONFIG = 1; /* Specified config is invalid. */
1592 OFPTMFC_EPERM = 2; /* Permissions error. */
1593};
1594
1595/* ofp_error msg 'code' values for OFPET_QUEUE_OP_FAILED. 'data' contains
1596 * at least the first 64 bytes of the failed request */
1597enum ofp_queue_op_failed_code {
1598 OFPQOFC_BAD_PORT = 0; /* Invalid port (or port does not exist). */
1599 OFPQOFC_BAD_QUEUE = 1; /* Queue does not exist. */
1600 OFPQOFC_EPERM = 2; /* Permissions error. */
1601};
1602
1603/* ofp_error_msg 'code' values for OFPET_SWITCH_CONFIG_FAILED. 'data' contains
1604 * at least the first 64 bytes of the failed request. */
1605enum ofp_switch_config_failed_code {
1606 OFPSCFC_BAD_FLAGS = 0; /* Specified flags is invalid. */
1607 OFPSCFC_BAD_LEN = 1; /* Specified len is invalid. */
1608 OFPSCFC_EPERM = 2; /* Permissions error. */
1609};
1610
1611/* ofp_error_msg 'code' values for OFPET_ROLE_REQUEST_FAILED. 'data' contains
1612 * at least the first 64 bytes of the failed request. */
1613enum ofp_role_request_failed_code {
1614 OFPRRFC_STALE = 0; /* Stale Message: old generation_id. */
1615 OFPRRFC_UNSUP = 1; /* Controller role change unsupported. */
1616 OFPRRFC_BAD_ROLE = 2; /* Invalid role. */
1617};
1618
1619/* ofp_error_msg 'code' values for OFPET_METER_MOD_FAILED. 'data' contains
1620 * at least the first 64 bytes of the failed request. */
1621enum ofp_meter_mod_failed_code {
1622 OFPMMFC_UNKNOWN = 0; /* Unspecified error. */
1623 OFPMMFC_METER_EXISTS = 1; /* Meter not added because a Meter ADD
1624 * attempted to replace an existing Meter. */
1625 OFPMMFC_INVALID_METER = 2; /* Meter not added because Meter specified
1626 * is invalid,
1627 * or invalid meter in meter action. */
1628 OFPMMFC_UNKNOWN_METER = 3; /* Meter not modified because a Meter MODIFY
1629 * attempted to modify a non-existent Meter,
1630 * or bad meter in meter action. */
1631 OFPMMFC_BAD_COMMAND = 4; /* Unsupported or unknown command. */
1632 OFPMMFC_BAD_FLAGS = 5; /* Flag configuration unsupported. */
1633 OFPMMFC_BAD_RATE = 6; /* Rate unsupported. */
1634 OFPMMFC_BAD_BURST = 7; /* Burst size unsupported. */
1635 OFPMMFC_BAD_BAND = 8; /* Band unsupported. */
1636 OFPMMFC_BAD_BAND_VALUE = 9; /* Band value unsupported. */
1637 OFPMMFC_OUT_OF_METERS = 10; /* No more meters available. */
1638 OFPMMFC_OUT_OF_BANDS = 11; /* The maximum number of properties
1639 * for a meter has been exceeded. */
1640};
1641
1642/* ofp_error_msg 'code' values for OFPET_TABLE_FEATURES_FAILED. 'data' contains
1643 * at least the first 64 bytes of the failed request. */
1644enum ofp_table_features_failed_code {
1645 OFPTFFC_BAD_TABLE = 0; /* Specified table does not exist. */
1646 OFPTFFC_BAD_METADATA = 1; /* Invalid metadata mask. */
1647 OFPTFFC_BAD_TYPE = 2; /* Unknown property type. */
1648 OFPTFFC_BAD_LEN = 3; /* Length problem in properties. */
1649 OFPTFFC_BAD_ARGUMENT = 4; /* Unsupported property value. */
1650 OFPTFFC_EPERM = 5; /* Permissions error. */
1651};
1652
1653/* OFPT_ERROR: Error message (datapath -> controller). */
1654message ofp_error_msg {
1655 //ofp_header header;
1656 uint32 type = 1;
1657 uint32 code = 2;
1658 bytes data = 3; /* Variable-length data. Interpreted based
1659 on the type and code. No padding. */
1660};
1661
1662/* OFPET_EXPERIMENTER: Error message (datapath -> controller). */
1663message ofp_error_experimenter_msg {
1664 //ofp_header header;
1665
1666 uint32 type = 1; /* OFPET_EXPERIMENTER. */
1667 uint32 exp_type = 2; /* Experimenter defined. */
1668 uint32 experimenter = 3; /* Experimenter ID which takes the same form
1669 as in struct ofp_experimenter_header. */
1670 bytes data = 4; /* Variable-length data. Interpreted based
1671 on the type and code. No padding. */
1672};
1673
1674enum ofp_multipart_type {
1675 /* Description of this OpenFlow switch.
1676 * The request body is empty.
1677 * The reply body is struct ofp_desc. */
1678 OFPMP_DESC = 0;
1679
1680 /* Individual flow statistics.
1681 * The request body is struct ofp_flow_stats_request.
1682 * The reply body is an array of struct ofp_flow_stats. */
1683 OFPMP_FLOW = 1;
1684
1685 /* Aggregate flow statistics.
1686 * The request body is struct ofp_aggregate_stats_request.
1687 * The reply body is struct ofp_aggregate_stats_reply. */
1688 OFPMP_AGGREGATE = 2;
1689
1690 /* Flow table statistics.
1691 * The request body is empty.
1692 * The reply body is an array of struct ofp_table_stats. */
1693 OFPMP_TABLE = 3;
1694
1695 /* Port statistics.
1696 * The request body is struct ofp_port_stats_request.
1697 * The reply body is an array of struct ofp_port_stats. */
1698 OFPMP_PORT_STATS = 4;
1699
1700 /* Queue statistics for a port
1701 * The request body is struct ofp_queue_stats_request.
1702 * The reply body is an array of struct ofp_queue_stats */
1703 OFPMP_QUEUE = 5;
1704
1705 /* Group counter statistics.
1706 * The request body is struct ofp_group_stats_request.
1707 * The reply is an array of struct ofp_group_stats. */
1708 OFPMP_GROUP = 6;
1709
1710 /* Group description.
1711 * The request body is empty.
1712 * The reply body is an array of struct ofp_group_desc. */
1713 OFPMP_GROUP_DESC = 7;
1714
1715 /* Group features.
1716 * The request body is empty.
1717 * The reply body is struct ofp_group_features. */
1718 OFPMP_GROUP_FEATURES = 8;
1719
1720 /* Meter statistics.
1721 * The request body is struct ofp_meter_multipart_requests.
1722 * The reply body is an array of struct ofp_meter_stats. */
1723 OFPMP_METER = 9;
1724
1725 /* Meter configuration.
1726 * The request body is struct ofp_meter_multipart_requests.
1727 * The reply body is an array of struct ofp_meter_config. */
1728 OFPMP_METER_CONFIG = 10;
1729
1730 /* Meter features.
1731 * The request body is empty.
1732 * The reply body is struct ofp_meter_features. */
1733 OFPMP_METER_FEATURES = 11;
1734
1735 /* Table features.
1736 * The request body is either empty or contains an array of
1737 * struct ofp_table_features containing the controller's
1738 * desired view of the switch. If the switch is unable to
1739 * set the specified view an error is returned.
1740 * The reply body is an array of struct ofp_table_features. */
1741 OFPMP_TABLE_FEATURES = 12;
1742
1743 /* Port description.
1744 * The request body is empty.
1745 * The reply body is an array of struct ofp_port. */
1746 OFPMP_PORT_DESC = 13;
1747
1748 /* Experimenter extension.
1749 * The request and reply bodies begin with
1750 * struct ofp_experimenter_multipart_header.
1751 * The request and reply bodies are otherwise experimenter-defined. */
1752 OFPMP_EXPERIMENTER = 0xffff;
1753};
1754
1755/* Backward compatibility with 1.3.1 - avoid breaking the API. */
1756//#define ofp_multipart_types ofp_multipart_type
1757
1758enum ofp_multipart_request_flags {
1759 OFPMPF_REQ_INVALID = 0;
1760 OFPMPF_REQ_MORE = 1; /* More requests to follow. */
1761};
1762
1763message ofp_multipart_request {
1764 //ofp_header header;
1765 ofp_multipart_type type = 1; /* One of the OFPMP_* constants. */
1766 uint32 flags = 2; /* OFPMPF_REQ_* flags. */
1767 bytes body = 3; /* Body of the request. 0 or more bytes. */
1768};
1769
1770enum ofp_multipart_reply_flags {
1771 OFPMPF_REPLY_INVALID = 0;
1772 OFPMPF_REPLY_MORE = 1; /* More replies to follow. */
1773};
1774
1775message ofp_multipart_reply {
1776 //ofp_header header;
1777 ofp_multipart_type type = 1; /* One of the OFPMP_* constants. */
1778 uint32 flags = 2; /* OFPMPF_REPLY_* flags. */
1779 bytes body = 3; /* Body of the reply. 0 or more bytes. */
1780};
1781
1782//#define DESC_STR_LEN 256
1783//#define SERIAL_NUM_LEN 32
1784/* Body of reply to OFPMP_DESC request. Each entry is a NULL-terminated
1785 * ASCII string. */
1786message ofp_desc {
1787 string mfr_desc = 1; /* Manufacturer description. */
1788 string hw_desc = 2; /* Hardware description. */
1789 string sw_desc = 3; /* Software description. */
1790 string serial_num = 4; /* Serial number. */
1791 string dp_desc = 5; /* Human readable description of datapath. */
1792};
1793
1794/* Body for ofp_multipart_request of type OFPMP_FLOW. */
1795message ofp_flow_stats_request {
1796 uint32 table_id = 1; /* ID of table to read (from ofp_table_stats),
1797 OFPTT_ALL for all tables. */
1798 uint32 out_port = 2; /* Require matching entries to include this
1799 as an output port. A value of OFPP_ANY
1800 indicates no restriction. */
1801 uint32 out_group = 3; /* Require matching entries to include this
1802 as an output group. A value of OFPG_ANY
1803 indicates no restriction. */
1804 uint64 cookie = 4; /* Require matching entries to contain this
1805 cookie value */
1806 uint64 cookie_mask = 5; /* Mask used to restrict the cookie bits that
1807 must match. A value of 0 indicates
1808 no restriction. */
1809 ofp_match match = 6; /* Fields to match. Variable size. */
1810};
1811
1812/* Body of reply to OFPMP_FLOW request. */
1813message ofp_flow_stats {
1814 uint64 id = 14; /* Unique ID of flow within device. */
1815 uint32 table_id = 1; /* ID of table flow came from. */
1816 uint32 duration_sec = 2; /* Time flow has been alive in seconds. */
1817 uint32 duration_nsec = 3; /* Time flow has been alive in nanoseconds
1818 beyond duration_sec. */
1819 uint32 priority = 4; /* Priority of the entry. */
1820 uint32 idle_timeout = 5; /* Number of seconds idle before expiration. */
1821 uint32 hard_timeout = 6; /* Number of seconds before expiration. */
1822 uint32 flags = 7; /* Bitmap of OFPFF_* flags. */
1823 uint64 cookie = 8; /* Opaque controller-issued identifier. */
1824 uint64 packet_count = 9; /* Number of packets in flow. */
1825 uint64 byte_count = 10; /* Number of bytes in flow. */
1826 ofp_match match = 12; /* Description of fields. Variable size. */
1827 repeated ofp_instruction instructions = 13; /* Instruction set
1828 (0 or more) */
1829};
1830
1831/* Body for ofp_multipart_request of type OFPMP_AGGREGATE. */
1832message ofp_aggregate_stats_request {
1833 uint32 table_id = 1; /* ID of table to read (from ofp_table_stats)
1834 OFPTT_ALL for all tables. */
1835 uint32 out_port = 2; /* Require matching entries to include this
1836 as an output port. A value of OFPP_ANY
1837 indicates no restriction. */
1838 uint32 out_group = 3; /* Require matching entries to include this
1839 as an output group. A value of OFPG_ANY
1840 indicates no restriction. */
1841 uint64 cookie = 4; /* Require matching entries to contain this
1842 cookie value */
1843 uint64 cookie_mask = 5; /* Mask used to restrict the cookie bits that
1844 must match. A value of 0 indicates
1845 no restriction. */
1846 ofp_match match = 6; /* Fields to match. Variable size. */
1847};
1848
1849/* Body of reply to OFPMP_AGGREGATE request. */
1850message ofp_aggregate_stats_reply {
1851 uint64 packet_count = 1; /* Number of packets in flows. */
1852 uint64 byte_count = 2; /* Number of bytes in flows. */
1853 uint32 flow_count = 3; /* Number of flows. */
1854};
1855
1856/* Table Feature property types.
1857 * Low order bit cleared indicates a property for a regular Flow Entry.
1858 * Low order bit set indicates a property for the Table-Miss Flow Entry.
1859 */
1860enum ofp_table_feature_prop_type {
1861 OFPTFPT_INSTRUCTIONS = 0; /* Instructions property. */
1862 OFPTFPT_INSTRUCTIONS_MISS = 1; /* Instructions for table-miss. */
1863 OFPTFPT_NEXT_TABLES = 2; /* Next Table property. */
1864 OFPTFPT_NEXT_TABLES_MISS = 3; /* Next Table for table-miss. */
1865 OFPTFPT_WRITE_ACTIONS = 4; /* Write Actions property. */
1866 OFPTFPT_WRITE_ACTIONS_MISS = 5; /* Write Actions for table-miss. */
1867 OFPTFPT_APPLY_ACTIONS = 6; /* Apply Actions property. */
1868 OFPTFPT_APPLY_ACTIONS_MISS = 7; /* Apply Actions for table-miss. */
1869 OFPTFPT_MATCH = 8; /* Match property. */
1870 OFPTFPT_WILDCARDS = 10; /* Wildcards property. */
1871 OFPTFPT_WRITE_SETFIELD = 12; /* Write Set-Field property. */
1872 OFPTFPT_WRITE_SETFIELD_MISS = 13; /* Write Set-Field for table-miss. */
1873 OFPTFPT_APPLY_SETFIELD = 14; /* Apply Set-Field property. */
1874 OFPTFPT_APPLY_SETFIELD_MISS = 15; /* Apply Set-Field for table-miss. */
1875 OFPTFPT_EXPERIMENTER = 0xFFFE; /* Experimenter property. */
1876 OFPTFPT_EXPERIMENTER_MISS = 0xFFFF; /* Experimenter for table-miss. */
1877};
1878
1879/* Common header for all Table Feature Properties */
1880message ofp_table_feature_property {
1881 ofp_table_feature_prop_type type = 1; /* One of OFPTFPT_*. */
1882 oneof value {
1883 ofp_table_feature_prop_instructions instructions = 2;
1884 ofp_table_feature_prop_next_tables next_tables = 3;
1885 ofp_table_feature_prop_actions actions = 4;
1886 ofp_table_feature_prop_oxm oxm = 5;
1887 ofp_table_feature_prop_experimenter experimenter = 6;
1888 }
1889};
1890
1891/* Instructions property */
1892message ofp_table_feature_prop_instructions {
1893 /* One of OFPTFPT_INSTRUCTIONS,
1894 OFPTFPT_INSTRUCTIONS_MISS. */
1895 repeated ofp_instruction instructions = 1; /* List of instructions */
1896};
1897
1898/* Next Tables property */
1899message ofp_table_feature_prop_next_tables {
1900 /* One of OFPTFPT_NEXT_TABLES,
1901 OFPTFPT_NEXT_TABLES_MISS. */
1902 repeated uint32 next_table_ids = 1; /* List of table ids. */
1903};
1904
1905/* Actions property */
1906message ofp_table_feature_prop_actions {
1907 /* One of OFPTFPT_WRITE_ACTIONS,
1908 OFPTFPT_WRITE_ACTIONS_MISS,
1909 OFPTFPT_APPLY_ACTIONS,
1910 OFPTFPT_APPLY_ACTIONS_MISS. */
1911 repeated ofp_action actions = 1; /* List of actions */
1912};
1913
1914/* Match, Wildcard or Set-Field property */
1915message ofp_table_feature_prop_oxm {
1916 /* One of OFPTFPT_MATCH,
1917 OFPTFPT_WILDCARDS,
1918 OFPTFPT_WRITE_SETFIELD,
1919 OFPTFPT_WRITE_SETFIELD_MISS,
1920 OFPTFPT_APPLY_SETFIELD,
1921 OFPTFPT_APPLY_SETFIELD_MISS. */
1922 /* TODO is this a uint32??? */
1923 repeated uint32 oxm_ids = 3; /* Array of OXM headers */
1924};
1925
1926/* Experimenter table feature property */
1927message ofp_table_feature_prop_experimenter {
1928 /* One of OFPTFPT_EXPERIMENTER,
1929 OFPTFPT_EXPERIMENTER_MISS. */
1930 uint32 experimenter = 2; /* Experimenter ID which takes the same
1931 form as in struct
1932 ofp_experimenter_header. */
1933 uint32 exp_type = 3; /* Experimenter defined. */
1934 repeated uint32 experimenter_data = 4;
1935};
1936
1937/* Body for ofp_multipart_request of type OFPMP_TABLE_FEATURES./
1938 * Body of reply to OFPMP_TABLE_FEATURES request. */
1939message ofp_table_features {
1940 uint32 table_id = 1; /* Identifier of table. Lower numbered tables
1941 are consulted first. */
1942 string name = 2;
1943 uint64 metadata_match = 3; /* Bits of metadata table can match. */
1944 uint64 metadata_write = 4; /* Bits of metadata table can write. */
1945 uint32 config = 5; /* Bitmap of OFPTC_* values */
1946 uint32 max_entries = 6; /* Max number of entries supported. */
1947
1948 /* Table Feature Property list */
1949 repeated ofp_table_feature_property properties = 7;
1950};
1951
1952/* Body of reply to OFPMP_TABLE request. */
1953message ofp_table_stats {
1954 uint32 table_id = 1; /* Identifier of table. Lower numbered tables
1955 are consulted first. */
1956 uint32 active_count = 2; /* Number of active entries. */
1957 uint64 lookup_count = 3; /* Number of packets looked up in table. */
1958 uint64 matched_count = 4; /* Number of packets that hit table. */
1959};
1960
1961/* Body for ofp_multipart_request of type OFPMP_PORT. */
1962message ofp_port_stats_request {
1963 uint32 port_no = 1; /* OFPMP_PORT message must request statistics
1964 * either for a single port (specified in
1965 * port_no) or for all ports (if port_no ==
1966 * OFPP_ANY). */
1967};
1968
1969/* Body of reply to OFPMP_PORT request. If a counter is unsupported, set
1970 * the field to all ones. */
1971message ofp_port_stats {
1972 uint32 port_no = 1;
1973 uint64 rx_packets = 2; /* Number of received packets. */
1974 uint64 tx_packets = 3; /* Number of transmitted packets. */
1975 uint64 rx_bytes = 4; /* Number of received bytes. */
1976 uint64 tx_bytes = 5; /* Number of transmitted bytes. */
1977 uint64 rx_dropped = 6; /* Number of packets dropped by RX. */
1978 uint64 tx_dropped = 7; /* Number of packets dropped by TX. */
1979 uint64 rx_errors = 8; /* Number of receive errors. This is a super-set
1980 of more specific receive errors and should be
1981 greater than or equal to the sum of all
1982 rx_*_err values. */
1983 uint64 tx_errors = 9; /* Number of transmit errors. This is a super-set
1984 of more specific transmit errors and should be
1985 greater than or equal to the sum of all
1986 tx_*_err values (none currently defined.) */
1987 uint64 rx_frame_err = 10; /* Number of frame alignment errors. */
1988 uint64 rx_over_err = 11; /* Number of packets with RX overrun. */
1989 uint64 rx_crc_err = 12; /* Number of CRC errors. */
1990 uint64 collisions = 13; /* Number of collisions. */
1991 uint32 duration_sec = 14; /* Time port has been alive in seconds. */
1992 uint32 duration_nsec = 15; /* Time port has been alive in nanoseconds
1993 beyond duration_sec. */
1994};
1995
1996/* Body of OFPMP_GROUP request. */
1997message ofp_group_stats_request {
1998 uint32 group_id = 1; /* All groups if OFPG_ALL. */
1999};
2000
2001/* Used in group stats replies. */
2002message ofp_bucket_counter {
2003 uint64 packet_count = 1; /* Number of packets processed by bucket. */
2004 uint64 byte_count = 2; /* Number of bytes processed by bucket. */
2005};
2006
2007/* Body of reply to OFPMP_GROUP request. */
2008message ofp_group_stats {
2009 uint32 group_id = 1; /* Group identifier. */
2010 uint32 ref_count = 2; /* Number of flows or groups that directly
2011 forward to this group. */
2012 uint64 packet_count = 3; /* Number of packets processed by group. */
2013 uint64 byte_count = 4; /* Number of bytes processed by group. */
2014 uint32 duration_sec = 5; /* Time group has been alive in seconds. */
2015 uint32 duration_nsec = 6; /* Time group has been alive in nanoseconds
2016 beyond duration_sec. */
2017 repeated ofp_bucket_counter bucket_stats = 7; /* One counter set per
2018 bucket. */
2019};
2020
2021/* Body of reply to OFPMP_GROUP_DESC request. */
2022message ofp_group_desc {
2023 ofp_group_type type = 1; /* One of OFPGT_*. */
2024 uint32 group_id = 2; /* Group identifier. */
2025 repeated ofp_bucket buckets = 3; /* List of buckets - 0 or more. */
2026};
2027
2028message ofp_group_entry {
2029 ofp_group_type type = 1; /* One of OFPGT_*. */
2030 uint32 group_id = 2; /* Group identifier. */
2031 repeated ofp_bucket buckets = 3; /* List of buckets - 0 or more. */
2032 /* ofp_group_desc desc = 1; */
2033 ofp_group_stats stats = 4;
2034};
2035
2036/* Backward compatibility with 1.3.1 - avoid breaking the API. */
2037//#define ofp_group_desc_stats ofp_group_desc
2038
2039/* Group configuration flags */
2040enum ofp_group_capabilities {
2041 OFPGFC_INVALID = 0;
2042 OFPGFC_SELECT_WEIGHT = 1; /* Support weight for select groups */
2043 OFPGFC_SELECT_LIVENESS = 2; /* Support liveness for select groups */
2044 OFPGFC_CHAINING = 4; /* Support chaining groups */
2045 OFPGFC_CHAINING_CHECKS = 8; /* Check chaining for loops and delete */
2046};
2047
2048/* Body of reply to OFPMP_GROUP_FEATURES request. Group features. */
2049message ofp_group_features {
2050 uint32 types = 1; /* Bitmap of (1 << OFPGT_*) values supported. */
2051 uint32 capabilities = 2; /* Bitmap of OFPGFC_* capability supported. */
2052 repeated uint32 max_groups = 3; /* Maximum number of groups for each type.
2053 */
2054 repeated uint32 actions = 4; /* Bitmaps of (1 << OFPAT_*) values
2055 supported. */
2056};
2057
2058/* Body of OFPMP_METER and OFPMP_METER_CONFIG requests. */
2059message ofp_meter_multipart_request {
2060 uint32 meter_id = 1; /* Meter instance, or OFPM_ALL. */
2061};
2062
2063/* Statistics for each meter band */
2064message ofp_meter_band_stats {
2065 uint64 packet_band_count = 1; /* Number of packets in band. */
2066 uint64 byte_band_count = 2; /* Number of bytes in band. */
2067};
2068
2069/* Body of reply to OFPMP_METER request. Meter statistics. */
2070message ofp_meter_stats {
2071 uint32 meter_id = 1; /* Meter instance. */
2072 uint32 flow_count = 2; /* Number of flows bound to meter. */
2073 uint64 packet_in_count = 3; /* Number of packets in input. */
2074 uint64 byte_in_count = 4; /* Number of bytes in input. */
2075 uint32 duration_sec = 5; /* Time meter has been alive in seconds. */
2076 uint32 duration_nsec = 6;/* Time meter has been alive in nanoseconds
2077 beyond duration_sec. */
2078 repeated ofp_meter_band_stats band_stats = 7; /* The band_stats length is
2079 inferred from the length field. */
2080};
2081
2082/* Body of reply to OFPMP_METER_CONFIG request. Meter configuration. */
2083message ofp_meter_config {
2084 uint32 flags = 1; /* All OFPMF_* that apply. */
2085 uint32 meter_id = 2; /* Meter instance. */
2086 repeated ofp_meter_band_header bands = 3; /* The bands length is
2087 inferred from the length field. */
2088};
2089
2090/* Body of reply to OFPMP_METER_FEATURES request. Meter features. */
2091message ofp_meter_features {
2092 uint32 max_meter = 1; /* Maximum number of meters. */
2093 uint32 band_types = 2; /* Bitmaps of (1 << OFPMBT_*) values supported.
2094 */
2095 uint32 capabilities = 3; /* Bitmaps of "ofp_meter_flags". */
2096 uint32 max_bands = 4; /* Maximum bands per meters */
2097 uint32 max_color = 5; /* Maximum color value */
2098};
2099
2100/* Body for ofp_multipart_request/reply of type OFPMP_EXPERIMENTER. */
2101message ofp_experimenter_multipart_header {
2102 uint32 experimenter = 1; /* Experimenter ID which takes the same form
2103 as in struct ofp_experimenter_header. */
2104 uint32 exp_type = 2; /* Experimenter defined. */
2105 bytes data = 3; /* Experimenter-defined arbitrary additional data. */
2106};
2107
2108/* Experimenter extension. */
2109message ofp_experimenter_header {
2110 //ofp_header header; /* Type OFPT_EXPERIMENTER. */
2111 uint32 experimenter = 1; /* Experimenter ID:
2112 * - MSB 0: low-order bytes are IEEE OUI.
2113 * - MSB != 0: defined by ONF. */
2114 uint32 exp_type = 2; /* Experimenter defined. */
2115 bytes data = 3; /* Experimenter-defined arbitrary additional data. */
2116};
2117
2118/* All ones is used to indicate all queues in a port (for stats retrieval). */
2119//#define OFPQ_ALL 0xffffffff
2120
2121/* Min rate > 1000 means not configured. */
2122//#define OFPQ_MIN_RATE_UNCFG 0xffff
2123
2124/* Max rate > 1000 means not configured. */
2125//#define OFPQ_MAX_RATE_UNCFG 0xffff
2126
2127enum ofp_queue_properties {
2128 OFPQT_INVALID = 0;
2129 OFPQT_MIN_RATE = 1; /* Minimum datarate guaranteed. */
2130 OFPQT_MAX_RATE = 2; /* Maximum datarate. */
2131 OFPQT_EXPERIMENTER = 0xffff; /* Experimenter defined property. */
2132};
2133
2134/* Common description for a queue. */
2135message ofp_queue_prop_header {
2136 uint32 property = 1; /* One of OFPQT_. */
2137 uint32 len = 2; /* Length of property, including this header. */
2138};
2139
2140/* Min-Rate queue property description. */
2141message ofp_queue_prop_min_rate {
2142 ofp_queue_prop_header prop_header = 1;/* prop: OFPQT_MIN, len: 16. */
2143 uint32 rate = 2; /* In 1/10 of a percent = 0;>1000 -> disabled. */
2144};
2145
2146/* Max-Rate queue property description. */
2147message ofp_queue_prop_max_rate {
2148 ofp_queue_prop_header prop_header = 1;/* prop: OFPQT_MAX, len: 16. */
2149 uint32 rate = 2; /* In 1/10 of a percent = 0;>1000 -> disabled. */
2150};
2151
2152/* Experimenter queue property description. */
2153message ofp_queue_prop_experimenter {
2154 ofp_queue_prop_header prop_header = 1;/* prop: OFPQT_EXPERIMENTER */
2155 uint32 experimenter = 2; /* Experimenter ID which takes the same
2156 form as in struct
2157 ofp_experimenter_header. */
2158 bytes data = 3; /* Experimenter defined data. */
2159};
2160
2161/* Full description for a queue. */
2162message ofp_packet_queue {
2163 uint32 queue_id = 1; /* id for the specific queue. */
2164 uint32 port = 2; /* Port this queue is attached to. */
2165 repeated ofp_queue_prop_header properties = 4; /* List of properties. */
2166};
2167
2168/* Query for port queue configuration. */
2169message ofp_queue_get_config_request {
2170 //ofp_header header;
2171 uint32 port = 1; /* Port to be queried. Should refer
2172 to a valid physical port (i.e. <= OFPP_MAX),
2173 or OFPP_ANY to request all configured
2174 queues.*/
2175};
2176
2177/* Queue configuration for a given port. */
2178message ofp_queue_get_config_reply {
2179 //ofp_header header;
2180 uint32 port = 1;
2181 repeated ofp_packet_queue queues = 2; /* List of configured queues. */
2182};
2183
2184/* OFPAT_SET_QUEUE action struct: send packets to given queue on port. */
2185message ofp_action_set_queue {
2186 uint32 type = 1; /* OFPAT_SET_QUEUE. */
2187 uint32 queue_id = 3; /* Queue id for the packets. */
2188};
2189
2190message ofp_queue_stats_request {
2191 uint32 port_no = 1; /* All ports if OFPP_ANY. */
2192 uint32 queue_id = 2; /* All queues if OFPQ_ALL. */
2193};
2194
2195message ofp_queue_stats {
2196 uint32 port_no = 1;
2197 uint32 queue_id = 2; /* Queue i.d */
2198 uint64 tx_bytes = 3; /* Number of transmitted bytes. */
2199 uint64 tx_packets = 4; /* Number of transmitted packets. */
2200 uint64 tx_errors = 5; /* Number of packets dropped due to overrun. */
2201 uint32 duration_sec = 6; /* Time queue has been alive in seconds. */
2202 uint32 duration_nsec = 7; /* Time queue has been alive in nanoseconds
2203 beyond duration_sec. */
2204};
2205
2206/* Configures the "role" of the sending controller. The default role is:
2207 *
2208 * - Equal (OFPCR_ROLE_EQUAL), which allows the controller access to all
2209 * OpenFlow features. All controllers have equal responsibility.
2210 *
2211 * The other possible roles are a related pair:
2212 *
2213 * - Master (OFPCR_ROLE_MASTER) is equivalent to Equal, except that there
2214 * may be at most one Master controller at a time: when a controller
2215 * configures itself as Master, any existing Master is demoted to the
2216 * Slave role.
2217 *
2218 * - Slave (OFPCR_ROLE_SLAVE) allows the controller read-only access to
2219 * OpenFlow features. In particular attempts to modify the flow table
2220 * will be rejected with an OFPBRC_EPERM error.
2221 *
2222 * Slave controllers do not receive OFPT_PACKET_IN or OFPT_FLOW_REMOVED
2223 * messages, but they do receive OFPT_PORT_STATUS messages.
2224 */
2225
2226/* Controller roles. */
2227enum ofp_controller_role {
2228 OFPCR_ROLE_NOCHANGE = 0; /* Don't change current role. */
2229 OFPCR_ROLE_EQUAL = 1; /* Default role, full access. */
2230 OFPCR_ROLE_MASTER = 2; /* Full access, at most one master. */
2231 OFPCR_ROLE_SLAVE = 3; /* Read-only access. */
2232};
2233
2234/* Role request and reply message. */
2235message ofp_role_request {
2236 //ofp_header header; /* Type OFPT_ROLE_REQUEST/OFPT_ROLE_REPLY. */
2237 ofp_controller_role role = 1; /* One of OFPCR_ROLE_*. */
2238 uint64 generation_id = 2; /* Master Election Generation Id */
2239};
2240
2241/* Asynchronous message configuration. */
2242message ofp_async_config {
2243 //ofp_header header; /* OFPT_GET_ASYNC_REPLY or OFPT_SET_ASYNC. */
2244 repeated uint32 packet_in_mask = 1; /* Bitmasks of OFPR_* values. */
2245 repeated uint32 port_status_mask = 2; /* Bitmasks of OFPPR_* values. */
2246 repeated uint32 flow_removed_mask = 3;/* Bitmasks of OFPRR_* values. */
2247};
2248
2249
2250/* ADDITIONAL VOLTHA SPECIFIC MESSAGE TYPES, AIDING RPC CALLS */
2251
2252message FlowTableUpdate {
2253 string id = 1; // Device.id or LogicalDevice.id
2254 ofp_flow_mod flow_mod = 2;
2255}
2256
2257message FlowGroupTableUpdate {
2258 string id = 1; // Device.id or LogicalDevice.id
2259 ofp_group_mod group_mod = 2;
2260}
2261
2262message Flows {
2263 repeated ofp_flow_stats items = 1;
2264}
2265
2266message FlowGroups {
2267 repeated ofp_group_entry items = 1;
2268}
2269
2270message PacketIn {
2271 string id = 1; // LogicalDevice.id
2272 ofp_packet_in packet_in = 2;
2273}
2274
2275message PacketOut {
2276 string id = 1; // LogicalDevice.id
2277 ofp_packet_out packet_out = 2;
2278}