1# Copyright (C) 2012 Nippon Telegraph and Telephone Corporation. 2# Copyright (C) 2012 Isaku Yamahata <yamahata at valinux co jp> 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13# implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16 17""" 18OpenFlow 1.2 definitions. 19""" 20 21from ryu.lib import type_desc 22from ryu.ofproto import nicira_ext 23from ryu.ofproto import ofproto_utils 24from ryu.ofproto import oxm_fields 25 26from struct import calcsize 27 28# struct ofp_header 29OFP_HEADER_PACK_STR = '!BBHI' 30OFP_HEADER_SIZE = 8 31assert calcsize(OFP_HEADER_PACK_STR) == OFP_HEADER_SIZE 32 33# enum ofp_type 34OFPT_HELLO = 0 # Symmetric message 35OFPT_ERROR = 1 # Symmetric message 36OFPT_ECHO_REQUEST = 2 # Symmetric message 37OFPT_ECHO_REPLY = 3 # Symmetric message 38OFPT_EXPERIMENTER = 4 # Symmetric message 39# Immutable message 40OFPT_FEATURES_REQUEST = 5 # Controller/switch message 41OFPT_FEATURES_REPLY = 6 # Controller/switch message 42OFPT_GET_CONFIG_REQUEST = 7 # Controller/switch message 43OFPT_GET_CONFIG_REPLY = 8 # Controller/switch message 44OFPT_SET_CONFIG = 9 # Controller/switch message 45 46OFPT_PACKET_IN = 10 # Async message 47OFPT_FLOW_REMOVED = 11 # Async message 48OFPT_PORT_STATUS = 12 # Async message 49 50OFPT_PACKET_OUT = 13 # Controller/switch message 51OFPT_FLOW_MOD = 14 # Controller/switch message 52OFPT_GROUP_MOD = 15 # Controller/switch message 53OFPT_PORT_MOD = 16 # Controller/switch message 54OFPT_TABLE_MOD = 17 # Controller/switch message 55 56OFPT_STATS_REQUEST = 18 # Controller/switch message 57OFPT_STATS_REPLY = 19 # Controller/switch message 58 59OFPT_BARRIER_REQUEST = 20 # Controller/switch message 60OFPT_BARRIER_REPLY = 21 # Controller/switch message 61 62OFPT_QUEUE_GET_CONFIG_REQUEST = 22 # Controller/switch message 63OFPT_QUEUE_GET_CONFIG_REPLY = 23 # Controller/switch message 64 65OFPT_ROLE_REQUEST = 24 # Controller/switch message 66OFPT_ROLE_REPLY = 25 # Controller/switch message 67 68# struct ofp_port 69OFP_MAX_PORT_NAME_LEN = 16 70OFP_ETH_ALEN = 6 71OFP_ETH_ALEN_STR = str(OFP_ETH_ALEN) 72_OFP_PORT_PACK_STR = 'I4x' + OFP_ETH_ALEN_STR + 's' + '2x' + \ 73 str(OFP_MAX_PORT_NAME_LEN) + 's' + 'IIIIIIII' 74OFP_PORT_PACK_STR = '!' + _OFP_PORT_PACK_STR 75OFP_PORT_SIZE = 64 76assert calcsize(OFP_PORT_PACK_STR) == OFP_PORT_SIZE 77 78# enum ofp_port_config 79OFPPC_PORT_DOWN = 1 << 0 # Port is administratively down. 80OFPPC_NO_RECV = 1 << 2 # Drop all packets recieved by port. 81OFPPC_NO_FWD = 1 << 5 # Drop packets forwarded to port. 82OFPPC_NO_PACKET_IN = 1 << 6 # Do not send packet-in msgs for port. 83 84# enum ofp_port_state 85OFPPS_LINK_DOWN = 1 << 0 # No physical link present. 86OFPPS_BLOCKED = 1 << 1 # Port is blocked. 87OFPPS_LIVE = 1 << 2 # Live for Fast Failover Group. 88 89# enum ofp_port_no 90OFPP_MAX = 0xffffff00 91OFPP_IN_PORT = 0xfffffff8 # Send the packet out the input port. This 92 # virtual port must be explicitly used 93 # in order to send back out of the input 94 # port. 95OFPP_TABLE = 0xfffffff9 # Perform actions in flow table. 96 # NB: This can only be the destination 97 # port for packet-out messages. 98OFPP_NORMAL = 0xfffffffa # Process with normal L2/L3 switching. 99OFPP_FLOOD = 0xfffffffb # All physical ports except input port and 100 # those disabled by STP. 101OFPP_ALL = 0xfffffffc # All physical ports except input port. 102OFPP_CONTROLLER = 0xfffffffd # Send to controller. 103OFPP_LOCAL = 0xfffffffe # Local openflow "port". 104OFPP_ANY = 0xffffffff # Not associated with a physical port. 105 106# All ones is used to indicate all queues in a port (for stats retrieval). 107OFPQ_ALL = 0xffffffff 108 109# enum ofp_port_features 110OFPPF_10MB_HD = 1 << 0 # 10 Mb half-duplex rate support. 111OFPPF_10MB_FD = 1 << 1 # 10 Mb full-duplex rate support. 112OFPPF_100MB_HD = 1 << 2 # 100 Mb half-duplex rate support. 113OFPPF_100MB_FD = 1 << 3 # 100 Mb full-duplex rate support. 114OFPPF_1GB_HD = 1 << 4 # 1 Gb half-duplex rate support. 115OFPPF_1GB_FD = 1 << 5 # 1 Gb full-duplex rate support. 116OFPPF_10GB_FD = 1 << 6 # 10 Gb full-duplex rate support. 117OFPPF_40GB_FD = 1 << 7 # 40 Gb full-duplex rate support. 118OFPPF_100GB_FD = 1 << 8 # 100 Gb full-duplex rate support. 119OFPPF_1TB_FD = 1 << 9 # 1 Tb full-duplex rate support. 120OFPPF_OTHER = 1 << 10 # Other rate, not in the list. 121OFPPF_COPPER = 1 << 11 # Copper medium. 122OFPPF_FIBER = 1 << 12 # Fiber medium. 123OFPPF_AUTONEG = 1 << 13 # Auto-negotiation. 124OFPPF_PAUSE = 1 << 14 # Pause. 125OFPPF_PAUSE_ASYM = 1 << 15 # Asymmetric pause. 126 127# struct ofp_packet_queue 128OFP_PACKET_QUEUE_PACK_STR = '!IIH6x' 129OFP_PACKET_QUEUE_SIZE = 16 130assert calcsize(OFP_PACKET_QUEUE_PACK_STR) == OFP_PACKET_QUEUE_SIZE 131 132# enum ofp_queue_properties 133OFPQT_MIN_RATE = 1 # Minimum datarate guaranteed. 134OFPQT_MAX_RATE = 2 # Maximum datarate. 135OFPQT_EXPERIMENTER = 0xffff # Experimenter defined property. 136 137# struct ofp_queue_prop_header 138OFP_QUEUE_PROP_HEADER_PACK_STR = '!HH4x' 139OFP_QUEUE_PROP_HEADER_SIZE = 8 140assert calcsize(OFP_QUEUE_PROP_HEADER_PACK_STR) == OFP_QUEUE_PROP_HEADER_SIZE 141 142# struct ofp_queue_prop_min_rate 143OFP_QUEUE_PROP_MIN_RATE_PACK_STR = '!H6x' 144OFP_QUEUE_PROP_MIN_RATE_SIZE = 16 145assert (calcsize(OFP_QUEUE_PROP_MIN_RATE_PACK_STR) + 146 OFP_QUEUE_PROP_HEADER_SIZE) == OFP_QUEUE_PROP_MIN_RATE_SIZE 147 148# struct ofp_queue_prop_max_rate 149OFP_QUEUE_PROP_MAX_RATE_PACK_STR = '!H6x' 150OFP_QUEUE_PROP_MAX_RATE_SIZE = 16 151assert (calcsize(OFP_QUEUE_PROP_MAX_RATE_PACK_STR) + 152 OFP_QUEUE_PROP_HEADER_SIZE) == OFP_QUEUE_PROP_MAX_RATE_SIZE 153 154# struct ofp_queue_prop_experimenter 155OFP_QUEUE_PROP_EXPERIMENTER_PACK_STR = '!I4x' 156OFP_QUEUE_PROP_EXPERIMENTER_SIZE = 16 157assert (calcsize(OFP_QUEUE_PROP_EXPERIMENTER_PACK_STR) + 158 OFP_QUEUE_PROP_HEADER_SIZE) == OFP_QUEUE_PROP_EXPERIMENTER_SIZE 159 160# struct ofp_match 161_OFP_MATCH_PACK_STR = 'HHBBBB' 162OFP_MATCH_PACK_STR = '!' + _OFP_MATCH_PACK_STR 163OFP_MATCH_SIZE = 8 164assert calcsize(OFP_MATCH_PACK_STR) == OFP_MATCH_SIZE 165 166# enum ofp_match_type 167OFPMT_STANDARD = 0 # Deprecated 168OFPMT_OXM = 1 # OpenFlow Extensible Match 169 170# enum ofp_oxm_class 171OFPXMC_NXM_0 = 0x0000 # Backward compatibility with NXM 172OFPXMC_NXM_1 = 0x0001 # Backward compatibility with NXM 173OFPXMC_OPENFLOW_BASIC = 0x8000 # Basic class for OpenFlow 174OFPXMC_EXPERIMENTER = 0xFFFF # Experimenter class 175 176# enum ofp_vlan_id 177OFPVID_PRESENT = 0x1000 # bit that indicate that a VLAN id is set. 178OFPVID_NONE = 0x0000 # No VLAN id was set. 179 180# struct ofp_oxm_experimenter_header 181OFP_OXM_EXPERIMENTER_HEADER_PACK_STR = '!II' 182OFP_OXM_EXPERIMENTER_HEADER_SIZE = 8 183assert (calcsize(OFP_OXM_EXPERIMENTER_HEADER_PACK_STR) == 184 OFP_OXM_EXPERIMENTER_HEADER_SIZE) 185 186# enum ofp_instruction_type 187OFPIT_GOTO_TABLE = 1 # Setup the next table in the lookup pipeline. 188OFPIT_WRITE_METADATA = 2 # Setup the metadata field for use later in 189 # pipeline. 190OFPIT_WRITE_ACTIONS = 3 # Write the action(s) onto the datapath 191 # action set 192OFPIT_APPLY_ACTIONS = 4 # Applies the action(s) immediately 193OFPIT_CLEAR_ACTIONS = 5 # Clears all actions from the datapath action 194 # set 195OFPIT_EXPERIMENTER = 0xFFFF # Experimenter instruction 196 197# struct ofp_instruction_goto_table 198OFP_INSTRUCTION_GOTO_TABLE_PACK_STR = '!HHB3x' 199OFP_INSTRUCTION_GOTO_TABLE_SIZE = 8 200assert (calcsize(OFP_INSTRUCTION_GOTO_TABLE_PACK_STR) == 201 OFP_INSTRUCTION_GOTO_TABLE_SIZE) 202 203# struct ofp_instruction_write_metadata 204OFP_INSTRUCTION_WRITE_METADATA_PACK_STR = '!HH4xQQ' 205OFP_INSTRUCTION_WRITE_METADATA_SIZE = 24 206assert (calcsize(OFP_INSTRUCTION_WRITE_METADATA_PACK_STR) == 207 OFP_INSTRUCTION_WRITE_METADATA_SIZE) 208 209# struct ofp_instaruction_actions 210OFP_INSTRUCTION_ACTIONS_PACK_STR = '!HH4x' 211OFP_INSTRUCTION_ACTIONS_SIZE = 8 212assert (calcsize(OFP_INSTRUCTION_ACTIONS_PACK_STR) == 213 OFP_INSTRUCTION_ACTIONS_SIZE) 214 215# enum ofp_action_type 216OFPAT_OUTPUT = 0 # Output to switch port. 217OFPAT_COPY_TTL_OUT = 11 # Copy TTL "outwards" -- from 218 # next-to-outermost to outermost 219OFPAT_COPY_TTL_IN = 12 # Copy TTL "inwards" -- from outermost to 220 # next-to-outermost 221OFPAT_SET_MPLS_TTL = 15 # MPLS TTL. 222OFPAT_DEC_MPLS_TTL = 16 # Decrement MPLS TTL 223OFPAT_PUSH_VLAN = 17 # Push a new VLAN tag 224OFPAT_POP_VLAN = 18 # Pop the outer VLAN tag 225OFPAT_PUSH_MPLS = 19 # Push a new MPLS tag 226OFPAT_POP_MPLS = 20 # Pop the outer MPLS tag 227OFPAT_SET_QUEUE = 21 # Set queue id when outputting to a port 228OFPAT_GROUP = 22 # Apply group 229OFPAT_SET_NW_TTL = 23 # IP TTL. 230OFPAT_DEC_NW_TTL = 24 # Decrement IP TTL. 231OFPAT_SET_FIELD = 25 # Set a header field using OXM TLV format. 232OFPAT_EXPERIMENTER = 0xffff 233 234# struct ofp_action_header 235OFP_ACTION_HEADER_PACK_STR = '!HH4x' 236OFP_ACTION_HEADER_SIZE = 8 237assert calcsize(OFP_ACTION_HEADER_PACK_STR) == OFP_ACTION_HEADER_SIZE 238 239# struct ofp_action_output 240OFP_ACTION_OUTPUT_PACK_STR = '!HHIH6x' 241OFP_ACTION_OUTPUT_SIZE = 16 242assert calcsize(OFP_ACTION_OUTPUT_PACK_STR) == OFP_ACTION_OUTPUT_SIZE 243 244# enum ofp_controller_max_len 245OFPCML_MAX = 0xffe5 # maximum max_len value which can be used to 246 # request a specific byte length. 247OFPCML_NO_BUFFER = 0xffff # indicates that no buffering should be 248 # applied and the whole packet is to be 249 # sent to the controller. 250 251# struct ofp_action_group 252OFP_ACTION_GROUP_PACK_STR = '!HHI' 253OFP_ACTION_GROUP_SIZE = 8 254assert calcsize(OFP_ACTION_GROUP_PACK_STR) == OFP_ACTION_GROUP_SIZE 255 256# struct ofp_action_set_queue 257OFP_ACTION_SET_QUEUE_PACK_STR = '!HHI' 258OFP_ACTION_SET_QUEUE_SIZE = 8 259assert calcsize(OFP_ACTION_SET_QUEUE_PACK_STR) == OFP_ACTION_SET_QUEUE_SIZE 260 261# struct ofp_aciton_mpls_ttl 262OFP_ACTION_MPLS_TTL_PACK_STR = '!HHB3x' 263OFP_ACTION_MPLS_TTL_SIZE = 8 264assert calcsize(OFP_ACTION_MPLS_TTL_PACK_STR) == OFP_ACTION_MPLS_TTL_SIZE 265 266# struct ofp_action_nw_ttl 267OFP_ACTION_NW_TTL_PACK_STR = '!HHB3x' 268OFP_ACTION_NW_TTL_SIZE = 8 269assert calcsize(OFP_ACTION_NW_TTL_PACK_STR) == OFP_ACTION_NW_TTL_SIZE 270 271# struct ofp_action_push 272OFP_ACTION_PUSH_PACK_STR = '!HHH2x' 273OFP_ACTION_PUSH_SIZE = 8 274assert calcsize(OFP_ACTION_PUSH_PACK_STR) == OFP_ACTION_PUSH_SIZE 275 276# struct ofp_action_pop_mpls 277OFP_ACTION_POP_MPLS_PACK_STR = '!HHH2x' 278OFP_ACTION_POP_MPLS_SIZE = 8 279assert calcsize(OFP_ACTION_POP_MPLS_PACK_STR) == OFP_ACTION_POP_MPLS_SIZE 280 281# struct ofp_action_set_field 282OFP_ACTION_SET_FIELD_PACK_STR = '!HH4B' 283OFP_ACTION_SET_FIELD_SIZE = 8 284assert calcsize(OFP_ACTION_SET_FIELD_PACK_STR) == OFP_ACTION_SET_FIELD_SIZE 285 286# struct ofp_action_experimenter_header 287OFP_ACTION_EXPERIMENTER_HEADER_PACK_STR = '!HHI' 288OFP_ACTION_EXPERIMENTER_HEADER_SIZE = 8 289assert (calcsize(OFP_ACTION_EXPERIMENTER_HEADER_PACK_STR) == 290 OFP_ACTION_EXPERIMENTER_HEADER_SIZE) 291 292# struct ofp_switch_feature 293OFP_SWITCH_FEATURES_PACK_STR = '!QIB3xII' 294OFP_SWITCH_FEATURES_SIZE = 32 295assert (calcsize(OFP_SWITCH_FEATURES_PACK_STR) + OFP_HEADER_SIZE == 296 OFP_SWITCH_FEATURES_SIZE) 297 298# enum ofp_capabilities 299OFPC_FLOW_STATS = 1 << 0 # Flow statistics. 300OFPC_TABLE_STATS = 1 << 1 # Table statistics. 301OFPC_PORT_STATS = 1 << 2 # Port statistics. 302OFPC_GROUP_STATS = 1 << 3 # Group statistics. 303OFPC_IP_REASM = 1 << 5 # Can reassemble IP fragments. 304OFPC_QUEUE_STATS = 1 << 6 # Queue statistics. 305OFPC_PORT_BLOCKED = 1 << 8 # Switch will block looping ports. 306 307# struct ofp_switch_config 308OFP_SWITCH_CONFIG_PACK_STR = '!HH' 309OFP_SWITCH_CONFIG_SIZE = 12 310assert (calcsize(OFP_SWITCH_CONFIG_PACK_STR) + OFP_HEADER_SIZE == 311 OFP_SWITCH_CONFIG_SIZE) 312 313# enum ofp_config_flags 314OFPC_FRAG_NORMAL = 0 # No special handling for fragments. 315OFPC_FRAG_DROP = 1 # Drop fragments. 316OFPC_FRAG_REASM = 2 # Reassemble (only if OFPC_IP_REASM set). 317OFPC_FRAG_MASK = 3 318OFPC_INVALID_TTL_TO_CONTROLLER = 1 << 2 # Send packets with invalid 319 # TTL to the controller. 320 321# enum ofp_table 322OFPTT_MAX = 0xfe 323OFPTT_ALL = 0xff 324 325# struct ofp_table_mod 326OFP_TABLE_MOD_PACK_STR = '!B3xI' 327OFP_TABLE_MOD_SIZE = 16 328assert (calcsize(OFP_TABLE_MOD_PACK_STR) + OFP_HEADER_SIZE == 329 OFP_TABLE_MOD_SIZE) 330 331# enum ofp_table_config 332OFPTC_TABLE_MISS_CONTROLLER = 0 333OFPTC_TABLE_MISS_CONTINUE = 1 << 0 334OFPTC_TABLE_MISS_DROP = 1 << 1 335OFPTC_TABLE_MISS_MASK = 3 336 337# struct ofp_flow_mod 338_OFP_FLOW_MOD_PACK_STR0 = 'QQBBHHHIIIH2x' 339OFP_FLOW_MOD_PACK_STR = '!' + _OFP_FLOW_MOD_PACK_STR0 + _OFP_MATCH_PACK_STR 340OFP_FLOW_MOD_PACK_STR0 = '!' + _OFP_FLOW_MOD_PACK_STR0 341OFP_FLOW_MOD_SIZE = 56 342assert (calcsize(OFP_FLOW_MOD_PACK_STR) + OFP_HEADER_SIZE == OFP_FLOW_MOD_SIZE) 343 344# enum ofp_flow_mod_command 345OFPFC_ADD = 0 # New flow. 346OFPFC_MODIFY = 1 # Modify all matching flows. 347OFPFC_MODIFY_STRICT = 2 # Modify entry strictly matching wildcards 348OFPFC_DELETE = 3 # Delete all matching flows. 349OFPFC_DELETE_STRICT = 4 # Strictly match wildcards and priority. 350 351# enum ofp_flow_mod_flags 352OFPFF_SEND_FLOW_REM = 1 << 0 # Send flow removed message when flow 353 # expires or is deleted. 354OFPFF_CHECK_OVERLAP = 1 << 1 # Check for overlapping entries first. 355OFPFF_RESET_COUNTS = 1 << 2 # Reset flow packet and byte counts. 356 357# struct ofp_group_mod 358OFP_GROUP_MOD_PACK_STR = '!HBxI' 359OFP_GROUP_MOD_SIZE = 16 360assert (calcsize(OFP_GROUP_MOD_PACK_STR) + OFP_HEADER_SIZE == 361 OFP_GROUP_MOD_SIZE) 362 363# enum ofp_group 364OFPG_MAX = 0xffffff00 365OFPG_ALL = 0xfffffffc 366OFPG_ANY = 0xffffffff 367 368# enum ofp_group_mod_command 369OFPGC_ADD = 0 # New group. 370OFPGC_MODIFY = 1 # Modify all matching groups. 371OFPGC_DELETE = 2 # Deletes all matching groups. 372 373# enum ofp_group_type 374OFPGT_ALL = 0 # All (multicast/broadcast) group. 375OFPGT_SELECT = 1 # Select group. 376OFPGT_INDIRECT = 2 # Indirect group. 377OFPGT_FF = 3 # Fast failover group. 378 379# struct ofp_bucket 380OFP_BUCKET_PACK_STR = '!HHII4x' 381OFP_BUCKET_SIZE = 16 382assert calcsize(OFP_BUCKET_PACK_STR) == OFP_BUCKET_SIZE 383 384# struct ofp_port_mod 385OFP_PORT_MOD_PACK_STR = '!I4x' + OFP_ETH_ALEN_STR + 's' + '2xIII4x' 386OFP_PORT_MOD_SIZE = 40 387assert calcsize(OFP_PORT_MOD_PACK_STR) + OFP_HEADER_SIZE == OFP_PORT_MOD_SIZE 388 389# sturct ofp_stats_request 390OFP_STATS_REQUEST_PACK_STR = '!HH4x' 391OFP_STATS_REQUEST_SIZE = 16 392assert (calcsize(OFP_STATS_REQUEST_PACK_STR) + OFP_HEADER_SIZE == 393 OFP_STATS_REQUEST_SIZE) 394 395# enum ofp_stats_reply_flags 396OFPSF_REPLY_MORE = 1 << 0 # More replies to follow. 397 398# struct ofp_stats_reply 399OFP_STATS_REPLY_PACK_STR = '!HH4x' 400OFP_STATS_REPLY_SIZE = 16 401assert (calcsize(OFP_STATS_REPLY_PACK_STR) + OFP_HEADER_SIZE == 402 OFP_STATS_REPLY_SIZE) 403 404# enum ofp_stats_types 405OFPST_DESC = 0 406OFPST_FLOW = 1 407OFPST_AGGREGATE = 2 408OFPST_TABLE = 3 409OFPST_PORT = 4 410OFPST_QUEUE = 5 411OFPST_GROUP = 6 412OFPST_GROUP_DESC = 7 413OFPST_GROUP_FEATURES = 8 414OFPST_EXPERIMENTER = 0xffff 415 416# struct ofp_desc_stats 417DESC_STR_LEN = 256 418DESC_STR_LEN_STR = str(DESC_STR_LEN) 419SERIAL_NUM_LEN = 32 420SERIAL_NUM_LEN_STR = str(SERIAL_NUM_LEN) 421OFP_DESC_STATS_PACK_STR = '!' + \ 422 DESC_STR_LEN_STR + 's' + \ 423 DESC_STR_LEN_STR + 's' + \ 424 DESC_STR_LEN_STR + 's' + \ 425 SERIAL_NUM_LEN_STR + 's' + \ 426 DESC_STR_LEN_STR + 's' 427OFP_DESC_STATS_SIZE = 1056 428assert calcsize(OFP_DESC_STATS_PACK_STR) == OFP_DESC_STATS_SIZE 429 430# struct ofp_flow_stats_request 431OFP_FLOW_STATS_REQUEST_PACK_STR = '!B3xII4xQQ' 432OFP_FLOW_STATS_REQUEST_SIZE = 40 433assert (calcsize(OFP_FLOW_STATS_REQUEST_PACK_STR) + OFP_MATCH_SIZE == 434 OFP_FLOW_STATS_REQUEST_SIZE) 435 436# struct ofp_flow_stats 437OFP_FLOW_STATS_PACK_STR = '!HBxIIHHH6xQQQ' 438OFP_FLOW_STATS_SIZE = 56 439assert (calcsize(OFP_FLOW_STATS_PACK_STR) + OFP_MATCH_SIZE == 440 OFP_FLOW_STATS_SIZE) 441 442# struct ofp_aggregate_stats_request 443OFP_AGGREGATE_STATS_REQUEST_PACK_STR = '!B3xII4xQQ' 444OFP_AGGREGATE_STATS_REQUEST_SIZE = 40 445assert (calcsize(OFP_AGGREGATE_STATS_REQUEST_PACK_STR) + OFP_MATCH_SIZE == 446 OFP_AGGREGATE_STATS_REQUEST_SIZE) 447 448# struct ofp_aggregate_stats_reply 449OFP_AGGREGATE_STATS_REPLY_PACK_STR = '!QQI4x' 450OFP_AGGREGATE_STATS_REPLY_SIZE = 24 451assert (calcsize(OFP_AGGREGATE_STATS_REPLY_PACK_STR) == 452 OFP_AGGREGATE_STATS_REPLY_SIZE) 453 454# sturct ofp_table_stats 455OFP_TABLE_STATS_SIZE = 128 456OFP_MAX_TABLE_NAME_LEN = 32 457OFP_MAX_TABLE_NAME_LEN_STR = str(OFP_MAX_TABLE_NAME_LEN) 458OFP_TABLE_STATS_PACK_STR = '!B7x' + OFP_MAX_TABLE_NAME_LEN_STR + \ 459 'sQQIIQQQQIIIIQQ' 460assert calcsize(OFP_TABLE_STATS_PACK_STR) == OFP_TABLE_STATS_SIZE 461 462# struct ofp_port_stats_request 463OFP_PORT_STATS_REQUEST_PACK_STR = '!I4x' 464OFP_PORT_STATS_REQUEST_SIZE = 8 465assert calcsize(OFP_PORT_STATS_REQUEST_PACK_STR) == OFP_PORT_STATS_REQUEST_SIZE 466 467# struct ofp_port_stats 468OFP_PORT_STATS_PACK_STR = '!I4xQQQQQQQQQQQQ' 469OFP_PORT_STATS_SIZE = 104 470assert calcsize(OFP_PORT_STATS_PACK_STR) == OFP_PORT_STATS_SIZE 471 472# struct ofp_queue_stats_request 473OFP_QUEUE_STATS_REQUEST_PACK_STR = '!II' 474OFP_QUEUE_STATS_REQUEST_SIZE = 8 475assert (calcsize(OFP_QUEUE_STATS_REQUEST_PACK_STR) == 476 OFP_QUEUE_STATS_REQUEST_SIZE) 477 478# struct ofp_queue_stats 479OFP_QUEUE_STATS_PACK_STR = '!IIQQQ' 480OFP_QUEUE_STATS_SIZE = 32 481assert calcsize(OFP_QUEUE_STATS_PACK_STR) == OFP_QUEUE_STATS_SIZE 482 483# struct ofp_group_stats_request 484OFP_GROUP_STATS_REQUEST_PACK_STR = '!I4x' 485OFP_GROUP_STATS_REQUEST_SIZE = 8 486assert (calcsize(OFP_GROUP_STATS_REQUEST_PACK_STR) == 487 OFP_GROUP_STATS_REQUEST_SIZE) 488 489# struct ofp_group_stats 490OFP_GROUP_STATS_PACK_STR = '!H2xII4xQQ' 491OFP_GROUP_STATS_SIZE = 32 492assert calcsize(OFP_GROUP_STATS_PACK_STR) == OFP_GROUP_STATS_SIZE 493 494# struct ofp_bucket_counter 495OFP_BUCKET_COUNTER_PACK_STR = '!QQ' 496OFP_BUCKET_COUNTER_SIZE = 16 497assert calcsize(OFP_BUCKET_COUNTER_PACK_STR) == OFP_BUCKET_COUNTER_SIZE 498 499# struct ofp_group_desc_stats 500OFP_GROUP_DESC_STATS_PACK_STR = '!HBxI' 501OFP_GROUP_DESC_STATS_SIZE = 8 502assert calcsize(OFP_GROUP_DESC_STATS_PACK_STR) == OFP_GROUP_DESC_STATS_SIZE 503 504# struct ofp_group_features_stats 505OFP_GROUP_FEATURES_STATS_PACK_STR = '!II4I4I' 506OFP_GROUP_FEATURES_STATS_SIZE = 40 507assert (calcsize(OFP_GROUP_FEATURES_STATS_PACK_STR) == 508 OFP_GROUP_FEATURES_STATS_SIZE) 509 510# enmu ofp_group_capabilities 511OFPGFC_SELECT_WEIGHT = 1 << 0 # Support weight for select groups. 512OFPGFC_SELECT_LIVENESS = 1 << 1 # Support liveness for select groups. 513OFPGFC_CHAINING = 1 << 2 # Support chaining groups. 514OFPGFC_CHAINING_CHECKS = 1 << 3 # Check chaining for loops and delete 515 516# struct ofp_experimenter_stats_header 517OFP_EXPERIMENTER_STATS_HEADER_PACK_STR = '!II' 518OFP_EXPERIMENTER_STATS_HEADER_SIZE = 8 519assert (calcsize(OFP_EXPERIMENTER_STATS_HEADER_PACK_STR) == 520 OFP_EXPERIMENTER_STATS_HEADER_SIZE) 521 522# struct opf_queue_get_config_request 523OFP_QUEUE_GET_CONFIG_REQUEST_PACK_STR = '!I4x' 524OFP_QUEUE_GET_CONFIG_REQUEST_SIZE = 16 525assert (calcsize(OFP_QUEUE_GET_CONFIG_REQUEST_PACK_STR) + OFP_HEADER_SIZE == 526 OFP_QUEUE_GET_CONFIG_REQUEST_SIZE) 527 528# struct ofp_queue_get_config_reply 529OFP_QUEUE_GET_CONFIG_REPLY_PACK_STR = '!I4x' 530OFP_QUEUE_GET_CONFIG_REPLY_SIZE = 16 531assert (calcsize(OFP_QUEUE_GET_CONFIG_REPLY_PACK_STR) + OFP_HEADER_SIZE == 532 OFP_QUEUE_GET_CONFIG_REPLY_SIZE) 533 534# struct ofp_packet_out 535OFP_PACKET_OUT_PACK_STR = '!IIH6x' 536OFP_PACKET_OUT_SIZE = 24 537assert (calcsize(OFP_PACKET_OUT_PACK_STR) + OFP_HEADER_SIZE == 538 OFP_PACKET_OUT_SIZE) 539 540# struct ofp_role_request 541OFP_ROLE_REQUEST_PACK_STR = '!I4xQ' 542OFP_ROLE_REQUEST_SIZE = 24 543assert (calcsize(OFP_ROLE_REQUEST_PACK_STR) + OFP_HEADER_SIZE == 544 OFP_ROLE_REQUEST_SIZE) 545 546# enum ofp_controller_role 547OFPCR_ROLE_NOCHANGE = 0 # Don't change current role. 548OFPCR_ROLE_EQUAL = 1 # Default role, full access. 549OFPCR_ROLE_MASTER = 2 # Full access, at most one master. 550OFPCR_ROLE_SLAVE = 3 # Read-only access. 551 552# struct ofp_packet_in 553OFP_PACKET_IN_PACK_STR = '!IHBB' 554OFP_PACKET_IN_SIZE = 24 555assert (calcsize(OFP_PACKET_IN_PACK_STR) + OFP_MATCH_SIZE + OFP_HEADER_SIZE == 556 OFP_PACKET_IN_SIZE) 557 558# enum ofp_packet_in_reason 559OFPR_NO_MATCH = 0 # No matching flow. 560OFPR_ACTION = 1 # Action explicitly output to controller. 561OFPR_INVALID_TTL = 2 # Packet has invalid TTL. 562 563# struct ofp_flow_removed 564_OFP_FLOW_REMOVED_PACK_STR0 = 'QHBBIIHHQQ' 565OFP_FLOW_REMOVED_PACK_STR = '!' + _OFP_FLOW_REMOVED_PACK_STR0 + \ 566 _OFP_MATCH_PACK_STR 567OFP_FLOW_REMOVED_PACK_STR0 = '!' + _OFP_FLOW_REMOVED_PACK_STR0 568OFP_FLOW_REMOVED_SIZE = 56 569assert (calcsize(OFP_FLOW_REMOVED_PACK_STR) + OFP_HEADER_SIZE == 570 OFP_FLOW_REMOVED_SIZE) 571 572# enum ofp_flow_removed_reason 573OFPRR_IDLE_TIMEOUT = 0 # Flow idle time exceeded idle_timeout. 574OFPRR_HARD_TIMEOUT = 1 # Time exceeded hard_timeout. 575OFPRR_DELETE = 2 # Evicted by a DELETE flow mod. 576OFPRR_GROUP_DELETE = 3 # Group was removed. 577 578# struct ofp_port_status 579OFP_PORT_STATUS_PACK_STR = '!B7x' + _OFP_PORT_PACK_STR 580OFP_PORT_STATUS_DESC_OFFSET = OFP_HEADER_SIZE + 8 581OFP_PORT_STATUS_SIZE = 80 582assert (calcsize(OFP_PORT_STATUS_PACK_STR) + OFP_HEADER_SIZE == 583 OFP_PORT_STATUS_SIZE) 584 585# enum ofp_port_reason 586OFPPR_ADD = 0 # The port was added. 587OFPPR_DELETE = 1 # The port was removed. 588OFPPR_MODIFY = 2 # Some attribute of the port has changed. 589 590# struct ofp_error_msg 591OFP_ERROR_MSG_PACK_STR = '!HH' 592OFP_ERROR_MSG_SIZE = 12 593assert calcsize(OFP_ERROR_MSG_PACK_STR) + OFP_HEADER_SIZE == OFP_ERROR_MSG_SIZE 594 595# enum ofp_error_type 596OFPET_HELLO_FAILED = 0 # Hello protocol failed. 597OFPET_BAD_REQUEST = 1 # Request was not understood. 598OFPET_BAD_ACTION = 2 # Error in action description. 599OFPET_BAD_INSTRUCTION = 3 # Error in instruction list. 600OFPET_BAD_MATCH = 4 # Error in match. 601OFPET_FLOW_MOD_FAILED = 5 # Problem modifying flow entry. 602OFPET_GROUP_MOD_FAILED = 6 # Problem modifying group entry. 603OFPET_PORT_MOD_FAILED = 7 # OFPT_PORT_MOD failed. 604OFPET_TABLE_MOD_FAILED = 8 # Table mod request failed. 605OFPET_QUEUE_OP_FAILED = 9 # Queue operation failed. 606OFPET_SWITCH_CONFIG_FAILED = 10 # Switch config request failed. 607OFPET_ROLE_REQUEST_FAILED = 11 # Controller Role request failed. 608OFPET_EXPERIMENTER = 0xffff # Experimenter error messages. 609 610# enum ofp_hello_failed_code 611OFPHFC_INCOMPATIBLE = 0 # No compatible version. 612OFPHFC_EPERM = 1 # Permissions error. 613 614# enum ofp_bad_request_code 615OFPBRC_BAD_VERSION = 0 # ofp_header.version not supported. 616OFPBRC_BAD_TYPE = 1 # ofp_header.type not supported. 617OFPBRC_BAD_STAT = 2 # ofp_stats_msg.type not supported. 618OFPBRC_BAD_EXPERIMENTER = 3 # Experimenter id not supported 619 # (in ofp_experimenter_header 620 # or ofp_stats_request or ofp_stats_reply). 621OFPBRC_BAD_EXP_TYPE = 4 # Experimenter type not supported. 622OFPBRC_EPERM = 5 # Permissions error. 623OFPBRC_BAD_LEN = 6 # Wrong request length for type. 624OFPBRC_BUFFER_EMPTY = 7 # Specified buffer has already been used. 625OFPBRC_BUFFER_UNKNOWN = 8 # Specified buffer does not exist. 626OFPBRC_BAD_TABLE_ID = 9 # Specified table-id invalid or does not exist. 627OFPBRC_IS_SLAVE = 10 # Denied because controller is slave. 628OFPBRC_BAD_PORT = 11 # Invalid port. 629OFPBRC_BAD_PACKET = 12 # Invalid packet in packet-out 630 631# enum ofp_bad_action_code 632OFPBAC_BAD_TYPE = 0 # Unknown action type. 633OFPBAC_BAD_LEN = 1 # Length problem in actions. 634OFPBAC_BAD_EXPERIMENTER = 2 # Unknown experimenter id specified. 635OFPBAC_BAD_EXP_TYPE = 3 # Unknown action type for experimenter id. 636OFPBAC_BAD_OUT_PORT = 4 # Problem validating output action. 637OFPBAC_BAD_ARGUMENT = 5 # Bad action argument. 638OFPBAC_EPERM = 6 # Permissions error. 639OFPBAC_TOO_MANY = 7 # Can't handle this many actions. 640OFPBAC_BAD_QUEUE = 8 # Problem validating output queue. 641OFPBAC_BAD_OUT_GROUP = 9 # Invalid group id in forward action. 642OFPBAC_MATCH_INCONSISTENT = 10 # Action can't apply for this match, 643 # or Set-Field missing prerequisite. 644OFPBAC_UNSUPPORTED_ORDER = 11 # Action order is unsupported for 645 # the action list in an Apply-Actions 646 # instruction 647OFPBAC_BAD_TAG = 12 # Actions uses an unsupported tag/encap. 648OFPBAC_BAD_SET_TYPE = 13 # Unsupported type in SET_FIELD action. 649OFPBAC_BAD_SET_LEN = 14 # Length problem in SET_FIELD action. 650OFPBAC_BAD_SET_ARGUMENT = 15 # Bad arguement in SET_FIELD action. 651 652# enum ofp_bad_instruction_code 653OFPBIC_UNKNOWN_INST = 0 # Unknown instruction. 654OFPBIC_UNSUP_INST = 1 # Switch or table does not support 655 # the instruction. 656OFPBIC_BAD_TABLE_ID = 2 # Invalid Table-Id specified 657OFPBIC_UNSUP_METADATA = 3 # Metadata value unsupported by datapath. 658OFPBIC_UNSUP_METADATA_MASK = 4 # Metadata mask value unsupported by 659 # datapath. 660OFPBIC_BAD_EXPERIMENTER = 5 # Unknown experimenter id specified. 661OFPBIC_BAD_EXP_TYPE = 6 # Unknown instruction for experimenter id. 662OFPBIC_BAD_LEN = 7 # Length problem in instrucitons. 663OFPBIC_EPERM = 8 # Permissions error. 664 665# enum ofp_bad_match_code 666OFPBMC_BAD_TYPE = 0 # Unsupported match type apecified by 667 # the match. 668OFPBMC_BAD_LEN = 1 # Length problem in math. 669OFPBMC_BAD_TAG = 2 # Match uses an unsupported tag/encap. 670OFPBMC_BAD_DL_ADDR_MASK = 3 # Unsupported datalink addr mask - 671 # switch does not support arbitrary 672 # datalink address mask. 673OFPBMC_BAD_NW_ADDR_MASK = 4 # Unsupported network addr mask - 674 # switch does not support arbitrary 675 # network addres mask. 676OFPBMC_BAD_WILDCARDS = 5 # Unsupported combination of fields 677 # masked or omitted in the match. 678OFPBMC_BAD_FIELD = 6 # Unsupported field type in the match. 679OFPBMC_BAD_VALUE = 7 # Unsupported value in a match field. 680OFPBMC_BAD_MASK = 8 # Unsupported mask specified in the 681 # match. 682OFPBMC_BAD_PREREQ = 9 # A prerequisite was not met. 683OFPBMC_DUP_FIELD = 10 # A field type was duplicated. 684OFPBMC_EPERM = 11 # Permissions error. 685 686# enum ofp_flow_mod_failed_code 687OFPFMFC_UNKNOWN = 0 # Unspecified error. 688OFPFMFC_TABLE_FULL = 1 # Flow not added because table was full. 689OFPFMFC_BAD_TABLE_ID = 2 # Table does not exist 690OFPFMFC_OVERLAP = 3 # Attempted to add overlapping flow 691 # with CHECK_OVERLAP flag set. 692OFPFMFC_EPERM = 4 # Permissions error. 693OFPFMFC_BAD_TIMEOUT = 5 # Flow not added because of 694 # unsupported idle/hard timeout. 695OFPFMFC_BAD_COMMAND = 6 # Unsupported or unknown command. 696OFPFMFC_BAD_FLAGS = 7 # Unsupported or unknown flags. 697 698# enum ofp_group_mod_failed_code 699OFPGMFC_GROUP_EXISTS = 0 700OFPGMFC_INVALID_GROUP = 1 701OFPGMFC_WEIGHT_UNSUPPORTED = 2 # Switch does not support unequal load 702 # sharing with select groups. 703OFPGMFC_OUT_OF_GROUPS = 3 # The group table is full. 704OFPGMFC_OUT_OF_BUCKETS = 4 # The maximum number of action buckets 705 # for a group has been exceeded. 706OFPGMFC_CHAINING_UNSUPPORTED = 5 # Switch does not support groups that 707 # forward to groups. 708OFPGMFC_WATCH_UNSUPPORTED = 6 # This group cannot watch the 709 # watch_port or watch_group specified. 710OFPGMFC_LOOP = 7 # Group entry would cause a loop. 711OFPGMFC_UNKNOWN_GROUP = 8 # Group not modified because a group 712 # MODIFY attempted to modify a 713 # non-existent group. 714OFPGMFC_CHAINED_GROUP = 9 # Group not deleted because another 715 # group is forwarding to it. 716OFPGMFC_BAD_TYPE = 10 # Unsupported or unknown group type. 717OFPGMFC_BAD_COMMAND = 11 # Unsupported or unknown command. 718OFPGMFC_BAD_BUCKET = 12 # Error in bucket. 719OFPGMFC_BAD_WATCH = 13 # Error in watch port/group. 720OFPGMFC_EPERM = 14 # Permissions error. 721 722# enum ofp_port_mod_failed_code 723OFPPMFC_BAD_PORT = 0 # Specified port does not exist. 724OFPPMFC_BAD_HW_ADDR = 1 # Specified hardware address does not 725 # match the port number. 726OFPPMFC_BAD_CONFIG = 2 # Specified config is invalid. 727OFPPMFC_BAD_ADVERTISE = 3 # Specified advertise is invalid. 728OFPPMFC_EPERM = 4 # Permissions error. 729 730# enum ofp_table_mod_failed_code 731OFPTMFC_BAD_TABLE = 0 # Specified table does not exist. 732OFPTMFC_BAD_CONFIG = 1 # Specified config is invalid. 733OFPTMFC_EPERM = 2 # Permissions error 734 735# enum ofp_queue_op_failed_code 736OFPQOFC_BAD_PORT = 0 # Invalid port (or port does not exist). 737OFPQOFC_BAD_QUEUE = 1 # Queue does not exist. 738OFPQOFC_EPERM = 2 # Permissions error. 739 740# enum ofp_switch_config_failed_code 741OFPSCFC_BAD_FLAGS = 0 # Specified flags is invalid. 742OFPSCFC_BAD_LEN = 1 # Specified len is invalid. 743OFPQCFC_EPERM = 2 # Permissions error (depracated). 744 # New or updated Ryu applications shall use 745 # OFPSCFC_EPERM. The variable name is a typo of 746 # in specifications before v1.3.1 (EXT-208). 747OFPSCFC_EPERM = 2 # Permissions error. 748 # Ported back to ofproto_v1_2 for consistency with 749 # later OF specs (EXT-208). 750 751# enum ofp_role_request_failed_code 752OFPRRFC_STALE = 0 # Stale Message: old generation_id. 753OFPRRFC_UNSUP = 1 # Controller role change unsupported. 754OFPRRFC_BAD_ROLE = 2 # Invalid role. 755 756# struct ofp_error_experimenter_msg 757OFP_ERROR_EXPERIMENTER_MSG_PACK_STR = '!HHI' 758OFP_ERROR_EXPERIMENTER_MSG_SIZE = 16 759assert (calcsize(OFP_ERROR_EXPERIMENTER_MSG_PACK_STR) + OFP_HEADER_SIZE == 760 OFP_ERROR_EXPERIMENTER_MSG_SIZE) 761 762# struct ofp_experimenter_header 763OFP_EXPERIMENTER_HEADER_PACK_STR = '!II' 764OFP_EXPERIMENTER_HEADER_SIZE = 16 765assert (calcsize(OFP_EXPERIMENTER_HEADER_PACK_STR) + OFP_HEADER_SIZE == 766 OFP_EXPERIMENTER_HEADER_SIZE) 767 768 769# OXM 770 771 772def _oxm_tlv_header(class_, field, hasmask, length): 773 return (class_ << 16) | (field << 9) | (hasmask << 8) | length 774 775 776def oxm_tlv_header(field, length): 777 return _oxm_tlv_header(OFPXMC_OPENFLOW_BASIC, field, 0, length) 778 779 780def oxm_tlv_header_w(field, length): 781 return _oxm_tlv_header(OFPXMC_OPENFLOW_BASIC, field, 1, length * 2) 782 783 784def oxm_tlv_header_extract_hasmask(header): 785 return (header >> 8) & 1 786 787 788def oxm_tlv_header_extract_length(header): 789 if oxm_tlv_header_extract_hasmask(header): 790 length = (header & 0xff) // 2 791 else: 792 length = header & 0xff 793 return length 794 795 796oxm_types = [ 797 oxm_fields.OpenFlowBasic('in_port', 0, type_desc.Int4), 798 oxm_fields.OpenFlowBasic('in_phy_port', 1, type_desc.Int4), 799 oxm_fields.OpenFlowBasic('metadata', 2, type_desc.Int8), 800 oxm_fields.OpenFlowBasic('eth_dst', 3, type_desc.MacAddr), 801 oxm_fields.OpenFlowBasic('eth_src', 4, type_desc.MacAddr), 802 oxm_fields.OpenFlowBasic('eth_type', 5, type_desc.Int2), 803 oxm_fields.OpenFlowBasic('vlan_vid', 6, type_desc.Int2), 804 oxm_fields.OpenFlowBasic('vlan_pcp', 7, type_desc.Int1), 805 oxm_fields.OpenFlowBasic('ip_dscp', 8, type_desc.Int1), 806 oxm_fields.OpenFlowBasic('ip_ecn', 9, type_desc.Int1), 807 oxm_fields.OpenFlowBasic('ip_proto', 10, type_desc.Int1), 808 oxm_fields.OpenFlowBasic('ipv4_src', 11, type_desc.IPv4Addr), 809 oxm_fields.OpenFlowBasic('ipv4_dst', 12, type_desc.IPv4Addr), 810 oxm_fields.OpenFlowBasic('tcp_src', 13, type_desc.Int2), 811 oxm_fields.OpenFlowBasic('tcp_dst', 14, type_desc.Int2), 812 oxm_fields.OpenFlowBasic('udp_src', 15, type_desc.Int2), 813 oxm_fields.OpenFlowBasic('udp_dst', 16, type_desc.Int2), 814 oxm_fields.OpenFlowBasic('sctp_src', 17, type_desc.Int2), 815 oxm_fields.OpenFlowBasic('sctp_dst', 18, type_desc.Int2), 816 oxm_fields.OpenFlowBasic('icmpv4_type', 19, type_desc.Int1), 817 oxm_fields.OpenFlowBasic('icmpv4_code', 20, type_desc.Int1), 818 oxm_fields.OpenFlowBasic('arp_op', 21, type_desc.Int2), 819 oxm_fields.OpenFlowBasic('arp_spa', 22, type_desc.IPv4Addr), 820 oxm_fields.OpenFlowBasic('arp_tpa', 23, type_desc.IPv4Addr), 821 oxm_fields.OpenFlowBasic('arp_sha', 24, type_desc.MacAddr), 822 oxm_fields.OpenFlowBasic('arp_tha', 25, type_desc.MacAddr), 823 oxm_fields.OpenFlowBasic('ipv6_src', 26, type_desc.IPv6Addr), 824 oxm_fields.OpenFlowBasic('ipv6_dst', 27, type_desc.IPv6Addr), 825 oxm_fields.OpenFlowBasic('ipv6_flabel', 28, type_desc.Int4), 826 oxm_fields.OpenFlowBasic('icmpv6_type', 29, type_desc.Int1), 827 oxm_fields.OpenFlowBasic('icmpv6_code', 30, type_desc.Int1), 828 oxm_fields.OpenFlowBasic('ipv6_nd_target', 31, type_desc.IPv6Addr), 829 oxm_fields.OpenFlowBasic('ipv6_nd_sll', 32, type_desc.MacAddr), 830 oxm_fields.OpenFlowBasic('ipv6_nd_tll', 33, type_desc.MacAddr), 831 oxm_fields.OpenFlowBasic('mpls_label', 34, type_desc.Int4), 832 oxm_fields.OpenFlowBasic('mpls_tc', 35, type_desc.Int1), 833 # EXT-256 Old version of ONF Extension 834 oxm_fields.OldONFExperimenter('pbb_uca', 2560, type_desc.Int1), 835 # EXT-109 TCP flags match field Extension 836 oxm_fields.ONFExperimenter('tcp_flags', 42, type_desc.Int2), 837 # EXT-233 Output match Extension 838 # NOTE(yamamoto): The spec says uint64_t but I assume it's an error. 839 oxm_fields.ONFExperimenter('actset_output', 43, type_desc.Int4), 840] + nicira_ext.oxm_types 841 842oxm_fields.generate(__name__) 843 844# generate utility methods 845ofproto_utils.generate(__name__) 846 847# define constants 848OFP_VERSION = 0x03 849OFP_TCP_PORT = 6633 850 851MAX_XID = 0xffffffff 852 853OFP_NO_BUFFER = 0xffffffff 854