Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1 | # Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University |
| 2 | # Copyright (c) 2011, 2012 Open Networking Foundation |
| 3 | # Copyright (c) 2012, 2013 Big Switch Networks, Inc. |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4 | # See the file LICENSE.pyloxi which should have been included in the source distribution |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5 | |
| 6 | # Automatically generated by LOXI from template message.py |
| 7 | # Do not modify |
| 8 | |
| 9 | import struct |
| 10 | import loxi |
| 11 | import const |
| 12 | import common |
| 13 | import action # for unpack_list |
| 14 | import instruction # for unpack_list |
| 15 | import meter_band # for unpack_list |
| 16 | import util |
| 17 | import loxi.generic_util |
| 18 | |
| 19 | class Message(object): |
| 20 | version = const.OFP_VERSION |
| 21 | type = None # override in subclass |
| 22 | xid = None |
| 23 | |
| 24 | class aggregate_stats_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 25 | version = 4 |
| 26 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 27 | stats_type = 2 |
| 28 | |
| 29 | def __init__(self, xid=None, flags=None, packet_count=None, byte_count=None, flow_count=None): |
| 30 | self.xid = xid |
| 31 | if flags != None: |
| 32 | self.flags = flags |
| 33 | else: |
| 34 | self.flags = 0 |
| 35 | if packet_count != None: |
| 36 | self.packet_count = packet_count |
| 37 | else: |
| 38 | self.packet_count = 0 |
| 39 | if byte_count != None: |
| 40 | self.byte_count = byte_count |
| 41 | else: |
| 42 | self.byte_count = 0 |
| 43 | if flow_count != None: |
| 44 | self.flow_count = flow_count |
| 45 | else: |
| 46 | self.flow_count = 0 |
| 47 | |
| 48 | def pack(self): |
| 49 | packed = [] |
| 50 | packed.append(struct.pack("!B", self.version)) |
| 51 | packed.append(struct.pack("!B", self.type)) |
| 52 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 53 | packed.append(struct.pack("!L", self.xid)) |
| 54 | packed.append(struct.pack("!H", self.stats_type)) |
| 55 | packed.append(struct.pack("!H", self.flags)) |
| 56 | packed.append('\x00' * 4) |
| 57 | packed.append(struct.pack("!Q", self.packet_count)) |
| 58 | packed.append(struct.pack("!Q", self.byte_count)) |
| 59 | packed.append(struct.pack("!L", self.flow_count)) |
| 60 | packed.append('\x00' * 4) |
| 61 | length = sum([len(x) for x in packed]) |
| 62 | packed[2] = struct.pack("!H", length) |
| 63 | return ''.join(packed) |
| 64 | |
| 65 | @staticmethod |
| 66 | def unpack(buf): |
| 67 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 68 | obj = aggregate_stats_reply() |
| 69 | if type(buf) == loxi.generic_util.OFReader: |
| 70 | reader = buf |
| 71 | else: |
| 72 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 73 | _version = reader.read("!B")[0] |
| 74 | assert(_version == 4) |
| 75 | _type = reader.read("!B")[0] |
| 76 | assert(_type == 19) |
| 77 | _length = reader.read("!H")[0] |
| 78 | obj.xid = reader.read("!L")[0] |
| 79 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 80 | assert(_stats_type == 2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 81 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 82 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 83 | obj.packet_count = reader.read("!Q")[0] |
| 84 | obj.byte_count = reader.read("!Q")[0] |
| 85 | obj.flow_count = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 86 | reader.skip(4) |
| 87 | return obj |
| 88 | |
| 89 | def __eq__(self, other): |
| 90 | if type(self) != type(other): return False |
| 91 | if self.version != other.version: return False |
| 92 | if self.type != other.type: return False |
| 93 | if self.xid != other.xid: return False |
| 94 | if self.flags != other.flags: return False |
| 95 | if self.packet_count != other.packet_count: return False |
| 96 | if self.byte_count != other.byte_count: return False |
| 97 | if self.flow_count != other.flow_count: return False |
| 98 | return True |
| 99 | |
| 100 | def __ne__(self, other): |
| 101 | return not self.__eq__(other) |
| 102 | |
| 103 | def __str__(self): |
| 104 | return self.show() |
| 105 | |
| 106 | def show(self): |
| 107 | import loxi.pp |
| 108 | return loxi.pp.pp(self) |
| 109 | |
| 110 | def pretty_print(self, q): |
| 111 | q.text("aggregate_stats_reply {") |
| 112 | with q.group(): |
| 113 | with q.indent(2): |
| 114 | q.breakable() |
| 115 | q.text("xid = "); |
| 116 | if self.xid != None: |
| 117 | q.text("%#x" % self.xid) |
| 118 | else: |
| 119 | q.text('None') |
| 120 | q.text(","); q.breakable() |
| 121 | q.text("flags = "); |
| 122 | q.text("%#x" % self.flags) |
| 123 | q.text(","); q.breakable() |
| 124 | q.text("packet_count = "); |
| 125 | q.text("%#x" % self.packet_count) |
| 126 | q.text(","); q.breakable() |
| 127 | q.text("byte_count = "); |
| 128 | q.text("%#x" % self.byte_count) |
| 129 | q.text(","); q.breakable() |
| 130 | q.text("flow_count = "); |
| 131 | q.text("%#x" % self.flow_count) |
| 132 | q.breakable() |
| 133 | q.text('}') |
| 134 | |
| 135 | class aggregate_stats_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 136 | version = 4 |
| 137 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 138 | stats_type = 2 |
| 139 | |
| 140 | def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None): |
| 141 | self.xid = xid |
| 142 | if flags != None: |
| 143 | self.flags = flags |
| 144 | else: |
| 145 | self.flags = 0 |
| 146 | if table_id != None: |
| 147 | self.table_id = table_id |
| 148 | else: |
| 149 | self.table_id = 0 |
| 150 | if out_port != None: |
| 151 | self.out_port = out_port |
| 152 | else: |
| 153 | self.out_port = 0 |
| 154 | if out_group != None: |
| 155 | self.out_group = out_group |
| 156 | else: |
| 157 | self.out_group = 0 |
| 158 | if cookie != None: |
| 159 | self.cookie = cookie |
| 160 | else: |
| 161 | self.cookie = 0 |
| 162 | if cookie_mask != None: |
| 163 | self.cookie_mask = cookie_mask |
| 164 | else: |
| 165 | self.cookie_mask = 0 |
| 166 | if match != None: |
| 167 | self.match = match |
| 168 | else: |
| 169 | self.match = common.match() |
| 170 | |
| 171 | def pack(self): |
| 172 | packed = [] |
| 173 | packed.append(struct.pack("!B", self.version)) |
| 174 | packed.append(struct.pack("!B", self.type)) |
| 175 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 176 | packed.append(struct.pack("!L", self.xid)) |
| 177 | packed.append(struct.pack("!H", self.stats_type)) |
| 178 | packed.append(struct.pack("!H", self.flags)) |
| 179 | packed.append('\x00' * 4) |
| 180 | packed.append(struct.pack("!B", self.table_id)) |
| 181 | packed.append('\x00' * 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 182 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 183 | packed.append(struct.pack("!L", self.out_group)) |
| 184 | packed.append('\x00' * 4) |
| 185 | packed.append(struct.pack("!Q", self.cookie)) |
| 186 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 187 | packed.append(self.match.pack()) |
| 188 | length = sum([len(x) for x in packed]) |
| 189 | packed[2] = struct.pack("!H", length) |
| 190 | return ''.join(packed) |
| 191 | |
| 192 | @staticmethod |
| 193 | def unpack(buf): |
| 194 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 195 | obj = aggregate_stats_request() |
| 196 | if type(buf) == loxi.generic_util.OFReader: |
| 197 | reader = buf |
| 198 | else: |
| 199 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 200 | _version = reader.read("!B")[0] |
| 201 | assert(_version == 4) |
| 202 | _type = reader.read("!B")[0] |
| 203 | assert(_type == 18) |
| 204 | _length = reader.read("!H")[0] |
| 205 | obj.xid = reader.read("!L")[0] |
| 206 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 207 | assert(_stats_type == 2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 208 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 209 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 210 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 211 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 212 | obj.out_port = util.unpack_port_no(reader) |
| 213 | obj.out_group = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 214 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 215 | obj.cookie = reader.read("!Q")[0] |
| 216 | obj.cookie_mask = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 217 | obj.match = common.match.unpack(reader) |
| 218 | return obj |
| 219 | |
| 220 | def __eq__(self, other): |
| 221 | if type(self) != type(other): return False |
| 222 | if self.version != other.version: return False |
| 223 | if self.type != other.type: return False |
| 224 | if self.xid != other.xid: return False |
| 225 | if self.flags != other.flags: return False |
| 226 | if self.table_id != other.table_id: return False |
| 227 | if self.out_port != other.out_port: return False |
| 228 | if self.out_group != other.out_group: return False |
| 229 | if self.cookie != other.cookie: return False |
| 230 | if self.cookie_mask != other.cookie_mask: return False |
| 231 | if self.match != other.match: return False |
| 232 | return True |
| 233 | |
| 234 | def __ne__(self, other): |
| 235 | return not self.__eq__(other) |
| 236 | |
| 237 | def __str__(self): |
| 238 | return self.show() |
| 239 | |
| 240 | def show(self): |
| 241 | import loxi.pp |
| 242 | return loxi.pp.pp(self) |
| 243 | |
| 244 | def pretty_print(self, q): |
| 245 | q.text("aggregate_stats_request {") |
| 246 | with q.group(): |
| 247 | with q.indent(2): |
| 248 | q.breakable() |
| 249 | q.text("xid = "); |
| 250 | if self.xid != None: |
| 251 | q.text("%#x" % self.xid) |
| 252 | else: |
| 253 | q.text('None') |
| 254 | q.text(","); q.breakable() |
| 255 | q.text("flags = "); |
| 256 | q.text("%#x" % self.flags) |
| 257 | q.text(","); q.breakable() |
| 258 | q.text("table_id = "); |
| 259 | q.text("%#x" % self.table_id) |
| 260 | q.text(","); q.breakable() |
| 261 | q.text("out_port = "); |
| 262 | q.text(util.pretty_port(self.out_port)) |
| 263 | q.text(","); q.breakable() |
| 264 | q.text("out_group = "); |
| 265 | q.text("%#x" % self.out_group) |
| 266 | q.text(","); q.breakable() |
| 267 | q.text("cookie = "); |
| 268 | q.text("%#x" % self.cookie) |
| 269 | q.text(","); q.breakable() |
| 270 | q.text("cookie_mask = "); |
| 271 | q.text("%#x" % self.cookie_mask) |
| 272 | q.text(","); q.breakable() |
| 273 | q.text("match = "); |
| 274 | q.pp(self.match) |
| 275 | q.breakable() |
| 276 | q.text('}') |
| 277 | |
| 278 | class async_get_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 279 | version = 4 |
| 280 | type = 27 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 281 | |
| 282 | def __init__(self, xid=None, packet_in_mask_equal_master=None, packet_in_mask_slave=None, port_status_mask_equal_master=None, port_status_mask_slave=None, flow_removed_mask_equal_master=None, flow_removed_mask_slave=None): |
| 283 | self.xid = xid |
| 284 | if packet_in_mask_equal_master != None: |
| 285 | self.packet_in_mask_equal_master = packet_in_mask_equal_master |
| 286 | else: |
| 287 | self.packet_in_mask_equal_master = 0 |
| 288 | if packet_in_mask_slave != None: |
| 289 | self.packet_in_mask_slave = packet_in_mask_slave |
| 290 | else: |
| 291 | self.packet_in_mask_slave = 0 |
| 292 | if port_status_mask_equal_master != None: |
| 293 | self.port_status_mask_equal_master = port_status_mask_equal_master |
| 294 | else: |
| 295 | self.port_status_mask_equal_master = 0 |
| 296 | if port_status_mask_slave != None: |
| 297 | self.port_status_mask_slave = port_status_mask_slave |
| 298 | else: |
| 299 | self.port_status_mask_slave = 0 |
| 300 | if flow_removed_mask_equal_master != None: |
| 301 | self.flow_removed_mask_equal_master = flow_removed_mask_equal_master |
| 302 | else: |
| 303 | self.flow_removed_mask_equal_master = 0 |
| 304 | if flow_removed_mask_slave != None: |
| 305 | self.flow_removed_mask_slave = flow_removed_mask_slave |
| 306 | else: |
| 307 | self.flow_removed_mask_slave = 0 |
| 308 | |
| 309 | def pack(self): |
| 310 | packed = [] |
| 311 | packed.append(struct.pack("!B", self.version)) |
| 312 | packed.append(struct.pack("!B", self.type)) |
| 313 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 314 | packed.append(struct.pack("!L", self.xid)) |
| 315 | packed.append(struct.pack("!L", self.packet_in_mask_equal_master)) |
| 316 | packed.append(struct.pack("!L", self.packet_in_mask_slave)) |
| 317 | packed.append(struct.pack("!L", self.port_status_mask_equal_master)) |
| 318 | packed.append(struct.pack("!L", self.port_status_mask_slave)) |
| 319 | packed.append(struct.pack("!L", self.flow_removed_mask_equal_master)) |
| 320 | packed.append(struct.pack("!L", self.flow_removed_mask_slave)) |
| 321 | length = sum([len(x) for x in packed]) |
| 322 | packed[2] = struct.pack("!H", length) |
| 323 | return ''.join(packed) |
| 324 | |
| 325 | @staticmethod |
| 326 | def unpack(buf): |
| 327 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 328 | obj = async_get_reply() |
| 329 | if type(buf) == loxi.generic_util.OFReader: |
| 330 | reader = buf |
| 331 | else: |
| 332 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 333 | _version = reader.read("!B")[0] |
| 334 | assert(_version == 4) |
| 335 | _type = reader.read("!B")[0] |
| 336 | assert(_type == 27) |
| 337 | _length = reader.read("!H")[0] |
| 338 | obj.xid = reader.read("!L")[0] |
| 339 | obj.packet_in_mask_equal_master = reader.read("!L")[0] |
| 340 | obj.packet_in_mask_slave = reader.read("!L")[0] |
| 341 | obj.port_status_mask_equal_master = reader.read("!L")[0] |
| 342 | obj.port_status_mask_slave = reader.read("!L")[0] |
| 343 | obj.flow_removed_mask_equal_master = reader.read("!L")[0] |
| 344 | obj.flow_removed_mask_slave = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 345 | return obj |
| 346 | |
| 347 | def __eq__(self, other): |
| 348 | if type(self) != type(other): return False |
| 349 | if self.version != other.version: return False |
| 350 | if self.type != other.type: return False |
| 351 | if self.xid != other.xid: return False |
| 352 | if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False |
| 353 | if self.packet_in_mask_slave != other.packet_in_mask_slave: return False |
| 354 | if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False |
| 355 | if self.port_status_mask_slave != other.port_status_mask_slave: return False |
| 356 | if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False |
| 357 | if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False |
| 358 | return True |
| 359 | |
| 360 | def __ne__(self, other): |
| 361 | return not self.__eq__(other) |
| 362 | |
| 363 | def __str__(self): |
| 364 | return self.show() |
| 365 | |
| 366 | def show(self): |
| 367 | import loxi.pp |
| 368 | return loxi.pp.pp(self) |
| 369 | |
| 370 | def pretty_print(self, q): |
| 371 | q.text("async_get_reply {") |
| 372 | with q.group(): |
| 373 | with q.indent(2): |
| 374 | q.breakable() |
| 375 | q.text("xid = "); |
| 376 | if self.xid != None: |
| 377 | q.text("%#x" % self.xid) |
| 378 | else: |
| 379 | q.text('None') |
| 380 | q.text(","); q.breakable() |
| 381 | q.text("packet_in_mask_equal_master = "); |
| 382 | q.text("%#x" % self.packet_in_mask_equal_master) |
| 383 | q.text(","); q.breakable() |
| 384 | q.text("packet_in_mask_slave = "); |
| 385 | q.text("%#x" % self.packet_in_mask_slave) |
| 386 | q.text(","); q.breakable() |
| 387 | q.text("port_status_mask_equal_master = "); |
| 388 | q.text("%#x" % self.port_status_mask_equal_master) |
| 389 | q.text(","); q.breakable() |
| 390 | q.text("port_status_mask_slave = "); |
| 391 | q.text("%#x" % self.port_status_mask_slave) |
| 392 | q.text(","); q.breakable() |
| 393 | q.text("flow_removed_mask_equal_master = "); |
| 394 | q.text("%#x" % self.flow_removed_mask_equal_master) |
| 395 | q.text(","); q.breakable() |
| 396 | q.text("flow_removed_mask_slave = "); |
| 397 | q.text("%#x" % self.flow_removed_mask_slave) |
| 398 | q.breakable() |
| 399 | q.text('}') |
| 400 | |
| 401 | class async_get_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 402 | version = 4 |
| 403 | type = 26 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 404 | |
| 405 | def __init__(self, xid=None, packet_in_mask_equal_master=None, packet_in_mask_slave=None, port_status_mask_equal_master=None, port_status_mask_slave=None, flow_removed_mask_equal_master=None, flow_removed_mask_slave=None): |
| 406 | self.xid = xid |
| 407 | if packet_in_mask_equal_master != None: |
| 408 | self.packet_in_mask_equal_master = packet_in_mask_equal_master |
| 409 | else: |
| 410 | self.packet_in_mask_equal_master = 0 |
| 411 | if packet_in_mask_slave != None: |
| 412 | self.packet_in_mask_slave = packet_in_mask_slave |
| 413 | else: |
| 414 | self.packet_in_mask_slave = 0 |
| 415 | if port_status_mask_equal_master != None: |
| 416 | self.port_status_mask_equal_master = port_status_mask_equal_master |
| 417 | else: |
| 418 | self.port_status_mask_equal_master = 0 |
| 419 | if port_status_mask_slave != None: |
| 420 | self.port_status_mask_slave = port_status_mask_slave |
| 421 | else: |
| 422 | self.port_status_mask_slave = 0 |
| 423 | if flow_removed_mask_equal_master != None: |
| 424 | self.flow_removed_mask_equal_master = flow_removed_mask_equal_master |
| 425 | else: |
| 426 | self.flow_removed_mask_equal_master = 0 |
| 427 | if flow_removed_mask_slave != None: |
| 428 | self.flow_removed_mask_slave = flow_removed_mask_slave |
| 429 | else: |
| 430 | self.flow_removed_mask_slave = 0 |
| 431 | |
| 432 | def pack(self): |
| 433 | packed = [] |
| 434 | packed.append(struct.pack("!B", self.version)) |
| 435 | packed.append(struct.pack("!B", self.type)) |
| 436 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 437 | packed.append(struct.pack("!L", self.xid)) |
| 438 | packed.append(struct.pack("!L", self.packet_in_mask_equal_master)) |
| 439 | packed.append(struct.pack("!L", self.packet_in_mask_slave)) |
| 440 | packed.append(struct.pack("!L", self.port_status_mask_equal_master)) |
| 441 | packed.append(struct.pack("!L", self.port_status_mask_slave)) |
| 442 | packed.append(struct.pack("!L", self.flow_removed_mask_equal_master)) |
| 443 | packed.append(struct.pack("!L", self.flow_removed_mask_slave)) |
| 444 | length = sum([len(x) for x in packed]) |
| 445 | packed[2] = struct.pack("!H", length) |
| 446 | return ''.join(packed) |
| 447 | |
| 448 | @staticmethod |
| 449 | def unpack(buf): |
| 450 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 451 | obj = async_get_request() |
| 452 | if type(buf) == loxi.generic_util.OFReader: |
| 453 | reader = buf |
| 454 | else: |
| 455 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 456 | _version = reader.read("!B")[0] |
| 457 | assert(_version == 4) |
| 458 | _type = reader.read("!B")[0] |
| 459 | assert(_type == 26) |
| 460 | _length = reader.read("!H")[0] |
| 461 | obj.xid = reader.read("!L")[0] |
| 462 | obj.packet_in_mask_equal_master = reader.read("!L")[0] |
| 463 | obj.packet_in_mask_slave = reader.read("!L")[0] |
| 464 | obj.port_status_mask_equal_master = reader.read("!L")[0] |
| 465 | obj.port_status_mask_slave = reader.read("!L")[0] |
| 466 | obj.flow_removed_mask_equal_master = reader.read("!L")[0] |
| 467 | obj.flow_removed_mask_slave = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 468 | return obj |
| 469 | |
| 470 | def __eq__(self, other): |
| 471 | if type(self) != type(other): return False |
| 472 | if self.version != other.version: return False |
| 473 | if self.type != other.type: return False |
| 474 | if self.xid != other.xid: return False |
| 475 | if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False |
| 476 | if self.packet_in_mask_slave != other.packet_in_mask_slave: return False |
| 477 | if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False |
| 478 | if self.port_status_mask_slave != other.port_status_mask_slave: return False |
| 479 | if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False |
| 480 | if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False |
| 481 | return True |
| 482 | |
| 483 | def __ne__(self, other): |
| 484 | return not self.__eq__(other) |
| 485 | |
| 486 | def __str__(self): |
| 487 | return self.show() |
| 488 | |
| 489 | def show(self): |
| 490 | import loxi.pp |
| 491 | return loxi.pp.pp(self) |
| 492 | |
| 493 | def pretty_print(self, q): |
| 494 | q.text("async_get_request {") |
| 495 | with q.group(): |
| 496 | with q.indent(2): |
| 497 | q.breakable() |
| 498 | q.text("xid = "); |
| 499 | if self.xid != None: |
| 500 | q.text("%#x" % self.xid) |
| 501 | else: |
| 502 | q.text('None') |
| 503 | q.text(","); q.breakable() |
| 504 | q.text("packet_in_mask_equal_master = "); |
| 505 | q.text("%#x" % self.packet_in_mask_equal_master) |
| 506 | q.text(","); q.breakable() |
| 507 | q.text("packet_in_mask_slave = "); |
| 508 | q.text("%#x" % self.packet_in_mask_slave) |
| 509 | q.text(","); q.breakable() |
| 510 | q.text("port_status_mask_equal_master = "); |
| 511 | q.text("%#x" % self.port_status_mask_equal_master) |
| 512 | q.text(","); q.breakable() |
| 513 | q.text("port_status_mask_slave = "); |
| 514 | q.text("%#x" % self.port_status_mask_slave) |
| 515 | q.text(","); q.breakable() |
| 516 | q.text("flow_removed_mask_equal_master = "); |
| 517 | q.text("%#x" % self.flow_removed_mask_equal_master) |
| 518 | q.text(","); q.breakable() |
| 519 | q.text("flow_removed_mask_slave = "); |
| 520 | q.text("%#x" % self.flow_removed_mask_slave) |
| 521 | q.breakable() |
| 522 | q.text('}') |
| 523 | |
| 524 | class async_set(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 525 | version = 4 |
| 526 | type = 28 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 527 | |
| 528 | def __init__(self, xid=None, packet_in_mask_equal_master=None, packet_in_mask_slave=None, port_status_mask_equal_master=None, port_status_mask_slave=None, flow_removed_mask_equal_master=None, flow_removed_mask_slave=None): |
| 529 | self.xid = xid |
| 530 | if packet_in_mask_equal_master != None: |
| 531 | self.packet_in_mask_equal_master = packet_in_mask_equal_master |
| 532 | else: |
| 533 | self.packet_in_mask_equal_master = 0 |
| 534 | if packet_in_mask_slave != None: |
| 535 | self.packet_in_mask_slave = packet_in_mask_slave |
| 536 | else: |
| 537 | self.packet_in_mask_slave = 0 |
| 538 | if port_status_mask_equal_master != None: |
| 539 | self.port_status_mask_equal_master = port_status_mask_equal_master |
| 540 | else: |
| 541 | self.port_status_mask_equal_master = 0 |
| 542 | if port_status_mask_slave != None: |
| 543 | self.port_status_mask_slave = port_status_mask_slave |
| 544 | else: |
| 545 | self.port_status_mask_slave = 0 |
| 546 | if flow_removed_mask_equal_master != None: |
| 547 | self.flow_removed_mask_equal_master = flow_removed_mask_equal_master |
| 548 | else: |
| 549 | self.flow_removed_mask_equal_master = 0 |
| 550 | if flow_removed_mask_slave != None: |
| 551 | self.flow_removed_mask_slave = flow_removed_mask_slave |
| 552 | else: |
| 553 | self.flow_removed_mask_slave = 0 |
| 554 | |
| 555 | def pack(self): |
| 556 | packed = [] |
| 557 | packed.append(struct.pack("!B", self.version)) |
| 558 | packed.append(struct.pack("!B", self.type)) |
| 559 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 560 | packed.append(struct.pack("!L", self.xid)) |
| 561 | packed.append(struct.pack("!L", self.packet_in_mask_equal_master)) |
| 562 | packed.append(struct.pack("!L", self.packet_in_mask_slave)) |
| 563 | packed.append(struct.pack("!L", self.port_status_mask_equal_master)) |
| 564 | packed.append(struct.pack("!L", self.port_status_mask_slave)) |
| 565 | packed.append(struct.pack("!L", self.flow_removed_mask_equal_master)) |
| 566 | packed.append(struct.pack("!L", self.flow_removed_mask_slave)) |
| 567 | length = sum([len(x) for x in packed]) |
| 568 | packed[2] = struct.pack("!H", length) |
| 569 | return ''.join(packed) |
| 570 | |
| 571 | @staticmethod |
| 572 | def unpack(buf): |
| 573 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 574 | obj = async_set() |
| 575 | if type(buf) == loxi.generic_util.OFReader: |
| 576 | reader = buf |
| 577 | else: |
| 578 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 579 | _version = reader.read("!B")[0] |
| 580 | assert(_version == 4) |
| 581 | _type = reader.read("!B")[0] |
| 582 | assert(_type == 28) |
| 583 | _length = reader.read("!H")[0] |
| 584 | obj.xid = reader.read("!L")[0] |
| 585 | obj.packet_in_mask_equal_master = reader.read("!L")[0] |
| 586 | obj.packet_in_mask_slave = reader.read("!L")[0] |
| 587 | obj.port_status_mask_equal_master = reader.read("!L")[0] |
| 588 | obj.port_status_mask_slave = reader.read("!L")[0] |
| 589 | obj.flow_removed_mask_equal_master = reader.read("!L")[0] |
| 590 | obj.flow_removed_mask_slave = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 591 | return obj |
| 592 | |
| 593 | def __eq__(self, other): |
| 594 | if type(self) != type(other): return False |
| 595 | if self.version != other.version: return False |
| 596 | if self.type != other.type: return False |
| 597 | if self.xid != other.xid: return False |
| 598 | if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False |
| 599 | if self.packet_in_mask_slave != other.packet_in_mask_slave: return False |
| 600 | if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False |
| 601 | if self.port_status_mask_slave != other.port_status_mask_slave: return False |
| 602 | if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False |
| 603 | if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False |
| 604 | return True |
| 605 | |
| 606 | def __ne__(self, other): |
| 607 | return not self.__eq__(other) |
| 608 | |
| 609 | def __str__(self): |
| 610 | return self.show() |
| 611 | |
| 612 | def show(self): |
| 613 | import loxi.pp |
| 614 | return loxi.pp.pp(self) |
| 615 | |
| 616 | def pretty_print(self, q): |
| 617 | q.text("async_set {") |
| 618 | with q.group(): |
| 619 | with q.indent(2): |
| 620 | q.breakable() |
| 621 | q.text("xid = "); |
| 622 | if self.xid != None: |
| 623 | q.text("%#x" % self.xid) |
| 624 | else: |
| 625 | q.text('None') |
| 626 | q.text(","); q.breakable() |
| 627 | q.text("packet_in_mask_equal_master = "); |
| 628 | q.text("%#x" % self.packet_in_mask_equal_master) |
| 629 | q.text(","); q.breakable() |
| 630 | q.text("packet_in_mask_slave = "); |
| 631 | q.text("%#x" % self.packet_in_mask_slave) |
| 632 | q.text(","); q.breakable() |
| 633 | q.text("port_status_mask_equal_master = "); |
| 634 | q.text("%#x" % self.port_status_mask_equal_master) |
| 635 | q.text(","); q.breakable() |
| 636 | q.text("port_status_mask_slave = "); |
| 637 | q.text("%#x" % self.port_status_mask_slave) |
| 638 | q.text(","); q.breakable() |
| 639 | q.text("flow_removed_mask_equal_master = "); |
| 640 | q.text("%#x" % self.flow_removed_mask_equal_master) |
| 641 | q.text(","); q.breakable() |
| 642 | q.text("flow_removed_mask_slave = "); |
| 643 | q.text("%#x" % self.flow_removed_mask_slave) |
| 644 | q.breakable() |
| 645 | q.text('}') |
| 646 | |
| 647 | class barrier_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 648 | version = 4 |
| 649 | type = 21 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 650 | |
| 651 | def __init__(self, xid=None): |
| 652 | self.xid = xid |
| 653 | |
| 654 | def pack(self): |
| 655 | packed = [] |
| 656 | packed.append(struct.pack("!B", self.version)) |
| 657 | packed.append(struct.pack("!B", self.type)) |
| 658 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 659 | packed.append(struct.pack("!L", self.xid)) |
| 660 | length = sum([len(x) for x in packed]) |
| 661 | packed[2] = struct.pack("!H", length) |
| 662 | return ''.join(packed) |
| 663 | |
| 664 | @staticmethod |
| 665 | def unpack(buf): |
| 666 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 667 | obj = barrier_reply() |
| 668 | if type(buf) == loxi.generic_util.OFReader: |
| 669 | reader = buf |
| 670 | else: |
| 671 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 672 | _version = reader.read("!B")[0] |
| 673 | assert(_version == 4) |
| 674 | _type = reader.read("!B")[0] |
| 675 | assert(_type == 21) |
| 676 | _length = reader.read("!H")[0] |
| 677 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 678 | return obj |
| 679 | |
| 680 | def __eq__(self, other): |
| 681 | if type(self) != type(other): return False |
| 682 | if self.version != other.version: return False |
| 683 | if self.type != other.type: return False |
| 684 | if self.xid != other.xid: return False |
| 685 | return True |
| 686 | |
| 687 | def __ne__(self, other): |
| 688 | return not self.__eq__(other) |
| 689 | |
| 690 | def __str__(self): |
| 691 | return self.show() |
| 692 | |
| 693 | def show(self): |
| 694 | import loxi.pp |
| 695 | return loxi.pp.pp(self) |
| 696 | |
| 697 | def pretty_print(self, q): |
| 698 | q.text("barrier_reply {") |
| 699 | with q.group(): |
| 700 | with q.indent(2): |
| 701 | q.breakable() |
| 702 | q.text("xid = "); |
| 703 | if self.xid != None: |
| 704 | q.text("%#x" % self.xid) |
| 705 | else: |
| 706 | q.text('None') |
| 707 | q.breakable() |
| 708 | q.text('}') |
| 709 | |
| 710 | class barrier_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 711 | version = 4 |
| 712 | type = 20 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 713 | |
| 714 | def __init__(self, xid=None): |
| 715 | self.xid = xid |
| 716 | |
| 717 | def pack(self): |
| 718 | packed = [] |
| 719 | packed.append(struct.pack("!B", self.version)) |
| 720 | packed.append(struct.pack("!B", self.type)) |
| 721 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 722 | packed.append(struct.pack("!L", self.xid)) |
| 723 | length = sum([len(x) for x in packed]) |
| 724 | packed[2] = struct.pack("!H", length) |
| 725 | return ''.join(packed) |
| 726 | |
| 727 | @staticmethod |
| 728 | def unpack(buf): |
| 729 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 730 | obj = barrier_request() |
| 731 | if type(buf) == loxi.generic_util.OFReader: |
| 732 | reader = buf |
| 733 | else: |
| 734 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 735 | _version = reader.read("!B")[0] |
| 736 | assert(_version == 4) |
| 737 | _type = reader.read("!B")[0] |
| 738 | assert(_type == 20) |
| 739 | _length = reader.read("!H")[0] |
| 740 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 741 | return obj |
| 742 | |
| 743 | def __eq__(self, other): |
| 744 | if type(self) != type(other): return False |
| 745 | if self.version != other.version: return False |
| 746 | if self.type != other.type: return False |
| 747 | if self.xid != other.xid: return False |
| 748 | return True |
| 749 | |
| 750 | def __ne__(self, other): |
| 751 | return not self.__eq__(other) |
| 752 | |
| 753 | def __str__(self): |
| 754 | return self.show() |
| 755 | |
| 756 | def show(self): |
| 757 | import loxi.pp |
| 758 | return loxi.pp.pp(self) |
| 759 | |
| 760 | def pretty_print(self, q): |
| 761 | q.text("barrier_request {") |
| 762 | with q.group(): |
| 763 | with q.indent(2): |
| 764 | q.breakable() |
| 765 | q.text("xid = "); |
| 766 | if self.xid != None: |
| 767 | q.text("%#x" % self.xid) |
| 768 | else: |
| 769 | q.text('None') |
| 770 | q.breakable() |
| 771 | q.text('}') |
| 772 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 773 | class bsn_bw_clear_data_reply(Message): |
| 774 | version = 4 |
| 775 | type = 4 |
| 776 | experimenter = 6035143 |
| 777 | subtype = 22 |
| 778 | |
| 779 | def __init__(self, xid=None, status=None): |
| 780 | self.xid = xid |
| 781 | if status != None: |
| 782 | self.status = status |
| 783 | else: |
| 784 | self.status = 0 |
| 785 | |
| 786 | def pack(self): |
| 787 | packed = [] |
| 788 | packed.append(struct.pack("!B", self.version)) |
| 789 | packed.append(struct.pack("!B", self.type)) |
| 790 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 791 | packed.append(struct.pack("!L", self.xid)) |
| 792 | packed.append(struct.pack("!L", self.experimenter)) |
| 793 | packed.append(struct.pack("!L", self.subtype)) |
| 794 | packed.append(struct.pack("!L", self.status)) |
| 795 | length = sum([len(x) for x in packed]) |
| 796 | packed[2] = struct.pack("!H", length) |
| 797 | return ''.join(packed) |
| 798 | |
| 799 | @staticmethod |
| 800 | def unpack(buf): |
| 801 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 802 | obj = bsn_bw_clear_data_reply() |
| 803 | if type(buf) == loxi.generic_util.OFReader: |
| 804 | reader = buf |
| 805 | else: |
| 806 | reader = loxi.generic_util.OFReader(buf) |
| 807 | _version = reader.read("!B")[0] |
| 808 | assert(_version == 4) |
| 809 | _type = reader.read("!B")[0] |
| 810 | assert(_type == 4) |
| 811 | _length = reader.read("!H")[0] |
| 812 | obj.xid = reader.read("!L")[0] |
| 813 | _experimenter = reader.read("!L")[0] |
| 814 | assert(_experimenter == 6035143) |
| 815 | _subtype = reader.read("!L")[0] |
| 816 | assert(_subtype == 22) |
| 817 | obj.status = reader.read("!L")[0] |
| 818 | return obj |
| 819 | |
| 820 | def __eq__(self, other): |
| 821 | if type(self) != type(other): return False |
| 822 | if self.version != other.version: return False |
| 823 | if self.type != other.type: return False |
| 824 | if self.xid != other.xid: return False |
| 825 | if self.status != other.status: return False |
| 826 | return True |
| 827 | |
| 828 | def __ne__(self, other): |
| 829 | return not self.__eq__(other) |
| 830 | |
| 831 | def __str__(self): |
| 832 | return self.show() |
| 833 | |
| 834 | def show(self): |
| 835 | import loxi.pp |
| 836 | return loxi.pp.pp(self) |
| 837 | |
| 838 | def pretty_print(self, q): |
| 839 | q.text("bsn_bw_clear_data_reply {") |
| 840 | with q.group(): |
| 841 | with q.indent(2): |
| 842 | q.breakable() |
| 843 | q.text("xid = "); |
| 844 | if self.xid != None: |
| 845 | q.text("%#x" % self.xid) |
| 846 | else: |
| 847 | q.text('None') |
| 848 | q.text(","); q.breakable() |
| 849 | q.text("status = "); |
| 850 | q.text("%#x" % self.status) |
| 851 | q.breakable() |
| 852 | q.text('}') |
| 853 | |
| 854 | class bsn_bw_clear_data_request(Message): |
| 855 | version = 4 |
| 856 | type = 4 |
| 857 | experimenter = 6035143 |
| 858 | subtype = 21 |
| 859 | |
| 860 | def __init__(self, xid=None): |
| 861 | self.xid = xid |
| 862 | |
| 863 | def pack(self): |
| 864 | packed = [] |
| 865 | packed.append(struct.pack("!B", self.version)) |
| 866 | packed.append(struct.pack("!B", self.type)) |
| 867 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 868 | packed.append(struct.pack("!L", self.xid)) |
| 869 | packed.append(struct.pack("!L", self.experimenter)) |
| 870 | packed.append(struct.pack("!L", self.subtype)) |
| 871 | length = sum([len(x) for x in packed]) |
| 872 | packed[2] = struct.pack("!H", length) |
| 873 | return ''.join(packed) |
| 874 | |
| 875 | @staticmethod |
| 876 | def unpack(buf): |
| 877 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 878 | obj = bsn_bw_clear_data_request() |
| 879 | if type(buf) == loxi.generic_util.OFReader: |
| 880 | reader = buf |
| 881 | else: |
| 882 | reader = loxi.generic_util.OFReader(buf) |
| 883 | _version = reader.read("!B")[0] |
| 884 | assert(_version == 4) |
| 885 | _type = reader.read("!B")[0] |
| 886 | assert(_type == 4) |
| 887 | _length = reader.read("!H")[0] |
| 888 | obj.xid = reader.read("!L")[0] |
| 889 | _experimenter = reader.read("!L")[0] |
| 890 | assert(_experimenter == 6035143) |
| 891 | _subtype = reader.read("!L")[0] |
| 892 | assert(_subtype == 21) |
| 893 | return obj |
| 894 | |
| 895 | def __eq__(self, other): |
| 896 | if type(self) != type(other): return False |
| 897 | if self.version != other.version: return False |
| 898 | if self.type != other.type: return False |
| 899 | if self.xid != other.xid: return False |
| 900 | return True |
| 901 | |
| 902 | def __ne__(self, other): |
| 903 | return not self.__eq__(other) |
| 904 | |
| 905 | def __str__(self): |
| 906 | return self.show() |
| 907 | |
| 908 | def show(self): |
| 909 | import loxi.pp |
| 910 | return loxi.pp.pp(self) |
| 911 | |
| 912 | def pretty_print(self, q): |
| 913 | q.text("bsn_bw_clear_data_request {") |
| 914 | with q.group(): |
| 915 | with q.indent(2): |
| 916 | q.breakable() |
| 917 | q.text("xid = "); |
| 918 | if self.xid != None: |
| 919 | q.text("%#x" % self.xid) |
| 920 | else: |
| 921 | q.text('None') |
| 922 | q.breakable() |
| 923 | q.text('}') |
| 924 | |
| 925 | class bsn_bw_enable_get_reply(Message): |
| 926 | version = 4 |
| 927 | type = 4 |
| 928 | experimenter = 6035143 |
| 929 | subtype = 20 |
| 930 | |
| 931 | def __init__(self, xid=None, enabled=None): |
| 932 | self.xid = xid |
| 933 | if enabled != None: |
| 934 | self.enabled = enabled |
| 935 | else: |
| 936 | self.enabled = 0 |
| 937 | |
| 938 | def pack(self): |
| 939 | packed = [] |
| 940 | packed.append(struct.pack("!B", self.version)) |
| 941 | packed.append(struct.pack("!B", self.type)) |
| 942 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 943 | packed.append(struct.pack("!L", self.xid)) |
| 944 | packed.append(struct.pack("!L", self.experimenter)) |
| 945 | packed.append(struct.pack("!L", self.subtype)) |
| 946 | packed.append(struct.pack("!L", self.enabled)) |
| 947 | length = sum([len(x) for x in packed]) |
| 948 | packed[2] = struct.pack("!H", length) |
| 949 | return ''.join(packed) |
| 950 | |
| 951 | @staticmethod |
| 952 | def unpack(buf): |
| 953 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 954 | obj = bsn_bw_enable_get_reply() |
| 955 | if type(buf) == loxi.generic_util.OFReader: |
| 956 | reader = buf |
| 957 | else: |
| 958 | reader = loxi.generic_util.OFReader(buf) |
| 959 | _version = reader.read("!B")[0] |
| 960 | assert(_version == 4) |
| 961 | _type = reader.read("!B")[0] |
| 962 | assert(_type == 4) |
| 963 | _length = reader.read("!H")[0] |
| 964 | obj.xid = reader.read("!L")[0] |
| 965 | _experimenter = reader.read("!L")[0] |
| 966 | assert(_experimenter == 6035143) |
| 967 | _subtype = reader.read("!L")[0] |
| 968 | assert(_subtype == 20) |
| 969 | obj.enabled = reader.read("!L")[0] |
| 970 | return obj |
| 971 | |
| 972 | def __eq__(self, other): |
| 973 | if type(self) != type(other): return False |
| 974 | if self.version != other.version: return False |
| 975 | if self.type != other.type: return False |
| 976 | if self.xid != other.xid: return False |
| 977 | if self.enabled != other.enabled: return False |
| 978 | return True |
| 979 | |
| 980 | def __ne__(self, other): |
| 981 | return not self.__eq__(other) |
| 982 | |
| 983 | def __str__(self): |
| 984 | return self.show() |
| 985 | |
| 986 | def show(self): |
| 987 | import loxi.pp |
| 988 | return loxi.pp.pp(self) |
| 989 | |
| 990 | def pretty_print(self, q): |
| 991 | q.text("bsn_bw_enable_get_reply {") |
| 992 | with q.group(): |
| 993 | with q.indent(2): |
| 994 | q.breakable() |
| 995 | q.text("xid = "); |
| 996 | if self.xid != None: |
| 997 | q.text("%#x" % self.xid) |
| 998 | else: |
| 999 | q.text('None') |
| 1000 | q.text(","); q.breakable() |
| 1001 | q.text("enabled = "); |
| 1002 | q.text("%#x" % self.enabled) |
| 1003 | q.breakable() |
| 1004 | q.text('}') |
| 1005 | |
| 1006 | class bsn_bw_enable_get_request(Message): |
| 1007 | version = 4 |
| 1008 | type = 4 |
| 1009 | experimenter = 6035143 |
| 1010 | subtype = 19 |
| 1011 | |
| 1012 | def __init__(self, xid=None): |
| 1013 | self.xid = xid |
| 1014 | |
| 1015 | def pack(self): |
| 1016 | packed = [] |
| 1017 | packed.append(struct.pack("!B", self.version)) |
| 1018 | packed.append(struct.pack("!B", self.type)) |
| 1019 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1020 | packed.append(struct.pack("!L", self.xid)) |
| 1021 | packed.append(struct.pack("!L", self.experimenter)) |
| 1022 | packed.append(struct.pack("!L", self.subtype)) |
| 1023 | length = sum([len(x) for x in packed]) |
| 1024 | packed[2] = struct.pack("!H", length) |
| 1025 | return ''.join(packed) |
| 1026 | |
| 1027 | @staticmethod |
| 1028 | def unpack(buf): |
| 1029 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 1030 | obj = bsn_bw_enable_get_request() |
| 1031 | if type(buf) == loxi.generic_util.OFReader: |
| 1032 | reader = buf |
| 1033 | else: |
| 1034 | reader = loxi.generic_util.OFReader(buf) |
| 1035 | _version = reader.read("!B")[0] |
| 1036 | assert(_version == 4) |
| 1037 | _type = reader.read("!B")[0] |
| 1038 | assert(_type == 4) |
| 1039 | _length = reader.read("!H")[0] |
| 1040 | obj.xid = reader.read("!L")[0] |
| 1041 | _experimenter = reader.read("!L")[0] |
| 1042 | assert(_experimenter == 6035143) |
| 1043 | _subtype = reader.read("!L")[0] |
| 1044 | assert(_subtype == 19) |
| 1045 | return obj |
| 1046 | |
| 1047 | def __eq__(self, other): |
| 1048 | if type(self) != type(other): return False |
| 1049 | if self.version != other.version: return False |
| 1050 | if self.type != other.type: return False |
| 1051 | if self.xid != other.xid: return False |
| 1052 | return True |
| 1053 | |
| 1054 | def __ne__(self, other): |
| 1055 | return not self.__eq__(other) |
| 1056 | |
| 1057 | def __str__(self): |
| 1058 | return self.show() |
| 1059 | |
| 1060 | def show(self): |
| 1061 | import loxi.pp |
| 1062 | return loxi.pp.pp(self) |
| 1063 | |
| 1064 | def pretty_print(self, q): |
| 1065 | q.text("bsn_bw_enable_get_request {") |
| 1066 | with q.group(): |
| 1067 | with q.indent(2): |
| 1068 | q.breakable() |
| 1069 | q.text("xid = "); |
| 1070 | if self.xid != None: |
| 1071 | q.text("%#x" % self.xid) |
| 1072 | else: |
| 1073 | q.text('None') |
| 1074 | q.breakable() |
| 1075 | q.text('}') |
| 1076 | |
| 1077 | class bsn_bw_enable_set_reply(Message): |
| 1078 | version = 4 |
| 1079 | type = 4 |
| 1080 | experimenter = 6035143 |
| 1081 | subtype = 23 |
| 1082 | |
| 1083 | def __init__(self, xid=None, enable=None, status=None): |
| 1084 | self.xid = xid |
| 1085 | if enable != None: |
| 1086 | self.enable = enable |
| 1087 | else: |
| 1088 | self.enable = 0 |
| 1089 | if status != None: |
| 1090 | self.status = status |
| 1091 | else: |
| 1092 | self.status = 0 |
| 1093 | |
| 1094 | def pack(self): |
| 1095 | packed = [] |
| 1096 | packed.append(struct.pack("!B", self.version)) |
| 1097 | packed.append(struct.pack("!B", self.type)) |
| 1098 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1099 | packed.append(struct.pack("!L", self.xid)) |
| 1100 | packed.append(struct.pack("!L", self.experimenter)) |
| 1101 | packed.append(struct.pack("!L", self.subtype)) |
| 1102 | packed.append(struct.pack("!L", self.enable)) |
| 1103 | packed.append(struct.pack("!L", self.status)) |
| 1104 | length = sum([len(x) for x in packed]) |
| 1105 | packed[2] = struct.pack("!H", length) |
| 1106 | return ''.join(packed) |
| 1107 | |
| 1108 | @staticmethod |
| 1109 | def unpack(buf): |
| 1110 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 1111 | obj = bsn_bw_enable_set_reply() |
| 1112 | if type(buf) == loxi.generic_util.OFReader: |
| 1113 | reader = buf |
| 1114 | else: |
| 1115 | reader = loxi.generic_util.OFReader(buf) |
| 1116 | _version = reader.read("!B")[0] |
| 1117 | assert(_version == 4) |
| 1118 | _type = reader.read("!B")[0] |
| 1119 | assert(_type == 4) |
| 1120 | _length = reader.read("!H")[0] |
| 1121 | obj.xid = reader.read("!L")[0] |
| 1122 | _experimenter = reader.read("!L")[0] |
| 1123 | assert(_experimenter == 6035143) |
| 1124 | _subtype = reader.read("!L")[0] |
| 1125 | assert(_subtype == 23) |
| 1126 | obj.enable = reader.read("!L")[0] |
| 1127 | obj.status = reader.read("!L")[0] |
| 1128 | return obj |
| 1129 | |
| 1130 | def __eq__(self, other): |
| 1131 | if type(self) != type(other): return False |
| 1132 | if self.version != other.version: return False |
| 1133 | if self.type != other.type: return False |
| 1134 | if self.xid != other.xid: return False |
| 1135 | if self.enable != other.enable: return False |
| 1136 | if self.status != other.status: return False |
| 1137 | return True |
| 1138 | |
| 1139 | def __ne__(self, other): |
| 1140 | return not self.__eq__(other) |
| 1141 | |
| 1142 | def __str__(self): |
| 1143 | return self.show() |
| 1144 | |
| 1145 | def show(self): |
| 1146 | import loxi.pp |
| 1147 | return loxi.pp.pp(self) |
| 1148 | |
| 1149 | def pretty_print(self, q): |
| 1150 | q.text("bsn_bw_enable_set_reply {") |
| 1151 | with q.group(): |
| 1152 | with q.indent(2): |
| 1153 | q.breakable() |
| 1154 | q.text("xid = "); |
| 1155 | if self.xid != None: |
| 1156 | q.text("%#x" % self.xid) |
| 1157 | else: |
| 1158 | q.text('None') |
| 1159 | q.text(","); q.breakable() |
| 1160 | q.text("enable = "); |
| 1161 | q.text("%#x" % self.enable) |
| 1162 | q.text(","); q.breakable() |
| 1163 | q.text("status = "); |
| 1164 | q.text("%#x" % self.status) |
| 1165 | q.breakable() |
| 1166 | q.text('}') |
| 1167 | |
| 1168 | class bsn_bw_enable_set_request(Message): |
| 1169 | version = 4 |
| 1170 | type = 4 |
| 1171 | experimenter = 6035143 |
| 1172 | subtype = 18 |
| 1173 | |
| 1174 | def __init__(self, xid=None, enable=None): |
| 1175 | self.xid = xid |
| 1176 | if enable != None: |
| 1177 | self.enable = enable |
| 1178 | else: |
| 1179 | self.enable = 0 |
| 1180 | |
| 1181 | def pack(self): |
| 1182 | packed = [] |
| 1183 | packed.append(struct.pack("!B", self.version)) |
| 1184 | packed.append(struct.pack("!B", self.type)) |
| 1185 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1186 | packed.append(struct.pack("!L", self.xid)) |
| 1187 | packed.append(struct.pack("!L", self.experimenter)) |
| 1188 | packed.append(struct.pack("!L", self.subtype)) |
| 1189 | packed.append(struct.pack("!L", self.enable)) |
| 1190 | length = sum([len(x) for x in packed]) |
| 1191 | packed[2] = struct.pack("!H", length) |
| 1192 | return ''.join(packed) |
| 1193 | |
| 1194 | @staticmethod |
| 1195 | def unpack(buf): |
| 1196 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 1197 | obj = bsn_bw_enable_set_request() |
| 1198 | if type(buf) == loxi.generic_util.OFReader: |
| 1199 | reader = buf |
| 1200 | else: |
| 1201 | reader = loxi.generic_util.OFReader(buf) |
| 1202 | _version = reader.read("!B")[0] |
| 1203 | assert(_version == 4) |
| 1204 | _type = reader.read("!B")[0] |
| 1205 | assert(_type == 4) |
| 1206 | _length = reader.read("!H")[0] |
| 1207 | obj.xid = reader.read("!L")[0] |
| 1208 | _experimenter = reader.read("!L")[0] |
| 1209 | assert(_experimenter == 6035143) |
| 1210 | _subtype = reader.read("!L")[0] |
| 1211 | assert(_subtype == 18) |
| 1212 | obj.enable = reader.read("!L")[0] |
| 1213 | return obj |
| 1214 | |
| 1215 | def __eq__(self, other): |
| 1216 | if type(self) != type(other): return False |
| 1217 | if self.version != other.version: return False |
| 1218 | if self.type != other.type: return False |
| 1219 | if self.xid != other.xid: return False |
| 1220 | if self.enable != other.enable: return False |
| 1221 | return True |
| 1222 | |
| 1223 | def __ne__(self, other): |
| 1224 | return not self.__eq__(other) |
| 1225 | |
| 1226 | def __str__(self): |
| 1227 | return self.show() |
| 1228 | |
| 1229 | def show(self): |
| 1230 | import loxi.pp |
| 1231 | return loxi.pp.pp(self) |
| 1232 | |
| 1233 | def pretty_print(self, q): |
| 1234 | q.text("bsn_bw_enable_set_request {") |
| 1235 | with q.group(): |
| 1236 | with q.indent(2): |
| 1237 | q.breakable() |
| 1238 | q.text("xid = "); |
| 1239 | if self.xid != None: |
| 1240 | q.text("%#x" % self.xid) |
| 1241 | else: |
| 1242 | q.text('None') |
| 1243 | q.text(","); q.breakable() |
| 1244 | q.text("enable = "); |
| 1245 | q.text("%#x" % self.enable) |
| 1246 | q.breakable() |
| 1247 | q.text('}') |
| 1248 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1249 | class bsn_get_interfaces_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1250 | version = 4 |
| 1251 | type = 4 |
| 1252 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1253 | subtype = 10 |
| 1254 | |
| 1255 | def __init__(self, xid=None, interfaces=None): |
| 1256 | self.xid = xid |
| 1257 | if interfaces != None: |
| 1258 | self.interfaces = interfaces |
| 1259 | else: |
| 1260 | self.interfaces = [] |
| 1261 | |
| 1262 | def pack(self): |
| 1263 | packed = [] |
| 1264 | packed.append(struct.pack("!B", self.version)) |
| 1265 | packed.append(struct.pack("!B", self.type)) |
| 1266 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1267 | packed.append(struct.pack("!L", self.xid)) |
| 1268 | packed.append(struct.pack("!L", self.experimenter)) |
| 1269 | packed.append(struct.pack("!L", self.subtype)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1270 | packed.append(util.pack_list(self.interfaces)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1271 | length = sum([len(x) for x in packed]) |
| 1272 | packed[2] = struct.pack("!H", length) |
| 1273 | return ''.join(packed) |
| 1274 | |
| 1275 | @staticmethod |
| 1276 | def unpack(buf): |
| 1277 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 1278 | obj = bsn_get_interfaces_reply() |
| 1279 | if type(buf) == loxi.generic_util.OFReader: |
| 1280 | reader = buf |
| 1281 | else: |
| 1282 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1283 | _version = reader.read("!B")[0] |
| 1284 | assert(_version == 4) |
| 1285 | _type = reader.read("!B")[0] |
| 1286 | assert(_type == 4) |
| 1287 | _length = reader.read("!H")[0] |
| 1288 | obj.xid = reader.read("!L")[0] |
| 1289 | _experimenter = reader.read("!L")[0] |
| 1290 | assert(_experimenter == 6035143) |
| 1291 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1292 | assert(_subtype == 10) |
| 1293 | obj.interfaces = loxi.generic_util.unpack_list(reader, common.bsn_interface.unpack) |
| 1294 | return obj |
| 1295 | |
| 1296 | def __eq__(self, other): |
| 1297 | if type(self) != type(other): return False |
| 1298 | if self.version != other.version: return False |
| 1299 | if self.type != other.type: return False |
| 1300 | if self.xid != other.xid: return False |
| 1301 | if self.interfaces != other.interfaces: return False |
| 1302 | return True |
| 1303 | |
| 1304 | def __ne__(self, other): |
| 1305 | return not self.__eq__(other) |
| 1306 | |
| 1307 | def __str__(self): |
| 1308 | return self.show() |
| 1309 | |
| 1310 | def show(self): |
| 1311 | import loxi.pp |
| 1312 | return loxi.pp.pp(self) |
| 1313 | |
| 1314 | def pretty_print(self, q): |
| 1315 | q.text("bsn_get_interfaces_reply {") |
| 1316 | with q.group(): |
| 1317 | with q.indent(2): |
| 1318 | q.breakable() |
| 1319 | q.text("xid = "); |
| 1320 | if self.xid != None: |
| 1321 | q.text("%#x" % self.xid) |
| 1322 | else: |
| 1323 | q.text('None') |
| 1324 | q.text(","); q.breakable() |
| 1325 | q.text("interfaces = "); |
| 1326 | q.pp(self.interfaces) |
| 1327 | q.breakable() |
| 1328 | q.text('}') |
| 1329 | |
| 1330 | class bsn_get_interfaces_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1331 | version = 4 |
| 1332 | type = 4 |
| 1333 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1334 | subtype = 9 |
| 1335 | |
| 1336 | def __init__(self, xid=None): |
| 1337 | self.xid = xid |
| 1338 | |
| 1339 | def pack(self): |
| 1340 | packed = [] |
| 1341 | packed.append(struct.pack("!B", self.version)) |
| 1342 | packed.append(struct.pack("!B", self.type)) |
| 1343 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1344 | packed.append(struct.pack("!L", self.xid)) |
| 1345 | packed.append(struct.pack("!L", self.experimenter)) |
| 1346 | packed.append(struct.pack("!L", self.subtype)) |
| 1347 | length = sum([len(x) for x in packed]) |
| 1348 | packed[2] = struct.pack("!H", length) |
| 1349 | return ''.join(packed) |
| 1350 | |
| 1351 | @staticmethod |
| 1352 | def unpack(buf): |
| 1353 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 1354 | obj = bsn_get_interfaces_request() |
| 1355 | if type(buf) == loxi.generic_util.OFReader: |
| 1356 | reader = buf |
| 1357 | else: |
| 1358 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1359 | _version = reader.read("!B")[0] |
| 1360 | assert(_version == 4) |
| 1361 | _type = reader.read("!B")[0] |
| 1362 | assert(_type == 4) |
| 1363 | _length = reader.read("!H")[0] |
| 1364 | obj.xid = reader.read("!L")[0] |
| 1365 | _experimenter = reader.read("!L")[0] |
| 1366 | assert(_experimenter == 6035143) |
| 1367 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1368 | assert(_subtype == 9) |
| 1369 | return obj |
| 1370 | |
| 1371 | def __eq__(self, other): |
| 1372 | if type(self) != type(other): return False |
| 1373 | if self.version != other.version: return False |
| 1374 | if self.type != other.type: return False |
| 1375 | if self.xid != other.xid: return False |
| 1376 | return True |
| 1377 | |
| 1378 | def __ne__(self, other): |
| 1379 | return not self.__eq__(other) |
| 1380 | |
| 1381 | def __str__(self): |
| 1382 | return self.show() |
| 1383 | |
| 1384 | def show(self): |
| 1385 | import loxi.pp |
| 1386 | return loxi.pp.pp(self) |
| 1387 | |
| 1388 | def pretty_print(self, q): |
| 1389 | q.text("bsn_get_interfaces_request {") |
| 1390 | with q.group(): |
| 1391 | with q.indent(2): |
| 1392 | q.breakable() |
| 1393 | q.text("xid = "); |
| 1394 | if self.xid != None: |
| 1395 | q.text("%#x" % self.xid) |
| 1396 | else: |
| 1397 | q.text('None') |
| 1398 | q.breakable() |
| 1399 | q.text('}') |
| 1400 | |
| 1401 | class bsn_get_mirroring_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1402 | version = 4 |
| 1403 | type = 4 |
| 1404 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1405 | subtype = 5 |
| 1406 | |
| 1407 | def __init__(self, xid=None, report_mirror_ports=None): |
| 1408 | self.xid = xid |
| 1409 | if report_mirror_ports != None: |
| 1410 | self.report_mirror_ports = report_mirror_ports |
| 1411 | else: |
| 1412 | self.report_mirror_ports = 0 |
| 1413 | |
| 1414 | def pack(self): |
| 1415 | packed = [] |
| 1416 | packed.append(struct.pack("!B", self.version)) |
| 1417 | packed.append(struct.pack("!B", self.type)) |
| 1418 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1419 | packed.append(struct.pack("!L", self.xid)) |
| 1420 | packed.append(struct.pack("!L", self.experimenter)) |
| 1421 | packed.append(struct.pack("!L", self.subtype)) |
| 1422 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 1423 | packed.append('\x00' * 3) |
| 1424 | length = sum([len(x) for x in packed]) |
| 1425 | packed[2] = struct.pack("!H", length) |
| 1426 | return ''.join(packed) |
| 1427 | |
| 1428 | @staticmethod |
| 1429 | def unpack(buf): |
| 1430 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 1431 | obj = bsn_get_mirroring_reply() |
| 1432 | if type(buf) == loxi.generic_util.OFReader: |
| 1433 | reader = buf |
| 1434 | else: |
| 1435 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1436 | _version = reader.read("!B")[0] |
| 1437 | assert(_version == 4) |
| 1438 | _type = reader.read("!B")[0] |
| 1439 | assert(_type == 4) |
| 1440 | _length = reader.read("!H")[0] |
| 1441 | obj.xid = reader.read("!L")[0] |
| 1442 | _experimenter = reader.read("!L")[0] |
| 1443 | assert(_experimenter == 6035143) |
| 1444 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1445 | assert(_subtype == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1446 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1447 | reader.skip(3) |
| 1448 | return obj |
| 1449 | |
| 1450 | def __eq__(self, other): |
| 1451 | if type(self) != type(other): return False |
| 1452 | if self.version != other.version: return False |
| 1453 | if self.type != other.type: return False |
| 1454 | if self.xid != other.xid: return False |
| 1455 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 1456 | return True |
| 1457 | |
| 1458 | def __ne__(self, other): |
| 1459 | return not self.__eq__(other) |
| 1460 | |
| 1461 | def __str__(self): |
| 1462 | return self.show() |
| 1463 | |
| 1464 | def show(self): |
| 1465 | import loxi.pp |
| 1466 | return loxi.pp.pp(self) |
| 1467 | |
| 1468 | def pretty_print(self, q): |
| 1469 | q.text("bsn_get_mirroring_reply {") |
| 1470 | with q.group(): |
| 1471 | with q.indent(2): |
| 1472 | q.breakable() |
| 1473 | q.text("xid = "); |
| 1474 | if self.xid != None: |
| 1475 | q.text("%#x" % self.xid) |
| 1476 | else: |
| 1477 | q.text('None') |
| 1478 | q.text(","); q.breakable() |
| 1479 | q.text("report_mirror_ports = "); |
| 1480 | q.text("%#x" % self.report_mirror_ports) |
| 1481 | q.breakable() |
| 1482 | q.text('}') |
| 1483 | |
| 1484 | class bsn_get_mirroring_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1485 | version = 4 |
| 1486 | type = 4 |
| 1487 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1488 | subtype = 4 |
| 1489 | |
| 1490 | def __init__(self, xid=None, report_mirror_ports=None): |
| 1491 | self.xid = xid |
| 1492 | if report_mirror_ports != None: |
| 1493 | self.report_mirror_ports = report_mirror_ports |
| 1494 | else: |
| 1495 | self.report_mirror_ports = 0 |
| 1496 | |
| 1497 | def pack(self): |
| 1498 | packed = [] |
| 1499 | packed.append(struct.pack("!B", self.version)) |
| 1500 | packed.append(struct.pack("!B", self.type)) |
| 1501 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1502 | packed.append(struct.pack("!L", self.xid)) |
| 1503 | packed.append(struct.pack("!L", self.experimenter)) |
| 1504 | packed.append(struct.pack("!L", self.subtype)) |
| 1505 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 1506 | packed.append('\x00' * 3) |
| 1507 | length = sum([len(x) for x in packed]) |
| 1508 | packed[2] = struct.pack("!H", length) |
| 1509 | return ''.join(packed) |
| 1510 | |
| 1511 | @staticmethod |
| 1512 | def unpack(buf): |
| 1513 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 1514 | obj = bsn_get_mirroring_request() |
| 1515 | if type(buf) == loxi.generic_util.OFReader: |
| 1516 | reader = buf |
| 1517 | else: |
| 1518 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1519 | _version = reader.read("!B")[0] |
| 1520 | assert(_version == 4) |
| 1521 | _type = reader.read("!B")[0] |
| 1522 | assert(_type == 4) |
| 1523 | _length = reader.read("!H")[0] |
| 1524 | obj.xid = reader.read("!L")[0] |
| 1525 | _experimenter = reader.read("!L")[0] |
| 1526 | assert(_experimenter == 6035143) |
| 1527 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1528 | assert(_subtype == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1529 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1530 | reader.skip(3) |
| 1531 | return obj |
| 1532 | |
| 1533 | def __eq__(self, other): |
| 1534 | if type(self) != type(other): return False |
| 1535 | if self.version != other.version: return False |
| 1536 | if self.type != other.type: return False |
| 1537 | if self.xid != other.xid: return False |
| 1538 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 1539 | return True |
| 1540 | |
| 1541 | def __ne__(self, other): |
| 1542 | return not self.__eq__(other) |
| 1543 | |
| 1544 | def __str__(self): |
| 1545 | return self.show() |
| 1546 | |
| 1547 | def show(self): |
| 1548 | import loxi.pp |
| 1549 | return loxi.pp.pp(self) |
| 1550 | |
| 1551 | def pretty_print(self, q): |
| 1552 | q.text("bsn_get_mirroring_request {") |
| 1553 | with q.group(): |
| 1554 | with q.indent(2): |
| 1555 | q.breakable() |
| 1556 | q.text("xid = "); |
| 1557 | if self.xid != None: |
| 1558 | q.text("%#x" % self.xid) |
| 1559 | else: |
| 1560 | q.text('None') |
| 1561 | q.text(","); q.breakable() |
| 1562 | q.text("report_mirror_ports = "); |
| 1563 | q.text("%#x" % self.report_mirror_ports) |
| 1564 | q.breakable() |
| 1565 | q.text('}') |
| 1566 | |
| 1567 | class bsn_set_mirroring(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1568 | version = 4 |
| 1569 | type = 4 |
| 1570 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1571 | subtype = 3 |
| 1572 | |
| 1573 | def __init__(self, xid=None, report_mirror_ports=None): |
| 1574 | self.xid = xid |
| 1575 | if report_mirror_ports != None: |
| 1576 | self.report_mirror_ports = report_mirror_ports |
| 1577 | else: |
| 1578 | self.report_mirror_ports = 0 |
| 1579 | |
| 1580 | def pack(self): |
| 1581 | packed = [] |
| 1582 | packed.append(struct.pack("!B", self.version)) |
| 1583 | packed.append(struct.pack("!B", self.type)) |
| 1584 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1585 | packed.append(struct.pack("!L", self.xid)) |
| 1586 | packed.append(struct.pack("!L", self.experimenter)) |
| 1587 | packed.append(struct.pack("!L", self.subtype)) |
| 1588 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 1589 | packed.append('\x00' * 3) |
| 1590 | length = sum([len(x) for x in packed]) |
| 1591 | packed[2] = struct.pack("!H", length) |
| 1592 | return ''.join(packed) |
| 1593 | |
| 1594 | @staticmethod |
| 1595 | def unpack(buf): |
| 1596 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 1597 | obj = bsn_set_mirroring() |
| 1598 | if type(buf) == loxi.generic_util.OFReader: |
| 1599 | reader = buf |
| 1600 | else: |
| 1601 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1602 | _version = reader.read("!B")[0] |
| 1603 | assert(_version == 4) |
| 1604 | _type = reader.read("!B")[0] |
| 1605 | assert(_type == 4) |
| 1606 | _length = reader.read("!H")[0] |
| 1607 | obj.xid = reader.read("!L")[0] |
| 1608 | _experimenter = reader.read("!L")[0] |
| 1609 | assert(_experimenter == 6035143) |
| 1610 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1611 | assert(_subtype == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1612 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1613 | reader.skip(3) |
| 1614 | return obj |
| 1615 | |
| 1616 | def __eq__(self, other): |
| 1617 | if type(self) != type(other): return False |
| 1618 | if self.version != other.version: return False |
| 1619 | if self.type != other.type: return False |
| 1620 | if self.xid != other.xid: return False |
| 1621 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 1622 | return True |
| 1623 | |
| 1624 | def __ne__(self, other): |
| 1625 | return not self.__eq__(other) |
| 1626 | |
| 1627 | def __str__(self): |
| 1628 | return self.show() |
| 1629 | |
| 1630 | def show(self): |
| 1631 | import loxi.pp |
| 1632 | return loxi.pp.pp(self) |
| 1633 | |
| 1634 | def pretty_print(self, q): |
| 1635 | q.text("bsn_set_mirroring {") |
| 1636 | with q.group(): |
| 1637 | with q.indent(2): |
| 1638 | q.breakable() |
| 1639 | q.text("xid = "); |
| 1640 | if self.xid != None: |
| 1641 | q.text("%#x" % self.xid) |
| 1642 | else: |
| 1643 | q.text('None') |
| 1644 | q.text(","); q.breakable() |
| 1645 | q.text("report_mirror_ports = "); |
| 1646 | q.text("%#x" % self.report_mirror_ports) |
| 1647 | q.breakable() |
| 1648 | q.text('}') |
| 1649 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1650 | class bsn_set_pktin_suppression_reply(Message): |
| 1651 | version = 4 |
| 1652 | type = 4 |
| 1653 | experimenter = 6035143 |
| 1654 | subtype = 25 |
| 1655 | |
| 1656 | def __init__(self, xid=None, status=None): |
| 1657 | self.xid = xid |
| 1658 | if status != None: |
| 1659 | self.status = status |
| 1660 | else: |
| 1661 | self.status = 0 |
| 1662 | |
| 1663 | def pack(self): |
| 1664 | packed = [] |
| 1665 | packed.append(struct.pack("!B", self.version)) |
| 1666 | packed.append(struct.pack("!B", self.type)) |
| 1667 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1668 | packed.append(struct.pack("!L", self.xid)) |
| 1669 | packed.append(struct.pack("!L", self.experimenter)) |
| 1670 | packed.append(struct.pack("!L", self.subtype)) |
| 1671 | packed.append(struct.pack("!L", self.status)) |
| 1672 | length = sum([len(x) for x in packed]) |
| 1673 | packed[2] = struct.pack("!H", length) |
| 1674 | return ''.join(packed) |
| 1675 | |
| 1676 | @staticmethod |
| 1677 | def unpack(buf): |
| 1678 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 1679 | obj = bsn_set_pktin_suppression_reply() |
| 1680 | if type(buf) == loxi.generic_util.OFReader: |
| 1681 | reader = buf |
| 1682 | else: |
| 1683 | reader = loxi.generic_util.OFReader(buf) |
| 1684 | _version = reader.read("!B")[0] |
| 1685 | assert(_version == 4) |
| 1686 | _type = reader.read("!B")[0] |
| 1687 | assert(_type == 4) |
| 1688 | _length = reader.read("!H")[0] |
| 1689 | obj.xid = reader.read("!L")[0] |
| 1690 | _experimenter = reader.read("!L")[0] |
| 1691 | assert(_experimenter == 6035143) |
| 1692 | _subtype = reader.read("!L")[0] |
| 1693 | assert(_subtype == 25) |
| 1694 | obj.status = reader.read("!L")[0] |
| 1695 | return obj |
| 1696 | |
| 1697 | def __eq__(self, other): |
| 1698 | if type(self) != type(other): return False |
| 1699 | if self.version != other.version: return False |
| 1700 | if self.type != other.type: return False |
| 1701 | if self.xid != other.xid: return False |
| 1702 | if self.status != other.status: return False |
| 1703 | return True |
| 1704 | |
| 1705 | def __ne__(self, other): |
| 1706 | return not self.__eq__(other) |
| 1707 | |
| 1708 | def __str__(self): |
| 1709 | return self.show() |
| 1710 | |
| 1711 | def show(self): |
| 1712 | import loxi.pp |
| 1713 | return loxi.pp.pp(self) |
| 1714 | |
| 1715 | def pretty_print(self, q): |
| 1716 | q.text("bsn_set_pktin_suppression_reply {") |
| 1717 | with q.group(): |
| 1718 | with q.indent(2): |
| 1719 | q.breakable() |
| 1720 | q.text("xid = "); |
| 1721 | if self.xid != None: |
| 1722 | q.text("%#x" % self.xid) |
| 1723 | else: |
| 1724 | q.text('None') |
| 1725 | q.text(","); q.breakable() |
| 1726 | q.text("status = "); |
| 1727 | q.text("%#x" % self.status) |
| 1728 | q.breakable() |
| 1729 | q.text('}') |
| 1730 | |
| 1731 | class bsn_set_pktin_suppression_request(Message): |
| 1732 | version = 4 |
| 1733 | type = 4 |
| 1734 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1735 | subtype = 11 |
| 1736 | |
| 1737 | def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None): |
| 1738 | self.xid = xid |
| 1739 | if enabled != None: |
| 1740 | self.enabled = enabled |
| 1741 | else: |
| 1742 | self.enabled = 0 |
| 1743 | if idle_timeout != None: |
| 1744 | self.idle_timeout = idle_timeout |
| 1745 | else: |
| 1746 | self.idle_timeout = 0 |
| 1747 | if hard_timeout != None: |
| 1748 | self.hard_timeout = hard_timeout |
| 1749 | else: |
| 1750 | self.hard_timeout = 0 |
| 1751 | if priority != None: |
| 1752 | self.priority = priority |
| 1753 | else: |
| 1754 | self.priority = 0 |
| 1755 | if cookie != None: |
| 1756 | self.cookie = cookie |
| 1757 | else: |
| 1758 | self.cookie = 0 |
| 1759 | |
| 1760 | def pack(self): |
| 1761 | packed = [] |
| 1762 | packed.append(struct.pack("!B", self.version)) |
| 1763 | packed.append(struct.pack("!B", self.type)) |
| 1764 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1765 | packed.append(struct.pack("!L", self.xid)) |
| 1766 | packed.append(struct.pack("!L", self.experimenter)) |
| 1767 | packed.append(struct.pack("!L", self.subtype)) |
| 1768 | packed.append(struct.pack("!B", self.enabled)) |
| 1769 | packed.append('\x00' * 1) |
| 1770 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 1771 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 1772 | packed.append(struct.pack("!H", self.priority)) |
| 1773 | packed.append(struct.pack("!Q", self.cookie)) |
| 1774 | length = sum([len(x) for x in packed]) |
| 1775 | packed[2] = struct.pack("!H", length) |
| 1776 | return ''.join(packed) |
| 1777 | |
| 1778 | @staticmethod |
| 1779 | def unpack(buf): |
| 1780 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1781 | obj = bsn_set_pktin_suppression_request() |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1782 | if type(buf) == loxi.generic_util.OFReader: |
| 1783 | reader = buf |
| 1784 | else: |
| 1785 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1786 | _version = reader.read("!B")[0] |
| 1787 | assert(_version == 4) |
| 1788 | _type = reader.read("!B")[0] |
| 1789 | assert(_type == 4) |
| 1790 | _length = reader.read("!H")[0] |
| 1791 | obj.xid = reader.read("!L")[0] |
| 1792 | _experimenter = reader.read("!L")[0] |
| 1793 | assert(_experimenter == 6035143) |
| 1794 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1795 | assert(_subtype == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1796 | obj.enabled = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1797 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1798 | obj.idle_timeout = reader.read("!H")[0] |
| 1799 | obj.hard_timeout = reader.read("!H")[0] |
| 1800 | obj.priority = reader.read("!H")[0] |
| 1801 | obj.cookie = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1802 | return obj |
| 1803 | |
| 1804 | def __eq__(self, other): |
| 1805 | if type(self) != type(other): return False |
| 1806 | if self.version != other.version: return False |
| 1807 | if self.type != other.type: return False |
| 1808 | if self.xid != other.xid: return False |
| 1809 | if self.enabled != other.enabled: return False |
| 1810 | if self.idle_timeout != other.idle_timeout: return False |
| 1811 | if self.hard_timeout != other.hard_timeout: return False |
| 1812 | if self.priority != other.priority: return False |
| 1813 | if self.cookie != other.cookie: return False |
| 1814 | return True |
| 1815 | |
| 1816 | def __ne__(self, other): |
| 1817 | return not self.__eq__(other) |
| 1818 | |
| 1819 | def __str__(self): |
| 1820 | return self.show() |
| 1821 | |
| 1822 | def show(self): |
| 1823 | import loxi.pp |
| 1824 | return loxi.pp.pp(self) |
| 1825 | |
| 1826 | def pretty_print(self, q): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1827 | q.text("bsn_set_pktin_suppression_request {") |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1828 | with q.group(): |
| 1829 | with q.indent(2): |
| 1830 | q.breakable() |
| 1831 | q.text("xid = "); |
| 1832 | if self.xid != None: |
| 1833 | q.text("%#x" % self.xid) |
| 1834 | else: |
| 1835 | q.text('None') |
| 1836 | q.text(","); q.breakable() |
| 1837 | q.text("enabled = "); |
| 1838 | q.text("%#x" % self.enabled) |
| 1839 | q.text(","); q.breakable() |
| 1840 | q.text("idle_timeout = "); |
| 1841 | q.text("%#x" % self.idle_timeout) |
| 1842 | q.text(","); q.breakable() |
| 1843 | q.text("hard_timeout = "); |
| 1844 | q.text("%#x" % self.hard_timeout) |
| 1845 | q.text(","); q.breakable() |
| 1846 | q.text("priority = "); |
| 1847 | q.text("%#x" % self.priority) |
| 1848 | q.text(","); q.breakable() |
| 1849 | q.text("cookie = "); |
| 1850 | q.text("%#x" % self.cookie) |
| 1851 | q.breakable() |
| 1852 | q.text('}') |
| 1853 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1854 | class bsn_virtual_port_create_reply(Message): |
| 1855 | version = 4 |
| 1856 | type = 4 |
| 1857 | experimenter = 6035143 |
| 1858 | subtype = 16 |
| 1859 | |
| 1860 | def __init__(self, xid=None, status=None, vport_no=None): |
| 1861 | self.xid = xid |
| 1862 | if status != None: |
| 1863 | self.status = status |
| 1864 | else: |
| 1865 | self.status = 0 |
| 1866 | if vport_no != None: |
| 1867 | self.vport_no = vport_no |
| 1868 | else: |
| 1869 | self.vport_no = 0 |
| 1870 | |
| 1871 | def pack(self): |
| 1872 | packed = [] |
| 1873 | packed.append(struct.pack("!B", self.version)) |
| 1874 | packed.append(struct.pack("!B", self.type)) |
| 1875 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1876 | packed.append(struct.pack("!L", self.xid)) |
| 1877 | packed.append(struct.pack("!L", self.experimenter)) |
| 1878 | packed.append(struct.pack("!L", self.subtype)) |
| 1879 | packed.append(struct.pack("!L", self.status)) |
| 1880 | packed.append(struct.pack("!L", self.vport_no)) |
| 1881 | length = sum([len(x) for x in packed]) |
| 1882 | packed[2] = struct.pack("!H", length) |
| 1883 | return ''.join(packed) |
| 1884 | |
| 1885 | @staticmethod |
| 1886 | def unpack(buf): |
| 1887 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 1888 | obj = bsn_virtual_port_create_reply() |
| 1889 | if type(buf) == loxi.generic_util.OFReader: |
| 1890 | reader = buf |
| 1891 | else: |
| 1892 | reader = loxi.generic_util.OFReader(buf) |
| 1893 | _version = reader.read("!B")[0] |
| 1894 | assert(_version == 4) |
| 1895 | _type = reader.read("!B")[0] |
| 1896 | assert(_type == 4) |
| 1897 | _length = reader.read("!H")[0] |
| 1898 | obj.xid = reader.read("!L")[0] |
| 1899 | _experimenter = reader.read("!L")[0] |
| 1900 | assert(_experimenter == 6035143) |
| 1901 | _subtype = reader.read("!L")[0] |
| 1902 | assert(_subtype == 16) |
| 1903 | obj.status = reader.read("!L")[0] |
| 1904 | obj.vport_no = reader.read("!L")[0] |
| 1905 | return obj |
| 1906 | |
| 1907 | def __eq__(self, other): |
| 1908 | if type(self) != type(other): return False |
| 1909 | if self.version != other.version: return False |
| 1910 | if self.type != other.type: return False |
| 1911 | if self.xid != other.xid: return False |
| 1912 | if self.status != other.status: return False |
| 1913 | if self.vport_no != other.vport_no: return False |
| 1914 | return True |
| 1915 | |
| 1916 | def __ne__(self, other): |
| 1917 | return not self.__eq__(other) |
| 1918 | |
| 1919 | def __str__(self): |
| 1920 | return self.show() |
| 1921 | |
| 1922 | def show(self): |
| 1923 | import loxi.pp |
| 1924 | return loxi.pp.pp(self) |
| 1925 | |
| 1926 | def pretty_print(self, q): |
| 1927 | q.text("bsn_virtual_port_create_reply {") |
| 1928 | with q.group(): |
| 1929 | with q.indent(2): |
| 1930 | q.breakable() |
| 1931 | q.text("xid = "); |
| 1932 | if self.xid != None: |
| 1933 | q.text("%#x" % self.xid) |
| 1934 | else: |
| 1935 | q.text('None') |
| 1936 | q.text(","); q.breakable() |
| 1937 | q.text("status = "); |
| 1938 | q.text("%#x" % self.status) |
| 1939 | q.text(","); q.breakable() |
| 1940 | q.text("vport_no = "); |
| 1941 | q.text("%#x" % self.vport_no) |
| 1942 | q.breakable() |
| 1943 | q.text('}') |
| 1944 | |
| 1945 | class bsn_virtual_port_create_request(Message): |
| 1946 | version = 4 |
| 1947 | type = 4 |
| 1948 | experimenter = 6035143 |
| 1949 | subtype = 15 |
| 1950 | |
| 1951 | def __init__(self, xid=None, vport=None): |
| 1952 | self.xid = xid |
| 1953 | if vport != None: |
| 1954 | self.vport = vport |
| 1955 | else: |
| 1956 | self.vport = common.bsn_vport_q_in_q() |
| 1957 | |
| 1958 | def pack(self): |
| 1959 | packed = [] |
| 1960 | packed.append(struct.pack("!B", self.version)) |
| 1961 | packed.append(struct.pack("!B", self.type)) |
| 1962 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1963 | packed.append(struct.pack("!L", self.xid)) |
| 1964 | packed.append(struct.pack("!L", self.experimenter)) |
| 1965 | packed.append(struct.pack("!L", self.subtype)) |
| 1966 | packed.append(self.vport.pack()) |
| 1967 | length = sum([len(x) for x in packed]) |
| 1968 | packed[2] = struct.pack("!H", length) |
| 1969 | return ''.join(packed) |
| 1970 | |
| 1971 | @staticmethod |
| 1972 | def unpack(buf): |
| 1973 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 1974 | obj = bsn_virtual_port_create_request() |
| 1975 | if type(buf) == loxi.generic_util.OFReader: |
| 1976 | reader = buf |
| 1977 | else: |
| 1978 | reader = loxi.generic_util.OFReader(buf) |
| 1979 | _version = reader.read("!B")[0] |
| 1980 | assert(_version == 4) |
| 1981 | _type = reader.read("!B")[0] |
| 1982 | assert(_type == 4) |
| 1983 | _length = reader.read("!H")[0] |
| 1984 | obj.xid = reader.read("!L")[0] |
| 1985 | _experimenter = reader.read("!L")[0] |
| 1986 | assert(_experimenter == 6035143) |
| 1987 | _subtype = reader.read("!L")[0] |
| 1988 | assert(_subtype == 15) |
| 1989 | obj.vport = common.bsn_vport_q_in_q.unpack(reader) |
| 1990 | return obj |
| 1991 | |
| 1992 | def __eq__(self, other): |
| 1993 | if type(self) != type(other): return False |
| 1994 | if self.version != other.version: return False |
| 1995 | if self.type != other.type: return False |
| 1996 | if self.xid != other.xid: return False |
| 1997 | if self.vport != other.vport: return False |
| 1998 | return True |
| 1999 | |
| 2000 | def __ne__(self, other): |
| 2001 | return not self.__eq__(other) |
| 2002 | |
| 2003 | def __str__(self): |
| 2004 | return self.show() |
| 2005 | |
| 2006 | def show(self): |
| 2007 | import loxi.pp |
| 2008 | return loxi.pp.pp(self) |
| 2009 | |
| 2010 | def pretty_print(self, q): |
| 2011 | q.text("bsn_virtual_port_create_request {") |
| 2012 | with q.group(): |
| 2013 | with q.indent(2): |
| 2014 | q.breakable() |
| 2015 | q.text("xid = "); |
| 2016 | if self.xid != None: |
| 2017 | q.text("%#x" % self.xid) |
| 2018 | else: |
| 2019 | q.text('None') |
| 2020 | q.text(","); q.breakable() |
| 2021 | q.text("vport = "); |
| 2022 | q.pp(self.vport) |
| 2023 | q.breakable() |
| 2024 | q.text('}') |
| 2025 | |
| 2026 | class bsn_virtual_port_remove_reply(Message): |
| 2027 | version = 4 |
| 2028 | type = 4 |
| 2029 | experimenter = 6035143 |
| 2030 | subtype = 26 |
| 2031 | |
| 2032 | def __init__(self, xid=None, status=None): |
| 2033 | self.xid = xid |
| 2034 | if status != None: |
| 2035 | self.status = status |
| 2036 | else: |
| 2037 | self.status = 0 |
| 2038 | |
| 2039 | def pack(self): |
| 2040 | packed = [] |
| 2041 | packed.append(struct.pack("!B", self.version)) |
| 2042 | packed.append(struct.pack("!B", self.type)) |
| 2043 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2044 | packed.append(struct.pack("!L", self.xid)) |
| 2045 | packed.append(struct.pack("!L", self.experimenter)) |
| 2046 | packed.append(struct.pack("!L", self.subtype)) |
| 2047 | packed.append(struct.pack("!L", self.status)) |
| 2048 | length = sum([len(x) for x in packed]) |
| 2049 | packed[2] = struct.pack("!H", length) |
| 2050 | return ''.join(packed) |
| 2051 | |
| 2052 | @staticmethod |
| 2053 | def unpack(buf): |
| 2054 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 2055 | obj = bsn_virtual_port_remove_reply() |
| 2056 | if type(buf) == loxi.generic_util.OFReader: |
| 2057 | reader = buf |
| 2058 | else: |
| 2059 | reader = loxi.generic_util.OFReader(buf) |
| 2060 | _version = reader.read("!B")[0] |
| 2061 | assert(_version == 4) |
| 2062 | _type = reader.read("!B")[0] |
| 2063 | assert(_type == 4) |
| 2064 | _length = reader.read("!H")[0] |
| 2065 | obj.xid = reader.read("!L")[0] |
| 2066 | _experimenter = reader.read("!L")[0] |
| 2067 | assert(_experimenter == 6035143) |
| 2068 | _subtype = reader.read("!L")[0] |
| 2069 | assert(_subtype == 26) |
| 2070 | obj.status = reader.read("!L")[0] |
| 2071 | return obj |
| 2072 | |
| 2073 | def __eq__(self, other): |
| 2074 | if type(self) != type(other): return False |
| 2075 | if self.version != other.version: return False |
| 2076 | if self.type != other.type: return False |
| 2077 | if self.xid != other.xid: return False |
| 2078 | if self.status != other.status: return False |
| 2079 | return True |
| 2080 | |
| 2081 | def __ne__(self, other): |
| 2082 | return not self.__eq__(other) |
| 2083 | |
| 2084 | def __str__(self): |
| 2085 | return self.show() |
| 2086 | |
| 2087 | def show(self): |
| 2088 | import loxi.pp |
| 2089 | return loxi.pp.pp(self) |
| 2090 | |
| 2091 | def pretty_print(self, q): |
| 2092 | q.text("bsn_virtual_port_remove_reply {") |
| 2093 | with q.group(): |
| 2094 | with q.indent(2): |
| 2095 | q.breakable() |
| 2096 | q.text("xid = "); |
| 2097 | if self.xid != None: |
| 2098 | q.text("%#x" % self.xid) |
| 2099 | else: |
| 2100 | q.text('None') |
| 2101 | q.text(","); q.breakable() |
| 2102 | q.text("status = "); |
| 2103 | q.text("%#x" % self.status) |
| 2104 | q.breakable() |
| 2105 | q.text('}') |
| 2106 | |
| 2107 | class bsn_virtual_port_remove_request(Message): |
| 2108 | version = 4 |
| 2109 | type = 4 |
| 2110 | experimenter = 6035143 |
| 2111 | subtype = 17 |
| 2112 | |
| 2113 | def __init__(self, xid=None, vport_no=None): |
| 2114 | self.xid = xid |
| 2115 | if vport_no != None: |
| 2116 | self.vport_no = vport_no |
| 2117 | else: |
| 2118 | self.vport_no = 0 |
| 2119 | |
| 2120 | def pack(self): |
| 2121 | packed = [] |
| 2122 | packed.append(struct.pack("!B", self.version)) |
| 2123 | packed.append(struct.pack("!B", self.type)) |
| 2124 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2125 | packed.append(struct.pack("!L", self.xid)) |
| 2126 | packed.append(struct.pack("!L", self.experimenter)) |
| 2127 | packed.append(struct.pack("!L", self.subtype)) |
| 2128 | packed.append(struct.pack("!L", self.vport_no)) |
| 2129 | length = sum([len(x) for x in packed]) |
| 2130 | packed[2] = struct.pack("!H", length) |
| 2131 | return ''.join(packed) |
| 2132 | |
| 2133 | @staticmethod |
| 2134 | def unpack(buf): |
| 2135 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 2136 | obj = bsn_virtual_port_remove_request() |
| 2137 | if type(buf) == loxi.generic_util.OFReader: |
| 2138 | reader = buf |
| 2139 | else: |
| 2140 | reader = loxi.generic_util.OFReader(buf) |
| 2141 | _version = reader.read("!B")[0] |
| 2142 | assert(_version == 4) |
| 2143 | _type = reader.read("!B")[0] |
| 2144 | assert(_type == 4) |
| 2145 | _length = reader.read("!H")[0] |
| 2146 | obj.xid = reader.read("!L")[0] |
| 2147 | _experimenter = reader.read("!L")[0] |
| 2148 | assert(_experimenter == 6035143) |
| 2149 | _subtype = reader.read("!L")[0] |
| 2150 | assert(_subtype == 17) |
| 2151 | obj.vport_no = reader.read("!L")[0] |
| 2152 | return obj |
| 2153 | |
| 2154 | def __eq__(self, other): |
| 2155 | if type(self) != type(other): return False |
| 2156 | if self.version != other.version: return False |
| 2157 | if self.type != other.type: return False |
| 2158 | if self.xid != other.xid: return False |
| 2159 | if self.vport_no != other.vport_no: return False |
| 2160 | return True |
| 2161 | |
| 2162 | def __ne__(self, other): |
| 2163 | return not self.__eq__(other) |
| 2164 | |
| 2165 | def __str__(self): |
| 2166 | return self.show() |
| 2167 | |
| 2168 | def show(self): |
| 2169 | import loxi.pp |
| 2170 | return loxi.pp.pp(self) |
| 2171 | |
| 2172 | def pretty_print(self, q): |
| 2173 | q.text("bsn_virtual_port_remove_request {") |
| 2174 | with q.group(): |
| 2175 | with q.indent(2): |
| 2176 | q.breakable() |
| 2177 | q.text("xid = "); |
| 2178 | if self.xid != None: |
| 2179 | q.text("%#x" % self.xid) |
| 2180 | else: |
| 2181 | q.text('None') |
| 2182 | q.text(","); q.breakable() |
| 2183 | q.text("vport_no = "); |
| 2184 | q.text("%#x" % self.vport_no) |
| 2185 | q.breakable() |
| 2186 | q.text('}') |
| 2187 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2188 | class desc_stats_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2189 | version = 4 |
| 2190 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2191 | stats_type = 0 |
| 2192 | |
| 2193 | def __init__(self, xid=None, flags=None, mfr_desc=None, hw_desc=None, sw_desc=None, serial_num=None, dp_desc=None): |
| 2194 | self.xid = xid |
| 2195 | if flags != None: |
| 2196 | self.flags = flags |
| 2197 | else: |
| 2198 | self.flags = 0 |
| 2199 | if mfr_desc != None: |
| 2200 | self.mfr_desc = mfr_desc |
| 2201 | else: |
| 2202 | self.mfr_desc = "" |
| 2203 | if hw_desc != None: |
| 2204 | self.hw_desc = hw_desc |
| 2205 | else: |
| 2206 | self.hw_desc = "" |
| 2207 | if sw_desc != None: |
| 2208 | self.sw_desc = sw_desc |
| 2209 | else: |
| 2210 | self.sw_desc = "" |
| 2211 | if serial_num != None: |
| 2212 | self.serial_num = serial_num |
| 2213 | else: |
| 2214 | self.serial_num = "" |
| 2215 | if dp_desc != None: |
| 2216 | self.dp_desc = dp_desc |
| 2217 | else: |
| 2218 | self.dp_desc = "" |
| 2219 | |
| 2220 | def pack(self): |
| 2221 | packed = [] |
| 2222 | packed.append(struct.pack("!B", self.version)) |
| 2223 | packed.append(struct.pack("!B", self.type)) |
| 2224 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2225 | packed.append(struct.pack("!L", self.xid)) |
| 2226 | packed.append(struct.pack("!H", self.stats_type)) |
| 2227 | packed.append(struct.pack("!H", self.flags)) |
| 2228 | packed.append('\x00' * 4) |
| 2229 | packed.append(struct.pack("!256s", self.mfr_desc)) |
| 2230 | packed.append(struct.pack("!256s", self.hw_desc)) |
| 2231 | packed.append(struct.pack("!256s", self.sw_desc)) |
| 2232 | packed.append(struct.pack("!32s", self.serial_num)) |
| 2233 | packed.append(struct.pack("!256s", self.dp_desc)) |
| 2234 | length = sum([len(x) for x in packed]) |
| 2235 | packed[2] = struct.pack("!H", length) |
| 2236 | return ''.join(packed) |
| 2237 | |
| 2238 | @staticmethod |
| 2239 | def unpack(buf): |
| 2240 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 2241 | obj = desc_stats_reply() |
| 2242 | if type(buf) == loxi.generic_util.OFReader: |
| 2243 | reader = buf |
| 2244 | else: |
| 2245 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2246 | _version = reader.read("!B")[0] |
| 2247 | assert(_version == 4) |
| 2248 | _type = reader.read("!B")[0] |
| 2249 | assert(_type == 19) |
| 2250 | _length = reader.read("!H")[0] |
| 2251 | obj.xid = reader.read("!L")[0] |
| 2252 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2253 | assert(_stats_type == 0) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2254 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2255 | reader.skip(4) |
| 2256 | obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00") |
| 2257 | obj.hw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 2258 | obj.sw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 2259 | obj.serial_num = reader.read("!32s")[0].rstrip("\x00") |
| 2260 | obj.dp_desc = reader.read("!256s")[0].rstrip("\x00") |
| 2261 | return obj |
| 2262 | |
| 2263 | def __eq__(self, other): |
| 2264 | if type(self) != type(other): return False |
| 2265 | if self.version != other.version: return False |
| 2266 | if self.type != other.type: return False |
| 2267 | if self.xid != other.xid: return False |
| 2268 | if self.flags != other.flags: return False |
| 2269 | if self.mfr_desc != other.mfr_desc: return False |
| 2270 | if self.hw_desc != other.hw_desc: return False |
| 2271 | if self.sw_desc != other.sw_desc: return False |
| 2272 | if self.serial_num != other.serial_num: return False |
| 2273 | if self.dp_desc != other.dp_desc: return False |
| 2274 | return True |
| 2275 | |
| 2276 | def __ne__(self, other): |
| 2277 | return not self.__eq__(other) |
| 2278 | |
| 2279 | def __str__(self): |
| 2280 | return self.show() |
| 2281 | |
| 2282 | def show(self): |
| 2283 | import loxi.pp |
| 2284 | return loxi.pp.pp(self) |
| 2285 | |
| 2286 | def pretty_print(self, q): |
| 2287 | q.text("desc_stats_reply {") |
| 2288 | with q.group(): |
| 2289 | with q.indent(2): |
| 2290 | q.breakable() |
| 2291 | q.text("xid = "); |
| 2292 | if self.xid != None: |
| 2293 | q.text("%#x" % self.xid) |
| 2294 | else: |
| 2295 | q.text('None') |
| 2296 | q.text(","); q.breakable() |
| 2297 | q.text("flags = "); |
| 2298 | q.text("%#x" % self.flags) |
| 2299 | q.text(","); q.breakable() |
| 2300 | q.text("mfr_desc = "); |
| 2301 | q.pp(self.mfr_desc) |
| 2302 | q.text(","); q.breakable() |
| 2303 | q.text("hw_desc = "); |
| 2304 | q.pp(self.hw_desc) |
| 2305 | q.text(","); q.breakable() |
| 2306 | q.text("sw_desc = "); |
| 2307 | q.pp(self.sw_desc) |
| 2308 | q.text(","); q.breakable() |
| 2309 | q.text("serial_num = "); |
| 2310 | q.pp(self.serial_num) |
| 2311 | q.text(","); q.breakable() |
| 2312 | q.text("dp_desc = "); |
| 2313 | q.pp(self.dp_desc) |
| 2314 | q.breakable() |
| 2315 | q.text('}') |
| 2316 | |
| 2317 | class desc_stats_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2318 | version = 4 |
| 2319 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2320 | stats_type = 0 |
| 2321 | |
| 2322 | def __init__(self, xid=None, flags=None): |
| 2323 | self.xid = xid |
| 2324 | if flags != None: |
| 2325 | self.flags = flags |
| 2326 | else: |
| 2327 | self.flags = 0 |
| 2328 | |
| 2329 | def pack(self): |
| 2330 | packed = [] |
| 2331 | packed.append(struct.pack("!B", self.version)) |
| 2332 | packed.append(struct.pack("!B", self.type)) |
| 2333 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2334 | packed.append(struct.pack("!L", self.xid)) |
| 2335 | packed.append(struct.pack("!H", self.stats_type)) |
| 2336 | packed.append(struct.pack("!H", self.flags)) |
| 2337 | packed.append('\x00' * 4) |
| 2338 | length = sum([len(x) for x in packed]) |
| 2339 | packed[2] = struct.pack("!H", length) |
| 2340 | return ''.join(packed) |
| 2341 | |
| 2342 | @staticmethod |
| 2343 | def unpack(buf): |
| 2344 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 2345 | obj = desc_stats_request() |
| 2346 | if type(buf) == loxi.generic_util.OFReader: |
| 2347 | reader = buf |
| 2348 | else: |
| 2349 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2350 | _version = reader.read("!B")[0] |
| 2351 | assert(_version == 4) |
| 2352 | _type = reader.read("!B")[0] |
| 2353 | assert(_type == 18) |
| 2354 | _length = reader.read("!H")[0] |
| 2355 | obj.xid = reader.read("!L")[0] |
| 2356 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2357 | assert(_stats_type == 0) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2358 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2359 | reader.skip(4) |
| 2360 | return obj |
| 2361 | |
| 2362 | def __eq__(self, other): |
| 2363 | if type(self) != type(other): return False |
| 2364 | if self.version != other.version: return False |
| 2365 | if self.type != other.type: return False |
| 2366 | if self.xid != other.xid: return False |
| 2367 | if self.flags != other.flags: return False |
| 2368 | return True |
| 2369 | |
| 2370 | def __ne__(self, other): |
| 2371 | return not self.__eq__(other) |
| 2372 | |
| 2373 | def __str__(self): |
| 2374 | return self.show() |
| 2375 | |
| 2376 | def show(self): |
| 2377 | import loxi.pp |
| 2378 | return loxi.pp.pp(self) |
| 2379 | |
| 2380 | def pretty_print(self, q): |
| 2381 | q.text("desc_stats_request {") |
| 2382 | with q.group(): |
| 2383 | with q.indent(2): |
| 2384 | q.breakable() |
| 2385 | q.text("xid = "); |
| 2386 | if self.xid != None: |
| 2387 | q.text("%#x" % self.xid) |
| 2388 | else: |
| 2389 | q.text('None') |
| 2390 | q.text(","); q.breakable() |
| 2391 | q.text("flags = "); |
| 2392 | q.text("%#x" % self.flags) |
| 2393 | q.breakable() |
| 2394 | q.text('}') |
| 2395 | |
| 2396 | class echo_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2397 | version = 4 |
| 2398 | type = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2399 | |
| 2400 | def __init__(self, xid=None, data=None): |
| 2401 | self.xid = xid |
| 2402 | if data != None: |
| 2403 | self.data = data |
| 2404 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2405 | self.data = '' |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2406 | |
| 2407 | def pack(self): |
| 2408 | packed = [] |
| 2409 | packed.append(struct.pack("!B", self.version)) |
| 2410 | packed.append(struct.pack("!B", self.type)) |
| 2411 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2412 | packed.append(struct.pack("!L", self.xid)) |
| 2413 | packed.append(self.data) |
| 2414 | length = sum([len(x) for x in packed]) |
| 2415 | packed[2] = struct.pack("!H", length) |
| 2416 | return ''.join(packed) |
| 2417 | |
| 2418 | @staticmethod |
| 2419 | def unpack(buf): |
| 2420 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 2421 | obj = echo_reply() |
| 2422 | if type(buf) == loxi.generic_util.OFReader: |
| 2423 | reader = buf |
| 2424 | else: |
| 2425 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2426 | _version = reader.read("!B")[0] |
| 2427 | assert(_version == 4) |
| 2428 | _type = reader.read("!B")[0] |
| 2429 | assert(_type == 3) |
| 2430 | _length = reader.read("!H")[0] |
| 2431 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2432 | obj.data = str(reader.read_all()) |
| 2433 | return obj |
| 2434 | |
| 2435 | def __eq__(self, other): |
| 2436 | if type(self) != type(other): return False |
| 2437 | if self.version != other.version: return False |
| 2438 | if self.type != other.type: return False |
| 2439 | if self.xid != other.xid: return False |
| 2440 | if self.data != other.data: return False |
| 2441 | return True |
| 2442 | |
| 2443 | def __ne__(self, other): |
| 2444 | return not self.__eq__(other) |
| 2445 | |
| 2446 | def __str__(self): |
| 2447 | return self.show() |
| 2448 | |
| 2449 | def show(self): |
| 2450 | import loxi.pp |
| 2451 | return loxi.pp.pp(self) |
| 2452 | |
| 2453 | def pretty_print(self, q): |
| 2454 | q.text("echo_reply {") |
| 2455 | with q.group(): |
| 2456 | with q.indent(2): |
| 2457 | q.breakable() |
| 2458 | q.text("xid = "); |
| 2459 | if self.xid != None: |
| 2460 | q.text("%#x" % self.xid) |
| 2461 | else: |
| 2462 | q.text('None') |
| 2463 | q.text(","); q.breakable() |
| 2464 | q.text("data = "); |
| 2465 | q.pp(self.data) |
| 2466 | q.breakable() |
| 2467 | q.text('}') |
| 2468 | |
| 2469 | class echo_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2470 | version = 4 |
| 2471 | type = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2472 | |
| 2473 | def __init__(self, xid=None, data=None): |
| 2474 | self.xid = xid |
| 2475 | if data != None: |
| 2476 | self.data = data |
| 2477 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2478 | self.data = '' |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2479 | |
| 2480 | def pack(self): |
| 2481 | packed = [] |
| 2482 | packed.append(struct.pack("!B", self.version)) |
| 2483 | packed.append(struct.pack("!B", self.type)) |
| 2484 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2485 | packed.append(struct.pack("!L", self.xid)) |
| 2486 | packed.append(self.data) |
| 2487 | length = sum([len(x) for x in packed]) |
| 2488 | packed[2] = struct.pack("!H", length) |
| 2489 | return ''.join(packed) |
| 2490 | |
| 2491 | @staticmethod |
| 2492 | def unpack(buf): |
| 2493 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 2494 | obj = echo_request() |
| 2495 | if type(buf) == loxi.generic_util.OFReader: |
| 2496 | reader = buf |
| 2497 | else: |
| 2498 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2499 | _version = reader.read("!B")[0] |
| 2500 | assert(_version == 4) |
| 2501 | _type = reader.read("!B")[0] |
| 2502 | assert(_type == 2) |
| 2503 | _length = reader.read("!H")[0] |
| 2504 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2505 | obj.data = str(reader.read_all()) |
| 2506 | return obj |
| 2507 | |
| 2508 | def __eq__(self, other): |
| 2509 | if type(self) != type(other): return False |
| 2510 | if self.version != other.version: return False |
| 2511 | if self.type != other.type: return False |
| 2512 | if self.xid != other.xid: return False |
| 2513 | if self.data != other.data: return False |
| 2514 | return True |
| 2515 | |
| 2516 | def __ne__(self, other): |
| 2517 | return not self.__eq__(other) |
| 2518 | |
| 2519 | def __str__(self): |
| 2520 | return self.show() |
| 2521 | |
| 2522 | def show(self): |
| 2523 | import loxi.pp |
| 2524 | return loxi.pp.pp(self) |
| 2525 | |
| 2526 | def pretty_print(self, q): |
| 2527 | q.text("echo_request {") |
| 2528 | with q.group(): |
| 2529 | with q.indent(2): |
| 2530 | q.breakable() |
| 2531 | q.text("xid = "); |
| 2532 | if self.xid != None: |
| 2533 | q.text("%#x" % self.xid) |
| 2534 | else: |
| 2535 | q.text('None') |
| 2536 | q.text(","); q.breakable() |
| 2537 | q.text("data = "); |
| 2538 | q.pp(self.data) |
| 2539 | q.breakable() |
| 2540 | q.text('}') |
| 2541 | |
| 2542 | class error_msg(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2543 | version = 4 |
| 2544 | type = 1 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2545 | |
| 2546 | def __init__(self, xid=None, err_type=None, code=None, data=None): |
| 2547 | self.xid = xid |
| 2548 | if err_type != None: |
| 2549 | self.err_type = err_type |
| 2550 | else: |
| 2551 | self.err_type = 0 |
| 2552 | if code != None: |
| 2553 | self.code = code |
| 2554 | else: |
| 2555 | self.code = 0 |
| 2556 | if data != None: |
| 2557 | self.data = data |
| 2558 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2559 | self.data = '' |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2560 | |
| 2561 | def pack(self): |
| 2562 | packed = [] |
| 2563 | packed.append(struct.pack("!B", self.version)) |
| 2564 | packed.append(struct.pack("!B", self.type)) |
| 2565 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2566 | packed.append(struct.pack("!L", self.xid)) |
| 2567 | packed.append(struct.pack("!H", self.err_type)) |
| 2568 | packed.append(struct.pack("!H", self.code)) |
| 2569 | packed.append(self.data) |
| 2570 | length = sum([len(x) for x in packed]) |
| 2571 | packed[2] = struct.pack("!H", length) |
| 2572 | return ''.join(packed) |
| 2573 | |
| 2574 | @staticmethod |
| 2575 | def unpack(buf): |
| 2576 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 2577 | obj = error_msg() |
| 2578 | if type(buf) == loxi.generic_util.OFReader: |
| 2579 | reader = buf |
| 2580 | else: |
| 2581 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2582 | _version = reader.read("!B")[0] |
| 2583 | assert(_version == 4) |
| 2584 | _type = reader.read("!B")[0] |
| 2585 | assert(_type == 1) |
| 2586 | _length = reader.read("!H")[0] |
| 2587 | obj.xid = reader.read("!L")[0] |
| 2588 | obj.err_type = reader.read("!H")[0] |
| 2589 | obj.code = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2590 | obj.data = str(reader.read_all()) |
| 2591 | return obj |
| 2592 | |
| 2593 | def __eq__(self, other): |
| 2594 | if type(self) != type(other): return False |
| 2595 | if self.version != other.version: return False |
| 2596 | if self.type != other.type: return False |
| 2597 | if self.xid != other.xid: return False |
| 2598 | if self.err_type != other.err_type: return False |
| 2599 | if self.code != other.code: return False |
| 2600 | if self.data != other.data: return False |
| 2601 | return True |
| 2602 | |
| 2603 | def __ne__(self, other): |
| 2604 | return not self.__eq__(other) |
| 2605 | |
| 2606 | def __str__(self): |
| 2607 | return self.show() |
| 2608 | |
| 2609 | def show(self): |
| 2610 | import loxi.pp |
| 2611 | return loxi.pp.pp(self) |
| 2612 | |
| 2613 | def pretty_print(self, q): |
| 2614 | q.text("error_msg {") |
| 2615 | with q.group(): |
| 2616 | with q.indent(2): |
| 2617 | q.breakable() |
| 2618 | q.text("xid = "); |
| 2619 | if self.xid != None: |
| 2620 | q.text("%#x" % self.xid) |
| 2621 | else: |
| 2622 | q.text('None') |
| 2623 | q.text(","); q.breakable() |
| 2624 | q.text("err_type = "); |
| 2625 | q.text("%#x" % self.err_type) |
| 2626 | q.text(","); q.breakable() |
| 2627 | q.text("code = "); |
| 2628 | q.text("%#x" % self.code) |
| 2629 | q.text(","); q.breakable() |
| 2630 | q.text("data = "); |
| 2631 | q.pp(self.data) |
| 2632 | q.breakable() |
| 2633 | q.text('}') |
| 2634 | |
| 2635 | class features_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2636 | version = 4 |
| 2637 | type = 6 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2638 | |
| 2639 | def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, auxiliary_id=None, capabilities=None, reserved=None): |
| 2640 | self.xid = xid |
| 2641 | if datapath_id != None: |
| 2642 | self.datapath_id = datapath_id |
| 2643 | else: |
| 2644 | self.datapath_id = 0 |
| 2645 | if n_buffers != None: |
| 2646 | self.n_buffers = n_buffers |
| 2647 | else: |
| 2648 | self.n_buffers = 0 |
| 2649 | if n_tables != None: |
| 2650 | self.n_tables = n_tables |
| 2651 | else: |
| 2652 | self.n_tables = 0 |
| 2653 | if auxiliary_id != None: |
| 2654 | self.auxiliary_id = auxiliary_id |
| 2655 | else: |
| 2656 | self.auxiliary_id = 0 |
| 2657 | if capabilities != None: |
| 2658 | self.capabilities = capabilities |
| 2659 | else: |
| 2660 | self.capabilities = 0 |
| 2661 | if reserved != None: |
| 2662 | self.reserved = reserved |
| 2663 | else: |
| 2664 | self.reserved = 0 |
| 2665 | |
| 2666 | def pack(self): |
| 2667 | packed = [] |
| 2668 | packed.append(struct.pack("!B", self.version)) |
| 2669 | packed.append(struct.pack("!B", self.type)) |
| 2670 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2671 | packed.append(struct.pack("!L", self.xid)) |
| 2672 | packed.append(struct.pack("!Q", self.datapath_id)) |
| 2673 | packed.append(struct.pack("!L", self.n_buffers)) |
| 2674 | packed.append(struct.pack("!B", self.n_tables)) |
| 2675 | packed.append(struct.pack("!B", self.auxiliary_id)) |
| 2676 | packed.append('\x00' * 2) |
| 2677 | packed.append(struct.pack("!L", self.capabilities)) |
| 2678 | packed.append(struct.pack("!L", self.reserved)) |
| 2679 | length = sum([len(x) for x in packed]) |
| 2680 | packed[2] = struct.pack("!H", length) |
| 2681 | return ''.join(packed) |
| 2682 | |
| 2683 | @staticmethod |
| 2684 | def unpack(buf): |
| 2685 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 2686 | obj = features_reply() |
| 2687 | if type(buf) == loxi.generic_util.OFReader: |
| 2688 | reader = buf |
| 2689 | else: |
| 2690 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2691 | _version = reader.read("!B")[0] |
| 2692 | assert(_version == 4) |
| 2693 | _type = reader.read("!B")[0] |
| 2694 | assert(_type == 6) |
| 2695 | _length = reader.read("!H")[0] |
| 2696 | obj.xid = reader.read("!L")[0] |
| 2697 | obj.datapath_id = reader.read("!Q")[0] |
| 2698 | obj.n_buffers = reader.read("!L")[0] |
| 2699 | obj.n_tables = reader.read("!B")[0] |
| 2700 | obj.auxiliary_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2701 | reader.skip(2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2702 | obj.capabilities = reader.read("!L")[0] |
| 2703 | obj.reserved = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2704 | return obj |
| 2705 | |
| 2706 | def __eq__(self, other): |
| 2707 | if type(self) != type(other): return False |
| 2708 | if self.version != other.version: return False |
| 2709 | if self.type != other.type: return False |
| 2710 | if self.xid != other.xid: return False |
| 2711 | if self.datapath_id != other.datapath_id: return False |
| 2712 | if self.n_buffers != other.n_buffers: return False |
| 2713 | if self.n_tables != other.n_tables: return False |
| 2714 | if self.auxiliary_id != other.auxiliary_id: return False |
| 2715 | if self.capabilities != other.capabilities: return False |
| 2716 | if self.reserved != other.reserved: return False |
| 2717 | return True |
| 2718 | |
| 2719 | def __ne__(self, other): |
| 2720 | return not self.__eq__(other) |
| 2721 | |
| 2722 | def __str__(self): |
| 2723 | return self.show() |
| 2724 | |
| 2725 | def show(self): |
| 2726 | import loxi.pp |
| 2727 | return loxi.pp.pp(self) |
| 2728 | |
| 2729 | def pretty_print(self, q): |
| 2730 | q.text("features_reply {") |
| 2731 | with q.group(): |
| 2732 | with q.indent(2): |
| 2733 | q.breakable() |
| 2734 | q.text("xid = "); |
| 2735 | if self.xid != None: |
| 2736 | q.text("%#x" % self.xid) |
| 2737 | else: |
| 2738 | q.text('None') |
| 2739 | q.text(","); q.breakable() |
| 2740 | q.text("datapath_id = "); |
| 2741 | q.text("%#x" % self.datapath_id) |
| 2742 | q.text(","); q.breakable() |
| 2743 | q.text("n_buffers = "); |
| 2744 | q.text("%#x" % self.n_buffers) |
| 2745 | q.text(","); q.breakable() |
| 2746 | q.text("n_tables = "); |
| 2747 | q.text("%#x" % self.n_tables) |
| 2748 | q.text(","); q.breakable() |
| 2749 | q.text("auxiliary_id = "); |
| 2750 | q.text("%#x" % self.auxiliary_id) |
| 2751 | q.text(","); q.breakable() |
| 2752 | q.text("capabilities = "); |
| 2753 | q.text("%#x" % self.capabilities) |
| 2754 | q.text(","); q.breakable() |
| 2755 | q.text("reserved = "); |
| 2756 | q.text("%#x" % self.reserved) |
| 2757 | q.breakable() |
| 2758 | q.text('}') |
| 2759 | |
| 2760 | class features_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2761 | version = 4 |
| 2762 | type = 5 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2763 | |
| 2764 | def __init__(self, xid=None): |
| 2765 | self.xid = xid |
| 2766 | |
| 2767 | def pack(self): |
| 2768 | packed = [] |
| 2769 | packed.append(struct.pack("!B", self.version)) |
| 2770 | packed.append(struct.pack("!B", self.type)) |
| 2771 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2772 | packed.append(struct.pack("!L", self.xid)) |
| 2773 | length = sum([len(x) for x in packed]) |
| 2774 | packed[2] = struct.pack("!H", length) |
| 2775 | return ''.join(packed) |
| 2776 | |
| 2777 | @staticmethod |
| 2778 | def unpack(buf): |
| 2779 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 2780 | obj = features_request() |
| 2781 | if type(buf) == loxi.generic_util.OFReader: |
| 2782 | reader = buf |
| 2783 | else: |
| 2784 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2785 | _version = reader.read("!B")[0] |
| 2786 | assert(_version == 4) |
| 2787 | _type = reader.read("!B")[0] |
| 2788 | assert(_type == 5) |
| 2789 | _length = reader.read("!H")[0] |
| 2790 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2791 | return obj |
| 2792 | |
| 2793 | def __eq__(self, other): |
| 2794 | if type(self) != type(other): return False |
| 2795 | if self.version != other.version: return False |
| 2796 | if self.type != other.type: return False |
| 2797 | if self.xid != other.xid: return False |
| 2798 | return True |
| 2799 | |
| 2800 | def __ne__(self, other): |
| 2801 | return not self.__eq__(other) |
| 2802 | |
| 2803 | def __str__(self): |
| 2804 | return self.show() |
| 2805 | |
| 2806 | def show(self): |
| 2807 | import loxi.pp |
| 2808 | return loxi.pp.pp(self) |
| 2809 | |
| 2810 | def pretty_print(self, q): |
| 2811 | q.text("features_request {") |
| 2812 | with q.group(): |
| 2813 | with q.indent(2): |
| 2814 | q.breakable() |
| 2815 | q.text("xid = "); |
| 2816 | if self.xid != None: |
| 2817 | q.text("%#x" % self.xid) |
| 2818 | else: |
| 2819 | q.text('None') |
| 2820 | q.breakable() |
| 2821 | q.text('}') |
| 2822 | |
| 2823 | class flow_add(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2824 | version = 4 |
| 2825 | type = 14 |
| 2826 | _command = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2827 | |
| 2828 | def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None): |
| 2829 | self.xid = xid |
| 2830 | if cookie != None: |
| 2831 | self.cookie = cookie |
| 2832 | else: |
| 2833 | self.cookie = 0 |
| 2834 | if cookie_mask != None: |
| 2835 | self.cookie_mask = cookie_mask |
| 2836 | else: |
| 2837 | self.cookie_mask = 0 |
| 2838 | if table_id != None: |
| 2839 | self.table_id = table_id |
| 2840 | else: |
| 2841 | self.table_id = 0 |
| 2842 | if idle_timeout != None: |
| 2843 | self.idle_timeout = idle_timeout |
| 2844 | else: |
| 2845 | self.idle_timeout = 0 |
| 2846 | if hard_timeout != None: |
| 2847 | self.hard_timeout = hard_timeout |
| 2848 | else: |
| 2849 | self.hard_timeout = 0 |
| 2850 | if priority != None: |
| 2851 | self.priority = priority |
| 2852 | else: |
| 2853 | self.priority = 0 |
| 2854 | if buffer_id != None: |
| 2855 | self.buffer_id = buffer_id |
| 2856 | else: |
| 2857 | self.buffer_id = 0 |
| 2858 | if out_port != None: |
| 2859 | self.out_port = out_port |
| 2860 | else: |
| 2861 | self.out_port = 0 |
| 2862 | if out_group != None: |
| 2863 | self.out_group = out_group |
| 2864 | else: |
| 2865 | self.out_group = 0 |
| 2866 | if flags != None: |
| 2867 | self.flags = flags |
| 2868 | else: |
| 2869 | self.flags = 0 |
| 2870 | if match != None: |
| 2871 | self.match = match |
| 2872 | else: |
| 2873 | self.match = common.match() |
| 2874 | if instructions != None: |
| 2875 | self.instructions = instructions |
| 2876 | else: |
| 2877 | self.instructions = [] |
| 2878 | |
| 2879 | def pack(self): |
| 2880 | packed = [] |
| 2881 | packed.append(struct.pack("!B", self.version)) |
| 2882 | packed.append(struct.pack("!B", self.type)) |
| 2883 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2884 | packed.append(struct.pack("!L", self.xid)) |
| 2885 | packed.append(struct.pack("!Q", self.cookie)) |
| 2886 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 2887 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2888 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2889 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 2890 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 2891 | packed.append(struct.pack("!H", self.priority)) |
| 2892 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2893 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2894 | packed.append(struct.pack("!L", self.out_group)) |
| 2895 | packed.append(struct.pack("!H", self.flags)) |
| 2896 | packed.append('\x00' * 2) |
| 2897 | packed.append(self.match.pack()) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2898 | packed.append(util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2899 | length = sum([len(x) for x in packed]) |
| 2900 | packed[2] = struct.pack("!H", length) |
| 2901 | return ''.join(packed) |
| 2902 | |
| 2903 | @staticmethod |
| 2904 | def unpack(buf): |
| 2905 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 2906 | obj = flow_add() |
| 2907 | if type(buf) == loxi.generic_util.OFReader: |
| 2908 | reader = buf |
| 2909 | else: |
| 2910 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2911 | _version = reader.read("!B")[0] |
| 2912 | assert(_version == 4) |
| 2913 | _type = reader.read("!B")[0] |
| 2914 | assert(_type == 14) |
| 2915 | _length = reader.read("!H")[0] |
| 2916 | obj.xid = reader.read("!L")[0] |
| 2917 | obj.cookie = reader.read("!Q")[0] |
| 2918 | obj.cookie_mask = reader.read("!Q")[0] |
| 2919 | obj.table_id = reader.read("!B")[0] |
| 2920 | __command = util.unpack_fm_cmd(reader) |
| 2921 | assert(__command == 0) |
| 2922 | obj.idle_timeout = reader.read("!H")[0] |
| 2923 | obj.hard_timeout = reader.read("!H")[0] |
| 2924 | obj.priority = reader.read("!H")[0] |
| 2925 | obj.buffer_id = reader.read("!L")[0] |
| 2926 | obj.out_port = util.unpack_port_no(reader) |
| 2927 | obj.out_group = reader.read("!L")[0] |
| 2928 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2929 | reader.skip(2) |
| 2930 | obj.match = common.match.unpack(reader) |
| 2931 | obj.instructions = instruction.unpack_list(reader) |
| 2932 | return obj |
| 2933 | |
| 2934 | def __eq__(self, other): |
| 2935 | if type(self) != type(other): return False |
| 2936 | if self.version != other.version: return False |
| 2937 | if self.type != other.type: return False |
| 2938 | if self.xid != other.xid: return False |
| 2939 | if self.cookie != other.cookie: return False |
| 2940 | if self.cookie_mask != other.cookie_mask: return False |
| 2941 | if self.table_id != other.table_id: return False |
| 2942 | if self.idle_timeout != other.idle_timeout: return False |
| 2943 | if self.hard_timeout != other.hard_timeout: return False |
| 2944 | if self.priority != other.priority: return False |
| 2945 | if self.buffer_id != other.buffer_id: return False |
| 2946 | if self.out_port != other.out_port: return False |
| 2947 | if self.out_group != other.out_group: return False |
| 2948 | if self.flags != other.flags: return False |
| 2949 | if self.match != other.match: return False |
| 2950 | if self.instructions != other.instructions: return False |
| 2951 | return True |
| 2952 | |
| 2953 | def __ne__(self, other): |
| 2954 | return not self.__eq__(other) |
| 2955 | |
| 2956 | def __str__(self): |
| 2957 | return self.show() |
| 2958 | |
| 2959 | def show(self): |
| 2960 | import loxi.pp |
| 2961 | return loxi.pp.pp(self) |
| 2962 | |
| 2963 | def pretty_print(self, q): |
| 2964 | q.text("flow_add {") |
| 2965 | with q.group(): |
| 2966 | with q.indent(2): |
| 2967 | q.breakable() |
| 2968 | q.text("xid = "); |
| 2969 | if self.xid != None: |
| 2970 | q.text("%#x" % self.xid) |
| 2971 | else: |
| 2972 | q.text('None') |
| 2973 | q.text(","); q.breakable() |
| 2974 | q.text("cookie = "); |
| 2975 | q.text("%#x" % self.cookie) |
| 2976 | q.text(","); q.breakable() |
| 2977 | q.text("cookie_mask = "); |
| 2978 | q.text("%#x" % self.cookie_mask) |
| 2979 | q.text(","); q.breakable() |
| 2980 | q.text("table_id = "); |
| 2981 | q.text("%#x" % self.table_id) |
| 2982 | q.text(","); q.breakable() |
| 2983 | q.text("idle_timeout = "); |
| 2984 | q.text("%#x" % self.idle_timeout) |
| 2985 | q.text(","); q.breakable() |
| 2986 | q.text("hard_timeout = "); |
| 2987 | q.text("%#x" % self.hard_timeout) |
| 2988 | q.text(","); q.breakable() |
| 2989 | q.text("priority = "); |
| 2990 | q.text("%#x" % self.priority) |
| 2991 | q.text(","); q.breakable() |
| 2992 | q.text("buffer_id = "); |
| 2993 | q.text("%#x" % self.buffer_id) |
| 2994 | q.text(","); q.breakable() |
| 2995 | q.text("out_port = "); |
| 2996 | q.text(util.pretty_port(self.out_port)) |
| 2997 | q.text(","); q.breakable() |
| 2998 | q.text("out_group = "); |
| 2999 | q.text("%#x" % self.out_group) |
| 3000 | q.text(","); q.breakable() |
| 3001 | q.text("flags = "); |
| 3002 | q.text("%#x" % self.flags) |
| 3003 | q.text(","); q.breakable() |
| 3004 | q.text("match = "); |
| 3005 | q.pp(self.match) |
| 3006 | q.text(","); q.breakable() |
| 3007 | q.text("instructions = "); |
| 3008 | q.pp(self.instructions) |
| 3009 | q.breakable() |
| 3010 | q.text('}') |
| 3011 | |
| 3012 | class flow_delete(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3013 | version = 4 |
| 3014 | type = 14 |
| 3015 | _command = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3016 | |
| 3017 | def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None): |
| 3018 | self.xid = xid |
| 3019 | if cookie != None: |
| 3020 | self.cookie = cookie |
| 3021 | else: |
| 3022 | self.cookie = 0 |
| 3023 | if cookie_mask != None: |
| 3024 | self.cookie_mask = cookie_mask |
| 3025 | else: |
| 3026 | self.cookie_mask = 0 |
| 3027 | if table_id != None: |
| 3028 | self.table_id = table_id |
| 3029 | else: |
| 3030 | self.table_id = 0 |
| 3031 | if idle_timeout != None: |
| 3032 | self.idle_timeout = idle_timeout |
| 3033 | else: |
| 3034 | self.idle_timeout = 0 |
| 3035 | if hard_timeout != None: |
| 3036 | self.hard_timeout = hard_timeout |
| 3037 | else: |
| 3038 | self.hard_timeout = 0 |
| 3039 | if priority != None: |
| 3040 | self.priority = priority |
| 3041 | else: |
| 3042 | self.priority = 0 |
| 3043 | if buffer_id != None: |
| 3044 | self.buffer_id = buffer_id |
| 3045 | else: |
| 3046 | self.buffer_id = 0 |
| 3047 | if out_port != None: |
| 3048 | self.out_port = out_port |
| 3049 | else: |
| 3050 | self.out_port = 0 |
| 3051 | if out_group != None: |
| 3052 | self.out_group = out_group |
| 3053 | else: |
| 3054 | self.out_group = 0 |
| 3055 | if flags != None: |
| 3056 | self.flags = flags |
| 3057 | else: |
| 3058 | self.flags = 0 |
| 3059 | if match != None: |
| 3060 | self.match = match |
| 3061 | else: |
| 3062 | self.match = common.match() |
| 3063 | if instructions != None: |
| 3064 | self.instructions = instructions |
| 3065 | else: |
| 3066 | self.instructions = [] |
| 3067 | |
| 3068 | def pack(self): |
| 3069 | packed = [] |
| 3070 | packed.append(struct.pack("!B", self.version)) |
| 3071 | packed.append(struct.pack("!B", self.type)) |
| 3072 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3073 | packed.append(struct.pack("!L", self.xid)) |
| 3074 | packed.append(struct.pack("!Q", self.cookie)) |
| 3075 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 3076 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3077 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3078 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 3079 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 3080 | packed.append(struct.pack("!H", self.priority)) |
| 3081 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3082 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3083 | packed.append(struct.pack("!L", self.out_group)) |
| 3084 | packed.append(struct.pack("!H", self.flags)) |
| 3085 | packed.append('\x00' * 2) |
| 3086 | packed.append(self.match.pack()) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3087 | packed.append(util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3088 | length = sum([len(x) for x in packed]) |
| 3089 | packed[2] = struct.pack("!H", length) |
| 3090 | return ''.join(packed) |
| 3091 | |
| 3092 | @staticmethod |
| 3093 | def unpack(buf): |
| 3094 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 3095 | obj = flow_delete() |
| 3096 | if type(buf) == loxi.generic_util.OFReader: |
| 3097 | reader = buf |
| 3098 | else: |
| 3099 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3100 | _version = reader.read("!B")[0] |
| 3101 | assert(_version == 4) |
| 3102 | _type = reader.read("!B")[0] |
| 3103 | assert(_type == 14) |
| 3104 | _length = reader.read("!H")[0] |
| 3105 | obj.xid = reader.read("!L")[0] |
| 3106 | obj.cookie = reader.read("!Q")[0] |
| 3107 | obj.cookie_mask = reader.read("!Q")[0] |
| 3108 | obj.table_id = reader.read("!B")[0] |
| 3109 | __command = util.unpack_fm_cmd(reader) |
| 3110 | assert(__command == 3) |
| 3111 | obj.idle_timeout = reader.read("!H")[0] |
| 3112 | obj.hard_timeout = reader.read("!H")[0] |
| 3113 | obj.priority = reader.read("!H")[0] |
| 3114 | obj.buffer_id = reader.read("!L")[0] |
| 3115 | obj.out_port = util.unpack_port_no(reader) |
| 3116 | obj.out_group = reader.read("!L")[0] |
| 3117 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3118 | reader.skip(2) |
| 3119 | obj.match = common.match.unpack(reader) |
| 3120 | obj.instructions = instruction.unpack_list(reader) |
| 3121 | return obj |
| 3122 | |
| 3123 | def __eq__(self, other): |
| 3124 | if type(self) != type(other): return False |
| 3125 | if self.version != other.version: return False |
| 3126 | if self.type != other.type: return False |
| 3127 | if self.xid != other.xid: return False |
| 3128 | if self.cookie != other.cookie: return False |
| 3129 | if self.cookie_mask != other.cookie_mask: return False |
| 3130 | if self.table_id != other.table_id: return False |
| 3131 | if self.idle_timeout != other.idle_timeout: return False |
| 3132 | if self.hard_timeout != other.hard_timeout: return False |
| 3133 | if self.priority != other.priority: return False |
| 3134 | if self.buffer_id != other.buffer_id: return False |
| 3135 | if self.out_port != other.out_port: return False |
| 3136 | if self.out_group != other.out_group: return False |
| 3137 | if self.flags != other.flags: return False |
| 3138 | if self.match != other.match: return False |
| 3139 | if self.instructions != other.instructions: return False |
| 3140 | return True |
| 3141 | |
| 3142 | def __ne__(self, other): |
| 3143 | return not self.__eq__(other) |
| 3144 | |
| 3145 | def __str__(self): |
| 3146 | return self.show() |
| 3147 | |
| 3148 | def show(self): |
| 3149 | import loxi.pp |
| 3150 | return loxi.pp.pp(self) |
| 3151 | |
| 3152 | def pretty_print(self, q): |
| 3153 | q.text("flow_delete {") |
| 3154 | with q.group(): |
| 3155 | with q.indent(2): |
| 3156 | q.breakable() |
| 3157 | q.text("xid = "); |
| 3158 | if self.xid != None: |
| 3159 | q.text("%#x" % self.xid) |
| 3160 | else: |
| 3161 | q.text('None') |
| 3162 | q.text(","); q.breakable() |
| 3163 | q.text("cookie = "); |
| 3164 | q.text("%#x" % self.cookie) |
| 3165 | q.text(","); q.breakable() |
| 3166 | q.text("cookie_mask = "); |
| 3167 | q.text("%#x" % self.cookie_mask) |
| 3168 | q.text(","); q.breakable() |
| 3169 | q.text("table_id = "); |
| 3170 | q.text("%#x" % self.table_id) |
| 3171 | q.text(","); q.breakable() |
| 3172 | q.text("idle_timeout = "); |
| 3173 | q.text("%#x" % self.idle_timeout) |
| 3174 | q.text(","); q.breakable() |
| 3175 | q.text("hard_timeout = "); |
| 3176 | q.text("%#x" % self.hard_timeout) |
| 3177 | q.text(","); q.breakable() |
| 3178 | q.text("priority = "); |
| 3179 | q.text("%#x" % self.priority) |
| 3180 | q.text(","); q.breakable() |
| 3181 | q.text("buffer_id = "); |
| 3182 | q.text("%#x" % self.buffer_id) |
| 3183 | q.text(","); q.breakable() |
| 3184 | q.text("out_port = "); |
| 3185 | q.text(util.pretty_port(self.out_port)) |
| 3186 | q.text(","); q.breakable() |
| 3187 | q.text("out_group = "); |
| 3188 | q.text("%#x" % self.out_group) |
| 3189 | q.text(","); q.breakable() |
| 3190 | q.text("flags = "); |
| 3191 | q.text("%#x" % self.flags) |
| 3192 | q.text(","); q.breakable() |
| 3193 | q.text("match = "); |
| 3194 | q.pp(self.match) |
| 3195 | q.text(","); q.breakable() |
| 3196 | q.text("instructions = "); |
| 3197 | q.pp(self.instructions) |
| 3198 | q.breakable() |
| 3199 | q.text('}') |
| 3200 | |
| 3201 | class flow_delete_strict(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3202 | version = 4 |
| 3203 | type = 14 |
| 3204 | _command = 4 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3205 | |
| 3206 | def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None): |
| 3207 | self.xid = xid |
| 3208 | if cookie != None: |
| 3209 | self.cookie = cookie |
| 3210 | else: |
| 3211 | self.cookie = 0 |
| 3212 | if cookie_mask != None: |
| 3213 | self.cookie_mask = cookie_mask |
| 3214 | else: |
| 3215 | self.cookie_mask = 0 |
| 3216 | if table_id != None: |
| 3217 | self.table_id = table_id |
| 3218 | else: |
| 3219 | self.table_id = 0 |
| 3220 | if idle_timeout != None: |
| 3221 | self.idle_timeout = idle_timeout |
| 3222 | else: |
| 3223 | self.idle_timeout = 0 |
| 3224 | if hard_timeout != None: |
| 3225 | self.hard_timeout = hard_timeout |
| 3226 | else: |
| 3227 | self.hard_timeout = 0 |
| 3228 | if priority != None: |
| 3229 | self.priority = priority |
| 3230 | else: |
| 3231 | self.priority = 0 |
| 3232 | if buffer_id != None: |
| 3233 | self.buffer_id = buffer_id |
| 3234 | else: |
| 3235 | self.buffer_id = 0 |
| 3236 | if out_port != None: |
| 3237 | self.out_port = out_port |
| 3238 | else: |
| 3239 | self.out_port = 0 |
| 3240 | if out_group != None: |
| 3241 | self.out_group = out_group |
| 3242 | else: |
| 3243 | self.out_group = 0 |
| 3244 | if flags != None: |
| 3245 | self.flags = flags |
| 3246 | else: |
| 3247 | self.flags = 0 |
| 3248 | if match != None: |
| 3249 | self.match = match |
| 3250 | else: |
| 3251 | self.match = common.match() |
| 3252 | if instructions != None: |
| 3253 | self.instructions = instructions |
| 3254 | else: |
| 3255 | self.instructions = [] |
| 3256 | |
| 3257 | def pack(self): |
| 3258 | packed = [] |
| 3259 | packed.append(struct.pack("!B", self.version)) |
| 3260 | packed.append(struct.pack("!B", self.type)) |
| 3261 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3262 | packed.append(struct.pack("!L", self.xid)) |
| 3263 | packed.append(struct.pack("!Q", self.cookie)) |
| 3264 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 3265 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3266 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3267 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 3268 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 3269 | packed.append(struct.pack("!H", self.priority)) |
| 3270 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3271 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3272 | packed.append(struct.pack("!L", self.out_group)) |
| 3273 | packed.append(struct.pack("!H", self.flags)) |
| 3274 | packed.append('\x00' * 2) |
| 3275 | packed.append(self.match.pack()) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3276 | packed.append(util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3277 | length = sum([len(x) for x in packed]) |
| 3278 | packed[2] = struct.pack("!H", length) |
| 3279 | return ''.join(packed) |
| 3280 | |
| 3281 | @staticmethod |
| 3282 | def unpack(buf): |
| 3283 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 3284 | obj = flow_delete_strict() |
| 3285 | if type(buf) == loxi.generic_util.OFReader: |
| 3286 | reader = buf |
| 3287 | else: |
| 3288 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3289 | _version = reader.read("!B")[0] |
| 3290 | assert(_version == 4) |
| 3291 | _type = reader.read("!B")[0] |
| 3292 | assert(_type == 14) |
| 3293 | _length = reader.read("!H")[0] |
| 3294 | obj.xid = reader.read("!L")[0] |
| 3295 | obj.cookie = reader.read("!Q")[0] |
| 3296 | obj.cookie_mask = reader.read("!Q")[0] |
| 3297 | obj.table_id = reader.read("!B")[0] |
| 3298 | __command = util.unpack_fm_cmd(reader) |
| 3299 | assert(__command == 4) |
| 3300 | obj.idle_timeout = reader.read("!H")[0] |
| 3301 | obj.hard_timeout = reader.read("!H")[0] |
| 3302 | obj.priority = reader.read("!H")[0] |
| 3303 | obj.buffer_id = reader.read("!L")[0] |
| 3304 | obj.out_port = util.unpack_port_no(reader) |
| 3305 | obj.out_group = reader.read("!L")[0] |
| 3306 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3307 | reader.skip(2) |
| 3308 | obj.match = common.match.unpack(reader) |
| 3309 | obj.instructions = instruction.unpack_list(reader) |
| 3310 | return obj |
| 3311 | |
| 3312 | def __eq__(self, other): |
| 3313 | if type(self) != type(other): return False |
| 3314 | if self.version != other.version: return False |
| 3315 | if self.type != other.type: return False |
| 3316 | if self.xid != other.xid: return False |
| 3317 | if self.cookie != other.cookie: return False |
| 3318 | if self.cookie_mask != other.cookie_mask: return False |
| 3319 | if self.table_id != other.table_id: return False |
| 3320 | if self.idle_timeout != other.idle_timeout: return False |
| 3321 | if self.hard_timeout != other.hard_timeout: return False |
| 3322 | if self.priority != other.priority: return False |
| 3323 | if self.buffer_id != other.buffer_id: return False |
| 3324 | if self.out_port != other.out_port: return False |
| 3325 | if self.out_group != other.out_group: return False |
| 3326 | if self.flags != other.flags: return False |
| 3327 | if self.match != other.match: return False |
| 3328 | if self.instructions != other.instructions: return False |
| 3329 | return True |
| 3330 | |
| 3331 | def __ne__(self, other): |
| 3332 | return not self.__eq__(other) |
| 3333 | |
| 3334 | def __str__(self): |
| 3335 | return self.show() |
| 3336 | |
| 3337 | def show(self): |
| 3338 | import loxi.pp |
| 3339 | return loxi.pp.pp(self) |
| 3340 | |
| 3341 | def pretty_print(self, q): |
| 3342 | q.text("flow_delete_strict {") |
| 3343 | with q.group(): |
| 3344 | with q.indent(2): |
| 3345 | q.breakable() |
| 3346 | q.text("xid = "); |
| 3347 | if self.xid != None: |
| 3348 | q.text("%#x" % self.xid) |
| 3349 | else: |
| 3350 | q.text('None') |
| 3351 | q.text(","); q.breakable() |
| 3352 | q.text("cookie = "); |
| 3353 | q.text("%#x" % self.cookie) |
| 3354 | q.text(","); q.breakable() |
| 3355 | q.text("cookie_mask = "); |
| 3356 | q.text("%#x" % self.cookie_mask) |
| 3357 | q.text(","); q.breakable() |
| 3358 | q.text("table_id = "); |
| 3359 | q.text("%#x" % self.table_id) |
| 3360 | q.text(","); q.breakable() |
| 3361 | q.text("idle_timeout = "); |
| 3362 | q.text("%#x" % self.idle_timeout) |
| 3363 | q.text(","); q.breakable() |
| 3364 | q.text("hard_timeout = "); |
| 3365 | q.text("%#x" % self.hard_timeout) |
| 3366 | q.text(","); q.breakable() |
| 3367 | q.text("priority = "); |
| 3368 | q.text("%#x" % self.priority) |
| 3369 | q.text(","); q.breakable() |
| 3370 | q.text("buffer_id = "); |
| 3371 | q.text("%#x" % self.buffer_id) |
| 3372 | q.text(","); q.breakable() |
| 3373 | q.text("out_port = "); |
| 3374 | q.text(util.pretty_port(self.out_port)) |
| 3375 | q.text(","); q.breakable() |
| 3376 | q.text("out_group = "); |
| 3377 | q.text("%#x" % self.out_group) |
| 3378 | q.text(","); q.breakable() |
| 3379 | q.text("flags = "); |
| 3380 | q.text("%#x" % self.flags) |
| 3381 | q.text(","); q.breakable() |
| 3382 | q.text("match = "); |
| 3383 | q.pp(self.match) |
| 3384 | q.text(","); q.breakable() |
| 3385 | q.text("instructions = "); |
| 3386 | q.pp(self.instructions) |
| 3387 | q.breakable() |
| 3388 | q.text('}') |
| 3389 | |
| 3390 | class flow_modify(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3391 | version = 4 |
| 3392 | type = 14 |
| 3393 | _command = 1 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3394 | |
| 3395 | def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None): |
| 3396 | self.xid = xid |
| 3397 | if cookie != None: |
| 3398 | self.cookie = cookie |
| 3399 | else: |
| 3400 | self.cookie = 0 |
| 3401 | if cookie_mask != None: |
| 3402 | self.cookie_mask = cookie_mask |
| 3403 | else: |
| 3404 | self.cookie_mask = 0 |
| 3405 | if table_id != None: |
| 3406 | self.table_id = table_id |
| 3407 | else: |
| 3408 | self.table_id = 0 |
| 3409 | if idle_timeout != None: |
| 3410 | self.idle_timeout = idle_timeout |
| 3411 | else: |
| 3412 | self.idle_timeout = 0 |
| 3413 | if hard_timeout != None: |
| 3414 | self.hard_timeout = hard_timeout |
| 3415 | else: |
| 3416 | self.hard_timeout = 0 |
| 3417 | if priority != None: |
| 3418 | self.priority = priority |
| 3419 | else: |
| 3420 | self.priority = 0 |
| 3421 | if buffer_id != None: |
| 3422 | self.buffer_id = buffer_id |
| 3423 | else: |
| 3424 | self.buffer_id = 0 |
| 3425 | if out_port != None: |
| 3426 | self.out_port = out_port |
| 3427 | else: |
| 3428 | self.out_port = 0 |
| 3429 | if out_group != None: |
| 3430 | self.out_group = out_group |
| 3431 | else: |
| 3432 | self.out_group = 0 |
| 3433 | if flags != None: |
| 3434 | self.flags = flags |
| 3435 | else: |
| 3436 | self.flags = 0 |
| 3437 | if match != None: |
| 3438 | self.match = match |
| 3439 | else: |
| 3440 | self.match = common.match() |
| 3441 | if instructions != None: |
| 3442 | self.instructions = instructions |
| 3443 | else: |
| 3444 | self.instructions = [] |
| 3445 | |
| 3446 | def pack(self): |
| 3447 | packed = [] |
| 3448 | packed.append(struct.pack("!B", self.version)) |
| 3449 | packed.append(struct.pack("!B", self.type)) |
| 3450 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3451 | packed.append(struct.pack("!L", self.xid)) |
| 3452 | packed.append(struct.pack("!Q", self.cookie)) |
| 3453 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 3454 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3455 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3456 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 3457 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 3458 | packed.append(struct.pack("!H", self.priority)) |
| 3459 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3460 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3461 | packed.append(struct.pack("!L", self.out_group)) |
| 3462 | packed.append(struct.pack("!H", self.flags)) |
| 3463 | packed.append('\x00' * 2) |
| 3464 | packed.append(self.match.pack()) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3465 | packed.append(util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3466 | length = sum([len(x) for x in packed]) |
| 3467 | packed[2] = struct.pack("!H", length) |
| 3468 | return ''.join(packed) |
| 3469 | |
| 3470 | @staticmethod |
| 3471 | def unpack(buf): |
| 3472 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 3473 | obj = flow_modify() |
| 3474 | if type(buf) == loxi.generic_util.OFReader: |
| 3475 | reader = buf |
| 3476 | else: |
| 3477 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3478 | _version = reader.read("!B")[0] |
| 3479 | assert(_version == 4) |
| 3480 | _type = reader.read("!B")[0] |
| 3481 | assert(_type == 14) |
| 3482 | _length = reader.read("!H")[0] |
| 3483 | obj.xid = reader.read("!L")[0] |
| 3484 | obj.cookie = reader.read("!Q")[0] |
| 3485 | obj.cookie_mask = reader.read("!Q")[0] |
| 3486 | obj.table_id = reader.read("!B")[0] |
| 3487 | __command = util.unpack_fm_cmd(reader) |
| 3488 | assert(__command == 1) |
| 3489 | obj.idle_timeout = reader.read("!H")[0] |
| 3490 | obj.hard_timeout = reader.read("!H")[0] |
| 3491 | obj.priority = reader.read("!H")[0] |
| 3492 | obj.buffer_id = reader.read("!L")[0] |
| 3493 | obj.out_port = util.unpack_port_no(reader) |
| 3494 | obj.out_group = reader.read("!L")[0] |
| 3495 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3496 | reader.skip(2) |
| 3497 | obj.match = common.match.unpack(reader) |
| 3498 | obj.instructions = instruction.unpack_list(reader) |
| 3499 | return obj |
| 3500 | |
| 3501 | def __eq__(self, other): |
| 3502 | if type(self) != type(other): return False |
| 3503 | if self.version != other.version: return False |
| 3504 | if self.type != other.type: return False |
| 3505 | if self.xid != other.xid: return False |
| 3506 | if self.cookie != other.cookie: return False |
| 3507 | if self.cookie_mask != other.cookie_mask: return False |
| 3508 | if self.table_id != other.table_id: return False |
| 3509 | if self.idle_timeout != other.idle_timeout: return False |
| 3510 | if self.hard_timeout != other.hard_timeout: return False |
| 3511 | if self.priority != other.priority: return False |
| 3512 | if self.buffer_id != other.buffer_id: return False |
| 3513 | if self.out_port != other.out_port: return False |
| 3514 | if self.out_group != other.out_group: return False |
| 3515 | if self.flags != other.flags: return False |
| 3516 | if self.match != other.match: return False |
| 3517 | if self.instructions != other.instructions: return False |
| 3518 | return True |
| 3519 | |
| 3520 | def __ne__(self, other): |
| 3521 | return not self.__eq__(other) |
| 3522 | |
| 3523 | def __str__(self): |
| 3524 | return self.show() |
| 3525 | |
| 3526 | def show(self): |
| 3527 | import loxi.pp |
| 3528 | return loxi.pp.pp(self) |
| 3529 | |
| 3530 | def pretty_print(self, q): |
| 3531 | q.text("flow_modify {") |
| 3532 | with q.group(): |
| 3533 | with q.indent(2): |
| 3534 | q.breakable() |
| 3535 | q.text("xid = "); |
| 3536 | if self.xid != None: |
| 3537 | q.text("%#x" % self.xid) |
| 3538 | else: |
| 3539 | q.text('None') |
| 3540 | q.text(","); q.breakable() |
| 3541 | q.text("cookie = "); |
| 3542 | q.text("%#x" % self.cookie) |
| 3543 | q.text(","); q.breakable() |
| 3544 | q.text("cookie_mask = "); |
| 3545 | q.text("%#x" % self.cookie_mask) |
| 3546 | q.text(","); q.breakable() |
| 3547 | q.text("table_id = "); |
| 3548 | q.text("%#x" % self.table_id) |
| 3549 | q.text(","); q.breakable() |
| 3550 | q.text("idle_timeout = "); |
| 3551 | q.text("%#x" % self.idle_timeout) |
| 3552 | q.text(","); q.breakable() |
| 3553 | q.text("hard_timeout = "); |
| 3554 | q.text("%#x" % self.hard_timeout) |
| 3555 | q.text(","); q.breakable() |
| 3556 | q.text("priority = "); |
| 3557 | q.text("%#x" % self.priority) |
| 3558 | q.text(","); q.breakable() |
| 3559 | q.text("buffer_id = "); |
| 3560 | q.text("%#x" % self.buffer_id) |
| 3561 | q.text(","); q.breakable() |
| 3562 | q.text("out_port = "); |
| 3563 | q.text(util.pretty_port(self.out_port)) |
| 3564 | q.text(","); q.breakable() |
| 3565 | q.text("out_group = "); |
| 3566 | q.text("%#x" % self.out_group) |
| 3567 | q.text(","); q.breakable() |
| 3568 | q.text("flags = "); |
| 3569 | q.text("%#x" % self.flags) |
| 3570 | q.text(","); q.breakable() |
| 3571 | q.text("match = "); |
| 3572 | q.pp(self.match) |
| 3573 | q.text(","); q.breakable() |
| 3574 | q.text("instructions = "); |
| 3575 | q.pp(self.instructions) |
| 3576 | q.breakable() |
| 3577 | q.text('}') |
| 3578 | |
| 3579 | class flow_modify_strict(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3580 | version = 4 |
| 3581 | type = 14 |
| 3582 | _command = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3583 | |
| 3584 | def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None): |
| 3585 | self.xid = xid |
| 3586 | if cookie != None: |
| 3587 | self.cookie = cookie |
| 3588 | else: |
| 3589 | self.cookie = 0 |
| 3590 | if cookie_mask != None: |
| 3591 | self.cookie_mask = cookie_mask |
| 3592 | else: |
| 3593 | self.cookie_mask = 0 |
| 3594 | if table_id != None: |
| 3595 | self.table_id = table_id |
| 3596 | else: |
| 3597 | self.table_id = 0 |
| 3598 | if idle_timeout != None: |
| 3599 | self.idle_timeout = idle_timeout |
| 3600 | else: |
| 3601 | self.idle_timeout = 0 |
| 3602 | if hard_timeout != None: |
| 3603 | self.hard_timeout = hard_timeout |
| 3604 | else: |
| 3605 | self.hard_timeout = 0 |
| 3606 | if priority != None: |
| 3607 | self.priority = priority |
| 3608 | else: |
| 3609 | self.priority = 0 |
| 3610 | if buffer_id != None: |
| 3611 | self.buffer_id = buffer_id |
| 3612 | else: |
| 3613 | self.buffer_id = 0 |
| 3614 | if out_port != None: |
| 3615 | self.out_port = out_port |
| 3616 | else: |
| 3617 | self.out_port = 0 |
| 3618 | if out_group != None: |
| 3619 | self.out_group = out_group |
| 3620 | else: |
| 3621 | self.out_group = 0 |
| 3622 | if flags != None: |
| 3623 | self.flags = flags |
| 3624 | else: |
| 3625 | self.flags = 0 |
| 3626 | if match != None: |
| 3627 | self.match = match |
| 3628 | else: |
| 3629 | self.match = common.match() |
| 3630 | if instructions != None: |
| 3631 | self.instructions = instructions |
| 3632 | else: |
| 3633 | self.instructions = [] |
| 3634 | |
| 3635 | def pack(self): |
| 3636 | packed = [] |
| 3637 | packed.append(struct.pack("!B", self.version)) |
| 3638 | packed.append(struct.pack("!B", self.type)) |
| 3639 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3640 | packed.append(struct.pack("!L", self.xid)) |
| 3641 | packed.append(struct.pack("!Q", self.cookie)) |
| 3642 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 3643 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3644 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3645 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 3646 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 3647 | packed.append(struct.pack("!H", self.priority)) |
| 3648 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3649 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3650 | packed.append(struct.pack("!L", self.out_group)) |
| 3651 | packed.append(struct.pack("!H", self.flags)) |
| 3652 | packed.append('\x00' * 2) |
| 3653 | packed.append(self.match.pack()) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3654 | packed.append(util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3655 | length = sum([len(x) for x in packed]) |
| 3656 | packed[2] = struct.pack("!H", length) |
| 3657 | return ''.join(packed) |
| 3658 | |
| 3659 | @staticmethod |
| 3660 | def unpack(buf): |
| 3661 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 3662 | obj = flow_modify_strict() |
| 3663 | if type(buf) == loxi.generic_util.OFReader: |
| 3664 | reader = buf |
| 3665 | else: |
| 3666 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3667 | _version = reader.read("!B")[0] |
| 3668 | assert(_version == 4) |
| 3669 | _type = reader.read("!B")[0] |
| 3670 | assert(_type == 14) |
| 3671 | _length = reader.read("!H")[0] |
| 3672 | obj.xid = reader.read("!L")[0] |
| 3673 | obj.cookie = reader.read("!Q")[0] |
| 3674 | obj.cookie_mask = reader.read("!Q")[0] |
| 3675 | obj.table_id = reader.read("!B")[0] |
| 3676 | __command = util.unpack_fm_cmd(reader) |
| 3677 | assert(__command == 2) |
| 3678 | obj.idle_timeout = reader.read("!H")[0] |
| 3679 | obj.hard_timeout = reader.read("!H")[0] |
| 3680 | obj.priority = reader.read("!H")[0] |
| 3681 | obj.buffer_id = reader.read("!L")[0] |
| 3682 | obj.out_port = util.unpack_port_no(reader) |
| 3683 | obj.out_group = reader.read("!L")[0] |
| 3684 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3685 | reader.skip(2) |
| 3686 | obj.match = common.match.unpack(reader) |
| 3687 | obj.instructions = instruction.unpack_list(reader) |
| 3688 | return obj |
| 3689 | |
| 3690 | def __eq__(self, other): |
| 3691 | if type(self) != type(other): return False |
| 3692 | if self.version != other.version: return False |
| 3693 | if self.type != other.type: return False |
| 3694 | if self.xid != other.xid: return False |
| 3695 | if self.cookie != other.cookie: return False |
| 3696 | if self.cookie_mask != other.cookie_mask: return False |
| 3697 | if self.table_id != other.table_id: return False |
| 3698 | if self.idle_timeout != other.idle_timeout: return False |
| 3699 | if self.hard_timeout != other.hard_timeout: return False |
| 3700 | if self.priority != other.priority: return False |
| 3701 | if self.buffer_id != other.buffer_id: return False |
| 3702 | if self.out_port != other.out_port: return False |
| 3703 | if self.out_group != other.out_group: return False |
| 3704 | if self.flags != other.flags: return False |
| 3705 | if self.match != other.match: return False |
| 3706 | if self.instructions != other.instructions: return False |
| 3707 | return True |
| 3708 | |
| 3709 | def __ne__(self, other): |
| 3710 | return not self.__eq__(other) |
| 3711 | |
| 3712 | def __str__(self): |
| 3713 | return self.show() |
| 3714 | |
| 3715 | def show(self): |
| 3716 | import loxi.pp |
| 3717 | return loxi.pp.pp(self) |
| 3718 | |
| 3719 | def pretty_print(self, q): |
| 3720 | q.text("flow_modify_strict {") |
| 3721 | with q.group(): |
| 3722 | with q.indent(2): |
| 3723 | q.breakable() |
| 3724 | q.text("xid = "); |
| 3725 | if self.xid != None: |
| 3726 | q.text("%#x" % self.xid) |
| 3727 | else: |
| 3728 | q.text('None') |
| 3729 | q.text(","); q.breakable() |
| 3730 | q.text("cookie = "); |
| 3731 | q.text("%#x" % self.cookie) |
| 3732 | q.text(","); q.breakable() |
| 3733 | q.text("cookie_mask = "); |
| 3734 | q.text("%#x" % self.cookie_mask) |
| 3735 | q.text(","); q.breakable() |
| 3736 | q.text("table_id = "); |
| 3737 | q.text("%#x" % self.table_id) |
| 3738 | q.text(","); q.breakable() |
| 3739 | q.text("idle_timeout = "); |
| 3740 | q.text("%#x" % self.idle_timeout) |
| 3741 | q.text(","); q.breakable() |
| 3742 | q.text("hard_timeout = "); |
| 3743 | q.text("%#x" % self.hard_timeout) |
| 3744 | q.text(","); q.breakable() |
| 3745 | q.text("priority = "); |
| 3746 | q.text("%#x" % self.priority) |
| 3747 | q.text(","); q.breakable() |
| 3748 | q.text("buffer_id = "); |
| 3749 | q.text("%#x" % self.buffer_id) |
| 3750 | q.text(","); q.breakable() |
| 3751 | q.text("out_port = "); |
| 3752 | q.text(util.pretty_port(self.out_port)) |
| 3753 | q.text(","); q.breakable() |
| 3754 | q.text("out_group = "); |
| 3755 | q.text("%#x" % self.out_group) |
| 3756 | q.text(","); q.breakable() |
| 3757 | q.text("flags = "); |
| 3758 | q.text("%#x" % self.flags) |
| 3759 | q.text(","); q.breakable() |
| 3760 | q.text("match = "); |
| 3761 | q.pp(self.match) |
| 3762 | q.text(","); q.breakable() |
| 3763 | q.text("instructions = "); |
| 3764 | q.pp(self.instructions) |
| 3765 | q.breakable() |
| 3766 | q.text('}') |
| 3767 | |
| 3768 | class flow_removed(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3769 | version = 4 |
| 3770 | type = 11 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3771 | |
| 3772 | def __init__(self, xid=None, cookie=None, priority=None, reason=None, table_id=None, duration_sec=None, duration_nsec=None, idle_timeout=None, hard_timeout=None, packet_count=None, byte_count=None, match=None): |
| 3773 | self.xid = xid |
| 3774 | if cookie != None: |
| 3775 | self.cookie = cookie |
| 3776 | else: |
| 3777 | self.cookie = 0 |
| 3778 | if priority != None: |
| 3779 | self.priority = priority |
| 3780 | else: |
| 3781 | self.priority = 0 |
| 3782 | if reason != None: |
| 3783 | self.reason = reason |
| 3784 | else: |
| 3785 | self.reason = 0 |
| 3786 | if table_id != None: |
| 3787 | self.table_id = table_id |
| 3788 | else: |
| 3789 | self.table_id = 0 |
| 3790 | if duration_sec != None: |
| 3791 | self.duration_sec = duration_sec |
| 3792 | else: |
| 3793 | self.duration_sec = 0 |
| 3794 | if duration_nsec != None: |
| 3795 | self.duration_nsec = duration_nsec |
| 3796 | else: |
| 3797 | self.duration_nsec = 0 |
| 3798 | if idle_timeout != None: |
| 3799 | self.idle_timeout = idle_timeout |
| 3800 | else: |
| 3801 | self.idle_timeout = 0 |
| 3802 | if hard_timeout != None: |
| 3803 | self.hard_timeout = hard_timeout |
| 3804 | else: |
| 3805 | self.hard_timeout = 0 |
| 3806 | if packet_count != None: |
| 3807 | self.packet_count = packet_count |
| 3808 | else: |
| 3809 | self.packet_count = 0 |
| 3810 | if byte_count != None: |
| 3811 | self.byte_count = byte_count |
| 3812 | else: |
| 3813 | self.byte_count = 0 |
| 3814 | if match != None: |
| 3815 | self.match = match |
| 3816 | else: |
| 3817 | self.match = common.match() |
| 3818 | |
| 3819 | def pack(self): |
| 3820 | packed = [] |
| 3821 | packed.append(struct.pack("!B", self.version)) |
| 3822 | packed.append(struct.pack("!B", self.type)) |
| 3823 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3824 | packed.append(struct.pack("!L", self.xid)) |
| 3825 | packed.append(struct.pack("!Q", self.cookie)) |
| 3826 | packed.append(struct.pack("!H", self.priority)) |
| 3827 | packed.append(struct.pack("!B", self.reason)) |
| 3828 | packed.append(struct.pack("!B", self.table_id)) |
| 3829 | packed.append(struct.pack("!L", self.duration_sec)) |
| 3830 | packed.append(struct.pack("!L", self.duration_nsec)) |
| 3831 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 3832 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 3833 | packed.append(struct.pack("!Q", self.packet_count)) |
| 3834 | packed.append(struct.pack("!Q", self.byte_count)) |
| 3835 | packed.append(self.match.pack()) |
| 3836 | length = sum([len(x) for x in packed]) |
| 3837 | packed[2] = struct.pack("!H", length) |
| 3838 | return ''.join(packed) |
| 3839 | |
| 3840 | @staticmethod |
| 3841 | def unpack(buf): |
| 3842 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 3843 | obj = flow_removed() |
| 3844 | if type(buf) == loxi.generic_util.OFReader: |
| 3845 | reader = buf |
| 3846 | else: |
| 3847 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3848 | _version = reader.read("!B")[0] |
| 3849 | assert(_version == 4) |
| 3850 | _type = reader.read("!B")[0] |
| 3851 | assert(_type == 11) |
| 3852 | _length = reader.read("!H")[0] |
| 3853 | obj.xid = reader.read("!L")[0] |
| 3854 | obj.cookie = reader.read("!Q")[0] |
| 3855 | obj.priority = reader.read("!H")[0] |
| 3856 | obj.reason = reader.read("!B")[0] |
| 3857 | obj.table_id = reader.read("!B")[0] |
| 3858 | obj.duration_sec = reader.read("!L")[0] |
| 3859 | obj.duration_nsec = reader.read("!L")[0] |
| 3860 | obj.idle_timeout = reader.read("!H")[0] |
| 3861 | obj.hard_timeout = reader.read("!H")[0] |
| 3862 | obj.packet_count = reader.read("!Q")[0] |
| 3863 | obj.byte_count = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3864 | obj.match = common.match.unpack(reader) |
| 3865 | return obj |
| 3866 | |
| 3867 | def __eq__(self, other): |
| 3868 | if type(self) != type(other): return False |
| 3869 | if self.version != other.version: return False |
| 3870 | if self.type != other.type: return False |
| 3871 | if self.xid != other.xid: return False |
| 3872 | if self.cookie != other.cookie: return False |
| 3873 | if self.priority != other.priority: return False |
| 3874 | if self.reason != other.reason: return False |
| 3875 | if self.table_id != other.table_id: return False |
| 3876 | if self.duration_sec != other.duration_sec: return False |
| 3877 | if self.duration_nsec != other.duration_nsec: return False |
| 3878 | if self.idle_timeout != other.idle_timeout: return False |
| 3879 | if self.hard_timeout != other.hard_timeout: return False |
| 3880 | if self.packet_count != other.packet_count: return False |
| 3881 | if self.byte_count != other.byte_count: return False |
| 3882 | if self.match != other.match: return False |
| 3883 | return True |
| 3884 | |
| 3885 | def __ne__(self, other): |
| 3886 | return not self.__eq__(other) |
| 3887 | |
| 3888 | def __str__(self): |
| 3889 | return self.show() |
| 3890 | |
| 3891 | def show(self): |
| 3892 | import loxi.pp |
| 3893 | return loxi.pp.pp(self) |
| 3894 | |
| 3895 | def pretty_print(self, q): |
| 3896 | q.text("flow_removed {") |
| 3897 | with q.group(): |
| 3898 | with q.indent(2): |
| 3899 | q.breakable() |
| 3900 | q.text("xid = "); |
| 3901 | if self.xid != None: |
| 3902 | q.text("%#x" % self.xid) |
| 3903 | else: |
| 3904 | q.text('None') |
| 3905 | q.text(","); q.breakable() |
| 3906 | q.text("cookie = "); |
| 3907 | q.text("%#x" % self.cookie) |
| 3908 | q.text(","); q.breakable() |
| 3909 | q.text("priority = "); |
| 3910 | q.text("%#x" % self.priority) |
| 3911 | q.text(","); q.breakable() |
| 3912 | q.text("reason = "); |
| 3913 | q.text("%#x" % self.reason) |
| 3914 | q.text(","); q.breakable() |
| 3915 | q.text("table_id = "); |
| 3916 | q.text("%#x" % self.table_id) |
| 3917 | q.text(","); q.breakable() |
| 3918 | q.text("duration_sec = "); |
| 3919 | q.text("%#x" % self.duration_sec) |
| 3920 | q.text(","); q.breakable() |
| 3921 | q.text("duration_nsec = "); |
| 3922 | q.text("%#x" % self.duration_nsec) |
| 3923 | q.text(","); q.breakable() |
| 3924 | q.text("idle_timeout = "); |
| 3925 | q.text("%#x" % self.idle_timeout) |
| 3926 | q.text(","); q.breakable() |
| 3927 | q.text("hard_timeout = "); |
| 3928 | q.text("%#x" % self.hard_timeout) |
| 3929 | q.text(","); q.breakable() |
| 3930 | q.text("packet_count = "); |
| 3931 | q.text("%#x" % self.packet_count) |
| 3932 | q.text(","); q.breakable() |
| 3933 | q.text("byte_count = "); |
| 3934 | q.text("%#x" % self.byte_count) |
| 3935 | q.text(","); q.breakable() |
| 3936 | q.text("match = "); |
| 3937 | q.pp(self.match) |
| 3938 | q.breakable() |
| 3939 | q.text('}') |
| 3940 | |
| 3941 | class flow_stats_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3942 | version = 4 |
| 3943 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3944 | stats_type = 1 |
| 3945 | |
| 3946 | def __init__(self, xid=None, flags=None, entries=None): |
| 3947 | self.xid = xid |
| 3948 | if flags != None: |
| 3949 | self.flags = flags |
| 3950 | else: |
| 3951 | self.flags = 0 |
| 3952 | if entries != None: |
| 3953 | self.entries = entries |
| 3954 | else: |
| 3955 | self.entries = [] |
| 3956 | |
| 3957 | def pack(self): |
| 3958 | packed = [] |
| 3959 | packed.append(struct.pack("!B", self.version)) |
| 3960 | packed.append(struct.pack("!B", self.type)) |
| 3961 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3962 | packed.append(struct.pack("!L", self.xid)) |
| 3963 | packed.append(struct.pack("!H", self.stats_type)) |
| 3964 | packed.append(struct.pack("!H", self.flags)) |
| 3965 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3966 | packed.append(util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3967 | length = sum([len(x) for x in packed]) |
| 3968 | packed[2] = struct.pack("!H", length) |
| 3969 | return ''.join(packed) |
| 3970 | |
| 3971 | @staticmethod |
| 3972 | def unpack(buf): |
| 3973 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 3974 | obj = flow_stats_reply() |
| 3975 | if type(buf) == loxi.generic_util.OFReader: |
| 3976 | reader = buf |
| 3977 | else: |
| 3978 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3979 | _version = reader.read("!B")[0] |
| 3980 | assert(_version == 4) |
| 3981 | _type = reader.read("!B")[0] |
| 3982 | assert(_type == 19) |
| 3983 | _length = reader.read("!H")[0] |
| 3984 | obj.xid = reader.read("!L")[0] |
| 3985 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3986 | assert(_stats_type == 1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3987 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3988 | reader.skip(4) |
| 3989 | obj.entries = common.unpack_list_flow_stats_entry(reader) |
| 3990 | return obj |
| 3991 | |
| 3992 | def __eq__(self, other): |
| 3993 | if type(self) != type(other): return False |
| 3994 | if self.version != other.version: return False |
| 3995 | if self.type != other.type: return False |
| 3996 | if self.xid != other.xid: return False |
| 3997 | if self.flags != other.flags: return False |
| 3998 | if self.entries != other.entries: return False |
| 3999 | return True |
| 4000 | |
| 4001 | def __ne__(self, other): |
| 4002 | return not self.__eq__(other) |
| 4003 | |
| 4004 | def __str__(self): |
| 4005 | return self.show() |
| 4006 | |
| 4007 | def show(self): |
| 4008 | import loxi.pp |
| 4009 | return loxi.pp.pp(self) |
| 4010 | |
| 4011 | def pretty_print(self, q): |
| 4012 | q.text("flow_stats_reply {") |
| 4013 | with q.group(): |
| 4014 | with q.indent(2): |
| 4015 | q.breakable() |
| 4016 | q.text("xid = "); |
| 4017 | if self.xid != None: |
| 4018 | q.text("%#x" % self.xid) |
| 4019 | else: |
| 4020 | q.text('None') |
| 4021 | q.text(","); q.breakable() |
| 4022 | q.text("flags = "); |
| 4023 | q.text("%#x" % self.flags) |
| 4024 | q.text(","); q.breakable() |
| 4025 | q.text("entries = "); |
| 4026 | q.pp(self.entries) |
| 4027 | q.breakable() |
| 4028 | q.text('}') |
| 4029 | |
| 4030 | class flow_stats_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4031 | version = 4 |
| 4032 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4033 | stats_type = 1 |
| 4034 | |
| 4035 | def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None): |
| 4036 | self.xid = xid |
| 4037 | if flags != None: |
| 4038 | self.flags = flags |
| 4039 | else: |
| 4040 | self.flags = 0 |
| 4041 | if table_id != None: |
| 4042 | self.table_id = table_id |
| 4043 | else: |
| 4044 | self.table_id = 0 |
| 4045 | if out_port != None: |
| 4046 | self.out_port = out_port |
| 4047 | else: |
| 4048 | self.out_port = 0 |
| 4049 | if out_group != None: |
| 4050 | self.out_group = out_group |
| 4051 | else: |
| 4052 | self.out_group = 0 |
| 4053 | if cookie != None: |
| 4054 | self.cookie = cookie |
| 4055 | else: |
| 4056 | self.cookie = 0 |
| 4057 | if cookie_mask != None: |
| 4058 | self.cookie_mask = cookie_mask |
| 4059 | else: |
| 4060 | self.cookie_mask = 0 |
| 4061 | if match != None: |
| 4062 | self.match = match |
| 4063 | else: |
| 4064 | self.match = common.match() |
| 4065 | |
| 4066 | def pack(self): |
| 4067 | packed = [] |
| 4068 | packed.append(struct.pack("!B", self.version)) |
| 4069 | packed.append(struct.pack("!B", self.type)) |
| 4070 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4071 | packed.append(struct.pack("!L", self.xid)) |
| 4072 | packed.append(struct.pack("!H", self.stats_type)) |
| 4073 | packed.append(struct.pack("!H", self.flags)) |
| 4074 | packed.append('\x00' * 4) |
| 4075 | packed.append(struct.pack("!B", self.table_id)) |
| 4076 | packed.append('\x00' * 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4077 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4078 | packed.append(struct.pack("!L", self.out_group)) |
| 4079 | packed.append('\x00' * 4) |
| 4080 | packed.append(struct.pack("!Q", self.cookie)) |
| 4081 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 4082 | packed.append(self.match.pack()) |
| 4083 | length = sum([len(x) for x in packed]) |
| 4084 | packed[2] = struct.pack("!H", length) |
| 4085 | return ''.join(packed) |
| 4086 | |
| 4087 | @staticmethod |
| 4088 | def unpack(buf): |
| 4089 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 4090 | obj = flow_stats_request() |
| 4091 | if type(buf) == loxi.generic_util.OFReader: |
| 4092 | reader = buf |
| 4093 | else: |
| 4094 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4095 | _version = reader.read("!B")[0] |
| 4096 | assert(_version == 4) |
| 4097 | _type = reader.read("!B")[0] |
| 4098 | assert(_type == 18) |
| 4099 | _length = reader.read("!H")[0] |
| 4100 | obj.xid = reader.read("!L")[0] |
| 4101 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4102 | assert(_stats_type == 1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4103 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4104 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4105 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4106 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4107 | obj.out_port = util.unpack_port_no(reader) |
| 4108 | obj.out_group = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4109 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4110 | obj.cookie = reader.read("!Q")[0] |
| 4111 | obj.cookie_mask = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4112 | obj.match = common.match.unpack(reader) |
| 4113 | return obj |
| 4114 | |
| 4115 | def __eq__(self, other): |
| 4116 | if type(self) != type(other): return False |
| 4117 | if self.version != other.version: return False |
| 4118 | if self.type != other.type: return False |
| 4119 | if self.xid != other.xid: return False |
| 4120 | if self.flags != other.flags: return False |
| 4121 | if self.table_id != other.table_id: return False |
| 4122 | if self.out_port != other.out_port: return False |
| 4123 | if self.out_group != other.out_group: return False |
| 4124 | if self.cookie != other.cookie: return False |
| 4125 | if self.cookie_mask != other.cookie_mask: return False |
| 4126 | if self.match != other.match: return False |
| 4127 | return True |
| 4128 | |
| 4129 | def __ne__(self, other): |
| 4130 | return not self.__eq__(other) |
| 4131 | |
| 4132 | def __str__(self): |
| 4133 | return self.show() |
| 4134 | |
| 4135 | def show(self): |
| 4136 | import loxi.pp |
| 4137 | return loxi.pp.pp(self) |
| 4138 | |
| 4139 | def pretty_print(self, q): |
| 4140 | q.text("flow_stats_request {") |
| 4141 | with q.group(): |
| 4142 | with q.indent(2): |
| 4143 | q.breakable() |
| 4144 | q.text("xid = "); |
| 4145 | if self.xid != None: |
| 4146 | q.text("%#x" % self.xid) |
| 4147 | else: |
| 4148 | q.text('None') |
| 4149 | q.text(","); q.breakable() |
| 4150 | q.text("flags = "); |
| 4151 | q.text("%#x" % self.flags) |
| 4152 | q.text(","); q.breakable() |
| 4153 | q.text("table_id = "); |
| 4154 | q.text("%#x" % self.table_id) |
| 4155 | q.text(","); q.breakable() |
| 4156 | q.text("out_port = "); |
| 4157 | q.text(util.pretty_port(self.out_port)) |
| 4158 | q.text(","); q.breakable() |
| 4159 | q.text("out_group = "); |
| 4160 | q.text("%#x" % self.out_group) |
| 4161 | q.text(","); q.breakable() |
| 4162 | q.text("cookie = "); |
| 4163 | q.text("%#x" % self.cookie) |
| 4164 | q.text(","); q.breakable() |
| 4165 | q.text("cookie_mask = "); |
| 4166 | q.text("%#x" % self.cookie_mask) |
| 4167 | q.text(","); q.breakable() |
| 4168 | q.text("match = "); |
| 4169 | q.pp(self.match) |
| 4170 | q.breakable() |
| 4171 | q.text('}') |
| 4172 | |
| 4173 | class get_config_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4174 | version = 4 |
| 4175 | type = 8 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4176 | |
| 4177 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
| 4178 | self.xid = xid |
| 4179 | if flags != None: |
| 4180 | self.flags = flags |
| 4181 | else: |
| 4182 | self.flags = 0 |
| 4183 | if miss_send_len != None: |
| 4184 | self.miss_send_len = miss_send_len |
| 4185 | else: |
| 4186 | self.miss_send_len = 0 |
| 4187 | |
| 4188 | def pack(self): |
| 4189 | packed = [] |
| 4190 | packed.append(struct.pack("!B", self.version)) |
| 4191 | packed.append(struct.pack("!B", self.type)) |
| 4192 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4193 | packed.append(struct.pack("!L", self.xid)) |
| 4194 | packed.append(struct.pack("!H", self.flags)) |
| 4195 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 4196 | length = sum([len(x) for x in packed]) |
| 4197 | packed[2] = struct.pack("!H", length) |
| 4198 | return ''.join(packed) |
| 4199 | |
| 4200 | @staticmethod |
| 4201 | def unpack(buf): |
| 4202 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 4203 | obj = get_config_reply() |
| 4204 | if type(buf) == loxi.generic_util.OFReader: |
| 4205 | reader = buf |
| 4206 | else: |
| 4207 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4208 | _version = reader.read("!B")[0] |
| 4209 | assert(_version == 4) |
| 4210 | _type = reader.read("!B")[0] |
| 4211 | assert(_type == 8) |
| 4212 | _length = reader.read("!H")[0] |
| 4213 | obj.xid = reader.read("!L")[0] |
| 4214 | obj.flags = reader.read("!H")[0] |
| 4215 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4216 | return obj |
| 4217 | |
| 4218 | def __eq__(self, other): |
| 4219 | if type(self) != type(other): return False |
| 4220 | if self.version != other.version: return False |
| 4221 | if self.type != other.type: return False |
| 4222 | if self.xid != other.xid: return False |
| 4223 | if self.flags != other.flags: return False |
| 4224 | if self.miss_send_len != other.miss_send_len: return False |
| 4225 | return True |
| 4226 | |
| 4227 | def __ne__(self, other): |
| 4228 | return not self.__eq__(other) |
| 4229 | |
| 4230 | def __str__(self): |
| 4231 | return self.show() |
| 4232 | |
| 4233 | def show(self): |
| 4234 | import loxi.pp |
| 4235 | return loxi.pp.pp(self) |
| 4236 | |
| 4237 | def pretty_print(self, q): |
| 4238 | q.text("get_config_reply {") |
| 4239 | with q.group(): |
| 4240 | with q.indent(2): |
| 4241 | q.breakable() |
| 4242 | q.text("xid = "); |
| 4243 | if self.xid != None: |
| 4244 | q.text("%#x" % self.xid) |
| 4245 | else: |
| 4246 | q.text('None') |
| 4247 | q.text(","); q.breakable() |
| 4248 | q.text("flags = "); |
| 4249 | q.text("%#x" % self.flags) |
| 4250 | q.text(","); q.breakable() |
| 4251 | q.text("miss_send_len = "); |
| 4252 | q.text("%#x" % self.miss_send_len) |
| 4253 | q.breakable() |
| 4254 | q.text('}') |
| 4255 | |
| 4256 | class get_config_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4257 | version = 4 |
| 4258 | type = 7 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4259 | |
| 4260 | def __init__(self, xid=None): |
| 4261 | self.xid = xid |
| 4262 | |
| 4263 | def pack(self): |
| 4264 | packed = [] |
| 4265 | packed.append(struct.pack("!B", self.version)) |
| 4266 | packed.append(struct.pack("!B", self.type)) |
| 4267 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4268 | packed.append(struct.pack("!L", self.xid)) |
| 4269 | length = sum([len(x) for x in packed]) |
| 4270 | packed[2] = struct.pack("!H", length) |
| 4271 | return ''.join(packed) |
| 4272 | |
| 4273 | @staticmethod |
| 4274 | def unpack(buf): |
| 4275 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 4276 | obj = get_config_request() |
| 4277 | if type(buf) == loxi.generic_util.OFReader: |
| 4278 | reader = buf |
| 4279 | else: |
| 4280 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4281 | _version = reader.read("!B")[0] |
| 4282 | assert(_version == 4) |
| 4283 | _type = reader.read("!B")[0] |
| 4284 | assert(_type == 7) |
| 4285 | _length = reader.read("!H")[0] |
| 4286 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4287 | return obj |
| 4288 | |
| 4289 | def __eq__(self, other): |
| 4290 | if type(self) != type(other): return False |
| 4291 | if self.version != other.version: return False |
| 4292 | if self.type != other.type: return False |
| 4293 | if self.xid != other.xid: return False |
| 4294 | return True |
| 4295 | |
| 4296 | def __ne__(self, other): |
| 4297 | return not self.__eq__(other) |
| 4298 | |
| 4299 | def __str__(self): |
| 4300 | return self.show() |
| 4301 | |
| 4302 | def show(self): |
| 4303 | import loxi.pp |
| 4304 | return loxi.pp.pp(self) |
| 4305 | |
| 4306 | def pretty_print(self, q): |
| 4307 | q.text("get_config_request {") |
| 4308 | with q.group(): |
| 4309 | with q.indent(2): |
| 4310 | q.breakable() |
| 4311 | q.text("xid = "); |
| 4312 | if self.xid != None: |
| 4313 | q.text("%#x" % self.xid) |
| 4314 | else: |
| 4315 | q.text('None') |
| 4316 | q.breakable() |
| 4317 | q.text('}') |
| 4318 | |
| 4319 | class group_desc_stats_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4320 | version = 4 |
| 4321 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4322 | stats_type = 7 |
| 4323 | |
| 4324 | def __init__(self, xid=None, flags=None, entries=None): |
| 4325 | self.xid = xid |
| 4326 | if flags != None: |
| 4327 | self.flags = flags |
| 4328 | else: |
| 4329 | self.flags = 0 |
| 4330 | if entries != None: |
| 4331 | self.entries = entries |
| 4332 | else: |
| 4333 | self.entries = [] |
| 4334 | |
| 4335 | def pack(self): |
| 4336 | packed = [] |
| 4337 | packed.append(struct.pack("!B", self.version)) |
| 4338 | packed.append(struct.pack("!B", self.type)) |
| 4339 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4340 | packed.append(struct.pack("!L", self.xid)) |
| 4341 | packed.append(struct.pack("!H", self.stats_type)) |
| 4342 | packed.append(struct.pack("!H", self.flags)) |
| 4343 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4344 | packed.append(util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4345 | length = sum([len(x) for x in packed]) |
| 4346 | packed[2] = struct.pack("!H", length) |
| 4347 | return ''.join(packed) |
| 4348 | |
| 4349 | @staticmethod |
| 4350 | def unpack(buf): |
| 4351 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 4352 | obj = group_desc_stats_reply() |
| 4353 | if type(buf) == loxi.generic_util.OFReader: |
| 4354 | reader = buf |
| 4355 | else: |
| 4356 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4357 | _version = reader.read("!B")[0] |
| 4358 | assert(_version == 4) |
| 4359 | _type = reader.read("!B")[0] |
| 4360 | assert(_type == 19) |
| 4361 | _length = reader.read("!H")[0] |
| 4362 | obj.xid = reader.read("!L")[0] |
| 4363 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4364 | assert(_stats_type == 7) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4365 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4366 | reader.skip(4) |
| 4367 | obj.entries = common.unpack_list_group_desc_stats_entry(reader) |
| 4368 | return obj |
| 4369 | |
| 4370 | def __eq__(self, other): |
| 4371 | if type(self) != type(other): return False |
| 4372 | if self.version != other.version: return False |
| 4373 | if self.type != other.type: return False |
| 4374 | if self.xid != other.xid: return False |
| 4375 | if self.flags != other.flags: return False |
| 4376 | if self.entries != other.entries: return False |
| 4377 | return True |
| 4378 | |
| 4379 | def __ne__(self, other): |
| 4380 | return not self.__eq__(other) |
| 4381 | |
| 4382 | def __str__(self): |
| 4383 | return self.show() |
| 4384 | |
| 4385 | def show(self): |
| 4386 | import loxi.pp |
| 4387 | return loxi.pp.pp(self) |
| 4388 | |
| 4389 | def pretty_print(self, q): |
| 4390 | q.text("group_desc_stats_reply {") |
| 4391 | with q.group(): |
| 4392 | with q.indent(2): |
| 4393 | q.breakable() |
| 4394 | q.text("xid = "); |
| 4395 | if self.xid != None: |
| 4396 | q.text("%#x" % self.xid) |
| 4397 | else: |
| 4398 | q.text('None') |
| 4399 | q.text(","); q.breakable() |
| 4400 | q.text("flags = "); |
| 4401 | q.text("%#x" % self.flags) |
| 4402 | q.text(","); q.breakable() |
| 4403 | q.text("entries = "); |
| 4404 | q.pp(self.entries) |
| 4405 | q.breakable() |
| 4406 | q.text('}') |
| 4407 | |
| 4408 | class group_desc_stats_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4409 | version = 4 |
| 4410 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4411 | stats_type = 7 |
| 4412 | |
| 4413 | def __init__(self, xid=None, flags=None): |
| 4414 | self.xid = xid |
| 4415 | if flags != None: |
| 4416 | self.flags = flags |
| 4417 | else: |
| 4418 | self.flags = 0 |
| 4419 | |
| 4420 | def pack(self): |
| 4421 | packed = [] |
| 4422 | packed.append(struct.pack("!B", self.version)) |
| 4423 | packed.append(struct.pack("!B", self.type)) |
| 4424 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4425 | packed.append(struct.pack("!L", self.xid)) |
| 4426 | packed.append(struct.pack("!H", self.stats_type)) |
| 4427 | packed.append(struct.pack("!H", self.flags)) |
| 4428 | packed.append('\x00' * 4) |
| 4429 | length = sum([len(x) for x in packed]) |
| 4430 | packed[2] = struct.pack("!H", length) |
| 4431 | return ''.join(packed) |
| 4432 | |
| 4433 | @staticmethod |
| 4434 | def unpack(buf): |
| 4435 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 4436 | obj = group_desc_stats_request() |
| 4437 | if type(buf) == loxi.generic_util.OFReader: |
| 4438 | reader = buf |
| 4439 | else: |
| 4440 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4441 | _version = reader.read("!B")[0] |
| 4442 | assert(_version == 4) |
| 4443 | _type = reader.read("!B")[0] |
| 4444 | assert(_type == 18) |
| 4445 | _length = reader.read("!H")[0] |
| 4446 | obj.xid = reader.read("!L")[0] |
| 4447 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4448 | assert(_stats_type == 7) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4449 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4450 | reader.skip(4) |
| 4451 | return obj |
| 4452 | |
| 4453 | def __eq__(self, other): |
| 4454 | if type(self) != type(other): return False |
| 4455 | if self.version != other.version: return False |
| 4456 | if self.type != other.type: return False |
| 4457 | if self.xid != other.xid: return False |
| 4458 | if self.flags != other.flags: return False |
| 4459 | return True |
| 4460 | |
| 4461 | def __ne__(self, other): |
| 4462 | return not self.__eq__(other) |
| 4463 | |
| 4464 | def __str__(self): |
| 4465 | return self.show() |
| 4466 | |
| 4467 | def show(self): |
| 4468 | import loxi.pp |
| 4469 | return loxi.pp.pp(self) |
| 4470 | |
| 4471 | def pretty_print(self, q): |
| 4472 | q.text("group_desc_stats_request {") |
| 4473 | with q.group(): |
| 4474 | with q.indent(2): |
| 4475 | q.breakable() |
| 4476 | q.text("xid = "); |
| 4477 | if self.xid != None: |
| 4478 | q.text("%#x" % self.xid) |
| 4479 | else: |
| 4480 | q.text('None') |
| 4481 | q.text(","); q.breakable() |
| 4482 | q.text("flags = "); |
| 4483 | q.text("%#x" % self.flags) |
| 4484 | q.breakable() |
| 4485 | q.text('}') |
| 4486 | |
| 4487 | class group_features_stats_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4488 | version = 4 |
| 4489 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4490 | stats_type = 8 |
| 4491 | |
| 4492 | def __init__(self, xid=None, flags=None, types=None, capabilities=None, max_groups_all=None, max_groups_select=None, max_groups_indirect=None, max_groups_ff=None, actions_all=None, actions_select=None, actions_indirect=None, actions_ff=None): |
| 4493 | self.xid = xid |
| 4494 | if flags != None: |
| 4495 | self.flags = flags |
| 4496 | else: |
| 4497 | self.flags = 0 |
| 4498 | if types != None: |
| 4499 | self.types = types |
| 4500 | else: |
| 4501 | self.types = 0 |
| 4502 | if capabilities != None: |
| 4503 | self.capabilities = capabilities |
| 4504 | else: |
| 4505 | self.capabilities = 0 |
| 4506 | if max_groups_all != None: |
| 4507 | self.max_groups_all = max_groups_all |
| 4508 | else: |
| 4509 | self.max_groups_all = 0 |
| 4510 | if max_groups_select != None: |
| 4511 | self.max_groups_select = max_groups_select |
| 4512 | else: |
| 4513 | self.max_groups_select = 0 |
| 4514 | if max_groups_indirect != None: |
| 4515 | self.max_groups_indirect = max_groups_indirect |
| 4516 | else: |
| 4517 | self.max_groups_indirect = 0 |
| 4518 | if max_groups_ff != None: |
| 4519 | self.max_groups_ff = max_groups_ff |
| 4520 | else: |
| 4521 | self.max_groups_ff = 0 |
| 4522 | if actions_all != None: |
| 4523 | self.actions_all = actions_all |
| 4524 | else: |
| 4525 | self.actions_all = 0 |
| 4526 | if actions_select != None: |
| 4527 | self.actions_select = actions_select |
| 4528 | else: |
| 4529 | self.actions_select = 0 |
| 4530 | if actions_indirect != None: |
| 4531 | self.actions_indirect = actions_indirect |
| 4532 | else: |
| 4533 | self.actions_indirect = 0 |
| 4534 | if actions_ff != None: |
| 4535 | self.actions_ff = actions_ff |
| 4536 | else: |
| 4537 | self.actions_ff = 0 |
| 4538 | |
| 4539 | def pack(self): |
| 4540 | packed = [] |
| 4541 | packed.append(struct.pack("!B", self.version)) |
| 4542 | packed.append(struct.pack("!B", self.type)) |
| 4543 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4544 | packed.append(struct.pack("!L", self.xid)) |
| 4545 | packed.append(struct.pack("!H", self.stats_type)) |
| 4546 | packed.append(struct.pack("!H", self.flags)) |
| 4547 | packed.append('\x00' * 4) |
| 4548 | packed.append(struct.pack("!L", self.types)) |
| 4549 | packed.append(struct.pack("!L", self.capabilities)) |
| 4550 | packed.append(struct.pack("!L", self.max_groups_all)) |
| 4551 | packed.append(struct.pack("!L", self.max_groups_select)) |
| 4552 | packed.append(struct.pack("!L", self.max_groups_indirect)) |
| 4553 | packed.append(struct.pack("!L", self.max_groups_ff)) |
| 4554 | packed.append(struct.pack("!L", self.actions_all)) |
| 4555 | packed.append(struct.pack("!L", self.actions_select)) |
| 4556 | packed.append(struct.pack("!L", self.actions_indirect)) |
| 4557 | packed.append(struct.pack("!L", self.actions_ff)) |
| 4558 | length = sum([len(x) for x in packed]) |
| 4559 | packed[2] = struct.pack("!H", length) |
| 4560 | return ''.join(packed) |
| 4561 | |
| 4562 | @staticmethod |
| 4563 | def unpack(buf): |
| 4564 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 4565 | obj = group_features_stats_reply() |
| 4566 | if type(buf) == loxi.generic_util.OFReader: |
| 4567 | reader = buf |
| 4568 | else: |
| 4569 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4570 | _version = reader.read("!B")[0] |
| 4571 | assert(_version == 4) |
| 4572 | _type = reader.read("!B")[0] |
| 4573 | assert(_type == 19) |
| 4574 | _length = reader.read("!H")[0] |
| 4575 | obj.xid = reader.read("!L")[0] |
| 4576 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4577 | assert(_stats_type == 8) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4578 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4579 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4580 | obj.types = reader.read("!L")[0] |
| 4581 | obj.capabilities = reader.read("!L")[0] |
| 4582 | obj.max_groups_all = reader.read("!L")[0] |
| 4583 | obj.max_groups_select = reader.read("!L")[0] |
| 4584 | obj.max_groups_indirect = reader.read("!L")[0] |
| 4585 | obj.max_groups_ff = reader.read("!L")[0] |
| 4586 | obj.actions_all = reader.read("!L")[0] |
| 4587 | obj.actions_select = reader.read("!L")[0] |
| 4588 | obj.actions_indirect = reader.read("!L")[0] |
| 4589 | obj.actions_ff = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4590 | return obj |
| 4591 | |
| 4592 | def __eq__(self, other): |
| 4593 | if type(self) != type(other): return False |
| 4594 | if self.version != other.version: return False |
| 4595 | if self.type != other.type: return False |
| 4596 | if self.xid != other.xid: return False |
| 4597 | if self.flags != other.flags: return False |
| 4598 | if self.types != other.types: return False |
| 4599 | if self.capabilities != other.capabilities: return False |
| 4600 | if self.max_groups_all != other.max_groups_all: return False |
| 4601 | if self.max_groups_select != other.max_groups_select: return False |
| 4602 | if self.max_groups_indirect != other.max_groups_indirect: return False |
| 4603 | if self.max_groups_ff != other.max_groups_ff: return False |
| 4604 | if self.actions_all != other.actions_all: return False |
| 4605 | if self.actions_select != other.actions_select: return False |
| 4606 | if self.actions_indirect != other.actions_indirect: return False |
| 4607 | if self.actions_ff != other.actions_ff: return False |
| 4608 | return True |
| 4609 | |
| 4610 | def __ne__(self, other): |
| 4611 | return not self.__eq__(other) |
| 4612 | |
| 4613 | def __str__(self): |
| 4614 | return self.show() |
| 4615 | |
| 4616 | def show(self): |
| 4617 | import loxi.pp |
| 4618 | return loxi.pp.pp(self) |
| 4619 | |
| 4620 | def pretty_print(self, q): |
| 4621 | q.text("group_features_stats_reply {") |
| 4622 | with q.group(): |
| 4623 | with q.indent(2): |
| 4624 | q.breakable() |
| 4625 | q.text("xid = "); |
| 4626 | if self.xid != None: |
| 4627 | q.text("%#x" % self.xid) |
| 4628 | else: |
| 4629 | q.text('None') |
| 4630 | q.text(","); q.breakable() |
| 4631 | q.text("flags = "); |
| 4632 | q.text("%#x" % self.flags) |
| 4633 | q.text(","); q.breakable() |
| 4634 | q.text("types = "); |
| 4635 | q.text("%#x" % self.types) |
| 4636 | q.text(","); q.breakable() |
| 4637 | q.text("capabilities = "); |
| 4638 | q.text("%#x" % self.capabilities) |
| 4639 | q.text(","); q.breakable() |
| 4640 | q.text("max_groups_all = "); |
| 4641 | q.text("%#x" % self.max_groups_all) |
| 4642 | q.text(","); q.breakable() |
| 4643 | q.text("max_groups_select = "); |
| 4644 | q.text("%#x" % self.max_groups_select) |
| 4645 | q.text(","); q.breakable() |
| 4646 | q.text("max_groups_indirect = "); |
| 4647 | q.text("%#x" % self.max_groups_indirect) |
| 4648 | q.text(","); q.breakable() |
| 4649 | q.text("max_groups_ff = "); |
| 4650 | q.text("%#x" % self.max_groups_ff) |
| 4651 | q.text(","); q.breakable() |
| 4652 | q.text("actions_all = "); |
| 4653 | q.text("%#x" % self.actions_all) |
| 4654 | q.text(","); q.breakable() |
| 4655 | q.text("actions_select = "); |
| 4656 | q.text("%#x" % self.actions_select) |
| 4657 | q.text(","); q.breakable() |
| 4658 | q.text("actions_indirect = "); |
| 4659 | q.text("%#x" % self.actions_indirect) |
| 4660 | q.text(","); q.breakable() |
| 4661 | q.text("actions_ff = "); |
| 4662 | q.text("%#x" % self.actions_ff) |
| 4663 | q.breakable() |
| 4664 | q.text('}') |
| 4665 | |
| 4666 | class group_features_stats_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4667 | version = 4 |
| 4668 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4669 | stats_type = 8 |
| 4670 | |
| 4671 | def __init__(self, xid=None, flags=None): |
| 4672 | self.xid = xid |
| 4673 | if flags != None: |
| 4674 | self.flags = flags |
| 4675 | else: |
| 4676 | self.flags = 0 |
| 4677 | |
| 4678 | def pack(self): |
| 4679 | packed = [] |
| 4680 | packed.append(struct.pack("!B", self.version)) |
| 4681 | packed.append(struct.pack("!B", self.type)) |
| 4682 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4683 | packed.append(struct.pack("!L", self.xid)) |
| 4684 | packed.append(struct.pack("!H", self.stats_type)) |
| 4685 | packed.append(struct.pack("!H", self.flags)) |
| 4686 | packed.append('\x00' * 4) |
| 4687 | length = sum([len(x) for x in packed]) |
| 4688 | packed[2] = struct.pack("!H", length) |
| 4689 | return ''.join(packed) |
| 4690 | |
| 4691 | @staticmethod |
| 4692 | def unpack(buf): |
| 4693 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 4694 | obj = group_features_stats_request() |
| 4695 | if type(buf) == loxi.generic_util.OFReader: |
| 4696 | reader = buf |
| 4697 | else: |
| 4698 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4699 | _version = reader.read("!B")[0] |
| 4700 | assert(_version == 4) |
| 4701 | _type = reader.read("!B")[0] |
| 4702 | assert(_type == 18) |
| 4703 | _length = reader.read("!H")[0] |
| 4704 | obj.xid = reader.read("!L")[0] |
| 4705 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4706 | assert(_stats_type == 8) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4707 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4708 | reader.skip(4) |
| 4709 | return obj |
| 4710 | |
| 4711 | def __eq__(self, other): |
| 4712 | if type(self) != type(other): return False |
| 4713 | if self.version != other.version: return False |
| 4714 | if self.type != other.type: return False |
| 4715 | if self.xid != other.xid: return False |
| 4716 | if self.flags != other.flags: return False |
| 4717 | return True |
| 4718 | |
| 4719 | def __ne__(self, other): |
| 4720 | return not self.__eq__(other) |
| 4721 | |
| 4722 | def __str__(self): |
| 4723 | return self.show() |
| 4724 | |
| 4725 | def show(self): |
| 4726 | import loxi.pp |
| 4727 | return loxi.pp.pp(self) |
| 4728 | |
| 4729 | def pretty_print(self, q): |
| 4730 | q.text("group_features_stats_request {") |
| 4731 | with q.group(): |
| 4732 | with q.indent(2): |
| 4733 | q.breakable() |
| 4734 | q.text("xid = "); |
| 4735 | if self.xid != None: |
| 4736 | q.text("%#x" % self.xid) |
| 4737 | else: |
| 4738 | q.text('None') |
| 4739 | q.text(","); q.breakable() |
| 4740 | q.text("flags = "); |
| 4741 | q.text("%#x" % self.flags) |
| 4742 | q.breakable() |
| 4743 | q.text('}') |
| 4744 | |
| 4745 | class group_mod(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4746 | version = 4 |
| 4747 | type = 15 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4748 | |
| 4749 | def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None): |
| 4750 | self.xid = xid |
| 4751 | if command != None: |
| 4752 | self.command = command |
| 4753 | else: |
| 4754 | self.command = 0 |
| 4755 | if group_type != None: |
| 4756 | self.group_type = group_type |
| 4757 | else: |
| 4758 | self.group_type = 0 |
| 4759 | if group_id != None: |
| 4760 | self.group_id = group_id |
| 4761 | else: |
| 4762 | self.group_id = 0 |
| 4763 | if buckets != None: |
| 4764 | self.buckets = buckets |
| 4765 | else: |
| 4766 | self.buckets = [] |
| 4767 | |
| 4768 | def pack(self): |
| 4769 | packed = [] |
| 4770 | packed.append(struct.pack("!B", self.version)) |
| 4771 | packed.append(struct.pack("!B", self.type)) |
| 4772 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4773 | packed.append(struct.pack("!L", self.xid)) |
| 4774 | packed.append(struct.pack("!H", self.command)) |
| 4775 | packed.append(struct.pack("!B", self.group_type)) |
| 4776 | packed.append('\x00' * 1) |
| 4777 | packed.append(struct.pack("!L", self.group_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4778 | packed.append(util.pack_list(self.buckets)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4779 | length = sum([len(x) for x in packed]) |
| 4780 | packed[2] = struct.pack("!H", length) |
| 4781 | return ''.join(packed) |
| 4782 | |
| 4783 | @staticmethod |
| 4784 | def unpack(buf): |
| 4785 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 4786 | obj = group_mod() |
| 4787 | if type(buf) == loxi.generic_util.OFReader: |
| 4788 | reader = buf |
| 4789 | else: |
| 4790 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4791 | _version = reader.read("!B")[0] |
| 4792 | assert(_version == 4) |
| 4793 | _type = reader.read("!B")[0] |
| 4794 | assert(_type == 15) |
| 4795 | _length = reader.read("!H")[0] |
| 4796 | obj.xid = reader.read("!L")[0] |
| 4797 | obj.command = reader.read("!H")[0] |
| 4798 | obj.group_type = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4799 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4800 | obj.group_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4801 | obj.buckets = common.unpack_list_bucket(reader) |
| 4802 | return obj |
| 4803 | |
| 4804 | def __eq__(self, other): |
| 4805 | if type(self) != type(other): return False |
| 4806 | if self.version != other.version: return False |
| 4807 | if self.type != other.type: return False |
| 4808 | if self.xid != other.xid: return False |
| 4809 | if self.command != other.command: return False |
| 4810 | if self.group_type != other.group_type: return False |
| 4811 | if self.group_id != other.group_id: return False |
| 4812 | if self.buckets != other.buckets: return False |
| 4813 | return True |
| 4814 | |
| 4815 | def __ne__(self, other): |
| 4816 | return not self.__eq__(other) |
| 4817 | |
| 4818 | def __str__(self): |
| 4819 | return self.show() |
| 4820 | |
| 4821 | def show(self): |
| 4822 | import loxi.pp |
| 4823 | return loxi.pp.pp(self) |
| 4824 | |
| 4825 | def pretty_print(self, q): |
| 4826 | q.text("group_mod {") |
| 4827 | with q.group(): |
| 4828 | with q.indent(2): |
| 4829 | q.breakable() |
| 4830 | q.text("xid = "); |
| 4831 | if self.xid != None: |
| 4832 | q.text("%#x" % self.xid) |
| 4833 | else: |
| 4834 | q.text('None') |
| 4835 | q.text(","); q.breakable() |
| 4836 | q.text("command = "); |
| 4837 | q.text("%#x" % self.command) |
| 4838 | q.text(","); q.breakable() |
| 4839 | q.text("group_type = "); |
| 4840 | q.text("%#x" % self.group_type) |
| 4841 | q.text(","); q.breakable() |
| 4842 | q.text("group_id = "); |
| 4843 | q.text("%#x" % self.group_id) |
| 4844 | q.text(","); q.breakable() |
| 4845 | q.text("buckets = "); |
| 4846 | q.pp(self.buckets) |
| 4847 | q.breakable() |
| 4848 | q.text('}') |
| 4849 | |
| 4850 | class group_stats_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4851 | version = 4 |
| 4852 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4853 | stats_type = 6 |
| 4854 | |
| 4855 | def __init__(self, xid=None, flags=None, entries=None): |
| 4856 | self.xid = xid |
| 4857 | if flags != None: |
| 4858 | self.flags = flags |
| 4859 | else: |
| 4860 | self.flags = 0 |
| 4861 | if entries != None: |
| 4862 | self.entries = entries |
| 4863 | else: |
| 4864 | self.entries = [] |
| 4865 | |
| 4866 | def pack(self): |
| 4867 | packed = [] |
| 4868 | packed.append(struct.pack("!B", self.version)) |
| 4869 | packed.append(struct.pack("!B", self.type)) |
| 4870 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4871 | packed.append(struct.pack("!L", self.xid)) |
| 4872 | packed.append(struct.pack("!H", self.stats_type)) |
| 4873 | packed.append(struct.pack("!H", self.flags)) |
| 4874 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4875 | packed.append(util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4876 | length = sum([len(x) for x in packed]) |
| 4877 | packed[2] = struct.pack("!H", length) |
| 4878 | return ''.join(packed) |
| 4879 | |
| 4880 | @staticmethod |
| 4881 | def unpack(buf): |
| 4882 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 4883 | obj = group_stats_reply() |
| 4884 | if type(buf) == loxi.generic_util.OFReader: |
| 4885 | reader = buf |
| 4886 | else: |
| 4887 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4888 | _version = reader.read("!B")[0] |
| 4889 | assert(_version == 4) |
| 4890 | _type = reader.read("!B")[0] |
| 4891 | assert(_type == 19) |
| 4892 | _length = reader.read("!H")[0] |
| 4893 | obj.xid = reader.read("!L")[0] |
| 4894 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4895 | assert(_stats_type == 6) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4896 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4897 | reader.skip(4) |
| 4898 | obj.entries = common.unpack_list_group_stats_entry(reader) |
| 4899 | return obj |
| 4900 | |
| 4901 | def __eq__(self, other): |
| 4902 | if type(self) != type(other): return False |
| 4903 | if self.version != other.version: return False |
| 4904 | if self.type != other.type: return False |
| 4905 | if self.xid != other.xid: return False |
| 4906 | if self.flags != other.flags: return False |
| 4907 | if self.entries != other.entries: return False |
| 4908 | return True |
| 4909 | |
| 4910 | def __ne__(self, other): |
| 4911 | return not self.__eq__(other) |
| 4912 | |
| 4913 | def __str__(self): |
| 4914 | return self.show() |
| 4915 | |
| 4916 | def show(self): |
| 4917 | import loxi.pp |
| 4918 | return loxi.pp.pp(self) |
| 4919 | |
| 4920 | def pretty_print(self, q): |
| 4921 | q.text("group_stats_reply {") |
| 4922 | with q.group(): |
| 4923 | with q.indent(2): |
| 4924 | q.breakable() |
| 4925 | q.text("xid = "); |
| 4926 | if self.xid != None: |
| 4927 | q.text("%#x" % self.xid) |
| 4928 | else: |
| 4929 | q.text('None') |
| 4930 | q.text(","); q.breakable() |
| 4931 | q.text("flags = "); |
| 4932 | q.text("%#x" % self.flags) |
| 4933 | q.text(","); q.breakable() |
| 4934 | q.text("entries = "); |
| 4935 | q.pp(self.entries) |
| 4936 | q.breakable() |
| 4937 | q.text('}') |
| 4938 | |
| 4939 | class group_stats_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4940 | version = 4 |
| 4941 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4942 | stats_type = 6 |
| 4943 | |
| 4944 | def __init__(self, xid=None, flags=None, group_id=None): |
| 4945 | self.xid = xid |
| 4946 | if flags != None: |
| 4947 | self.flags = flags |
| 4948 | else: |
| 4949 | self.flags = 0 |
| 4950 | if group_id != None: |
| 4951 | self.group_id = group_id |
| 4952 | else: |
| 4953 | self.group_id = 0 |
| 4954 | |
| 4955 | def pack(self): |
| 4956 | packed = [] |
| 4957 | packed.append(struct.pack("!B", self.version)) |
| 4958 | packed.append(struct.pack("!B", self.type)) |
| 4959 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4960 | packed.append(struct.pack("!L", self.xid)) |
| 4961 | packed.append(struct.pack("!H", self.stats_type)) |
| 4962 | packed.append(struct.pack("!H", self.flags)) |
| 4963 | packed.append('\x00' * 4) |
| 4964 | packed.append(struct.pack("!L", self.group_id)) |
| 4965 | packed.append('\x00' * 4) |
| 4966 | length = sum([len(x) for x in packed]) |
| 4967 | packed[2] = struct.pack("!H", length) |
| 4968 | return ''.join(packed) |
| 4969 | |
| 4970 | @staticmethod |
| 4971 | def unpack(buf): |
| 4972 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 4973 | obj = group_stats_request() |
| 4974 | if type(buf) == loxi.generic_util.OFReader: |
| 4975 | reader = buf |
| 4976 | else: |
| 4977 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4978 | _version = reader.read("!B")[0] |
| 4979 | assert(_version == 4) |
| 4980 | _type = reader.read("!B")[0] |
| 4981 | assert(_type == 18) |
| 4982 | _length = reader.read("!H")[0] |
| 4983 | obj.xid = reader.read("!L")[0] |
| 4984 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4985 | assert(_stats_type == 6) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4986 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4987 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4988 | obj.group_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4989 | reader.skip(4) |
| 4990 | return obj |
| 4991 | |
| 4992 | def __eq__(self, other): |
| 4993 | if type(self) != type(other): return False |
| 4994 | if self.version != other.version: return False |
| 4995 | if self.type != other.type: return False |
| 4996 | if self.xid != other.xid: return False |
| 4997 | if self.flags != other.flags: return False |
| 4998 | if self.group_id != other.group_id: return False |
| 4999 | return True |
| 5000 | |
| 5001 | def __ne__(self, other): |
| 5002 | return not self.__eq__(other) |
| 5003 | |
| 5004 | def __str__(self): |
| 5005 | return self.show() |
| 5006 | |
| 5007 | def show(self): |
| 5008 | import loxi.pp |
| 5009 | return loxi.pp.pp(self) |
| 5010 | |
| 5011 | def pretty_print(self, q): |
| 5012 | q.text("group_stats_request {") |
| 5013 | with q.group(): |
| 5014 | with q.indent(2): |
| 5015 | q.breakable() |
| 5016 | q.text("xid = "); |
| 5017 | if self.xid != None: |
| 5018 | q.text("%#x" % self.xid) |
| 5019 | else: |
| 5020 | q.text('None') |
| 5021 | q.text(","); q.breakable() |
| 5022 | q.text("flags = "); |
| 5023 | q.text("%#x" % self.flags) |
| 5024 | q.text(","); q.breakable() |
| 5025 | q.text("group_id = "); |
| 5026 | q.text("%#x" % self.group_id) |
| 5027 | q.breakable() |
| 5028 | q.text('}') |
| 5029 | |
| 5030 | class hello(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5031 | version = 4 |
| 5032 | type = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5033 | |
| 5034 | def __init__(self, xid=None, elements=None): |
| 5035 | self.xid = xid |
| 5036 | if elements != None: |
| 5037 | self.elements = elements |
| 5038 | else: |
| 5039 | self.elements = [] |
| 5040 | |
| 5041 | def pack(self): |
| 5042 | packed = [] |
| 5043 | packed.append(struct.pack("!B", self.version)) |
| 5044 | packed.append(struct.pack("!B", self.type)) |
| 5045 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5046 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5047 | packed.append(util.pack_list(self.elements)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5048 | length = sum([len(x) for x in packed]) |
| 5049 | packed[2] = struct.pack("!H", length) |
| 5050 | return ''.join(packed) |
| 5051 | |
| 5052 | @staticmethod |
| 5053 | def unpack(buf): |
| 5054 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 5055 | obj = hello() |
| 5056 | if type(buf) == loxi.generic_util.OFReader: |
| 5057 | reader = buf |
| 5058 | else: |
| 5059 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5060 | _version = reader.read("!B")[0] |
| 5061 | assert(_version == 4) |
| 5062 | _type = reader.read("!B")[0] |
| 5063 | assert(_type == 0) |
| 5064 | _length = reader.read("!H")[0] |
| 5065 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5066 | obj.elements = common.unpack_list_hello_elem(reader) |
| 5067 | return obj |
| 5068 | |
| 5069 | def __eq__(self, other): |
| 5070 | if type(self) != type(other): return False |
| 5071 | if self.version != other.version: return False |
| 5072 | if self.type != other.type: return False |
| 5073 | if self.xid != other.xid: return False |
| 5074 | if self.elements != other.elements: return False |
| 5075 | return True |
| 5076 | |
| 5077 | def __ne__(self, other): |
| 5078 | return not self.__eq__(other) |
| 5079 | |
| 5080 | def __str__(self): |
| 5081 | return self.show() |
| 5082 | |
| 5083 | def show(self): |
| 5084 | import loxi.pp |
| 5085 | return loxi.pp.pp(self) |
| 5086 | |
| 5087 | def pretty_print(self, q): |
| 5088 | q.text("hello {") |
| 5089 | with q.group(): |
| 5090 | with q.indent(2): |
| 5091 | q.breakable() |
| 5092 | q.text("xid = "); |
| 5093 | if self.xid != None: |
| 5094 | q.text("%#x" % self.xid) |
| 5095 | else: |
| 5096 | q.text('None') |
| 5097 | q.text(","); q.breakable() |
| 5098 | q.text("elements = "); |
| 5099 | q.pp(self.elements) |
| 5100 | q.breakable() |
| 5101 | q.text('}') |
| 5102 | |
| 5103 | class meter_config_stats_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5104 | version = 4 |
| 5105 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5106 | stats_type = 10 |
| 5107 | |
| 5108 | def __init__(self, xid=None, flags=None, entries=None): |
| 5109 | self.xid = xid |
| 5110 | if flags != None: |
| 5111 | self.flags = flags |
| 5112 | else: |
| 5113 | self.flags = 0 |
| 5114 | if entries != None: |
| 5115 | self.entries = entries |
| 5116 | else: |
| 5117 | self.entries = [] |
| 5118 | |
| 5119 | def pack(self): |
| 5120 | packed = [] |
| 5121 | packed.append(struct.pack("!B", self.version)) |
| 5122 | packed.append(struct.pack("!B", self.type)) |
| 5123 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5124 | packed.append(struct.pack("!L", self.xid)) |
| 5125 | packed.append(struct.pack("!H", self.stats_type)) |
| 5126 | packed.append(struct.pack("!H", self.flags)) |
| 5127 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5128 | packed.append(util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5129 | length = sum([len(x) for x in packed]) |
| 5130 | packed[2] = struct.pack("!H", length) |
| 5131 | return ''.join(packed) |
| 5132 | |
| 5133 | @staticmethod |
| 5134 | def unpack(buf): |
| 5135 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 5136 | obj = meter_config_stats_reply() |
| 5137 | if type(buf) == loxi.generic_util.OFReader: |
| 5138 | reader = buf |
| 5139 | else: |
| 5140 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5141 | _version = reader.read("!B")[0] |
| 5142 | assert(_version == 4) |
| 5143 | _type = reader.read("!B")[0] |
| 5144 | assert(_type == 19) |
| 5145 | _length = reader.read("!H")[0] |
| 5146 | obj.xid = reader.read("!L")[0] |
| 5147 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5148 | assert(_stats_type == 10) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5149 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5150 | reader.skip(4) |
| 5151 | obj.entries = meter_band.unpack_list(reader) |
| 5152 | return obj |
| 5153 | |
| 5154 | def __eq__(self, other): |
| 5155 | if type(self) != type(other): return False |
| 5156 | if self.version != other.version: return False |
| 5157 | if self.type != other.type: return False |
| 5158 | if self.xid != other.xid: return False |
| 5159 | if self.flags != other.flags: return False |
| 5160 | if self.entries != other.entries: return False |
| 5161 | return True |
| 5162 | |
| 5163 | def __ne__(self, other): |
| 5164 | return not self.__eq__(other) |
| 5165 | |
| 5166 | def __str__(self): |
| 5167 | return self.show() |
| 5168 | |
| 5169 | def show(self): |
| 5170 | import loxi.pp |
| 5171 | return loxi.pp.pp(self) |
| 5172 | |
| 5173 | def pretty_print(self, q): |
| 5174 | q.text("meter_config_stats_reply {") |
| 5175 | with q.group(): |
| 5176 | with q.indent(2): |
| 5177 | q.breakable() |
| 5178 | q.text("xid = "); |
| 5179 | if self.xid != None: |
| 5180 | q.text("%#x" % self.xid) |
| 5181 | else: |
| 5182 | q.text('None') |
| 5183 | q.text(","); q.breakable() |
| 5184 | q.text("flags = "); |
| 5185 | q.text("%#x" % self.flags) |
| 5186 | q.text(","); q.breakable() |
| 5187 | q.text("entries = "); |
| 5188 | q.pp(self.entries) |
| 5189 | q.breakable() |
| 5190 | q.text('}') |
| 5191 | |
| 5192 | class meter_config_stats_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5193 | version = 4 |
| 5194 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5195 | stats_type = 10 |
| 5196 | |
| 5197 | def __init__(self, xid=None, flags=None, meter_id=None): |
| 5198 | self.xid = xid |
| 5199 | if flags != None: |
| 5200 | self.flags = flags |
| 5201 | else: |
| 5202 | self.flags = 0 |
| 5203 | if meter_id != None: |
| 5204 | self.meter_id = meter_id |
| 5205 | else: |
| 5206 | self.meter_id = 0 |
| 5207 | |
| 5208 | def pack(self): |
| 5209 | packed = [] |
| 5210 | packed.append(struct.pack("!B", self.version)) |
| 5211 | packed.append(struct.pack("!B", self.type)) |
| 5212 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5213 | packed.append(struct.pack("!L", self.xid)) |
| 5214 | packed.append(struct.pack("!H", self.stats_type)) |
| 5215 | packed.append(struct.pack("!H", self.flags)) |
| 5216 | packed.append('\x00' * 4) |
| 5217 | packed.append(struct.pack("!L", self.meter_id)) |
| 5218 | packed.append('\x00' * 4) |
| 5219 | length = sum([len(x) for x in packed]) |
| 5220 | packed[2] = struct.pack("!H", length) |
| 5221 | return ''.join(packed) |
| 5222 | |
| 5223 | @staticmethod |
| 5224 | def unpack(buf): |
| 5225 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 5226 | obj = meter_config_stats_request() |
| 5227 | if type(buf) == loxi.generic_util.OFReader: |
| 5228 | reader = buf |
| 5229 | else: |
| 5230 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5231 | _version = reader.read("!B")[0] |
| 5232 | assert(_version == 4) |
| 5233 | _type = reader.read("!B")[0] |
| 5234 | assert(_type == 18) |
| 5235 | _length = reader.read("!H")[0] |
| 5236 | obj.xid = reader.read("!L")[0] |
| 5237 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5238 | assert(_stats_type == 10) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5239 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5240 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5241 | obj.meter_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5242 | reader.skip(4) |
| 5243 | return obj |
| 5244 | |
| 5245 | def __eq__(self, other): |
| 5246 | if type(self) != type(other): return False |
| 5247 | if self.version != other.version: return False |
| 5248 | if self.type != other.type: return False |
| 5249 | if self.xid != other.xid: return False |
| 5250 | if self.flags != other.flags: return False |
| 5251 | if self.meter_id != other.meter_id: return False |
| 5252 | return True |
| 5253 | |
| 5254 | def __ne__(self, other): |
| 5255 | return not self.__eq__(other) |
| 5256 | |
| 5257 | def __str__(self): |
| 5258 | return self.show() |
| 5259 | |
| 5260 | def show(self): |
| 5261 | import loxi.pp |
| 5262 | return loxi.pp.pp(self) |
| 5263 | |
| 5264 | def pretty_print(self, q): |
| 5265 | q.text("meter_config_stats_request {") |
| 5266 | with q.group(): |
| 5267 | with q.indent(2): |
| 5268 | q.breakable() |
| 5269 | q.text("xid = "); |
| 5270 | if self.xid != None: |
| 5271 | q.text("%#x" % self.xid) |
| 5272 | else: |
| 5273 | q.text('None') |
| 5274 | q.text(","); q.breakable() |
| 5275 | q.text("flags = "); |
| 5276 | q.text("%#x" % self.flags) |
| 5277 | q.text(","); q.breakable() |
| 5278 | q.text("meter_id = "); |
| 5279 | q.text("%#x" % self.meter_id) |
| 5280 | q.breakable() |
| 5281 | q.text('}') |
| 5282 | |
| 5283 | class meter_features_stats_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5284 | version = 4 |
| 5285 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5286 | stats_type = 11 |
| 5287 | |
| 5288 | def __init__(self, xid=None, flags=None, features=None): |
| 5289 | self.xid = xid |
| 5290 | if flags != None: |
| 5291 | self.flags = flags |
| 5292 | else: |
| 5293 | self.flags = 0 |
| 5294 | if features != None: |
| 5295 | self.features = features |
| 5296 | else: |
| 5297 | self.features = common.meter_features() |
| 5298 | |
| 5299 | def pack(self): |
| 5300 | packed = [] |
| 5301 | packed.append(struct.pack("!B", self.version)) |
| 5302 | packed.append(struct.pack("!B", self.type)) |
| 5303 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5304 | packed.append(struct.pack("!L", self.xid)) |
| 5305 | packed.append(struct.pack("!H", self.stats_type)) |
| 5306 | packed.append(struct.pack("!H", self.flags)) |
| 5307 | packed.append('\x00' * 4) |
| 5308 | packed.append(self.features.pack()) |
| 5309 | length = sum([len(x) for x in packed]) |
| 5310 | packed[2] = struct.pack("!H", length) |
| 5311 | return ''.join(packed) |
| 5312 | |
| 5313 | @staticmethod |
| 5314 | def unpack(buf): |
| 5315 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 5316 | obj = meter_features_stats_reply() |
| 5317 | if type(buf) == loxi.generic_util.OFReader: |
| 5318 | reader = buf |
| 5319 | else: |
| 5320 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5321 | _version = reader.read("!B")[0] |
| 5322 | assert(_version == 4) |
| 5323 | _type = reader.read("!B")[0] |
| 5324 | assert(_type == 19) |
| 5325 | _length = reader.read("!H")[0] |
| 5326 | obj.xid = reader.read("!L")[0] |
| 5327 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5328 | assert(_stats_type == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5329 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5330 | reader.skip(4) |
| 5331 | obj.features = common.meter_features.unpack(reader) |
| 5332 | return obj |
| 5333 | |
| 5334 | def __eq__(self, other): |
| 5335 | if type(self) != type(other): return False |
| 5336 | if self.version != other.version: return False |
| 5337 | if self.type != other.type: return False |
| 5338 | if self.xid != other.xid: return False |
| 5339 | if self.flags != other.flags: return False |
| 5340 | if self.features != other.features: return False |
| 5341 | return True |
| 5342 | |
| 5343 | def __ne__(self, other): |
| 5344 | return not self.__eq__(other) |
| 5345 | |
| 5346 | def __str__(self): |
| 5347 | return self.show() |
| 5348 | |
| 5349 | def show(self): |
| 5350 | import loxi.pp |
| 5351 | return loxi.pp.pp(self) |
| 5352 | |
| 5353 | def pretty_print(self, q): |
| 5354 | q.text("meter_features_stats_reply {") |
| 5355 | with q.group(): |
| 5356 | with q.indent(2): |
| 5357 | q.breakable() |
| 5358 | q.text("xid = "); |
| 5359 | if self.xid != None: |
| 5360 | q.text("%#x" % self.xid) |
| 5361 | else: |
| 5362 | q.text('None') |
| 5363 | q.text(","); q.breakable() |
| 5364 | q.text("flags = "); |
| 5365 | q.text("%#x" % self.flags) |
| 5366 | q.text(","); q.breakable() |
| 5367 | q.text("features = "); |
| 5368 | q.pp(self.features) |
| 5369 | q.breakable() |
| 5370 | q.text('}') |
| 5371 | |
| 5372 | class meter_features_stats_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5373 | version = 4 |
| 5374 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5375 | stats_type = 11 |
| 5376 | |
| 5377 | def __init__(self, xid=None, flags=None): |
| 5378 | self.xid = xid |
| 5379 | if flags != None: |
| 5380 | self.flags = flags |
| 5381 | else: |
| 5382 | self.flags = 0 |
| 5383 | |
| 5384 | def pack(self): |
| 5385 | packed = [] |
| 5386 | packed.append(struct.pack("!B", self.version)) |
| 5387 | packed.append(struct.pack("!B", self.type)) |
| 5388 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5389 | packed.append(struct.pack("!L", self.xid)) |
| 5390 | packed.append(struct.pack("!H", self.stats_type)) |
| 5391 | packed.append(struct.pack("!H", self.flags)) |
| 5392 | packed.append('\x00' * 4) |
| 5393 | length = sum([len(x) for x in packed]) |
| 5394 | packed[2] = struct.pack("!H", length) |
| 5395 | return ''.join(packed) |
| 5396 | |
| 5397 | @staticmethod |
| 5398 | def unpack(buf): |
| 5399 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 5400 | obj = meter_features_stats_request() |
| 5401 | if type(buf) == loxi.generic_util.OFReader: |
| 5402 | reader = buf |
| 5403 | else: |
| 5404 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5405 | _version = reader.read("!B")[0] |
| 5406 | assert(_version == 4) |
| 5407 | _type = reader.read("!B")[0] |
| 5408 | assert(_type == 18) |
| 5409 | _length = reader.read("!H")[0] |
| 5410 | obj.xid = reader.read("!L")[0] |
| 5411 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5412 | assert(_stats_type == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5413 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5414 | reader.skip(4) |
| 5415 | return obj |
| 5416 | |
| 5417 | def __eq__(self, other): |
| 5418 | if type(self) != type(other): return False |
| 5419 | if self.version != other.version: return False |
| 5420 | if self.type != other.type: return False |
| 5421 | if self.xid != other.xid: return False |
| 5422 | if self.flags != other.flags: return False |
| 5423 | return True |
| 5424 | |
| 5425 | def __ne__(self, other): |
| 5426 | return not self.__eq__(other) |
| 5427 | |
| 5428 | def __str__(self): |
| 5429 | return self.show() |
| 5430 | |
| 5431 | def show(self): |
| 5432 | import loxi.pp |
| 5433 | return loxi.pp.pp(self) |
| 5434 | |
| 5435 | def pretty_print(self, q): |
| 5436 | q.text("meter_features_stats_request {") |
| 5437 | with q.group(): |
| 5438 | with q.indent(2): |
| 5439 | q.breakable() |
| 5440 | q.text("xid = "); |
| 5441 | if self.xid != None: |
| 5442 | q.text("%#x" % self.xid) |
| 5443 | else: |
| 5444 | q.text('None') |
| 5445 | q.text(","); q.breakable() |
| 5446 | q.text("flags = "); |
| 5447 | q.text("%#x" % self.flags) |
| 5448 | q.breakable() |
| 5449 | q.text('}') |
| 5450 | |
| 5451 | class meter_mod(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5452 | version = 4 |
| 5453 | type = 29 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5454 | |
| 5455 | def __init__(self, xid=None, command=None, flags=None, meter_id=None, meters=None): |
| 5456 | self.xid = xid |
| 5457 | if command != None: |
| 5458 | self.command = command |
| 5459 | else: |
| 5460 | self.command = 0 |
| 5461 | if flags != None: |
| 5462 | self.flags = flags |
| 5463 | else: |
| 5464 | self.flags = 0 |
| 5465 | if meter_id != None: |
| 5466 | self.meter_id = meter_id |
| 5467 | else: |
| 5468 | self.meter_id = 0 |
| 5469 | if meters != None: |
| 5470 | self.meters = meters |
| 5471 | else: |
| 5472 | self.meters = [] |
| 5473 | |
| 5474 | def pack(self): |
| 5475 | packed = [] |
| 5476 | packed.append(struct.pack("!B", self.version)) |
| 5477 | packed.append(struct.pack("!B", self.type)) |
| 5478 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5479 | packed.append(struct.pack("!L", self.xid)) |
| 5480 | packed.append(struct.pack("!H", self.command)) |
| 5481 | packed.append(struct.pack("!H", self.flags)) |
| 5482 | packed.append(struct.pack("!L", self.meter_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5483 | packed.append(util.pack_list(self.meters)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5484 | length = sum([len(x) for x in packed]) |
| 5485 | packed[2] = struct.pack("!H", length) |
| 5486 | return ''.join(packed) |
| 5487 | |
| 5488 | @staticmethod |
| 5489 | def unpack(buf): |
| 5490 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 5491 | obj = meter_mod() |
| 5492 | if type(buf) == loxi.generic_util.OFReader: |
| 5493 | reader = buf |
| 5494 | else: |
| 5495 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5496 | _version = reader.read("!B")[0] |
| 5497 | assert(_version == 4) |
| 5498 | _type = reader.read("!B")[0] |
| 5499 | assert(_type == 29) |
| 5500 | _length = reader.read("!H")[0] |
| 5501 | obj.xid = reader.read("!L")[0] |
| 5502 | obj.command = reader.read("!H")[0] |
| 5503 | obj.flags = reader.read("!H")[0] |
| 5504 | obj.meter_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5505 | obj.meters = meter_band.unpack_list(reader) |
| 5506 | return obj |
| 5507 | |
| 5508 | def __eq__(self, other): |
| 5509 | if type(self) != type(other): return False |
| 5510 | if self.version != other.version: return False |
| 5511 | if self.type != other.type: return False |
| 5512 | if self.xid != other.xid: return False |
| 5513 | if self.command != other.command: return False |
| 5514 | if self.flags != other.flags: return False |
| 5515 | if self.meter_id != other.meter_id: return False |
| 5516 | if self.meters != other.meters: return False |
| 5517 | return True |
| 5518 | |
| 5519 | def __ne__(self, other): |
| 5520 | return not self.__eq__(other) |
| 5521 | |
| 5522 | def __str__(self): |
| 5523 | return self.show() |
| 5524 | |
| 5525 | def show(self): |
| 5526 | import loxi.pp |
| 5527 | return loxi.pp.pp(self) |
| 5528 | |
| 5529 | def pretty_print(self, q): |
| 5530 | q.text("meter_mod {") |
| 5531 | with q.group(): |
| 5532 | with q.indent(2): |
| 5533 | q.breakable() |
| 5534 | q.text("xid = "); |
| 5535 | if self.xid != None: |
| 5536 | q.text("%#x" % self.xid) |
| 5537 | else: |
| 5538 | q.text('None') |
| 5539 | q.text(","); q.breakable() |
| 5540 | q.text("command = "); |
| 5541 | q.text("%#x" % self.command) |
| 5542 | q.text(","); q.breakable() |
| 5543 | q.text("flags = "); |
| 5544 | q.text("%#x" % self.flags) |
| 5545 | q.text(","); q.breakable() |
| 5546 | q.text("meter_id = "); |
| 5547 | q.text("%#x" % self.meter_id) |
| 5548 | q.text(","); q.breakable() |
| 5549 | q.text("meters = "); |
| 5550 | q.pp(self.meters) |
| 5551 | q.breakable() |
| 5552 | q.text('}') |
| 5553 | |
| 5554 | class meter_stats_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5555 | version = 4 |
| 5556 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5557 | stats_type = 9 |
| 5558 | |
| 5559 | def __init__(self, xid=None, flags=None, entries=None): |
| 5560 | self.xid = xid |
| 5561 | if flags != None: |
| 5562 | self.flags = flags |
| 5563 | else: |
| 5564 | self.flags = 0 |
| 5565 | if entries != None: |
| 5566 | self.entries = entries |
| 5567 | else: |
| 5568 | self.entries = [] |
| 5569 | |
| 5570 | def pack(self): |
| 5571 | packed = [] |
| 5572 | packed.append(struct.pack("!B", self.version)) |
| 5573 | packed.append(struct.pack("!B", self.type)) |
| 5574 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5575 | packed.append(struct.pack("!L", self.xid)) |
| 5576 | packed.append(struct.pack("!H", self.stats_type)) |
| 5577 | packed.append(struct.pack("!H", self.flags)) |
| 5578 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5579 | packed.append(util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5580 | length = sum([len(x) for x in packed]) |
| 5581 | packed[2] = struct.pack("!H", length) |
| 5582 | return ''.join(packed) |
| 5583 | |
| 5584 | @staticmethod |
| 5585 | def unpack(buf): |
| 5586 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 5587 | obj = meter_stats_reply() |
| 5588 | if type(buf) == loxi.generic_util.OFReader: |
| 5589 | reader = buf |
| 5590 | else: |
| 5591 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5592 | _version = reader.read("!B")[0] |
| 5593 | assert(_version == 4) |
| 5594 | _type = reader.read("!B")[0] |
| 5595 | assert(_type == 19) |
| 5596 | _length = reader.read("!H")[0] |
| 5597 | obj.xid = reader.read("!L")[0] |
| 5598 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5599 | assert(_stats_type == 9) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5600 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5601 | reader.skip(4) |
| 5602 | obj.entries = common.unpack_list_meter_stats(reader) |
| 5603 | return obj |
| 5604 | |
| 5605 | def __eq__(self, other): |
| 5606 | if type(self) != type(other): return False |
| 5607 | if self.version != other.version: return False |
| 5608 | if self.type != other.type: return False |
| 5609 | if self.xid != other.xid: return False |
| 5610 | if self.flags != other.flags: return False |
| 5611 | if self.entries != other.entries: return False |
| 5612 | return True |
| 5613 | |
| 5614 | def __ne__(self, other): |
| 5615 | return not self.__eq__(other) |
| 5616 | |
| 5617 | def __str__(self): |
| 5618 | return self.show() |
| 5619 | |
| 5620 | def show(self): |
| 5621 | import loxi.pp |
| 5622 | return loxi.pp.pp(self) |
| 5623 | |
| 5624 | def pretty_print(self, q): |
| 5625 | q.text("meter_stats_reply {") |
| 5626 | with q.group(): |
| 5627 | with q.indent(2): |
| 5628 | q.breakable() |
| 5629 | q.text("xid = "); |
| 5630 | if self.xid != None: |
| 5631 | q.text("%#x" % self.xid) |
| 5632 | else: |
| 5633 | q.text('None') |
| 5634 | q.text(","); q.breakable() |
| 5635 | q.text("flags = "); |
| 5636 | q.text("%#x" % self.flags) |
| 5637 | q.text(","); q.breakable() |
| 5638 | q.text("entries = "); |
| 5639 | q.pp(self.entries) |
| 5640 | q.breakable() |
| 5641 | q.text('}') |
| 5642 | |
| 5643 | class meter_stats_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5644 | version = 4 |
| 5645 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5646 | stats_type = 9 |
| 5647 | |
| 5648 | def __init__(self, xid=None, flags=None, meter_id=None): |
| 5649 | self.xid = xid |
| 5650 | if flags != None: |
| 5651 | self.flags = flags |
| 5652 | else: |
| 5653 | self.flags = 0 |
| 5654 | if meter_id != None: |
| 5655 | self.meter_id = meter_id |
| 5656 | else: |
| 5657 | self.meter_id = 0 |
| 5658 | |
| 5659 | def pack(self): |
| 5660 | packed = [] |
| 5661 | packed.append(struct.pack("!B", self.version)) |
| 5662 | packed.append(struct.pack("!B", self.type)) |
| 5663 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5664 | packed.append(struct.pack("!L", self.xid)) |
| 5665 | packed.append(struct.pack("!H", self.stats_type)) |
| 5666 | packed.append(struct.pack("!H", self.flags)) |
| 5667 | packed.append('\x00' * 4) |
| 5668 | packed.append(struct.pack("!L", self.meter_id)) |
| 5669 | packed.append('\x00' * 4) |
| 5670 | length = sum([len(x) for x in packed]) |
| 5671 | packed[2] = struct.pack("!H", length) |
| 5672 | return ''.join(packed) |
| 5673 | |
| 5674 | @staticmethod |
| 5675 | def unpack(buf): |
| 5676 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 5677 | obj = meter_stats_request() |
| 5678 | if type(buf) == loxi.generic_util.OFReader: |
| 5679 | reader = buf |
| 5680 | else: |
| 5681 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5682 | _version = reader.read("!B")[0] |
| 5683 | assert(_version == 4) |
| 5684 | _type = reader.read("!B")[0] |
| 5685 | assert(_type == 18) |
| 5686 | _length = reader.read("!H")[0] |
| 5687 | obj.xid = reader.read("!L")[0] |
| 5688 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5689 | assert(_stats_type == 9) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5690 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5691 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5692 | obj.meter_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5693 | reader.skip(4) |
| 5694 | return obj |
| 5695 | |
| 5696 | def __eq__(self, other): |
| 5697 | if type(self) != type(other): return False |
| 5698 | if self.version != other.version: return False |
| 5699 | if self.type != other.type: return False |
| 5700 | if self.xid != other.xid: return False |
| 5701 | if self.flags != other.flags: return False |
| 5702 | if self.meter_id != other.meter_id: return False |
| 5703 | return True |
| 5704 | |
| 5705 | def __ne__(self, other): |
| 5706 | return not self.__eq__(other) |
| 5707 | |
| 5708 | def __str__(self): |
| 5709 | return self.show() |
| 5710 | |
| 5711 | def show(self): |
| 5712 | import loxi.pp |
| 5713 | return loxi.pp.pp(self) |
| 5714 | |
| 5715 | def pretty_print(self, q): |
| 5716 | q.text("meter_stats_request {") |
| 5717 | with q.group(): |
| 5718 | with q.indent(2): |
| 5719 | q.breakable() |
| 5720 | q.text("xid = "); |
| 5721 | if self.xid != None: |
| 5722 | q.text("%#x" % self.xid) |
| 5723 | else: |
| 5724 | q.text('None') |
| 5725 | q.text(","); q.breakable() |
| 5726 | q.text("flags = "); |
| 5727 | q.text("%#x" % self.flags) |
| 5728 | q.text(","); q.breakable() |
| 5729 | q.text("meter_id = "); |
| 5730 | q.text("%#x" % self.meter_id) |
| 5731 | q.breakable() |
| 5732 | q.text('}') |
| 5733 | |
| 5734 | class packet_in(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5735 | version = 4 |
| 5736 | type = 10 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5737 | |
| 5738 | def __init__(self, xid=None, buffer_id=None, total_len=None, reason=None, table_id=None, cookie=None, match=None, data=None): |
| 5739 | self.xid = xid |
| 5740 | if buffer_id != None: |
| 5741 | self.buffer_id = buffer_id |
| 5742 | else: |
| 5743 | self.buffer_id = 0 |
| 5744 | if total_len != None: |
| 5745 | self.total_len = total_len |
| 5746 | else: |
| 5747 | self.total_len = 0 |
| 5748 | if reason != None: |
| 5749 | self.reason = reason |
| 5750 | else: |
| 5751 | self.reason = 0 |
| 5752 | if table_id != None: |
| 5753 | self.table_id = table_id |
| 5754 | else: |
| 5755 | self.table_id = 0 |
| 5756 | if cookie != None: |
| 5757 | self.cookie = cookie |
| 5758 | else: |
| 5759 | self.cookie = 0 |
| 5760 | if match != None: |
| 5761 | self.match = match |
| 5762 | else: |
| 5763 | self.match = common.match() |
| 5764 | if data != None: |
| 5765 | self.data = data |
| 5766 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5767 | self.data = '' |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5768 | |
| 5769 | def pack(self): |
| 5770 | packed = [] |
| 5771 | packed.append(struct.pack("!B", self.version)) |
| 5772 | packed.append(struct.pack("!B", self.type)) |
| 5773 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5774 | packed.append(struct.pack("!L", self.xid)) |
| 5775 | packed.append(struct.pack("!L", self.buffer_id)) |
| 5776 | packed.append(struct.pack("!H", self.total_len)) |
| 5777 | packed.append(struct.pack("!B", self.reason)) |
| 5778 | packed.append(struct.pack("!B", self.table_id)) |
| 5779 | packed.append(struct.pack("!Q", self.cookie)) |
| 5780 | packed.append(self.match.pack()) |
| 5781 | packed.append('\x00' * 2) |
| 5782 | packed.append(self.data) |
| 5783 | length = sum([len(x) for x in packed]) |
| 5784 | packed[2] = struct.pack("!H", length) |
| 5785 | return ''.join(packed) |
| 5786 | |
| 5787 | @staticmethod |
| 5788 | def unpack(buf): |
| 5789 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 5790 | obj = packet_in() |
| 5791 | if type(buf) == loxi.generic_util.OFReader: |
| 5792 | reader = buf |
| 5793 | else: |
| 5794 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5795 | _version = reader.read("!B")[0] |
| 5796 | assert(_version == 4) |
| 5797 | _type = reader.read("!B")[0] |
| 5798 | assert(_type == 10) |
| 5799 | _length = reader.read("!H")[0] |
| 5800 | obj.xid = reader.read("!L")[0] |
| 5801 | obj.buffer_id = reader.read("!L")[0] |
| 5802 | obj.total_len = reader.read("!H")[0] |
| 5803 | obj.reason = reader.read("!B")[0] |
| 5804 | obj.table_id = reader.read("!B")[0] |
| 5805 | obj.cookie = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5806 | obj.match = common.match.unpack(reader) |
| 5807 | reader.skip(2) |
| 5808 | obj.data = str(reader.read_all()) |
| 5809 | return obj |
| 5810 | |
| 5811 | def __eq__(self, other): |
| 5812 | if type(self) != type(other): return False |
| 5813 | if self.version != other.version: return False |
| 5814 | if self.type != other.type: return False |
| 5815 | if self.xid != other.xid: return False |
| 5816 | if self.buffer_id != other.buffer_id: return False |
| 5817 | if self.total_len != other.total_len: return False |
| 5818 | if self.reason != other.reason: return False |
| 5819 | if self.table_id != other.table_id: return False |
| 5820 | if self.cookie != other.cookie: return False |
| 5821 | if self.match != other.match: return False |
| 5822 | if self.data != other.data: return False |
| 5823 | return True |
| 5824 | |
| 5825 | def __ne__(self, other): |
| 5826 | return not self.__eq__(other) |
| 5827 | |
| 5828 | def __str__(self): |
| 5829 | return self.show() |
| 5830 | |
| 5831 | def show(self): |
| 5832 | import loxi.pp |
| 5833 | return loxi.pp.pp(self) |
| 5834 | |
| 5835 | def pretty_print(self, q): |
| 5836 | q.text("packet_in {") |
| 5837 | with q.group(): |
| 5838 | with q.indent(2): |
| 5839 | q.breakable() |
| 5840 | q.text("xid = "); |
| 5841 | if self.xid != None: |
| 5842 | q.text("%#x" % self.xid) |
| 5843 | else: |
| 5844 | q.text('None') |
| 5845 | q.text(","); q.breakable() |
| 5846 | q.text("buffer_id = "); |
| 5847 | q.text("%#x" % self.buffer_id) |
| 5848 | q.text(","); q.breakable() |
| 5849 | q.text("total_len = "); |
| 5850 | q.text("%#x" % self.total_len) |
| 5851 | q.text(","); q.breakable() |
| 5852 | q.text("reason = "); |
| 5853 | q.text("%#x" % self.reason) |
| 5854 | q.text(","); q.breakable() |
| 5855 | q.text("table_id = "); |
| 5856 | q.text("%#x" % self.table_id) |
| 5857 | q.text(","); q.breakable() |
| 5858 | q.text("cookie = "); |
| 5859 | q.text("%#x" % self.cookie) |
| 5860 | q.text(","); q.breakable() |
| 5861 | q.text("match = "); |
| 5862 | q.pp(self.match) |
| 5863 | q.text(","); q.breakable() |
| 5864 | q.text("data = "); |
| 5865 | q.pp(self.data) |
| 5866 | q.breakable() |
| 5867 | q.text('}') |
| 5868 | |
| 5869 | class packet_out(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5870 | version = 4 |
| 5871 | type = 13 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5872 | |
| 5873 | def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None): |
| 5874 | self.xid = xid |
| 5875 | if buffer_id != None: |
| 5876 | self.buffer_id = buffer_id |
| 5877 | else: |
| 5878 | self.buffer_id = 0 |
| 5879 | if in_port != None: |
| 5880 | self.in_port = in_port |
| 5881 | else: |
| 5882 | self.in_port = 0 |
| 5883 | if actions != None: |
| 5884 | self.actions = actions |
| 5885 | else: |
| 5886 | self.actions = [] |
| 5887 | if data != None: |
| 5888 | self.data = data |
| 5889 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5890 | self.data = '' |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5891 | |
| 5892 | def pack(self): |
| 5893 | packed = [] |
| 5894 | packed.append(struct.pack("!B", self.version)) |
| 5895 | packed.append(struct.pack("!B", self.type)) |
| 5896 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5897 | packed.append(struct.pack("!L", self.xid)) |
| 5898 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5899 | packed.append(util.pack_port_no(self.in_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5900 | packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6 |
| 5901 | packed.append('\x00' * 6) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5902 | packed.append(util.pack_list(self.actions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5903 | packed[6] = struct.pack("!H", len(packed[-1])) |
| 5904 | packed.append(self.data) |
| 5905 | length = sum([len(x) for x in packed]) |
| 5906 | packed[2] = struct.pack("!H", length) |
| 5907 | return ''.join(packed) |
| 5908 | |
| 5909 | @staticmethod |
| 5910 | def unpack(buf): |
| 5911 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 5912 | obj = packet_out() |
| 5913 | if type(buf) == loxi.generic_util.OFReader: |
| 5914 | reader = buf |
| 5915 | else: |
| 5916 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5917 | _version = reader.read("!B")[0] |
| 5918 | assert(_version == 4) |
| 5919 | _type = reader.read("!B")[0] |
| 5920 | assert(_type == 13) |
| 5921 | _length = reader.read("!H")[0] |
| 5922 | obj.xid = reader.read("!L")[0] |
| 5923 | obj.buffer_id = reader.read("!L")[0] |
| 5924 | obj.in_port = util.unpack_port_no(reader) |
| 5925 | _actions_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5926 | reader.skip(6) |
| 5927 | obj.actions = action.unpack_list(reader.slice(_actions_len)) |
| 5928 | obj.data = str(reader.read_all()) |
| 5929 | return obj |
| 5930 | |
| 5931 | def __eq__(self, other): |
| 5932 | if type(self) != type(other): return False |
| 5933 | if self.version != other.version: return False |
| 5934 | if self.type != other.type: return False |
| 5935 | if self.xid != other.xid: return False |
| 5936 | if self.buffer_id != other.buffer_id: return False |
| 5937 | if self.in_port != other.in_port: return False |
| 5938 | if self.actions != other.actions: return False |
| 5939 | if self.data != other.data: return False |
| 5940 | return True |
| 5941 | |
| 5942 | def __ne__(self, other): |
| 5943 | return not self.__eq__(other) |
| 5944 | |
| 5945 | def __str__(self): |
| 5946 | return self.show() |
| 5947 | |
| 5948 | def show(self): |
| 5949 | import loxi.pp |
| 5950 | return loxi.pp.pp(self) |
| 5951 | |
| 5952 | def pretty_print(self, q): |
| 5953 | q.text("packet_out {") |
| 5954 | with q.group(): |
| 5955 | with q.indent(2): |
| 5956 | q.breakable() |
| 5957 | q.text("xid = "); |
| 5958 | if self.xid != None: |
| 5959 | q.text("%#x" % self.xid) |
| 5960 | else: |
| 5961 | q.text('None') |
| 5962 | q.text(","); q.breakable() |
| 5963 | q.text("buffer_id = "); |
| 5964 | q.text("%#x" % self.buffer_id) |
| 5965 | q.text(","); q.breakable() |
| 5966 | q.text("in_port = "); |
| 5967 | q.text(util.pretty_port(self.in_port)) |
| 5968 | q.text(","); q.breakable() |
| 5969 | q.text("actions = "); |
| 5970 | q.pp(self.actions) |
| 5971 | q.text(","); q.breakable() |
| 5972 | q.text("data = "); |
| 5973 | q.pp(self.data) |
| 5974 | q.breakable() |
| 5975 | q.text('}') |
| 5976 | |
| 5977 | class port_desc_stats_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5978 | version = 4 |
| 5979 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5980 | stats_type = 13 |
| 5981 | |
| 5982 | def __init__(self, xid=None, flags=None, entries=None): |
| 5983 | self.xid = xid |
| 5984 | if flags != None: |
| 5985 | self.flags = flags |
| 5986 | else: |
| 5987 | self.flags = 0 |
| 5988 | if entries != None: |
| 5989 | self.entries = entries |
| 5990 | else: |
| 5991 | self.entries = [] |
| 5992 | |
| 5993 | def pack(self): |
| 5994 | packed = [] |
| 5995 | packed.append(struct.pack("!B", self.version)) |
| 5996 | packed.append(struct.pack("!B", self.type)) |
| 5997 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5998 | packed.append(struct.pack("!L", self.xid)) |
| 5999 | packed.append(struct.pack("!H", self.stats_type)) |
| 6000 | packed.append(struct.pack("!H", self.flags)) |
| 6001 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6002 | packed.append(util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6003 | length = sum([len(x) for x in packed]) |
| 6004 | packed[2] = struct.pack("!H", length) |
| 6005 | return ''.join(packed) |
| 6006 | |
| 6007 | @staticmethod |
| 6008 | def unpack(buf): |
| 6009 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 6010 | obj = port_desc_stats_reply() |
| 6011 | if type(buf) == loxi.generic_util.OFReader: |
| 6012 | reader = buf |
| 6013 | else: |
| 6014 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6015 | _version = reader.read("!B")[0] |
| 6016 | assert(_version == 4) |
| 6017 | _type = reader.read("!B")[0] |
| 6018 | assert(_type == 19) |
| 6019 | _length = reader.read("!H")[0] |
| 6020 | obj.xid = reader.read("!L")[0] |
| 6021 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6022 | assert(_stats_type == 13) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6023 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6024 | reader.skip(4) |
| 6025 | obj.entries = loxi.generic_util.unpack_list(reader, common.port_desc.unpack) |
| 6026 | return obj |
| 6027 | |
| 6028 | def __eq__(self, other): |
| 6029 | if type(self) != type(other): return False |
| 6030 | if self.version != other.version: return False |
| 6031 | if self.type != other.type: return False |
| 6032 | if self.xid != other.xid: return False |
| 6033 | if self.flags != other.flags: return False |
| 6034 | if self.entries != other.entries: return False |
| 6035 | return True |
| 6036 | |
| 6037 | def __ne__(self, other): |
| 6038 | return not self.__eq__(other) |
| 6039 | |
| 6040 | def __str__(self): |
| 6041 | return self.show() |
| 6042 | |
| 6043 | def show(self): |
| 6044 | import loxi.pp |
| 6045 | return loxi.pp.pp(self) |
| 6046 | |
| 6047 | def pretty_print(self, q): |
| 6048 | q.text("port_desc_stats_reply {") |
| 6049 | with q.group(): |
| 6050 | with q.indent(2): |
| 6051 | q.breakable() |
| 6052 | q.text("xid = "); |
| 6053 | if self.xid != None: |
| 6054 | q.text("%#x" % self.xid) |
| 6055 | else: |
| 6056 | q.text('None') |
| 6057 | q.text(","); q.breakable() |
| 6058 | q.text("flags = "); |
| 6059 | q.text("%#x" % self.flags) |
| 6060 | q.text(","); q.breakable() |
| 6061 | q.text("entries = "); |
| 6062 | q.pp(self.entries) |
| 6063 | q.breakable() |
| 6064 | q.text('}') |
| 6065 | |
| 6066 | class port_desc_stats_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6067 | version = 4 |
| 6068 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6069 | stats_type = 13 |
| 6070 | |
| 6071 | def __init__(self, xid=None, flags=None): |
| 6072 | self.xid = xid |
| 6073 | if flags != None: |
| 6074 | self.flags = flags |
| 6075 | else: |
| 6076 | self.flags = 0 |
| 6077 | |
| 6078 | def pack(self): |
| 6079 | packed = [] |
| 6080 | packed.append(struct.pack("!B", self.version)) |
| 6081 | packed.append(struct.pack("!B", self.type)) |
| 6082 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6083 | packed.append(struct.pack("!L", self.xid)) |
| 6084 | packed.append(struct.pack("!H", self.stats_type)) |
| 6085 | packed.append(struct.pack("!H", self.flags)) |
| 6086 | packed.append('\x00' * 4) |
| 6087 | length = sum([len(x) for x in packed]) |
| 6088 | packed[2] = struct.pack("!H", length) |
| 6089 | return ''.join(packed) |
| 6090 | |
| 6091 | @staticmethod |
| 6092 | def unpack(buf): |
| 6093 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 6094 | obj = port_desc_stats_request() |
| 6095 | if type(buf) == loxi.generic_util.OFReader: |
| 6096 | reader = buf |
| 6097 | else: |
| 6098 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6099 | _version = reader.read("!B")[0] |
| 6100 | assert(_version == 4) |
| 6101 | _type = reader.read("!B")[0] |
| 6102 | assert(_type == 18) |
| 6103 | _length = reader.read("!H")[0] |
| 6104 | obj.xid = reader.read("!L")[0] |
| 6105 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6106 | assert(_stats_type == 13) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6107 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6108 | reader.skip(4) |
| 6109 | return obj |
| 6110 | |
| 6111 | def __eq__(self, other): |
| 6112 | if type(self) != type(other): return False |
| 6113 | if self.version != other.version: return False |
| 6114 | if self.type != other.type: return False |
| 6115 | if self.xid != other.xid: return False |
| 6116 | if self.flags != other.flags: return False |
| 6117 | return True |
| 6118 | |
| 6119 | def __ne__(self, other): |
| 6120 | return not self.__eq__(other) |
| 6121 | |
| 6122 | def __str__(self): |
| 6123 | return self.show() |
| 6124 | |
| 6125 | def show(self): |
| 6126 | import loxi.pp |
| 6127 | return loxi.pp.pp(self) |
| 6128 | |
| 6129 | def pretty_print(self, q): |
| 6130 | q.text("port_desc_stats_request {") |
| 6131 | with q.group(): |
| 6132 | with q.indent(2): |
| 6133 | q.breakable() |
| 6134 | q.text("xid = "); |
| 6135 | if self.xid != None: |
| 6136 | q.text("%#x" % self.xid) |
| 6137 | else: |
| 6138 | q.text('None') |
| 6139 | q.text(","); q.breakable() |
| 6140 | q.text("flags = "); |
| 6141 | q.text("%#x" % self.flags) |
| 6142 | q.breakable() |
| 6143 | q.text('}') |
| 6144 | |
| 6145 | class port_mod(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6146 | version = 4 |
| 6147 | type = 16 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6148 | |
| 6149 | def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, advertise=None): |
| 6150 | self.xid = xid |
| 6151 | if port_no != None: |
| 6152 | self.port_no = port_no |
| 6153 | else: |
| 6154 | self.port_no = 0 |
| 6155 | if hw_addr != None: |
| 6156 | self.hw_addr = hw_addr |
| 6157 | else: |
| 6158 | self.hw_addr = [0,0,0,0,0,0] |
| 6159 | if config != None: |
| 6160 | self.config = config |
| 6161 | else: |
| 6162 | self.config = 0 |
| 6163 | if mask != None: |
| 6164 | self.mask = mask |
| 6165 | else: |
| 6166 | self.mask = 0 |
| 6167 | if advertise != None: |
| 6168 | self.advertise = advertise |
| 6169 | else: |
| 6170 | self.advertise = 0 |
| 6171 | |
| 6172 | def pack(self): |
| 6173 | packed = [] |
| 6174 | packed.append(struct.pack("!B", self.version)) |
| 6175 | packed.append(struct.pack("!B", self.type)) |
| 6176 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6177 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6178 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6179 | packed.append('\x00' * 4) |
| 6180 | packed.append(struct.pack("!6B", *self.hw_addr)) |
| 6181 | packed.append('\x00' * 2) |
| 6182 | packed.append(struct.pack("!L", self.config)) |
| 6183 | packed.append(struct.pack("!L", self.mask)) |
| 6184 | packed.append(struct.pack("!L", self.advertise)) |
| 6185 | packed.append('\x00' * 4) |
| 6186 | length = sum([len(x) for x in packed]) |
| 6187 | packed[2] = struct.pack("!H", length) |
| 6188 | return ''.join(packed) |
| 6189 | |
| 6190 | @staticmethod |
| 6191 | def unpack(buf): |
| 6192 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 6193 | obj = port_mod() |
| 6194 | if type(buf) == loxi.generic_util.OFReader: |
| 6195 | reader = buf |
| 6196 | else: |
| 6197 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6198 | _version = reader.read("!B")[0] |
| 6199 | assert(_version == 4) |
| 6200 | _type = reader.read("!B")[0] |
| 6201 | assert(_type == 16) |
| 6202 | _length = reader.read("!H")[0] |
| 6203 | obj.xid = reader.read("!L")[0] |
| 6204 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6205 | reader.skip(4) |
| 6206 | obj.hw_addr = list(reader.read('!6B')) |
| 6207 | reader.skip(2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6208 | obj.config = reader.read("!L")[0] |
| 6209 | obj.mask = reader.read("!L")[0] |
| 6210 | obj.advertise = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6211 | reader.skip(4) |
| 6212 | return obj |
| 6213 | |
| 6214 | def __eq__(self, other): |
| 6215 | if type(self) != type(other): return False |
| 6216 | if self.version != other.version: return False |
| 6217 | if self.type != other.type: return False |
| 6218 | if self.xid != other.xid: return False |
| 6219 | if self.port_no != other.port_no: return False |
| 6220 | if self.hw_addr != other.hw_addr: return False |
| 6221 | if self.config != other.config: return False |
| 6222 | if self.mask != other.mask: return False |
| 6223 | if self.advertise != other.advertise: return False |
| 6224 | return True |
| 6225 | |
| 6226 | def __ne__(self, other): |
| 6227 | return not self.__eq__(other) |
| 6228 | |
| 6229 | def __str__(self): |
| 6230 | return self.show() |
| 6231 | |
| 6232 | def show(self): |
| 6233 | import loxi.pp |
| 6234 | return loxi.pp.pp(self) |
| 6235 | |
| 6236 | def pretty_print(self, q): |
| 6237 | q.text("port_mod {") |
| 6238 | with q.group(): |
| 6239 | with q.indent(2): |
| 6240 | q.breakable() |
| 6241 | q.text("xid = "); |
| 6242 | if self.xid != None: |
| 6243 | q.text("%#x" % self.xid) |
| 6244 | else: |
| 6245 | q.text('None') |
| 6246 | q.text(","); q.breakable() |
| 6247 | q.text("port_no = "); |
| 6248 | q.text(util.pretty_port(self.port_no)) |
| 6249 | q.text(","); q.breakable() |
| 6250 | q.text("hw_addr = "); |
| 6251 | q.text(util.pretty_mac(self.hw_addr)) |
| 6252 | q.text(","); q.breakable() |
| 6253 | q.text("config = "); |
| 6254 | q.text("%#x" % self.config) |
| 6255 | q.text(","); q.breakable() |
| 6256 | q.text("mask = "); |
| 6257 | q.text("%#x" % self.mask) |
| 6258 | q.text(","); q.breakable() |
| 6259 | q.text("advertise = "); |
| 6260 | q.text("%#x" % self.advertise) |
| 6261 | q.breakable() |
| 6262 | q.text('}') |
| 6263 | |
| 6264 | class port_stats_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6265 | version = 4 |
| 6266 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6267 | stats_type = 4 |
| 6268 | |
| 6269 | def __init__(self, xid=None, flags=None, entries=None): |
| 6270 | self.xid = xid |
| 6271 | if flags != None: |
| 6272 | self.flags = flags |
| 6273 | else: |
| 6274 | self.flags = 0 |
| 6275 | if entries != None: |
| 6276 | self.entries = entries |
| 6277 | else: |
| 6278 | self.entries = [] |
| 6279 | |
| 6280 | def pack(self): |
| 6281 | packed = [] |
| 6282 | packed.append(struct.pack("!B", self.version)) |
| 6283 | packed.append(struct.pack("!B", self.type)) |
| 6284 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6285 | packed.append(struct.pack("!L", self.xid)) |
| 6286 | packed.append(struct.pack("!H", self.stats_type)) |
| 6287 | packed.append(struct.pack("!H", self.flags)) |
| 6288 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6289 | packed.append(util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6290 | length = sum([len(x) for x in packed]) |
| 6291 | packed[2] = struct.pack("!H", length) |
| 6292 | return ''.join(packed) |
| 6293 | |
| 6294 | @staticmethod |
| 6295 | def unpack(buf): |
| 6296 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 6297 | obj = port_stats_reply() |
| 6298 | if type(buf) == loxi.generic_util.OFReader: |
| 6299 | reader = buf |
| 6300 | else: |
| 6301 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6302 | _version = reader.read("!B")[0] |
| 6303 | assert(_version == 4) |
| 6304 | _type = reader.read("!B")[0] |
| 6305 | assert(_type == 19) |
| 6306 | _length = reader.read("!H")[0] |
| 6307 | obj.xid = reader.read("!L")[0] |
| 6308 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6309 | assert(_stats_type == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6310 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6311 | reader.skip(4) |
| 6312 | obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack) |
| 6313 | return obj |
| 6314 | |
| 6315 | def __eq__(self, other): |
| 6316 | if type(self) != type(other): return False |
| 6317 | if self.version != other.version: return False |
| 6318 | if self.type != other.type: return False |
| 6319 | if self.xid != other.xid: return False |
| 6320 | if self.flags != other.flags: return False |
| 6321 | if self.entries != other.entries: return False |
| 6322 | return True |
| 6323 | |
| 6324 | def __ne__(self, other): |
| 6325 | return not self.__eq__(other) |
| 6326 | |
| 6327 | def __str__(self): |
| 6328 | return self.show() |
| 6329 | |
| 6330 | def show(self): |
| 6331 | import loxi.pp |
| 6332 | return loxi.pp.pp(self) |
| 6333 | |
| 6334 | def pretty_print(self, q): |
| 6335 | q.text("port_stats_reply {") |
| 6336 | with q.group(): |
| 6337 | with q.indent(2): |
| 6338 | q.breakable() |
| 6339 | q.text("xid = "); |
| 6340 | if self.xid != None: |
| 6341 | q.text("%#x" % self.xid) |
| 6342 | else: |
| 6343 | q.text('None') |
| 6344 | q.text(","); q.breakable() |
| 6345 | q.text("flags = "); |
| 6346 | q.text("%#x" % self.flags) |
| 6347 | q.text(","); q.breakable() |
| 6348 | q.text("entries = "); |
| 6349 | q.pp(self.entries) |
| 6350 | q.breakable() |
| 6351 | q.text('}') |
| 6352 | |
| 6353 | class port_stats_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6354 | version = 4 |
| 6355 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6356 | stats_type = 4 |
| 6357 | |
| 6358 | def __init__(self, xid=None, flags=None, port_no=None): |
| 6359 | self.xid = xid |
| 6360 | if flags != None: |
| 6361 | self.flags = flags |
| 6362 | else: |
| 6363 | self.flags = 0 |
| 6364 | if port_no != None: |
| 6365 | self.port_no = port_no |
| 6366 | else: |
| 6367 | self.port_no = 0 |
| 6368 | |
| 6369 | def pack(self): |
| 6370 | packed = [] |
| 6371 | packed.append(struct.pack("!B", self.version)) |
| 6372 | packed.append(struct.pack("!B", self.type)) |
| 6373 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6374 | packed.append(struct.pack("!L", self.xid)) |
| 6375 | packed.append(struct.pack("!H", self.stats_type)) |
| 6376 | packed.append(struct.pack("!H", self.flags)) |
| 6377 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6378 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6379 | packed.append('\x00' * 4) |
| 6380 | length = sum([len(x) for x in packed]) |
| 6381 | packed[2] = struct.pack("!H", length) |
| 6382 | return ''.join(packed) |
| 6383 | |
| 6384 | @staticmethod |
| 6385 | def unpack(buf): |
| 6386 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 6387 | obj = port_stats_request() |
| 6388 | if type(buf) == loxi.generic_util.OFReader: |
| 6389 | reader = buf |
| 6390 | else: |
| 6391 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6392 | _version = reader.read("!B")[0] |
| 6393 | assert(_version == 4) |
| 6394 | _type = reader.read("!B")[0] |
| 6395 | assert(_type == 18) |
| 6396 | _length = reader.read("!H")[0] |
| 6397 | obj.xid = reader.read("!L")[0] |
| 6398 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6399 | assert(_stats_type == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6400 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6401 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6402 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6403 | reader.skip(4) |
| 6404 | return obj |
| 6405 | |
| 6406 | def __eq__(self, other): |
| 6407 | if type(self) != type(other): return False |
| 6408 | if self.version != other.version: return False |
| 6409 | if self.type != other.type: return False |
| 6410 | if self.xid != other.xid: return False |
| 6411 | if self.flags != other.flags: return False |
| 6412 | if self.port_no != other.port_no: return False |
| 6413 | return True |
| 6414 | |
| 6415 | def __ne__(self, other): |
| 6416 | return not self.__eq__(other) |
| 6417 | |
| 6418 | def __str__(self): |
| 6419 | return self.show() |
| 6420 | |
| 6421 | def show(self): |
| 6422 | import loxi.pp |
| 6423 | return loxi.pp.pp(self) |
| 6424 | |
| 6425 | def pretty_print(self, q): |
| 6426 | q.text("port_stats_request {") |
| 6427 | with q.group(): |
| 6428 | with q.indent(2): |
| 6429 | q.breakable() |
| 6430 | q.text("xid = "); |
| 6431 | if self.xid != None: |
| 6432 | q.text("%#x" % self.xid) |
| 6433 | else: |
| 6434 | q.text('None') |
| 6435 | q.text(","); q.breakable() |
| 6436 | q.text("flags = "); |
| 6437 | q.text("%#x" % self.flags) |
| 6438 | q.text(","); q.breakable() |
| 6439 | q.text("port_no = "); |
| 6440 | q.text(util.pretty_port(self.port_no)) |
| 6441 | q.breakable() |
| 6442 | q.text('}') |
| 6443 | |
| 6444 | class port_status(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6445 | version = 4 |
| 6446 | type = 12 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6447 | |
| 6448 | def __init__(self, xid=None, reason=None, desc=None): |
| 6449 | self.xid = xid |
| 6450 | if reason != None: |
| 6451 | self.reason = reason |
| 6452 | else: |
| 6453 | self.reason = 0 |
| 6454 | if desc != None: |
| 6455 | self.desc = desc |
| 6456 | else: |
| 6457 | self.desc = common.port_desc() |
| 6458 | |
| 6459 | def pack(self): |
| 6460 | packed = [] |
| 6461 | packed.append(struct.pack("!B", self.version)) |
| 6462 | packed.append(struct.pack("!B", self.type)) |
| 6463 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6464 | packed.append(struct.pack("!L", self.xid)) |
| 6465 | packed.append(struct.pack("!B", self.reason)) |
| 6466 | packed.append('\x00' * 7) |
| 6467 | packed.append(self.desc.pack()) |
| 6468 | length = sum([len(x) for x in packed]) |
| 6469 | packed[2] = struct.pack("!H", length) |
| 6470 | return ''.join(packed) |
| 6471 | |
| 6472 | @staticmethod |
| 6473 | def unpack(buf): |
| 6474 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 6475 | obj = port_status() |
| 6476 | if type(buf) == loxi.generic_util.OFReader: |
| 6477 | reader = buf |
| 6478 | else: |
| 6479 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6480 | _version = reader.read("!B")[0] |
| 6481 | assert(_version == 4) |
| 6482 | _type = reader.read("!B")[0] |
| 6483 | assert(_type == 12) |
| 6484 | _length = reader.read("!H")[0] |
| 6485 | obj.xid = reader.read("!L")[0] |
| 6486 | obj.reason = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6487 | reader.skip(7) |
| 6488 | obj.desc = common.port_desc.unpack(reader) |
| 6489 | return obj |
| 6490 | |
| 6491 | def __eq__(self, other): |
| 6492 | if type(self) != type(other): return False |
| 6493 | if self.version != other.version: return False |
| 6494 | if self.type != other.type: return False |
| 6495 | if self.xid != other.xid: return False |
| 6496 | if self.reason != other.reason: return False |
| 6497 | if self.desc != other.desc: return False |
| 6498 | return True |
| 6499 | |
| 6500 | def __ne__(self, other): |
| 6501 | return not self.__eq__(other) |
| 6502 | |
| 6503 | def __str__(self): |
| 6504 | return self.show() |
| 6505 | |
| 6506 | def show(self): |
| 6507 | import loxi.pp |
| 6508 | return loxi.pp.pp(self) |
| 6509 | |
| 6510 | def pretty_print(self, q): |
| 6511 | q.text("port_status {") |
| 6512 | with q.group(): |
| 6513 | with q.indent(2): |
| 6514 | q.breakable() |
| 6515 | q.text("xid = "); |
| 6516 | if self.xid != None: |
| 6517 | q.text("%#x" % self.xid) |
| 6518 | else: |
| 6519 | q.text('None') |
| 6520 | q.text(","); q.breakable() |
| 6521 | q.text("reason = "); |
| 6522 | q.text("%#x" % self.reason) |
| 6523 | q.text(","); q.breakable() |
| 6524 | q.text("desc = "); |
| 6525 | q.pp(self.desc) |
| 6526 | q.breakable() |
| 6527 | q.text('}') |
| 6528 | |
| 6529 | class queue_get_config_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6530 | version = 4 |
| 6531 | type = 23 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6532 | |
| 6533 | def __init__(self, xid=None, port=None, queues=None): |
| 6534 | self.xid = xid |
| 6535 | if port != None: |
| 6536 | self.port = port |
| 6537 | else: |
| 6538 | self.port = 0 |
| 6539 | if queues != None: |
| 6540 | self.queues = queues |
| 6541 | else: |
| 6542 | self.queues = [] |
| 6543 | |
| 6544 | def pack(self): |
| 6545 | packed = [] |
| 6546 | packed.append(struct.pack("!B", self.version)) |
| 6547 | packed.append(struct.pack("!B", self.type)) |
| 6548 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6549 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6550 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6551 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6552 | packed.append(util.pack_list(self.queues)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6553 | length = sum([len(x) for x in packed]) |
| 6554 | packed[2] = struct.pack("!H", length) |
| 6555 | return ''.join(packed) |
| 6556 | |
| 6557 | @staticmethod |
| 6558 | def unpack(buf): |
| 6559 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 6560 | obj = queue_get_config_reply() |
| 6561 | if type(buf) == loxi.generic_util.OFReader: |
| 6562 | reader = buf |
| 6563 | else: |
| 6564 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6565 | _version = reader.read("!B")[0] |
| 6566 | assert(_version == 4) |
| 6567 | _type = reader.read("!B")[0] |
| 6568 | assert(_type == 23) |
| 6569 | _length = reader.read("!H")[0] |
| 6570 | obj.xid = reader.read("!L")[0] |
| 6571 | obj.port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6572 | reader.skip(4) |
| 6573 | obj.queues = common.unpack_list_packet_queue(reader) |
| 6574 | return obj |
| 6575 | |
| 6576 | def __eq__(self, other): |
| 6577 | if type(self) != type(other): return False |
| 6578 | if self.version != other.version: return False |
| 6579 | if self.type != other.type: return False |
| 6580 | if self.xid != other.xid: return False |
| 6581 | if self.port != other.port: return False |
| 6582 | if self.queues != other.queues: return False |
| 6583 | return True |
| 6584 | |
| 6585 | def __ne__(self, other): |
| 6586 | return not self.__eq__(other) |
| 6587 | |
| 6588 | def __str__(self): |
| 6589 | return self.show() |
| 6590 | |
| 6591 | def show(self): |
| 6592 | import loxi.pp |
| 6593 | return loxi.pp.pp(self) |
| 6594 | |
| 6595 | def pretty_print(self, q): |
| 6596 | q.text("queue_get_config_reply {") |
| 6597 | with q.group(): |
| 6598 | with q.indent(2): |
| 6599 | q.breakable() |
| 6600 | q.text("xid = "); |
| 6601 | if self.xid != None: |
| 6602 | q.text("%#x" % self.xid) |
| 6603 | else: |
| 6604 | q.text('None') |
| 6605 | q.text(","); q.breakable() |
| 6606 | q.text("port = "); |
| 6607 | q.text(util.pretty_port(self.port)) |
| 6608 | q.text(","); q.breakable() |
| 6609 | q.text("queues = "); |
| 6610 | q.pp(self.queues) |
| 6611 | q.breakable() |
| 6612 | q.text('}') |
| 6613 | |
| 6614 | class queue_get_config_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6615 | version = 4 |
| 6616 | type = 22 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6617 | |
| 6618 | def __init__(self, xid=None, port=None): |
| 6619 | self.xid = xid |
| 6620 | if port != None: |
| 6621 | self.port = port |
| 6622 | else: |
| 6623 | self.port = 0 |
| 6624 | |
| 6625 | def pack(self): |
| 6626 | packed = [] |
| 6627 | packed.append(struct.pack("!B", self.version)) |
| 6628 | packed.append(struct.pack("!B", self.type)) |
| 6629 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6630 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6631 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6632 | packed.append('\x00' * 4) |
| 6633 | length = sum([len(x) for x in packed]) |
| 6634 | packed[2] = struct.pack("!H", length) |
| 6635 | return ''.join(packed) |
| 6636 | |
| 6637 | @staticmethod |
| 6638 | def unpack(buf): |
| 6639 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 6640 | obj = queue_get_config_request() |
| 6641 | if type(buf) == loxi.generic_util.OFReader: |
| 6642 | reader = buf |
| 6643 | else: |
| 6644 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6645 | _version = reader.read("!B")[0] |
| 6646 | assert(_version == 4) |
| 6647 | _type = reader.read("!B")[0] |
| 6648 | assert(_type == 22) |
| 6649 | _length = reader.read("!H")[0] |
| 6650 | obj.xid = reader.read("!L")[0] |
| 6651 | obj.port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6652 | reader.skip(4) |
| 6653 | return obj |
| 6654 | |
| 6655 | def __eq__(self, other): |
| 6656 | if type(self) != type(other): return False |
| 6657 | if self.version != other.version: return False |
| 6658 | if self.type != other.type: return False |
| 6659 | if self.xid != other.xid: return False |
| 6660 | if self.port != other.port: return False |
| 6661 | return True |
| 6662 | |
| 6663 | def __ne__(self, other): |
| 6664 | return not self.__eq__(other) |
| 6665 | |
| 6666 | def __str__(self): |
| 6667 | return self.show() |
| 6668 | |
| 6669 | def show(self): |
| 6670 | import loxi.pp |
| 6671 | return loxi.pp.pp(self) |
| 6672 | |
| 6673 | def pretty_print(self, q): |
| 6674 | q.text("queue_get_config_request {") |
| 6675 | with q.group(): |
| 6676 | with q.indent(2): |
| 6677 | q.breakable() |
| 6678 | q.text("xid = "); |
| 6679 | if self.xid != None: |
| 6680 | q.text("%#x" % self.xid) |
| 6681 | else: |
| 6682 | q.text('None') |
| 6683 | q.text(","); q.breakable() |
| 6684 | q.text("port = "); |
| 6685 | q.text(util.pretty_port(self.port)) |
| 6686 | q.breakable() |
| 6687 | q.text('}') |
| 6688 | |
| 6689 | class queue_stats_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6690 | version = 4 |
| 6691 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6692 | stats_type = 5 |
| 6693 | |
| 6694 | def __init__(self, xid=None, flags=None, entries=None): |
| 6695 | self.xid = xid |
| 6696 | if flags != None: |
| 6697 | self.flags = flags |
| 6698 | else: |
| 6699 | self.flags = 0 |
| 6700 | if entries != None: |
| 6701 | self.entries = entries |
| 6702 | else: |
| 6703 | self.entries = [] |
| 6704 | |
| 6705 | def pack(self): |
| 6706 | packed = [] |
| 6707 | packed.append(struct.pack("!B", self.version)) |
| 6708 | packed.append(struct.pack("!B", self.type)) |
| 6709 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6710 | packed.append(struct.pack("!L", self.xid)) |
| 6711 | packed.append(struct.pack("!H", self.stats_type)) |
| 6712 | packed.append(struct.pack("!H", self.flags)) |
| 6713 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6714 | packed.append(util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6715 | length = sum([len(x) for x in packed]) |
| 6716 | packed[2] = struct.pack("!H", length) |
| 6717 | return ''.join(packed) |
| 6718 | |
| 6719 | @staticmethod |
| 6720 | def unpack(buf): |
| 6721 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 6722 | obj = queue_stats_reply() |
| 6723 | if type(buf) == loxi.generic_util.OFReader: |
| 6724 | reader = buf |
| 6725 | else: |
| 6726 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6727 | _version = reader.read("!B")[0] |
| 6728 | assert(_version == 4) |
| 6729 | _type = reader.read("!B")[0] |
| 6730 | assert(_type == 19) |
| 6731 | _length = reader.read("!H")[0] |
| 6732 | obj.xid = reader.read("!L")[0] |
| 6733 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6734 | assert(_stats_type == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6735 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6736 | reader.skip(4) |
| 6737 | obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack) |
| 6738 | return obj |
| 6739 | |
| 6740 | def __eq__(self, other): |
| 6741 | if type(self) != type(other): return False |
| 6742 | if self.version != other.version: return False |
| 6743 | if self.type != other.type: return False |
| 6744 | if self.xid != other.xid: return False |
| 6745 | if self.flags != other.flags: return False |
| 6746 | if self.entries != other.entries: return False |
| 6747 | return True |
| 6748 | |
| 6749 | def __ne__(self, other): |
| 6750 | return not self.__eq__(other) |
| 6751 | |
| 6752 | def __str__(self): |
| 6753 | return self.show() |
| 6754 | |
| 6755 | def show(self): |
| 6756 | import loxi.pp |
| 6757 | return loxi.pp.pp(self) |
| 6758 | |
| 6759 | def pretty_print(self, q): |
| 6760 | q.text("queue_stats_reply {") |
| 6761 | with q.group(): |
| 6762 | with q.indent(2): |
| 6763 | q.breakable() |
| 6764 | q.text("xid = "); |
| 6765 | if self.xid != None: |
| 6766 | q.text("%#x" % self.xid) |
| 6767 | else: |
| 6768 | q.text('None') |
| 6769 | q.text(","); q.breakable() |
| 6770 | q.text("flags = "); |
| 6771 | q.text("%#x" % self.flags) |
| 6772 | q.text(","); q.breakable() |
| 6773 | q.text("entries = "); |
| 6774 | q.pp(self.entries) |
| 6775 | q.breakable() |
| 6776 | q.text('}') |
| 6777 | |
| 6778 | class queue_stats_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6779 | version = 4 |
| 6780 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6781 | stats_type = 5 |
| 6782 | |
| 6783 | def __init__(self, xid=None, flags=None, port_no=None, queue_id=None): |
| 6784 | self.xid = xid |
| 6785 | if flags != None: |
| 6786 | self.flags = flags |
| 6787 | else: |
| 6788 | self.flags = 0 |
| 6789 | if port_no != None: |
| 6790 | self.port_no = port_no |
| 6791 | else: |
| 6792 | self.port_no = 0 |
| 6793 | if queue_id != None: |
| 6794 | self.queue_id = queue_id |
| 6795 | else: |
| 6796 | self.queue_id = 0 |
| 6797 | |
| 6798 | def pack(self): |
| 6799 | packed = [] |
| 6800 | packed.append(struct.pack("!B", self.version)) |
| 6801 | packed.append(struct.pack("!B", self.type)) |
| 6802 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6803 | packed.append(struct.pack("!L", self.xid)) |
| 6804 | packed.append(struct.pack("!H", self.stats_type)) |
| 6805 | packed.append(struct.pack("!H", self.flags)) |
| 6806 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6807 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6808 | packed.append(struct.pack("!L", self.queue_id)) |
| 6809 | length = sum([len(x) for x in packed]) |
| 6810 | packed[2] = struct.pack("!H", length) |
| 6811 | return ''.join(packed) |
| 6812 | |
| 6813 | @staticmethod |
| 6814 | def unpack(buf): |
| 6815 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 6816 | obj = queue_stats_request() |
| 6817 | if type(buf) == loxi.generic_util.OFReader: |
| 6818 | reader = buf |
| 6819 | else: |
| 6820 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6821 | _version = reader.read("!B")[0] |
| 6822 | assert(_version == 4) |
| 6823 | _type = reader.read("!B")[0] |
| 6824 | assert(_type == 18) |
| 6825 | _length = reader.read("!H")[0] |
| 6826 | obj.xid = reader.read("!L")[0] |
| 6827 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6828 | assert(_stats_type == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6829 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6830 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6831 | obj.port_no = util.unpack_port_no(reader) |
| 6832 | obj.queue_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6833 | return obj |
| 6834 | |
| 6835 | def __eq__(self, other): |
| 6836 | if type(self) != type(other): return False |
| 6837 | if self.version != other.version: return False |
| 6838 | if self.type != other.type: return False |
| 6839 | if self.xid != other.xid: return False |
| 6840 | if self.flags != other.flags: return False |
| 6841 | if self.port_no != other.port_no: return False |
| 6842 | if self.queue_id != other.queue_id: return False |
| 6843 | return True |
| 6844 | |
| 6845 | def __ne__(self, other): |
| 6846 | return not self.__eq__(other) |
| 6847 | |
| 6848 | def __str__(self): |
| 6849 | return self.show() |
| 6850 | |
| 6851 | def show(self): |
| 6852 | import loxi.pp |
| 6853 | return loxi.pp.pp(self) |
| 6854 | |
| 6855 | def pretty_print(self, q): |
| 6856 | q.text("queue_stats_request {") |
| 6857 | with q.group(): |
| 6858 | with q.indent(2): |
| 6859 | q.breakable() |
| 6860 | q.text("xid = "); |
| 6861 | if self.xid != None: |
| 6862 | q.text("%#x" % self.xid) |
| 6863 | else: |
| 6864 | q.text('None') |
| 6865 | q.text(","); q.breakable() |
| 6866 | q.text("flags = "); |
| 6867 | q.text("%#x" % self.flags) |
| 6868 | q.text(","); q.breakable() |
| 6869 | q.text("port_no = "); |
| 6870 | q.text(util.pretty_port(self.port_no)) |
| 6871 | q.text(","); q.breakable() |
| 6872 | q.text("queue_id = "); |
| 6873 | q.text("%#x" % self.queue_id) |
| 6874 | q.breakable() |
| 6875 | q.text('}') |
| 6876 | |
| 6877 | class role_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6878 | version = 4 |
| 6879 | type = 25 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6880 | |
| 6881 | def __init__(self, xid=None, data=None): |
| 6882 | self.xid = xid |
| 6883 | if data != None: |
| 6884 | self.data = data |
| 6885 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6886 | self.data = '' |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6887 | |
| 6888 | def pack(self): |
| 6889 | packed = [] |
| 6890 | packed.append(struct.pack("!B", self.version)) |
| 6891 | packed.append(struct.pack("!B", self.type)) |
| 6892 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6893 | packed.append(struct.pack("!L", self.xid)) |
| 6894 | packed.append(self.data) |
| 6895 | length = sum([len(x) for x in packed]) |
| 6896 | packed[2] = struct.pack("!H", length) |
| 6897 | return ''.join(packed) |
| 6898 | |
| 6899 | @staticmethod |
| 6900 | def unpack(buf): |
| 6901 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 6902 | obj = role_reply() |
| 6903 | if type(buf) == loxi.generic_util.OFReader: |
| 6904 | reader = buf |
| 6905 | else: |
| 6906 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6907 | _version = reader.read("!B")[0] |
| 6908 | assert(_version == 4) |
| 6909 | _type = reader.read("!B")[0] |
| 6910 | assert(_type == 25) |
| 6911 | _length = reader.read("!H")[0] |
| 6912 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6913 | obj.data = str(reader.read_all()) |
| 6914 | return obj |
| 6915 | |
| 6916 | def __eq__(self, other): |
| 6917 | if type(self) != type(other): return False |
| 6918 | if self.version != other.version: return False |
| 6919 | if self.type != other.type: return False |
| 6920 | if self.xid != other.xid: return False |
| 6921 | if self.data != other.data: return False |
| 6922 | return True |
| 6923 | |
| 6924 | def __ne__(self, other): |
| 6925 | return not self.__eq__(other) |
| 6926 | |
| 6927 | def __str__(self): |
| 6928 | return self.show() |
| 6929 | |
| 6930 | def show(self): |
| 6931 | import loxi.pp |
| 6932 | return loxi.pp.pp(self) |
| 6933 | |
| 6934 | def pretty_print(self, q): |
| 6935 | q.text("role_reply {") |
| 6936 | with q.group(): |
| 6937 | with q.indent(2): |
| 6938 | q.breakable() |
| 6939 | q.text("xid = "); |
| 6940 | if self.xid != None: |
| 6941 | q.text("%#x" % self.xid) |
| 6942 | else: |
| 6943 | q.text('None') |
| 6944 | q.text(","); q.breakable() |
| 6945 | q.text("data = "); |
| 6946 | q.pp(self.data) |
| 6947 | q.breakable() |
| 6948 | q.text('}') |
| 6949 | |
| 6950 | class role_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6951 | version = 4 |
| 6952 | type = 24 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6953 | |
| 6954 | def __init__(self, xid=None, role=None, generation_id=None): |
| 6955 | self.xid = xid |
| 6956 | if role != None: |
| 6957 | self.role = role |
| 6958 | else: |
| 6959 | self.role = 0 |
| 6960 | if generation_id != None: |
| 6961 | self.generation_id = generation_id |
| 6962 | else: |
| 6963 | self.generation_id = 0 |
| 6964 | |
| 6965 | def pack(self): |
| 6966 | packed = [] |
| 6967 | packed.append(struct.pack("!B", self.version)) |
| 6968 | packed.append(struct.pack("!B", self.type)) |
| 6969 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6970 | packed.append(struct.pack("!L", self.xid)) |
| 6971 | packed.append(struct.pack("!L", self.role)) |
| 6972 | packed.append('\x00' * 4) |
| 6973 | packed.append(struct.pack("!Q", self.generation_id)) |
| 6974 | length = sum([len(x) for x in packed]) |
| 6975 | packed[2] = struct.pack("!H", length) |
| 6976 | return ''.join(packed) |
| 6977 | |
| 6978 | @staticmethod |
| 6979 | def unpack(buf): |
| 6980 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 6981 | obj = role_request() |
| 6982 | if type(buf) == loxi.generic_util.OFReader: |
| 6983 | reader = buf |
| 6984 | else: |
| 6985 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6986 | _version = reader.read("!B")[0] |
| 6987 | assert(_version == 4) |
| 6988 | _type = reader.read("!B")[0] |
| 6989 | assert(_type == 24) |
| 6990 | _length = reader.read("!H")[0] |
| 6991 | obj.xid = reader.read("!L")[0] |
| 6992 | obj.role = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6993 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6994 | obj.generation_id = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6995 | return obj |
| 6996 | |
| 6997 | def __eq__(self, other): |
| 6998 | if type(self) != type(other): return False |
| 6999 | if self.version != other.version: return False |
| 7000 | if self.type != other.type: return False |
| 7001 | if self.xid != other.xid: return False |
| 7002 | if self.role != other.role: return False |
| 7003 | if self.generation_id != other.generation_id: return False |
| 7004 | return True |
| 7005 | |
| 7006 | def __ne__(self, other): |
| 7007 | return not self.__eq__(other) |
| 7008 | |
| 7009 | def __str__(self): |
| 7010 | return self.show() |
| 7011 | |
| 7012 | def show(self): |
| 7013 | import loxi.pp |
| 7014 | return loxi.pp.pp(self) |
| 7015 | |
| 7016 | def pretty_print(self, q): |
| 7017 | q.text("role_request {") |
| 7018 | with q.group(): |
| 7019 | with q.indent(2): |
| 7020 | q.breakable() |
| 7021 | q.text("xid = "); |
| 7022 | if self.xid != None: |
| 7023 | q.text("%#x" % self.xid) |
| 7024 | else: |
| 7025 | q.text('None') |
| 7026 | q.text(","); q.breakable() |
| 7027 | q.text("role = "); |
| 7028 | q.text("%#x" % self.role) |
| 7029 | q.text(","); q.breakable() |
| 7030 | q.text("generation_id = "); |
| 7031 | q.text("%#x" % self.generation_id) |
| 7032 | q.breakable() |
| 7033 | q.text('}') |
| 7034 | |
| 7035 | class set_config(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7036 | version = 4 |
| 7037 | type = 9 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7038 | |
| 7039 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
| 7040 | self.xid = xid |
| 7041 | if flags != None: |
| 7042 | self.flags = flags |
| 7043 | else: |
| 7044 | self.flags = 0 |
| 7045 | if miss_send_len != None: |
| 7046 | self.miss_send_len = miss_send_len |
| 7047 | else: |
| 7048 | self.miss_send_len = 0 |
| 7049 | |
| 7050 | def pack(self): |
| 7051 | packed = [] |
| 7052 | packed.append(struct.pack("!B", self.version)) |
| 7053 | packed.append(struct.pack("!B", self.type)) |
| 7054 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7055 | packed.append(struct.pack("!L", self.xid)) |
| 7056 | packed.append(struct.pack("!H", self.flags)) |
| 7057 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 7058 | length = sum([len(x) for x in packed]) |
| 7059 | packed[2] = struct.pack("!H", length) |
| 7060 | return ''.join(packed) |
| 7061 | |
| 7062 | @staticmethod |
| 7063 | def unpack(buf): |
| 7064 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 7065 | obj = set_config() |
| 7066 | if type(buf) == loxi.generic_util.OFReader: |
| 7067 | reader = buf |
| 7068 | else: |
| 7069 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7070 | _version = reader.read("!B")[0] |
| 7071 | assert(_version == 4) |
| 7072 | _type = reader.read("!B")[0] |
| 7073 | assert(_type == 9) |
| 7074 | _length = reader.read("!H")[0] |
| 7075 | obj.xid = reader.read("!L")[0] |
| 7076 | obj.flags = reader.read("!H")[0] |
| 7077 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7078 | return obj |
| 7079 | |
| 7080 | def __eq__(self, other): |
| 7081 | if type(self) != type(other): return False |
| 7082 | if self.version != other.version: return False |
| 7083 | if self.type != other.type: return False |
| 7084 | if self.xid != other.xid: return False |
| 7085 | if self.flags != other.flags: return False |
| 7086 | if self.miss_send_len != other.miss_send_len: return False |
| 7087 | return True |
| 7088 | |
| 7089 | def __ne__(self, other): |
| 7090 | return not self.__eq__(other) |
| 7091 | |
| 7092 | def __str__(self): |
| 7093 | return self.show() |
| 7094 | |
| 7095 | def show(self): |
| 7096 | import loxi.pp |
| 7097 | return loxi.pp.pp(self) |
| 7098 | |
| 7099 | def pretty_print(self, q): |
| 7100 | q.text("set_config {") |
| 7101 | with q.group(): |
| 7102 | with q.indent(2): |
| 7103 | q.breakable() |
| 7104 | q.text("xid = "); |
| 7105 | if self.xid != None: |
| 7106 | q.text("%#x" % self.xid) |
| 7107 | else: |
| 7108 | q.text('None') |
| 7109 | q.text(","); q.breakable() |
| 7110 | q.text("flags = "); |
| 7111 | q.text("%#x" % self.flags) |
| 7112 | q.text(","); q.breakable() |
| 7113 | q.text("miss_send_len = "); |
| 7114 | q.text("%#x" % self.miss_send_len) |
| 7115 | q.breakable() |
| 7116 | q.text('}') |
| 7117 | |
| 7118 | class table_features_stats_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7119 | version = 4 |
| 7120 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7121 | stats_type = 12 |
| 7122 | |
| 7123 | def __init__(self, xid=None, flags=None, entries=None): |
| 7124 | self.xid = xid |
| 7125 | if flags != None: |
| 7126 | self.flags = flags |
| 7127 | else: |
| 7128 | self.flags = 0 |
| 7129 | if entries != None: |
| 7130 | self.entries = entries |
| 7131 | else: |
| 7132 | self.entries = [] |
| 7133 | |
| 7134 | def pack(self): |
| 7135 | packed = [] |
| 7136 | packed.append(struct.pack("!B", self.version)) |
| 7137 | packed.append(struct.pack("!B", self.type)) |
| 7138 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7139 | packed.append(struct.pack("!L", self.xid)) |
| 7140 | packed.append(struct.pack("!H", self.stats_type)) |
| 7141 | packed.append(struct.pack("!H", self.flags)) |
| 7142 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7143 | packed.append(util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7144 | length = sum([len(x) for x in packed]) |
| 7145 | packed[2] = struct.pack("!H", length) |
| 7146 | return ''.join(packed) |
| 7147 | |
| 7148 | @staticmethod |
| 7149 | def unpack(buf): |
| 7150 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 7151 | obj = table_features_stats_reply() |
| 7152 | if type(buf) == loxi.generic_util.OFReader: |
| 7153 | reader = buf |
| 7154 | else: |
| 7155 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7156 | _version = reader.read("!B")[0] |
| 7157 | assert(_version == 4) |
| 7158 | _type = reader.read("!B")[0] |
| 7159 | assert(_type == 19) |
| 7160 | _length = reader.read("!H")[0] |
| 7161 | obj.xid = reader.read("!L")[0] |
| 7162 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7163 | assert(_stats_type == 12) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7164 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7165 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7166 | obj.entries = loxi.unimplemented('unpack list(of_table_features_t)') |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7167 | return obj |
| 7168 | |
| 7169 | def __eq__(self, other): |
| 7170 | if type(self) != type(other): return False |
| 7171 | if self.version != other.version: return False |
| 7172 | if self.type != other.type: return False |
| 7173 | if self.xid != other.xid: return False |
| 7174 | if self.flags != other.flags: return False |
| 7175 | if self.entries != other.entries: return False |
| 7176 | return True |
| 7177 | |
| 7178 | def __ne__(self, other): |
| 7179 | return not self.__eq__(other) |
| 7180 | |
| 7181 | def __str__(self): |
| 7182 | return self.show() |
| 7183 | |
| 7184 | def show(self): |
| 7185 | import loxi.pp |
| 7186 | return loxi.pp.pp(self) |
| 7187 | |
| 7188 | def pretty_print(self, q): |
| 7189 | q.text("table_features_stats_reply {") |
| 7190 | with q.group(): |
| 7191 | with q.indent(2): |
| 7192 | q.breakable() |
| 7193 | q.text("xid = "); |
| 7194 | if self.xid != None: |
| 7195 | q.text("%#x" % self.xid) |
| 7196 | else: |
| 7197 | q.text('None') |
| 7198 | q.text(","); q.breakable() |
| 7199 | q.text("flags = "); |
| 7200 | q.text("%#x" % self.flags) |
| 7201 | q.text(","); q.breakable() |
| 7202 | q.text("entries = "); |
| 7203 | q.pp(self.entries) |
| 7204 | q.breakable() |
| 7205 | q.text('}') |
| 7206 | |
| 7207 | class table_features_stats_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7208 | version = 4 |
| 7209 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7210 | stats_type = 12 |
| 7211 | |
| 7212 | def __init__(self, xid=None, flags=None, entries=None): |
| 7213 | self.xid = xid |
| 7214 | if flags != None: |
| 7215 | self.flags = flags |
| 7216 | else: |
| 7217 | self.flags = 0 |
| 7218 | if entries != None: |
| 7219 | self.entries = entries |
| 7220 | else: |
| 7221 | self.entries = [] |
| 7222 | |
| 7223 | def pack(self): |
| 7224 | packed = [] |
| 7225 | packed.append(struct.pack("!B", self.version)) |
| 7226 | packed.append(struct.pack("!B", self.type)) |
| 7227 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7228 | packed.append(struct.pack("!L", self.xid)) |
| 7229 | packed.append(struct.pack("!H", self.stats_type)) |
| 7230 | packed.append(struct.pack("!H", self.flags)) |
| 7231 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7232 | packed.append(util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7233 | length = sum([len(x) for x in packed]) |
| 7234 | packed[2] = struct.pack("!H", length) |
| 7235 | return ''.join(packed) |
| 7236 | |
| 7237 | @staticmethod |
| 7238 | def unpack(buf): |
| 7239 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 7240 | obj = table_features_stats_request() |
| 7241 | if type(buf) == loxi.generic_util.OFReader: |
| 7242 | reader = buf |
| 7243 | else: |
| 7244 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7245 | _version = reader.read("!B")[0] |
| 7246 | assert(_version == 4) |
| 7247 | _type = reader.read("!B")[0] |
| 7248 | assert(_type == 18) |
| 7249 | _length = reader.read("!H")[0] |
| 7250 | obj.xid = reader.read("!L")[0] |
| 7251 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7252 | assert(_stats_type == 12) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7253 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7254 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7255 | obj.entries = loxi.unimplemented('unpack list(of_table_features_t)') |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7256 | return obj |
| 7257 | |
| 7258 | def __eq__(self, other): |
| 7259 | if type(self) != type(other): return False |
| 7260 | if self.version != other.version: return False |
| 7261 | if self.type != other.type: return False |
| 7262 | if self.xid != other.xid: return False |
| 7263 | if self.flags != other.flags: return False |
| 7264 | if self.entries != other.entries: return False |
| 7265 | return True |
| 7266 | |
| 7267 | def __ne__(self, other): |
| 7268 | return not self.__eq__(other) |
| 7269 | |
| 7270 | def __str__(self): |
| 7271 | return self.show() |
| 7272 | |
| 7273 | def show(self): |
| 7274 | import loxi.pp |
| 7275 | return loxi.pp.pp(self) |
| 7276 | |
| 7277 | def pretty_print(self, q): |
| 7278 | q.text("table_features_stats_request {") |
| 7279 | with q.group(): |
| 7280 | with q.indent(2): |
| 7281 | q.breakable() |
| 7282 | q.text("xid = "); |
| 7283 | if self.xid != None: |
| 7284 | q.text("%#x" % self.xid) |
| 7285 | else: |
| 7286 | q.text('None') |
| 7287 | q.text(","); q.breakable() |
| 7288 | q.text("flags = "); |
| 7289 | q.text("%#x" % self.flags) |
| 7290 | q.text(","); q.breakable() |
| 7291 | q.text("entries = "); |
| 7292 | q.pp(self.entries) |
| 7293 | q.breakable() |
| 7294 | q.text('}') |
| 7295 | |
| 7296 | class table_mod(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7297 | version = 4 |
| 7298 | type = 17 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7299 | |
| 7300 | def __init__(self, xid=None, table_id=None, config=None): |
| 7301 | self.xid = xid |
| 7302 | if table_id != None: |
| 7303 | self.table_id = table_id |
| 7304 | else: |
| 7305 | self.table_id = 0 |
| 7306 | if config != None: |
| 7307 | self.config = config |
| 7308 | else: |
| 7309 | self.config = 0 |
| 7310 | |
| 7311 | def pack(self): |
| 7312 | packed = [] |
| 7313 | packed.append(struct.pack("!B", self.version)) |
| 7314 | packed.append(struct.pack("!B", self.type)) |
| 7315 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7316 | packed.append(struct.pack("!L", self.xid)) |
| 7317 | packed.append(struct.pack("!B", self.table_id)) |
| 7318 | packed.append('\x00' * 3) |
| 7319 | packed.append(struct.pack("!L", self.config)) |
| 7320 | length = sum([len(x) for x in packed]) |
| 7321 | packed[2] = struct.pack("!H", length) |
| 7322 | return ''.join(packed) |
| 7323 | |
| 7324 | @staticmethod |
| 7325 | def unpack(buf): |
| 7326 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 7327 | obj = table_mod() |
| 7328 | if type(buf) == loxi.generic_util.OFReader: |
| 7329 | reader = buf |
| 7330 | else: |
| 7331 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7332 | _version = reader.read("!B")[0] |
| 7333 | assert(_version == 4) |
| 7334 | _type = reader.read("!B")[0] |
| 7335 | assert(_type == 17) |
| 7336 | _length = reader.read("!H")[0] |
| 7337 | obj.xid = reader.read("!L")[0] |
| 7338 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7339 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7340 | obj.config = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7341 | return obj |
| 7342 | |
| 7343 | def __eq__(self, other): |
| 7344 | if type(self) != type(other): return False |
| 7345 | if self.version != other.version: return False |
| 7346 | if self.type != other.type: return False |
| 7347 | if self.xid != other.xid: return False |
| 7348 | if self.table_id != other.table_id: return False |
| 7349 | if self.config != other.config: return False |
| 7350 | return True |
| 7351 | |
| 7352 | def __ne__(self, other): |
| 7353 | return not self.__eq__(other) |
| 7354 | |
| 7355 | def __str__(self): |
| 7356 | return self.show() |
| 7357 | |
| 7358 | def show(self): |
| 7359 | import loxi.pp |
| 7360 | return loxi.pp.pp(self) |
| 7361 | |
| 7362 | def pretty_print(self, q): |
| 7363 | q.text("table_mod {") |
| 7364 | with q.group(): |
| 7365 | with q.indent(2): |
| 7366 | q.breakable() |
| 7367 | q.text("xid = "); |
| 7368 | if self.xid != None: |
| 7369 | q.text("%#x" % self.xid) |
| 7370 | else: |
| 7371 | q.text('None') |
| 7372 | q.text(","); q.breakable() |
| 7373 | q.text("table_id = "); |
| 7374 | q.text("%#x" % self.table_id) |
| 7375 | q.text(","); q.breakable() |
| 7376 | q.text("config = "); |
| 7377 | q.text("%#x" % self.config) |
| 7378 | q.breakable() |
| 7379 | q.text('}') |
| 7380 | |
| 7381 | class table_stats_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7382 | version = 4 |
| 7383 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7384 | stats_type = 3 |
| 7385 | |
| 7386 | def __init__(self, xid=None, flags=None, entries=None): |
| 7387 | self.xid = xid |
| 7388 | if flags != None: |
| 7389 | self.flags = flags |
| 7390 | else: |
| 7391 | self.flags = 0 |
| 7392 | if entries != None: |
| 7393 | self.entries = entries |
| 7394 | else: |
| 7395 | self.entries = [] |
| 7396 | |
| 7397 | def pack(self): |
| 7398 | packed = [] |
| 7399 | packed.append(struct.pack("!B", self.version)) |
| 7400 | packed.append(struct.pack("!B", self.type)) |
| 7401 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7402 | packed.append(struct.pack("!L", self.xid)) |
| 7403 | packed.append(struct.pack("!H", self.stats_type)) |
| 7404 | packed.append(struct.pack("!H", self.flags)) |
| 7405 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7406 | packed.append(util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7407 | length = sum([len(x) for x in packed]) |
| 7408 | packed[2] = struct.pack("!H", length) |
| 7409 | return ''.join(packed) |
| 7410 | |
| 7411 | @staticmethod |
| 7412 | def unpack(buf): |
| 7413 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 7414 | obj = table_stats_reply() |
| 7415 | if type(buf) == loxi.generic_util.OFReader: |
| 7416 | reader = buf |
| 7417 | else: |
| 7418 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7419 | _version = reader.read("!B")[0] |
| 7420 | assert(_version == 4) |
| 7421 | _type = reader.read("!B")[0] |
| 7422 | assert(_type == 19) |
| 7423 | _length = reader.read("!H")[0] |
| 7424 | obj.xid = reader.read("!L")[0] |
| 7425 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7426 | assert(_stats_type == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7427 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7428 | reader.skip(4) |
| 7429 | obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack) |
| 7430 | return obj |
| 7431 | |
| 7432 | def __eq__(self, other): |
| 7433 | if type(self) != type(other): return False |
| 7434 | if self.version != other.version: return False |
| 7435 | if self.type != other.type: return False |
| 7436 | if self.xid != other.xid: return False |
| 7437 | if self.flags != other.flags: return False |
| 7438 | if self.entries != other.entries: return False |
| 7439 | return True |
| 7440 | |
| 7441 | def __ne__(self, other): |
| 7442 | return not self.__eq__(other) |
| 7443 | |
| 7444 | def __str__(self): |
| 7445 | return self.show() |
| 7446 | |
| 7447 | def show(self): |
| 7448 | import loxi.pp |
| 7449 | return loxi.pp.pp(self) |
| 7450 | |
| 7451 | def pretty_print(self, q): |
| 7452 | q.text("table_stats_reply {") |
| 7453 | with q.group(): |
| 7454 | with q.indent(2): |
| 7455 | q.breakable() |
| 7456 | q.text("xid = "); |
| 7457 | if self.xid != None: |
| 7458 | q.text("%#x" % self.xid) |
| 7459 | else: |
| 7460 | q.text('None') |
| 7461 | q.text(","); q.breakable() |
| 7462 | q.text("flags = "); |
| 7463 | q.text("%#x" % self.flags) |
| 7464 | q.text(","); q.breakable() |
| 7465 | q.text("entries = "); |
| 7466 | q.pp(self.entries) |
| 7467 | q.breakable() |
| 7468 | q.text('}') |
| 7469 | |
| 7470 | class table_stats_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7471 | version = 4 |
| 7472 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7473 | stats_type = 3 |
| 7474 | |
| 7475 | def __init__(self, xid=None, flags=None): |
| 7476 | self.xid = xid |
| 7477 | if flags != None: |
| 7478 | self.flags = flags |
| 7479 | else: |
| 7480 | self.flags = 0 |
| 7481 | |
| 7482 | def pack(self): |
| 7483 | packed = [] |
| 7484 | packed.append(struct.pack("!B", self.version)) |
| 7485 | packed.append(struct.pack("!B", self.type)) |
| 7486 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7487 | packed.append(struct.pack("!L", self.xid)) |
| 7488 | packed.append(struct.pack("!H", self.stats_type)) |
| 7489 | packed.append(struct.pack("!H", self.flags)) |
| 7490 | packed.append('\x00' * 4) |
| 7491 | length = sum([len(x) for x in packed]) |
| 7492 | packed[2] = struct.pack("!H", length) |
| 7493 | return ''.join(packed) |
| 7494 | |
| 7495 | @staticmethod |
| 7496 | def unpack(buf): |
| 7497 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 7498 | obj = table_stats_request() |
| 7499 | if type(buf) == loxi.generic_util.OFReader: |
| 7500 | reader = buf |
| 7501 | else: |
| 7502 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7503 | _version = reader.read("!B")[0] |
| 7504 | assert(_version == 4) |
| 7505 | _type = reader.read("!B")[0] |
| 7506 | assert(_type == 18) |
| 7507 | _length = reader.read("!H")[0] |
| 7508 | obj.xid = reader.read("!L")[0] |
| 7509 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7510 | assert(_stats_type == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7511 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7512 | reader.skip(4) |
| 7513 | return obj |
| 7514 | |
| 7515 | def __eq__(self, other): |
| 7516 | if type(self) != type(other): return False |
| 7517 | if self.version != other.version: return False |
| 7518 | if self.type != other.type: return False |
| 7519 | if self.xid != other.xid: return False |
| 7520 | if self.flags != other.flags: return False |
| 7521 | return True |
| 7522 | |
| 7523 | def __ne__(self, other): |
| 7524 | return not self.__eq__(other) |
| 7525 | |
| 7526 | def __str__(self): |
| 7527 | return self.show() |
| 7528 | |
| 7529 | def show(self): |
| 7530 | import loxi.pp |
| 7531 | return loxi.pp.pp(self) |
| 7532 | |
| 7533 | def pretty_print(self, q): |
| 7534 | q.text("table_stats_request {") |
| 7535 | with q.group(): |
| 7536 | with q.indent(2): |
| 7537 | q.breakable() |
| 7538 | q.text("xid = "); |
| 7539 | if self.xid != None: |
| 7540 | q.text("%#x" % self.xid) |
| 7541 | else: |
| 7542 | q.text('None') |
| 7543 | q.text(","); q.breakable() |
| 7544 | q.text("flags = "); |
| 7545 | q.text("%#x" % self.flags) |
| 7546 | q.breakable() |
| 7547 | q.text('}') |
| 7548 | |
| 7549 | |
| 7550 | def parse_header(buf): |
| 7551 | if len(buf) < 8: |
| 7552 | raise loxi.ProtocolError("too short to be an OpenFlow message") |
| 7553 | return struct.unpack_from("!BBHL", buf) |
| 7554 | |
| 7555 | def parse_message(buf): |
| 7556 | msg_ver, msg_type, msg_len, msg_xid = parse_header(buf) |
Rich Lane | fe600f5 | 2013-07-09 13:22:32 -0700 | [diff] [blame] | 7557 | if msg_ver != const.OFP_VERSION and msg_type != const.OFPT_HELLO: |
| 7558 | raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (const.OFP_VERSION, msg_ver)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7559 | if len(buf) != msg_len: |
| 7560 | raise loxi.ProtocolError("incorrect message size") |
| 7561 | if msg_type in parsers: |
| 7562 | return parsers[msg_type](buf) |
| 7563 | else: |
| 7564 | raise loxi.ProtocolError("unexpected message type") |
| 7565 | |
| 7566 | def parse_flow_mod(buf): |
Rich Lane | fe600f5 | 2013-07-09 13:22:32 -0700 | [diff] [blame] | 7567 | if len(buf) < 25 + 1: |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7568 | raise loxi.ProtocolError("message too short") |
Rich Lane | fe600f5 | 2013-07-09 13:22:32 -0700 | [diff] [blame] | 7569 | # Technically uint16_t for OF 1.0 |
| 7570 | cmd, = struct.unpack_from("!B", buf, 25) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7571 | if cmd in flow_mod_parsers: |
| 7572 | return flow_mod_parsers[cmd](buf) |
| 7573 | else: |
| 7574 | raise loxi.ProtocolError("unexpected flow mod cmd %u" % cmd) |
| 7575 | |
| 7576 | def parse_multipart_reply(buf): |
| 7577 | if len(buf) < 8 + 2: |
| 7578 | raise loxi.ProtocolError("message too short") |
| 7579 | multipart_type, = struct.unpack_from("!H", buf, 8) |
| 7580 | if multipart_type in multipart_reply_parsers: |
| 7581 | return multipart_reply_parsers[multipart_type](buf) |
| 7582 | else: |
| 7583 | raise loxi.ProtocolError("unexpected multipart type %u" % multipart_type) |
| 7584 | |
| 7585 | def parse_multipart_request(buf): |
| 7586 | if len(buf) < 8 + 2: |
| 7587 | raise loxi.ProtocolError("message too short") |
| 7588 | multipart_type, = struct.unpack_from("!H", buf, 8) |
| 7589 | if multipart_type in multipart_request_parsers: |
| 7590 | return multipart_request_parsers[multipart_type](buf) |
| 7591 | else: |
| 7592 | raise loxi.ProtocolError("unexpected multipart type %u" % multipart_type) |
| 7593 | |
| 7594 | def parse_experimenter(buf): |
| 7595 | if len(buf) < 16: |
| 7596 | raise loxi.ProtocolError("experimenter message too short") |
| 7597 | |
| 7598 | experimenter, = struct.unpack_from("!L", buf, 8) |
| 7599 | if experimenter == 0x005c16c7: # Big Switch Networks |
| 7600 | subtype, = struct.unpack_from("!L", buf, 12) |
| 7601 | elif experimenter == 0x00002320: # Nicira |
| 7602 | subtype, = struct.unpack_from("!L", buf, 12) |
| 7603 | else: |
| 7604 | raise loxi.ProtocolError("unexpected experimenter id %#x" % experimenter) |
| 7605 | |
| 7606 | if subtype in experimenter_parsers[experimenter]: |
| 7607 | return experimenter_parsers[experimenter][subtype](buf) |
| 7608 | else: |
| 7609 | raise loxi.ProtocolError("unexpected experimenter %#x subtype %#x" % (experimenter, subtype)) |
| 7610 | |
| 7611 | parsers = { |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7612 | const.OFPT_HELLO : hello.unpack, |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7613 | const.OFPT_ERROR : error_msg.unpack, |
| 7614 | const.OFPT_ECHO_REQUEST : echo_request.unpack, |
| 7615 | const.OFPT_ECHO_REPLY : echo_reply.unpack, |
| 7616 | const.OFPT_EXPERIMENTER : parse_experimenter, |
| 7617 | const.OFPT_FEATURES_REQUEST : features_request.unpack, |
| 7618 | const.OFPT_FEATURES_REPLY : features_reply.unpack, |
| 7619 | const.OFPT_GET_CONFIG_REQUEST : get_config_request.unpack, |
| 7620 | const.OFPT_GET_CONFIG_REPLY : get_config_reply.unpack, |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7621 | const.OFPT_SET_CONFIG : set_config.unpack, |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7622 | const.OFPT_PACKET_IN : packet_in.unpack, |
| 7623 | const.OFPT_FLOW_REMOVED : flow_removed.unpack, |
| 7624 | const.OFPT_PORT_STATUS : port_status.unpack, |
| 7625 | const.OFPT_PACKET_OUT : packet_out.unpack, |
| 7626 | const.OFPT_FLOW_MOD : parse_flow_mod, |
| 7627 | const.OFPT_GROUP_MOD : group_mod.unpack, |
| 7628 | const.OFPT_PORT_MOD : port_mod.unpack, |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7629 | const.OFPT_TABLE_MOD : table_mod.unpack, |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7630 | const.OFPT_MULTIPART_REQUEST : parse_multipart_request, |
| 7631 | const.OFPT_MULTIPART_REPLY : parse_multipart_reply, |
| 7632 | const.OFPT_BARRIER_REQUEST : barrier_request.unpack, |
| 7633 | const.OFPT_BARRIER_REPLY : barrier_reply.unpack, |
| 7634 | const.OFPT_QUEUE_GET_CONFIG_REQUEST : queue_get_config_request.unpack, |
| 7635 | const.OFPT_QUEUE_GET_CONFIG_REPLY : queue_get_config_reply.unpack, |
| 7636 | const.OFPT_ROLE_REQUEST : role_request.unpack, |
| 7637 | const.OFPT_ROLE_REPLY : role_reply.unpack, |
| 7638 | const.OFPT_GET_ASYNC_REQUEST : async_get_request.unpack, |
| 7639 | const.OFPT_GET_ASYNC_REPLY : async_get_reply.unpack, |
| 7640 | const.OFPT_SET_ASYNC : async_set.unpack, |
| 7641 | const.OFPT_METER_MOD : meter_mod.unpack, |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7642 | } |
| 7643 | |
| 7644 | flow_mod_parsers = { |
| 7645 | const.OFPFC_ADD : flow_add.unpack, |
| 7646 | const.OFPFC_MODIFY : flow_modify.unpack, |
| 7647 | const.OFPFC_MODIFY_STRICT : flow_modify_strict.unpack, |
| 7648 | const.OFPFC_DELETE : flow_delete.unpack, |
| 7649 | const.OFPFC_DELETE_STRICT : flow_delete_strict.unpack, |
| 7650 | } |
| 7651 | |
Rich Lane | fe600f5 | 2013-07-09 13:22:32 -0700 | [diff] [blame] | 7652 | multipart_reply_parsers = { |
| 7653 | const.OFPMP_DESC : desc_stats_reply.unpack, |
| 7654 | const.OFPMP_FLOW : flow_stats_reply.unpack, |
| 7655 | const.OFPMP_AGGREGATE : aggregate_stats_reply.unpack, |
| 7656 | const.OFPMP_TABLE : table_stats_reply.unpack, |
| 7657 | const.OFPMP_PORT_STATS : port_stats_reply.unpack, |
| 7658 | const.OFPMP_QUEUE : queue_stats_reply.unpack, |
| 7659 | const.OFPMP_GROUP : group_stats_reply.unpack, |
| 7660 | const.OFPMP_GROUP_DESC : group_desc_stats_reply.unpack, |
| 7661 | const.OFPMP_GROUP_FEATURES : group_features_stats_reply.unpack, |
| 7662 | const.OFPMP_METER : meter_stats_reply.unpack, |
| 7663 | const.OFPMP_METER_CONFIG : meter_config_stats_reply.unpack, |
| 7664 | const.OFPMP_METER_FEATURES : meter_features_stats_reply.unpack, |
| 7665 | const.OFPMP_TABLE_FEATURES : table_features_stats_reply.unpack, |
| 7666 | const.OFPMP_PORT_DESC : port_desc_stats_reply.unpack, |
| 7667 | } |
| 7668 | |
| 7669 | multipart_request_parsers = { |
| 7670 | const.OFPMP_DESC : desc_stats_request.unpack, |
| 7671 | const.OFPMP_FLOW : flow_stats_request.unpack, |
| 7672 | const.OFPMP_AGGREGATE : aggregate_stats_request.unpack, |
| 7673 | const.OFPMP_TABLE : table_stats_request.unpack, |
| 7674 | const.OFPMP_PORT_STATS : port_stats_request.unpack, |
| 7675 | const.OFPMP_QUEUE : queue_stats_request.unpack, |
| 7676 | const.OFPMP_GROUP : group_stats_request.unpack, |
| 7677 | const.OFPMP_GROUP_DESC : group_desc_stats_request.unpack, |
| 7678 | const.OFPMP_GROUP_FEATURES : group_features_stats_request.unpack, |
| 7679 | const.OFPMP_METER : meter_stats_request.unpack, |
| 7680 | const.OFPMP_METER_CONFIG : meter_config_stats_request.unpack, |
| 7681 | const.OFPMP_METER_FEATURES : meter_features_stats_request.unpack, |
| 7682 | const.OFPMP_TABLE_FEATURES : table_features_stats_request.unpack, |
| 7683 | const.OFPMP_PORT_DESC : port_desc_stats_request.unpack, |
| 7684 | } |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7685 | |
| 7686 | experimenter_parsers = { |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7687 | 6035143 : { |
| 7688 | 22: bsn_bw_clear_data_reply.unpack, |
| 7689 | 21: bsn_bw_clear_data_request.unpack, |
| 7690 | 20: bsn_bw_enable_get_reply.unpack, |
| 7691 | 19: bsn_bw_enable_get_request.unpack, |
| 7692 | 23: bsn_bw_enable_set_reply.unpack, |
| 7693 | 18: bsn_bw_enable_set_request.unpack, |
| 7694 | 10: bsn_get_interfaces_reply.unpack, |
| 7695 | 9: bsn_get_interfaces_request.unpack, |
| 7696 | 5: bsn_get_mirroring_reply.unpack, |
| 7697 | 4: bsn_get_mirroring_request.unpack, |
| 7698 | 3: bsn_set_mirroring.unpack, |
| 7699 | 25: bsn_set_pktin_suppression_reply.unpack, |
| 7700 | 11: bsn_set_pktin_suppression_request.unpack, |
| 7701 | 16: bsn_virtual_port_create_reply.unpack, |
| 7702 | 15: bsn_virtual_port_create_request.unpack, |
| 7703 | 26: bsn_virtual_port_remove_reply.unpack, |
| 7704 | 17: bsn_virtual_port_remove_request.unpack, |
| 7705 | }, |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7706 | } |