blob: 47d881b8f4cfc72f0d92df1a73b602c14d18808f [file] [log] [blame]
khenaidooabad44c2018-08-03 16:58:35 -04001/* 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-go/protos/openflow_13";
61
62package openflow_13;
63
64import "google/api/annotations.proto";
65import public "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 len = 2; /* Length in bytes of this band. */
1358 uint32 rate = 3; /* Rate for this band. */
1359 uint32 burst_size = 4;/* Size of bursts. */
1360};
1361
1362/* OFPMBT_DROP band - drop packets */
1363message ofp_meter_band_drop {
1364 uint32 type = 1; /* OFPMBT_DROP. */
1365 uint32 len = 2; /* Length in bytes of this band. */
1366 uint32 rate = 3; /* Rate for dropping packets. */
1367 uint32 burst_size = 4;/* Size of bursts. */
1368};
1369
1370/* OFPMBT_DSCP_REMARK band - Remark DSCP in the IP header */
1371message ofp_meter_band_dscp_remark {
1372 uint32 type = 1; /* OFPMBT_DSCP_REMARK. */
1373 uint32 len = 2; /* Length in bytes of this band. */
1374 uint32 rate = 3; /* Rate for remarking packets. */
1375 uint32 burst_size = 4; /* Size of bursts. */
1376 uint32 prec_level = 5; /* Number of drop precedence level to add. */
1377};
1378
1379/* OFPMBT_EXPERIMENTER band - Experimenter type.
1380 * The rest of the band is experimenter-defined. */
1381message ofp_meter_band_experimenter {
1382 ofp_meter_band_type type = 1; /* One of OFPMBT_*. */
1383 uint32 len = 2; /* Length in bytes of this band. */
1384 uint32 rate = 3; /* Rate for this band. */
1385 uint32 burst_size = 4; /* Size of bursts. */
1386 uint32 experimenter = 5;/* Experimenter ID which takes the
1387 same form as in struct
1388 ofp_experimenter_header. */
1389};
1390
1391/* Meter commands */
1392enum ofp_meter_mod_command {
1393 OFPMC_ADD = 0; /* New meter. */
1394 OFPMC_MODIFY = 1; /* Modify specified meter. */
1395 OFPMC_DELETE = 2; /* Delete specified meter. */
1396};
1397
1398/* Meter configuration flags */
1399enum ofp_meter_flags {
1400 OFPMF_INVALID = 0;
1401 OFPMF_KBPS = 1; /* Rate value in kb/s (kilo-bit per second). */
1402 OFPMF_PKTPS = 2; /* Rate value in packet/sec. */
1403 OFPMF_BURST = 4; /* Do burst size. */
1404 OFPMF_STATS = 8; /* Collect statistics. */
1405};
1406
1407/* Meter configuration. OFPT_METER_MOD. */
1408message ofp_meter_mod {
1409// ofp_header header = 1;
1410 ofp_meter_mod_command command = 1; /* One of OFPMC_*. */
1411 uint32 flags = 2; /* Bitmap of OFPMF_* flags. */
1412 uint32 meter_id = 3; /* Meter instance. */
1413 repeated ofp_meter_band_header bands = 4; /* The band list length is
1414 inferred from the length field
1415 in the header. */
1416};
1417
1418/* Values for 'type' in ofp_error_message. These values are immutable: they
1419 * will not change in future versions of the protocol (although new values may
1420 * be added). */
1421enum ofp_error_type {
1422 OFPET_HELLO_FAILED = 0; /* Hello protocol failed. */
1423 OFPET_BAD_REQUEST = 1; /* Request was not understood. */
1424 OFPET_BAD_ACTION = 2; /* Error in action description. */
1425 OFPET_BAD_INSTRUCTION = 3; /* Error in instruction list. */
1426 OFPET_BAD_MATCH = 4; /* Error in match. */
1427 OFPET_FLOW_MOD_FAILED = 5; /* Problem modifying flow entry. */
1428 OFPET_GROUP_MOD_FAILED = 6; /* Problem modifying group entry. */
1429 OFPET_PORT_MOD_FAILED = 7; /* Port mod request failed. */
1430 OFPET_TABLE_MOD_FAILED = 8; /* Table mod request failed. */
1431 OFPET_QUEUE_OP_FAILED = 9; /* Queue operation failed. */
1432 OFPET_SWITCH_CONFIG_FAILED = 10; /* Switch config request failed. */
1433 OFPET_ROLE_REQUEST_FAILED = 11; /* Controller Role request failed. */
1434 OFPET_METER_MOD_FAILED = 12; /* Error in meter. */
1435 OFPET_TABLE_FEATURES_FAILED = 13; /* Setting table features failed. */
1436 OFPET_EXPERIMENTER = 0xffff; /* Experimenter error messages. */
1437};
1438
1439/* ofp_error_msg 'code' values for OFPET_HELLO_FAILED. 'data' contains an
1440 * ASCII text string that may give failure details. */
1441enum ofp_hello_failed_code {
1442 OFPHFC_INCOMPATIBLE = 0; /* No compatible version. */
1443 OFPHFC_EPERM = 1; /* Permissions error. */
1444};
1445
1446/* ofp_error_msg 'code' values for OFPET_BAD_REQUEST. 'data' contains at least
1447 * the first 64 bytes of the failed request. */
1448enum ofp_bad_request_code {
1449 OFPBRC_BAD_VERSION = 0; /* ofp_header.version not supported. */
1450 OFPBRC_BAD_TYPE = 1; /* ofp_header.type not supported. */
1451 OFPBRC_BAD_MULTIPART = 2; /* ofp_multipart_request.type not supported.
1452 */
1453 OFPBRC_BAD_EXPERIMENTER = 3; /* Experimenter id not supported
1454 * (in ofp_experimenter_header or
1455 * ofp_multipart_request or
1456 * ofp_multipart_reply). */
1457 OFPBRC_BAD_EXP_TYPE = 4; /* Experimenter type not supported. */
1458 OFPBRC_EPERM = 5; /* Permissions error. */
1459 OFPBRC_BAD_LEN = 6; /* Wrong request length for type. */
1460 OFPBRC_BUFFER_EMPTY = 7; /* Specified buffer has already been used. */
1461 OFPBRC_BUFFER_UNKNOWN = 8; /* Specified buffer does not exist. */
1462 OFPBRC_BAD_TABLE_ID = 9; /* Specified table-id invalid or does not
1463 * exist. */
1464 OFPBRC_IS_SLAVE = 10; /* Denied because controller is slave. */
1465 OFPBRC_BAD_PORT = 11; /* Invalid port. */
1466 OFPBRC_BAD_PACKET = 12; /* Invalid packet in packet-out. */
1467 OFPBRC_MULTIPART_BUFFER_OVERFLOW = 13; /* ofp_multipart_request
1468 overflowed the assigned buffer. */
1469};
1470
1471/* ofp_error_msg 'code' values for OFPET_BAD_ACTION. 'data' contains at least
1472 * the first 64 bytes of the failed request. */
1473enum ofp_bad_action_code {
1474 OFPBAC_BAD_TYPE = 0; /* Unknown or unsupported action type. */
1475 OFPBAC_BAD_LEN = 1; /* Length problem in actions. */
1476 OFPBAC_BAD_EXPERIMENTER = 2; /* Unknown experimenter id specified. */
1477 OFPBAC_BAD_EXP_TYPE = 3; /* Unknown action for experimenter id. */
1478 OFPBAC_BAD_OUT_PORT = 4; /* Problem validating output port. */
1479 OFPBAC_BAD_ARGUMENT = 5; /* Bad action argument. */
1480 OFPBAC_EPERM = 6; /* Permissions error. */
1481 OFPBAC_TOO_MANY = 7; /* Can't handle this many actions. */
1482 OFPBAC_BAD_QUEUE = 8; /* Problem validating output queue. */
1483 OFPBAC_BAD_OUT_GROUP = 9; /* Invalid group id in forward action. */
1484 OFPBAC_MATCH_INCONSISTENT = 10; /* Action can't apply for this match,
1485 or Set-Field missing prerequisite. */
1486 OFPBAC_UNSUPPORTED_ORDER = 11; /* Action order is unsupported for the
1487 action list in an Apply-Actions instruction */
1488 OFPBAC_BAD_TAG = 12; /* Actions uses an unsupported
1489 tag/encap. */
1490 OFPBAC_BAD_SET_TYPE = 13; /* Unsupported type in SET_FIELD action. */
1491 OFPBAC_BAD_SET_LEN = 14; /* Length problem in SET_FIELD action. */
1492 OFPBAC_BAD_SET_ARGUMENT = 15; /* Bad argument in SET_FIELD action. */
1493};
1494
1495/* ofp_error_msg 'code' values for OFPET_BAD_INSTRUCTION. 'data' contains at
1496 * least the first 64 bytes of the failed request. */
1497enum ofp_bad_instruction_code {
1498 OFPBIC_UNKNOWN_INST = 0; /* Unknown instruction. */
1499 OFPBIC_UNSUP_INST = 1; /* Switch or table does not support the
1500 instruction. */
1501 OFPBIC_BAD_TABLE_ID = 2; /* Invalid Table-ID specified. */
1502 OFPBIC_UNSUP_METADATA = 3; /* Metadata value unsupported by datapath. */
1503 OFPBIC_UNSUP_METADATA_MASK = 4; /* Metadata mask value unsupported by
1504 datapath. */
1505 OFPBIC_BAD_EXPERIMENTER = 5; /* Unknown experimenter id specified. */
1506 OFPBIC_BAD_EXP_TYPE = 6; /* Unknown instruction for experimenter id. */
1507 OFPBIC_BAD_LEN = 7; /* Length problem in instructions. */
1508 OFPBIC_EPERM = 8; /* Permissions error. */
1509};
1510
1511/* ofp_error_msg 'code' values for OFPET_BAD_MATCH. 'data' contains at least
1512 * the first 64 bytes of the failed request. */
1513enum ofp_bad_match_code {
1514 OFPBMC_BAD_TYPE = 0; /* Unsupported match type specified by the
1515 match */
1516 OFPBMC_BAD_LEN = 1; /* Length problem in match. */
1517 OFPBMC_BAD_TAG = 2; /* Match uses an unsupported tag/encap. */
1518 OFPBMC_BAD_DL_ADDR_MASK = 3; /* Unsupported datalink addr mask - switch
1519 does not support arbitrary datalink
1520 address mask. */
1521 OFPBMC_BAD_NW_ADDR_MASK = 4; /* Unsupported network addr mask - switch
1522 does not support arbitrary network
1523 address mask. */
1524 OFPBMC_BAD_WILDCARDS = 5; /* Unsupported combination of fields masked
1525 or omitted in the match. */
1526 OFPBMC_BAD_FIELD = 6; /* Unsupported field type in the match. */
1527 OFPBMC_BAD_VALUE = 7; /* Unsupported value in a match field. */
1528 OFPBMC_BAD_MASK = 8; /* Unsupported mask specified in the match,
1529 field is not dl-address or nw-address. */
1530 OFPBMC_BAD_PREREQ = 9; /* A prerequisite was not met. */
1531 OFPBMC_DUP_FIELD = 10; /* A field type was duplicated. */
1532 OFPBMC_EPERM = 11; /* Permissions error. */
1533};
1534
1535/* ofp_error_msg 'code' values for OFPET_FLOW_MOD_FAILED. 'data' contains
1536 * at least the first 64 bytes of the failed request. */
1537enum ofp_flow_mod_failed_code {
1538 OFPFMFC_UNKNOWN = 0; /* Unspecified error. */
1539 OFPFMFC_TABLE_FULL = 1; /* Flow not added because table was full. */
1540 OFPFMFC_BAD_TABLE_ID = 2; /* Table does not exist */
1541 OFPFMFC_OVERLAP = 3; /* Attempted to add overlapping flow with
1542 CHECK_OVERLAP flag set. */
1543 OFPFMFC_EPERM = 4; /* Permissions error. */
1544 OFPFMFC_BAD_TIMEOUT = 5; /* Flow not added because of unsupported
1545 idle/hard timeout. */
1546 OFPFMFC_BAD_COMMAND = 6; /* Unsupported or unknown command. */
1547 OFPFMFC_BAD_FLAGS = 7; /* Unsupported or unknown flags. */
1548};
1549
1550/* ofp_error_msg 'code' values for OFPET_GROUP_MOD_FAILED. 'data' contains
1551 * at least the first 64 bytes of the failed request. */
1552enum ofp_group_mod_failed_code {
1553 OFPGMFC_GROUP_EXISTS = 0; /* Group not added because a group ADD
1554 attempted to replace an
1555 already-present group. */
1556 OFPGMFC_INVALID_GROUP = 1; /* Group not added because Group
1557 specified is invalid. */
1558 OFPGMFC_WEIGHT_UNSUPPORTED = 2; /* Switch does not support unequal load
1559 sharing with select groups. */
1560 OFPGMFC_OUT_OF_GROUPS = 3; /* The group table is full. */
1561 OFPGMFC_OUT_OF_BUCKETS = 4; /* The maximum number of action buckets
1562 for a group has been exceeded. */
1563 OFPGMFC_CHAINING_UNSUPPORTED = 5; /* Switch does not support groups that
1564 forward to groups. */
1565 OFPGMFC_WATCH_UNSUPPORTED = 6; /* This group cannot watch the
1566 watch_port or watch_group specified.
1567 */
1568 OFPGMFC_LOOP = 7; /* Group entry would cause a loop. */
1569 OFPGMFC_UNKNOWN_GROUP = 8; /* Group not modified because a group
1570 MODIFY attempted to modify a
1571 non-existent group. */
1572 OFPGMFC_CHAINED_GROUP = 9; /* Group not deleted because another
1573 group is forwarding to it. */
1574 OFPGMFC_BAD_TYPE = 10; /* Unsupported or unknown group type. */
1575 OFPGMFC_BAD_COMMAND = 11; /* Unsupported or unknown command. */
1576 OFPGMFC_BAD_BUCKET = 12; /* Error in bucket. */
1577 OFPGMFC_BAD_WATCH = 13; /* Error in watch port/group. */
1578 OFPGMFC_EPERM = 14; /* Permissions error. */
1579};
1580
1581/* ofp_error_msg 'code' values for OFPET_PORT_MOD_FAILED. 'data' contains
1582 * at least the first 64 bytes of the failed request. */
1583enum ofp_port_mod_failed_code {
1584 OFPPMFC_BAD_PORT = 0; /* Specified port number does not exist. */
1585 OFPPMFC_BAD_HW_ADDR = 1; /* Specified hardware address does not
1586 * match the port number. */
1587 OFPPMFC_BAD_CONFIG = 2; /* Specified config is invalid. */
1588 OFPPMFC_BAD_ADVERTISE = 3; /* Specified advertise is invalid. */
1589 OFPPMFC_EPERM = 4; /* Permissions error. */
1590};
1591
1592/* ofp_error_msg 'code' values for OFPET_TABLE_MOD_FAILED. 'data' contains
1593 * at least the first 64 bytes of the failed request. */
1594enum ofp_table_mod_failed_code {
1595 OFPTMFC_BAD_TABLE = 0; /* Specified table does not exist. */
1596 OFPTMFC_BAD_CONFIG = 1; /* Specified config is invalid. */
1597 OFPTMFC_EPERM = 2; /* Permissions error. */
1598};
1599
1600/* ofp_error msg 'code' values for OFPET_QUEUE_OP_FAILED. 'data' contains
1601 * at least the first 64 bytes of the failed request */
1602enum ofp_queue_op_failed_code {
1603 OFPQOFC_BAD_PORT = 0; /* Invalid port (or port does not exist). */
1604 OFPQOFC_BAD_QUEUE = 1; /* Queue does not exist. */
1605 OFPQOFC_EPERM = 2; /* Permissions error. */
1606};
1607
1608/* ofp_error_msg 'code' values for OFPET_SWITCH_CONFIG_FAILED. 'data' contains
1609 * at least the first 64 bytes of the failed request. */
1610enum ofp_switch_config_failed_code {
1611 OFPSCFC_BAD_FLAGS = 0; /* Specified flags is invalid. */
1612 OFPSCFC_BAD_LEN = 1; /* Specified len is invalid. */
1613 OFPSCFC_EPERM = 2; /* Permissions error. */
1614};
1615
1616/* ofp_error_msg 'code' values for OFPET_ROLE_REQUEST_FAILED. 'data' contains
1617 * at least the first 64 bytes of the failed request. */
1618enum ofp_role_request_failed_code {
1619 OFPRRFC_STALE = 0; /* Stale Message: old generation_id. */
1620 OFPRRFC_UNSUP = 1; /* Controller role change unsupported. */
1621 OFPRRFC_BAD_ROLE = 2; /* Invalid role. */
1622};
1623
1624/* ofp_error_msg 'code' values for OFPET_METER_MOD_FAILED. 'data' contains
1625 * at least the first 64 bytes of the failed request. */
1626enum ofp_meter_mod_failed_code {
1627 OFPMMFC_UNKNOWN = 0; /* Unspecified error. */
1628 OFPMMFC_METER_EXISTS = 1; /* Meter not added because a Meter ADD
1629 * attempted to replace an existing Meter. */
1630 OFPMMFC_INVALID_METER = 2; /* Meter not added because Meter specified
1631 * is invalid,
1632 * or invalid meter in meter action. */
1633 OFPMMFC_UNKNOWN_METER = 3; /* Meter not modified because a Meter MODIFY
1634 * attempted to modify a non-existent Meter,
1635 * or bad meter in meter action. */
1636 OFPMMFC_BAD_COMMAND = 4; /* Unsupported or unknown command. */
1637 OFPMMFC_BAD_FLAGS = 5; /* Flag configuration unsupported. */
1638 OFPMMFC_BAD_RATE = 6; /* Rate unsupported. */
1639 OFPMMFC_BAD_BURST = 7; /* Burst size unsupported. */
1640 OFPMMFC_BAD_BAND = 8; /* Band unsupported. */
1641 OFPMMFC_BAD_BAND_VALUE = 9; /* Band value unsupported. */
1642 OFPMMFC_OUT_OF_METERS = 10; /* No more meters available. */
1643 OFPMMFC_OUT_OF_BANDS = 11; /* The maximum number of properties
1644 * for a meter has been exceeded. */
1645};
1646
1647/* ofp_error_msg 'code' values for OFPET_TABLE_FEATURES_FAILED. 'data' contains
1648 * at least the first 64 bytes of the failed request. */
1649enum ofp_table_features_failed_code {
1650 OFPTFFC_BAD_TABLE = 0; /* Specified table does not exist. */
1651 OFPTFFC_BAD_METADATA = 1; /* Invalid metadata mask. */
1652 OFPTFFC_BAD_TYPE = 2; /* Unknown property type. */
1653 OFPTFFC_BAD_LEN = 3; /* Length problem in properties. */
1654 OFPTFFC_BAD_ARGUMENT = 4; /* Unsupported property value. */
1655 OFPTFFC_EPERM = 5; /* Permissions error. */
1656};
1657
1658/* OFPT_ERROR: Error message (datapath -> controller). */
1659message ofp_error_msg {
1660 //ofp_header header;
1661 uint32 type = 1;
1662 uint32 code = 2;
1663 bytes data = 3; /* Variable-length data. Interpreted based
1664 on the type and code. No padding. */
1665};
1666
1667/* OFPET_EXPERIMENTER: Error message (datapath -> controller). */
1668message ofp_error_experimenter_msg {
1669 //ofp_header header;
1670
1671 uint32 type = 1; /* OFPET_EXPERIMENTER. */
1672 uint32 exp_type = 2; /* Experimenter defined. */
1673 uint32 experimenter = 3; /* Experimenter ID which takes the same form
1674 as in struct ofp_experimenter_header. */
1675 bytes data = 4; /* Variable-length data. Interpreted based
1676 on the type and code. No padding. */
1677};
1678
1679enum ofp_multipart_type {
1680 /* Description of this OpenFlow switch.
1681 * The request body is empty.
1682 * The reply body is struct ofp_desc. */
1683 OFPMP_DESC = 0;
1684
1685 /* Individual flow statistics.
1686 * The request body is struct ofp_flow_stats_request.
1687 * The reply body is an array of struct ofp_flow_stats. */
1688 OFPMP_FLOW = 1;
1689
1690 /* Aggregate flow statistics.
1691 * The request body is struct ofp_aggregate_stats_request.
1692 * The reply body is struct ofp_aggregate_stats_reply. */
1693 OFPMP_AGGREGATE = 2;
1694
1695 /* Flow table statistics.
1696 * The request body is empty.
1697 * The reply body is an array of struct ofp_table_stats. */
1698 OFPMP_TABLE = 3;
1699
1700 /* Port statistics.
1701 * The request body is struct ofp_port_stats_request.
1702 * The reply body is an array of struct ofp_port_stats. */
1703 OFPMP_PORT_STATS = 4;
1704
1705 /* Queue statistics for a port
1706 * The request body is struct ofp_queue_stats_request.
1707 * The reply body is an array of struct ofp_queue_stats */
1708 OFPMP_QUEUE = 5;
1709
1710 /* Group counter statistics.
1711 * The request body is struct ofp_group_stats_request.
1712 * The reply is an array of struct ofp_group_stats. */
1713 OFPMP_GROUP = 6;
1714
1715 /* Group description.
1716 * The request body is empty.
1717 * The reply body is an array of struct ofp_group_desc. */
1718 OFPMP_GROUP_DESC = 7;
1719
1720 /* Group features.
1721 * The request body is empty.
1722 * The reply body is struct ofp_group_features. */
1723 OFPMP_GROUP_FEATURES = 8;
1724
1725 /* Meter statistics.
1726 * The request body is struct ofp_meter_multipart_requests.
1727 * The reply body is an array of struct ofp_meter_stats. */
1728 OFPMP_METER = 9;
1729
1730 /* Meter configuration.
1731 * The request body is struct ofp_meter_multipart_requests.
1732 * The reply body is an array of struct ofp_meter_config. */
1733 OFPMP_METER_CONFIG = 10;
1734
1735 /* Meter features.
1736 * The request body is empty.
1737 * The reply body is struct ofp_meter_features. */
1738 OFPMP_METER_FEATURES = 11;
1739
1740 /* Table features.
1741 * The request body is either empty or contains an array of
1742 * struct ofp_table_features containing the controller's
1743 * desired view of the switch. If the switch is unable to
1744 * set the specified view an error is returned.
1745 * The reply body is an array of struct ofp_table_features. */
1746 OFPMP_TABLE_FEATURES = 12;
1747
1748 /* Port description.
1749 * The request body is empty.
1750 * The reply body is an array of struct ofp_port. */
1751 OFPMP_PORT_DESC = 13;
1752
1753 /* Experimenter extension.
1754 * The request and reply bodies begin with
1755 * struct ofp_experimenter_multipart_header.
1756 * The request and reply bodies are otherwise experimenter-defined. */
1757 OFPMP_EXPERIMENTER = 0xffff;
1758};
1759
1760/* Backward compatibility with 1.3.1 - avoid breaking the API. */
1761//#define ofp_multipart_types ofp_multipart_type
1762
1763enum ofp_multipart_request_flags {
1764 OFPMPF_REQ_INVALID = 0;
1765 OFPMPF_REQ_MORE = 1; /* More requests to follow. */
1766};
1767
1768message ofp_multipart_request {
1769 //ofp_header header;
1770 ofp_multipart_type type = 1; /* One of the OFPMP_* constants. */
1771 uint32 flags = 2; /* OFPMPF_REQ_* flags. */
1772 bytes body = 3; /* Body of the request. 0 or more bytes. */
1773};
1774
1775enum ofp_multipart_reply_flags {
1776 OFPMPF_REPLY_INVALID = 0;
1777 OFPMPF_REPLY_MORE = 1; /* More replies to follow. */
1778};
1779
1780message ofp_multipart_reply {
1781 //ofp_header header;
1782 ofp_multipart_type type = 1; /* One of the OFPMP_* constants. */
1783 uint32 flags = 2; /* OFPMPF_REPLY_* flags. */
1784 bytes body = 3; /* Body of the reply. 0 or more bytes. */
1785};
1786
1787//#define DESC_STR_LEN 256
1788//#define SERIAL_NUM_LEN 32
1789/* Body of reply to OFPMP_DESC request. Each entry is a NULL-terminated
1790 * ASCII string. */
1791message ofp_desc {
1792 string mfr_desc = 1; /* Manufacturer description. */
1793 string hw_desc = 2; /* Hardware description. */
1794 string sw_desc = 3; /* Software description. */
1795 string serial_num = 4; /* Serial number. */
1796 string dp_desc = 5; /* Human readable description of datapath. */
1797};
1798
1799/* Body for ofp_multipart_request of type OFPMP_FLOW. */
1800message ofp_flow_stats_request {
1801 uint32 table_id = 1; /* ID of table to read (from ofp_table_stats),
1802 OFPTT_ALL for all tables. */
1803 uint32 out_port = 2; /* Require matching entries to include this
1804 as an output port. A value of OFPP_ANY
1805 indicates no restriction. */
1806 uint32 out_group = 3; /* Require matching entries to include this
1807 as an output group. A value of OFPG_ANY
1808 indicates no restriction. */
1809 uint64 cookie = 4; /* Require matching entries to contain this
1810 cookie value */
1811 uint64 cookie_mask = 5; /* Mask used to restrict the cookie bits that
1812 must match. A value of 0 indicates
1813 no restriction. */
1814 ofp_match match = 6; /* Fields to match. Variable size. */
1815};
1816
1817/* Body of reply to OFPMP_FLOW request. */
1818message ofp_flow_stats {
1819 uint64 id = 14; /* Unique ID of flow within device. */
1820 uint32 table_id = 1; /* ID of table flow came from. */
1821 uint32 duration_sec = 2; /* Time flow has been alive in seconds. */
1822 uint32 duration_nsec = 3; /* Time flow has been alive in nanoseconds
1823 beyond duration_sec. */
1824 uint32 priority = 4; /* Priority of the entry. */
1825 uint32 idle_timeout = 5; /* Number of seconds idle before expiration. */
1826 uint32 hard_timeout = 6; /* Number of seconds before expiration. */
1827 uint32 flags = 7; /* Bitmap of OFPFF_* flags. */
1828 uint64 cookie = 8; /* Opaque controller-issued identifier. */
1829 uint64 packet_count = 9; /* Number of packets in flow. */
1830 uint64 byte_count = 10; /* Number of bytes in flow. */
1831 ofp_match match = 12; /* Description of fields. Variable size. */
1832 repeated ofp_instruction instructions = 13; /* Instruction set
1833 (0 or more) */
1834};
1835
1836/* Body for ofp_multipart_request of type OFPMP_AGGREGATE. */
1837message ofp_aggregate_stats_request {
1838 uint32 table_id = 1; /* ID of table to read (from ofp_table_stats)
1839 OFPTT_ALL for all tables. */
1840 uint32 out_port = 2; /* Require matching entries to include this
1841 as an output port. A value of OFPP_ANY
1842 indicates no restriction. */
1843 uint32 out_group = 3; /* Require matching entries to include this
1844 as an output group. A value of OFPG_ANY
1845 indicates no restriction. */
1846 uint64 cookie = 4; /* Require matching entries to contain this
1847 cookie value */
1848 uint64 cookie_mask = 5; /* Mask used to restrict the cookie bits that
1849 must match. A value of 0 indicates
1850 no restriction. */
1851 ofp_match match = 6; /* Fields to match. Variable size. */
1852};
1853
1854/* Body of reply to OFPMP_AGGREGATE request. */
1855message ofp_aggregate_stats_reply {
1856 uint64 packet_count = 1; /* Number of packets in flows. */
1857 uint64 byte_count = 2; /* Number of bytes in flows. */
1858 uint32 flow_count = 3; /* Number of flows. */
1859};
1860
1861/* Table Feature property types.
1862 * Low order bit cleared indicates a property for a regular Flow Entry.
1863 * Low order bit set indicates a property for the Table-Miss Flow Entry.
1864 */
1865enum ofp_table_feature_prop_type {
1866 OFPTFPT_INSTRUCTIONS = 0; /* Instructions property. */
1867 OFPTFPT_INSTRUCTIONS_MISS = 1; /* Instructions for table-miss. */
1868 OFPTFPT_NEXT_TABLES = 2; /* Next Table property. */
1869 OFPTFPT_NEXT_TABLES_MISS = 3; /* Next Table for table-miss. */
1870 OFPTFPT_WRITE_ACTIONS = 4; /* Write Actions property. */
1871 OFPTFPT_WRITE_ACTIONS_MISS = 5; /* Write Actions for table-miss. */
1872 OFPTFPT_APPLY_ACTIONS = 6; /* Apply Actions property. */
1873 OFPTFPT_APPLY_ACTIONS_MISS = 7; /* Apply Actions for table-miss. */
1874 OFPTFPT_MATCH = 8; /* Match property. */
1875 OFPTFPT_WILDCARDS = 10; /* Wildcards property. */
1876 OFPTFPT_WRITE_SETFIELD = 12; /* Write Set-Field property. */
1877 OFPTFPT_WRITE_SETFIELD_MISS = 13; /* Write Set-Field for table-miss. */
1878 OFPTFPT_APPLY_SETFIELD = 14; /* Apply Set-Field property. */
1879 OFPTFPT_APPLY_SETFIELD_MISS = 15; /* Apply Set-Field for table-miss. */
1880 OFPTFPT_EXPERIMENTER = 0xFFFE; /* Experimenter property. */
1881 OFPTFPT_EXPERIMENTER_MISS = 0xFFFF; /* Experimenter for table-miss. */
1882};
1883
1884/* Common header for all Table Feature Properties */
1885message ofp_table_feature_property {
1886 ofp_table_feature_prop_type type = 1; /* One of OFPTFPT_*. */
1887 oneof value {
1888 ofp_table_feature_prop_instructions instructions = 2;
1889 ofp_table_feature_prop_next_tables next_tables = 3;
1890 ofp_table_feature_prop_actions actions = 4;
1891 ofp_table_feature_prop_oxm oxm = 5;
1892 ofp_table_feature_prop_experimenter experimenter = 6;
1893 }
1894};
1895
1896/* Instructions property */
1897message ofp_table_feature_prop_instructions {
1898 /* One of OFPTFPT_INSTRUCTIONS,
1899 OFPTFPT_INSTRUCTIONS_MISS. */
1900 repeated ofp_instruction instructions = 1; /* List of instructions */
1901};
1902
1903/* Next Tables property */
1904message ofp_table_feature_prop_next_tables {
1905 /* One of OFPTFPT_NEXT_TABLES,
1906 OFPTFPT_NEXT_TABLES_MISS. */
1907 repeated uint32 next_table_ids = 1; /* List of table ids. */
1908};
1909
1910/* Actions property */
1911message ofp_table_feature_prop_actions {
1912 /* One of OFPTFPT_WRITE_ACTIONS,
1913 OFPTFPT_WRITE_ACTIONS_MISS,
1914 OFPTFPT_APPLY_ACTIONS,
1915 OFPTFPT_APPLY_ACTIONS_MISS. */
1916 repeated ofp_action actions = 1; /* List of actions */
1917};
1918
1919/* Match, Wildcard or Set-Field property */
1920message ofp_table_feature_prop_oxm {
1921 /* One of OFPTFPT_MATCH,
1922 OFPTFPT_WILDCARDS,
1923 OFPTFPT_WRITE_SETFIELD,
1924 OFPTFPT_WRITE_SETFIELD_MISS,
1925 OFPTFPT_APPLY_SETFIELD,
1926 OFPTFPT_APPLY_SETFIELD_MISS. */
1927 /* TODO is this a uint32??? */
1928 repeated uint32 oxm_ids = 3; /* Array of OXM headers */
1929};
1930
1931/* Experimenter table feature property */
1932message ofp_table_feature_prop_experimenter {
1933 /* One of OFPTFPT_EXPERIMENTER,
1934 OFPTFPT_EXPERIMENTER_MISS. */
1935 uint32 experimenter = 2; /* Experimenter ID which takes the same
1936 form as in struct
1937 ofp_experimenter_header. */
1938 uint32 exp_type = 3; /* Experimenter defined. */
1939 repeated uint32 experimenter_data = 4;
1940};
1941
1942/* Body for ofp_multipart_request of type OFPMP_TABLE_FEATURES./
1943 * Body of reply to OFPMP_TABLE_FEATURES request. */
1944message ofp_table_features {
1945 uint32 table_id = 1; /* Identifier of table. Lower numbered tables
1946 are consulted first. */
1947 string name = 2;
1948 uint64 metadata_match = 3; /* Bits of metadata table can match. */
1949 uint64 metadata_write = 4; /* Bits of metadata table can write. */
1950 uint32 config = 5; /* Bitmap of OFPTC_* values */
1951 uint32 max_entries = 6; /* Max number of entries supported. */
1952
1953 /* Table Feature Property list */
1954 repeated ofp_table_feature_property properties = 7;
1955};
1956
1957/* Body of reply to OFPMP_TABLE request. */
1958message ofp_table_stats {
1959 uint32 table_id = 1; /* Identifier of table. Lower numbered tables
1960 are consulted first. */
1961 uint32 active_count = 2; /* Number of active entries. */
1962 uint64 lookup_count = 3; /* Number of packets looked up in table. */
1963 uint64 matched_count = 4; /* Number of packets that hit table. */
1964};
1965
1966/* Body for ofp_multipart_request of type OFPMP_PORT. */
1967message ofp_port_stats_request {
1968 uint32 port_no = 1; /* OFPMP_PORT message must request statistics
1969 * either for a single port (specified in
1970 * port_no) or for all ports (if port_no ==
1971 * OFPP_ANY). */
1972};
1973
1974/* Body of reply to OFPMP_PORT request. If a counter is unsupported, set
1975 * the field to all ones. */
1976message ofp_port_stats {
1977 uint32 port_no = 1;
1978 uint64 rx_packets = 2; /* Number of received packets. */
1979 uint64 tx_packets = 3; /* Number of transmitted packets. */
1980 uint64 rx_bytes = 4; /* Number of received bytes. */
1981 uint64 tx_bytes = 5; /* Number of transmitted bytes. */
1982 uint64 rx_dropped = 6; /* Number of packets dropped by RX. */
1983 uint64 tx_dropped = 7; /* Number of packets dropped by TX. */
1984 uint64 rx_errors = 8; /* Number of receive errors. This is a super-set
1985 of more specific receive errors and should be
1986 greater than or equal to the sum of all
1987 rx_*_err values. */
1988 uint64 tx_errors = 9; /* Number of transmit errors. This is a super-set
1989 of more specific transmit errors and should be
1990 greater than or equal to the sum of all
1991 tx_*_err values (none currently defined.) */
1992 uint64 rx_frame_err = 10; /* Number of frame alignment errors. */
1993 uint64 rx_over_err = 11; /* Number of packets with RX overrun. */
1994 uint64 rx_crc_err = 12; /* Number of CRC errors. */
1995 uint64 collisions = 13; /* Number of collisions. */
1996 uint32 duration_sec = 14; /* Time port has been alive in seconds. */
1997 uint32 duration_nsec = 15; /* Time port has been alive in nanoseconds
1998 beyond duration_sec. */
1999};
2000
2001/* Body of OFPMP_GROUP request. */
2002message ofp_group_stats_request {
2003 uint32 group_id = 1; /* All groups if OFPG_ALL. */
2004};
2005
2006/* Used in group stats replies. */
2007message ofp_bucket_counter {
2008 uint64 packet_count = 1; /* Number of packets processed by bucket. */
2009 uint64 byte_count = 2; /* Number of bytes processed by bucket. */
2010};
2011
2012/* Body of reply to OFPMP_GROUP request. */
2013message ofp_group_stats {
2014 uint32 group_id = 1; /* Group identifier. */
2015 uint32 ref_count = 2; /* Number of flows or groups that directly
2016 forward to this group. */
2017 uint64 packet_count = 3; /* Number of packets processed by group. */
2018 uint64 byte_count = 4; /* Number of bytes processed by group. */
2019 uint32 duration_sec = 5; /* Time group has been alive in seconds. */
2020 uint32 duration_nsec = 6; /* Time group has been alive in nanoseconds
2021 beyond duration_sec. */
2022 repeated ofp_bucket_counter bucket_stats = 7; /* One counter set per
2023 bucket. */
2024};
2025
2026/* Body of reply to OFPMP_GROUP_DESC request. */
2027message ofp_group_desc {
2028 ofp_group_type type = 1; /* One of OFPGT_*. */
2029 uint32 group_id = 2; /* Group identifier. */
2030 repeated ofp_bucket buckets = 3; /* List of buckets - 0 or more. */
2031};
2032
2033message ofp_group_entry {
2034 ofp_group_desc desc = 1 [(voltha.yang_inline_node).id = 'desc',
2035 (voltha.yang_inline_node).type = 'openflow_13-ofp_group_desc'];
2036 ofp_group_stats stats = 2;
2037};
2038
2039/* Backward compatibility with 1.3.1 - avoid breaking the API. */
2040//#define ofp_group_desc_stats ofp_group_desc
2041
2042/* Group configuration flags */
2043enum ofp_group_capabilities {
2044 OFPGFC_INVALID = 0;
2045 OFPGFC_SELECT_WEIGHT = 1; /* Support weight for select groups */
2046 OFPGFC_SELECT_LIVENESS = 2; /* Support liveness for select groups */
2047 OFPGFC_CHAINING = 4; /* Support chaining groups */
2048 OFPGFC_CHAINING_CHECKS = 8; /* Check chaining for loops and delete */
2049};
2050
2051/* Body of reply to OFPMP_GROUP_FEATURES request. Group features. */
2052message ofp_group_features {
2053 uint32 types = 1; /* Bitmap of (1 << OFPGT_*) values supported. */
2054 uint32 capabilities = 2; /* Bitmap of OFPGFC_* capability supported. */
2055 repeated uint32 max_groups = 3; /* Maximum number of groups for each type.
2056 */
2057 repeated uint32 actions = 4; /* Bitmaps of (1 << OFPAT_*) values
2058 supported. */
2059};
2060
2061/* Body of OFPMP_METER and OFPMP_METER_CONFIG requests. */
2062message ofp_meter_multipart_request {
2063 uint32 meter_id = 1; /* Meter instance, or OFPM_ALL. */
2064};
2065
2066/* Statistics for each meter band */
2067message ofp_meter_band_stats {
2068 uint64 packet_band_count = 1; /* Number of packets in band. */
2069 uint64 byte_band_count = 2; /* Number of bytes in band. */
2070};
2071
2072/* Body of reply to OFPMP_METER request. Meter statistics. */
2073message ofp_meter_stats {
2074 uint32 meter_id = 1; /* Meter instance. */
2075 uint32 flow_count = 2; /* Number of flows bound to meter. */
2076 uint64 packet_in_count = 3; /* Number of packets in input. */
2077 uint64 byte_in_count = 4; /* Number of bytes in input. */
2078 uint32 duration_sec = 5; /* Time meter has been alive in seconds. */
2079 uint32 duration_nsec = 6;/* Time meter has been alive in nanoseconds
2080 beyond duration_sec. */
2081 repeated ofp_meter_band_stats band_stats = 7; /* The band_stats length is
2082 inferred from the length field. */
2083};
2084
2085/* Body of reply to OFPMP_METER_CONFIG request. Meter configuration. */
2086message ofp_meter_config {
2087 uint32 flags = 1; /* All OFPMF_* that apply. */
2088 uint32 meter_id = 2; /* Meter instance. */
2089 repeated ofp_meter_band_header bands = 3; /* The bands length is
2090 inferred from the length field. */
2091};
2092
2093/* Body of reply to OFPMP_METER_FEATURES request. Meter features. */
2094message ofp_meter_features {
2095 uint32 max_meter = 1; /* Maximum number of meters. */
2096 uint32 band_types = 2; /* Bitmaps of (1 << OFPMBT_*) values supported.
2097 */
2098 uint32 capabilities = 3; /* Bitmaps of "ofp_meter_flags". */
2099 uint32 max_bands = 4; /* Maximum bands per meters */
2100 uint32 max_color = 5; /* Maximum color value */
2101};
2102
2103/* Body for ofp_multipart_request/reply of type OFPMP_EXPERIMENTER. */
2104message ofp_experimenter_multipart_header {
2105 uint32 experimenter = 1; /* Experimenter ID which takes the same form
2106 as in struct ofp_experimenter_header. */
2107 uint32 exp_type = 2; /* Experimenter defined. */
2108 bytes data = 3; /* Experimenter-defined arbitrary additional data. */
2109};
2110
2111/* Experimenter extension. */
2112message ofp_experimenter_header {
2113 //ofp_header header; /* Type OFPT_EXPERIMENTER. */
2114 uint32 experimenter = 1; /* Experimenter ID:
2115 * - MSB 0: low-order bytes are IEEE OUI.
2116 * - MSB != 0: defined by ONF. */
2117 uint32 exp_type = 2; /* Experimenter defined. */
2118 bytes data = 3; /* Experimenter-defined arbitrary additional data. */
2119};
2120
2121/* All ones is used to indicate all queues in a port (for stats retrieval). */
2122//#define OFPQ_ALL 0xffffffff
2123
2124/* Min rate > 1000 means not configured. */
2125//#define OFPQ_MIN_RATE_UNCFG 0xffff
2126
2127/* Max rate > 1000 means not configured. */
2128//#define OFPQ_MAX_RATE_UNCFG 0xffff
2129
2130enum ofp_queue_properties {
2131 OFPQT_INVALID = 0;
2132 OFPQT_MIN_RATE = 1; /* Minimum datarate guaranteed. */
2133 OFPQT_MAX_RATE = 2; /* Maximum datarate. */
2134 OFPQT_EXPERIMENTER = 0xffff; /* Experimenter defined property. */
2135};
2136
2137/* Common description for a queue. */
2138message ofp_queue_prop_header {
2139 uint32 property = 1; /* One of OFPQT_. */
2140 uint32 len = 2; /* Length of property, including this header. */
2141};
2142
2143/* Min-Rate queue property description. */
2144message ofp_queue_prop_min_rate {
2145 ofp_queue_prop_header prop_header = 1;/* prop: OFPQT_MIN, len: 16. */
2146 uint32 rate = 2; /* In 1/10 of a percent = 0;>1000 -> disabled. */
2147};
2148
2149/* Max-Rate queue property description. */
2150message ofp_queue_prop_max_rate {
2151 ofp_queue_prop_header prop_header = 1;/* prop: OFPQT_MAX, len: 16. */
2152 uint32 rate = 2; /* In 1/10 of a percent = 0;>1000 -> disabled. */
2153};
2154
2155/* Experimenter queue property description. */
2156message ofp_queue_prop_experimenter {
2157 ofp_queue_prop_header prop_header = 1;/* prop: OFPQT_EXPERIMENTER */
2158 uint32 experimenter = 2; /* Experimenter ID which takes the same
2159 form as in struct
2160 ofp_experimenter_header. */
2161 bytes data = 3; /* Experimenter defined data. */
2162};
2163
2164/* Full description for a queue. */
2165message ofp_packet_queue {
2166 uint32 queue_id = 1; /* id for the specific queue. */
2167 uint32 port = 2; /* Port this queue is attached to. */
2168 repeated ofp_queue_prop_header properties = 4; /* List of properties. */
2169};
2170
2171/* Query for port queue configuration. */
2172message ofp_queue_get_config_request {
2173 //ofp_header header;
2174 uint32 port = 1; /* Port to be queried. Should refer
2175 to a valid physical port (i.e. <= OFPP_MAX),
2176 or OFPP_ANY to request all configured
2177 queues.*/
2178};
2179
2180/* Queue configuration for a given port. */
2181message ofp_queue_get_config_reply {
2182 //ofp_header header;
2183 uint32 port = 1;
2184 repeated ofp_packet_queue queues = 2; /* List of configured queues. */
2185};
2186
2187/* OFPAT_SET_QUEUE action struct: send packets to given queue on port. */
2188message ofp_action_set_queue {
2189 uint32 type = 1; /* OFPAT_SET_QUEUE. */
2190 uint32 queue_id = 3; /* Queue id for the packets. */
2191};
2192
2193message ofp_queue_stats_request {
2194 uint32 port_no = 1; /* All ports if OFPP_ANY. */
2195 uint32 queue_id = 2; /* All queues if OFPQ_ALL. */
2196};
2197
2198message ofp_queue_stats {
2199 uint32 port_no = 1;
2200 uint32 queue_id = 2; /* Queue i.d */
2201 uint64 tx_bytes = 3; /* Number of transmitted bytes. */
2202 uint64 tx_packets = 4; /* Number of transmitted packets. */
2203 uint64 tx_errors = 5; /* Number of packets dropped due to overrun. */
2204 uint32 duration_sec = 6; /* Time queue has been alive in seconds. */
2205 uint32 duration_nsec = 7; /* Time queue has been alive in nanoseconds
2206 beyond duration_sec. */
2207};
2208
2209/* Configures the "role" of the sending controller. The default role is:
2210 *
2211 * - Equal (OFPCR_ROLE_EQUAL), which allows the controller access to all
2212 * OpenFlow features. All controllers have equal responsibility.
2213 *
2214 * The other possible roles are a related pair:
2215 *
2216 * - Master (OFPCR_ROLE_MASTER) is equivalent to Equal, except that there
2217 * may be at most one Master controller at a time: when a controller
2218 * configures itself as Master, any existing Master is demoted to the
2219 * Slave role.
2220 *
2221 * - Slave (OFPCR_ROLE_SLAVE) allows the controller read-only access to
2222 * OpenFlow features. In particular attempts to modify the flow table
2223 * will be rejected with an OFPBRC_EPERM error.
2224 *
2225 * Slave controllers do not receive OFPT_PACKET_IN or OFPT_FLOW_REMOVED
2226 * messages, but they do receive OFPT_PORT_STATUS messages.
2227 */
2228
2229/* Controller roles. */
2230enum ofp_controller_role {
2231 OFPCR_ROLE_NOCHANGE = 0; /* Don't change current role. */
2232 OFPCR_ROLE_EQUAL = 1; /* Default role, full access. */
2233 OFPCR_ROLE_MASTER = 2; /* Full access, at most one master. */
2234 OFPCR_ROLE_SLAVE = 3; /* Read-only access. */
2235};
2236
2237/* Role request and reply message. */
2238message ofp_role_request {
2239 //ofp_header header; /* Type OFPT_ROLE_REQUEST/OFPT_ROLE_REPLY. */
2240 ofp_controller_role role = 1; /* One of OFPCR_ROLE_*. */
2241 uint64 generation_id = 2; /* Master Election Generation Id */
2242};
2243
2244/* Asynchronous message configuration. */
2245message ofp_async_config {
2246 //ofp_header header; /* OFPT_GET_ASYNC_REPLY or OFPT_SET_ASYNC. */
2247 repeated uint32 packet_in_mask = 1; /* Bitmasks of OFPR_* values. */
2248 repeated uint32 port_status_mask = 2; /* Bitmasks of OFPPR_* values. */
2249 repeated uint32 flow_removed_mask = 3;/* Bitmasks of OFPRR_* values. */
2250};
2251
2252
2253/* ADDITIONAL VOLTHA SPECIFIC MESSAGE TYPES, AIDING RPC CALLS */
2254
2255message FlowTableUpdate {
2256 string id = 1; // Device.id or LogicalDevice.id
2257 ofp_flow_mod flow_mod = 2;
2258}
2259
2260message FlowGroupTableUpdate {
2261 string id = 1; // Device.id or LogicalDevice.id
2262 ofp_group_mod group_mod = 2;
2263}
2264
2265message Flows {
2266 repeated ofp_flow_stats items = 1;
2267}
2268
2269message FlowGroups {
2270 repeated ofp_group_entry items = 1;
2271}
2272
2273message FlowChanges {
2274 Flows to_add = 1;
2275 Flows to_remove = 2;
2276}
2277
2278message FlowGroupChanges {
2279 FlowGroups to_add = 1;
2280 FlowGroups to_remove = 2;
2281}
2282
2283message PacketIn {
2284 string id = 1; // LogicalDevice.id
2285 ofp_packet_in packet_in = 2;
2286}
2287
2288message PacketOut {
2289 string id = 1; // LogicalDevice.id
2290 ofp_packet_out packet_out = 2;
2291}
2292
2293message ChangeEvent {
2294 string id = 1; // LogicalDevice.id
2295 oneof event {
2296 ofp_port_status port_status = 2;
2297 }
2298}