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