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