Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | # |
| 3 | # This python script generates wrapper functions for OpenFlow messages |
| 4 | # |
| 5 | # See the doc string below for more info |
| 6 | # |
| 7 | |
| 8 | # To do: |
| 9 | # Default type values for messages |
| 10 | # Generate all message objects |
| 11 | # Action list objects? |
| 12 | # Autogen lengths when possible |
| 13 | # Dictionaries for enum strings |
| 14 | # Resolve sub struct initializers (see ofp_flow_mod) |
| 15 | |
| 16 | |
| 17 | """ |
| 18 | Generate wrapper classes for OpenFlow messages |
| 19 | |
| 20 | (C) Copyright Stanford University |
| 21 | Date February 2010 |
| 22 | Created by dtalayco |
| 23 | |
| 24 | Attempting to follow http://www.python.org/dev/peps/pep-0008/ |
| 25 | The main exception is that our class names do not use CamelCase |
| 26 | so as to more closely match the original C code names. |
| 27 | |
| 28 | This file is meant to generate a file of_wrapper.py which imports |
| 29 | the base classes generated form automatic processing of openflow.h |
| 30 | and produces wrapper classes for each OpenFlow message type. |
| 31 | |
| 32 | This file will normally be included in of_message.py which provides |
| 33 | additional hand-generated work. |
| 34 | |
| 35 | There are two types of structures/classes here: base components and |
| 36 | message classes. |
| 37 | |
| 38 | Base components are the base data classes which are fixed |
| 39 | length structures including: |
| 40 | ofp_header |
| 41 | Each ofp_action structure |
| 42 | ofp_phy_port |
| 43 | The array elements of all the stats reply messages |
| 44 | The base components are to be imported from a file of_header.py. |
| 45 | |
| 46 | Message classes define a complete message on the wire. These are |
| 47 | comprised of possibly variable length lists of possibly variably |
| 48 | typed objects from the base component list above. |
| 49 | |
| 50 | Each OpenFlow message has a header and zero or more fixed length |
| 51 | members (the "core members" of the class) followed by zero or more |
| 52 | variable length lists. |
| 53 | |
| 54 | The wrapper classes should live in their own name space, probably |
| 55 | of_message. Automatically generated base component and skeletons for |
| 56 | the message classes are assumed generated and the wrapper classes |
| 57 | will inherit from those. |
| 58 | |
| 59 | Every message class must implement pack and unpack functions to |
| 60 | convert between the class and a string representing what goes on the |
| 61 | wire. |
| 62 | |
| 63 | For unpacking, the low level (base-component) classes must implement |
| 64 | their own unpack functions. A single top level unpack function |
| 65 | will do the parsing and call the lower layer unpack functions as |
| 66 | appropriate. |
| 67 | |
| 68 | Every base and message class should implement a show function to |
| 69 | (recursively) display the contents of the object. |
| 70 | |
| 71 | Certain OpenFlow message types are further subclassed. These include |
| 72 | stats_request, stats_reply and error. |
| 73 | |
| 74 | """ |
| 75 | |
| 76 | # Don't generate header object in messages |
| 77 | # Map each message to a body that doesn't include the header |
| 78 | # The body has does not include variable length info at the end |
| 79 | |
| 80 | import re |
| 81 | import string |
| 82 | import sys |
Rich Lane | 6242d9f | 2013-01-06 17:35:39 -0800 | [diff] [blame] | 83 | sys.path.append("../../src/python/of10") |
Dan Talayco | b9cb548 | 2010-02-09 15:23:12 -0800 | [diff] [blame] | 84 | from cstruct import * |
| 85 | from class_maps import class_to_members_map |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 86 | |
| 87 | message_top_matter = """ |
| 88 | # Python OpenFlow message wrapper classes |
| 89 | |
Dan Talayco | b9cb548 | 2010-02-09 15:23:12 -0800 | [diff] [blame] | 90 | from cstruct import * |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 91 | from action_list import action_list |
Dan Talayco | 411489d | 2010-02-12 23:03:46 -0800 | [diff] [blame] | 92 | from error import * |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 93 | |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 94 | # Define templates for documentation |
| 95 | class ofp_template_msg: |
| 96 | \""" |
| 97 | Sample base class for template_msg; normally auto generated |
| 98 | This class should live in the of_header name space and provides the |
| 99 | base class for this type of message. It will be wrapped for the |
| 100 | high level API. |
| 101 | |
| 102 | \""" |
| 103 | def __init__(self): |
| 104 | \""" |
| 105 | Constructor for base class |
| 106 | |
| 107 | \""" |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 108 | # Additional base data members declared here |
Dan Talayco | ac1cb81 | 2010-02-06 20:34:18 -0800 | [diff] [blame] | 109 | |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 110 | # Normally will define pack, unpack, __len__ functions |
| 111 | |
| 112 | class template_msg(ofp_template_msg): |
| 113 | \""" |
| 114 | Sample class wrapper for template_msg |
| 115 | This class should live in the of_message name space and provides the |
| 116 | high level API for an OpenFlow message object. These objects must |
| 117 | implement the functions indicated in this template. |
| 118 | |
| 119 | \""" |
| 120 | def __init__(self): |
| 121 | \""" |
| 122 | Constructor |
| 123 | Must set the header type value appropriately for the message |
| 124 | |
| 125 | \""" |
Dan Talayco | ac1cb81 | 2010-02-06 20:34:18 -0800 | [diff] [blame] | 126 | |
| 127 | ##@var header |
| 128 | # OpenFlow message header: length, version, xid, type |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 129 | ofp_template_msg.__init__(self) |
| 130 | # For a real message, will be set to an integer |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 131 | self.type = "TEMPLATE_MSG_VALUE" |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 132 | def pack(self): |
| 133 | \""" |
| 134 | Pack object into string |
| 135 | |
| 136 | @return The packed string which can go on the wire |
| 137 | |
| 138 | \""" |
| 139 | pass |
| 140 | def unpack(self, binary_string): |
| 141 | \""" |
| 142 | Unpack object from a binary string |
| 143 | |
| 144 | @param binary_string The wire protocol byte string holding the object |
| 145 | represented as an array of bytes. |
| 146 | |
| 147 | @return Typically returns the remainder of binary_string that |
| 148 | was not parsed. May give a warning if that string is non-empty |
| 149 | |
| 150 | \""" |
| 151 | pass |
| 152 | def __len__(self): |
| 153 | \""" |
| 154 | Return the length of this object once packed into a string |
| 155 | |
| 156 | @return An integer representing the number bytes in the packed |
| 157 | string. |
| 158 | |
| 159 | \""" |
| 160 | pass |
| 161 | def show(self, prefix=''): |
| 162 | \""" |
Dan Talayco | 46755fa | 2010-03-09 21:44:29 -0800 | [diff] [blame] | 163 | Generate a string (with multiple lines) describing the contents |
| 164 | of the object in a readable manner |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 165 | |
Dan Talayco | 46755fa | 2010-03-09 21:44:29 -0800 | [diff] [blame] | 166 | @param prefix Pre-pended at the beginning of each line. |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 167 | |
| 168 | \""" |
| 169 | pass |
| 170 | def __eq__(self, other): |
| 171 | \""" |
| 172 | Return True if self and other hold the same data |
| 173 | |
| 174 | @param other Other object in comparison |
| 175 | |
| 176 | \""" |
| 177 | pass |
| 178 | def __ne__(self, other): |
| 179 | \""" |
| 180 | Return True if self and other do not hold the same data |
| 181 | |
| 182 | @param other Other object in comparison |
| 183 | |
| 184 | \""" |
| 185 | pass |
| 186 | """ |
| 187 | |
| 188 | # Dictionary mapping wrapped classes to the auto-generated structure |
| 189 | # underlieing the class (body only, not header or var-length data) |
| 190 | message_class_map = { |
| 191 | "hello" : "ofp_header", |
| 192 | "error" : "ofp_error_msg", |
| 193 | "echo_request" : "ofp_header", |
| 194 | "echo_reply" : "ofp_header", |
| 195 | "vendor" : "ofp_vendor_header", |
| 196 | "features_request" : "ofp_header", |
| 197 | "features_reply" : "ofp_switch_features", |
| 198 | "get_config_request" : "ofp_header", |
| 199 | "get_config_reply" : "ofp_switch_config", |
| 200 | "set_config" : "ofp_switch_config", |
| 201 | "packet_in" : "ofp_packet_in", |
| 202 | "flow_removed" : "ofp_flow_removed", |
| 203 | "port_status" : "ofp_port_status", |
| 204 | "packet_out" : "ofp_packet_out", |
| 205 | "flow_mod" : "ofp_flow_mod", |
| 206 | "port_mod" : "ofp_port_mod", |
| 207 | "stats_request" : "ofp_stats_request", |
| 208 | "stats_reply" : "ofp_stats_reply", |
| 209 | "barrier_request" : "ofp_header", |
| 210 | "barrier_reply" : "ofp_header", |
| 211 | "queue_get_config_request" : "ofp_queue_get_config_request", |
| 212 | "queue_get_config_reply" : "ofp_queue_get_config_reply" |
| 213 | } |
| 214 | |
| 215 | # These messages have a string member at the end of the data |
| 216 | string_members = [ |
| 217 | "hello", |
| 218 | "error", |
| 219 | "echo_request", |
| 220 | "echo_reply", |
| 221 | "vendor", |
| 222 | "packet_in", |
| 223 | "packet_out" |
| 224 | ] |
| 225 | |
| 226 | # These messages have a list (with the given name) in the data, |
| 227 | # after the core members; the type is given for validation |
| 228 | list_members = { |
| 229 | "features_reply" : ('ports', None), |
| 230 | "packet_out" : ('actions', 'action_list'), |
| 231 | "flow_mod" : ('actions', 'action_list'), |
| 232 | "queue_get_config_reply" : ('queues', None) |
| 233 | } |
| 234 | |
| 235 | _ind = " " |
| 236 | |
| 237 | def _p1(s): print _ind + s |
| 238 | def _p2(s): print _ind * 2 + s |
| 239 | def _p3(s): print _ind * 3 + s |
| 240 | def _p4(s): print _ind * 4 + s |
| 241 | |
| 242 | # Okay, this gets kind of ugly: |
| 243 | # There are three variables: |
| 244 | # has_core_members: If parent class is not ofp_header, has inheritance |
| 245 | # has_list: Whether class has trailing array or class |
| 246 | # has_string: Whether class has trailing string |
| 247 | |
| 248 | def gen_message_wrapper(msg): |
| 249 | """ |
| 250 | Generate a wrapper for the given message based on above info |
| 251 | @param msg String identifying the message name for the class |
| 252 | """ |
| 253 | |
| 254 | msg_name = "OFPT_" + msg.upper() |
| 255 | parent = message_class_map[msg] |
| 256 | |
| 257 | has_list = False # Has trailing list |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 258 | has_core_members = True |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 259 | has_string = False # Has trailing string |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 260 | if msg in list_members.keys(): |
| 261 | (list_var, list_type) = list_members[msg] |
| 262 | has_list = True |
| 263 | if msg in string_members: |
| 264 | has_string = True |
| 265 | |
| 266 | if has_core_members: |
| 267 | print "class " + msg + "(" + parent + "):" |
| 268 | else: |
| 269 | print "class " + msg + ":" |
| 270 | _p1('"""') |
| 271 | _p1("Wrapper class for " + msg) |
| 272 | print |
Dan Talayco | ac1cb81 | 2010-02-06 20:34:18 -0800 | [diff] [blame] | 273 | _p1("OpenFlow message header: length, version, xid, type") |
| 274 | _p1("@arg length: The total length of the message") |
| 275 | _p1("@arg version: The OpenFlow version (" + str(OFP_VERSION) + ")") |
| 276 | _p1("@arg xid: The transaction ID") |
| 277 | _p1("@arg type: The message type (" + msg_name + "=" + |
| 278 | str(eval(msg_name)) + ")") |
| 279 | print |
| 280 | if has_core_members and parent in class_to_members_map.keys(): |
| 281 | _p1("Data members inherited from " + parent + ":") |
| 282 | for var in class_to_members_map[parent]: |
| 283 | _p1("@arg " + var) |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 284 | if has_list: |
| 285 | if list_type == None: |
Dan Talayco | ac1cb81 | 2010-02-06 20:34:18 -0800 | [diff] [blame] | 286 | _p1("@arg " + list_var + ": Variable length array of TBD") |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 287 | else: |
Dan Talayco | ac1cb81 | 2010-02-06 20:34:18 -0800 | [diff] [blame] | 288 | _p1("@arg " + list_var + ": Object of type " + list_type); |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 289 | if has_string: |
Dan Talayco | ac1cb81 | 2010-02-06 20:34:18 -0800 | [diff] [blame] | 290 | _p1("@arg data: Binary string following message members") |
| 291 | print |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 292 | _p1('"""') |
| 293 | |
| 294 | print |
Rich Lane | c3c2ae1 | 2013-01-04 10:13:17 -0800 | [diff] [blame] | 295 | _p1("def __init__(self, **kwargs):") |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 296 | if has_core_members: |
| 297 | _p2(parent + ".__init__(self)") |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 298 | _p2("self.version = OFP_VERSION") |
| 299 | _p2("self.type = " + msg_name) |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 300 | if has_list: |
Rich Lane | 0f0adc9 | 2013-01-04 15:13:02 -0800 | [diff] [blame] | 301 | _p2('self.' + list_var + ' = []') |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 302 | if has_string: |
| 303 | _p2('self.data = ""') |
Rich Lane | c3c2ae1 | 2013-01-04 10:13:17 -0800 | [diff] [blame] | 304 | _p2('for (k, v) in kwargs.items():') |
| 305 | _p3('if hasattr(self, k):') |
| 306 | _p4('setattr(self, k, v)') |
| 307 | _p3('else:') |
| 308 | _p4('raise NameError("field %s does not exist in %s" % (k, self.__class__))') |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 309 | |
Dan Talayco | b9cb548 | 2010-02-09 15:23:12 -0800 | [diff] [blame] | 310 | print """ |
| 311 | |
| 312 | def pack(self): |
| 313 | \""" |
| 314 | Pack object into string |
| 315 | |
| 316 | @return The packed string which can go on the wire |
| 317 | |
| 318 | \""" |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 319 | self.length = len(self) |
| 320 | packed = "" |
Dan Talayco | b9cb548 | 2010-02-09 15:23:12 -0800 | [diff] [blame] | 321 | """ |
| 322 | |
Dan Talayco | 36f2f1f | 2010-02-10 22:40:26 -0800 | [diff] [blame] | 323 | # Have to special case the action length calculation for pkt out |
| 324 | if msg == 'packet_out': |
Rich Lane | 62e9685 | 2013-03-11 12:04:45 -0700 | [diff] [blame] | 325 | _p2('self.actions_len = 0') |
| 326 | _p2('for obj in self.actions:') |
| 327 | _p3('self.actions_len += len(obj)') |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 328 | if has_core_members: |
Dan Talayco | 6d2470b | 2010-02-07 22:59:49 -0800 | [diff] [blame] | 329 | _p2("packed += " + parent + ".pack(self)") |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 330 | if has_list: |
| 331 | if list_type == None: |
| 332 | _p2('for obj in self.' + list_var + ':') |
| 333 | _p3('packed += obj.pack()') |
| 334 | else: |
Rich Lane | 62e9685 | 2013-03-11 12:04:45 -0700 | [diff] [blame] | 335 | _p2('packed += ' + list_type + '(self.' + list_var + ').pack()') |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 336 | if has_string: |
| 337 | _p2('packed += self.data') |
Dan Talayco | 6d2470b | 2010-02-07 22:59:49 -0800 | [diff] [blame] | 338 | _p2("return packed") |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 339 | |
Dan Talayco | b9cb548 | 2010-02-09 15:23:12 -0800 | [diff] [blame] | 340 | print """ |
| 341 | def unpack(self, binary_string): |
| 342 | \""" |
| 343 | Unpack object from a binary string |
| 344 | |
| 345 | @param binary_string The wire protocol byte string holding the object |
| 346 | represented as an array of bytes. |
Dan Talayco | 411489d | 2010-02-12 23:03:46 -0800 | [diff] [blame] | 347 | @return The remainder of binary_string that was not parsed. |
Dan Talayco | b9cb548 | 2010-02-09 15:23:12 -0800 | [diff] [blame] | 348 | |
| 349 | \""" |
Dan Talayco | b9cb548 | 2010-02-09 15:23:12 -0800 | [diff] [blame] | 350 | """ |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 351 | if has_core_members: |
| 352 | _p2("binary_string = " + parent + ".unpack(self, binary_string)") |
| 353 | if has_list: |
Dan Talayco | ff60649 | 2010-05-13 14:22:37 -0700 | [diff] [blame] | 354 | if msg == "features_reply": # Special case port parsing |
| 355 | # For now, cheat and assume the rest of the message is port list |
| 356 | _p2("while len(binary_string) >= OFP_PHY_PORT_BYTES:") |
| 357 | _p3("new_port = ofp_phy_port()") |
| 358 | _p3("binary_string = new_port.unpack(binary_string)") |
| 359 | _p3("self.ports.append(new_port)") |
| 360 | elif list_type == None: |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 361 | _p2("for obj in self." + list_var + ":") |
| 362 | _p3("binary_string = obj.unpack(binary_string)") |
| 363 | elif msg == "packet_out": # Special case this |
Rich Lane | 62e9685 | 2013-03-11 12:04:45 -0700 | [diff] [blame] | 364 | _p2("obj = action_list()") |
| 365 | _p2('binary_string = obj.unpack(' + |
Dan Talayco | 6d2470b | 2010-02-07 22:59:49 -0800 | [diff] [blame] | 366 | 'binary_string, bytes=self.actions_len)') |
Rich Lane | 62e9685 | 2013-03-11 12:04:45 -0700 | [diff] [blame] | 367 | _p2("self.actions = list(obj)") |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 368 | elif msg == "flow_mod": # Special case this |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 369 | _p2("ai_len = self.length - (OFP_FLOW_MOD_BYTES + " + |
Dan Talayco | 6d2470b | 2010-02-07 22:59:49 -0800 | [diff] [blame] | 370 | "OFP_HEADER_BYTES)") |
Rich Lane | 62e9685 | 2013-03-11 12:04:45 -0700 | [diff] [blame] | 371 | _p2("obj = action_list()") |
| 372 | _p2("binary_string = obj.unpack(binary_string, " + |
Dan Talayco | 6d2470b | 2010-02-07 22:59:49 -0800 | [diff] [blame] | 373 | "bytes=ai_len)") |
Rich Lane | 62e9685 | 2013-03-11 12:04:45 -0700 | [diff] [blame] | 374 | _p2("self.actions = list(obj)") |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 375 | else: |
Rich Lane | 62e9685 | 2013-03-11 12:04:45 -0700 | [diff] [blame] | 376 | _p2("obj = " + list_type + "()") |
| 377 | _p2("binary_string = obj.unpack(binary_string)") |
| 378 | _p2("self." + list_var + " = list(obj)") |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 379 | if has_string: |
| 380 | _p2("self.data = binary_string") |
| 381 | _p2("binary_string = ''") |
| 382 | else: |
| 383 | _p2("# Fixme: If no self.data, add check for data remaining") |
| 384 | _p2("return binary_string") |
| 385 | |
Dan Talayco | b9cb548 | 2010-02-09 15:23:12 -0800 | [diff] [blame] | 386 | print """ |
| 387 | def __len__(self): |
| 388 | \""" |
| 389 | Return the length of this object once packed into a string |
| 390 | |
| 391 | @return An integer representing the number bytes in the packed |
| 392 | string. |
| 393 | |
| 394 | \""" |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 395 | length = 0 |
Dan Talayco | b9cb548 | 2010-02-09 15:23:12 -0800 | [diff] [blame] | 396 | """ |
Dan Talayco | 6d2470b | 2010-02-07 22:59:49 -0800 | [diff] [blame] | 397 | if has_core_members: |
| 398 | _p2("length += " + parent + ".__len__(self)") |
| 399 | if has_list: |
Rich Lane | 62e9685 | 2013-03-11 12:04:45 -0700 | [diff] [blame] | 400 | _p2("for obj in self." + list_var + ":") |
| 401 | _p3("length += len(obj)") |
Dan Talayco | 6d2470b | 2010-02-07 22:59:49 -0800 | [diff] [blame] | 402 | if has_string: |
| 403 | _p2("length += len(self.data)") |
| 404 | _p2("return length") |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 405 | |
Dan Talayco | b9cb548 | 2010-02-09 15:23:12 -0800 | [diff] [blame] | 406 | print """ |
Dan Talayco | b9cb548 | 2010-02-09 15:23:12 -0800 | [diff] [blame] | 407 | def show(self, prefix=''): |
| 408 | \""" |
Dan Talayco | 46755fa | 2010-03-09 21:44:29 -0800 | [diff] [blame] | 409 | Generate a string (with multiple lines) describing the contents |
| 410 | of the object in a readable manner |
Dan Talayco | b9cb548 | 2010-02-09 15:23:12 -0800 | [diff] [blame] | 411 | |
Dan Talayco | 46755fa | 2010-03-09 21:44:29 -0800 | [diff] [blame] | 412 | @param prefix Pre-pended at the beginning of each line. |
Dan Talayco | b9cb548 | 2010-02-09 15:23:12 -0800 | [diff] [blame] | 413 | |
| 414 | \""" |
| 415 | """ |
Dan Talayco | 46755fa | 2010-03-09 21:44:29 -0800 | [diff] [blame] | 416 | _p2("outstr = prefix + '" + msg + " (" + msg_name + ")\\n'") |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 417 | _p2("prefix += ' '") |
Dan Talayco | 46755fa | 2010-03-09 21:44:29 -0800 | [diff] [blame] | 418 | _p2("outstr += prefix + 'ofp header\\n'") |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 419 | if has_core_members: |
Dan Talayco | 46755fa | 2010-03-09 21:44:29 -0800 | [diff] [blame] | 420 | _p2("outstr += " + parent + ".show(self, prefix)") |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 421 | if has_list: |
| 422 | if list_type == None: |
Dan Talayco | 46755fa | 2010-03-09 21:44:29 -0800 | [diff] [blame] | 423 | _p2('outstr += prefix + "Array ' + list_var + '\\n"') |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 424 | _p2('for obj in self.' + list_var +':') |
Dan Talayco | 46755fa | 2010-03-09 21:44:29 -0800 | [diff] [blame] | 425 | _p3("outstr += obj.show(prefix + ' ')") |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 426 | else: |
Dan Talayco | 46755fa | 2010-03-09 21:44:29 -0800 | [diff] [blame] | 427 | _p2('outstr += prefix + "List ' + list_var + '\\n"') |
Rich Lane | e6ea3fe | 2013-03-08 17:54:38 -0800 | [diff] [blame] | 428 | _p2('for obj in self.' + list_var + ':') |
| 429 | _p3('outstr += obj.show(prefix + " ")') |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 430 | if has_string: |
Dan Talayco | 46755fa | 2010-03-09 21:44:29 -0800 | [diff] [blame] | 431 | _p2("outstr += prefix + 'data is of length ' + str(len(self.data)) + '\\n'") |
Dan Talayco | 6d2470b | 2010-02-07 22:59:49 -0800 | [diff] [blame] | 432 | _p2("##@todo Fix this circular reference") |
| 433 | _p2("# if len(self.data) > 0:") |
| 434 | _p3("# obj = of_message_parse(self.data)") |
| 435 | _p3("# if obj != None:") |
Dan Talayco | 46755fa | 2010-03-09 21:44:29 -0800 | [diff] [blame] | 436 | _p4("# outstr += obj.show(prefix)") |
Dan Talayco | 6d2470b | 2010-02-07 22:59:49 -0800 | [diff] [blame] | 437 | _p3("# else:") |
Dan Talayco | 46755fa | 2010-03-09 21:44:29 -0800 | [diff] [blame] | 438 | _p4('# outstr += prefix + "Unable to parse data\\n"') |
| 439 | _p2('return outstr') |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 440 | |
Dan Talayco | b9cb548 | 2010-02-09 15:23:12 -0800 | [diff] [blame] | 441 | print """ |
| 442 | def __eq__(self, other): |
| 443 | \""" |
| 444 | Return True if self and other hold the same data |
| 445 | |
| 446 | @param other Other object in comparison |
| 447 | |
| 448 | \""" |
| 449 | if type(self) != type(other): return False |
Dan Talayco | b9cb548 | 2010-02-09 15:23:12 -0800 | [diff] [blame] | 450 | """ |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 451 | if has_core_members: |
Dan Talayco | 6d2470b | 2010-02-07 22:59:49 -0800 | [diff] [blame] | 452 | _p2("if not " + parent + ".__eq__(self, other): return False") |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 453 | if has_string: |
| 454 | _p2("if self.data != other.data: return False") |
| 455 | if has_list: |
| 456 | _p2("if self." + list_var + " != other." + list_var + ": return False") |
| 457 | _p2("return True") |
| 458 | |
Dan Talayco | b9cb548 | 2010-02-09 15:23:12 -0800 | [diff] [blame] | 459 | print """ |
| 460 | def __ne__(self, other): |
| 461 | \""" |
| 462 | Return True if self and other do not hold the same data |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 463 | |
Dan Talayco | b9cb548 | 2010-02-09 15:23:12 -0800 | [diff] [blame] | 464 | @param other Other object in comparison |
| 465 | |
| 466 | \""" |
| 467 | return not self.__eq__(other) |
| 468 | """ |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 469 | |
| 470 | |
| 471 | ################################################################ |
| 472 | # |
| 473 | # Stats request subclasses |
| 474 | # description_request, flow, aggregate, table, port, vendor |
| 475 | # |
| 476 | ################################################################ |
| 477 | |
| 478 | # table and desc stats requests are special with empty body |
| 479 | extra_ofp_stats_req_defs = """ |
| 480 | # Stats request bodies for desc and table stats are not defined in the |
| 481 | # OpenFlow header; We define them here. They are empty classes, really |
| 482 | |
| 483 | class ofp_desc_stats_request: |
| 484 | \""" |
| 485 | Forced definition of ofp_desc_stats_request (empty class) |
| 486 | \""" |
| 487 | def __init__(self): |
| 488 | pass |
| 489 | def pack(self, assertstruct=True): |
| 490 | return "" |
| 491 | def unpack(self, binary_string): |
| 492 | return binary_string |
| 493 | def __len__(self): |
| 494 | return 0 |
| 495 | def show(self, prefix=''): |
Dan Talayco | 46755fa | 2010-03-09 21:44:29 -0800 | [diff] [blame] | 496 | return prefix + "ofp_desc_stats_request (empty)\\n" |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 497 | def __eq__(self, other): |
| 498 | return type(self) == type(other) |
| 499 | def __ne__(self, other): |
| 500 | return type(self) != type(other) |
| 501 | |
| 502 | OFP_DESC_STATS_REQUEST_BYTES = 0 |
| 503 | |
| 504 | class ofp_table_stats_request: |
| 505 | \""" |
| 506 | Forced definition of ofp_table_stats_request (empty class) |
| 507 | \""" |
| 508 | def __init__(self): |
| 509 | pass |
| 510 | def pack(self, assertstruct=True): |
| 511 | return "" |
| 512 | def unpack(self, binary_string): |
| 513 | return binary_string |
| 514 | def __len__(self): |
| 515 | return 0 |
| 516 | def show(self, prefix=''): |
Dan Talayco | 46755fa | 2010-03-09 21:44:29 -0800 | [diff] [blame] | 517 | return prefix + "ofp_table_stats_request (empty)\\n" |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 518 | def __eq__(self, other): |
| 519 | return type(self) == type(other) |
| 520 | def __ne__(self, other): |
| 521 | return type(self) != type(other) |
| 522 | |
| 523 | OFP_TABLE_STATS_REQUEST_BYTES = 0 |
| 524 | |
| 525 | """ |
| 526 | |
| 527 | stats_request_template = """ |
| 528 | class --TYPE--_stats_request(ofp_stats_request, ofp_--TYPE--_stats_request): |
| 529 | \""" |
| 530 | Wrapper class for --TYPE-- stats request message |
| 531 | \""" |
Rich Lane | c3c2ae1 | 2013-01-04 10:13:17 -0800 | [diff] [blame] | 532 | def __init__(self, **kwargs): |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 533 | ofp_stats_request.__init__(self) |
| 534 | ofp_--TYPE--_stats_request.__init__(self) |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 535 | self.version = OFP_VERSION |
| 536 | self.type = OFPT_STATS_REQUEST |
Rich Lane | 7c7342a | 2013-03-11 14:16:58 -0700 | [diff] [blame] | 537 | self.stats_type = --STATS_NAME-- |
Rich Lane | c3c2ae1 | 2013-01-04 10:13:17 -0800 | [diff] [blame] | 538 | for (k, v) in kwargs.items(): |
| 539 | if hasattr(self, k): |
| 540 | setattr(self, k, v) |
| 541 | else: |
| 542 | raise NameError("field %s does not exist in %s" % (k, self.__class__)) |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 543 | |
| 544 | def pack(self, assertstruct=True): |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 545 | self.length = len(self) |
| 546 | packed = "" |
Dan Talayco | 36f2f1f | 2010-02-10 22:40:26 -0800 | [diff] [blame] | 547 | packed += ofp_stats_request.pack(self) |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 548 | packed += ofp_--TYPE--_stats_request.pack(self) |
Dan Talayco | 6d2470b | 2010-02-07 22:59:49 -0800 | [diff] [blame] | 549 | return packed |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 550 | |
| 551 | def unpack(self, binary_string): |
| 552 | binary_string = ofp_stats_request.unpack(self, binary_string) |
| 553 | binary_string = ofp_--TYPE--_stats_request.unpack(self, binary_string) |
| 554 | if len(binary_string) != 0: |
Dan Talayco | 36f2f1f | 2010-02-10 22:40:26 -0800 | [diff] [blame] | 555 | print "ERROR unpacking --TYPE--: extra data" |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 556 | return binary_string |
| 557 | |
| 558 | def __len__(self): |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 559 | return OFP_STATS_REQUEST_BYTES + \\ |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 560 | OFP_--TYPE_UPPER--_STATS_REQUEST_BYTES |
| 561 | |
| 562 | def show(self, prefix=''): |
Dan Talayco | 46755fa | 2010-03-09 21:44:29 -0800 | [diff] [blame] | 563 | outstr = prefix + "--TYPE--_stats_request\\n" |
| 564 | outstr += prefix + "ofp header:\\n" |
Dan Talayco | 46755fa | 2010-03-09 21:44:29 -0800 | [diff] [blame] | 565 | outstr += ofp_stats_request.show(self) |
| 566 | outstr += ofp_--TYPE--_stats_request.show(self) |
| 567 | return outstr |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 568 | |
| 569 | def __eq__(self, other): |
Dan Talayco | 36f2f1f | 2010-02-10 22:40:26 -0800 | [diff] [blame] | 570 | if type(self) != type(other): return False |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 571 | return (ofp_stats_request.__eq__(self, other) and |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 572 | ofp_--TYPE--_stats_request.__eq__(self, other)) |
| 573 | |
| 574 | def __ne__(self, other): return not self.__eq__(other) |
| 575 | """ |
| 576 | |
| 577 | ################################################################ |
| 578 | # |
| 579 | # Stats replies always have an array at the end. |
| 580 | # For aggregate and desc, these arrays are always of length 1 |
| 581 | # This array is always called stats |
| 582 | # |
| 583 | ################################################################ |
| 584 | |
| 585 | |
| 586 | # Template for objects stats reply messages |
| 587 | stats_reply_template = """ |
| 588 | class --TYPE--_stats_reply(ofp_stats_reply): |
| 589 | \""" |
| 590 | Wrapper class for --TYPE-- stats reply |
| 591 | \""" |
| 592 | def __init__(self): |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 593 | ofp_stats_reply.__init__(self) |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 594 | self.version = OFP_VERSION |
| 595 | self.type = OFPT_STATS_REPLY |
| 596 | self.stats_type = --STATS_NAME-- |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 597 | # stats: Array of type --TYPE--_stats_entry |
Rich Lane | 5fd6faf | 2013-03-11 13:30:20 -0700 | [diff] [blame] | 598 | self.entries = [] |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 599 | |
| 600 | def pack(self, assertstruct=True): |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 601 | self.length = len(self) |
| 602 | packed = "" |
Dan Talayco | 36f2f1f | 2010-02-10 22:40:26 -0800 | [diff] [blame] | 603 | packed += ofp_stats_reply.pack(self) |
Rich Lane | 5fd6faf | 2013-03-11 13:30:20 -0700 | [diff] [blame] | 604 | for obj in self.entries: |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 605 | packed += obj.pack() |
Dan Talayco | 6d2470b | 2010-02-07 22:59:49 -0800 | [diff] [blame] | 606 | return packed |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 607 | |
| 608 | def unpack(self, binary_string): |
| 609 | binary_string = ofp_stats_reply.unpack(self, binary_string) |
| 610 | dummy = --TYPE--_stats_entry() |
| 611 | while len(binary_string) >= len(dummy): |
| 612 | obj = --TYPE--_stats_entry() |
| 613 | binary_string = obj.unpack(binary_string) |
Rich Lane | 5fd6faf | 2013-03-11 13:30:20 -0700 | [diff] [blame] | 614 | self.entries.append(obj) |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 615 | if len(binary_string) != 0: |
| 616 | print "ERROR unpacking --TYPE-- stats string: extra bytes" |
| 617 | return binary_string |
| 618 | |
| 619 | def __len__(self): |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 620 | length = OFP_STATS_REPLY_BYTES |
Rich Lane | 5fd6faf | 2013-03-11 13:30:20 -0700 | [diff] [blame] | 621 | for obj in self.entries: |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 622 | length += len(obj) |
| 623 | return length |
| 624 | |
| 625 | def show(self, prefix=''): |
Dan Talayco | 46755fa | 2010-03-09 21:44:29 -0800 | [diff] [blame] | 626 | outstr = prefix + "--TYPE--_stats_reply\\n" |
| 627 | outstr += prefix + "ofp header:\\n" |
Dan Talayco | 46755fa | 2010-03-09 21:44:29 -0800 | [diff] [blame] | 628 | outstr += ofp_stats_reply.show(self) |
Rich Lane | 5fd6faf | 2013-03-11 13:30:20 -0700 | [diff] [blame] | 629 | outstr += prefix + "Stats array of length " + str(len(self.entries)) + '\\n' |
| 630 | for obj in self.entries: |
Dan Talayco | 46755fa | 2010-03-09 21:44:29 -0800 | [diff] [blame] | 631 | outstr += obj.show() |
| 632 | return outstr |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 633 | |
| 634 | def __eq__(self, other): |
Dan Talayco | 36f2f1f | 2010-02-10 22:40:26 -0800 | [diff] [blame] | 635 | if type(self) != type(other): return False |
Rich Lane | b73808c | 2013-03-11 15:22:23 -0700 | [diff] [blame^] | 636 | return (ofp_stats_reply.__eq__(self, other) and |
Rich Lane | 5fd6faf | 2013-03-11 13:30:20 -0700 | [diff] [blame] | 637 | self.entries == other.entries) |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 638 | |
| 639 | def __ne__(self, other): return not self.__eq__(other) |
| 640 | """ |
| 641 | |
| 642 | # |
| 643 | # To address variations in stats reply bodies, the following |
| 644 | # "_entry" classes are defined for each element in the reply |
| 645 | # |
| 646 | |
| 647 | extra_stats_entry_defs = """ |
| 648 | # Stats entries define the content of one element in a stats |
| 649 | # reply for the indicated type; define _entry for consistency |
| 650 | |
| 651 | aggregate_stats_entry = ofp_aggregate_stats_reply |
| 652 | desc_stats_entry = ofp_desc_stats |
| 653 | port_stats_entry = ofp_port_stats |
| 654 | queue_stats_entry = ofp_queue_stats |
| 655 | table_stats_entry = ofp_table_stats |
| 656 | """ |
| 657 | |
| 658 | # Special case flow_stats to handle actions_list |
| 659 | |
| 660 | flow_stats_entry_def = """ |
| 661 | # |
| 662 | # Flow stats entry contains an action list of variable length, so |
| 663 | # it is done by hand |
| 664 | # |
| 665 | |
| 666 | class flow_stats_entry(ofp_flow_stats): |
| 667 | \""" |
| 668 | Special case flow stats entry to handle action list object |
| 669 | \""" |
| 670 | def __init__(self): |
| 671 | ofp_flow_stats.__init__(self) |
Rich Lane | 62e9685 | 2013-03-11 12:04:45 -0700 | [diff] [blame] | 672 | self.actions = [] |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 673 | |
| 674 | def pack(self, assertstruct=True): |
Dan Talayco | 6d2470b | 2010-02-07 22:59:49 -0800 | [diff] [blame] | 675 | self.length = len(self) |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 676 | packed = ofp_flow_stats.pack(self, assertstruct) |
Rich Lane | 62e9685 | 2013-03-11 12:04:45 -0700 | [diff] [blame] | 677 | packed += action_list(self.actions).pack() |
Dan Talayco | 6d2470b | 2010-02-07 22:59:49 -0800 | [diff] [blame] | 678 | if len(packed) != self.length: |
| 679 | print("ERROR: flow_stats_entry pack length not equal", |
| 680 | self.length, len(packed)) |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 681 | return packed |
| 682 | |
| 683 | def unpack(self, binary_string): |
| 684 | binary_string = ofp_flow_stats.unpack(self, binary_string) |
| 685 | ai_len = self.length - OFP_FLOW_STATS_BYTES |
Dan Talayco | 6d2470b | 2010-02-07 22:59:49 -0800 | [diff] [blame] | 686 | if ai_len < 0: |
| 687 | print("ERROR: flow_stats_entry unpack length too small", |
| 688 | self.length) |
Rich Lane | 62e9685 | 2013-03-11 12:04:45 -0700 | [diff] [blame] | 689 | obj = action_list() |
| 690 | binary_string = obj.unpack(binary_string, bytes=ai_len) |
| 691 | self.actions = list(obj) |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 692 | return binary_string |
| 693 | |
| 694 | def __len__(self): |
| 695 | return OFP_FLOW_STATS_BYTES + len(self.actions) |
| 696 | |
| 697 | def show(self, prefix=''): |
Dan Talayco | 46755fa | 2010-03-09 21:44:29 -0800 | [diff] [blame] | 698 | outstr = prefix + "flow_stats_entry\\n" |
| 699 | outstr += ofp_flow_stats.show(self, prefix + ' ') |
Rich Lane | e6ea3fe | 2013-03-08 17:54:38 -0800 | [diff] [blame] | 700 | outstr += prefix + "List actions\\n" |
| 701 | for obj in self.actions: |
| 702 | outstr += obj.show(prefix + ' ') |
Dan Talayco | 46755fa | 2010-03-09 21:44:29 -0800 | [diff] [blame] | 703 | return outstr |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 704 | |
| 705 | def __eq__(self, other): |
Dan Talayco | 36f2f1f | 2010-02-10 22:40:26 -0800 | [diff] [blame] | 706 | if type(self) != type(other): return False |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 707 | return (ofp_flow_stats.__eq__(self, other) and |
| 708 | self.actions == other.actions) |
| 709 | |
| 710 | def __ne__(self, other): return not self.__eq__(other) |
| 711 | """ |
| 712 | |
| 713 | stats_types = [ |
| 714 | 'aggregate', |
| 715 | 'desc', |
| 716 | 'flow', |
| 717 | 'port', |
| 718 | 'queue', |
| 719 | 'table'] |
| 720 | |
| 721 | if __name__ == '__main__': |
| 722 | |
| 723 | print message_top_matter |
| 724 | |
| 725 | print """ |
| 726 | ################################################################ |
| 727 | # |
| 728 | # OpenFlow Message Definitions |
| 729 | # |
| 730 | ################################################################ |
| 731 | """ |
| 732 | |
| 733 | msg_types = message_class_map.keys() |
| 734 | msg_types.sort() |
| 735 | |
| 736 | for t in msg_types: |
| 737 | gen_message_wrapper(t) |
| 738 | print |
| 739 | |
| 740 | print """ |
| 741 | ################################################################ |
| 742 | # |
| 743 | # Stats request and reply subclass definitions |
| 744 | # |
| 745 | ################################################################ |
| 746 | """ |
| 747 | |
| 748 | print extra_ofp_stats_req_defs |
| 749 | print extra_stats_entry_defs |
| 750 | print flow_stats_entry_def |
| 751 | |
| 752 | # Generate stats request and reply subclasses |
| 753 | for t in stats_types: |
| 754 | stats_name = "OFPST_" + t.upper() |
| 755 | to_print = re.sub('--TYPE--', t, stats_request_template) |
| 756 | to_print = re.sub('--TYPE_UPPER--', t.upper(), to_print) |
| 757 | to_print = re.sub('--STATS_NAME--', stats_name, to_print) |
| 758 | print to_print |
| 759 | to_print = re.sub('--TYPE--', t, stats_reply_template) |
| 760 | to_print = re.sub('--STATS_NAME--', stats_name, to_print) |
| 761 | print to_print |
| 762 | |
Dan Talayco | 411489d | 2010-02-12 23:03:46 -0800 | [diff] [blame] | 763 | # Lastly, generate a tuple containing all the message classes |
| 764 | print """ |
| 765 | message_type_list = ( |
| 766 | aggregate_stats_reply, |
| 767 | aggregate_stats_request, |
| 768 | bad_action_error_msg, |
| 769 | bad_request_error_msg, |
| 770 | barrier_reply, |
| 771 | barrier_request, |
| 772 | desc_stats_reply, |
| 773 | desc_stats_request, |
| 774 | echo_reply, |
| 775 | echo_request, |
| 776 | features_reply, |
| 777 | features_request, |
| 778 | flow_mod, |
| 779 | flow_mod_failed_error_msg, |
| 780 | flow_removed, |
| 781 | flow_stats_reply, |
| 782 | flow_stats_request, |
| 783 | get_config_reply, |
| 784 | get_config_request, |
| 785 | hello, |
| 786 | hello_failed_error_msg, |
| 787 | packet_in, |
| 788 | packet_out, |
| 789 | port_mod, |
| 790 | port_mod_failed_error_msg, |
| 791 | port_stats_reply, |
| 792 | port_stats_request, |
| 793 | port_status, |
| 794 | queue_get_config_reply, |
| 795 | queue_get_config_request, |
| 796 | queue_op_failed_error_msg, |
| 797 | queue_stats_reply, |
| 798 | queue_stats_request, |
| 799 | set_config, |
| 800 | table_stats_reply, |
| 801 | table_stats_request, |
| 802 | vendor |
| 803 | ) |
| 804 | """ |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 805 | |
| 806 | # |
| 807 | # OFP match variants |
| 808 | # ICMP 0x801 (?) ==> icmp_type/code replace tp_src/dst |
| 809 | # |
| 810 | |
| 811 | |