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