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 util |
| 16 | import loxi.generic_util |
| 17 | |
| 18 | class Message(object): |
| 19 | version = const.OFP_VERSION |
| 20 | type = None # override in subclass |
| 21 | xid = None |
| 22 | |
| 23 | class aggregate_stats_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 24 | version = 3 |
| 25 | type = 19 |
| 26 | stats_type = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 27 | |
| 28 | def __init__(self, xid=None, flags=None, packet_count=None, byte_count=None, flow_count=None): |
| 29 | self.xid = xid |
| 30 | if flags != None: |
| 31 | self.flags = flags |
| 32 | else: |
| 33 | self.flags = 0 |
| 34 | if packet_count != None: |
| 35 | self.packet_count = packet_count |
| 36 | else: |
| 37 | self.packet_count = 0 |
| 38 | if byte_count != None: |
| 39 | self.byte_count = byte_count |
| 40 | else: |
| 41 | self.byte_count = 0 |
| 42 | if flow_count != None: |
| 43 | self.flow_count = flow_count |
| 44 | else: |
| 45 | self.flow_count = 0 |
| 46 | |
| 47 | def pack(self): |
| 48 | packed = [] |
| 49 | packed.append(struct.pack("!B", self.version)) |
| 50 | packed.append(struct.pack("!B", self.type)) |
| 51 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 52 | packed.append(struct.pack("!L", self.xid)) |
| 53 | packed.append(struct.pack("!H", self.stats_type)) |
| 54 | packed.append(struct.pack("!H", self.flags)) |
| 55 | packed.append('\x00' * 4) |
| 56 | packed.append(struct.pack("!Q", self.packet_count)) |
| 57 | packed.append(struct.pack("!Q", self.byte_count)) |
| 58 | packed.append(struct.pack("!L", self.flow_count)) |
| 59 | packed.append('\x00' * 4) |
| 60 | length = sum([len(x) for x in packed]) |
| 61 | packed[2] = struct.pack("!H", length) |
| 62 | return ''.join(packed) |
| 63 | |
| 64 | @staticmethod |
| 65 | def unpack(buf): |
| 66 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 67 | obj = aggregate_stats_reply() |
| 68 | if type(buf) == loxi.generic_util.OFReader: |
| 69 | reader = buf |
| 70 | else: |
| 71 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 72 | _version = reader.read("!B")[0] |
| 73 | assert(_version == 3) |
| 74 | _type = reader.read("!B")[0] |
| 75 | assert(_type == 19) |
| 76 | _length = reader.read("!H")[0] |
| 77 | obj.xid = reader.read("!L")[0] |
| 78 | _stats_type = reader.read("!H")[0] |
| 79 | assert(_stats_type == 2) |
| 80 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 81 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 82 | obj.packet_count = reader.read("!Q")[0] |
| 83 | obj.byte_count = reader.read("!Q")[0] |
| 84 | obj.flow_count = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 85 | reader.skip(4) |
| 86 | return obj |
| 87 | |
| 88 | def __eq__(self, other): |
| 89 | if type(self) != type(other): return False |
| 90 | if self.version != other.version: return False |
| 91 | if self.type != other.type: return False |
| 92 | if self.xid != other.xid: return False |
| 93 | if self.flags != other.flags: return False |
| 94 | if self.packet_count != other.packet_count: return False |
| 95 | if self.byte_count != other.byte_count: return False |
| 96 | if self.flow_count != other.flow_count: return False |
| 97 | return True |
| 98 | |
| 99 | def __ne__(self, other): |
| 100 | return not self.__eq__(other) |
| 101 | |
| 102 | def __str__(self): |
| 103 | return self.show() |
| 104 | |
| 105 | def show(self): |
| 106 | import loxi.pp |
| 107 | return loxi.pp.pp(self) |
| 108 | |
| 109 | def pretty_print(self, q): |
| 110 | q.text("aggregate_stats_reply {") |
| 111 | with q.group(): |
| 112 | with q.indent(2): |
| 113 | q.breakable() |
| 114 | q.text("xid = "); |
| 115 | if self.xid != None: |
| 116 | q.text("%#x" % self.xid) |
| 117 | else: |
| 118 | q.text('None') |
| 119 | q.text(","); q.breakable() |
| 120 | q.text("flags = "); |
| 121 | q.text("%#x" % self.flags) |
| 122 | q.text(","); q.breakable() |
| 123 | q.text("packet_count = "); |
| 124 | q.text("%#x" % self.packet_count) |
| 125 | q.text(","); q.breakable() |
| 126 | q.text("byte_count = "); |
| 127 | q.text("%#x" % self.byte_count) |
| 128 | q.text(","); q.breakable() |
| 129 | q.text("flow_count = "); |
| 130 | q.text("%#x" % self.flow_count) |
| 131 | q.breakable() |
| 132 | q.text('}') |
| 133 | |
| 134 | class aggregate_stats_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 135 | version = 3 |
| 136 | type = 18 |
| 137 | stats_type = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 138 | |
| 139 | def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None): |
| 140 | self.xid = xid |
| 141 | if flags != None: |
| 142 | self.flags = flags |
| 143 | else: |
| 144 | self.flags = 0 |
| 145 | if table_id != None: |
| 146 | self.table_id = table_id |
| 147 | else: |
| 148 | self.table_id = 0 |
| 149 | if out_port != None: |
| 150 | self.out_port = out_port |
| 151 | else: |
| 152 | self.out_port = 0 |
| 153 | if out_group != None: |
| 154 | self.out_group = out_group |
| 155 | else: |
| 156 | self.out_group = 0 |
| 157 | if cookie != None: |
| 158 | self.cookie = cookie |
| 159 | else: |
| 160 | self.cookie = 0 |
| 161 | if cookie_mask != None: |
| 162 | self.cookie_mask = cookie_mask |
| 163 | else: |
| 164 | self.cookie_mask = 0 |
| 165 | if match != None: |
| 166 | self.match = match |
| 167 | else: |
| 168 | self.match = common.match() |
| 169 | |
| 170 | def pack(self): |
| 171 | packed = [] |
| 172 | packed.append(struct.pack("!B", self.version)) |
| 173 | packed.append(struct.pack("!B", self.type)) |
| 174 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 175 | packed.append(struct.pack("!L", self.xid)) |
| 176 | packed.append(struct.pack("!H", self.stats_type)) |
| 177 | packed.append(struct.pack("!H", self.flags)) |
| 178 | packed.append('\x00' * 4) |
| 179 | packed.append(struct.pack("!B", self.table_id)) |
| 180 | packed.append('\x00' * 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 181 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 182 | packed.append(struct.pack("!L", self.out_group)) |
| 183 | packed.append('\x00' * 4) |
| 184 | packed.append(struct.pack("!Q", self.cookie)) |
| 185 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 186 | packed.append(self.match.pack()) |
| 187 | length = sum([len(x) for x in packed]) |
| 188 | packed[2] = struct.pack("!H", length) |
| 189 | return ''.join(packed) |
| 190 | |
| 191 | @staticmethod |
| 192 | def unpack(buf): |
| 193 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 194 | obj = aggregate_stats_request() |
| 195 | if type(buf) == loxi.generic_util.OFReader: |
| 196 | reader = buf |
| 197 | else: |
| 198 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 199 | _version = reader.read("!B")[0] |
| 200 | assert(_version == 3) |
| 201 | _type = reader.read("!B")[0] |
| 202 | assert(_type == 18) |
| 203 | _length = reader.read("!H")[0] |
| 204 | obj.xid = reader.read("!L")[0] |
| 205 | _stats_type = reader.read("!H")[0] |
| 206 | assert(_stats_type == 2) |
| 207 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 208 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 209 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 210 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 211 | obj.out_port = util.unpack_port_no(reader) |
| 212 | obj.out_group = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 213 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 214 | obj.cookie = reader.read("!Q")[0] |
| 215 | obj.cookie_mask = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 216 | obj.match = common.match.unpack(reader) |
| 217 | return obj |
| 218 | |
| 219 | def __eq__(self, other): |
| 220 | if type(self) != type(other): return False |
| 221 | if self.version != other.version: return False |
| 222 | if self.type != other.type: return False |
| 223 | if self.xid != other.xid: return False |
| 224 | if self.flags != other.flags: return False |
| 225 | if self.table_id != other.table_id: return False |
| 226 | if self.out_port != other.out_port: return False |
| 227 | if self.out_group != other.out_group: return False |
| 228 | if self.cookie != other.cookie: return False |
| 229 | if self.cookie_mask != other.cookie_mask: return False |
| 230 | if self.match != other.match: return False |
| 231 | return True |
| 232 | |
| 233 | def __ne__(self, other): |
| 234 | return not self.__eq__(other) |
| 235 | |
| 236 | def __str__(self): |
| 237 | return self.show() |
| 238 | |
| 239 | def show(self): |
| 240 | import loxi.pp |
| 241 | return loxi.pp.pp(self) |
| 242 | |
| 243 | def pretty_print(self, q): |
| 244 | q.text("aggregate_stats_request {") |
| 245 | with q.group(): |
| 246 | with q.indent(2): |
| 247 | q.breakable() |
| 248 | q.text("xid = "); |
| 249 | if self.xid != None: |
| 250 | q.text("%#x" % self.xid) |
| 251 | else: |
| 252 | q.text('None') |
| 253 | q.text(","); q.breakable() |
| 254 | q.text("flags = "); |
| 255 | q.text("%#x" % self.flags) |
| 256 | q.text(","); q.breakable() |
| 257 | q.text("table_id = "); |
| 258 | q.text("%#x" % self.table_id) |
| 259 | q.text(","); q.breakable() |
| 260 | q.text("out_port = "); |
| 261 | q.text(util.pretty_port(self.out_port)) |
| 262 | q.text(","); q.breakable() |
| 263 | q.text("out_group = "); |
| 264 | q.text("%#x" % self.out_group) |
| 265 | q.text(","); q.breakable() |
| 266 | q.text("cookie = "); |
| 267 | q.text("%#x" % self.cookie) |
| 268 | q.text(","); q.breakable() |
| 269 | q.text("cookie_mask = "); |
| 270 | q.text("%#x" % self.cookie_mask) |
| 271 | q.text(","); q.breakable() |
| 272 | q.text("match = "); |
| 273 | q.pp(self.match) |
| 274 | q.breakable() |
| 275 | q.text('}') |
| 276 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 277 | class bad_action_error_msg(Message): |
| 278 | version = 3 |
| 279 | type = 1 |
| 280 | err_type = 2 |
| 281 | |
| 282 | def __init__(self, xid=None, code=None, data=None): |
| 283 | self.xid = xid |
| 284 | if code != None: |
| 285 | self.code = code |
| 286 | else: |
| 287 | self.code = 0 |
| 288 | if data != None: |
| 289 | self.data = data |
| 290 | else: |
| 291 | self.data = '' |
| 292 | |
| 293 | def pack(self): |
| 294 | packed = [] |
| 295 | packed.append(struct.pack("!B", self.version)) |
| 296 | packed.append(struct.pack("!B", self.type)) |
| 297 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 298 | packed.append(struct.pack("!L", self.xid)) |
| 299 | packed.append(struct.pack("!H", self.err_type)) |
| 300 | packed.append(struct.pack("!H", self.code)) |
| 301 | packed.append(self.data) |
| 302 | length = sum([len(x) for x in packed]) |
| 303 | packed[2] = struct.pack("!H", length) |
| 304 | return ''.join(packed) |
| 305 | |
| 306 | @staticmethod |
| 307 | def unpack(buf): |
| 308 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 309 | obj = bad_action_error_msg() |
| 310 | if type(buf) == loxi.generic_util.OFReader: |
| 311 | reader = buf |
| 312 | else: |
| 313 | reader = loxi.generic_util.OFReader(buf) |
| 314 | _version = reader.read("!B")[0] |
| 315 | assert(_version == 3) |
| 316 | _type = reader.read("!B")[0] |
| 317 | assert(_type == 1) |
| 318 | _length = reader.read("!H")[0] |
| 319 | obj.xid = reader.read("!L")[0] |
| 320 | _err_type = reader.read("!H")[0] |
| 321 | assert(_err_type == 2) |
| 322 | obj.code = reader.read("!H")[0] |
| 323 | obj.data = str(reader.read_all()) |
| 324 | return obj |
| 325 | |
| 326 | def __eq__(self, other): |
| 327 | if type(self) != type(other): return False |
| 328 | if self.version != other.version: return False |
| 329 | if self.type != other.type: return False |
| 330 | if self.xid != other.xid: return False |
| 331 | if self.code != other.code: return False |
| 332 | if self.data != other.data: return False |
| 333 | return True |
| 334 | |
| 335 | def __ne__(self, other): |
| 336 | return not self.__eq__(other) |
| 337 | |
| 338 | def __str__(self): |
| 339 | return self.show() |
| 340 | |
| 341 | def show(self): |
| 342 | import loxi.pp |
| 343 | return loxi.pp.pp(self) |
| 344 | |
| 345 | def pretty_print(self, q): |
| 346 | q.text("bad_action_error_msg {") |
| 347 | with q.group(): |
| 348 | with q.indent(2): |
| 349 | q.breakable() |
| 350 | q.text("xid = "); |
| 351 | if self.xid != None: |
| 352 | q.text("%#x" % self.xid) |
| 353 | else: |
| 354 | q.text('None') |
| 355 | q.text(","); q.breakable() |
| 356 | q.text("code = "); |
| 357 | q.text("%#x" % self.code) |
| 358 | q.text(","); q.breakable() |
| 359 | q.text("data = "); |
| 360 | q.pp(self.data) |
| 361 | q.breakable() |
| 362 | q.text('}') |
| 363 | |
| 364 | class bad_instruction_error_msg(Message): |
| 365 | version = 3 |
| 366 | type = 1 |
| 367 | err_type = 3 |
| 368 | |
| 369 | def __init__(self, xid=None, code=None, data=None): |
| 370 | self.xid = xid |
| 371 | if code != None: |
| 372 | self.code = code |
| 373 | else: |
| 374 | self.code = 0 |
| 375 | if data != None: |
| 376 | self.data = data |
| 377 | else: |
| 378 | self.data = '' |
| 379 | |
| 380 | def pack(self): |
| 381 | packed = [] |
| 382 | packed.append(struct.pack("!B", self.version)) |
| 383 | packed.append(struct.pack("!B", self.type)) |
| 384 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 385 | packed.append(struct.pack("!L", self.xid)) |
| 386 | packed.append(struct.pack("!H", self.err_type)) |
| 387 | packed.append(struct.pack("!H", self.code)) |
| 388 | packed.append(self.data) |
| 389 | length = sum([len(x) for x in packed]) |
| 390 | packed[2] = struct.pack("!H", length) |
| 391 | return ''.join(packed) |
| 392 | |
| 393 | @staticmethod |
| 394 | def unpack(buf): |
| 395 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 396 | obj = bad_instruction_error_msg() |
| 397 | if type(buf) == loxi.generic_util.OFReader: |
| 398 | reader = buf |
| 399 | else: |
| 400 | reader = loxi.generic_util.OFReader(buf) |
| 401 | _version = reader.read("!B")[0] |
| 402 | assert(_version == 3) |
| 403 | _type = reader.read("!B")[0] |
| 404 | assert(_type == 1) |
| 405 | _length = reader.read("!H")[0] |
| 406 | obj.xid = reader.read("!L")[0] |
| 407 | _err_type = reader.read("!H")[0] |
| 408 | assert(_err_type == 3) |
| 409 | obj.code = reader.read("!H")[0] |
| 410 | obj.data = str(reader.read_all()) |
| 411 | return obj |
| 412 | |
| 413 | def __eq__(self, other): |
| 414 | if type(self) != type(other): return False |
| 415 | if self.version != other.version: return False |
| 416 | if self.type != other.type: return False |
| 417 | if self.xid != other.xid: return False |
| 418 | if self.code != other.code: return False |
| 419 | if self.data != other.data: return False |
| 420 | return True |
| 421 | |
| 422 | def __ne__(self, other): |
| 423 | return not self.__eq__(other) |
| 424 | |
| 425 | def __str__(self): |
| 426 | return self.show() |
| 427 | |
| 428 | def show(self): |
| 429 | import loxi.pp |
| 430 | return loxi.pp.pp(self) |
| 431 | |
| 432 | def pretty_print(self, q): |
| 433 | q.text("bad_instruction_error_msg {") |
| 434 | with q.group(): |
| 435 | with q.indent(2): |
| 436 | q.breakable() |
| 437 | q.text("xid = "); |
| 438 | if self.xid != None: |
| 439 | q.text("%#x" % self.xid) |
| 440 | else: |
| 441 | q.text('None') |
| 442 | q.text(","); q.breakable() |
| 443 | q.text("code = "); |
| 444 | q.text("%#x" % self.code) |
| 445 | q.text(","); q.breakable() |
| 446 | q.text("data = "); |
| 447 | q.pp(self.data) |
| 448 | q.breakable() |
| 449 | q.text('}') |
| 450 | |
| 451 | class bad_match_error_msg(Message): |
| 452 | version = 3 |
| 453 | type = 1 |
| 454 | err_type = 4 |
| 455 | |
| 456 | def __init__(self, xid=None, code=None, data=None): |
| 457 | self.xid = xid |
| 458 | if code != None: |
| 459 | self.code = code |
| 460 | else: |
| 461 | self.code = 0 |
| 462 | if data != None: |
| 463 | self.data = data |
| 464 | else: |
| 465 | self.data = '' |
| 466 | |
| 467 | def pack(self): |
| 468 | packed = [] |
| 469 | packed.append(struct.pack("!B", self.version)) |
| 470 | packed.append(struct.pack("!B", self.type)) |
| 471 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 472 | packed.append(struct.pack("!L", self.xid)) |
| 473 | packed.append(struct.pack("!H", self.err_type)) |
| 474 | packed.append(struct.pack("!H", self.code)) |
| 475 | packed.append(self.data) |
| 476 | length = sum([len(x) for x in packed]) |
| 477 | packed[2] = struct.pack("!H", length) |
| 478 | return ''.join(packed) |
| 479 | |
| 480 | @staticmethod |
| 481 | def unpack(buf): |
| 482 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 483 | obj = bad_match_error_msg() |
| 484 | if type(buf) == loxi.generic_util.OFReader: |
| 485 | reader = buf |
| 486 | else: |
| 487 | reader = loxi.generic_util.OFReader(buf) |
| 488 | _version = reader.read("!B")[0] |
| 489 | assert(_version == 3) |
| 490 | _type = reader.read("!B")[0] |
| 491 | assert(_type == 1) |
| 492 | _length = reader.read("!H")[0] |
| 493 | obj.xid = reader.read("!L")[0] |
| 494 | _err_type = reader.read("!H")[0] |
| 495 | assert(_err_type == 4) |
| 496 | obj.code = reader.read("!H")[0] |
| 497 | obj.data = str(reader.read_all()) |
| 498 | return obj |
| 499 | |
| 500 | def __eq__(self, other): |
| 501 | if type(self) != type(other): return False |
| 502 | if self.version != other.version: return False |
| 503 | if self.type != other.type: return False |
| 504 | if self.xid != other.xid: return False |
| 505 | if self.code != other.code: return False |
| 506 | if self.data != other.data: return False |
| 507 | return True |
| 508 | |
| 509 | def __ne__(self, other): |
| 510 | return not self.__eq__(other) |
| 511 | |
| 512 | def __str__(self): |
| 513 | return self.show() |
| 514 | |
| 515 | def show(self): |
| 516 | import loxi.pp |
| 517 | return loxi.pp.pp(self) |
| 518 | |
| 519 | def pretty_print(self, q): |
| 520 | q.text("bad_match_error_msg {") |
| 521 | with q.group(): |
| 522 | with q.indent(2): |
| 523 | q.breakable() |
| 524 | q.text("xid = "); |
| 525 | if self.xid != None: |
| 526 | q.text("%#x" % self.xid) |
| 527 | else: |
| 528 | q.text('None') |
| 529 | q.text(","); q.breakable() |
| 530 | q.text("code = "); |
| 531 | q.text("%#x" % self.code) |
| 532 | q.text(","); q.breakable() |
| 533 | q.text("data = "); |
| 534 | q.pp(self.data) |
| 535 | q.breakable() |
| 536 | q.text('}') |
| 537 | |
| 538 | class bad_request_error_msg(Message): |
| 539 | version = 3 |
| 540 | type = 1 |
| 541 | err_type = 1 |
| 542 | |
| 543 | def __init__(self, xid=None, code=None, data=None): |
| 544 | self.xid = xid |
| 545 | if code != None: |
| 546 | self.code = code |
| 547 | else: |
| 548 | self.code = 0 |
| 549 | if data != None: |
| 550 | self.data = data |
| 551 | else: |
| 552 | self.data = '' |
| 553 | |
| 554 | def pack(self): |
| 555 | packed = [] |
| 556 | packed.append(struct.pack("!B", self.version)) |
| 557 | packed.append(struct.pack("!B", self.type)) |
| 558 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 559 | packed.append(struct.pack("!L", self.xid)) |
| 560 | packed.append(struct.pack("!H", self.err_type)) |
| 561 | packed.append(struct.pack("!H", self.code)) |
| 562 | packed.append(self.data) |
| 563 | length = sum([len(x) for x in packed]) |
| 564 | packed[2] = struct.pack("!H", length) |
| 565 | return ''.join(packed) |
| 566 | |
| 567 | @staticmethod |
| 568 | def unpack(buf): |
| 569 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 570 | obj = bad_request_error_msg() |
| 571 | if type(buf) == loxi.generic_util.OFReader: |
| 572 | reader = buf |
| 573 | else: |
| 574 | reader = loxi.generic_util.OFReader(buf) |
| 575 | _version = reader.read("!B")[0] |
| 576 | assert(_version == 3) |
| 577 | _type = reader.read("!B")[0] |
| 578 | assert(_type == 1) |
| 579 | _length = reader.read("!H")[0] |
| 580 | obj.xid = reader.read("!L")[0] |
| 581 | _err_type = reader.read("!H")[0] |
| 582 | assert(_err_type == 1) |
| 583 | obj.code = reader.read("!H")[0] |
| 584 | obj.data = str(reader.read_all()) |
| 585 | return obj |
| 586 | |
| 587 | def __eq__(self, other): |
| 588 | if type(self) != type(other): return False |
| 589 | if self.version != other.version: return False |
| 590 | if self.type != other.type: return False |
| 591 | if self.xid != other.xid: return False |
| 592 | if self.code != other.code: return False |
| 593 | if self.data != other.data: return False |
| 594 | return True |
| 595 | |
| 596 | def __ne__(self, other): |
| 597 | return not self.__eq__(other) |
| 598 | |
| 599 | def __str__(self): |
| 600 | return self.show() |
| 601 | |
| 602 | def show(self): |
| 603 | import loxi.pp |
| 604 | return loxi.pp.pp(self) |
| 605 | |
| 606 | def pretty_print(self, q): |
| 607 | q.text("bad_request_error_msg {") |
| 608 | with q.group(): |
| 609 | with q.indent(2): |
| 610 | q.breakable() |
| 611 | q.text("xid = "); |
| 612 | if self.xid != None: |
| 613 | q.text("%#x" % self.xid) |
| 614 | else: |
| 615 | q.text('None') |
| 616 | q.text(","); q.breakable() |
| 617 | q.text("code = "); |
| 618 | q.text("%#x" % self.code) |
| 619 | q.text(","); q.breakable() |
| 620 | q.text("data = "); |
| 621 | q.pp(self.data) |
| 622 | q.breakable() |
| 623 | q.text('}') |
| 624 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 625 | class barrier_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 626 | version = 3 |
| 627 | type = 21 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 628 | |
| 629 | def __init__(self, xid=None): |
| 630 | self.xid = xid |
| 631 | |
| 632 | def pack(self): |
| 633 | packed = [] |
| 634 | packed.append(struct.pack("!B", self.version)) |
| 635 | packed.append(struct.pack("!B", self.type)) |
| 636 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 637 | packed.append(struct.pack("!L", self.xid)) |
| 638 | length = sum([len(x) for x in packed]) |
| 639 | packed[2] = struct.pack("!H", length) |
| 640 | return ''.join(packed) |
| 641 | |
| 642 | @staticmethod |
| 643 | def unpack(buf): |
| 644 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 645 | obj = barrier_reply() |
| 646 | if type(buf) == loxi.generic_util.OFReader: |
| 647 | reader = buf |
| 648 | else: |
| 649 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 650 | _version = reader.read("!B")[0] |
| 651 | assert(_version == 3) |
| 652 | _type = reader.read("!B")[0] |
| 653 | assert(_type == 21) |
| 654 | _length = reader.read("!H")[0] |
| 655 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 656 | return obj |
| 657 | |
| 658 | def __eq__(self, other): |
| 659 | if type(self) != type(other): return False |
| 660 | if self.version != other.version: return False |
| 661 | if self.type != other.type: return False |
| 662 | if self.xid != other.xid: return False |
| 663 | return True |
| 664 | |
| 665 | def __ne__(self, other): |
| 666 | return not self.__eq__(other) |
| 667 | |
| 668 | def __str__(self): |
| 669 | return self.show() |
| 670 | |
| 671 | def show(self): |
| 672 | import loxi.pp |
| 673 | return loxi.pp.pp(self) |
| 674 | |
| 675 | def pretty_print(self, q): |
| 676 | q.text("barrier_reply {") |
| 677 | with q.group(): |
| 678 | with q.indent(2): |
| 679 | q.breakable() |
| 680 | q.text("xid = "); |
| 681 | if self.xid != None: |
| 682 | q.text("%#x" % self.xid) |
| 683 | else: |
| 684 | q.text('None') |
| 685 | q.breakable() |
| 686 | q.text('}') |
| 687 | |
| 688 | class barrier_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 689 | version = 3 |
| 690 | type = 20 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 691 | |
| 692 | def __init__(self, xid=None): |
| 693 | self.xid = xid |
| 694 | |
| 695 | def pack(self): |
| 696 | packed = [] |
| 697 | packed.append(struct.pack("!B", self.version)) |
| 698 | packed.append(struct.pack("!B", self.type)) |
| 699 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 700 | packed.append(struct.pack("!L", self.xid)) |
| 701 | length = sum([len(x) for x in packed]) |
| 702 | packed[2] = struct.pack("!H", length) |
| 703 | return ''.join(packed) |
| 704 | |
| 705 | @staticmethod |
| 706 | def unpack(buf): |
| 707 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 708 | obj = barrier_request() |
| 709 | if type(buf) == loxi.generic_util.OFReader: |
| 710 | reader = buf |
| 711 | else: |
| 712 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 713 | _version = reader.read("!B")[0] |
| 714 | assert(_version == 3) |
| 715 | _type = reader.read("!B")[0] |
| 716 | assert(_type == 20) |
| 717 | _length = reader.read("!H")[0] |
| 718 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 719 | return obj |
| 720 | |
| 721 | def __eq__(self, other): |
| 722 | if type(self) != type(other): return False |
| 723 | if self.version != other.version: return False |
| 724 | if self.type != other.type: return False |
| 725 | if self.xid != other.xid: return False |
| 726 | return True |
| 727 | |
| 728 | def __ne__(self, other): |
| 729 | return not self.__eq__(other) |
| 730 | |
| 731 | def __str__(self): |
| 732 | return self.show() |
| 733 | |
| 734 | def show(self): |
| 735 | import loxi.pp |
| 736 | return loxi.pp.pp(self) |
| 737 | |
| 738 | def pretty_print(self, q): |
| 739 | q.text("barrier_request {") |
| 740 | with q.group(): |
| 741 | with q.indent(2): |
| 742 | q.breakable() |
| 743 | q.text("xid = "); |
| 744 | if self.xid != None: |
| 745 | q.text("%#x" % self.xid) |
| 746 | else: |
| 747 | q.text('None') |
| 748 | q.breakable() |
| 749 | q.text('}') |
| 750 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 751 | class bsn_bw_clear_data_reply(Message): |
| 752 | version = 3 |
| 753 | type = 4 |
| 754 | experimenter = 6035143 |
| 755 | subtype = 22 |
| 756 | |
| 757 | def __init__(self, xid=None, status=None): |
| 758 | self.xid = xid |
| 759 | if status != None: |
| 760 | self.status = status |
| 761 | else: |
| 762 | self.status = 0 |
| 763 | |
| 764 | def pack(self): |
| 765 | packed = [] |
| 766 | packed.append(struct.pack("!B", self.version)) |
| 767 | packed.append(struct.pack("!B", self.type)) |
| 768 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 769 | packed.append(struct.pack("!L", self.xid)) |
| 770 | packed.append(struct.pack("!L", self.experimenter)) |
| 771 | packed.append(struct.pack("!L", self.subtype)) |
| 772 | packed.append(struct.pack("!L", self.status)) |
| 773 | length = sum([len(x) for x in packed]) |
| 774 | packed[2] = struct.pack("!H", length) |
| 775 | return ''.join(packed) |
| 776 | |
| 777 | @staticmethod |
| 778 | def unpack(buf): |
| 779 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 780 | obj = bsn_bw_clear_data_reply() |
| 781 | if type(buf) == loxi.generic_util.OFReader: |
| 782 | reader = buf |
| 783 | else: |
| 784 | reader = loxi.generic_util.OFReader(buf) |
| 785 | _version = reader.read("!B")[0] |
| 786 | assert(_version == 3) |
| 787 | _type = reader.read("!B")[0] |
| 788 | assert(_type == 4) |
| 789 | _length = reader.read("!H")[0] |
| 790 | obj.xid = reader.read("!L")[0] |
| 791 | _experimenter = reader.read("!L")[0] |
| 792 | assert(_experimenter == 6035143) |
| 793 | _subtype = reader.read("!L")[0] |
| 794 | assert(_subtype == 22) |
| 795 | obj.status = reader.read("!L")[0] |
| 796 | return obj |
| 797 | |
| 798 | def __eq__(self, other): |
| 799 | if type(self) != type(other): return False |
| 800 | if self.version != other.version: return False |
| 801 | if self.type != other.type: return False |
| 802 | if self.xid != other.xid: return False |
| 803 | if self.status != other.status: return False |
| 804 | return True |
| 805 | |
| 806 | def __ne__(self, other): |
| 807 | return not self.__eq__(other) |
| 808 | |
| 809 | def __str__(self): |
| 810 | return self.show() |
| 811 | |
| 812 | def show(self): |
| 813 | import loxi.pp |
| 814 | return loxi.pp.pp(self) |
| 815 | |
| 816 | def pretty_print(self, q): |
| 817 | q.text("bsn_bw_clear_data_reply {") |
| 818 | with q.group(): |
| 819 | with q.indent(2): |
| 820 | q.breakable() |
| 821 | q.text("xid = "); |
| 822 | if self.xid != None: |
| 823 | q.text("%#x" % self.xid) |
| 824 | else: |
| 825 | q.text('None') |
| 826 | q.text(","); q.breakable() |
| 827 | q.text("status = "); |
| 828 | q.text("%#x" % self.status) |
| 829 | q.breakable() |
| 830 | q.text('}') |
| 831 | |
| 832 | class bsn_bw_clear_data_request(Message): |
| 833 | version = 3 |
| 834 | type = 4 |
| 835 | experimenter = 6035143 |
| 836 | subtype = 21 |
| 837 | |
| 838 | def __init__(self, xid=None): |
| 839 | self.xid = xid |
| 840 | |
| 841 | def pack(self): |
| 842 | packed = [] |
| 843 | packed.append(struct.pack("!B", self.version)) |
| 844 | packed.append(struct.pack("!B", self.type)) |
| 845 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 846 | packed.append(struct.pack("!L", self.xid)) |
| 847 | packed.append(struct.pack("!L", self.experimenter)) |
| 848 | packed.append(struct.pack("!L", self.subtype)) |
| 849 | length = sum([len(x) for x in packed]) |
| 850 | packed[2] = struct.pack("!H", length) |
| 851 | return ''.join(packed) |
| 852 | |
| 853 | @staticmethod |
| 854 | def unpack(buf): |
| 855 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 856 | obj = bsn_bw_clear_data_request() |
| 857 | if type(buf) == loxi.generic_util.OFReader: |
| 858 | reader = buf |
| 859 | else: |
| 860 | reader = loxi.generic_util.OFReader(buf) |
| 861 | _version = reader.read("!B")[0] |
| 862 | assert(_version == 3) |
| 863 | _type = reader.read("!B")[0] |
| 864 | assert(_type == 4) |
| 865 | _length = reader.read("!H")[0] |
| 866 | obj.xid = reader.read("!L")[0] |
| 867 | _experimenter = reader.read("!L")[0] |
| 868 | assert(_experimenter == 6035143) |
| 869 | _subtype = reader.read("!L")[0] |
| 870 | assert(_subtype == 21) |
| 871 | return obj |
| 872 | |
| 873 | def __eq__(self, other): |
| 874 | if type(self) != type(other): return False |
| 875 | if self.version != other.version: return False |
| 876 | if self.type != other.type: return False |
| 877 | if self.xid != other.xid: return False |
| 878 | return True |
| 879 | |
| 880 | def __ne__(self, other): |
| 881 | return not self.__eq__(other) |
| 882 | |
| 883 | def __str__(self): |
| 884 | return self.show() |
| 885 | |
| 886 | def show(self): |
| 887 | import loxi.pp |
| 888 | return loxi.pp.pp(self) |
| 889 | |
| 890 | def pretty_print(self, q): |
| 891 | q.text("bsn_bw_clear_data_request {") |
| 892 | with q.group(): |
| 893 | with q.indent(2): |
| 894 | q.breakable() |
| 895 | q.text("xid = "); |
| 896 | if self.xid != None: |
| 897 | q.text("%#x" % self.xid) |
| 898 | else: |
| 899 | q.text('None') |
| 900 | q.breakable() |
| 901 | q.text('}') |
| 902 | |
| 903 | class bsn_bw_enable_get_reply(Message): |
| 904 | version = 3 |
| 905 | type = 4 |
| 906 | experimenter = 6035143 |
| 907 | subtype = 20 |
| 908 | |
| 909 | def __init__(self, xid=None, enabled=None): |
| 910 | self.xid = xid |
| 911 | if enabled != None: |
| 912 | self.enabled = enabled |
| 913 | else: |
| 914 | self.enabled = 0 |
| 915 | |
| 916 | def pack(self): |
| 917 | packed = [] |
| 918 | packed.append(struct.pack("!B", self.version)) |
| 919 | packed.append(struct.pack("!B", self.type)) |
| 920 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 921 | packed.append(struct.pack("!L", self.xid)) |
| 922 | packed.append(struct.pack("!L", self.experimenter)) |
| 923 | packed.append(struct.pack("!L", self.subtype)) |
| 924 | packed.append(struct.pack("!L", self.enabled)) |
| 925 | length = sum([len(x) for x in packed]) |
| 926 | packed[2] = struct.pack("!H", length) |
| 927 | return ''.join(packed) |
| 928 | |
| 929 | @staticmethod |
| 930 | def unpack(buf): |
| 931 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 932 | obj = bsn_bw_enable_get_reply() |
| 933 | if type(buf) == loxi.generic_util.OFReader: |
| 934 | reader = buf |
| 935 | else: |
| 936 | reader = loxi.generic_util.OFReader(buf) |
| 937 | _version = reader.read("!B")[0] |
| 938 | assert(_version == 3) |
| 939 | _type = reader.read("!B")[0] |
| 940 | assert(_type == 4) |
| 941 | _length = reader.read("!H")[0] |
| 942 | obj.xid = reader.read("!L")[0] |
| 943 | _experimenter = reader.read("!L")[0] |
| 944 | assert(_experimenter == 6035143) |
| 945 | _subtype = reader.read("!L")[0] |
| 946 | assert(_subtype == 20) |
| 947 | obj.enabled = reader.read("!L")[0] |
| 948 | return obj |
| 949 | |
| 950 | def __eq__(self, other): |
| 951 | if type(self) != type(other): return False |
| 952 | if self.version != other.version: return False |
| 953 | if self.type != other.type: return False |
| 954 | if self.xid != other.xid: return False |
| 955 | if self.enabled != other.enabled: return False |
| 956 | return True |
| 957 | |
| 958 | def __ne__(self, other): |
| 959 | return not self.__eq__(other) |
| 960 | |
| 961 | def __str__(self): |
| 962 | return self.show() |
| 963 | |
| 964 | def show(self): |
| 965 | import loxi.pp |
| 966 | return loxi.pp.pp(self) |
| 967 | |
| 968 | def pretty_print(self, q): |
| 969 | q.text("bsn_bw_enable_get_reply {") |
| 970 | with q.group(): |
| 971 | with q.indent(2): |
| 972 | q.breakable() |
| 973 | q.text("xid = "); |
| 974 | if self.xid != None: |
| 975 | q.text("%#x" % self.xid) |
| 976 | else: |
| 977 | q.text('None') |
| 978 | q.text(","); q.breakable() |
| 979 | q.text("enabled = "); |
| 980 | q.text("%#x" % self.enabled) |
| 981 | q.breakable() |
| 982 | q.text('}') |
| 983 | |
| 984 | class bsn_bw_enable_get_request(Message): |
| 985 | version = 3 |
| 986 | type = 4 |
| 987 | experimenter = 6035143 |
| 988 | subtype = 19 |
| 989 | |
| 990 | def __init__(self, xid=None): |
| 991 | self.xid = xid |
| 992 | |
| 993 | def pack(self): |
| 994 | packed = [] |
| 995 | packed.append(struct.pack("!B", self.version)) |
| 996 | packed.append(struct.pack("!B", self.type)) |
| 997 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 998 | packed.append(struct.pack("!L", self.xid)) |
| 999 | packed.append(struct.pack("!L", self.experimenter)) |
| 1000 | packed.append(struct.pack("!L", self.subtype)) |
| 1001 | length = sum([len(x) for x in packed]) |
| 1002 | packed[2] = struct.pack("!H", length) |
| 1003 | return ''.join(packed) |
| 1004 | |
| 1005 | @staticmethod |
| 1006 | def unpack(buf): |
| 1007 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 1008 | obj = bsn_bw_enable_get_request() |
| 1009 | if type(buf) == loxi.generic_util.OFReader: |
| 1010 | reader = buf |
| 1011 | else: |
| 1012 | reader = loxi.generic_util.OFReader(buf) |
| 1013 | _version = reader.read("!B")[0] |
| 1014 | assert(_version == 3) |
| 1015 | _type = reader.read("!B")[0] |
| 1016 | assert(_type == 4) |
| 1017 | _length = reader.read("!H")[0] |
| 1018 | obj.xid = reader.read("!L")[0] |
| 1019 | _experimenter = reader.read("!L")[0] |
| 1020 | assert(_experimenter == 6035143) |
| 1021 | _subtype = reader.read("!L")[0] |
| 1022 | assert(_subtype == 19) |
| 1023 | return obj |
| 1024 | |
| 1025 | def __eq__(self, other): |
| 1026 | if type(self) != type(other): return False |
| 1027 | if self.version != other.version: return False |
| 1028 | if self.type != other.type: return False |
| 1029 | if self.xid != other.xid: return False |
| 1030 | return True |
| 1031 | |
| 1032 | def __ne__(self, other): |
| 1033 | return not self.__eq__(other) |
| 1034 | |
| 1035 | def __str__(self): |
| 1036 | return self.show() |
| 1037 | |
| 1038 | def show(self): |
| 1039 | import loxi.pp |
| 1040 | return loxi.pp.pp(self) |
| 1041 | |
| 1042 | def pretty_print(self, q): |
| 1043 | q.text("bsn_bw_enable_get_request {") |
| 1044 | with q.group(): |
| 1045 | with q.indent(2): |
| 1046 | q.breakable() |
| 1047 | q.text("xid = "); |
| 1048 | if self.xid != None: |
| 1049 | q.text("%#x" % self.xid) |
| 1050 | else: |
| 1051 | q.text('None') |
| 1052 | q.breakable() |
| 1053 | q.text('}') |
| 1054 | |
| 1055 | class bsn_bw_enable_set_reply(Message): |
| 1056 | version = 3 |
| 1057 | type = 4 |
| 1058 | experimenter = 6035143 |
| 1059 | subtype = 23 |
| 1060 | |
| 1061 | def __init__(self, xid=None, enable=None, status=None): |
| 1062 | self.xid = xid |
| 1063 | if enable != None: |
| 1064 | self.enable = enable |
| 1065 | else: |
| 1066 | self.enable = 0 |
| 1067 | if status != None: |
| 1068 | self.status = status |
| 1069 | else: |
| 1070 | self.status = 0 |
| 1071 | |
| 1072 | def pack(self): |
| 1073 | packed = [] |
| 1074 | packed.append(struct.pack("!B", self.version)) |
| 1075 | packed.append(struct.pack("!B", self.type)) |
| 1076 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1077 | packed.append(struct.pack("!L", self.xid)) |
| 1078 | packed.append(struct.pack("!L", self.experimenter)) |
| 1079 | packed.append(struct.pack("!L", self.subtype)) |
| 1080 | packed.append(struct.pack("!L", self.enable)) |
| 1081 | packed.append(struct.pack("!L", self.status)) |
| 1082 | length = sum([len(x) for x in packed]) |
| 1083 | packed[2] = struct.pack("!H", length) |
| 1084 | return ''.join(packed) |
| 1085 | |
| 1086 | @staticmethod |
| 1087 | def unpack(buf): |
| 1088 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 1089 | obj = bsn_bw_enable_set_reply() |
| 1090 | if type(buf) == loxi.generic_util.OFReader: |
| 1091 | reader = buf |
| 1092 | else: |
| 1093 | reader = loxi.generic_util.OFReader(buf) |
| 1094 | _version = reader.read("!B")[0] |
| 1095 | assert(_version == 3) |
| 1096 | _type = reader.read("!B")[0] |
| 1097 | assert(_type == 4) |
| 1098 | _length = reader.read("!H")[0] |
| 1099 | obj.xid = reader.read("!L")[0] |
| 1100 | _experimenter = reader.read("!L")[0] |
| 1101 | assert(_experimenter == 6035143) |
| 1102 | _subtype = reader.read("!L")[0] |
| 1103 | assert(_subtype == 23) |
| 1104 | obj.enable = reader.read("!L")[0] |
| 1105 | obj.status = reader.read("!L")[0] |
| 1106 | return obj |
| 1107 | |
| 1108 | def __eq__(self, other): |
| 1109 | if type(self) != type(other): return False |
| 1110 | if self.version != other.version: return False |
| 1111 | if self.type != other.type: return False |
| 1112 | if self.xid != other.xid: return False |
| 1113 | if self.enable != other.enable: return False |
| 1114 | if self.status != other.status: return False |
| 1115 | return True |
| 1116 | |
| 1117 | def __ne__(self, other): |
| 1118 | return not self.__eq__(other) |
| 1119 | |
| 1120 | def __str__(self): |
| 1121 | return self.show() |
| 1122 | |
| 1123 | def show(self): |
| 1124 | import loxi.pp |
| 1125 | return loxi.pp.pp(self) |
| 1126 | |
| 1127 | def pretty_print(self, q): |
| 1128 | q.text("bsn_bw_enable_set_reply {") |
| 1129 | with q.group(): |
| 1130 | with q.indent(2): |
| 1131 | q.breakable() |
| 1132 | q.text("xid = "); |
| 1133 | if self.xid != None: |
| 1134 | q.text("%#x" % self.xid) |
| 1135 | else: |
| 1136 | q.text('None') |
| 1137 | q.text(","); q.breakable() |
| 1138 | q.text("enable = "); |
| 1139 | q.text("%#x" % self.enable) |
| 1140 | q.text(","); q.breakable() |
| 1141 | q.text("status = "); |
| 1142 | q.text("%#x" % self.status) |
| 1143 | q.breakable() |
| 1144 | q.text('}') |
| 1145 | |
| 1146 | class bsn_bw_enable_set_request(Message): |
| 1147 | version = 3 |
| 1148 | type = 4 |
| 1149 | experimenter = 6035143 |
| 1150 | subtype = 18 |
| 1151 | |
| 1152 | def __init__(self, xid=None, enable=None): |
| 1153 | self.xid = xid |
| 1154 | if enable != None: |
| 1155 | self.enable = enable |
| 1156 | else: |
| 1157 | self.enable = 0 |
| 1158 | |
| 1159 | def pack(self): |
| 1160 | packed = [] |
| 1161 | packed.append(struct.pack("!B", self.version)) |
| 1162 | packed.append(struct.pack("!B", self.type)) |
| 1163 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1164 | packed.append(struct.pack("!L", self.xid)) |
| 1165 | packed.append(struct.pack("!L", self.experimenter)) |
| 1166 | packed.append(struct.pack("!L", self.subtype)) |
| 1167 | packed.append(struct.pack("!L", self.enable)) |
| 1168 | length = sum([len(x) for x in packed]) |
| 1169 | packed[2] = struct.pack("!H", length) |
| 1170 | return ''.join(packed) |
| 1171 | |
| 1172 | @staticmethod |
| 1173 | def unpack(buf): |
| 1174 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 1175 | obj = bsn_bw_enable_set_request() |
| 1176 | if type(buf) == loxi.generic_util.OFReader: |
| 1177 | reader = buf |
| 1178 | else: |
| 1179 | reader = loxi.generic_util.OFReader(buf) |
| 1180 | _version = reader.read("!B")[0] |
| 1181 | assert(_version == 3) |
| 1182 | _type = reader.read("!B")[0] |
| 1183 | assert(_type == 4) |
| 1184 | _length = reader.read("!H")[0] |
| 1185 | obj.xid = reader.read("!L")[0] |
| 1186 | _experimenter = reader.read("!L")[0] |
| 1187 | assert(_experimenter == 6035143) |
| 1188 | _subtype = reader.read("!L")[0] |
| 1189 | assert(_subtype == 18) |
| 1190 | obj.enable = reader.read("!L")[0] |
| 1191 | return obj |
| 1192 | |
| 1193 | def __eq__(self, other): |
| 1194 | if type(self) != type(other): return False |
| 1195 | if self.version != other.version: return False |
| 1196 | if self.type != other.type: return False |
| 1197 | if self.xid != other.xid: return False |
| 1198 | if self.enable != other.enable: return False |
| 1199 | return True |
| 1200 | |
| 1201 | def __ne__(self, other): |
| 1202 | return not self.__eq__(other) |
| 1203 | |
| 1204 | def __str__(self): |
| 1205 | return self.show() |
| 1206 | |
| 1207 | def show(self): |
| 1208 | import loxi.pp |
| 1209 | return loxi.pp.pp(self) |
| 1210 | |
| 1211 | def pretty_print(self, q): |
| 1212 | q.text("bsn_bw_enable_set_request {") |
| 1213 | with q.group(): |
| 1214 | with q.indent(2): |
| 1215 | q.breakable() |
| 1216 | q.text("xid = "); |
| 1217 | if self.xid != None: |
| 1218 | q.text("%#x" % self.xid) |
| 1219 | else: |
| 1220 | q.text('None') |
| 1221 | q.text(","); q.breakable() |
| 1222 | q.text("enable = "); |
| 1223 | q.text("%#x" % self.enable) |
| 1224 | q.breakable() |
| 1225 | q.text('}') |
| 1226 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1227 | class bsn_get_interfaces_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1228 | version = 3 |
| 1229 | type = 4 |
| 1230 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1231 | subtype = 10 |
| 1232 | |
| 1233 | def __init__(self, xid=None, interfaces=None): |
| 1234 | self.xid = xid |
| 1235 | if interfaces != None: |
| 1236 | self.interfaces = interfaces |
| 1237 | else: |
| 1238 | self.interfaces = [] |
| 1239 | |
| 1240 | def pack(self): |
| 1241 | packed = [] |
| 1242 | packed.append(struct.pack("!B", self.version)) |
| 1243 | packed.append(struct.pack("!B", self.type)) |
| 1244 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1245 | packed.append(struct.pack("!L", self.xid)) |
| 1246 | packed.append(struct.pack("!L", self.experimenter)) |
| 1247 | packed.append(struct.pack("!L", self.subtype)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1248 | packed.append(util.pack_list(self.interfaces)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1249 | length = sum([len(x) for x in packed]) |
| 1250 | packed[2] = struct.pack("!H", length) |
| 1251 | return ''.join(packed) |
| 1252 | |
| 1253 | @staticmethod |
| 1254 | def unpack(buf): |
| 1255 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 1256 | obj = bsn_get_interfaces_reply() |
| 1257 | if type(buf) == loxi.generic_util.OFReader: |
| 1258 | reader = buf |
| 1259 | else: |
| 1260 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1261 | _version = reader.read("!B")[0] |
| 1262 | assert(_version == 3) |
| 1263 | _type = reader.read("!B")[0] |
| 1264 | assert(_type == 4) |
| 1265 | _length = reader.read("!H")[0] |
| 1266 | obj.xid = reader.read("!L")[0] |
| 1267 | _experimenter = reader.read("!L")[0] |
| 1268 | assert(_experimenter == 6035143) |
| 1269 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1270 | assert(_subtype == 10) |
| 1271 | obj.interfaces = loxi.generic_util.unpack_list(reader, common.bsn_interface.unpack) |
| 1272 | return obj |
| 1273 | |
| 1274 | def __eq__(self, other): |
| 1275 | if type(self) != type(other): return False |
| 1276 | if self.version != other.version: return False |
| 1277 | if self.type != other.type: return False |
| 1278 | if self.xid != other.xid: return False |
| 1279 | if self.interfaces != other.interfaces: return False |
| 1280 | return True |
| 1281 | |
| 1282 | def __ne__(self, other): |
| 1283 | return not self.__eq__(other) |
| 1284 | |
| 1285 | def __str__(self): |
| 1286 | return self.show() |
| 1287 | |
| 1288 | def show(self): |
| 1289 | import loxi.pp |
| 1290 | return loxi.pp.pp(self) |
| 1291 | |
| 1292 | def pretty_print(self, q): |
| 1293 | q.text("bsn_get_interfaces_reply {") |
| 1294 | with q.group(): |
| 1295 | with q.indent(2): |
| 1296 | q.breakable() |
| 1297 | q.text("xid = "); |
| 1298 | if self.xid != None: |
| 1299 | q.text("%#x" % self.xid) |
| 1300 | else: |
| 1301 | q.text('None') |
| 1302 | q.text(","); q.breakable() |
| 1303 | q.text("interfaces = "); |
| 1304 | q.pp(self.interfaces) |
| 1305 | q.breakable() |
| 1306 | q.text('}') |
| 1307 | |
| 1308 | class bsn_get_interfaces_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1309 | version = 3 |
| 1310 | type = 4 |
| 1311 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1312 | subtype = 9 |
| 1313 | |
| 1314 | def __init__(self, xid=None): |
| 1315 | self.xid = xid |
| 1316 | |
| 1317 | def pack(self): |
| 1318 | packed = [] |
| 1319 | packed.append(struct.pack("!B", self.version)) |
| 1320 | packed.append(struct.pack("!B", self.type)) |
| 1321 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1322 | packed.append(struct.pack("!L", self.xid)) |
| 1323 | packed.append(struct.pack("!L", self.experimenter)) |
| 1324 | packed.append(struct.pack("!L", self.subtype)) |
| 1325 | length = sum([len(x) for x in packed]) |
| 1326 | packed[2] = struct.pack("!H", length) |
| 1327 | return ''.join(packed) |
| 1328 | |
| 1329 | @staticmethod |
| 1330 | def unpack(buf): |
| 1331 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 1332 | obj = bsn_get_interfaces_request() |
| 1333 | if type(buf) == loxi.generic_util.OFReader: |
| 1334 | reader = buf |
| 1335 | else: |
| 1336 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1337 | _version = reader.read("!B")[0] |
| 1338 | assert(_version == 3) |
| 1339 | _type = reader.read("!B")[0] |
| 1340 | assert(_type == 4) |
| 1341 | _length = reader.read("!H")[0] |
| 1342 | obj.xid = reader.read("!L")[0] |
| 1343 | _experimenter = reader.read("!L")[0] |
| 1344 | assert(_experimenter == 6035143) |
| 1345 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1346 | assert(_subtype == 9) |
| 1347 | return obj |
| 1348 | |
| 1349 | def __eq__(self, other): |
| 1350 | if type(self) != type(other): return False |
| 1351 | if self.version != other.version: return False |
| 1352 | if self.type != other.type: return False |
| 1353 | if self.xid != other.xid: return False |
| 1354 | return True |
| 1355 | |
| 1356 | def __ne__(self, other): |
| 1357 | return not self.__eq__(other) |
| 1358 | |
| 1359 | def __str__(self): |
| 1360 | return self.show() |
| 1361 | |
| 1362 | def show(self): |
| 1363 | import loxi.pp |
| 1364 | return loxi.pp.pp(self) |
| 1365 | |
| 1366 | def pretty_print(self, q): |
| 1367 | q.text("bsn_get_interfaces_request {") |
| 1368 | with q.group(): |
| 1369 | with q.indent(2): |
| 1370 | q.breakable() |
| 1371 | q.text("xid = "); |
| 1372 | if self.xid != None: |
| 1373 | q.text("%#x" % self.xid) |
| 1374 | else: |
| 1375 | q.text('None') |
| 1376 | q.breakable() |
| 1377 | q.text('}') |
| 1378 | |
| 1379 | class bsn_get_mirroring_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1380 | version = 3 |
| 1381 | type = 4 |
| 1382 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1383 | subtype = 5 |
| 1384 | |
| 1385 | def __init__(self, xid=None, report_mirror_ports=None): |
| 1386 | self.xid = xid |
| 1387 | if report_mirror_ports != None: |
| 1388 | self.report_mirror_ports = report_mirror_ports |
| 1389 | else: |
| 1390 | self.report_mirror_ports = 0 |
| 1391 | |
| 1392 | def pack(self): |
| 1393 | packed = [] |
| 1394 | packed.append(struct.pack("!B", self.version)) |
| 1395 | packed.append(struct.pack("!B", self.type)) |
| 1396 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1397 | packed.append(struct.pack("!L", self.xid)) |
| 1398 | packed.append(struct.pack("!L", self.experimenter)) |
| 1399 | packed.append(struct.pack("!L", self.subtype)) |
| 1400 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 1401 | packed.append('\x00' * 3) |
| 1402 | length = sum([len(x) for x in packed]) |
| 1403 | packed[2] = struct.pack("!H", length) |
| 1404 | return ''.join(packed) |
| 1405 | |
| 1406 | @staticmethod |
| 1407 | def unpack(buf): |
| 1408 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 1409 | obj = bsn_get_mirroring_reply() |
| 1410 | if type(buf) == loxi.generic_util.OFReader: |
| 1411 | reader = buf |
| 1412 | else: |
| 1413 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1414 | _version = reader.read("!B")[0] |
| 1415 | assert(_version == 3) |
| 1416 | _type = reader.read("!B")[0] |
| 1417 | assert(_type == 4) |
| 1418 | _length = reader.read("!H")[0] |
| 1419 | obj.xid = reader.read("!L")[0] |
| 1420 | _experimenter = reader.read("!L")[0] |
| 1421 | assert(_experimenter == 6035143) |
| 1422 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1423 | assert(_subtype == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1424 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1425 | reader.skip(3) |
| 1426 | return obj |
| 1427 | |
| 1428 | def __eq__(self, other): |
| 1429 | if type(self) != type(other): return False |
| 1430 | if self.version != other.version: return False |
| 1431 | if self.type != other.type: return False |
| 1432 | if self.xid != other.xid: return False |
| 1433 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 1434 | return True |
| 1435 | |
| 1436 | def __ne__(self, other): |
| 1437 | return not self.__eq__(other) |
| 1438 | |
| 1439 | def __str__(self): |
| 1440 | return self.show() |
| 1441 | |
| 1442 | def show(self): |
| 1443 | import loxi.pp |
| 1444 | return loxi.pp.pp(self) |
| 1445 | |
| 1446 | def pretty_print(self, q): |
| 1447 | q.text("bsn_get_mirroring_reply {") |
| 1448 | with q.group(): |
| 1449 | with q.indent(2): |
| 1450 | q.breakable() |
| 1451 | q.text("xid = "); |
| 1452 | if self.xid != None: |
| 1453 | q.text("%#x" % self.xid) |
| 1454 | else: |
| 1455 | q.text('None') |
| 1456 | q.text(","); q.breakable() |
| 1457 | q.text("report_mirror_ports = "); |
| 1458 | q.text("%#x" % self.report_mirror_ports) |
| 1459 | q.breakable() |
| 1460 | q.text('}') |
| 1461 | |
| 1462 | class bsn_get_mirroring_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1463 | version = 3 |
| 1464 | type = 4 |
| 1465 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1466 | subtype = 4 |
| 1467 | |
| 1468 | def __init__(self, xid=None, report_mirror_ports=None): |
| 1469 | self.xid = xid |
| 1470 | if report_mirror_ports != None: |
| 1471 | self.report_mirror_ports = report_mirror_ports |
| 1472 | else: |
| 1473 | self.report_mirror_ports = 0 |
| 1474 | |
| 1475 | def pack(self): |
| 1476 | packed = [] |
| 1477 | packed.append(struct.pack("!B", self.version)) |
| 1478 | packed.append(struct.pack("!B", self.type)) |
| 1479 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1480 | packed.append(struct.pack("!L", self.xid)) |
| 1481 | packed.append(struct.pack("!L", self.experimenter)) |
| 1482 | packed.append(struct.pack("!L", self.subtype)) |
| 1483 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 1484 | packed.append('\x00' * 3) |
| 1485 | length = sum([len(x) for x in packed]) |
| 1486 | packed[2] = struct.pack("!H", length) |
| 1487 | return ''.join(packed) |
| 1488 | |
| 1489 | @staticmethod |
| 1490 | def unpack(buf): |
| 1491 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 1492 | obj = bsn_get_mirroring_request() |
| 1493 | if type(buf) == loxi.generic_util.OFReader: |
| 1494 | reader = buf |
| 1495 | else: |
| 1496 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1497 | _version = reader.read("!B")[0] |
| 1498 | assert(_version == 3) |
| 1499 | _type = reader.read("!B")[0] |
| 1500 | assert(_type == 4) |
| 1501 | _length = reader.read("!H")[0] |
| 1502 | obj.xid = reader.read("!L")[0] |
| 1503 | _experimenter = reader.read("!L")[0] |
| 1504 | assert(_experimenter == 6035143) |
| 1505 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1506 | assert(_subtype == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1507 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1508 | reader.skip(3) |
| 1509 | return obj |
| 1510 | |
| 1511 | def __eq__(self, other): |
| 1512 | if type(self) != type(other): return False |
| 1513 | if self.version != other.version: return False |
| 1514 | if self.type != other.type: return False |
| 1515 | if self.xid != other.xid: return False |
| 1516 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 1517 | return True |
| 1518 | |
| 1519 | def __ne__(self, other): |
| 1520 | return not self.__eq__(other) |
| 1521 | |
| 1522 | def __str__(self): |
| 1523 | return self.show() |
| 1524 | |
| 1525 | def show(self): |
| 1526 | import loxi.pp |
| 1527 | return loxi.pp.pp(self) |
| 1528 | |
| 1529 | def pretty_print(self, q): |
| 1530 | q.text("bsn_get_mirroring_request {") |
| 1531 | with q.group(): |
| 1532 | with q.indent(2): |
| 1533 | q.breakable() |
| 1534 | q.text("xid = "); |
| 1535 | if self.xid != None: |
| 1536 | q.text("%#x" % self.xid) |
| 1537 | else: |
| 1538 | q.text('None') |
| 1539 | q.text(","); q.breakable() |
| 1540 | q.text("report_mirror_ports = "); |
| 1541 | q.text("%#x" % self.report_mirror_ports) |
| 1542 | q.breakable() |
| 1543 | q.text('}') |
| 1544 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1545 | class bsn_pdu_rx_reply(Message): |
| 1546 | version = 3 |
| 1547 | type = 4 |
| 1548 | experimenter = 6035143 |
| 1549 | subtype = 34 |
| 1550 | |
| 1551 | def __init__(self, xid=None, status=None): |
| 1552 | self.xid = xid |
| 1553 | if status != None: |
| 1554 | self.status = status |
| 1555 | else: |
| 1556 | self.status = 0 |
| 1557 | |
| 1558 | def pack(self): |
| 1559 | packed = [] |
| 1560 | packed.append(struct.pack("!B", self.version)) |
| 1561 | packed.append(struct.pack("!B", self.type)) |
| 1562 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1563 | packed.append(struct.pack("!L", self.xid)) |
| 1564 | packed.append(struct.pack("!L", self.experimenter)) |
| 1565 | packed.append(struct.pack("!L", self.subtype)) |
| 1566 | packed.append(struct.pack("!L", self.status)) |
| 1567 | length = sum([len(x) for x in packed]) |
| 1568 | packed[2] = struct.pack("!H", length) |
| 1569 | return ''.join(packed) |
| 1570 | |
| 1571 | @staticmethod |
| 1572 | def unpack(buf): |
| 1573 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 1574 | obj = bsn_pdu_rx_reply() |
| 1575 | if type(buf) == loxi.generic_util.OFReader: |
| 1576 | reader = buf |
| 1577 | else: |
| 1578 | reader = loxi.generic_util.OFReader(buf) |
| 1579 | _version = reader.read("!B")[0] |
| 1580 | assert(_version == 3) |
| 1581 | _type = reader.read("!B")[0] |
| 1582 | assert(_type == 4) |
| 1583 | _length = reader.read("!H")[0] |
| 1584 | obj.xid = reader.read("!L")[0] |
| 1585 | _experimenter = reader.read("!L")[0] |
| 1586 | assert(_experimenter == 6035143) |
| 1587 | _subtype = reader.read("!L")[0] |
| 1588 | assert(_subtype == 34) |
| 1589 | obj.status = reader.read("!L")[0] |
| 1590 | return obj |
| 1591 | |
| 1592 | def __eq__(self, other): |
| 1593 | if type(self) != type(other): return False |
| 1594 | if self.version != other.version: return False |
| 1595 | if self.type != other.type: return False |
| 1596 | if self.xid != other.xid: return False |
| 1597 | if self.status != other.status: return False |
| 1598 | return True |
| 1599 | |
| 1600 | def __ne__(self, other): |
| 1601 | return not self.__eq__(other) |
| 1602 | |
| 1603 | def __str__(self): |
| 1604 | return self.show() |
| 1605 | |
| 1606 | def show(self): |
| 1607 | import loxi.pp |
| 1608 | return loxi.pp.pp(self) |
| 1609 | |
| 1610 | def pretty_print(self, q): |
| 1611 | q.text("bsn_pdu_rx_reply {") |
| 1612 | with q.group(): |
| 1613 | with q.indent(2): |
| 1614 | q.breakable() |
| 1615 | q.text("xid = "); |
| 1616 | if self.xid != None: |
| 1617 | q.text("%#x" % self.xid) |
| 1618 | else: |
| 1619 | q.text('None') |
| 1620 | q.text(","); q.breakable() |
| 1621 | q.text("status = "); |
| 1622 | q.text("%#x" % self.status) |
| 1623 | q.breakable() |
| 1624 | q.text('}') |
| 1625 | |
| 1626 | class bsn_pdu_rx_request(Message): |
| 1627 | version = 3 |
| 1628 | type = 4 |
| 1629 | experimenter = 6035143 |
| 1630 | subtype = 33 |
| 1631 | |
| 1632 | def __init__(self, xid=None, timeout_ms=None, port_no=None, slot_num=None, data=None): |
| 1633 | self.xid = xid |
| 1634 | if timeout_ms != None: |
| 1635 | self.timeout_ms = timeout_ms |
| 1636 | else: |
| 1637 | self.timeout_ms = 0 |
| 1638 | if port_no != None: |
| 1639 | self.port_no = port_no |
| 1640 | else: |
| 1641 | self.port_no = 0 |
| 1642 | if slot_num != None: |
| 1643 | self.slot_num = slot_num |
| 1644 | else: |
| 1645 | self.slot_num = 0 |
| 1646 | if data != None: |
| 1647 | self.data = data |
| 1648 | else: |
| 1649 | self.data = '' |
| 1650 | |
| 1651 | def pack(self): |
| 1652 | packed = [] |
| 1653 | packed.append(struct.pack("!B", self.version)) |
| 1654 | packed.append(struct.pack("!B", self.type)) |
| 1655 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1656 | packed.append(struct.pack("!L", self.xid)) |
| 1657 | packed.append(struct.pack("!L", self.experimenter)) |
| 1658 | packed.append(struct.pack("!L", self.subtype)) |
| 1659 | packed.append(struct.pack("!L", self.timeout_ms)) |
| 1660 | packed.append(util.pack_port_no(self.port_no)) |
| 1661 | packed.append(struct.pack("!B", self.slot_num)) |
| 1662 | packed.append('\x00' * 3) |
| 1663 | packed.append(self.data) |
| 1664 | length = sum([len(x) for x in packed]) |
| 1665 | packed[2] = struct.pack("!H", length) |
| 1666 | return ''.join(packed) |
| 1667 | |
| 1668 | @staticmethod |
| 1669 | def unpack(buf): |
| 1670 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 1671 | obj = bsn_pdu_rx_request() |
| 1672 | if type(buf) == loxi.generic_util.OFReader: |
| 1673 | reader = buf |
| 1674 | else: |
| 1675 | reader = loxi.generic_util.OFReader(buf) |
| 1676 | _version = reader.read("!B")[0] |
| 1677 | assert(_version == 3) |
| 1678 | _type = reader.read("!B")[0] |
| 1679 | assert(_type == 4) |
| 1680 | _length = reader.read("!H")[0] |
| 1681 | obj.xid = reader.read("!L")[0] |
| 1682 | _experimenter = reader.read("!L")[0] |
| 1683 | assert(_experimenter == 6035143) |
| 1684 | _subtype = reader.read("!L")[0] |
| 1685 | assert(_subtype == 33) |
| 1686 | obj.timeout_ms = reader.read("!L")[0] |
| 1687 | obj.port_no = util.unpack_port_no(reader) |
| 1688 | obj.slot_num = reader.read("!B")[0] |
| 1689 | reader.skip(3) |
| 1690 | obj.data = str(reader.read_all()) |
| 1691 | return obj |
| 1692 | |
| 1693 | def __eq__(self, other): |
| 1694 | if type(self) != type(other): return False |
| 1695 | if self.version != other.version: return False |
| 1696 | if self.type != other.type: return False |
| 1697 | if self.xid != other.xid: return False |
| 1698 | if self.timeout_ms != other.timeout_ms: return False |
| 1699 | if self.port_no != other.port_no: return False |
| 1700 | if self.slot_num != other.slot_num: return False |
| 1701 | if self.data != other.data: return False |
| 1702 | return True |
| 1703 | |
| 1704 | def __ne__(self, other): |
| 1705 | return not self.__eq__(other) |
| 1706 | |
| 1707 | def __str__(self): |
| 1708 | return self.show() |
| 1709 | |
| 1710 | def show(self): |
| 1711 | import loxi.pp |
| 1712 | return loxi.pp.pp(self) |
| 1713 | |
| 1714 | def pretty_print(self, q): |
| 1715 | q.text("bsn_pdu_rx_request {") |
| 1716 | with q.group(): |
| 1717 | with q.indent(2): |
| 1718 | q.breakable() |
| 1719 | q.text("xid = "); |
| 1720 | if self.xid != None: |
| 1721 | q.text("%#x" % self.xid) |
| 1722 | else: |
| 1723 | q.text('None') |
| 1724 | q.text(","); q.breakable() |
| 1725 | q.text("timeout_ms = "); |
| 1726 | q.text("%#x" % self.timeout_ms) |
| 1727 | q.text(","); q.breakable() |
| 1728 | q.text("port_no = "); |
| 1729 | q.text(util.pretty_port(self.port_no)) |
| 1730 | q.text(","); q.breakable() |
| 1731 | q.text("slot_num = "); |
| 1732 | q.text("%#x" % self.slot_num) |
| 1733 | q.text(","); q.breakable() |
| 1734 | q.text("data = "); |
| 1735 | q.pp(self.data) |
| 1736 | q.breakable() |
| 1737 | q.text('}') |
| 1738 | |
| 1739 | class bsn_pdu_rx_timeout(Message): |
| 1740 | version = 3 |
| 1741 | type = 4 |
| 1742 | experimenter = 6035143 |
| 1743 | subtype = 35 |
| 1744 | |
| 1745 | def __init__(self, xid=None, port_no=None, slot_num=None): |
| 1746 | self.xid = xid |
| 1747 | if port_no != None: |
| 1748 | self.port_no = port_no |
| 1749 | else: |
| 1750 | self.port_no = 0 |
| 1751 | if slot_num != None: |
| 1752 | self.slot_num = slot_num |
| 1753 | else: |
| 1754 | self.slot_num = 0 |
| 1755 | |
| 1756 | def pack(self): |
| 1757 | packed = [] |
| 1758 | packed.append(struct.pack("!B", self.version)) |
| 1759 | packed.append(struct.pack("!B", self.type)) |
| 1760 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1761 | packed.append(struct.pack("!L", self.xid)) |
| 1762 | packed.append(struct.pack("!L", self.experimenter)) |
| 1763 | packed.append(struct.pack("!L", self.subtype)) |
| 1764 | packed.append(util.pack_port_no(self.port_no)) |
| 1765 | packed.append(struct.pack("!B", self.slot_num)) |
| 1766 | length = sum([len(x) for x in packed]) |
| 1767 | packed[2] = struct.pack("!H", length) |
| 1768 | return ''.join(packed) |
| 1769 | |
| 1770 | @staticmethod |
| 1771 | def unpack(buf): |
| 1772 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 1773 | obj = bsn_pdu_rx_timeout() |
| 1774 | if type(buf) == loxi.generic_util.OFReader: |
| 1775 | reader = buf |
| 1776 | else: |
| 1777 | reader = loxi.generic_util.OFReader(buf) |
| 1778 | _version = reader.read("!B")[0] |
| 1779 | assert(_version == 3) |
| 1780 | _type = reader.read("!B")[0] |
| 1781 | assert(_type == 4) |
| 1782 | _length = reader.read("!H")[0] |
| 1783 | obj.xid = reader.read("!L")[0] |
| 1784 | _experimenter = reader.read("!L")[0] |
| 1785 | assert(_experimenter == 6035143) |
| 1786 | _subtype = reader.read("!L")[0] |
| 1787 | assert(_subtype == 35) |
| 1788 | obj.port_no = util.unpack_port_no(reader) |
| 1789 | obj.slot_num = reader.read("!B")[0] |
| 1790 | return obj |
| 1791 | |
| 1792 | def __eq__(self, other): |
| 1793 | if type(self) != type(other): return False |
| 1794 | if self.version != other.version: return False |
| 1795 | if self.type != other.type: return False |
| 1796 | if self.xid != other.xid: return False |
| 1797 | if self.port_no != other.port_no: return False |
| 1798 | if self.slot_num != other.slot_num: return False |
| 1799 | return True |
| 1800 | |
| 1801 | def __ne__(self, other): |
| 1802 | return not self.__eq__(other) |
| 1803 | |
| 1804 | def __str__(self): |
| 1805 | return self.show() |
| 1806 | |
| 1807 | def show(self): |
| 1808 | import loxi.pp |
| 1809 | return loxi.pp.pp(self) |
| 1810 | |
| 1811 | def pretty_print(self, q): |
| 1812 | q.text("bsn_pdu_rx_timeout {") |
| 1813 | with q.group(): |
| 1814 | with q.indent(2): |
| 1815 | q.breakable() |
| 1816 | q.text("xid = "); |
| 1817 | if self.xid != None: |
| 1818 | q.text("%#x" % self.xid) |
| 1819 | else: |
| 1820 | q.text('None') |
| 1821 | q.text(","); q.breakable() |
| 1822 | q.text("port_no = "); |
| 1823 | q.text(util.pretty_port(self.port_no)) |
| 1824 | q.text(","); q.breakable() |
| 1825 | q.text("slot_num = "); |
| 1826 | q.text("%#x" % self.slot_num) |
| 1827 | q.breakable() |
| 1828 | q.text('}') |
| 1829 | |
| 1830 | class bsn_pdu_tx_reply(Message): |
| 1831 | version = 3 |
| 1832 | type = 4 |
| 1833 | experimenter = 6035143 |
| 1834 | subtype = 32 |
| 1835 | |
| 1836 | def __init__(self, xid=None, status=None): |
| 1837 | self.xid = xid |
| 1838 | if status != None: |
| 1839 | self.status = status |
| 1840 | else: |
| 1841 | self.status = 0 |
| 1842 | |
| 1843 | def pack(self): |
| 1844 | packed = [] |
| 1845 | packed.append(struct.pack("!B", self.version)) |
| 1846 | packed.append(struct.pack("!B", self.type)) |
| 1847 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1848 | packed.append(struct.pack("!L", self.xid)) |
| 1849 | packed.append(struct.pack("!L", self.experimenter)) |
| 1850 | packed.append(struct.pack("!L", self.subtype)) |
| 1851 | packed.append(struct.pack("!L", self.status)) |
| 1852 | length = sum([len(x) for x in packed]) |
| 1853 | packed[2] = struct.pack("!H", length) |
| 1854 | return ''.join(packed) |
| 1855 | |
| 1856 | @staticmethod |
| 1857 | def unpack(buf): |
| 1858 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 1859 | obj = bsn_pdu_tx_reply() |
| 1860 | if type(buf) == loxi.generic_util.OFReader: |
| 1861 | reader = buf |
| 1862 | else: |
| 1863 | reader = loxi.generic_util.OFReader(buf) |
| 1864 | _version = reader.read("!B")[0] |
| 1865 | assert(_version == 3) |
| 1866 | _type = reader.read("!B")[0] |
| 1867 | assert(_type == 4) |
| 1868 | _length = reader.read("!H")[0] |
| 1869 | obj.xid = reader.read("!L")[0] |
| 1870 | _experimenter = reader.read("!L")[0] |
| 1871 | assert(_experimenter == 6035143) |
| 1872 | _subtype = reader.read("!L")[0] |
| 1873 | assert(_subtype == 32) |
| 1874 | obj.status = reader.read("!L")[0] |
| 1875 | return obj |
| 1876 | |
| 1877 | def __eq__(self, other): |
| 1878 | if type(self) != type(other): return False |
| 1879 | if self.version != other.version: return False |
| 1880 | if self.type != other.type: return False |
| 1881 | if self.xid != other.xid: return False |
| 1882 | if self.status != other.status: return False |
| 1883 | return True |
| 1884 | |
| 1885 | def __ne__(self, other): |
| 1886 | return not self.__eq__(other) |
| 1887 | |
| 1888 | def __str__(self): |
| 1889 | return self.show() |
| 1890 | |
| 1891 | def show(self): |
| 1892 | import loxi.pp |
| 1893 | return loxi.pp.pp(self) |
| 1894 | |
| 1895 | def pretty_print(self, q): |
| 1896 | q.text("bsn_pdu_tx_reply {") |
| 1897 | with q.group(): |
| 1898 | with q.indent(2): |
| 1899 | q.breakable() |
| 1900 | q.text("xid = "); |
| 1901 | if self.xid != None: |
| 1902 | q.text("%#x" % self.xid) |
| 1903 | else: |
| 1904 | q.text('None') |
| 1905 | q.text(","); q.breakable() |
| 1906 | q.text("status = "); |
| 1907 | q.text("%#x" % self.status) |
| 1908 | q.breakable() |
| 1909 | q.text('}') |
| 1910 | |
| 1911 | class bsn_pdu_tx_request(Message): |
| 1912 | version = 3 |
| 1913 | type = 4 |
| 1914 | experimenter = 6035143 |
| 1915 | subtype = 31 |
| 1916 | |
| 1917 | def __init__(self, xid=None, tx_interval_ms=None, port_no=None, slot_num=None, data=None): |
| 1918 | self.xid = xid |
| 1919 | if tx_interval_ms != None: |
| 1920 | self.tx_interval_ms = tx_interval_ms |
| 1921 | else: |
| 1922 | self.tx_interval_ms = 0 |
| 1923 | if port_no != None: |
| 1924 | self.port_no = port_no |
| 1925 | else: |
| 1926 | self.port_no = 0 |
| 1927 | if slot_num != None: |
| 1928 | self.slot_num = slot_num |
| 1929 | else: |
| 1930 | self.slot_num = 0 |
| 1931 | if data != None: |
| 1932 | self.data = data |
| 1933 | else: |
| 1934 | self.data = '' |
| 1935 | |
| 1936 | def pack(self): |
| 1937 | packed = [] |
| 1938 | packed.append(struct.pack("!B", self.version)) |
| 1939 | packed.append(struct.pack("!B", self.type)) |
| 1940 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1941 | packed.append(struct.pack("!L", self.xid)) |
| 1942 | packed.append(struct.pack("!L", self.experimenter)) |
| 1943 | packed.append(struct.pack("!L", self.subtype)) |
| 1944 | packed.append(struct.pack("!L", self.tx_interval_ms)) |
| 1945 | packed.append(util.pack_port_no(self.port_no)) |
| 1946 | packed.append(struct.pack("!B", self.slot_num)) |
| 1947 | packed.append('\x00' * 3) |
| 1948 | packed.append(self.data) |
| 1949 | length = sum([len(x) for x in packed]) |
| 1950 | packed[2] = struct.pack("!H", length) |
| 1951 | return ''.join(packed) |
| 1952 | |
| 1953 | @staticmethod |
| 1954 | def unpack(buf): |
| 1955 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 1956 | obj = bsn_pdu_tx_request() |
| 1957 | if type(buf) == loxi.generic_util.OFReader: |
| 1958 | reader = buf |
| 1959 | else: |
| 1960 | reader = loxi.generic_util.OFReader(buf) |
| 1961 | _version = reader.read("!B")[0] |
| 1962 | assert(_version == 3) |
| 1963 | _type = reader.read("!B")[0] |
| 1964 | assert(_type == 4) |
| 1965 | _length = reader.read("!H")[0] |
| 1966 | obj.xid = reader.read("!L")[0] |
| 1967 | _experimenter = reader.read("!L")[0] |
| 1968 | assert(_experimenter == 6035143) |
| 1969 | _subtype = reader.read("!L")[0] |
| 1970 | assert(_subtype == 31) |
| 1971 | obj.tx_interval_ms = reader.read("!L")[0] |
| 1972 | obj.port_no = util.unpack_port_no(reader) |
| 1973 | obj.slot_num = reader.read("!B")[0] |
| 1974 | reader.skip(3) |
| 1975 | obj.data = str(reader.read_all()) |
| 1976 | return obj |
| 1977 | |
| 1978 | def __eq__(self, other): |
| 1979 | if type(self) != type(other): return False |
| 1980 | if self.version != other.version: return False |
| 1981 | if self.type != other.type: return False |
| 1982 | if self.xid != other.xid: return False |
| 1983 | if self.tx_interval_ms != other.tx_interval_ms: return False |
| 1984 | if self.port_no != other.port_no: return False |
| 1985 | if self.slot_num != other.slot_num: return False |
| 1986 | if self.data != other.data: return False |
| 1987 | return True |
| 1988 | |
| 1989 | def __ne__(self, other): |
| 1990 | return not self.__eq__(other) |
| 1991 | |
| 1992 | def __str__(self): |
| 1993 | return self.show() |
| 1994 | |
| 1995 | def show(self): |
| 1996 | import loxi.pp |
| 1997 | return loxi.pp.pp(self) |
| 1998 | |
| 1999 | def pretty_print(self, q): |
| 2000 | q.text("bsn_pdu_tx_request {") |
| 2001 | with q.group(): |
| 2002 | with q.indent(2): |
| 2003 | q.breakable() |
| 2004 | q.text("xid = "); |
| 2005 | if self.xid != None: |
| 2006 | q.text("%#x" % self.xid) |
| 2007 | else: |
| 2008 | q.text('None') |
| 2009 | q.text(","); q.breakable() |
| 2010 | q.text("tx_interval_ms = "); |
| 2011 | q.text("%#x" % self.tx_interval_ms) |
| 2012 | q.text(","); q.breakable() |
| 2013 | q.text("port_no = "); |
| 2014 | q.text(util.pretty_port(self.port_no)) |
| 2015 | q.text(","); q.breakable() |
| 2016 | q.text("slot_num = "); |
| 2017 | q.text("%#x" % self.slot_num) |
| 2018 | q.text(","); q.breakable() |
| 2019 | q.text("data = "); |
| 2020 | q.pp(self.data) |
| 2021 | q.breakable() |
| 2022 | q.text('}') |
| 2023 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2024 | class bsn_set_mirroring(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2025 | version = 3 |
| 2026 | type = 4 |
| 2027 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2028 | subtype = 3 |
| 2029 | |
| 2030 | def __init__(self, xid=None, report_mirror_ports=None): |
| 2031 | self.xid = xid |
| 2032 | if report_mirror_ports != None: |
| 2033 | self.report_mirror_ports = report_mirror_ports |
| 2034 | else: |
| 2035 | self.report_mirror_ports = 0 |
| 2036 | |
| 2037 | def pack(self): |
| 2038 | packed = [] |
| 2039 | packed.append(struct.pack("!B", self.version)) |
| 2040 | packed.append(struct.pack("!B", self.type)) |
| 2041 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2042 | packed.append(struct.pack("!L", self.xid)) |
| 2043 | packed.append(struct.pack("!L", self.experimenter)) |
| 2044 | packed.append(struct.pack("!L", self.subtype)) |
| 2045 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 2046 | packed.append('\x00' * 3) |
| 2047 | length = sum([len(x) for x in packed]) |
| 2048 | packed[2] = struct.pack("!H", length) |
| 2049 | return ''.join(packed) |
| 2050 | |
| 2051 | @staticmethod |
| 2052 | def unpack(buf): |
| 2053 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 2054 | obj = bsn_set_mirroring() |
| 2055 | if type(buf) == loxi.generic_util.OFReader: |
| 2056 | reader = buf |
| 2057 | else: |
| 2058 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2059 | _version = reader.read("!B")[0] |
| 2060 | assert(_version == 3) |
| 2061 | _type = reader.read("!B")[0] |
| 2062 | assert(_type == 4) |
| 2063 | _length = reader.read("!H")[0] |
| 2064 | obj.xid = reader.read("!L")[0] |
| 2065 | _experimenter = reader.read("!L")[0] |
| 2066 | assert(_experimenter == 6035143) |
| 2067 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2068 | assert(_subtype == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2069 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2070 | reader.skip(3) |
| 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.report_mirror_ports != other.report_mirror_ports: 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_set_mirroring {") |
| 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("report_mirror_ports = "); |
| 2103 | q.text("%#x" % self.report_mirror_ports) |
| 2104 | q.breakable() |
| 2105 | q.text('}') |
| 2106 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2107 | class bsn_set_pktin_suppression_reply(Message): |
| 2108 | version = 3 |
| 2109 | type = 4 |
| 2110 | experimenter = 6035143 |
| 2111 | subtype = 25 |
| 2112 | |
| 2113 | def __init__(self, xid=None, status=None): |
| 2114 | self.xid = xid |
| 2115 | if status != None: |
| 2116 | self.status = status |
| 2117 | else: |
| 2118 | self.status = 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.status)) |
| 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_set_pktin_suppression_reply() |
| 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 == 3) |
| 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 == 25) |
| 2151 | obj.status = 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.status != other.status: 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_set_pktin_suppression_reply {") |
| 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("status = "); |
| 2184 | q.text("%#x" % self.status) |
| 2185 | q.breakable() |
| 2186 | q.text('}') |
| 2187 | |
| 2188 | class bsn_set_pktin_suppression_request(Message): |
| 2189 | version = 3 |
| 2190 | type = 4 |
| 2191 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2192 | subtype = 11 |
| 2193 | |
| 2194 | def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None): |
| 2195 | self.xid = xid |
| 2196 | if enabled != None: |
| 2197 | self.enabled = enabled |
| 2198 | else: |
| 2199 | self.enabled = 0 |
| 2200 | if idle_timeout != None: |
| 2201 | self.idle_timeout = idle_timeout |
| 2202 | else: |
| 2203 | self.idle_timeout = 0 |
| 2204 | if hard_timeout != None: |
| 2205 | self.hard_timeout = hard_timeout |
| 2206 | else: |
| 2207 | self.hard_timeout = 0 |
| 2208 | if priority != None: |
| 2209 | self.priority = priority |
| 2210 | else: |
| 2211 | self.priority = 0 |
| 2212 | if cookie != None: |
| 2213 | self.cookie = cookie |
| 2214 | else: |
| 2215 | self.cookie = 0 |
| 2216 | |
| 2217 | def pack(self): |
| 2218 | packed = [] |
| 2219 | packed.append(struct.pack("!B", self.version)) |
| 2220 | packed.append(struct.pack("!B", self.type)) |
| 2221 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2222 | packed.append(struct.pack("!L", self.xid)) |
| 2223 | packed.append(struct.pack("!L", self.experimenter)) |
| 2224 | packed.append(struct.pack("!L", self.subtype)) |
| 2225 | packed.append(struct.pack("!B", self.enabled)) |
| 2226 | packed.append('\x00' * 1) |
| 2227 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 2228 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 2229 | packed.append(struct.pack("!H", self.priority)) |
| 2230 | packed.append(struct.pack("!Q", self.cookie)) |
| 2231 | length = sum([len(x) for x in packed]) |
| 2232 | packed[2] = struct.pack("!H", length) |
| 2233 | return ''.join(packed) |
| 2234 | |
| 2235 | @staticmethod |
| 2236 | def unpack(buf): |
| 2237 | 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] | 2238 | obj = bsn_set_pktin_suppression_request() |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2239 | if type(buf) == loxi.generic_util.OFReader: |
| 2240 | reader = buf |
| 2241 | else: |
| 2242 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2243 | _version = reader.read("!B")[0] |
| 2244 | assert(_version == 3) |
| 2245 | _type = reader.read("!B")[0] |
| 2246 | assert(_type == 4) |
| 2247 | _length = reader.read("!H")[0] |
| 2248 | obj.xid = reader.read("!L")[0] |
| 2249 | _experimenter = reader.read("!L")[0] |
| 2250 | assert(_experimenter == 6035143) |
| 2251 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2252 | assert(_subtype == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2253 | obj.enabled = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2254 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2255 | obj.idle_timeout = reader.read("!H")[0] |
| 2256 | obj.hard_timeout = reader.read("!H")[0] |
| 2257 | obj.priority = reader.read("!H")[0] |
| 2258 | obj.cookie = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2259 | return obj |
| 2260 | |
| 2261 | def __eq__(self, other): |
| 2262 | if type(self) != type(other): return False |
| 2263 | if self.version != other.version: return False |
| 2264 | if self.type != other.type: return False |
| 2265 | if self.xid != other.xid: return False |
| 2266 | if self.enabled != other.enabled: return False |
| 2267 | if self.idle_timeout != other.idle_timeout: return False |
| 2268 | if self.hard_timeout != other.hard_timeout: return False |
| 2269 | if self.priority != other.priority: return False |
| 2270 | if self.cookie != other.cookie: return False |
| 2271 | return True |
| 2272 | |
| 2273 | def __ne__(self, other): |
| 2274 | return not self.__eq__(other) |
| 2275 | |
| 2276 | def __str__(self): |
| 2277 | return self.show() |
| 2278 | |
| 2279 | def show(self): |
| 2280 | import loxi.pp |
| 2281 | return loxi.pp.pp(self) |
| 2282 | |
| 2283 | def pretty_print(self, q): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2284 | q.text("bsn_set_pktin_suppression_request {") |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2285 | with q.group(): |
| 2286 | with q.indent(2): |
| 2287 | q.breakable() |
| 2288 | q.text("xid = "); |
| 2289 | if self.xid != None: |
| 2290 | q.text("%#x" % self.xid) |
| 2291 | else: |
| 2292 | q.text('None') |
| 2293 | q.text(","); q.breakable() |
| 2294 | q.text("enabled = "); |
| 2295 | q.text("%#x" % self.enabled) |
| 2296 | q.text(","); q.breakable() |
| 2297 | q.text("idle_timeout = "); |
| 2298 | q.text("%#x" % self.idle_timeout) |
| 2299 | q.text(","); q.breakable() |
| 2300 | q.text("hard_timeout = "); |
| 2301 | q.text("%#x" % self.hard_timeout) |
| 2302 | q.text(","); q.breakable() |
| 2303 | q.text("priority = "); |
| 2304 | q.text("%#x" % self.priority) |
| 2305 | q.text(","); q.breakable() |
| 2306 | q.text("cookie = "); |
| 2307 | q.text("%#x" % self.cookie) |
| 2308 | q.breakable() |
| 2309 | q.text('}') |
| 2310 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2311 | class bsn_virtual_port_create_reply(Message): |
| 2312 | version = 3 |
| 2313 | type = 4 |
| 2314 | experimenter = 6035143 |
| 2315 | subtype = 16 |
| 2316 | |
| 2317 | def __init__(self, xid=None, status=None, vport_no=None): |
| 2318 | self.xid = xid |
| 2319 | if status != None: |
| 2320 | self.status = status |
| 2321 | else: |
| 2322 | self.status = 0 |
| 2323 | if vport_no != None: |
| 2324 | self.vport_no = vport_no |
| 2325 | else: |
| 2326 | self.vport_no = 0 |
| 2327 | |
| 2328 | def pack(self): |
| 2329 | packed = [] |
| 2330 | packed.append(struct.pack("!B", self.version)) |
| 2331 | packed.append(struct.pack("!B", self.type)) |
| 2332 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2333 | packed.append(struct.pack("!L", self.xid)) |
| 2334 | packed.append(struct.pack("!L", self.experimenter)) |
| 2335 | packed.append(struct.pack("!L", self.subtype)) |
| 2336 | packed.append(struct.pack("!L", self.status)) |
| 2337 | packed.append(struct.pack("!L", self.vport_no)) |
| 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 = bsn_virtual_port_create_reply() |
| 2346 | if type(buf) == loxi.generic_util.OFReader: |
| 2347 | reader = buf |
| 2348 | else: |
| 2349 | reader = loxi.generic_util.OFReader(buf) |
| 2350 | _version = reader.read("!B")[0] |
| 2351 | assert(_version == 3) |
| 2352 | _type = reader.read("!B")[0] |
| 2353 | assert(_type == 4) |
| 2354 | _length = reader.read("!H")[0] |
| 2355 | obj.xid = reader.read("!L")[0] |
| 2356 | _experimenter = reader.read("!L")[0] |
| 2357 | assert(_experimenter == 6035143) |
| 2358 | _subtype = reader.read("!L")[0] |
| 2359 | assert(_subtype == 16) |
| 2360 | obj.status = reader.read("!L")[0] |
| 2361 | obj.vport_no = reader.read("!L")[0] |
| 2362 | return obj |
| 2363 | |
| 2364 | def __eq__(self, other): |
| 2365 | if type(self) != type(other): return False |
| 2366 | if self.version != other.version: return False |
| 2367 | if self.type != other.type: return False |
| 2368 | if self.xid != other.xid: return False |
| 2369 | if self.status != other.status: return False |
| 2370 | if self.vport_no != other.vport_no: return False |
| 2371 | return True |
| 2372 | |
| 2373 | def __ne__(self, other): |
| 2374 | return not self.__eq__(other) |
| 2375 | |
| 2376 | def __str__(self): |
| 2377 | return self.show() |
| 2378 | |
| 2379 | def show(self): |
| 2380 | import loxi.pp |
| 2381 | return loxi.pp.pp(self) |
| 2382 | |
| 2383 | def pretty_print(self, q): |
| 2384 | q.text("bsn_virtual_port_create_reply {") |
| 2385 | with q.group(): |
| 2386 | with q.indent(2): |
| 2387 | q.breakable() |
| 2388 | q.text("xid = "); |
| 2389 | if self.xid != None: |
| 2390 | q.text("%#x" % self.xid) |
| 2391 | else: |
| 2392 | q.text('None') |
| 2393 | q.text(","); q.breakable() |
| 2394 | q.text("status = "); |
| 2395 | q.text("%#x" % self.status) |
| 2396 | q.text(","); q.breakable() |
| 2397 | q.text("vport_no = "); |
| 2398 | q.text("%#x" % self.vport_no) |
| 2399 | q.breakable() |
| 2400 | q.text('}') |
| 2401 | |
| 2402 | class bsn_virtual_port_create_request(Message): |
| 2403 | version = 3 |
| 2404 | type = 4 |
| 2405 | experimenter = 6035143 |
| 2406 | subtype = 15 |
| 2407 | |
| 2408 | def __init__(self, xid=None, vport=None): |
| 2409 | self.xid = xid |
| 2410 | if vport != None: |
| 2411 | self.vport = vport |
| 2412 | else: |
| 2413 | self.vport = common.bsn_vport_q_in_q() |
| 2414 | |
| 2415 | def pack(self): |
| 2416 | packed = [] |
| 2417 | packed.append(struct.pack("!B", self.version)) |
| 2418 | packed.append(struct.pack("!B", self.type)) |
| 2419 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2420 | packed.append(struct.pack("!L", self.xid)) |
| 2421 | packed.append(struct.pack("!L", self.experimenter)) |
| 2422 | packed.append(struct.pack("!L", self.subtype)) |
| 2423 | packed.append(self.vport.pack()) |
| 2424 | length = sum([len(x) for x in packed]) |
| 2425 | packed[2] = struct.pack("!H", length) |
| 2426 | return ''.join(packed) |
| 2427 | |
| 2428 | @staticmethod |
| 2429 | def unpack(buf): |
| 2430 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 2431 | obj = bsn_virtual_port_create_request() |
| 2432 | if type(buf) == loxi.generic_util.OFReader: |
| 2433 | reader = buf |
| 2434 | else: |
| 2435 | reader = loxi.generic_util.OFReader(buf) |
| 2436 | _version = reader.read("!B")[0] |
| 2437 | assert(_version == 3) |
| 2438 | _type = reader.read("!B")[0] |
| 2439 | assert(_type == 4) |
| 2440 | _length = reader.read("!H")[0] |
| 2441 | obj.xid = reader.read("!L")[0] |
| 2442 | _experimenter = reader.read("!L")[0] |
| 2443 | assert(_experimenter == 6035143) |
| 2444 | _subtype = reader.read("!L")[0] |
| 2445 | assert(_subtype == 15) |
| 2446 | obj.vport = common.bsn_vport_q_in_q.unpack(reader) |
| 2447 | return obj |
| 2448 | |
| 2449 | def __eq__(self, other): |
| 2450 | if type(self) != type(other): return False |
| 2451 | if self.version != other.version: return False |
| 2452 | if self.type != other.type: return False |
| 2453 | if self.xid != other.xid: return False |
| 2454 | if self.vport != other.vport: return False |
| 2455 | return True |
| 2456 | |
| 2457 | def __ne__(self, other): |
| 2458 | return not self.__eq__(other) |
| 2459 | |
| 2460 | def __str__(self): |
| 2461 | return self.show() |
| 2462 | |
| 2463 | def show(self): |
| 2464 | import loxi.pp |
| 2465 | return loxi.pp.pp(self) |
| 2466 | |
| 2467 | def pretty_print(self, q): |
| 2468 | q.text("bsn_virtual_port_create_request {") |
| 2469 | with q.group(): |
| 2470 | with q.indent(2): |
| 2471 | q.breakable() |
| 2472 | q.text("xid = "); |
| 2473 | if self.xid != None: |
| 2474 | q.text("%#x" % self.xid) |
| 2475 | else: |
| 2476 | q.text('None') |
| 2477 | q.text(","); q.breakable() |
| 2478 | q.text("vport = "); |
| 2479 | q.pp(self.vport) |
| 2480 | q.breakable() |
| 2481 | q.text('}') |
| 2482 | |
| 2483 | class bsn_virtual_port_remove_reply(Message): |
| 2484 | version = 3 |
| 2485 | type = 4 |
| 2486 | experimenter = 6035143 |
| 2487 | subtype = 26 |
| 2488 | |
| 2489 | def __init__(self, xid=None, status=None): |
| 2490 | self.xid = xid |
| 2491 | if status != None: |
| 2492 | self.status = status |
| 2493 | else: |
| 2494 | self.status = 0 |
| 2495 | |
| 2496 | def pack(self): |
| 2497 | packed = [] |
| 2498 | packed.append(struct.pack("!B", self.version)) |
| 2499 | packed.append(struct.pack("!B", self.type)) |
| 2500 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2501 | packed.append(struct.pack("!L", self.xid)) |
| 2502 | packed.append(struct.pack("!L", self.experimenter)) |
| 2503 | packed.append(struct.pack("!L", self.subtype)) |
| 2504 | packed.append(struct.pack("!L", self.status)) |
| 2505 | length = sum([len(x) for x in packed]) |
| 2506 | packed[2] = struct.pack("!H", length) |
| 2507 | return ''.join(packed) |
| 2508 | |
| 2509 | @staticmethod |
| 2510 | def unpack(buf): |
| 2511 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 2512 | obj = bsn_virtual_port_remove_reply() |
| 2513 | if type(buf) == loxi.generic_util.OFReader: |
| 2514 | reader = buf |
| 2515 | else: |
| 2516 | reader = loxi.generic_util.OFReader(buf) |
| 2517 | _version = reader.read("!B")[0] |
| 2518 | assert(_version == 3) |
| 2519 | _type = reader.read("!B")[0] |
| 2520 | assert(_type == 4) |
| 2521 | _length = reader.read("!H")[0] |
| 2522 | obj.xid = reader.read("!L")[0] |
| 2523 | _experimenter = reader.read("!L")[0] |
| 2524 | assert(_experimenter == 6035143) |
| 2525 | _subtype = reader.read("!L")[0] |
| 2526 | assert(_subtype == 26) |
| 2527 | obj.status = reader.read("!L")[0] |
| 2528 | return obj |
| 2529 | |
| 2530 | def __eq__(self, other): |
| 2531 | if type(self) != type(other): return False |
| 2532 | if self.version != other.version: return False |
| 2533 | if self.type != other.type: return False |
| 2534 | if self.xid != other.xid: return False |
| 2535 | if self.status != other.status: return False |
| 2536 | return True |
| 2537 | |
| 2538 | def __ne__(self, other): |
| 2539 | return not self.__eq__(other) |
| 2540 | |
| 2541 | def __str__(self): |
| 2542 | return self.show() |
| 2543 | |
| 2544 | def show(self): |
| 2545 | import loxi.pp |
| 2546 | return loxi.pp.pp(self) |
| 2547 | |
| 2548 | def pretty_print(self, q): |
| 2549 | q.text("bsn_virtual_port_remove_reply {") |
| 2550 | with q.group(): |
| 2551 | with q.indent(2): |
| 2552 | q.breakable() |
| 2553 | q.text("xid = "); |
| 2554 | if self.xid != None: |
| 2555 | q.text("%#x" % self.xid) |
| 2556 | else: |
| 2557 | q.text('None') |
| 2558 | q.text(","); q.breakable() |
| 2559 | q.text("status = "); |
| 2560 | q.text("%#x" % self.status) |
| 2561 | q.breakable() |
| 2562 | q.text('}') |
| 2563 | |
| 2564 | class bsn_virtual_port_remove_request(Message): |
| 2565 | version = 3 |
| 2566 | type = 4 |
| 2567 | experimenter = 6035143 |
| 2568 | subtype = 17 |
| 2569 | |
| 2570 | def __init__(self, xid=None, vport_no=None): |
| 2571 | self.xid = xid |
| 2572 | if vport_no != None: |
| 2573 | self.vport_no = vport_no |
| 2574 | else: |
| 2575 | self.vport_no = 0 |
| 2576 | |
| 2577 | def pack(self): |
| 2578 | packed = [] |
| 2579 | packed.append(struct.pack("!B", self.version)) |
| 2580 | packed.append(struct.pack("!B", self.type)) |
| 2581 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2582 | packed.append(struct.pack("!L", self.xid)) |
| 2583 | packed.append(struct.pack("!L", self.experimenter)) |
| 2584 | packed.append(struct.pack("!L", self.subtype)) |
| 2585 | packed.append(struct.pack("!L", self.vport_no)) |
| 2586 | length = sum([len(x) for x in packed]) |
| 2587 | packed[2] = struct.pack("!H", length) |
| 2588 | return ''.join(packed) |
| 2589 | |
| 2590 | @staticmethod |
| 2591 | def unpack(buf): |
| 2592 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 2593 | obj = bsn_virtual_port_remove_request() |
| 2594 | if type(buf) == loxi.generic_util.OFReader: |
| 2595 | reader = buf |
| 2596 | else: |
| 2597 | reader = loxi.generic_util.OFReader(buf) |
| 2598 | _version = reader.read("!B")[0] |
| 2599 | assert(_version == 3) |
| 2600 | _type = reader.read("!B")[0] |
| 2601 | assert(_type == 4) |
| 2602 | _length = reader.read("!H")[0] |
| 2603 | obj.xid = reader.read("!L")[0] |
| 2604 | _experimenter = reader.read("!L")[0] |
| 2605 | assert(_experimenter == 6035143) |
| 2606 | _subtype = reader.read("!L")[0] |
| 2607 | assert(_subtype == 17) |
| 2608 | obj.vport_no = reader.read("!L")[0] |
| 2609 | return obj |
| 2610 | |
| 2611 | def __eq__(self, other): |
| 2612 | if type(self) != type(other): return False |
| 2613 | if self.version != other.version: return False |
| 2614 | if self.type != other.type: return False |
| 2615 | if self.xid != other.xid: return False |
| 2616 | if self.vport_no != other.vport_no: return False |
| 2617 | return True |
| 2618 | |
| 2619 | def __ne__(self, other): |
| 2620 | return not self.__eq__(other) |
| 2621 | |
| 2622 | def __str__(self): |
| 2623 | return self.show() |
| 2624 | |
| 2625 | def show(self): |
| 2626 | import loxi.pp |
| 2627 | return loxi.pp.pp(self) |
| 2628 | |
| 2629 | def pretty_print(self, q): |
| 2630 | q.text("bsn_virtual_port_remove_request {") |
| 2631 | with q.group(): |
| 2632 | with q.indent(2): |
| 2633 | q.breakable() |
| 2634 | q.text("xid = "); |
| 2635 | if self.xid != None: |
| 2636 | q.text("%#x" % self.xid) |
| 2637 | else: |
| 2638 | q.text('None') |
| 2639 | q.text(","); q.breakable() |
| 2640 | q.text("vport_no = "); |
| 2641 | q.text("%#x" % self.vport_no) |
| 2642 | q.breakable() |
| 2643 | q.text('}') |
| 2644 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2645 | class desc_stats_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2646 | version = 3 |
| 2647 | type = 19 |
| 2648 | stats_type = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2649 | |
| 2650 | def __init__(self, xid=None, flags=None, mfr_desc=None, hw_desc=None, sw_desc=None, serial_num=None, dp_desc=None): |
| 2651 | self.xid = xid |
| 2652 | if flags != None: |
| 2653 | self.flags = flags |
| 2654 | else: |
| 2655 | self.flags = 0 |
| 2656 | if mfr_desc != None: |
| 2657 | self.mfr_desc = mfr_desc |
| 2658 | else: |
| 2659 | self.mfr_desc = "" |
| 2660 | if hw_desc != None: |
| 2661 | self.hw_desc = hw_desc |
| 2662 | else: |
| 2663 | self.hw_desc = "" |
| 2664 | if sw_desc != None: |
| 2665 | self.sw_desc = sw_desc |
| 2666 | else: |
| 2667 | self.sw_desc = "" |
| 2668 | if serial_num != None: |
| 2669 | self.serial_num = serial_num |
| 2670 | else: |
| 2671 | self.serial_num = "" |
| 2672 | if dp_desc != None: |
| 2673 | self.dp_desc = dp_desc |
| 2674 | else: |
| 2675 | self.dp_desc = "" |
| 2676 | |
| 2677 | def pack(self): |
| 2678 | packed = [] |
| 2679 | packed.append(struct.pack("!B", self.version)) |
| 2680 | packed.append(struct.pack("!B", self.type)) |
| 2681 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2682 | packed.append(struct.pack("!L", self.xid)) |
| 2683 | packed.append(struct.pack("!H", self.stats_type)) |
| 2684 | packed.append(struct.pack("!H", self.flags)) |
| 2685 | packed.append('\x00' * 4) |
| 2686 | packed.append(struct.pack("!256s", self.mfr_desc)) |
| 2687 | packed.append(struct.pack("!256s", self.hw_desc)) |
| 2688 | packed.append(struct.pack("!256s", self.sw_desc)) |
| 2689 | packed.append(struct.pack("!32s", self.serial_num)) |
| 2690 | packed.append(struct.pack("!256s", self.dp_desc)) |
| 2691 | length = sum([len(x) for x in packed]) |
| 2692 | packed[2] = struct.pack("!H", length) |
| 2693 | return ''.join(packed) |
| 2694 | |
| 2695 | @staticmethod |
| 2696 | def unpack(buf): |
| 2697 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 2698 | obj = desc_stats_reply() |
| 2699 | if type(buf) == loxi.generic_util.OFReader: |
| 2700 | reader = buf |
| 2701 | else: |
| 2702 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2703 | _version = reader.read("!B")[0] |
| 2704 | assert(_version == 3) |
| 2705 | _type = reader.read("!B")[0] |
| 2706 | assert(_type == 19) |
| 2707 | _length = reader.read("!H")[0] |
| 2708 | obj.xid = reader.read("!L")[0] |
| 2709 | _stats_type = reader.read("!H")[0] |
| 2710 | assert(_stats_type == 0) |
| 2711 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2712 | reader.skip(4) |
| 2713 | obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00") |
| 2714 | obj.hw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 2715 | obj.sw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 2716 | obj.serial_num = reader.read("!32s")[0].rstrip("\x00") |
| 2717 | obj.dp_desc = reader.read("!256s")[0].rstrip("\x00") |
| 2718 | return obj |
| 2719 | |
| 2720 | def __eq__(self, other): |
| 2721 | if type(self) != type(other): return False |
| 2722 | if self.version != other.version: return False |
| 2723 | if self.type != other.type: return False |
| 2724 | if self.xid != other.xid: return False |
| 2725 | if self.flags != other.flags: return False |
| 2726 | if self.mfr_desc != other.mfr_desc: return False |
| 2727 | if self.hw_desc != other.hw_desc: return False |
| 2728 | if self.sw_desc != other.sw_desc: return False |
| 2729 | if self.serial_num != other.serial_num: return False |
| 2730 | if self.dp_desc != other.dp_desc: return False |
| 2731 | return True |
| 2732 | |
| 2733 | def __ne__(self, other): |
| 2734 | return not self.__eq__(other) |
| 2735 | |
| 2736 | def __str__(self): |
| 2737 | return self.show() |
| 2738 | |
| 2739 | def show(self): |
| 2740 | import loxi.pp |
| 2741 | return loxi.pp.pp(self) |
| 2742 | |
| 2743 | def pretty_print(self, q): |
| 2744 | q.text("desc_stats_reply {") |
| 2745 | with q.group(): |
| 2746 | with q.indent(2): |
| 2747 | q.breakable() |
| 2748 | q.text("xid = "); |
| 2749 | if self.xid != None: |
| 2750 | q.text("%#x" % self.xid) |
| 2751 | else: |
| 2752 | q.text('None') |
| 2753 | q.text(","); q.breakable() |
| 2754 | q.text("flags = "); |
| 2755 | q.text("%#x" % self.flags) |
| 2756 | q.text(","); q.breakable() |
| 2757 | q.text("mfr_desc = "); |
| 2758 | q.pp(self.mfr_desc) |
| 2759 | q.text(","); q.breakable() |
| 2760 | q.text("hw_desc = "); |
| 2761 | q.pp(self.hw_desc) |
| 2762 | q.text(","); q.breakable() |
| 2763 | q.text("sw_desc = "); |
| 2764 | q.pp(self.sw_desc) |
| 2765 | q.text(","); q.breakable() |
| 2766 | q.text("serial_num = "); |
| 2767 | q.pp(self.serial_num) |
| 2768 | q.text(","); q.breakable() |
| 2769 | q.text("dp_desc = "); |
| 2770 | q.pp(self.dp_desc) |
| 2771 | q.breakable() |
| 2772 | q.text('}') |
| 2773 | |
| 2774 | class desc_stats_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2775 | version = 3 |
| 2776 | type = 18 |
| 2777 | stats_type = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2778 | |
| 2779 | def __init__(self, xid=None, flags=None): |
| 2780 | self.xid = xid |
| 2781 | if flags != None: |
| 2782 | self.flags = flags |
| 2783 | else: |
| 2784 | self.flags = 0 |
| 2785 | |
| 2786 | def pack(self): |
| 2787 | packed = [] |
| 2788 | packed.append(struct.pack("!B", self.version)) |
| 2789 | packed.append(struct.pack("!B", self.type)) |
| 2790 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2791 | packed.append(struct.pack("!L", self.xid)) |
| 2792 | packed.append(struct.pack("!H", self.stats_type)) |
| 2793 | packed.append(struct.pack("!H", self.flags)) |
| 2794 | packed.append('\x00' * 4) |
| 2795 | length = sum([len(x) for x in packed]) |
| 2796 | packed[2] = struct.pack("!H", length) |
| 2797 | return ''.join(packed) |
| 2798 | |
| 2799 | @staticmethod |
| 2800 | def unpack(buf): |
| 2801 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 2802 | obj = desc_stats_request() |
| 2803 | if type(buf) == loxi.generic_util.OFReader: |
| 2804 | reader = buf |
| 2805 | else: |
| 2806 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2807 | _version = reader.read("!B")[0] |
| 2808 | assert(_version == 3) |
| 2809 | _type = reader.read("!B")[0] |
| 2810 | assert(_type == 18) |
| 2811 | _length = reader.read("!H")[0] |
| 2812 | obj.xid = reader.read("!L")[0] |
| 2813 | _stats_type = reader.read("!H")[0] |
| 2814 | assert(_stats_type == 0) |
| 2815 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2816 | reader.skip(4) |
| 2817 | return obj |
| 2818 | |
| 2819 | def __eq__(self, other): |
| 2820 | if type(self) != type(other): return False |
| 2821 | if self.version != other.version: return False |
| 2822 | if self.type != other.type: return False |
| 2823 | if self.xid != other.xid: return False |
| 2824 | if self.flags != other.flags: return False |
| 2825 | return True |
| 2826 | |
| 2827 | def __ne__(self, other): |
| 2828 | return not self.__eq__(other) |
| 2829 | |
| 2830 | def __str__(self): |
| 2831 | return self.show() |
| 2832 | |
| 2833 | def show(self): |
| 2834 | import loxi.pp |
| 2835 | return loxi.pp.pp(self) |
| 2836 | |
| 2837 | def pretty_print(self, q): |
| 2838 | q.text("desc_stats_request {") |
| 2839 | with q.group(): |
| 2840 | with q.indent(2): |
| 2841 | q.breakable() |
| 2842 | q.text("xid = "); |
| 2843 | if self.xid != None: |
| 2844 | q.text("%#x" % self.xid) |
| 2845 | else: |
| 2846 | q.text('None') |
| 2847 | q.text(","); q.breakable() |
| 2848 | q.text("flags = "); |
| 2849 | q.text("%#x" % self.flags) |
| 2850 | q.breakable() |
| 2851 | q.text('}') |
| 2852 | |
| 2853 | class echo_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2854 | version = 3 |
| 2855 | type = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2856 | |
| 2857 | def __init__(self, xid=None, data=None): |
| 2858 | self.xid = xid |
| 2859 | if data != None: |
| 2860 | self.data = data |
| 2861 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2862 | self.data = '' |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2863 | |
| 2864 | def pack(self): |
| 2865 | packed = [] |
| 2866 | packed.append(struct.pack("!B", self.version)) |
| 2867 | packed.append(struct.pack("!B", self.type)) |
| 2868 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2869 | packed.append(struct.pack("!L", self.xid)) |
| 2870 | packed.append(self.data) |
| 2871 | length = sum([len(x) for x in packed]) |
| 2872 | packed[2] = struct.pack("!H", length) |
| 2873 | return ''.join(packed) |
| 2874 | |
| 2875 | @staticmethod |
| 2876 | def unpack(buf): |
| 2877 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 2878 | obj = echo_reply() |
| 2879 | if type(buf) == loxi.generic_util.OFReader: |
| 2880 | reader = buf |
| 2881 | else: |
| 2882 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2883 | _version = reader.read("!B")[0] |
| 2884 | assert(_version == 3) |
| 2885 | _type = reader.read("!B")[0] |
| 2886 | assert(_type == 3) |
| 2887 | _length = reader.read("!H")[0] |
| 2888 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2889 | obj.data = str(reader.read_all()) |
| 2890 | return obj |
| 2891 | |
| 2892 | def __eq__(self, other): |
| 2893 | if type(self) != type(other): return False |
| 2894 | if self.version != other.version: return False |
| 2895 | if self.type != other.type: return False |
| 2896 | if self.xid != other.xid: return False |
| 2897 | if self.data != other.data: return False |
| 2898 | return True |
| 2899 | |
| 2900 | def __ne__(self, other): |
| 2901 | return not self.__eq__(other) |
| 2902 | |
| 2903 | def __str__(self): |
| 2904 | return self.show() |
| 2905 | |
| 2906 | def show(self): |
| 2907 | import loxi.pp |
| 2908 | return loxi.pp.pp(self) |
| 2909 | |
| 2910 | def pretty_print(self, q): |
| 2911 | q.text("echo_reply {") |
| 2912 | with q.group(): |
| 2913 | with q.indent(2): |
| 2914 | q.breakable() |
| 2915 | q.text("xid = "); |
| 2916 | if self.xid != None: |
| 2917 | q.text("%#x" % self.xid) |
| 2918 | else: |
| 2919 | q.text('None') |
| 2920 | q.text(","); q.breakable() |
| 2921 | q.text("data = "); |
| 2922 | q.pp(self.data) |
| 2923 | q.breakable() |
| 2924 | q.text('}') |
| 2925 | |
| 2926 | class echo_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2927 | version = 3 |
| 2928 | type = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2929 | |
| 2930 | def __init__(self, xid=None, data=None): |
| 2931 | self.xid = xid |
| 2932 | if data != None: |
| 2933 | self.data = data |
| 2934 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2935 | self.data = '' |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2936 | |
| 2937 | def pack(self): |
| 2938 | packed = [] |
| 2939 | packed.append(struct.pack("!B", self.version)) |
| 2940 | packed.append(struct.pack("!B", self.type)) |
| 2941 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2942 | packed.append(struct.pack("!L", self.xid)) |
| 2943 | packed.append(self.data) |
| 2944 | length = sum([len(x) for x in packed]) |
| 2945 | packed[2] = struct.pack("!H", length) |
| 2946 | return ''.join(packed) |
| 2947 | |
| 2948 | @staticmethod |
| 2949 | def unpack(buf): |
| 2950 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 2951 | obj = echo_request() |
| 2952 | if type(buf) == loxi.generic_util.OFReader: |
| 2953 | reader = buf |
| 2954 | else: |
| 2955 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2956 | _version = reader.read("!B")[0] |
| 2957 | assert(_version == 3) |
| 2958 | _type = reader.read("!B")[0] |
| 2959 | assert(_type == 2) |
| 2960 | _length = reader.read("!H")[0] |
| 2961 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2962 | obj.data = str(reader.read_all()) |
| 2963 | return obj |
| 2964 | |
| 2965 | def __eq__(self, other): |
| 2966 | if type(self) != type(other): return False |
| 2967 | if self.version != other.version: return False |
| 2968 | if self.type != other.type: return False |
| 2969 | if self.xid != other.xid: return False |
| 2970 | if self.data != other.data: return False |
| 2971 | return True |
| 2972 | |
| 2973 | def __ne__(self, other): |
| 2974 | return not self.__eq__(other) |
| 2975 | |
| 2976 | def __str__(self): |
| 2977 | return self.show() |
| 2978 | |
| 2979 | def show(self): |
| 2980 | import loxi.pp |
| 2981 | return loxi.pp.pp(self) |
| 2982 | |
| 2983 | def pretty_print(self, q): |
| 2984 | q.text("echo_request {") |
| 2985 | with q.group(): |
| 2986 | with q.indent(2): |
| 2987 | q.breakable() |
| 2988 | q.text("xid = "); |
| 2989 | if self.xid != None: |
| 2990 | q.text("%#x" % self.xid) |
| 2991 | else: |
| 2992 | q.text('None') |
| 2993 | q.text(","); q.breakable() |
| 2994 | q.text("data = "); |
| 2995 | q.pp(self.data) |
| 2996 | q.breakable() |
| 2997 | q.text('}') |
| 2998 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2999 | class experimenter_error_msg(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3000 | version = 3 |
| 3001 | type = 1 |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3002 | err_type = 65535 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3003 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3004 | def __init__(self, xid=None, subtype=None, experimenter=None, data=None): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3005 | self.xid = xid |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3006 | if subtype != None: |
| 3007 | self.subtype = subtype |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3008 | else: |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3009 | self.subtype = 0 |
| 3010 | if experimenter != None: |
| 3011 | self.experimenter = experimenter |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3012 | else: |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3013 | self.experimenter = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3014 | if data != None: |
| 3015 | self.data = data |
| 3016 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3017 | self.data = '' |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3018 | |
| 3019 | def pack(self): |
| 3020 | packed = [] |
| 3021 | packed.append(struct.pack("!B", self.version)) |
| 3022 | packed.append(struct.pack("!B", self.type)) |
| 3023 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3024 | packed.append(struct.pack("!L", self.xid)) |
| 3025 | packed.append(struct.pack("!H", self.err_type)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3026 | packed.append(struct.pack("!H", self.subtype)) |
| 3027 | packed.append(struct.pack("!L", self.experimenter)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3028 | packed.append(self.data) |
| 3029 | length = sum([len(x) for x in packed]) |
| 3030 | packed[2] = struct.pack("!H", length) |
| 3031 | return ''.join(packed) |
| 3032 | |
| 3033 | @staticmethod |
| 3034 | def unpack(buf): |
| 3035 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3036 | obj = experimenter_error_msg() |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3037 | if type(buf) == loxi.generic_util.OFReader: |
| 3038 | reader = buf |
| 3039 | else: |
| 3040 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3041 | _version = reader.read("!B")[0] |
| 3042 | assert(_version == 3) |
| 3043 | _type = reader.read("!B")[0] |
| 3044 | assert(_type == 1) |
| 3045 | _length = reader.read("!H")[0] |
| 3046 | obj.xid = reader.read("!L")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3047 | _err_type = reader.read("!H")[0] |
| 3048 | assert(_err_type == 65535) |
| 3049 | obj.subtype = reader.read("!H")[0] |
| 3050 | obj.experimenter = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3051 | obj.data = str(reader.read_all()) |
| 3052 | return obj |
| 3053 | |
| 3054 | def __eq__(self, other): |
| 3055 | if type(self) != type(other): return False |
| 3056 | if self.version != other.version: return False |
| 3057 | if self.type != other.type: return False |
| 3058 | if self.xid != other.xid: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3059 | if self.subtype != other.subtype: return False |
| 3060 | if self.experimenter != other.experimenter: return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3061 | if self.data != other.data: return False |
| 3062 | return True |
| 3063 | |
| 3064 | def __ne__(self, other): |
| 3065 | return not self.__eq__(other) |
| 3066 | |
| 3067 | def __str__(self): |
| 3068 | return self.show() |
| 3069 | |
| 3070 | def show(self): |
| 3071 | import loxi.pp |
| 3072 | return loxi.pp.pp(self) |
| 3073 | |
| 3074 | def pretty_print(self, q): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3075 | q.text("experimenter_error_msg {") |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3076 | with q.group(): |
| 3077 | with q.indent(2): |
| 3078 | q.breakable() |
| 3079 | q.text("xid = "); |
| 3080 | if self.xid != None: |
| 3081 | q.text("%#x" % self.xid) |
| 3082 | else: |
| 3083 | q.text('None') |
| 3084 | q.text(","); q.breakable() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3085 | q.text("subtype = "); |
| 3086 | q.text("%#x" % self.subtype) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3087 | q.text(","); q.breakable() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3088 | q.text("experimenter = "); |
| 3089 | q.text("%#x" % self.experimenter) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3090 | q.text(","); q.breakable() |
| 3091 | q.text("data = "); |
| 3092 | q.pp(self.data) |
| 3093 | q.breakable() |
| 3094 | q.text('}') |
| 3095 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3096 | class features_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3097 | version = 3 |
| 3098 | type = 6 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3099 | |
| 3100 | def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, capabilities=None, reserved=None, ports=None): |
| 3101 | self.xid = xid |
| 3102 | if datapath_id != None: |
| 3103 | self.datapath_id = datapath_id |
| 3104 | else: |
| 3105 | self.datapath_id = 0 |
| 3106 | if n_buffers != None: |
| 3107 | self.n_buffers = n_buffers |
| 3108 | else: |
| 3109 | self.n_buffers = 0 |
| 3110 | if n_tables != None: |
| 3111 | self.n_tables = n_tables |
| 3112 | else: |
| 3113 | self.n_tables = 0 |
| 3114 | if capabilities != None: |
| 3115 | self.capabilities = capabilities |
| 3116 | else: |
| 3117 | self.capabilities = 0 |
| 3118 | if reserved != None: |
| 3119 | self.reserved = reserved |
| 3120 | else: |
| 3121 | self.reserved = 0 |
| 3122 | if ports != None: |
| 3123 | self.ports = ports |
| 3124 | else: |
| 3125 | self.ports = [] |
| 3126 | |
| 3127 | def pack(self): |
| 3128 | packed = [] |
| 3129 | packed.append(struct.pack("!B", self.version)) |
| 3130 | packed.append(struct.pack("!B", self.type)) |
| 3131 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3132 | packed.append(struct.pack("!L", self.xid)) |
| 3133 | packed.append(struct.pack("!Q", self.datapath_id)) |
| 3134 | packed.append(struct.pack("!L", self.n_buffers)) |
| 3135 | packed.append(struct.pack("!B", self.n_tables)) |
| 3136 | packed.append('\x00' * 3) |
| 3137 | packed.append(struct.pack("!L", self.capabilities)) |
| 3138 | packed.append(struct.pack("!L", self.reserved)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3139 | packed.append(util.pack_list(self.ports)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3140 | length = sum([len(x) for x in packed]) |
| 3141 | packed[2] = struct.pack("!H", length) |
| 3142 | return ''.join(packed) |
| 3143 | |
| 3144 | @staticmethod |
| 3145 | def unpack(buf): |
| 3146 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 3147 | obj = features_reply() |
| 3148 | if type(buf) == loxi.generic_util.OFReader: |
| 3149 | reader = buf |
| 3150 | else: |
| 3151 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3152 | _version = reader.read("!B")[0] |
| 3153 | assert(_version == 3) |
| 3154 | _type = reader.read("!B")[0] |
| 3155 | assert(_type == 6) |
| 3156 | _length = reader.read("!H")[0] |
| 3157 | obj.xid = reader.read("!L")[0] |
| 3158 | obj.datapath_id = reader.read("!Q")[0] |
| 3159 | obj.n_buffers = reader.read("!L")[0] |
| 3160 | obj.n_tables = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3161 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3162 | obj.capabilities = reader.read("!L")[0] |
| 3163 | obj.reserved = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3164 | obj.ports = loxi.generic_util.unpack_list(reader, common.port_desc.unpack) |
| 3165 | return obj |
| 3166 | |
| 3167 | def __eq__(self, other): |
| 3168 | if type(self) != type(other): return False |
| 3169 | if self.version != other.version: return False |
| 3170 | if self.type != other.type: return False |
| 3171 | if self.xid != other.xid: return False |
| 3172 | if self.datapath_id != other.datapath_id: return False |
| 3173 | if self.n_buffers != other.n_buffers: return False |
| 3174 | if self.n_tables != other.n_tables: return False |
| 3175 | if self.capabilities != other.capabilities: return False |
| 3176 | if self.reserved != other.reserved: return False |
| 3177 | if self.ports != other.ports: return False |
| 3178 | return True |
| 3179 | |
| 3180 | def __ne__(self, other): |
| 3181 | return not self.__eq__(other) |
| 3182 | |
| 3183 | def __str__(self): |
| 3184 | return self.show() |
| 3185 | |
| 3186 | def show(self): |
| 3187 | import loxi.pp |
| 3188 | return loxi.pp.pp(self) |
| 3189 | |
| 3190 | def pretty_print(self, q): |
| 3191 | q.text("features_reply {") |
| 3192 | with q.group(): |
| 3193 | with q.indent(2): |
| 3194 | q.breakable() |
| 3195 | q.text("xid = "); |
| 3196 | if self.xid != None: |
| 3197 | q.text("%#x" % self.xid) |
| 3198 | else: |
| 3199 | q.text('None') |
| 3200 | q.text(","); q.breakable() |
| 3201 | q.text("datapath_id = "); |
| 3202 | q.text("%#x" % self.datapath_id) |
| 3203 | q.text(","); q.breakable() |
| 3204 | q.text("n_buffers = "); |
| 3205 | q.text("%#x" % self.n_buffers) |
| 3206 | q.text(","); q.breakable() |
| 3207 | q.text("n_tables = "); |
| 3208 | q.text("%#x" % self.n_tables) |
| 3209 | q.text(","); q.breakable() |
| 3210 | q.text("capabilities = "); |
| 3211 | q.text("%#x" % self.capabilities) |
| 3212 | q.text(","); q.breakable() |
| 3213 | q.text("reserved = "); |
| 3214 | q.text("%#x" % self.reserved) |
| 3215 | q.text(","); q.breakable() |
| 3216 | q.text("ports = "); |
| 3217 | q.pp(self.ports) |
| 3218 | q.breakable() |
| 3219 | q.text('}') |
| 3220 | |
| 3221 | class features_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3222 | version = 3 |
| 3223 | type = 5 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3224 | |
| 3225 | def __init__(self, xid=None): |
| 3226 | self.xid = xid |
| 3227 | |
| 3228 | def pack(self): |
| 3229 | packed = [] |
| 3230 | packed.append(struct.pack("!B", self.version)) |
| 3231 | packed.append(struct.pack("!B", self.type)) |
| 3232 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3233 | packed.append(struct.pack("!L", self.xid)) |
| 3234 | length = sum([len(x) for x in packed]) |
| 3235 | packed[2] = struct.pack("!H", length) |
| 3236 | return ''.join(packed) |
| 3237 | |
| 3238 | @staticmethod |
| 3239 | def unpack(buf): |
| 3240 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 3241 | obj = features_request() |
| 3242 | if type(buf) == loxi.generic_util.OFReader: |
| 3243 | reader = buf |
| 3244 | else: |
| 3245 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3246 | _version = reader.read("!B")[0] |
| 3247 | assert(_version == 3) |
| 3248 | _type = reader.read("!B")[0] |
| 3249 | assert(_type == 5) |
| 3250 | _length = reader.read("!H")[0] |
| 3251 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3252 | return obj |
| 3253 | |
| 3254 | def __eq__(self, other): |
| 3255 | if type(self) != type(other): return False |
| 3256 | if self.version != other.version: return False |
| 3257 | if self.type != other.type: return False |
| 3258 | if self.xid != other.xid: return False |
| 3259 | return True |
| 3260 | |
| 3261 | def __ne__(self, other): |
| 3262 | return not self.__eq__(other) |
| 3263 | |
| 3264 | def __str__(self): |
| 3265 | return self.show() |
| 3266 | |
| 3267 | def show(self): |
| 3268 | import loxi.pp |
| 3269 | return loxi.pp.pp(self) |
| 3270 | |
| 3271 | def pretty_print(self, q): |
| 3272 | q.text("features_request {") |
| 3273 | with q.group(): |
| 3274 | with q.indent(2): |
| 3275 | q.breakable() |
| 3276 | q.text("xid = "); |
| 3277 | if self.xid != None: |
| 3278 | q.text("%#x" % self.xid) |
| 3279 | else: |
| 3280 | q.text('None') |
| 3281 | q.breakable() |
| 3282 | q.text('}') |
| 3283 | |
| 3284 | class flow_add(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3285 | version = 3 |
| 3286 | type = 14 |
| 3287 | _command = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3288 | |
| 3289 | 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): |
| 3290 | self.xid = xid |
| 3291 | if cookie != None: |
| 3292 | self.cookie = cookie |
| 3293 | else: |
| 3294 | self.cookie = 0 |
| 3295 | if cookie_mask != None: |
| 3296 | self.cookie_mask = cookie_mask |
| 3297 | else: |
| 3298 | self.cookie_mask = 0 |
| 3299 | if table_id != None: |
| 3300 | self.table_id = table_id |
| 3301 | else: |
| 3302 | self.table_id = 0 |
| 3303 | if idle_timeout != None: |
| 3304 | self.idle_timeout = idle_timeout |
| 3305 | else: |
| 3306 | self.idle_timeout = 0 |
| 3307 | if hard_timeout != None: |
| 3308 | self.hard_timeout = hard_timeout |
| 3309 | else: |
| 3310 | self.hard_timeout = 0 |
| 3311 | if priority != None: |
| 3312 | self.priority = priority |
| 3313 | else: |
| 3314 | self.priority = 0 |
| 3315 | if buffer_id != None: |
| 3316 | self.buffer_id = buffer_id |
| 3317 | else: |
| 3318 | self.buffer_id = 0 |
| 3319 | if out_port != None: |
| 3320 | self.out_port = out_port |
| 3321 | else: |
| 3322 | self.out_port = 0 |
| 3323 | if out_group != None: |
| 3324 | self.out_group = out_group |
| 3325 | else: |
| 3326 | self.out_group = 0 |
| 3327 | if flags != None: |
| 3328 | self.flags = flags |
| 3329 | else: |
| 3330 | self.flags = 0 |
| 3331 | if match != None: |
| 3332 | self.match = match |
| 3333 | else: |
| 3334 | self.match = common.match() |
| 3335 | if instructions != None: |
| 3336 | self.instructions = instructions |
| 3337 | else: |
| 3338 | self.instructions = [] |
| 3339 | |
| 3340 | def pack(self): |
| 3341 | packed = [] |
| 3342 | packed.append(struct.pack("!B", self.version)) |
| 3343 | packed.append(struct.pack("!B", self.type)) |
| 3344 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3345 | packed.append(struct.pack("!L", self.xid)) |
| 3346 | packed.append(struct.pack("!Q", self.cookie)) |
| 3347 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 3348 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3349 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3350 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 3351 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 3352 | packed.append(struct.pack("!H", self.priority)) |
| 3353 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3354 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3355 | packed.append(struct.pack("!L", self.out_group)) |
| 3356 | packed.append(struct.pack("!H", self.flags)) |
| 3357 | packed.append('\x00' * 2) |
| 3358 | packed.append(self.match.pack()) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3359 | packed.append(util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3360 | length = sum([len(x) for x in packed]) |
| 3361 | packed[2] = struct.pack("!H", length) |
| 3362 | return ''.join(packed) |
| 3363 | |
| 3364 | @staticmethod |
| 3365 | def unpack(buf): |
| 3366 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 3367 | obj = flow_add() |
| 3368 | if type(buf) == loxi.generic_util.OFReader: |
| 3369 | reader = buf |
| 3370 | else: |
| 3371 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3372 | _version = reader.read("!B")[0] |
| 3373 | assert(_version == 3) |
| 3374 | _type = reader.read("!B")[0] |
| 3375 | assert(_type == 14) |
| 3376 | _length = reader.read("!H")[0] |
| 3377 | obj.xid = reader.read("!L")[0] |
| 3378 | obj.cookie = reader.read("!Q")[0] |
| 3379 | obj.cookie_mask = reader.read("!Q")[0] |
| 3380 | obj.table_id = reader.read("!B")[0] |
| 3381 | __command = util.unpack_fm_cmd(reader) |
| 3382 | assert(__command == 0) |
| 3383 | obj.idle_timeout = reader.read("!H")[0] |
| 3384 | obj.hard_timeout = reader.read("!H")[0] |
| 3385 | obj.priority = reader.read("!H")[0] |
| 3386 | obj.buffer_id = reader.read("!L")[0] |
| 3387 | obj.out_port = util.unpack_port_no(reader) |
| 3388 | obj.out_group = reader.read("!L")[0] |
| 3389 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3390 | reader.skip(2) |
| 3391 | obj.match = common.match.unpack(reader) |
| 3392 | obj.instructions = instruction.unpack_list(reader) |
| 3393 | return obj |
| 3394 | |
| 3395 | def __eq__(self, other): |
| 3396 | if type(self) != type(other): return False |
| 3397 | if self.version != other.version: return False |
| 3398 | if self.type != other.type: return False |
| 3399 | if self.xid != other.xid: return False |
| 3400 | if self.cookie != other.cookie: return False |
| 3401 | if self.cookie_mask != other.cookie_mask: return False |
| 3402 | if self.table_id != other.table_id: return False |
| 3403 | if self.idle_timeout != other.idle_timeout: return False |
| 3404 | if self.hard_timeout != other.hard_timeout: return False |
| 3405 | if self.priority != other.priority: return False |
| 3406 | if self.buffer_id != other.buffer_id: return False |
| 3407 | if self.out_port != other.out_port: return False |
| 3408 | if self.out_group != other.out_group: return False |
| 3409 | if self.flags != other.flags: return False |
| 3410 | if self.match != other.match: return False |
| 3411 | if self.instructions != other.instructions: return False |
| 3412 | return True |
| 3413 | |
| 3414 | def __ne__(self, other): |
| 3415 | return not self.__eq__(other) |
| 3416 | |
| 3417 | def __str__(self): |
| 3418 | return self.show() |
| 3419 | |
| 3420 | def show(self): |
| 3421 | import loxi.pp |
| 3422 | return loxi.pp.pp(self) |
| 3423 | |
| 3424 | def pretty_print(self, q): |
| 3425 | q.text("flow_add {") |
| 3426 | with q.group(): |
| 3427 | with q.indent(2): |
| 3428 | q.breakable() |
| 3429 | q.text("xid = "); |
| 3430 | if self.xid != None: |
| 3431 | q.text("%#x" % self.xid) |
| 3432 | else: |
| 3433 | q.text('None') |
| 3434 | q.text(","); q.breakable() |
| 3435 | q.text("cookie = "); |
| 3436 | q.text("%#x" % self.cookie) |
| 3437 | q.text(","); q.breakable() |
| 3438 | q.text("cookie_mask = "); |
| 3439 | q.text("%#x" % self.cookie_mask) |
| 3440 | q.text(","); q.breakable() |
| 3441 | q.text("table_id = "); |
| 3442 | q.text("%#x" % self.table_id) |
| 3443 | q.text(","); q.breakable() |
| 3444 | q.text("idle_timeout = "); |
| 3445 | q.text("%#x" % self.idle_timeout) |
| 3446 | q.text(","); q.breakable() |
| 3447 | q.text("hard_timeout = "); |
| 3448 | q.text("%#x" % self.hard_timeout) |
| 3449 | q.text(","); q.breakable() |
| 3450 | q.text("priority = "); |
| 3451 | q.text("%#x" % self.priority) |
| 3452 | q.text(","); q.breakable() |
| 3453 | q.text("buffer_id = "); |
| 3454 | q.text("%#x" % self.buffer_id) |
| 3455 | q.text(","); q.breakable() |
| 3456 | q.text("out_port = "); |
| 3457 | q.text(util.pretty_port(self.out_port)) |
| 3458 | q.text(","); q.breakable() |
| 3459 | q.text("out_group = "); |
| 3460 | q.text("%#x" % self.out_group) |
| 3461 | q.text(","); q.breakable() |
| 3462 | q.text("flags = "); |
| 3463 | q.text("%#x" % self.flags) |
| 3464 | q.text(","); q.breakable() |
| 3465 | q.text("match = "); |
| 3466 | q.pp(self.match) |
| 3467 | q.text(","); q.breakable() |
| 3468 | q.text("instructions = "); |
| 3469 | q.pp(self.instructions) |
| 3470 | q.breakable() |
| 3471 | q.text('}') |
| 3472 | |
| 3473 | class flow_delete(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3474 | version = 3 |
| 3475 | type = 14 |
| 3476 | _command = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3477 | |
| 3478 | 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): |
| 3479 | self.xid = xid |
| 3480 | if cookie != None: |
| 3481 | self.cookie = cookie |
| 3482 | else: |
| 3483 | self.cookie = 0 |
| 3484 | if cookie_mask != None: |
| 3485 | self.cookie_mask = cookie_mask |
| 3486 | else: |
| 3487 | self.cookie_mask = 0 |
| 3488 | if table_id != None: |
| 3489 | self.table_id = table_id |
| 3490 | else: |
| 3491 | self.table_id = 0 |
| 3492 | if idle_timeout != None: |
| 3493 | self.idle_timeout = idle_timeout |
| 3494 | else: |
| 3495 | self.idle_timeout = 0 |
| 3496 | if hard_timeout != None: |
| 3497 | self.hard_timeout = hard_timeout |
| 3498 | else: |
| 3499 | self.hard_timeout = 0 |
| 3500 | if priority != None: |
| 3501 | self.priority = priority |
| 3502 | else: |
| 3503 | self.priority = 0 |
| 3504 | if buffer_id != None: |
| 3505 | self.buffer_id = buffer_id |
| 3506 | else: |
| 3507 | self.buffer_id = 0 |
| 3508 | if out_port != None: |
| 3509 | self.out_port = out_port |
| 3510 | else: |
| 3511 | self.out_port = 0 |
| 3512 | if out_group != None: |
| 3513 | self.out_group = out_group |
| 3514 | else: |
| 3515 | self.out_group = 0 |
| 3516 | if flags != None: |
| 3517 | self.flags = flags |
| 3518 | else: |
| 3519 | self.flags = 0 |
| 3520 | if match != None: |
| 3521 | self.match = match |
| 3522 | else: |
| 3523 | self.match = common.match() |
| 3524 | if instructions != None: |
| 3525 | self.instructions = instructions |
| 3526 | else: |
| 3527 | self.instructions = [] |
| 3528 | |
| 3529 | def pack(self): |
| 3530 | packed = [] |
| 3531 | packed.append(struct.pack("!B", self.version)) |
| 3532 | packed.append(struct.pack("!B", self.type)) |
| 3533 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3534 | packed.append(struct.pack("!L", self.xid)) |
| 3535 | packed.append(struct.pack("!Q", self.cookie)) |
| 3536 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 3537 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3538 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3539 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 3540 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 3541 | packed.append(struct.pack("!H", self.priority)) |
| 3542 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3543 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3544 | packed.append(struct.pack("!L", self.out_group)) |
| 3545 | packed.append(struct.pack("!H", self.flags)) |
| 3546 | packed.append('\x00' * 2) |
| 3547 | packed.append(self.match.pack()) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3548 | packed.append(util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3549 | length = sum([len(x) for x in packed]) |
| 3550 | packed[2] = struct.pack("!H", length) |
| 3551 | return ''.join(packed) |
| 3552 | |
| 3553 | @staticmethod |
| 3554 | def unpack(buf): |
| 3555 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 3556 | obj = flow_delete() |
| 3557 | if type(buf) == loxi.generic_util.OFReader: |
| 3558 | reader = buf |
| 3559 | else: |
| 3560 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3561 | _version = reader.read("!B")[0] |
| 3562 | assert(_version == 3) |
| 3563 | _type = reader.read("!B")[0] |
| 3564 | assert(_type == 14) |
| 3565 | _length = reader.read("!H")[0] |
| 3566 | obj.xid = reader.read("!L")[0] |
| 3567 | obj.cookie = reader.read("!Q")[0] |
| 3568 | obj.cookie_mask = reader.read("!Q")[0] |
| 3569 | obj.table_id = reader.read("!B")[0] |
| 3570 | __command = util.unpack_fm_cmd(reader) |
| 3571 | assert(__command == 3) |
| 3572 | obj.idle_timeout = reader.read("!H")[0] |
| 3573 | obj.hard_timeout = reader.read("!H")[0] |
| 3574 | obj.priority = reader.read("!H")[0] |
| 3575 | obj.buffer_id = reader.read("!L")[0] |
| 3576 | obj.out_port = util.unpack_port_no(reader) |
| 3577 | obj.out_group = reader.read("!L")[0] |
| 3578 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3579 | reader.skip(2) |
| 3580 | obj.match = common.match.unpack(reader) |
| 3581 | obj.instructions = instruction.unpack_list(reader) |
| 3582 | return obj |
| 3583 | |
| 3584 | def __eq__(self, other): |
| 3585 | if type(self) != type(other): return False |
| 3586 | if self.version != other.version: return False |
| 3587 | if self.type != other.type: return False |
| 3588 | if self.xid != other.xid: return False |
| 3589 | if self.cookie != other.cookie: return False |
| 3590 | if self.cookie_mask != other.cookie_mask: return False |
| 3591 | if self.table_id != other.table_id: return False |
| 3592 | if self.idle_timeout != other.idle_timeout: return False |
| 3593 | if self.hard_timeout != other.hard_timeout: return False |
| 3594 | if self.priority != other.priority: return False |
| 3595 | if self.buffer_id != other.buffer_id: return False |
| 3596 | if self.out_port != other.out_port: return False |
| 3597 | if self.out_group != other.out_group: return False |
| 3598 | if self.flags != other.flags: return False |
| 3599 | if self.match != other.match: return False |
| 3600 | if self.instructions != other.instructions: return False |
| 3601 | return True |
| 3602 | |
| 3603 | def __ne__(self, other): |
| 3604 | return not self.__eq__(other) |
| 3605 | |
| 3606 | def __str__(self): |
| 3607 | return self.show() |
| 3608 | |
| 3609 | def show(self): |
| 3610 | import loxi.pp |
| 3611 | return loxi.pp.pp(self) |
| 3612 | |
| 3613 | def pretty_print(self, q): |
| 3614 | q.text("flow_delete {") |
| 3615 | with q.group(): |
| 3616 | with q.indent(2): |
| 3617 | q.breakable() |
| 3618 | q.text("xid = "); |
| 3619 | if self.xid != None: |
| 3620 | q.text("%#x" % self.xid) |
| 3621 | else: |
| 3622 | q.text('None') |
| 3623 | q.text(","); q.breakable() |
| 3624 | q.text("cookie = "); |
| 3625 | q.text("%#x" % self.cookie) |
| 3626 | q.text(","); q.breakable() |
| 3627 | q.text("cookie_mask = "); |
| 3628 | q.text("%#x" % self.cookie_mask) |
| 3629 | q.text(","); q.breakable() |
| 3630 | q.text("table_id = "); |
| 3631 | q.text("%#x" % self.table_id) |
| 3632 | q.text(","); q.breakable() |
| 3633 | q.text("idle_timeout = "); |
| 3634 | q.text("%#x" % self.idle_timeout) |
| 3635 | q.text(","); q.breakable() |
| 3636 | q.text("hard_timeout = "); |
| 3637 | q.text("%#x" % self.hard_timeout) |
| 3638 | q.text(","); q.breakable() |
| 3639 | q.text("priority = "); |
| 3640 | q.text("%#x" % self.priority) |
| 3641 | q.text(","); q.breakable() |
| 3642 | q.text("buffer_id = "); |
| 3643 | q.text("%#x" % self.buffer_id) |
| 3644 | q.text(","); q.breakable() |
| 3645 | q.text("out_port = "); |
| 3646 | q.text(util.pretty_port(self.out_port)) |
| 3647 | q.text(","); q.breakable() |
| 3648 | q.text("out_group = "); |
| 3649 | q.text("%#x" % self.out_group) |
| 3650 | q.text(","); q.breakable() |
| 3651 | q.text("flags = "); |
| 3652 | q.text("%#x" % self.flags) |
| 3653 | q.text(","); q.breakable() |
| 3654 | q.text("match = "); |
| 3655 | q.pp(self.match) |
| 3656 | q.text(","); q.breakable() |
| 3657 | q.text("instructions = "); |
| 3658 | q.pp(self.instructions) |
| 3659 | q.breakable() |
| 3660 | q.text('}') |
| 3661 | |
| 3662 | class flow_delete_strict(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3663 | version = 3 |
| 3664 | type = 14 |
| 3665 | _command = 4 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3666 | |
| 3667 | 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): |
| 3668 | self.xid = xid |
| 3669 | if cookie != None: |
| 3670 | self.cookie = cookie |
| 3671 | else: |
| 3672 | self.cookie = 0 |
| 3673 | if cookie_mask != None: |
| 3674 | self.cookie_mask = cookie_mask |
| 3675 | else: |
| 3676 | self.cookie_mask = 0 |
| 3677 | if table_id != None: |
| 3678 | self.table_id = table_id |
| 3679 | else: |
| 3680 | self.table_id = 0 |
| 3681 | if idle_timeout != None: |
| 3682 | self.idle_timeout = idle_timeout |
| 3683 | else: |
| 3684 | self.idle_timeout = 0 |
| 3685 | if hard_timeout != None: |
| 3686 | self.hard_timeout = hard_timeout |
| 3687 | else: |
| 3688 | self.hard_timeout = 0 |
| 3689 | if priority != None: |
| 3690 | self.priority = priority |
| 3691 | else: |
| 3692 | self.priority = 0 |
| 3693 | if buffer_id != None: |
| 3694 | self.buffer_id = buffer_id |
| 3695 | else: |
| 3696 | self.buffer_id = 0 |
| 3697 | if out_port != None: |
| 3698 | self.out_port = out_port |
| 3699 | else: |
| 3700 | self.out_port = 0 |
| 3701 | if out_group != None: |
| 3702 | self.out_group = out_group |
| 3703 | else: |
| 3704 | self.out_group = 0 |
| 3705 | if flags != None: |
| 3706 | self.flags = flags |
| 3707 | else: |
| 3708 | self.flags = 0 |
| 3709 | if match != None: |
| 3710 | self.match = match |
| 3711 | else: |
| 3712 | self.match = common.match() |
| 3713 | if instructions != None: |
| 3714 | self.instructions = instructions |
| 3715 | else: |
| 3716 | self.instructions = [] |
| 3717 | |
| 3718 | def pack(self): |
| 3719 | packed = [] |
| 3720 | packed.append(struct.pack("!B", self.version)) |
| 3721 | packed.append(struct.pack("!B", self.type)) |
| 3722 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3723 | packed.append(struct.pack("!L", self.xid)) |
| 3724 | packed.append(struct.pack("!Q", self.cookie)) |
| 3725 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 3726 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3727 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3728 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 3729 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 3730 | packed.append(struct.pack("!H", self.priority)) |
| 3731 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3732 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3733 | packed.append(struct.pack("!L", self.out_group)) |
| 3734 | packed.append(struct.pack("!H", self.flags)) |
| 3735 | packed.append('\x00' * 2) |
| 3736 | packed.append(self.match.pack()) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3737 | packed.append(util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3738 | length = sum([len(x) for x in packed]) |
| 3739 | packed[2] = struct.pack("!H", length) |
| 3740 | return ''.join(packed) |
| 3741 | |
| 3742 | @staticmethod |
| 3743 | def unpack(buf): |
| 3744 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 3745 | obj = flow_delete_strict() |
| 3746 | if type(buf) == loxi.generic_util.OFReader: |
| 3747 | reader = buf |
| 3748 | else: |
| 3749 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3750 | _version = reader.read("!B")[0] |
| 3751 | assert(_version == 3) |
| 3752 | _type = reader.read("!B")[0] |
| 3753 | assert(_type == 14) |
| 3754 | _length = reader.read("!H")[0] |
| 3755 | obj.xid = reader.read("!L")[0] |
| 3756 | obj.cookie = reader.read("!Q")[0] |
| 3757 | obj.cookie_mask = reader.read("!Q")[0] |
| 3758 | obj.table_id = reader.read("!B")[0] |
| 3759 | __command = util.unpack_fm_cmd(reader) |
| 3760 | assert(__command == 4) |
| 3761 | obj.idle_timeout = reader.read("!H")[0] |
| 3762 | obj.hard_timeout = reader.read("!H")[0] |
| 3763 | obj.priority = reader.read("!H")[0] |
| 3764 | obj.buffer_id = reader.read("!L")[0] |
| 3765 | obj.out_port = util.unpack_port_no(reader) |
| 3766 | obj.out_group = reader.read("!L")[0] |
| 3767 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3768 | reader.skip(2) |
| 3769 | obj.match = common.match.unpack(reader) |
| 3770 | obj.instructions = instruction.unpack_list(reader) |
| 3771 | return obj |
| 3772 | |
| 3773 | def __eq__(self, other): |
| 3774 | if type(self) != type(other): return False |
| 3775 | if self.version != other.version: return False |
| 3776 | if self.type != other.type: return False |
| 3777 | if self.xid != other.xid: return False |
| 3778 | if self.cookie != other.cookie: return False |
| 3779 | if self.cookie_mask != other.cookie_mask: return False |
| 3780 | if self.table_id != other.table_id: return False |
| 3781 | if self.idle_timeout != other.idle_timeout: return False |
| 3782 | if self.hard_timeout != other.hard_timeout: return False |
| 3783 | if self.priority != other.priority: return False |
| 3784 | if self.buffer_id != other.buffer_id: return False |
| 3785 | if self.out_port != other.out_port: return False |
| 3786 | if self.out_group != other.out_group: return False |
| 3787 | if self.flags != other.flags: return False |
| 3788 | if self.match != other.match: return False |
| 3789 | if self.instructions != other.instructions: return False |
| 3790 | return True |
| 3791 | |
| 3792 | def __ne__(self, other): |
| 3793 | return not self.__eq__(other) |
| 3794 | |
| 3795 | def __str__(self): |
| 3796 | return self.show() |
| 3797 | |
| 3798 | def show(self): |
| 3799 | import loxi.pp |
| 3800 | return loxi.pp.pp(self) |
| 3801 | |
| 3802 | def pretty_print(self, q): |
| 3803 | q.text("flow_delete_strict {") |
| 3804 | with q.group(): |
| 3805 | with q.indent(2): |
| 3806 | q.breakable() |
| 3807 | q.text("xid = "); |
| 3808 | if self.xid != None: |
| 3809 | q.text("%#x" % self.xid) |
| 3810 | else: |
| 3811 | q.text('None') |
| 3812 | q.text(","); q.breakable() |
| 3813 | q.text("cookie = "); |
| 3814 | q.text("%#x" % self.cookie) |
| 3815 | q.text(","); q.breakable() |
| 3816 | q.text("cookie_mask = "); |
| 3817 | q.text("%#x" % self.cookie_mask) |
| 3818 | q.text(","); q.breakable() |
| 3819 | q.text("table_id = "); |
| 3820 | q.text("%#x" % self.table_id) |
| 3821 | q.text(","); q.breakable() |
| 3822 | q.text("idle_timeout = "); |
| 3823 | q.text("%#x" % self.idle_timeout) |
| 3824 | q.text(","); q.breakable() |
| 3825 | q.text("hard_timeout = "); |
| 3826 | q.text("%#x" % self.hard_timeout) |
| 3827 | q.text(","); q.breakable() |
| 3828 | q.text("priority = "); |
| 3829 | q.text("%#x" % self.priority) |
| 3830 | q.text(","); q.breakable() |
| 3831 | q.text("buffer_id = "); |
| 3832 | q.text("%#x" % self.buffer_id) |
| 3833 | q.text(","); q.breakable() |
| 3834 | q.text("out_port = "); |
| 3835 | q.text(util.pretty_port(self.out_port)) |
| 3836 | q.text(","); q.breakable() |
| 3837 | q.text("out_group = "); |
| 3838 | q.text("%#x" % self.out_group) |
| 3839 | q.text(","); q.breakable() |
| 3840 | q.text("flags = "); |
| 3841 | q.text("%#x" % self.flags) |
| 3842 | q.text(","); q.breakable() |
| 3843 | q.text("match = "); |
| 3844 | q.pp(self.match) |
| 3845 | q.text(","); q.breakable() |
| 3846 | q.text("instructions = "); |
| 3847 | q.pp(self.instructions) |
| 3848 | q.breakable() |
| 3849 | q.text('}') |
| 3850 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3851 | class flow_mod_failed_error_msg(Message): |
| 3852 | version = 3 |
| 3853 | type = 1 |
| 3854 | err_type = 5 |
| 3855 | |
| 3856 | def __init__(self, xid=None, code=None, data=None): |
| 3857 | self.xid = xid |
| 3858 | if code != None: |
| 3859 | self.code = code |
| 3860 | else: |
| 3861 | self.code = 0 |
| 3862 | if data != None: |
| 3863 | self.data = data |
| 3864 | else: |
| 3865 | self.data = '' |
| 3866 | |
| 3867 | def pack(self): |
| 3868 | packed = [] |
| 3869 | packed.append(struct.pack("!B", self.version)) |
| 3870 | packed.append(struct.pack("!B", self.type)) |
| 3871 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3872 | packed.append(struct.pack("!L", self.xid)) |
| 3873 | packed.append(struct.pack("!H", self.err_type)) |
| 3874 | packed.append(struct.pack("!H", self.code)) |
| 3875 | packed.append(self.data) |
| 3876 | length = sum([len(x) for x in packed]) |
| 3877 | packed[2] = struct.pack("!H", length) |
| 3878 | return ''.join(packed) |
| 3879 | |
| 3880 | @staticmethod |
| 3881 | def unpack(buf): |
| 3882 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 3883 | obj = flow_mod_failed_error_msg() |
| 3884 | if type(buf) == loxi.generic_util.OFReader: |
| 3885 | reader = buf |
| 3886 | else: |
| 3887 | reader = loxi.generic_util.OFReader(buf) |
| 3888 | _version = reader.read("!B")[0] |
| 3889 | assert(_version == 3) |
| 3890 | _type = reader.read("!B")[0] |
| 3891 | assert(_type == 1) |
| 3892 | _length = reader.read("!H")[0] |
| 3893 | obj.xid = reader.read("!L")[0] |
| 3894 | _err_type = reader.read("!H")[0] |
| 3895 | assert(_err_type == 5) |
| 3896 | obj.code = reader.read("!H")[0] |
| 3897 | obj.data = str(reader.read_all()) |
| 3898 | return obj |
| 3899 | |
| 3900 | def __eq__(self, other): |
| 3901 | if type(self) != type(other): return False |
| 3902 | if self.version != other.version: return False |
| 3903 | if self.type != other.type: return False |
| 3904 | if self.xid != other.xid: return False |
| 3905 | if self.code != other.code: return False |
| 3906 | if self.data != other.data: return False |
| 3907 | return True |
| 3908 | |
| 3909 | def __ne__(self, other): |
| 3910 | return not self.__eq__(other) |
| 3911 | |
| 3912 | def __str__(self): |
| 3913 | return self.show() |
| 3914 | |
| 3915 | def show(self): |
| 3916 | import loxi.pp |
| 3917 | return loxi.pp.pp(self) |
| 3918 | |
| 3919 | def pretty_print(self, q): |
| 3920 | q.text("flow_mod_failed_error_msg {") |
| 3921 | with q.group(): |
| 3922 | with q.indent(2): |
| 3923 | q.breakable() |
| 3924 | q.text("xid = "); |
| 3925 | if self.xid != None: |
| 3926 | q.text("%#x" % self.xid) |
| 3927 | else: |
| 3928 | q.text('None') |
| 3929 | q.text(","); q.breakable() |
| 3930 | q.text("code = "); |
| 3931 | q.text("%#x" % self.code) |
| 3932 | q.text(","); q.breakable() |
| 3933 | q.text("data = "); |
| 3934 | q.pp(self.data) |
| 3935 | q.breakable() |
| 3936 | q.text('}') |
| 3937 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3938 | class flow_modify(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3939 | version = 3 |
| 3940 | type = 14 |
| 3941 | _command = 1 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3942 | |
| 3943 | 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): |
| 3944 | self.xid = xid |
| 3945 | if cookie != None: |
| 3946 | self.cookie = cookie |
| 3947 | else: |
| 3948 | self.cookie = 0 |
| 3949 | if cookie_mask != None: |
| 3950 | self.cookie_mask = cookie_mask |
| 3951 | else: |
| 3952 | self.cookie_mask = 0 |
| 3953 | if table_id != None: |
| 3954 | self.table_id = table_id |
| 3955 | else: |
| 3956 | self.table_id = 0 |
| 3957 | if idle_timeout != None: |
| 3958 | self.idle_timeout = idle_timeout |
| 3959 | else: |
| 3960 | self.idle_timeout = 0 |
| 3961 | if hard_timeout != None: |
| 3962 | self.hard_timeout = hard_timeout |
| 3963 | else: |
| 3964 | self.hard_timeout = 0 |
| 3965 | if priority != None: |
| 3966 | self.priority = priority |
| 3967 | else: |
| 3968 | self.priority = 0 |
| 3969 | if buffer_id != None: |
| 3970 | self.buffer_id = buffer_id |
| 3971 | else: |
| 3972 | self.buffer_id = 0 |
| 3973 | if out_port != None: |
| 3974 | self.out_port = out_port |
| 3975 | else: |
| 3976 | self.out_port = 0 |
| 3977 | if out_group != None: |
| 3978 | self.out_group = out_group |
| 3979 | else: |
| 3980 | self.out_group = 0 |
| 3981 | if flags != None: |
| 3982 | self.flags = flags |
| 3983 | else: |
| 3984 | self.flags = 0 |
| 3985 | if match != None: |
| 3986 | self.match = match |
| 3987 | else: |
| 3988 | self.match = common.match() |
| 3989 | if instructions != None: |
| 3990 | self.instructions = instructions |
| 3991 | else: |
| 3992 | self.instructions = [] |
| 3993 | |
| 3994 | def pack(self): |
| 3995 | packed = [] |
| 3996 | packed.append(struct.pack("!B", self.version)) |
| 3997 | packed.append(struct.pack("!B", self.type)) |
| 3998 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3999 | packed.append(struct.pack("!L", self.xid)) |
| 4000 | packed.append(struct.pack("!Q", self.cookie)) |
| 4001 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 4002 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4003 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4004 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 4005 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 4006 | packed.append(struct.pack("!H", self.priority)) |
| 4007 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4008 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4009 | packed.append(struct.pack("!L", self.out_group)) |
| 4010 | packed.append(struct.pack("!H", self.flags)) |
| 4011 | packed.append('\x00' * 2) |
| 4012 | packed.append(self.match.pack()) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4013 | packed.append(util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4014 | length = sum([len(x) for x in packed]) |
| 4015 | packed[2] = struct.pack("!H", length) |
| 4016 | return ''.join(packed) |
| 4017 | |
| 4018 | @staticmethod |
| 4019 | def unpack(buf): |
| 4020 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 4021 | obj = flow_modify() |
| 4022 | if type(buf) == loxi.generic_util.OFReader: |
| 4023 | reader = buf |
| 4024 | else: |
| 4025 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4026 | _version = reader.read("!B")[0] |
| 4027 | assert(_version == 3) |
| 4028 | _type = reader.read("!B")[0] |
| 4029 | assert(_type == 14) |
| 4030 | _length = reader.read("!H")[0] |
| 4031 | obj.xid = reader.read("!L")[0] |
| 4032 | obj.cookie = reader.read("!Q")[0] |
| 4033 | obj.cookie_mask = reader.read("!Q")[0] |
| 4034 | obj.table_id = reader.read("!B")[0] |
| 4035 | __command = util.unpack_fm_cmd(reader) |
| 4036 | assert(__command == 1) |
| 4037 | obj.idle_timeout = reader.read("!H")[0] |
| 4038 | obj.hard_timeout = reader.read("!H")[0] |
| 4039 | obj.priority = reader.read("!H")[0] |
| 4040 | obj.buffer_id = reader.read("!L")[0] |
| 4041 | obj.out_port = util.unpack_port_no(reader) |
| 4042 | obj.out_group = reader.read("!L")[0] |
| 4043 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4044 | reader.skip(2) |
| 4045 | obj.match = common.match.unpack(reader) |
| 4046 | obj.instructions = instruction.unpack_list(reader) |
| 4047 | return obj |
| 4048 | |
| 4049 | def __eq__(self, other): |
| 4050 | if type(self) != type(other): return False |
| 4051 | if self.version != other.version: return False |
| 4052 | if self.type != other.type: return False |
| 4053 | if self.xid != other.xid: return False |
| 4054 | if self.cookie != other.cookie: return False |
| 4055 | if self.cookie_mask != other.cookie_mask: return False |
| 4056 | if self.table_id != other.table_id: return False |
| 4057 | if self.idle_timeout != other.idle_timeout: return False |
| 4058 | if self.hard_timeout != other.hard_timeout: return False |
| 4059 | if self.priority != other.priority: return False |
| 4060 | if self.buffer_id != other.buffer_id: return False |
| 4061 | if self.out_port != other.out_port: return False |
| 4062 | if self.out_group != other.out_group: return False |
| 4063 | if self.flags != other.flags: return False |
| 4064 | if self.match != other.match: return False |
| 4065 | if self.instructions != other.instructions: return False |
| 4066 | return True |
| 4067 | |
| 4068 | def __ne__(self, other): |
| 4069 | return not self.__eq__(other) |
| 4070 | |
| 4071 | def __str__(self): |
| 4072 | return self.show() |
| 4073 | |
| 4074 | def show(self): |
| 4075 | import loxi.pp |
| 4076 | return loxi.pp.pp(self) |
| 4077 | |
| 4078 | def pretty_print(self, q): |
| 4079 | q.text("flow_modify {") |
| 4080 | with q.group(): |
| 4081 | with q.indent(2): |
| 4082 | q.breakable() |
| 4083 | q.text("xid = "); |
| 4084 | if self.xid != None: |
| 4085 | q.text("%#x" % self.xid) |
| 4086 | else: |
| 4087 | q.text('None') |
| 4088 | q.text(","); q.breakable() |
| 4089 | q.text("cookie = "); |
| 4090 | q.text("%#x" % self.cookie) |
| 4091 | q.text(","); q.breakable() |
| 4092 | q.text("cookie_mask = "); |
| 4093 | q.text("%#x" % self.cookie_mask) |
| 4094 | q.text(","); q.breakable() |
| 4095 | q.text("table_id = "); |
| 4096 | q.text("%#x" % self.table_id) |
| 4097 | q.text(","); q.breakable() |
| 4098 | q.text("idle_timeout = "); |
| 4099 | q.text("%#x" % self.idle_timeout) |
| 4100 | q.text(","); q.breakable() |
| 4101 | q.text("hard_timeout = "); |
| 4102 | q.text("%#x" % self.hard_timeout) |
| 4103 | q.text(","); q.breakable() |
| 4104 | q.text("priority = "); |
| 4105 | q.text("%#x" % self.priority) |
| 4106 | q.text(","); q.breakable() |
| 4107 | q.text("buffer_id = "); |
| 4108 | q.text("%#x" % self.buffer_id) |
| 4109 | q.text(","); q.breakable() |
| 4110 | q.text("out_port = "); |
| 4111 | q.text(util.pretty_port(self.out_port)) |
| 4112 | q.text(","); q.breakable() |
| 4113 | q.text("out_group = "); |
| 4114 | q.text("%#x" % self.out_group) |
| 4115 | q.text(","); q.breakable() |
| 4116 | q.text("flags = "); |
| 4117 | q.text("%#x" % self.flags) |
| 4118 | q.text(","); q.breakable() |
| 4119 | q.text("match = "); |
| 4120 | q.pp(self.match) |
| 4121 | q.text(","); q.breakable() |
| 4122 | q.text("instructions = "); |
| 4123 | q.pp(self.instructions) |
| 4124 | q.breakable() |
| 4125 | q.text('}') |
| 4126 | |
| 4127 | class flow_modify_strict(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4128 | version = 3 |
| 4129 | type = 14 |
| 4130 | _command = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4131 | |
| 4132 | 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): |
| 4133 | self.xid = xid |
| 4134 | if cookie != None: |
| 4135 | self.cookie = cookie |
| 4136 | else: |
| 4137 | self.cookie = 0 |
| 4138 | if cookie_mask != None: |
| 4139 | self.cookie_mask = cookie_mask |
| 4140 | else: |
| 4141 | self.cookie_mask = 0 |
| 4142 | if table_id != None: |
| 4143 | self.table_id = table_id |
| 4144 | else: |
| 4145 | self.table_id = 0 |
| 4146 | if idle_timeout != None: |
| 4147 | self.idle_timeout = idle_timeout |
| 4148 | else: |
| 4149 | self.idle_timeout = 0 |
| 4150 | if hard_timeout != None: |
| 4151 | self.hard_timeout = hard_timeout |
| 4152 | else: |
| 4153 | self.hard_timeout = 0 |
| 4154 | if priority != None: |
| 4155 | self.priority = priority |
| 4156 | else: |
| 4157 | self.priority = 0 |
| 4158 | if buffer_id != None: |
| 4159 | self.buffer_id = buffer_id |
| 4160 | else: |
| 4161 | self.buffer_id = 0 |
| 4162 | if out_port != None: |
| 4163 | self.out_port = out_port |
| 4164 | else: |
| 4165 | self.out_port = 0 |
| 4166 | if out_group != None: |
| 4167 | self.out_group = out_group |
| 4168 | else: |
| 4169 | self.out_group = 0 |
| 4170 | if flags != None: |
| 4171 | self.flags = flags |
| 4172 | else: |
| 4173 | self.flags = 0 |
| 4174 | if match != None: |
| 4175 | self.match = match |
| 4176 | else: |
| 4177 | self.match = common.match() |
| 4178 | if instructions != None: |
| 4179 | self.instructions = instructions |
| 4180 | else: |
| 4181 | self.instructions = [] |
| 4182 | |
| 4183 | def pack(self): |
| 4184 | packed = [] |
| 4185 | packed.append(struct.pack("!B", self.version)) |
| 4186 | packed.append(struct.pack("!B", self.type)) |
| 4187 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4188 | packed.append(struct.pack("!L", self.xid)) |
| 4189 | packed.append(struct.pack("!Q", self.cookie)) |
| 4190 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 4191 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4192 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4193 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 4194 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 4195 | packed.append(struct.pack("!H", self.priority)) |
| 4196 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4197 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4198 | packed.append(struct.pack("!L", self.out_group)) |
| 4199 | packed.append(struct.pack("!H", self.flags)) |
| 4200 | packed.append('\x00' * 2) |
| 4201 | packed.append(self.match.pack()) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4202 | packed.append(util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4203 | length = sum([len(x) for x in packed]) |
| 4204 | packed[2] = struct.pack("!H", length) |
| 4205 | return ''.join(packed) |
| 4206 | |
| 4207 | @staticmethod |
| 4208 | def unpack(buf): |
| 4209 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 4210 | obj = flow_modify_strict() |
| 4211 | if type(buf) == loxi.generic_util.OFReader: |
| 4212 | reader = buf |
| 4213 | else: |
| 4214 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4215 | _version = reader.read("!B")[0] |
| 4216 | assert(_version == 3) |
| 4217 | _type = reader.read("!B")[0] |
| 4218 | assert(_type == 14) |
| 4219 | _length = reader.read("!H")[0] |
| 4220 | obj.xid = reader.read("!L")[0] |
| 4221 | obj.cookie = reader.read("!Q")[0] |
| 4222 | obj.cookie_mask = reader.read("!Q")[0] |
| 4223 | obj.table_id = reader.read("!B")[0] |
| 4224 | __command = util.unpack_fm_cmd(reader) |
| 4225 | assert(__command == 2) |
| 4226 | obj.idle_timeout = reader.read("!H")[0] |
| 4227 | obj.hard_timeout = reader.read("!H")[0] |
| 4228 | obj.priority = reader.read("!H")[0] |
| 4229 | obj.buffer_id = reader.read("!L")[0] |
| 4230 | obj.out_port = util.unpack_port_no(reader) |
| 4231 | obj.out_group = reader.read("!L")[0] |
| 4232 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4233 | reader.skip(2) |
| 4234 | obj.match = common.match.unpack(reader) |
| 4235 | obj.instructions = instruction.unpack_list(reader) |
| 4236 | return obj |
| 4237 | |
| 4238 | def __eq__(self, other): |
| 4239 | if type(self) != type(other): return False |
| 4240 | if self.version != other.version: return False |
| 4241 | if self.type != other.type: return False |
| 4242 | if self.xid != other.xid: return False |
| 4243 | if self.cookie != other.cookie: return False |
| 4244 | if self.cookie_mask != other.cookie_mask: return False |
| 4245 | if self.table_id != other.table_id: return False |
| 4246 | if self.idle_timeout != other.idle_timeout: return False |
| 4247 | if self.hard_timeout != other.hard_timeout: return False |
| 4248 | if self.priority != other.priority: return False |
| 4249 | if self.buffer_id != other.buffer_id: return False |
| 4250 | if self.out_port != other.out_port: return False |
| 4251 | if self.out_group != other.out_group: return False |
| 4252 | if self.flags != other.flags: return False |
| 4253 | if self.match != other.match: return False |
| 4254 | if self.instructions != other.instructions: return False |
| 4255 | return True |
| 4256 | |
| 4257 | def __ne__(self, other): |
| 4258 | return not self.__eq__(other) |
| 4259 | |
| 4260 | def __str__(self): |
| 4261 | return self.show() |
| 4262 | |
| 4263 | def show(self): |
| 4264 | import loxi.pp |
| 4265 | return loxi.pp.pp(self) |
| 4266 | |
| 4267 | def pretty_print(self, q): |
| 4268 | q.text("flow_modify_strict {") |
| 4269 | with q.group(): |
| 4270 | with q.indent(2): |
| 4271 | q.breakable() |
| 4272 | q.text("xid = "); |
| 4273 | if self.xid != None: |
| 4274 | q.text("%#x" % self.xid) |
| 4275 | else: |
| 4276 | q.text('None') |
| 4277 | q.text(","); q.breakable() |
| 4278 | q.text("cookie = "); |
| 4279 | q.text("%#x" % self.cookie) |
| 4280 | q.text(","); q.breakable() |
| 4281 | q.text("cookie_mask = "); |
| 4282 | q.text("%#x" % self.cookie_mask) |
| 4283 | q.text(","); q.breakable() |
| 4284 | q.text("table_id = "); |
| 4285 | q.text("%#x" % self.table_id) |
| 4286 | q.text(","); q.breakable() |
| 4287 | q.text("idle_timeout = "); |
| 4288 | q.text("%#x" % self.idle_timeout) |
| 4289 | q.text(","); q.breakable() |
| 4290 | q.text("hard_timeout = "); |
| 4291 | q.text("%#x" % self.hard_timeout) |
| 4292 | q.text(","); q.breakable() |
| 4293 | q.text("priority = "); |
| 4294 | q.text("%#x" % self.priority) |
| 4295 | q.text(","); q.breakable() |
| 4296 | q.text("buffer_id = "); |
| 4297 | q.text("%#x" % self.buffer_id) |
| 4298 | q.text(","); q.breakable() |
| 4299 | q.text("out_port = "); |
| 4300 | q.text(util.pretty_port(self.out_port)) |
| 4301 | q.text(","); q.breakable() |
| 4302 | q.text("out_group = "); |
| 4303 | q.text("%#x" % self.out_group) |
| 4304 | q.text(","); q.breakable() |
| 4305 | q.text("flags = "); |
| 4306 | q.text("%#x" % self.flags) |
| 4307 | q.text(","); q.breakable() |
| 4308 | q.text("match = "); |
| 4309 | q.pp(self.match) |
| 4310 | q.text(","); q.breakable() |
| 4311 | q.text("instructions = "); |
| 4312 | q.pp(self.instructions) |
| 4313 | q.breakable() |
| 4314 | q.text('}') |
| 4315 | |
| 4316 | class flow_removed(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4317 | version = 3 |
| 4318 | type = 11 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4319 | |
| 4320 | 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): |
| 4321 | self.xid = xid |
| 4322 | if cookie != None: |
| 4323 | self.cookie = cookie |
| 4324 | else: |
| 4325 | self.cookie = 0 |
| 4326 | if priority != None: |
| 4327 | self.priority = priority |
| 4328 | else: |
| 4329 | self.priority = 0 |
| 4330 | if reason != None: |
| 4331 | self.reason = reason |
| 4332 | else: |
| 4333 | self.reason = 0 |
| 4334 | if table_id != None: |
| 4335 | self.table_id = table_id |
| 4336 | else: |
| 4337 | self.table_id = 0 |
| 4338 | if duration_sec != None: |
| 4339 | self.duration_sec = duration_sec |
| 4340 | else: |
| 4341 | self.duration_sec = 0 |
| 4342 | if duration_nsec != None: |
| 4343 | self.duration_nsec = duration_nsec |
| 4344 | else: |
| 4345 | self.duration_nsec = 0 |
| 4346 | if idle_timeout != None: |
| 4347 | self.idle_timeout = idle_timeout |
| 4348 | else: |
| 4349 | self.idle_timeout = 0 |
| 4350 | if hard_timeout != None: |
| 4351 | self.hard_timeout = hard_timeout |
| 4352 | else: |
| 4353 | self.hard_timeout = 0 |
| 4354 | if packet_count != None: |
| 4355 | self.packet_count = packet_count |
| 4356 | else: |
| 4357 | self.packet_count = 0 |
| 4358 | if byte_count != None: |
| 4359 | self.byte_count = byte_count |
| 4360 | else: |
| 4361 | self.byte_count = 0 |
| 4362 | if match != None: |
| 4363 | self.match = match |
| 4364 | else: |
| 4365 | self.match = common.match() |
| 4366 | |
| 4367 | def pack(self): |
| 4368 | packed = [] |
| 4369 | packed.append(struct.pack("!B", self.version)) |
| 4370 | packed.append(struct.pack("!B", self.type)) |
| 4371 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4372 | packed.append(struct.pack("!L", self.xid)) |
| 4373 | packed.append(struct.pack("!Q", self.cookie)) |
| 4374 | packed.append(struct.pack("!H", self.priority)) |
| 4375 | packed.append(struct.pack("!B", self.reason)) |
| 4376 | packed.append(struct.pack("!B", self.table_id)) |
| 4377 | packed.append(struct.pack("!L", self.duration_sec)) |
| 4378 | packed.append(struct.pack("!L", self.duration_nsec)) |
| 4379 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 4380 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 4381 | packed.append(struct.pack("!Q", self.packet_count)) |
| 4382 | packed.append(struct.pack("!Q", self.byte_count)) |
| 4383 | packed.append(self.match.pack()) |
| 4384 | length = sum([len(x) for x in packed]) |
| 4385 | packed[2] = struct.pack("!H", length) |
| 4386 | return ''.join(packed) |
| 4387 | |
| 4388 | @staticmethod |
| 4389 | def unpack(buf): |
| 4390 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 4391 | obj = flow_removed() |
| 4392 | if type(buf) == loxi.generic_util.OFReader: |
| 4393 | reader = buf |
| 4394 | else: |
| 4395 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4396 | _version = reader.read("!B")[0] |
| 4397 | assert(_version == 3) |
| 4398 | _type = reader.read("!B")[0] |
| 4399 | assert(_type == 11) |
| 4400 | _length = reader.read("!H")[0] |
| 4401 | obj.xid = reader.read("!L")[0] |
| 4402 | obj.cookie = reader.read("!Q")[0] |
| 4403 | obj.priority = reader.read("!H")[0] |
| 4404 | obj.reason = reader.read("!B")[0] |
| 4405 | obj.table_id = reader.read("!B")[0] |
| 4406 | obj.duration_sec = reader.read("!L")[0] |
| 4407 | obj.duration_nsec = reader.read("!L")[0] |
| 4408 | obj.idle_timeout = reader.read("!H")[0] |
| 4409 | obj.hard_timeout = reader.read("!H")[0] |
| 4410 | obj.packet_count = reader.read("!Q")[0] |
| 4411 | obj.byte_count = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4412 | obj.match = common.match.unpack(reader) |
| 4413 | return obj |
| 4414 | |
| 4415 | def __eq__(self, other): |
| 4416 | if type(self) != type(other): return False |
| 4417 | if self.version != other.version: return False |
| 4418 | if self.type != other.type: return False |
| 4419 | if self.xid != other.xid: return False |
| 4420 | if self.cookie != other.cookie: return False |
| 4421 | if self.priority != other.priority: return False |
| 4422 | if self.reason != other.reason: return False |
| 4423 | if self.table_id != other.table_id: return False |
| 4424 | if self.duration_sec != other.duration_sec: return False |
| 4425 | if self.duration_nsec != other.duration_nsec: return False |
| 4426 | if self.idle_timeout != other.idle_timeout: return False |
| 4427 | if self.hard_timeout != other.hard_timeout: return False |
| 4428 | if self.packet_count != other.packet_count: return False |
| 4429 | if self.byte_count != other.byte_count: return False |
| 4430 | if self.match != other.match: return False |
| 4431 | return True |
| 4432 | |
| 4433 | def __ne__(self, other): |
| 4434 | return not self.__eq__(other) |
| 4435 | |
| 4436 | def __str__(self): |
| 4437 | return self.show() |
| 4438 | |
| 4439 | def show(self): |
| 4440 | import loxi.pp |
| 4441 | return loxi.pp.pp(self) |
| 4442 | |
| 4443 | def pretty_print(self, q): |
| 4444 | q.text("flow_removed {") |
| 4445 | with q.group(): |
| 4446 | with q.indent(2): |
| 4447 | q.breakable() |
| 4448 | q.text("xid = "); |
| 4449 | if self.xid != None: |
| 4450 | q.text("%#x" % self.xid) |
| 4451 | else: |
| 4452 | q.text('None') |
| 4453 | q.text(","); q.breakable() |
| 4454 | q.text("cookie = "); |
| 4455 | q.text("%#x" % self.cookie) |
| 4456 | q.text(","); q.breakable() |
| 4457 | q.text("priority = "); |
| 4458 | q.text("%#x" % self.priority) |
| 4459 | q.text(","); q.breakable() |
| 4460 | q.text("reason = "); |
| 4461 | q.text("%#x" % self.reason) |
| 4462 | q.text(","); q.breakable() |
| 4463 | q.text("table_id = "); |
| 4464 | q.text("%#x" % self.table_id) |
| 4465 | q.text(","); q.breakable() |
| 4466 | q.text("duration_sec = "); |
| 4467 | q.text("%#x" % self.duration_sec) |
| 4468 | q.text(","); q.breakable() |
| 4469 | q.text("duration_nsec = "); |
| 4470 | q.text("%#x" % self.duration_nsec) |
| 4471 | q.text(","); q.breakable() |
| 4472 | q.text("idle_timeout = "); |
| 4473 | q.text("%#x" % self.idle_timeout) |
| 4474 | q.text(","); q.breakable() |
| 4475 | q.text("hard_timeout = "); |
| 4476 | q.text("%#x" % self.hard_timeout) |
| 4477 | q.text(","); q.breakable() |
| 4478 | q.text("packet_count = "); |
| 4479 | q.text("%#x" % self.packet_count) |
| 4480 | q.text(","); q.breakable() |
| 4481 | q.text("byte_count = "); |
| 4482 | q.text("%#x" % self.byte_count) |
| 4483 | q.text(","); q.breakable() |
| 4484 | q.text("match = "); |
| 4485 | q.pp(self.match) |
| 4486 | q.breakable() |
| 4487 | q.text('}') |
| 4488 | |
| 4489 | class flow_stats_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4490 | version = 3 |
| 4491 | type = 19 |
| 4492 | stats_type = 1 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4493 | |
| 4494 | def __init__(self, xid=None, flags=None, entries=None): |
| 4495 | self.xid = xid |
| 4496 | if flags != None: |
| 4497 | self.flags = flags |
| 4498 | else: |
| 4499 | self.flags = 0 |
| 4500 | if entries != None: |
| 4501 | self.entries = entries |
| 4502 | else: |
| 4503 | self.entries = [] |
| 4504 | |
| 4505 | def pack(self): |
| 4506 | packed = [] |
| 4507 | packed.append(struct.pack("!B", self.version)) |
| 4508 | packed.append(struct.pack("!B", self.type)) |
| 4509 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4510 | packed.append(struct.pack("!L", self.xid)) |
| 4511 | packed.append(struct.pack("!H", self.stats_type)) |
| 4512 | packed.append(struct.pack("!H", self.flags)) |
| 4513 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4514 | packed.append(util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4515 | length = sum([len(x) for x in packed]) |
| 4516 | packed[2] = struct.pack("!H", length) |
| 4517 | return ''.join(packed) |
| 4518 | |
| 4519 | @staticmethod |
| 4520 | def unpack(buf): |
| 4521 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 4522 | obj = flow_stats_reply() |
| 4523 | if type(buf) == loxi.generic_util.OFReader: |
| 4524 | reader = buf |
| 4525 | else: |
| 4526 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4527 | _version = reader.read("!B")[0] |
| 4528 | assert(_version == 3) |
| 4529 | _type = reader.read("!B")[0] |
| 4530 | assert(_type == 19) |
| 4531 | _length = reader.read("!H")[0] |
| 4532 | obj.xid = reader.read("!L")[0] |
| 4533 | _stats_type = reader.read("!H")[0] |
| 4534 | assert(_stats_type == 1) |
| 4535 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4536 | reader.skip(4) |
| 4537 | obj.entries = common.unpack_list_flow_stats_entry(reader) |
| 4538 | return obj |
| 4539 | |
| 4540 | def __eq__(self, other): |
| 4541 | if type(self) != type(other): return False |
| 4542 | if self.version != other.version: return False |
| 4543 | if self.type != other.type: return False |
| 4544 | if self.xid != other.xid: return False |
| 4545 | if self.flags != other.flags: return False |
| 4546 | if self.entries != other.entries: return False |
| 4547 | return True |
| 4548 | |
| 4549 | def __ne__(self, other): |
| 4550 | return not self.__eq__(other) |
| 4551 | |
| 4552 | def __str__(self): |
| 4553 | return self.show() |
| 4554 | |
| 4555 | def show(self): |
| 4556 | import loxi.pp |
| 4557 | return loxi.pp.pp(self) |
| 4558 | |
| 4559 | def pretty_print(self, q): |
| 4560 | q.text("flow_stats_reply {") |
| 4561 | with q.group(): |
| 4562 | with q.indent(2): |
| 4563 | q.breakable() |
| 4564 | q.text("xid = "); |
| 4565 | if self.xid != None: |
| 4566 | q.text("%#x" % self.xid) |
| 4567 | else: |
| 4568 | q.text('None') |
| 4569 | q.text(","); q.breakable() |
| 4570 | q.text("flags = "); |
| 4571 | q.text("%#x" % self.flags) |
| 4572 | q.text(","); q.breakable() |
| 4573 | q.text("entries = "); |
| 4574 | q.pp(self.entries) |
| 4575 | q.breakable() |
| 4576 | q.text('}') |
| 4577 | |
| 4578 | class flow_stats_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4579 | version = 3 |
| 4580 | type = 18 |
| 4581 | stats_type = 1 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4582 | |
| 4583 | def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None): |
| 4584 | self.xid = xid |
| 4585 | if flags != None: |
| 4586 | self.flags = flags |
| 4587 | else: |
| 4588 | self.flags = 0 |
| 4589 | if table_id != None: |
| 4590 | self.table_id = table_id |
| 4591 | else: |
| 4592 | self.table_id = 0 |
| 4593 | if out_port != None: |
| 4594 | self.out_port = out_port |
| 4595 | else: |
| 4596 | self.out_port = 0 |
| 4597 | if out_group != None: |
| 4598 | self.out_group = out_group |
| 4599 | else: |
| 4600 | self.out_group = 0 |
| 4601 | if cookie != None: |
| 4602 | self.cookie = cookie |
| 4603 | else: |
| 4604 | self.cookie = 0 |
| 4605 | if cookie_mask != None: |
| 4606 | self.cookie_mask = cookie_mask |
| 4607 | else: |
| 4608 | self.cookie_mask = 0 |
| 4609 | if match != None: |
| 4610 | self.match = match |
| 4611 | else: |
| 4612 | self.match = common.match() |
| 4613 | |
| 4614 | def pack(self): |
| 4615 | packed = [] |
| 4616 | packed.append(struct.pack("!B", self.version)) |
| 4617 | packed.append(struct.pack("!B", self.type)) |
| 4618 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4619 | packed.append(struct.pack("!L", self.xid)) |
| 4620 | packed.append(struct.pack("!H", self.stats_type)) |
| 4621 | packed.append(struct.pack("!H", self.flags)) |
| 4622 | packed.append('\x00' * 4) |
| 4623 | packed.append(struct.pack("!B", self.table_id)) |
| 4624 | packed.append('\x00' * 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4625 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4626 | packed.append(struct.pack("!L", self.out_group)) |
| 4627 | packed.append('\x00' * 4) |
| 4628 | packed.append(struct.pack("!Q", self.cookie)) |
| 4629 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 4630 | packed.append(self.match.pack()) |
| 4631 | length = sum([len(x) for x in packed]) |
| 4632 | packed[2] = struct.pack("!H", length) |
| 4633 | return ''.join(packed) |
| 4634 | |
| 4635 | @staticmethod |
| 4636 | def unpack(buf): |
| 4637 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 4638 | obj = flow_stats_request() |
| 4639 | if type(buf) == loxi.generic_util.OFReader: |
| 4640 | reader = buf |
| 4641 | else: |
| 4642 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4643 | _version = reader.read("!B")[0] |
| 4644 | assert(_version == 3) |
| 4645 | _type = reader.read("!B")[0] |
| 4646 | assert(_type == 18) |
| 4647 | _length = reader.read("!H")[0] |
| 4648 | obj.xid = reader.read("!L")[0] |
| 4649 | _stats_type = reader.read("!H")[0] |
| 4650 | assert(_stats_type == 1) |
| 4651 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4652 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4653 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4654 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4655 | obj.out_port = util.unpack_port_no(reader) |
| 4656 | obj.out_group = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4657 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4658 | obj.cookie = reader.read("!Q")[0] |
| 4659 | obj.cookie_mask = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4660 | obj.match = common.match.unpack(reader) |
| 4661 | return obj |
| 4662 | |
| 4663 | def __eq__(self, other): |
| 4664 | if type(self) != type(other): return False |
| 4665 | if self.version != other.version: return False |
| 4666 | if self.type != other.type: return False |
| 4667 | if self.xid != other.xid: return False |
| 4668 | if self.flags != other.flags: return False |
| 4669 | if self.table_id != other.table_id: return False |
| 4670 | if self.out_port != other.out_port: return False |
| 4671 | if self.out_group != other.out_group: return False |
| 4672 | if self.cookie != other.cookie: return False |
| 4673 | if self.cookie_mask != other.cookie_mask: return False |
| 4674 | if self.match != other.match: return False |
| 4675 | return True |
| 4676 | |
| 4677 | def __ne__(self, other): |
| 4678 | return not self.__eq__(other) |
| 4679 | |
| 4680 | def __str__(self): |
| 4681 | return self.show() |
| 4682 | |
| 4683 | def show(self): |
| 4684 | import loxi.pp |
| 4685 | return loxi.pp.pp(self) |
| 4686 | |
| 4687 | def pretty_print(self, q): |
| 4688 | q.text("flow_stats_request {") |
| 4689 | with q.group(): |
| 4690 | with q.indent(2): |
| 4691 | q.breakable() |
| 4692 | q.text("xid = "); |
| 4693 | if self.xid != None: |
| 4694 | q.text("%#x" % self.xid) |
| 4695 | else: |
| 4696 | q.text('None') |
| 4697 | q.text(","); q.breakable() |
| 4698 | q.text("flags = "); |
| 4699 | q.text("%#x" % self.flags) |
| 4700 | q.text(","); q.breakable() |
| 4701 | q.text("table_id = "); |
| 4702 | q.text("%#x" % self.table_id) |
| 4703 | q.text(","); q.breakable() |
| 4704 | q.text("out_port = "); |
| 4705 | q.text(util.pretty_port(self.out_port)) |
| 4706 | q.text(","); q.breakable() |
| 4707 | q.text("out_group = "); |
| 4708 | q.text("%#x" % self.out_group) |
| 4709 | q.text(","); q.breakable() |
| 4710 | q.text("cookie = "); |
| 4711 | q.text("%#x" % self.cookie) |
| 4712 | q.text(","); q.breakable() |
| 4713 | q.text("cookie_mask = "); |
| 4714 | q.text("%#x" % self.cookie_mask) |
| 4715 | q.text(","); q.breakable() |
| 4716 | q.text("match = "); |
| 4717 | q.pp(self.match) |
| 4718 | q.breakable() |
| 4719 | q.text('}') |
| 4720 | |
| 4721 | class get_config_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4722 | version = 3 |
| 4723 | type = 8 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4724 | |
| 4725 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
| 4726 | self.xid = xid |
| 4727 | if flags != None: |
| 4728 | self.flags = flags |
| 4729 | else: |
| 4730 | self.flags = 0 |
| 4731 | if miss_send_len != None: |
| 4732 | self.miss_send_len = miss_send_len |
| 4733 | else: |
| 4734 | self.miss_send_len = 0 |
| 4735 | |
| 4736 | def pack(self): |
| 4737 | packed = [] |
| 4738 | packed.append(struct.pack("!B", self.version)) |
| 4739 | packed.append(struct.pack("!B", self.type)) |
| 4740 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4741 | packed.append(struct.pack("!L", self.xid)) |
| 4742 | packed.append(struct.pack("!H", self.flags)) |
| 4743 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 4744 | length = sum([len(x) for x in packed]) |
| 4745 | packed[2] = struct.pack("!H", length) |
| 4746 | return ''.join(packed) |
| 4747 | |
| 4748 | @staticmethod |
| 4749 | def unpack(buf): |
| 4750 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 4751 | obj = get_config_reply() |
| 4752 | if type(buf) == loxi.generic_util.OFReader: |
| 4753 | reader = buf |
| 4754 | else: |
| 4755 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4756 | _version = reader.read("!B")[0] |
| 4757 | assert(_version == 3) |
| 4758 | _type = reader.read("!B")[0] |
| 4759 | assert(_type == 8) |
| 4760 | _length = reader.read("!H")[0] |
| 4761 | obj.xid = reader.read("!L")[0] |
| 4762 | obj.flags = reader.read("!H")[0] |
| 4763 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4764 | return obj |
| 4765 | |
| 4766 | def __eq__(self, other): |
| 4767 | if type(self) != type(other): return False |
| 4768 | if self.version != other.version: return False |
| 4769 | if self.type != other.type: return False |
| 4770 | if self.xid != other.xid: return False |
| 4771 | if self.flags != other.flags: return False |
| 4772 | if self.miss_send_len != other.miss_send_len: return False |
| 4773 | return True |
| 4774 | |
| 4775 | def __ne__(self, other): |
| 4776 | return not self.__eq__(other) |
| 4777 | |
| 4778 | def __str__(self): |
| 4779 | return self.show() |
| 4780 | |
| 4781 | def show(self): |
| 4782 | import loxi.pp |
| 4783 | return loxi.pp.pp(self) |
| 4784 | |
| 4785 | def pretty_print(self, q): |
| 4786 | q.text("get_config_reply {") |
| 4787 | with q.group(): |
| 4788 | with q.indent(2): |
| 4789 | q.breakable() |
| 4790 | q.text("xid = "); |
| 4791 | if self.xid != None: |
| 4792 | q.text("%#x" % self.xid) |
| 4793 | else: |
| 4794 | q.text('None') |
| 4795 | q.text(","); q.breakable() |
| 4796 | q.text("flags = "); |
| 4797 | q.text("%#x" % self.flags) |
| 4798 | q.text(","); q.breakable() |
| 4799 | q.text("miss_send_len = "); |
| 4800 | q.text("%#x" % self.miss_send_len) |
| 4801 | q.breakable() |
| 4802 | q.text('}') |
| 4803 | |
| 4804 | class get_config_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4805 | version = 3 |
| 4806 | type = 7 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4807 | |
| 4808 | def __init__(self, xid=None): |
| 4809 | self.xid = xid |
| 4810 | |
| 4811 | def pack(self): |
| 4812 | packed = [] |
| 4813 | packed.append(struct.pack("!B", self.version)) |
| 4814 | packed.append(struct.pack("!B", self.type)) |
| 4815 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4816 | packed.append(struct.pack("!L", self.xid)) |
| 4817 | length = sum([len(x) for x in packed]) |
| 4818 | packed[2] = struct.pack("!H", length) |
| 4819 | return ''.join(packed) |
| 4820 | |
| 4821 | @staticmethod |
| 4822 | def unpack(buf): |
| 4823 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 4824 | obj = get_config_request() |
| 4825 | if type(buf) == loxi.generic_util.OFReader: |
| 4826 | reader = buf |
| 4827 | else: |
| 4828 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4829 | _version = reader.read("!B")[0] |
| 4830 | assert(_version == 3) |
| 4831 | _type = reader.read("!B")[0] |
| 4832 | assert(_type == 7) |
| 4833 | _length = reader.read("!H")[0] |
| 4834 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4835 | return obj |
| 4836 | |
| 4837 | def __eq__(self, other): |
| 4838 | if type(self) != type(other): return False |
| 4839 | if self.version != other.version: return False |
| 4840 | if self.type != other.type: return False |
| 4841 | if self.xid != other.xid: return False |
| 4842 | return True |
| 4843 | |
| 4844 | def __ne__(self, other): |
| 4845 | return not self.__eq__(other) |
| 4846 | |
| 4847 | def __str__(self): |
| 4848 | return self.show() |
| 4849 | |
| 4850 | def show(self): |
| 4851 | import loxi.pp |
| 4852 | return loxi.pp.pp(self) |
| 4853 | |
| 4854 | def pretty_print(self, q): |
| 4855 | q.text("get_config_request {") |
| 4856 | with q.group(): |
| 4857 | with q.indent(2): |
| 4858 | q.breakable() |
| 4859 | q.text("xid = "); |
| 4860 | if self.xid != None: |
| 4861 | q.text("%#x" % self.xid) |
| 4862 | else: |
| 4863 | q.text('None') |
| 4864 | q.breakable() |
| 4865 | q.text('}') |
| 4866 | |
| 4867 | class group_desc_stats_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4868 | version = 3 |
| 4869 | type = 19 |
| 4870 | stats_type = 7 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4871 | |
| 4872 | def __init__(self, xid=None, flags=None, entries=None): |
| 4873 | self.xid = xid |
| 4874 | if flags != None: |
| 4875 | self.flags = flags |
| 4876 | else: |
| 4877 | self.flags = 0 |
| 4878 | if entries != None: |
| 4879 | self.entries = entries |
| 4880 | else: |
| 4881 | self.entries = [] |
| 4882 | |
| 4883 | def pack(self): |
| 4884 | packed = [] |
| 4885 | packed.append(struct.pack("!B", self.version)) |
| 4886 | packed.append(struct.pack("!B", self.type)) |
| 4887 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4888 | packed.append(struct.pack("!L", self.xid)) |
| 4889 | packed.append(struct.pack("!H", self.stats_type)) |
| 4890 | packed.append(struct.pack("!H", self.flags)) |
| 4891 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4892 | packed.append(util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4893 | length = sum([len(x) for x in packed]) |
| 4894 | packed[2] = struct.pack("!H", length) |
| 4895 | return ''.join(packed) |
| 4896 | |
| 4897 | @staticmethod |
| 4898 | def unpack(buf): |
| 4899 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 4900 | obj = group_desc_stats_reply() |
| 4901 | if type(buf) == loxi.generic_util.OFReader: |
| 4902 | reader = buf |
| 4903 | else: |
| 4904 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4905 | _version = reader.read("!B")[0] |
| 4906 | assert(_version == 3) |
| 4907 | _type = reader.read("!B")[0] |
| 4908 | assert(_type == 19) |
| 4909 | _length = reader.read("!H")[0] |
| 4910 | obj.xid = reader.read("!L")[0] |
| 4911 | _stats_type = reader.read("!H")[0] |
| 4912 | assert(_stats_type == 7) |
| 4913 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4914 | reader.skip(4) |
| 4915 | obj.entries = common.unpack_list_group_desc_stats_entry(reader) |
| 4916 | return obj |
| 4917 | |
| 4918 | def __eq__(self, other): |
| 4919 | if type(self) != type(other): return False |
| 4920 | if self.version != other.version: return False |
| 4921 | if self.type != other.type: return False |
| 4922 | if self.xid != other.xid: return False |
| 4923 | if self.flags != other.flags: return False |
| 4924 | if self.entries != other.entries: return False |
| 4925 | return True |
| 4926 | |
| 4927 | def __ne__(self, other): |
| 4928 | return not self.__eq__(other) |
| 4929 | |
| 4930 | def __str__(self): |
| 4931 | return self.show() |
| 4932 | |
| 4933 | def show(self): |
| 4934 | import loxi.pp |
| 4935 | return loxi.pp.pp(self) |
| 4936 | |
| 4937 | def pretty_print(self, q): |
| 4938 | q.text("group_desc_stats_reply {") |
| 4939 | with q.group(): |
| 4940 | with q.indent(2): |
| 4941 | q.breakable() |
| 4942 | q.text("xid = "); |
| 4943 | if self.xid != None: |
| 4944 | q.text("%#x" % self.xid) |
| 4945 | else: |
| 4946 | q.text('None') |
| 4947 | q.text(","); q.breakable() |
| 4948 | q.text("flags = "); |
| 4949 | q.text("%#x" % self.flags) |
| 4950 | q.text(","); q.breakable() |
| 4951 | q.text("entries = "); |
| 4952 | q.pp(self.entries) |
| 4953 | q.breakable() |
| 4954 | q.text('}') |
| 4955 | |
| 4956 | class group_desc_stats_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4957 | version = 3 |
| 4958 | type = 18 |
| 4959 | stats_type = 7 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4960 | |
| 4961 | def __init__(self, xid=None, flags=None): |
| 4962 | self.xid = xid |
| 4963 | if flags != None: |
| 4964 | self.flags = flags |
| 4965 | else: |
| 4966 | self.flags = 0 |
| 4967 | |
| 4968 | def pack(self): |
| 4969 | packed = [] |
| 4970 | packed.append(struct.pack("!B", self.version)) |
| 4971 | packed.append(struct.pack("!B", self.type)) |
| 4972 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4973 | packed.append(struct.pack("!L", self.xid)) |
| 4974 | packed.append(struct.pack("!H", self.stats_type)) |
| 4975 | packed.append(struct.pack("!H", self.flags)) |
| 4976 | packed.append('\x00' * 4) |
| 4977 | length = sum([len(x) for x in packed]) |
| 4978 | packed[2] = struct.pack("!H", length) |
| 4979 | return ''.join(packed) |
| 4980 | |
| 4981 | @staticmethod |
| 4982 | def unpack(buf): |
| 4983 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 4984 | obj = group_desc_stats_request() |
| 4985 | if type(buf) == loxi.generic_util.OFReader: |
| 4986 | reader = buf |
| 4987 | else: |
| 4988 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4989 | _version = reader.read("!B")[0] |
| 4990 | assert(_version == 3) |
| 4991 | _type = reader.read("!B")[0] |
| 4992 | assert(_type == 18) |
| 4993 | _length = reader.read("!H")[0] |
| 4994 | obj.xid = reader.read("!L")[0] |
| 4995 | _stats_type = reader.read("!H")[0] |
| 4996 | assert(_stats_type == 7) |
| 4997 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4998 | reader.skip(4) |
| 4999 | return obj |
| 5000 | |
| 5001 | def __eq__(self, other): |
| 5002 | if type(self) != type(other): return False |
| 5003 | if self.version != other.version: return False |
| 5004 | if self.type != other.type: return False |
| 5005 | if self.xid != other.xid: return False |
| 5006 | if self.flags != other.flags: return False |
| 5007 | return True |
| 5008 | |
| 5009 | def __ne__(self, other): |
| 5010 | return not self.__eq__(other) |
| 5011 | |
| 5012 | def __str__(self): |
| 5013 | return self.show() |
| 5014 | |
| 5015 | def show(self): |
| 5016 | import loxi.pp |
| 5017 | return loxi.pp.pp(self) |
| 5018 | |
| 5019 | def pretty_print(self, q): |
| 5020 | q.text("group_desc_stats_request {") |
| 5021 | with q.group(): |
| 5022 | with q.indent(2): |
| 5023 | q.breakable() |
| 5024 | q.text("xid = "); |
| 5025 | if self.xid != None: |
| 5026 | q.text("%#x" % self.xid) |
| 5027 | else: |
| 5028 | q.text('None') |
| 5029 | q.text(","); q.breakable() |
| 5030 | q.text("flags = "); |
| 5031 | q.text("%#x" % self.flags) |
| 5032 | q.breakable() |
| 5033 | q.text('}') |
| 5034 | |
| 5035 | class group_features_stats_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5036 | version = 3 |
| 5037 | type = 19 |
| 5038 | stats_type = 8 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5039 | |
| 5040 | 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): |
| 5041 | self.xid = xid |
| 5042 | if flags != None: |
| 5043 | self.flags = flags |
| 5044 | else: |
| 5045 | self.flags = 0 |
| 5046 | if types != None: |
| 5047 | self.types = types |
| 5048 | else: |
| 5049 | self.types = 0 |
| 5050 | if capabilities != None: |
| 5051 | self.capabilities = capabilities |
| 5052 | else: |
| 5053 | self.capabilities = 0 |
| 5054 | if max_groups_all != None: |
| 5055 | self.max_groups_all = max_groups_all |
| 5056 | else: |
| 5057 | self.max_groups_all = 0 |
| 5058 | if max_groups_select != None: |
| 5059 | self.max_groups_select = max_groups_select |
| 5060 | else: |
| 5061 | self.max_groups_select = 0 |
| 5062 | if max_groups_indirect != None: |
| 5063 | self.max_groups_indirect = max_groups_indirect |
| 5064 | else: |
| 5065 | self.max_groups_indirect = 0 |
| 5066 | if max_groups_ff != None: |
| 5067 | self.max_groups_ff = max_groups_ff |
| 5068 | else: |
| 5069 | self.max_groups_ff = 0 |
| 5070 | if actions_all != None: |
| 5071 | self.actions_all = actions_all |
| 5072 | else: |
| 5073 | self.actions_all = 0 |
| 5074 | if actions_select != None: |
| 5075 | self.actions_select = actions_select |
| 5076 | else: |
| 5077 | self.actions_select = 0 |
| 5078 | if actions_indirect != None: |
| 5079 | self.actions_indirect = actions_indirect |
| 5080 | else: |
| 5081 | self.actions_indirect = 0 |
| 5082 | if actions_ff != None: |
| 5083 | self.actions_ff = actions_ff |
| 5084 | else: |
| 5085 | self.actions_ff = 0 |
| 5086 | |
| 5087 | def pack(self): |
| 5088 | packed = [] |
| 5089 | packed.append(struct.pack("!B", self.version)) |
| 5090 | packed.append(struct.pack("!B", self.type)) |
| 5091 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5092 | packed.append(struct.pack("!L", self.xid)) |
| 5093 | packed.append(struct.pack("!H", self.stats_type)) |
| 5094 | packed.append(struct.pack("!H", self.flags)) |
| 5095 | packed.append('\x00' * 4) |
| 5096 | packed.append(struct.pack("!L", self.types)) |
| 5097 | packed.append(struct.pack("!L", self.capabilities)) |
| 5098 | packed.append(struct.pack("!L", self.max_groups_all)) |
| 5099 | packed.append(struct.pack("!L", self.max_groups_select)) |
| 5100 | packed.append(struct.pack("!L", self.max_groups_indirect)) |
| 5101 | packed.append(struct.pack("!L", self.max_groups_ff)) |
| 5102 | packed.append(struct.pack("!L", self.actions_all)) |
| 5103 | packed.append(struct.pack("!L", self.actions_select)) |
| 5104 | packed.append(struct.pack("!L", self.actions_indirect)) |
| 5105 | packed.append(struct.pack("!L", self.actions_ff)) |
| 5106 | length = sum([len(x) for x in packed]) |
| 5107 | packed[2] = struct.pack("!H", length) |
| 5108 | return ''.join(packed) |
| 5109 | |
| 5110 | @staticmethod |
| 5111 | def unpack(buf): |
| 5112 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 5113 | obj = group_features_stats_reply() |
| 5114 | if type(buf) == loxi.generic_util.OFReader: |
| 5115 | reader = buf |
| 5116 | else: |
| 5117 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5118 | _version = reader.read("!B")[0] |
| 5119 | assert(_version == 3) |
| 5120 | _type = reader.read("!B")[0] |
| 5121 | assert(_type == 19) |
| 5122 | _length = reader.read("!H")[0] |
| 5123 | obj.xid = reader.read("!L")[0] |
| 5124 | _stats_type = reader.read("!H")[0] |
| 5125 | assert(_stats_type == 8) |
| 5126 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5127 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5128 | obj.types = reader.read("!L")[0] |
| 5129 | obj.capabilities = reader.read("!L")[0] |
| 5130 | obj.max_groups_all = reader.read("!L")[0] |
| 5131 | obj.max_groups_select = reader.read("!L")[0] |
| 5132 | obj.max_groups_indirect = reader.read("!L")[0] |
| 5133 | obj.max_groups_ff = reader.read("!L")[0] |
| 5134 | obj.actions_all = reader.read("!L")[0] |
| 5135 | obj.actions_select = reader.read("!L")[0] |
| 5136 | obj.actions_indirect = reader.read("!L")[0] |
| 5137 | obj.actions_ff = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5138 | return obj |
| 5139 | |
| 5140 | def __eq__(self, other): |
| 5141 | if type(self) != type(other): return False |
| 5142 | if self.version != other.version: return False |
| 5143 | if self.type != other.type: return False |
| 5144 | if self.xid != other.xid: return False |
| 5145 | if self.flags != other.flags: return False |
| 5146 | if self.types != other.types: return False |
| 5147 | if self.capabilities != other.capabilities: return False |
| 5148 | if self.max_groups_all != other.max_groups_all: return False |
| 5149 | if self.max_groups_select != other.max_groups_select: return False |
| 5150 | if self.max_groups_indirect != other.max_groups_indirect: return False |
| 5151 | if self.max_groups_ff != other.max_groups_ff: return False |
| 5152 | if self.actions_all != other.actions_all: return False |
| 5153 | if self.actions_select != other.actions_select: return False |
| 5154 | if self.actions_indirect != other.actions_indirect: return False |
| 5155 | if self.actions_ff != other.actions_ff: return False |
| 5156 | return True |
| 5157 | |
| 5158 | def __ne__(self, other): |
| 5159 | return not self.__eq__(other) |
| 5160 | |
| 5161 | def __str__(self): |
| 5162 | return self.show() |
| 5163 | |
| 5164 | def show(self): |
| 5165 | import loxi.pp |
| 5166 | return loxi.pp.pp(self) |
| 5167 | |
| 5168 | def pretty_print(self, q): |
| 5169 | q.text("group_features_stats_reply {") |
| 5170 | with q.group(): |
| 5171 | with q.indent(2): |
| 5172 | q.breakable() |
| 5173 | q.text("xid = "); |
| 5174 | if self.xid != None: |
| 5175 | q.text("%#x" % self.xid) |
| 5176 | else: |
| 5177 | q.text('None') |
| 5178 | q.text(","); q.breakable() |
| 5179 | q.text("flags = "); |
| 5180 | q.text("%#x" % self.flags) |
| 5181 | q.text(","); q.breakable() |
| 5182 | q.text("types = "); |
| 5183 | q.text("%#x" % self.types) |
| 5184 | q.text(","); q.breakable() |
| 5185 | q.text("capabilities = "); |
| 5186 | q.text("%#x" % self.capabilities) |
| 5187 | q.text(","); q.breakable() |
| 5188 | q.text("max_groups_all = "); |
| 5189 | q.text("%#x" % self.max_groups_all) |
| 5190 | q.text(","); q.breakable() |
| 5191 | q.text("max_groups_select = "); |
| 5192 | q.text("%#x" % self.max_groups_select) |
| 5193 | q.text(","); q.breakable() |
| 5194 | q.text("max_groups_indirect = "); |
| 5195 | q.text("%#x" % self.max_groups_indirect) |
| 5196 | q.text(","); q.breakable() |
| 5197 | q.text("max_groups_ff = "); |
| 5198 | q.text("%#x" % self.max_groups_ff) |
| 5199 | q.text(","); q.breakable() |
| 5200 | q.text("actions_all = "); |
| 5201 | q.text("%#x" % self.actions_all) |
| 5202 | q.text(","); q.breakable() |
| 5203 | q.text("actions_select = "); |
| 5204 | q.text("%#x" % self.actions_select) |
| 5205 | q.text(","); q.breakable() |
| 5206 | q.text("actions_indirect = "); |
| 5207 | q.text("%#x" % self.actions_indirect) |
| 5208 | q.text(","); q.breakable() |
| 5209 | q.text("actions_ff = "); |
| 5210 | q.text("%#x" % self.actions_ff) |
| 5211 | q.breakable() |
| 5212 | q.text('}') |
| 5213 | |
| 5214 | class group_features_stats_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5215 | version = 3 |
| 5216 | type = 18 |
| 5217 | stats_type = 8 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5218 | |
| 5219 | def __init__(self, xid=None, flags=None): |
| 5220 | self.xid = xid |
| 5221 | if flags != None: |
| 5222 | self.flags = flags |
| 5223 | else: |
| 5224 | self.flags = 0 |
| 5225 | |
| 5226 | def pack(self): |
| 5227 | packed = [] |
| 5228 | packed.append(struct.pack("!B", self.version)) |
| 5229 | packed.append(struct.pack("!B", self.type)) |
| 5230 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5231 | packed.append(struct.pack("!L", self.xid)) |
| 5232 | packed.append(struct.pack("!H", self.stats_type)) |
| 5233 | packed.append(struct.pack("!H", self.flags)) |
| 5234 | packed.append('\x00' * 4) |
| 5235 | length = sum([len(x) for x in packed]) |
| 5236 | packed[2] = struct.pack("!H", length) |
| 5237 | return ''.join(packed) |
| 5238 | |
| 5239 | @staticmethod |
| 5240 | def unpack(buf): |
| 5241 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 5242 | obj = group_features_stats_request() |
| 5243 | if type(buf) == loxi.generic_util.OFReader: |
| 5244 | reader = buf |
| 5245 | else: |
| 5246 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5247 | _version = reader.read("!B")[0] |
| 5248 | assert(_version == 3) |
| 5249 | _type = reader.read("!B")[0] |
| 5250 | assert(_type == 18) |
| 5251 | _length = reader.read("!H")[0] |
| 5252 | obj.xid = reader.read("!L")[0] |
| 5253 | _stats_type = reader.read("!H")[0] |
| 5254 | assert(_stats_type == 8) |
| 5255 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5256 | reader.skip(4) |
| 5257 | return obj |
| 5258 | |
| 5259 | def __eq__(self, other): |
| 5260 | if type(self) != type(other): return False |
| 5261 | if self.version != other.version: return False |
| 5262 | if self.type != other.type: return False |
| 5263 | if self.xid != other.xid: return False |
| 5264 | if self.flags != other.flags: return False |
| 5265 | return True |
| 5266 | |
| 5267 | def __ne__(self, other): |
| 5268 | return not self.__eq__(other) |
| 5269 | |
| 5270 | def __str__(self): |
| 5271 | return self.show() |
| 5272 | |
| 5273 | def show(self): |
| 5274 | import loxi.pp |
| 5275 | return loxi.pp.pp(self) |
| 5276 | |
| 5277 | def pretty_print(self, q): |
| 5278 | q.text("group_features_stats_request {") |
| 5279 | with q.group(): |
| 5280 | with q.indent(2): |
| 5281 | q.breakable() |
| 5282 | q.text("xid = "); |
| 5283 | if self.xid != None: |
| 5284 | q.text("%#x" % self.xid) |
| 5285 | else: |
| 5286 | q.text('None') |
| 5287 | q.text(","); q.breakable() |
| 5288 | q.text("flags = "); |
| 5289 | q.text("%#x" % self.flags) |
| 5290 | q.breakable() |
| 5291 | q.text('}') |
| 5292 | |
| 5293 | class group_mod(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5294 | version = 3 |
| 5295 | type = 15 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5296 | |
| 5297 | def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None): |
| 5298 | self.xid = xid |
| 5299 | if command != None: |
| 5300 | self.command = command |
| 5301 | else: |
| 5302 | self.command = 0 |
| 5303 | if group_type != None: |
| 5304 | self.group_type = group_type |
| 5305 | else: |
| 5306 | self.group_type = 0 |
| 5307 | if group_id != None: |
| 5308 | self.group_id = group_id |
| 5309 | else: |
| 5310 | self.group_id = 0 |
| 5311 | if buckets != None: |
| 5312 | self.buckets = buckets |
| 5313 | else: |
| 5314 | self.buckets = [] |
| 5315 | |
| 5316 | def pack(self): |
| 5317 | packed = [] |
| 5318 | packed.append(struct.pack("!B", self.version)) |
| 5319 | packed.append(struct.pack("!B", self.type)) |
| 5320 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5321 | packed.append(struct.pack("!L", self.xid)) |
| 5322 | packed.append(struct.pack("!H", self.command)) |
| 5323 | packed.append(struct.pack("!B", self.group_type)) |
| 5324 | packed.append('\x00' * 1) |
| 5325 | packed.append(struct.pack("!L", self.group_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5326 | packed.append(util.pack_list(self.buckets)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5327 | length = sum([len(x) for x in packed]) |
| 5328 | packed[2] = struct.pack("!H", length) |
| 5329 | return ''.join(packed) |
| 5330 | |
| 5331 | @staticmethod |
| 5332 | def unpack(buf): |
| 5333 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 5334 | obj = group_mod() |
| 5335 | if type(buf) == loxi.generic_util.OFReader: |
| 5336 | reader = buf |
| 5337 | else: |
| 5338 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5339 | _version = reader.read("!B")[0] |
| 5340 | assert(_version == 3) |
| 5341 | _type = reader.read("!B")[0] |
| 5342 | assert(_type == 15) |
| 5343 | _length = reader.read("!H")[0] |
| 5344 | obj.xid = reader.read("!L")[0] |
| 5345 | obj.command = reader.read("!H")[0] |
| 5346 | obj.group_type = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5347 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5348 | obj.group_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5349 | obj.buckets = common.unpack_list_bucket(reader) |
| 5350 | return obj |
| 5351 | |
| 5352 | def __eq__(self, other): |
| 5353 | if type(self) != type(other): return False |
| 5354 | if self.version != other.version: return False |
| 5355 | if self.type != other.type: return False |
| 5356 | if self.xid != other.xid: return False |
| 5357 | if self.command != other.command: return False |
| 5358 | if self.group_type != other.group_type: return False |
| 5359 | if self.group_id != other.group_id: return False |
| 5360 | if self.buckets != other.buckets: return False |
| 5361 | return True |
| 5362 | |
| 5363 | def __ne__(self, other): |
| 5364 | return not self.__eq__(other) |
| 5365 | |
| 5366 | def __str__(self): |
| 5367 | return self.show() |
| 5368 | |
| 5369 | def show(self): |
| 5370 | import loxi.pp |
| 5371 | return loxi.pp.pp(self) |
| 5372 | |
| 5373 | def pretty_print(self, q): |
| 5374 | q.text("group_mod {") |
| 5375 | with q.group(): |
| 5376 | with q.indent(2): |
| 5377 | q.breakable() |
| 5378 | q.text("xid = "); |
| 5379 | if self.xid != None: |
| 5380 | q.text("%#x" % self.xid) |
| 5381 | else: |
| 5382 | q.text('None') |
| 5383 | q.text(","); q.breakable() |
| 5384 | q.text("command = "); |
| 5385 | q.text("%#x" % self.command) |
| 5386 | q.text(","); q.breakable() |
| 5387 | q.text("group_type = "); |
| 5388 | q.text("%#x" % self.group_type) |
| 5389 | q.text(","); q.breakable() |
| 5390 | q.text("group_id = "); |
| 5391 | q.text("%#x" % self.group_id) |
| 5392 | q.text(","); q.breakable() |
| 5393 | q.text("buckets = "); |
| 5394 | q.pp(self.buckets) |
| 5395 | q.breakable() |
| 5396 | q.text('}') |
| 5397 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5398 | class group_mod_failed_error_msg(Message): |
| 5399 | version = 3 |
| 5400 | type = 1 |
| 5401 | err_type = 6 |
| 5402 | |
| 5403 | def __init__(self, xid=None, code=None, data=None): |
| 5404 | self.xid = xid |
| 5405 | if code != None: |
| 5406 | self.code = code |
| 5407 | else: |
| 5408 | self.code = 0 |
| 5409 | if data != None: |
| 5410 | self.data = data |
| 5411 | else: |
| 5412 | self.data = '' |
| 5413 | |
| 5414 | def pack(self): |
| 5415 | packed = [] |
| 5416 | packed.append(struct.pack("!B", self.version)) |
| 5417 | packed.append(struct.pack("!B", self.type)) |
| 5418 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5419 | packed.append(struct.pack("!L", self.xid)) |
| 5420 | packed.append(struct.pack("!H", self.err_type)) |
| 5421 | packed.append(struct.pack("!H", self.code)) |
| 5422 | packed.append(self.data) |
| 5423 | length = sum([len(x) for x in packed]) |
| 5424 | packed[2] = struct.pack("!H", length) |
| 5425 | return ''.join(packed) |
| 5426 | |
| 5427 | @staticmethod |
| 5428 | def unpack(buf): |
| 5429 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 5430 | obj = group_mod_failed_error_msg() |
| 5431 | if type(buf) == loxi.generic_util.OFReader: |
| 5432 | reader = buf |
| 5433 | else: |
| 5434 | reader = loxi.generic_util.OFReader(buf) |
| 5435 | _version = reader.read("!B")[0] |
| 5436 | assert(_version == 3) |
| 5437 | _type = reader.read("!B")[0] |
| 5438 | assert(_type == 1) |
| 5439 | _length = reader.read("!H")[0] |
| 5440 | obj.xid = reader.read("!L")[0] |
| 5441 | _err_type = reader.read("!H")[0] |
| 5442 | assert(_err_type == 6) |
| 5443 | obj.code = reader.read("!H")[0] |
| 5444 | obj.data = str(reader.read_all()) |
| 5445 | return obj |
| 5446 | |
| 5447 | def __eq__(self, other): |
| 5448 | if type(self) != type(other): return False |
| 5449 | if self.version != other.version: return False |
| 5450 | if self.type != other.type: return False |
| 5451 | if self.xid != other.xid: return False |
| 5452 | if self.code != other.code: return False |
| 5453 | if self.data != other.data: return False |
| 5454 | return True |
| 5455 | |
| 5456 | def __ne__(self, other): |
| 5457 | return not self.__eq__(other) |
| 5458 | |
| 5459 | def __str__(self): |
| 5460 | return self.show() |
| 5461 | |
| 5462 | def show(self): |
| 5463 | import loxi.pp |
| 5464 | return loxi.pp.pp(self) |
| 5465 | |
| 5466 | def pretty_print(self, q): |
| 5467 | q.text("group_mod_failed_error_msg {") |
| 5468 | with q.group(): |
| 5469 | with q.indent(2): |
| 5470 | q.breakable() |
| 5471 | q.text("xid = "); |
| 5472 | if self.xid != None: |
| 5473 | q.text("%#x" % self.xid) |
| 5474 | else: |
| 5475 | q.text('None') |
| 5476 | q.text(","); q.breakable() |
| 5477 | q.text("code = "); |
| 5478 | q.text("%#x" % self.code) |
| 5479 | q.text(","); q.breakable() |
| 5480 | q.text("data = "); |
| 5481 | q.pp(self.data) |
| 5482 | q.breakable() |
| 5483 | q.text('}') |
| 5484 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5485 | class group_stats_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5486 | version = 3 |
| 5487 | type = 19 |
| 5488 | stats_type = 6 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5489 | |
| 5490 | def __init__(self, xid=None, flags=None, entries=None): |
| 5491 | self.xid = xid |
| 5492 | if flags != None: |
| 5493 | self.flags = flags |
| 5494 | else: |
| 5495 | self.flags = 0 |
| 5496 | if entries != None: |
| 5497 | self.entries = entries |
| 5498 | else: |
| 5499 | self.entries = [] |
| 5500 | |
| 5501 | def pack(self): |
| 5502 | packed = [] |
| 5503 | packed.append(struct.pack("!B", self.version)) |
| 5504 | packed.append(struct.pack("!B", self.type)) |
| 5505 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5506 | packed.append(struct.pack("!L", self.xid)) |
| 5507 | packed.append(struct.pack("!H", self.stats_type)) |
| 5508 | packed.append(struct.pack("!H", self.flags)) |
| 5509 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5510 | packed.append(util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5511 | length = sum([len(x) for x in packed]) |
| 5512 | packed[2] = struct.pack("!H", length) |
| 5513 | return ''.join(packed) |
| 5514 | |
| 5515 | @staticmethod |
| 5516 | def unpack(buf): |
| 5517 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 5518 | obj = group_stats_reply() |
| 5519 | if type(buf) == loxi.generic_util.OFReader: |
| 5520 | reader = buf |
| 5521 | else: |
| 5522 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5523 | _version = reader.read("!B")[0] |
| 5524 | assert(_version == 3) |
| 5525 | _type = reader.read("!B")[0] |
| 5526 | assert(_type == 19) |
| 5527 | _length = reader.read("!H")[0] |
| 5528 | obj.xid = reader.read("!L")[0] |
| 5529 | _stats_type = reader.read("!H")[0] |
| 5530 | assert(_stats_type == 6) |
| 5531 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5532 | reader.skip(4) |
| 5533 | obj.entries = common.unpack_list_group_stats_entry(reader) |
| 5534 | return obj |
| 5535 | |
| 5536 | def __eq__(self, other): |
| 5537 | if type(self) != type(other): return False |
| 5538 | if self.version != other.version: return False |
| 5539 | if self.type != other.type: return False |
| 5540 | if self.xid != other.xid: return False |
| 5541 | if self.flags != other.flags: return False |
| 5542 | if self.entries != other.entries: return False |
| 5543 | return True |
| 5544 | |
| 5545 | def __ne__(self, other): |
| 5546 | return not self.__eq__(other) |
| 5547 | |
| 5548 | def __str__(self): |
| 5549 | return self.show() |
| 5550 | |
| 5551 | def show(self): |
| 5552 | import loxi.pp |
| 5553 | return loxi.pp.pp(self) |
| 5554 | |
| 5555 | def pretty_print(self, q): |
| 5556 | q.text("group_stats_reply {") |
| 5557 | with q.group(): |
| 5558 | with q.indent(2): |
| 5559 | q.breakable() |
| 5560 | q.text("xid = "); |
| 5561 | if self.xid != None: |
| 5562 | q.text("%#x" % self.xid) |
| 5563 | else: |
| 5564 | q.text('None') |
| 5565 | q.text(","); q.breakable() |
| 5566 | q.text("flags = "); |
| 5567 | q.text("%#x" % self.flags) |
| 5568 | q.text(","); q.breakable() |
| 5569 | q.text("entries = "); |
| 5570 | q.pp(self.entries) |
| 5571 | q.breakable() |
| 5572 | q.text('}') |
| 5573 | |
| 5574 | class group_stats_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5575 | version = 3 |
| 5576 | type = 18 |
| 5577 | stats_type = 6 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5578 | |
| 5579 | def __init__(self, xid=None, flags=None, group_id=None): |
| 5580 | self.xid = xid |
| 5581 | if flags != None: |
| 5582 | self.flags = flags |
| 5583 | else: |
| 5584 | self.flags = 0 |
| 5585 | if group_id != None: |
| 5586 | self.group_id = group_id |
| 5587 | else: |
| 5588 | self.group_id = 0 |
| 5589 | |
| 5590 | def pack(self): |
| 5591 | packed = [] |
| 5592 | packed.append(struct.pack("!B", self.version)) |
| 5593 | packed.append(struct.pack("!B", self.type)) |
| 5594 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5595 | packed.append(struct.pack("!L", self.xid)) |
| 5596 | packed.append(struct.pack("!H", self.stats_type)) |
| 5597 | packed.append(struct.pack("!H", self.flags)) |
| 5598 | packed.append('\x00' * 4) |
| 5599 | packed.append(struct.pack("!L", self.group_id)) |
| 5600 | packed.append('\x00' * 4) |
| 5601 | length = sum([len(x) for x in packed]) |
| 5602 | packed[2] = struct.pack("!H", length) |
| 5603 | return ''.join(packed) |
| 5604 | |
| 5605 | @staticmethod |
| 5606 | def unpack(buf): |
| 5607 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 5608 | obj = group_stats_request() |
| 5609 | if type(buf) == loxi.generic_util.OFReader: |
| 5610 | reader = buf |
| 5611 | else: |
| 5612 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5613 | _version = reader.read("!B")[0] |
| 5614 | assert(_version == 3) |
| 5615 | _type = reader.read("!B")[0] |
| 5616 | assert(_type == 18) |
| 5617 | _length = reader.read("!H")[0] |
| 5618 | obj.xid = reader.read("!L")[0] |
| 5619 | _stats_type = reader.read("!H")[0] |
| 5620 | assert(_stats_type == 6) |
| 5621 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5622 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5623 | obj.group_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5624 | reader.skip(4) |
| 5625 | return obj |
| 5626 | |
| 5627 | def __eq__(self, other): |
| 5628 | if type(self) != type(other): return False |
| 5629 | if self.version != other.version: return False |
| 5630 | if self.type != other.type: return False |
| 5631 | if self.xid != other.xid: return False |
| 5632 | if self.flags != other.flags: return False |
| 5633 | if self.group_id != other.group_id: return False |
| 5634 | return True |
| 5635 | |
| 5636 | def __ne__(self, other): |
| 5637 | return not self.__eq__(other) |
| 5638 | |
| 5639 | def __str__(self): |
| 5640 | return self.show() |
| 5641 | |
| 5642 | def show(self): |
| 5643 | import loxi.pp |
| 5644 | return loxi.pp.pp(self) |
| 5645 | |
| 5646 | def pretty_print(self, q): |
| 5647 | q.text("group_stats_request {") |
| 5648 | with q.group(): |
| 5649 | with q.indent(2): |
| 5650 | q.breakable() |
| 5651 | q.text("xid = "); |
| 5652 | if self.xid != None: |
| 5653 | q.text("%#x" % self.xid) |
| 5654 | else: |
| 5655 | q.text('None') |
| 5656 | q.text(","); q.breakable() |
| 5657 | q.text("flags = "); |
| 5658 | q.text("%#x" % self.flags) |
| 5659 | q.text(","); q.breakable() |
| 5660 | q.text("group_id = "); |
| 5661 | q.text("%#x" % self.group_id) |
| 5662 | q.breakable() |
| 5663 | q.text('}') |
| 5664 | |
| 5665 | class hello(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5666 | version = 3 |
| 5667 | type = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5668 | |
| 5669 | def __init__(self, xid=None): |
| 5670 | self.xid = xid |
| 5671 | |
| 5672 | def pack(self): |
| 5673 | packed = [] |
| 5674 | packed.append(struct.pack("!B", self.version)) |
| 5675 | packed.append(struct.pack("!B", self.type)) |
| 5676 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5677 | packed.append(struct.pack("!L", self.xid)) |
| 5678 | length = sum([len(x) for x in packed]) |
| 5679 | packed[2] = struct.pack("!H", length) |
| 5680 | return ''.join(packed) |
| 5681 | |
| 5682 | @staticmethod |
| 5683 | def unpack(buf): |
| 5684 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 5685 | obj = hello() |
| 5686 | if type(buf) == loxi.generic_util.OFReader: |
| 5687 | reader = buf |
| 5688 | else: |
| 5689 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5690 | _version = reader.read("!B")[0] |
| 5691 | assert(_version == 3) |
| 5692 | _type = reader.read("!B")[0] |
| 5693 | assert(_type == 0) |
| 5694 | _length = reader.read("!H")[0] |
| 5695 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5696 | return obj |
| 5697 | |
| 5698 | def __eq__(self, other): |
| 5699 | if type(self) != type(other): return False |
| 5700 | if self.version != other.version: return False |
| 5701 | if self.type != other.type: return False |
| 5702 | if self.xid != other.xid: 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("hello {") |
| 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.breakable() |
| 5726 | q.text('}') |
| 5727 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5728 | class hello_failed_error_msg(Message): |
| 5729 | version = 3 |
| 5730 | type = 1 |
| 5731 | err_type = 0 |
| 5732 | |
| 5733 | def __init__(self, xid=None, code=None, data=None): |
| 5734 | self.xid = xid |
| 5735 | if code != None: |
| 5736 | self.code = code |
| 5737 | else: |
| 5738 | self.code = 0 |
| 5739 | if data != None: |
| 5740 | self.data = data |
| 5741 | else: |
| 5742 | self.data = '' |
| 5743 | |
| 5744 | def pack(self): |
| 5745 | packed = [] |
| 5746 | packed.append(struct.pack("!B", self.version)) |
| 5747 | packed.append(struct.pack("!B", self.type)) |
| 5748 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5749 | packed.append(struct.pack("!L", self.xid)) |
| 5750 | packed.append(struct.pack("!H", self.err_type)) |
| 5751 | packed.append(struct.pack("!H", self.code)) |
| 5752 | packed.append(self.data) |
| 5753 | length = sum([len(x) for x in packed]) |
| 5754 | packed[2] = struct.pack("!H", length) |
| 5755 | return ''.join(packed) |
| 5756 | |
| 5757 | @staticmethod |
| 5758 | def unpack(buf): |
| 5759 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 5760 | obj = hello_failed_error_msg() |
| 5761 | if type(buf) == loxi.generic_util.OFReader: |
| 5762 | reader = buf |
| 5763 | else: |
| 5764 | reader = loxi.generic_util.OFReader(buf) |
| 5765 | _version = reader.read("!B")[0] |
| 5766 | assert(_version == 3) |
| 5767 | _type = reader.read("!B")[0] |
| 5768 | assert(_type == 1) |
| 5769 | _length = reader.read("!H")[0] |
| 5770 | obj.xid = reader.read("!L")[0] |
| 5771 | _err_type = reader.read("!H")[0] |
| 5772 | assert(_err_type == 0) |
| 5773 | obj.code = reader.read("!H")[0] |
| 5774 | obj.data = str(reader.read_all()) |
| 5775 | return obj |
| 5776 | |
| 5777 | def __eq__(self, other): |
| 5778 | if type(self) != type(other): return False |
| 5779 | if self.version != other.version: return False |
| 5780 | if self.type != other.type: return False |
| 5781 | if self.xid != other.xid: return False |
| 5782 | if self.code != other.code: return False |
| 5783 | if self.data != other.data: return False |
| 5784 | return True |
| 5785 | |
| 5786 | def __ne__(self, other): |
| 5787 | return not self.__eq__(other) |
| 5788 | |
| 5789 | def __str__(self): |
| 5790 | return self.show() |
| 5791 | |
| 5792 | def show(self): |
| 5793 | import loxi.pp |
| 5794 | return loxi.pp.pp(self) |
| 5795 | |
| 5796 | def pretty_print(self, q): |
| 5797 | q.text("hello_failed_error_msg {") |
| 5798 | with q.group(): |
| 5799 | with q.indent(2): |
| 5800 | q.breakable() |
| 5801 | q.text("xid = "); |
| 5802 | if self.xid != None: |
| 5803 | q.text("%#x" % self.xid) |
| 5804 | else: |
| 5805 | q.text('None') |
| 5806 | q.text(","); q.breakable() |
| 5807 | q.text("code = "); |
| 5808 | q.text("%#x" % self.code) |
| 5809 | q.text(","); q.breakable() |
| 5810 | q.text("data = "); |
| 5811 | q.pp(self.data) |
| 5812 | q.breakable() |
| 5813 | q.text('}') |
| 5814 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5815 | class packet_in(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5816 | version = 3 |
| 5817 | type = 10 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5818 | |
| 5819 | def __init__(self, xid=None, buffer_id=None, total_len=None, reason=None, table_id=None, match=None, data=None): |
| 5820 | self.xid = xid |
| 5821 | if buffer_id != None: |
| 5822 | self.buffer_id = buffer_id |
| 5823 | else: |
| 5824 | self.buffer_id = 0 |
| 5825 | if total_len != None: |
| 5826 | self.total_len = total_len |
| 5827 | else: |
| 5828 | self.total_len = 0 |
| 5829 | if reason != None: |
| 5830 | self.reason = reason |
| 5831 | else: |
| 5832 | self.reason = 0 |
| 5833 | if table_id != None: |
| 5834 | self.table_id = table_id |
| 5835 | else: |
| 5836 | self.table_id = 0 |
| 5837 | if match != None: |
| 5838 | self.match = match |
| 5839 | else: |
| 5840 | self.match = common.match() |
| 5841 | if data != None: |
| 5842 | self.data = data |
| 5843 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5844 | self.data = '' |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5845 | |
| 5846 | def pack(self): |
| 5847 | packed = [] |
| 5848 | packed.append(struct.pack("!B", self.version)) |
| 5849 | packed.append(struct.pack("!B", self.type)) |
| 5850 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5851 | packed.append(struct.pack("!L", self.xid)) |
| 5852 | packed.append(struct.pack("!L", self.buffer_id)) |
| 5853 | packed.append(struct.pack("!H", self.total_len)) |
| 5854 | packed.append(struct.pack("!B", self.reason)) |
| 5855 | packed.append(struct.pack("!B", self.table_id)) |
| 5856 | packed.append(self.match.pack()) |
| 5857 | packed.append('\x00' * 2) |
| 5858 | packed.append(self.data) |
| 5859 | length = sum([len(x) for x in packed]) |
| 5860 | packed[2] = struct.pack("!H", length) |
| 5861 | return ''.join(packed) |
| 5862 | |
| 5863 | @staticmethod |
| 5864 | def unpack(buf): |
| 5865 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 5866 | obj = packet_in() |
| 5867 | if type(buf) == loxi.generic_util.OFReader: |
| 5868 | reader = buf |
| 5869 | else: |
| 5870 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5871 | _version = reader.read("!B")[0] |
| 5872 | assert(_version == 3) |
| 5873 | _type = reader.read("!B")[0] |
| 5874 | assert(_type == 10) |
| 5875 | _length = reader.read("!H")[0] |
| 5876 | obj.xid = reader.read("!L")[0] |
| 5877 | obj.buffer_id = reader.read("!L")[0] |
| 5878 | obj.total_len = reader.read("!H")[0] |
| 5879 | obj.reason = reader.read("!B")[0] |
| 5880 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5881 | obj.match = common.match.unpack(reader) |
| 5882 | reader.skip(2) |
| 5883 | obj.data = str(reader.read_all()) |
| 5884 | return obj |
| 5885 | |
| 5886 | def __eq__(self, other): |
| 5887 | if type(self) != type(other): return False |
| 5888 | if self.version != other.version: return False |
| 5889 | if self.type != other.type: return False |
| 5890 | if self.xid != other.xid: return False |
| 5891 | if self.buffer_id != other.buffer_id: return False |
| 5892 | if self.total_len != other.total_len: return False |
| 5893 | if self.reason != other.reason: return False |
| 5894 | if self.table_id != other.table_id: return False |
| 5895 | if self.match != other.match: return False |
| 5896 | if self.data != other.data: return False |
| 5897 | return True |
| 5898 | |
| 5899 | def __ne__(self, other): |
| 5900 | return not self.__eq__(other) |
| 5901 | |
| 5902 | def __str__(self): |
| 5903 | return self.show() |
| 5904 | |
| 5905 | def show(self): |
| 5906 | import loxi.pp |
| 5907 | return loxi.pp.pp(self) |
| 5908 | |
| 5909 | def pretty_print(self, q): |
| 5910 | q.text("packet_in {") |
| 5911 | with q.group(): |
| 5912 | with q.indent(2): |
| 5913 | q.breakable() |
| 5914 | q.text("xid = "); |
| 5915 | if self.xid != None: |
| 5916 | q.text("%#x" % self.xid) |
| 5917 | else: |
| 5918 | q.text('None') |
| 5919 | q.text(","); q.breakable() |
| 5920 | q.text("buffer_id = "); |
| 5921 | q.text("%#x" % self.buffer_id) |
| 5922 | q.text(","); q.breakable() |
| 5923 | q.text("total_len = "); |
| 5924 | q.text("%#x" % self.total_len) |
| 5925 | q.text(","); q.breakable() |
| 5926 | q.text("reason = "); |
| 5927 | q.text("%#x" % self.reason) |
| 5928 | q.text(","); q.breakable() |
| 5929 | q.text("table_id = "); |
| 5930 | q.text("%#x" % self.table_id) |
| 5931 | q.text(","); q.breakable() |
| 5932 | q.text("match = "); |
| 5933 | q.pp(self.match) |
| 5934 | q.text(","); q.breakable() |
| 5935 | q.text("data = "); |
| 5936 | q.pp(self.data) |
| 5937 | q.breakable() |
| 5938 | q.text('}') |
| 5939 | |
| 5940 | class packet_out(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5941 | version = 3 |
| 5942 | type = 13 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5943 | |
| 5944 | def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None): |
| 5945 | self.xid = xid |
| 5946 | if buffer_id != None: |
| 5947 | self.buffer_id = buffer_id |
| 5948 | else: |
| 5949 | self.buffer_id = 0 |
| 5950 | if in_port != None: |
| 5951 | self.in_port = in_port |
| 5952 | else: |
| 5953 | self.in_port = 0 |
| 5954 | if actions != None: |
| 5955 | self.actions = actions |
| 5956 | else: |
| 5957 | self.actions = [] |
| 5958 | if data != None: |
| 5959 | self.data = data |
| 5960 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5961 | self.data = '' |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5962 | |
| 5963 | def pack(self): |
| 5964 | packed = [] |
| 5965 | packed.append(struct.pack("!B", self.version)) |
| 5966 | packed.append(struct.pack("!B", self.type)) |
| 5967 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5968 | packed.append(struct.pack("!L", self.xid)) |
| 5969 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5970 | packed.append(util.pack_port_no(self.in_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5971 | packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6 |
| 5972 | packed.append('\x00' * 6) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5973 | packed.append(util.pack_list(self.actions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5974 | packed[6] = struct.pack("!H", len(packed[-1])) |
| 5975 | packed.append(self.data) |
| 5976 | length = sum([len(x) for x in packed]) |
| 5977 | packed[2] = struct.pack("!H", length) |
| 5978 | return ''.join(packed) |
| 5979 | |
| 5980 | @staticmethod |
| 5981 | def unpack(buf): |
| 5982 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 5983 | obj = packet_out() |
| 5984 | if type(buf) == loxi.generic_util.OFReader: |
| 5985 | reader = buf |
| 5986 | else: |
| 5987 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5988 | _version = reader.read("!B")[0] |
| 5989 | assert(_version == 3) |
| 5990 | _type = reader.read("!B")[0] |
| 5991 | assert(_type == 13) |
| 5992 | _length = reader.read("!H")[0] |
| 5993 | obj.xid = reader.read("!L")[0] |
| 5994 | obj.buffer_id = reader.read("!L")[0] |
| 5995 | obj.in_port = util.unpack_port_no(reader) |
| 5996 | _actions_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5997 | reader.skip(6) |
| 5998 | obj.actions = action.unpack_list(reader.slice(_actions_len)) |
| 5999 | obj.data = str(reader.read_all()) |
| 6000 | return obj |
| 6001 | |
| 6002 | def __eq__(self, other): |
| 6003 | if type(self) != type(other): return False |
| 6004 | if self.version != other.version: return False |
| 6005 | if self.type != other.type: return False |
| 6006 | if self.xid != other.xid: return False |
| 6007 | if self.buffer_id != other.buffer_id: return False |
| 6008 | if self.in_port != other.in_port: return False |
| 6009 | if self.actions != other.actions: return False |
| 6010 | if self.data != other.data: return False |
| 6011 | return True |
| 6012 | |
| 6013 | def __ne__(self, other): |
| 6014 | return not self.__eq__(other) |
| 6015 | |
| 6016 | def __str__(self): |
| 6017 | return self.show() |
| 6018 | |
| 6019 | def show(self): |
| 6020 | import loxi.pp |
| 6021 | return loxi.pp.pp(self) |
| 6022 | |
| 6023 | def pretty_print(self, q): |
| 6024 | q.text("packet_out {") |
| 6025 | with q.group(): |
| 6026 | with q.indent(2): |
| 6027 | q.breakable() |
| 6028 | q.text("xid = "); |
| 6029 | if self.xid != None: |
| 6030 | q.text("%#x" % self.xid) |
| 6031 | else: |
| 6032 | q.text('None') |
| 6033 | q.text(","); q.breakable() |
| 6034 | q.text("buffer_id = "); |
| 6035 | q.text("%#x" % self.buffer_id) |
| 6036 | q.text(","); q.breakable() |
| 6037 | q.text("in_port = "); |
| 6038 | q.text(util.pretty_port(self.in_port)) |
| 6039 | q.text(","); q.breakable() |
| 6040 | q.text("actions = "); |
| 6041 | q.pp(self.actions) |
| 6042 | q.text(","); q.breakable() |
| 6043 | q.text("data = "); |
| 6044 | q.pp(self.data) |
| 6045 | q.breakable() |
| 6046 | q.text('}') |
| 6047 | |
| 6048 | class port_mod(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6049 | version = 3 |
| 6050 | type = 16 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6051 | |
| 6052 | def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, advertise=None): |
| 6053 | self.xid = xid |
| 6054 | if port_no != None: |
| 6055 | self.port_no = port_no |
| 6056 | else: |
| 6057 | self.port_no = 0 |
| 6058 | if hw_addr != None: |
| 6059 | self.hw_addr = hw_addr |
| 6060 | else: |
| 6061 | self.hw_addr = [0,0,0,0,0,0] |
| 6062 | if config != None: |
| 6063 | self.config = config |
| 6064 | else: |
| 6065 | self.config = 0 |
| 6066 | if mask != None: |
| 6067 | self.mask = mask |
| 6068 | else: |
| 6069 | self.mask = 0 |
| 6070 | if advertise != None: |
| 6071 | self.advertise = advertise |
| 6072 | else: |
| 6073 | self.advertise = 0 |
| 6074 | |
| 6075 | def pack(self): |
| 6076 | packed = [] |
| 6077 | packed.append(struct.pack("!B", self.version)) |
| 6078 | packed.append(struct.pack("!B", self.type)) |
| 6079 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6080 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6081 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6082 | packed.append('\x00' * 4) |
| 6083 | packed.append(struct.pack("!6B", *self.hw_addr)) |
| 6084 | packed.append('\x00' * 2) |
| 6085 | packed.append(struct.pack("!L", self.config)) |
| 6086 | packed.append(struct.pack("!L", self.mask)) |
| 6087 | packed.append(struct.pack("!L", self.advertise)) |
| 6088 | packed.append('\x00' * 4) |
| 6089 | length = sum([len(x) for x in packed]) |
| 6090 | packed[2] = struct.pack("!H", length) |
| 6091 | return ''.join(packed) |
| 6092 | |
| 6093 | @staticmethod |
| 6094 | def unpack(buf): |
| 6095 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 6096 | obj = port_mod() |
| 6097 | if type(buf) == loxi.generic_util.OFReader: |
| 6098 | reader = buf |
| 6099 | else: |
| 6100 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6101 | _version = reader.read("!B")[0] |
| 6102 | assert(_version == 3) |
| 6103 | _type = reader.read("!B")[0] |
| 6104 | assert(_type == 16) |
| 6105 | _length = reader.read("!H")[0] |
| 6106 | obj.xid = reader.read("!L")[0] |
| 6107 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6108 | reader.skip(4) |
| 6109 | obj.hw_addr = list(reader.read('!6B')) |
| 6110 | reader.skip(2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6111 | obj.config = reader.read("!L")[0] |
| 6112 | obj.mask = reader.read("!L")[0] |
| 6113 | obj.advertise = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6114 | reader.skip(4) |
| 6115 | return obj |
| 6116 | |
| 6117 | def __eq__(self, other): |
| 6118 | if type(self) != type(other): return False |
| 6119 | if self.version != other.version: return False |
| 6120 | if self.type != other.type: return False |
| 6121 | if self.xid != other.xid: return False |
| 6122 | if self.port_no != other.port_no: return False |
| 6123 | if self.hw_addr != other.hw_addr: return False |
| 6124 | if self.config != other.config: return False |
| 6125 | if self.mask != other.mask: return False |
| 6126 | if self.advertise != other.advertise: return False |
| 6127 | return True |
| 6128 | |
| 6129 | def __ne__(self, other): |
| 6130 | return not self.__eq__(other) |
| 6131 | |
| 6132 | def __str__(self): |
| 6133 | return self.show() |
| 6134 | |
| 6135 | def show(self): |
| 6136 | import loxi.pp |
| 6137 | return loxi.pp.pp(self) |
| 6138 | |
| 6139 | def pretty_print(self, q): |
| 6140 | q.text("port_mod {") |
| 6141 | with q.group(): |
| 6142 | with q.indent(2): |
| 6143 | q.breakable() |
| 6144 | q.text("xid = "); |
| 6145 | if self.xid != None: |
| 6146 | q.text("%#x" % self.xid) |
| 6147 | else: |
| 6148 | q.text('None') |
| 6149 | q.text(","); q.breakable() |
| 6150 | q.text("port_no = "); |
| 6151 | q.text(util.pretty_port(self.port_no)) |
| 6152 | q.text(","); q.breakable() |
| 6153 | q.text("hw_addr = "); |
| 6154 | q.text(util.pretty_mac(self.hw_addr)) |
| 6155 | q.text(","); q.breakable() |
| 6156 | q.text("config = "); |
| 6157 | q.text("%#x" % self.config) |
| 6158 | q.text(","); q.breakable() |
| 6159 | q.text("mask = "); |
| 6160 | q.text("%#x" % self.mask) |
| 6161 | q.text(","); q.breakable() |
| 6162 | q.text("advertise = "); |
| 6163 | q.text("%#x" % self.advertise) |
| 6164 | q.breakable() |
| 6165 | q.text('}') |
| 6166 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6167 | class port_mod_failed_error_msg(Message): |
| 6168 | version = 3 |
| 6169 | type = 1 |
| 6170 | err_type = 7 |
| 6171 | |
| 6172 | def __init__(self, xid=None, code=None, data=None): |
| 6173 | self.xid = xid |
| 6174 | if code != None: |
| 6175 | self.code = code |
| 6176 | else: |
| 6177 | self.code = 0 |
| 6178 | if data != None: |
| 6179 | self.data = data |
| 6180 | else: |
| 6181 | self.data = '' |
| 6182 | |
| 6183 | def pack(self): |
| 6184 | packed = [] |
| 6185 | packed.append(struct.pack("!B", self.version)) |
| 6186 | packed.append(struct.pack("!B", self.type)) |
| 6187 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6188 | packed.append(struct.pack("!L", self.xid)) |
| 6189 | packed.append(struct.pack("!H", self.err_type)) |
| 6190 | packed.append(struct.pack("!H", self.code)) |
| 6191 | packed.append(self.data) |
| 6192 | length = sum([len(x) for x in packed]) |
| 6193 | packed[2] = struct.pack("!H", length) |
| 6194 | return ''.join(packed) |
| 6195 | |
| 6196 | @staticmethod |
| 6197 | def unpack(buf): |
| 6198 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 6199 | obj = port_mod_failed_error_msg() |
| 6200 | if type(buf) == loxi.generic_util.OFReader: |
| 6201 | reader = buf |
| 6202 | else: |
| 6203 | reader = loxi.generic_util.OFReader(buf) |
| 6204 | _version = reader.read("!B")[0] |
| 6205 | assert(_version == 3) |
| 6206 | _type = reader.read("!B")[0] |
| 6207 | assert(_type == 1) |
| 6208 | _length = reader.read("!H")[0] |
| 6209 | obj.xid = reader.read("!L")[0] |
| 6210 | _err_type = reader.read("!H")[0] |
| 6211 | assert(_err_type == 7) |
| 6212 | obj.code = reader.read("!H")[0] |
| 6213 | obj.data = str(reader.read_all()) |
| 6214 | return obj |
| 6215 | |
| 6216 | def __eq__(self, other): |
| 6217 | if type(self) != type(other): return False |
| 6218 | if self.version != other.version: return False |
| 6219 | if self.type != other.type: return False |
| 6220 | if self.xid != other.xid: return False |
| 6221 | if self.code != other.code: return False |
| 6222 | if self.data != other.data: return False |
| 6223 | return True |
| 6224 | |
| 6225 | def __ne__(self, other): |
| 6226 | return not self.__eq__(other) |
| 6227 | |
| 6228 | def __str__(self): |
| 6229 | return self.show() |
| 6230 | |
| 6231 | def show(self): |
| 6232 | import loxi.pp |
| 6233 | return loxi.pp.pp(self) |
| 6234 | |
| 6235 | def pretty_print(self, q): |
| 6236 | q.text("port_mod_failed_error_msg {") |
| 6237 | with q.group(): |
| 6238 | with q.indent(2): |
| 6239 | q.breakable() |
| 6240 | q.text("xid = "); |
| 6241 | if self.xid != None: |
| 6242 | q.text("%#x" % self.xid) |
| 6243 | else: |
| 6244 | q.text('None') |
| 6245 | q.text(","); q.breakable() |
| 6246 | q.text("code = "); |
| 6247 | q.text("%#x" % self.code) |
| 6248 | q.text(","); q.breakable() |
| 6249 | q.text("data = "); |
| 6250 | q.pp(self.data) |
| 6251 | q.breakable() |
| 6252 | q.text('}') |
| 6253 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6254 | class port_stats_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6255 | version = 3 |
| 6256 | type = 19 |
| 6257 | stats_type = 4 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6258 | |
| 6259 | def __init__(self, xid=None, flags=None, entries=None): |
| 6260 | self.xid = xid |
| 6261 | if flags != None: |
| 6262 | self.flags = flags |
| 6263 | else: |
| 6264 | self.flags = 0 |
| 6265 | if entries != None: |
| 6266 | self.entries = entries |
| 6267 | else: |
| 6268 | self.entries = [] |
| 6269 | |
| 6270 | def pack(self): |
| 6271 | packed = [] |
| 6272 | packed.append(struct.pack("!B", self.version)) |
| 6273 | packed.append(struct.pack("!B", self.type)) |
| 6274 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6275 | packed.append(struct.pack("!L", self.xid)) |
| 6276 | packed.append(struct.pack("!H", self.stats_type)) |
| 6277 | packed.append(struct.pack("!H", self.flags)) |
| 6278 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6279 | packed.append(util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6280 | length = sum([len(x) for x in packed]) |
| 6281 | packed[2] = struct.pack("!H", length) |
| 6282 | return ''.join(packed) |
| 6283 | |
| 6284 | @staticmethod |
| 6285 | def unpack(buf): |
| 6286 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 6287 | obj = port_stats_reply() |
| 6288 | if type(buf) == loxi.generic_util.OFReader: |
| 6289 | reader = buf |
| 6290 | else: |
| 6291 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6292 | _version = reader.read("!B")[0] |
| 6293 | assert(_version == 3) |
| 6294 | _type = reader.read("!B")[0] |
| 6295 | assert(_type == 19) |
| 6296 | _length = reader.read("!H")[0] |
| 6297 | obj.xid = reader.read("!L")[0] |
| 6298 | _stats_type = reader.read("!H")[0] |
| 6299 | assert(_stats_type == 4) |
| 6300 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6301 | reader.skip(4) |
| 6302 | obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack) |
| 6303 | return obj |
| 6304 | |
| 6305 | def __eq__(self, other): |
| 6306 | if type(self) != type(other): return False |
| 6307 | if self.version != other.version: return False |
| 6308 | if self.type != other.type: return False |
| 6309 | if self.xid != other.xid: return False |
| 6310 | if self.flags != other.flags: return False |
| 6311 | if self.entries != other.entries: return False |
| 6312 | return True |
| 6313 | |
| 6314 | def __ne__(self, other): |
| 6315 | return not self.__eq__(other) |
| 6316 | |
| 6317 | def __str__(self): |
| 6318 | return self.show() |
| 6319 | |
| 6320 | def show(self): |
| 6321 | import loxi.pp |
| 6322 | return loxi.pp.pp(self) |
| 6323 | |
| 6324 | def pretty_print(self, q): |
| 6325 | q.text("port_stats_reply {") |
| 6326 | with q.group(): |
| 6327 | with q.indent(2): |
| 6328 | q.breakable() |
| 6329 | q.text("xid = "); |
| 6330 | if self.xid != None: |
| 6331 | q.text("%#x" % self.xid) |
| 6332 | else: |
| 6333 | q.text('None') |
| 6334 | q.text(","); q.breakable() |
| 6335 | q.text("flags = "); |
| 6336 | q.text("%#x" % self.flags) |
| 6337 | q.text(","); q.breakable() |
| 6338 | q.text("entries = "); |
| 6339 | q.pp(self.entries) |
| 6340 | q.breakable() |
| 6341 | q.text('}') |
| 6342 | |
| 6343 | class port_stats_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6344 | version = 3 |
| 6345 | type = 18 |
| 6346 | stats_type = 4 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6347 | |
| 6348 | def __init__(self, xid=None, flags=None, port_no=None): |
| 6349 | self.xid = xid |
| 6350 | if flags != None: |
| 6351 | self.flags = flags |
| 6352 | else: |
| 6353 | self.flags = 0 |
| 6354 | if port_no != None: |
| 6355 | self.port_no = port_no |
| 6356 | else: |
| 6357 | self.port_no = 0 |
| 6358 | |
| 6359 | def pack(self): |
| 6360 | packed = [] |
| 6361 | packed.append(struct.pack("!B", self.version)) |
| 6362 | packed.append(struct.pack("!B", self.type)) |
| 6363 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6364 | packed.append(struct.pack("!L", self.xid)) |
| 6365 | packed.append(struct.pack("!H", self.stats_type)) |
| 6366 | packed.append(struct.pack("!H", self.flags)) |
| 6367 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6368 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6369 | packed.append('\x00' * 4) |
| 6370 | length = sum([len(x) for x in packed]) |
| 6371 | packed[2] = struct.pack("!H", length) |
| 6372 | return ''.join(packed) |
| 6373 | |
| 6374 | @staticmethod |
| 6375 | def unpack(buf): |
| 6376 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 6377 | obj = port_stats_request() |
| 6378 | if type(buf) == loxi.generic_util.OFReader: |
| 6379 | reader = buf |
| 6380 | else: |
| 6381 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6382 | _version = reader.read("!B")[0] |
| 6383 | assert(_version == 3) |
| 6384 | _type = reader.read("!B")[0] |
| 6385 | assert(_type == 18) |
| 6386 | _length = reader.read("!H")[0] |
| 6387 | obj.xid = reader.read("!L")[0] |
| 6388 | _stats_type = reader.read("!H")[0] |
| 6389 | assert(_stats_type == 4) |
| 6390 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6391 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6392 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6393 | reader.skip(4) |
| 6394 | return obj |
| 6395 | |
| 6396 | def __eq__(self, other): |
| 6397 | if type(self) != type(other): return False |
| 6398 | if self.version != other.version: return False |
| 6399 | if self.type != other.type: return False |
| 6400 | if self.xid != other.xid: return False |
| 6401 | if self.flags != other.flags: return False |
| 6402 | if self.port_no != other.port_no: return False |
| 6403 | return True |
| 6404 | |
| 6405 | def __ne__(self, other): |
| 6406 | return not self.__eq__(other) |
| 6407 | |
| 6408 | def __str__(self): |
| 6409 | return self.show() |
| 6410 | |
| 6411 | def show(self): |
| 6412 | import loxi.pp |
| 6413 | return loxi.pp.pp(self) |
| 6414 | |
| 6415 | def pretty_print(self, q): |
| 6416 | q.text("port_stats_request {") |
| 6417 | with q.group(): |
| 6418 | with q.indent(2): |
| 6419 | q.breakable() |
| 6420 | q.text("xid = "); |
| 6421 | if self.xid != None: |
| 6422 | q.text("%#x" % self.xid) |
| 6423 | else: |
| 6424 | q.text('None') |
| 6425 | q.text(","); q.breakable() |
| 6426 | q.text("flags = "); |
| 6427 | q.text("%#x" % self.flags) |
| 6428 | q.text(","); q.breakable() |
| 6429 | q.text("port_no = "); |
| 6430 | q.text(util.pretty_port(self.port_no)) |
| 6431 | q.breakable() |
| 6432 | q.text('}') |
| 6433 | |
| 6434 | class port_status(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6435 | version = 3 |
| 6436 | type = 12 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6437 | |
| 6438 | def __init__(self, xid=None, reason=None, desc=None): |
| 6439 | self.xid = xid |
| 6440 | if reason != None: |
| 6441 | self.reason = reason |
| 6442 | else: |
| 6443 | self.reason = 0 |
| 6444 | if desc != None: |
| 6445 | self.desc = desc |
| 6446 | else: |
| 6447 | self.desc = common.port_desc() |
| 6448 | |
| 6449 | def pack(self): |
| 6450 | packed = [] |
| 6451 | packed.append(struct.pack("!B", self.version)) |
| 6452 | packed.append(struct.pack("!B", self.type)) |
| 6453 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6454 | packed.append(struct.pack("!L", self.xid)) |
| 6455 | packed.append(struct.pack("!B", self.reason)) |
| 6456 | packed.append('\x00' * 7) |
| 6457 | packed.append(self.desc.pack()) |
| 6458 | length = sum([len(x) for x in packed]) |
| 6459 | packed[2] = struct.pack("!H", length) |
| 6460 | return ''.join(packed) |
| 6461 | |
| 6462 | @staticmethod |
| 6463 | def unpack(buf): |
| 6464 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 6465 | obj = port_status() |
| 6466 | if type(buf) == loxi.generic_util.OFReader: |
| 6467 | reader = buf |
| 6468 | else: |
| 6469 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6470 | _version = reader.read("!B")[0] |
| 6471 | assert(_version == 3) |
| 6472 | _type = reader.read("!B")[0] |
| 6473 | assert(_type == 12) |
| 6474 | _length = reader.read("!H")[0] |
| 6475 | obj.xid = reader.read("!L")[0] |
| 6476 | obj.reason = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6477 | reader.skip(7) |
| 6478 | obj.desc = common.port_desc.unpack(reader) |
| 6479 | return obj |
| 6480 | |
| 6481 | def __eq__(self, other): |
| 6482 | if type(self) != type(other): return False |
| 6483 | if self.version != other.version: return False |
| 6484 | if self.type != other.type: return False |
| 6485 | if self.xid != other.xid: return False |
| 6486 | if self.reason != other.reason: return False |
| 6487 | if self.desc != other.desc: return False |
| 6488 | return True |
| 6489 | |
| 6490 | def __ne__(self, other): |
| 6491 | return not self.__eq__(other) |
| 6492 | |
| 6493 | def __str__(self): |
| 6494 | return self.show() |
| 6495 | |
| 6496 | def show(self): |
| 6497 | import loxi.pp |
| 6498 | return loxi.pp.pp(self) |
| 6499 | |
| 6500 | def pretty_print(self, q): |
| 6501 | q.text("port_status {") |
| 6502 | with q.group(): |
| 6503 | with q.indent(2): |
| 6504 | q.breakable() |
| 6505 | q.text("xid = "); |
| 6506 | if self.xid != None: |
| 6507 | q.text("%#x" % self.xid) |
| 6508 | else: |
| 6509 | q.text('None') |
| 6510 | q.text(","); q.breakable() |
| 6511 | q.text("reason = "); |
| 6512 | q.text("%#x" % self.reason) |
| 6513 | q.text(","); q.breakable() |
| 6514 | q.text("desc = "); |
| 6515 | q.pp(self.desc) |
| 6516 | q.breakable() |
| 6517 | q.text('}') |
| 6518 | |
| 6519 | class queue_get_config_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6520 | version = 3 |
| 6521 | type = 23 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6522 | |
| 6523 | def __init__(self, xid=None, port=None, queues=None): |
| 6524 | self.xid = xid |
| 6525 | if port != None: |
| 6526 | self.port = port |
| 6527 | else: |
| 6528 | self.port = 0 |
| 6529 | if queues != None: |
| 6530 | self.queues = queues |
| 6531 | else: |
| 6532 | self.queues = [] |
| 6533 | |
| 6534 | def pack(self): |
| 6535 | packed = [] |
| 6536 | packed.append(struct.pack("!B", self.version)) |
| 6537 | packed.append(struct.pack("!B", self.type)) |
| 6538 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6539 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6540 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6541 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6542 | packed.append(util.pack_list(self.queues)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6543 | length = sum([len(x) for x in packed]) |
| 6544 | packed[2] = struct.pack("!H", length) |
| 6545 | return ''.join(packed) |
| 6546 | |
| 6547 | @staticmethod |
| 6548 | def unpack(buf): |
| 6549 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 6550 | obj = queue_get_config_reply() |
| 6551 | if type(buf) == loxi.generic_util.OFReader: |
| 6552 | reader = buf |
| 6553 | else: |
| 6554 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6555 | _version = reader.read("!B")[0] |
| 6556 | assert(_version == 3) |
| 6557 | _type = reader.read("!B")[0] |
| 6558 | assert(_type == 23) |
| 6559 | _length = reader.read("!H")[0] |
| 6560 | obj.xid = reader.read("!L")[0] |
| 6561 | obj.port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6562 | reader.skip(4) |
| 6563 | obj.queues = common.unpack_list_packet_queue(reader) |
| 6564 | return obj |
| 6565 | |
| 6566 | def __eq__(self, other): |
| 6567 | if type(self) != type(other): return False |
| 6568 | if self.version != other.version: return False |
| 6569 | if self.type != other.type: return False |
| 6570 | if self.xid != other.xid: return False |
| 6571 | if self.port != other.port: return False |
| 6572 | if self.queues != other.queues: return False |
| 6573 | return True |
| 6574 | |
| 6575 | def __ne__(self, other): |
| 6576 | return not self.__eq__(other) |
| 6577 | |
| 6578 | def __str__(self): |
| 6579 | return self.show() |
| 6580 | |
| 6581 | def show(self): |
| 6582 | import loxi.pp |
| 6583 | return loxi.pp.pp(self) |
| 6584 | |
| 6585 | def pretty_print(self, q): |
| 6586 | q.text("queue_get_config_reply {") |
| 6587 | with q.group(): |
| 6588 | with q.indent(2): |
| 6589 | q.breakable() |
| 6590 | q.text("xid = "); |
| 6591 | if self.xid != None: |
| 6592 | q.text("%#x" % self.xid) |
| 6593 | else: |
| 6594 | q.text('None') |
| 6595 | q.text(","); q.breakable() |
| 6596 | q.text("port = "); |
| 6597 | q.text(util.pretty_port(self.port)) |
| 6598 | q.text(","); q.breakable() |
| 6599 | q.text("queues = "); |
| 6600 | q.pp(self.queues) |
| 6601 | q.breakable() |
| 6602 | q.text('}') |
| 6603 | |
| 6604 | class queue_get_config_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6605 | version = 3 |
| 6606 | type = 22 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6607 | |
| 6608 | def __init__(self, xid=None, port=None): |
| 6609 | self.xid = xid |
| 6610 | if port != None: |
| 6611 | self.port = port |
| 6612 | else: |
| 6613 | self.port = 0 |
| 6614 | |
| 6615 | def pack(self): |
| 6616 | packed = [] |
| 6617 | packed.append(struct.pack("!B", self.version)) |
| 6618 | packed.append(struct.pack("!B", self.type)) |
| 6619 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6620 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6621 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6622 | packed.append('\x00' * 4) |
| 6623 | length = sum([len(x) for x in packed]) |
| 6624 | packed[2] = struct.pack("!H", length) |
| 6625 | return ''.join(packed) |
| 6626 | |
| 6627 | @staticmethod |
| 6628 | def unpack(buf): |
| 6629 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 6630 | obj = queue_get_config_request() |
| 6631 | if type(buf) == loxi.generic_util.OFReader: |
| 6632 | reader = buf |
| 6633 | else: |
| 6634 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6635 | _version = reader.read("!B")[0] |
| 6636 | assert(_version == 3) |
| 6637 | _type = reader.read("!B")[0] |
| 6638 | assert(_type == 22) |
| 6639 | _length = reader.read("!H")[0] |
| 6640 | obj.xid = reader.read("!L")[0] |
| 6641 | obj.port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6642 | reader.skip(4) |
| 6643 | return obj |
| 6644 | |
| 6645 | def __eq__(self, other): |
| 6646 | if type(self) != type(other): return False |
| 6647 | if self.version != other.version: return False |
| 6648 | if self.type != other.type: return False |
| 6649 | if self.xid != other.xid: return False |
| 6650 | if self.port != other.port: return False |
| 6651 | return True |
| 6652 | |
| 6653 | def __ne__(self, other): |
| 6654 | return not self.__eq__(other) |
| 6655 | |
| 6656 | def __str__(self): |
| 6657 | return self.show() |
| 6658 | |
| 6659 | def show(self): |
| 6660 | import loxi.pp |
| 6661 | return loxi.pp.pp(self) |
| 6662 | |
| 6663 | def pretty_print(self, q): |
| 6664 | q.text("queue_get_config_request {") |
| 6665 | with q.group(): |
| 6666 | with q.indent(2): |
| 6667 | q.breakable() |
| 6668 | q.text("xid = "); |
| 6669 | if self.xid != None: |
| 6670 | q.text("%#x" % self.xid) |
| 6671 | else: |
| 6672 | q.text('None') |
| 6673 | q.text(","); q.breakable() |
| 6674 | q.text("port = "); |
| 6675 | q.text(util.pretty_port(self.port)) |
| 6676 | q.breakable() |
| 6677 | q.text('}') |
| 6678 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6679 | class queue_op_failed_error_msg(Message): |
| 6680 | version = 3 |
| 6681 | type = 1 |
| 6682 | err_type = 9 |
| 6683 | |
| 6684 | def __init__(self, xid=None, code=None, data=None): |
| 6685 | self.xid = xid |
| 6686 | if code != None: |
| 6687 | self.code = code |
| 6688 | else: |
| 6689 | self.code = 0 |
| 6690 | if data != None: |
| 6691 | self.data = data |
| 6692 | else: |
| 6693 | self.data = '' |
| 6694 | |
| 6695 | def pack(self): |
| 6696 | packed = [] |
| 6697 | packed.append(struct.pack("!B", self.version)) |
| 6698 | packed.append(struct.pack("!B", self.type)) |
| 6699 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6700 | packed.append(struct.pack("!L", self.xid)) |
| 6701 | packed.append(struct.pack("!H", self.err_type)) |
| 6702 | packed.append(struct.pack("!H", self.code)) |
| 6703 | packed.append(self.data) |
| 6704 | length = sum([len(x) for x in packed]) |
| 6705 | packed[2] = struct.pack("!H", length) |
| 6706 | return ''.join(packed) |
| 6707 | |
| 6708 | @staticmethod |
| 6709 | def unpack(buf): |
| 6710 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 6711 | obj = queue_op_failed_error_msg() |
| 6712 | if type(buf) == loxi.generic_util.OFReader: |
| 6713 | reader = buf |
| 6714 | else: |
| 6715 | reader = loxi.generic_util.OFReader(buf) |
| 6716 | _version = reader.read("!B")[0] |
| 6717 | assert(_version == 3) |
| 6718 | _type = reader.read("!B")[0] |
| 6719 | assert(_type == 1) |
| 6720 | _length = reader.read("!H")[0] |
| 6721 | obj.xid = reader.read("!L")[0] |
| 6722 | _err_type = reader.read("!H")[0] |
| 6723 | assert(_err_type == 9) |
| 6724 | obj.code = reader.read("!H")[0] |
| 6725 | obj.data = str(reader.read_all()) |
| 6726 | return obj |
| 6727 | |
| 6728 | def __eq__(self, other): |
| 6729 | if type(self) != type(other): return False |
| 6730 | if self.version != other.version: return False |
| 6731 | if self.type != other.type: return False |
| 6732 | if self.xid != other.xid: return False |
| 6733 | if self.code != other.code: return False |
| 6734 | if self.data != other.data: return False |
| 6735 | return True |
| 6736 | |
| 6737 | def __ne__(self, other): |
| 6738 | return not self.__eq__(other) |
| 6739 | |
| 6740 | def __str__(self): |
| 6741 | return self.show() |
| 6742 | |
| 6743 | def show(self): |
| 6744 | import loxi.pp |
| 6745 | return loxi.pp.pp(self) |
| 6746 | |
| 6747 | def pretty_print(self, q): |
| 6748 | q.text("queue_op_failed_error_msg {") |
| 6749 | with q.group(): |
| 6750 | with q.indent(2): |
| 6751 | q.breakable() |
| 6752 | q.text("xid = "); |
| 6753 | if self.xid != None: |
| 6754 | q.text("%#x" % self.xid) |
| 6755 | else: |
| 6756 | q.text('None') |
| 6757 | q.text(","); q.breakable() |
| 6758 | q.text("code = "); |
| 6759 | q.text("%#x" % self.code) |
| 6760 | q.text(","); q.breakable() |
| 6761 | q.text("data = "); |
| 6762 | q.pp(self.data) |
| 6763 | q.breakable() |
| 6764 | q.text('}') |
| 6765 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6766 | class queue_stats_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6767 | version = 3 |
| 6768 | type = 19 |
| 6769 | stats_type = 5 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6770 | |
| 6771 | def __init__(self, xid=None, flags=None, entries=None): |
| 6772 | self.xid = xid |
| 6773 | if flags != None: |
| 6774 | self.flags = flags |
| 6775 | else: |
| 6776 | self.flags = 0 |
| 6777 | if entries != None: |
| 6778 | self.entries = entries |
| 6779 | else: |
| 6780 | self.entries = [] |
| 6781 | |
| 6782 | def pack(self): |
| 6783 | packed = [] |
| 6784 | packed.append(struct.pack("!B", self.version)) |
| 6785 | packed.append(struct.pack("!B", self.type)) |
| 6786 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6787 | packed.append(struct.pack("!L", self.xid)) |
| 6788 | packed.append(struct.pack("!H", self.stats_type)) |
| 6789 | packed.append(struct.pack("!H", self.flags)) |
| 6790 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6791 | packed.append(util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6792 | length = sum([len(x) for x in packed]) |
| 6793 | packed[2] = struct.pack("!H", length) |
| 6794 | return ''.join(packed) |
| 6795 | |
| 6796 | @staticmethod |
| 6797 | def unpack(buf): |
| 6798 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 6799 | obj = queue_stats_reply() |
| 6800 | if type(buf) == loxi.generic_util.OFReader: |
| 6801 | reader = buf |
| 6802 | else: |
| 6803 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6804 | _version = reader.read("!B")[0] |
| 6805 | assert(_version == 3) |
| 6806 | _type = reader.read("!B")[0] |
| 6807 | assert(_type == 19) |
| 6808 | _length = reader.read("!H")[0] |
| 6809 | obj.xid = reader.read("!L")[0] |
| 6810 | _stats_type = reader.read("!H")[0] |
| 6811 | assert(_stats_type == 5) |
| 6812 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6813 | reader.skip(4) |
| 6814 | obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack) |
| 6815 | return obj |
| 6816 | |
| 6817 | def __eq__(self, other): |
| 6818 | if type(self) != type(other): return False |
| 6819 | if self.version != other.version: return False |
| 6820 | if self.type != other.type: return False |
| 6821 | if self.xid != other.xid: return False |
| 6822 | if self.flags != other.flags: return False |
| 6823 | if self.entries != other.entries: return False |
| 6824 | return True |
| 6825 | |
| 6826 | def __ne__(self, other): |
| 6827 | return not self.__eq__(other) |
| 6828 | |
| 6829 | def __str__(self): |
| 6830 | return self.show() |
| 6831 | |
| 6832 | def show(self): |
| 6833 | import loxi.pp |
| 6834 | return loxi.pp.pp(self) |
| 6835 | |
| 6836 | def pretty_print(self, q): |
| 6837 | q.text("queue_stats_reply {") |
| 6838 | with q.group(): |
| 6839 | with q.indent(2): |
| 6840 | q.breakable() |
| 6841 | q.text("xid = "); |
| 6842 | if self.xid != None: |
| 6843 | q.text("%#x" % self.xid) |
| 6844 | else: |
| 6845 | q.text('None') |
| 6846 | q.text(","); q.breakable() |
| 6847 | q.text("flags = "); |
| 6848 | q.text("%#x" % self.flags) |
| 6849 | q.text(","); q.breakable() |
| 6850 | q.text("entries = "); |
| 6851 | q.pp(self.entries) |
| 6852 | q.breakable() |
| 6853 | q.text('}') |
| 6854 | |
| 6855 | class queue_stats_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6856 | version = 3 |
| 6857 | type = 18 |
| 6858 | stats_type = 5 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6859 | |
| 6860 | def __init__(self, xid=None, flags=None, port_no=None, queue_id=None): |
| 6861 | self.xid = xid |
| 6862 | if flags != None: |
| 6863 | self.flags = flags |
| 6864 | else: |
| 6865 | self.flags = 0 |
| 6866 | if port_no != None: |
| 6867 | self.port_no = port_no |
| 6868 | else: |
| 6869 | self.port_no = 0 |
| 6870 | if queue_id != None: |
| 6871 | self.queue_id = queue_id |
| 6872 | else: |
| 6873 | self.queue_id = 0 |
| 6874 | |
| 6875 | def pack(self): |
| 6876 | packed = [] |
| 6877 | packed.append(struct.pack("!B", self.version)) |
| 6878 | packed.append(struct.pack("!B", self.type)) |
| 6879 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6880 | packed.append(struct.pack("!L", self.xid)) |
| 6881 | packed.append(struct.pack("!H", self.stats_type)) |
| 6882 | packed.append(struct.pack("!H", self.flags)) |
| 6883 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6884 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6885 | packed.append(struct.pack("!L", self.queue_id)) |
| 6886 | length = sum([len(x) for x in packed]) |
| 6887 | packed[2] = struct.pack("!H", length) |
| 6888 | return ''.join(packed) |
| 6889 | |
| 6890 | @staticmethod |
| 6891 | def unpack(buf): |
| 6892 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 6893 | obj = queue_stats_request() |
| 6894 | if type(buf) == loxi.generic_util.OFReader: |
| 6895 | reader = buf |
| 6896 | else: |
| 6897 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6898 | _version = reader.read("!B")[0] |
| 6899 | assert(_version == 3) |
| 6900 | _type = reader.read("!B")[0] |
| 6901 | assert(_type == 18) |
| 6902 | _length = reader.read("!H")[0] |
| 6903 | obj.xid = reader.read("!L")[0] |
| 6904 | _stats_type = reader.read("!H")[0] |
| 6905 | assert(_stats_type == 5) |
| 6906 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6907 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6908 | obj.port_no = util.unpack_port_no(reader) |
| 6909 | obj.queue_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6910 | return obj |
| 6911 | |
| 6912 | def __eq__(self, other): |
| 6913 | if type(self) != type(other): return False |
| 6914 | if self.version != other.version: return False |
| 6915 | if self.type != other.type: return False |
| 6916 | if self.xid != other.xid: return False |
| 6917 | if self.flags != other.flags: return False |
| 6918 | if self.port_no != other.port_no: return False |
| 6919 | if self.queue_id != other.queue_id: return False |
| 6920 | return True |
| 6921 | |
| 6922 | def __ne__(self, other): |
| 6923 | return not self.__eq__(other) |
| 6924 | |
| 6925 | def __str__(self): |
| 6926 | return self.show() |
| 6927 | |
| 6928 | def show(self): |
| 6929 | import loxi.pp |
| 6930 | return loxi.pp.pp(self) |
| 6931 | |
| 6932 | def pretty_print(self, q): |
| 6933 | q.text("queue_stats_request {") |
| 6934 | with q.group(): |
| 6935 | with q.indent(2): |
| 6936 | q.breakable() |
| 6937 | q.text("xid = "); |
| 6938 | if self.xid != None: |
| 6939 | q.text("%#x" % self.xid) |
| 6940 | else: |
| 6941 | q.text('None') |
| 6942 | q.text(","); q.breakable() |
| 6943 | q.text("flags = "); |
| 6944 | q.text("%#x" % self.flags) |
| 6945 | q.text(","); q.breakable() |
| 6946 | q.text("port_no = "); |
| 6947 | q.text(util.pretty_port(self.port_no)) |
| 6948 | q.text(","); q.breakable() |
| 6949 | q.text("queue_id = "); |
| 6950 | q.text("%#x" % self.queue_id) |
| 6951 | q.breakable() |
| 6952 | q.text('}') |
| 6953 | |
| 6954 | class role_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6955 | version = 3 |
| 6956 | type = 25 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6957 | |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 6958 | def __init__(self, xid=None, role=None, generation_id=None): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6959 | self.xid = xid |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 6960 | if role != None: |
| 6961 | self.role = role |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6962 | else: |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 6963 | self.role = 0 |
| 6964 | if generation_id != None: |
| 6965 | self.generation_id = generation_id |
| 6966 | else: |
| 6967 | self.generation_id = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6968 | |
| 6969 | def pack(self): |
| 6970 | packed = [] |
| 6971 | packed.append(struct.pack("!B", self.version)) |
| 6972 | packed.append(struct.pack("!B", self.type)) |
| 6973 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6974 | packed.append(struct.pack("!L", self.xid)) |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 6975 | packed.append(struct.pack("!L", self.role)) |
| 6976 | packed.append('\x00' * 4) |
| 6977 | packed.append(struct.pack("!Q", self.generation_id)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6978 | length = sum([len(x) for x in packed]) |
| 6979 | packed[2] = struct.pack("!H", length) |
| 6980 | return ''.join(packed) |
| 6981 | |
| 6982 | @staticmethod |
| 6983 | def unpack(buf): |
| 6984 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 6985 | obj = role_reply() |
| 6986 | if type(buf) == loxi.generic_util.OFReader: |
| 6987 | reader = buf |
| 6988 | else: |
| 6989 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6990 | _version = reader.read("!B")[0] |
| 6991 | assert(_version == 3) |
| 6992 | _type = reader.read("!B")[0] |
| 6993 | assert(_type == 25) |
| 6994 | _length = reader.read("!H")[0] |
| 6995 | obj.xid = reader.read("!L")[0] |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 6996 | obj.role = reader.read("!L")[0] |
| 6997 | reader.skip(4) |
| 6998 | obj.generation_id = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6999 | return obj |
| 7000 | |
| 7001 | def __eq__(self, other): |
| 7002 | if type(self) != type(other): return False |
| 7003 | if self.version != other.version: return False |
| 7004 | if self.type != other.type: return False |
| 7005 | if self.xid != other.xid: return False |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 7006 | if self.role != other.role: return False |
| 7007 | if self.generation_id != other.generation_id: return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7008 | return True |
| 7009 | |
| 7010 | def __ne__(self, other): |
| 7011 | return not self.__eq__(other) |
| 7012 | |
| 7013 | def __str__(self): |
| 7014 | return self.show() |
| 7015 | |
| 7016 | def show(self): |
| 7017 | import loxi.pp |
| 7018 | return loxi.pp.pp(self) |
| 7019 | |
| 7020 | def pretty_print(self, q): |
| 7021 | q.text("role_reply {") |
| 7022 | with q.group(): |
| 7023 | with q.indent(2): |
| 7024 | q.breakable() |
| 7025 | q.text("xid = "); |
| 7026 | if self.xid != None: |
| 7027 | q.text("%#x" % self.xid) |
| 7028 | else: |
| 7029 | q.text('None') |
| 7030 | q.text(","); q.breakable() |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 7031 | q.text("role = "); |
| 7032 | q.text("%#x" % self.role) |
| 7033 | q.text(","); q.breakable() |
| 7034 | q.text("generation_id = "); |
| 7035 | q.text("%#x" % self.generation_id) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7036 | q.breakable() |
| 7037 | q.text('}') |
| 7038 | |
| 7039 | class role_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7040 | version = 3 |
| 7041 | type = 24 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7042 | |
| 7043 | def __init__(self, xid=None, role=None, generation_id=None): |
| 7044 | self.xid = xid |
| 7045 | if role != None: |
| 7046 | self.role = role |
| 7047 | else: |
| 7048 | self.role = 0 |
| 7049 | if generation_id != None: |
| 7050 | self.generation_id = generation_id |
| 7051 | else: |
| 7052 | self.generation_id = 0 |
| 7053 | |
| 7054 | def pack(self): |
| 7055 | packed = [] |
| 7056 | packed.append(struct.pack("!B", self.version)) |
| 7057 | packed.append(struct.pack("!B", self.type)) |
| 7058 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7059 | packed.append(struct.pack("!L", self.xid)) |
| 7060 | packed.append(struct.pack("!L", self.role)) |
| 7061 | packed.append('\x00' * 4) |
| 7062 | packed.append(struct.pack("!Q", self.generation_id)) |
| 7063 | length = sum([len(x) for x in packed]) |
| 7064 | packed[2] = struct.pack("!H", length) |
| 7065 | return ''.join(packed) |
| 7066 | |
| 7067 | @staticmethod |
| 7068 | def unpack(buf): |
| 7069 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 7070 | obj = role_request() |
| 7071 | if type(buf) == loxi.generic_util.OFReader: |
| 7072 | reader = buf |
| 7073 | else: |
| 7074 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7075 | _version = reader.read("!B")[0] |
| 7076 | assert(_version == 3) |
| 7077 | _type = reader.read("!B")[0] |
| 7078 | assert(_type == 24) |
| 7079 | _length = reader.read("!H")[0] |
| 7080 | obj.xid = reader.read("!L")[0] |
| 7081 | obj.role = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7082 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7083 | obj.generation_id = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7084 | return obj |
| 7085 | |
| 7086 | def __eq__(self, other): |
| 7087 | if type(self) != type(other): return False |
| 7088 | if self.version != other.version: return False |
| 7089 | if self.type != other.type: return False |
| 7090 | if self.xid != other.xid: return False |
| 7091 | if self.role != other.role: return False |
| 7092 | if self.generation_id != other.generation_id: return False |
| 7093 | return True |
| 7094 | |
| 7095 | def __ne__(self, other): |
| 7096 | return not self.__eq__(other) |
| 7097 | |
| 7098 | def __str__(self): |
| 7099 | return self.show() |
| 7100 | |
| 7101 | def show(self): |
| 7102 | import loxi.pp |
| 7103 | return loxi.pp.pp(self) |
| 7104 | |
| 7105 | def pretty_print(self, q): |
| 7106 | q.text("role_request {") |
| 7107 | with q.group(): |
| 7108 | with q.indent(2): |
| 7109 | q.breakable() |
| 7110 | q.text("xid = "); |
| 7111 | if self.xid != None: |
| 7112 | q.text("%#x" % self.xid) |
| 7113 | else: |
| 7114 | q.text('None') |
| 7115 | q.text(","); q.breakable() |
| 7116 | q.text("role = "); |
| 7117 | q.text("%#x" % self.role) |
| 7118 | q.text(","); q.breakable() |
| 7119 | q.text("generation_id = "); |
| 7120 | q.text("%#x" % self.generation_id) |
| 7121 | q.breakable() |
| 7122 | q.text('}') |
| 7123 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7124 | class role_request_failed_error_msg(Message): |
| 7125 | version = 3 |
| 7126 | type = 1 |
| 7127 | err_type = 11 |
| 7128 | |
| 7129 | def __init__(self, xid=None, code=None, data=None): |
| 7130 | self.xid = xid |
| 7131 | if code != None: |
| 7132 | self.code = code |
| 7133 | else: |
| 7134 | self.code = 0 |
| 7135 | if data != None: |
| 7136 | self.data = data |
| 7137 | else: |
| 7138 | self.data = '' |
| 7139 | |
| 7140 | def pack(self): |
| 7141 | packed = [] |
| 7142 | packed.append(struct.pack("!B", self.version)) |
| 7143 | packed.append(struct.pack("!B", self.type)) |
| 7144 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7145 | packed.append(struct.pack("!L", self.xid)) |
| 7146 | packed.append(struct.pack("!H", self.err_type)) |
| 7147 | packed.append(struct.pack("!H", self.code)) |
| 7148 | packed.append(self.data) |
| 7149 | length = sum([len(x) for x in packed]) |
| 7150 | packed[2] = struct.pack("!H", length) |
| 7151 | return ''.join(packed) |
| 7152 | |
| 7153 | @staticmethod |
| 7154 | def unpack(buf): |
| 7155 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 7156 | obj = role_request_failed_error_msg() |
| 7157 | if type(buf) == loxi.generic_util.OFReader: |
| 7158 | reader = buf |
| 7159 | else: |
| 7160 | reader = loxi.generic_util.OFReader(buf) |
| 7161 | _version = reader.read("!B")[0] |
| 7162 | assert(_version == 3) |
| 7163 | _type = reader.read("!B")[0] |
| 7164 | assert(_type == 1) |
| 7165 | _length = reader.read("!H")[0] |
| 7166 | obj.xid = reader.read("!L")[0] |
| 7167 | _err_type = reader.read("!H")[0] |
| 7168 | assert(_err_type == 11) |
| 7169 | obj.code = reader.read("!H")[0] |
| 7170 | obj.data = str(reader.read_all()) |
| 7171 | return obj |
| 7172 | |
| 7173 | def __eq__(self, other): |
| 7174 | if type(self) != type(other): return False |
| 7175 | if self.version != other.version: return False |
| 7176 | if self.type != other.type: return False |
| 7177 | if self.xid != other.xid: return False |
| 7178 | if self.code != other.code: return False |
| 7179 | if self.data != other.data: return False |
| 7180 | return True |
| 7181 | |
| 7182 | def __ne__(self, other): |
| 7183 | return not self.__eq__(other) |
| 7184 | |
| 7185 | def __str__(self): |
| 7186 | return self.show() |
| 7187 | |
| 7188 | def show(self): |
| 7189 | import loxi.pp |
| 7190 | return loxi.pp.pp(self) |
| 7191 | |
| 7192 | def pretty_print(self, q): |
| 7193 | q.text("role_request_failed_error_msg {") |
| 7194 | with q.group(): |
| 7195 | with q.indent(2): |
| 7196 | q.breakable() |
| 7197 | q.text("xid = "); |
| 7198 | if self.xid != None: |
| 7199 | q.text("%#x" % self.xid) |
| 7200 | else: |
| 7201 | q.text('None') |
| 7202 | q.text(","); q.breakable() |
| 7203 | q.text("code = "); |
| 7204 | q.text("%#x" % self.code) |
| 7205 | q.text(","); q.breakable() |
| 7206 | q.text("data = "); |
| 7207 | q.pp(self.data) |
| 7208 | q.breakable() |
| 7209 | q.text('}') |
| 7210 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7211 | class set_config(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7212 | version = 3 |
| 7213 | type = 9 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7214 | |
| 7215 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
| 7216 | self.xid = xid |
| 7217 | if flags != None: |
| 7218 | self.flags = flags |
| 7219 | else: |
| 7220 | self.flags = 0 |
| 7221 | if miss_send_len != None: |
| 7222 | self.miss_send_len = miss_send_len |
| 7223 | else: |
| 7224 | self.miss_send_len = 0 |
| 7225 | |
| 7226 | def pack(self): |
| 7227 | packed = [] |
| 7228 | packed.append(struct.pack("!B", self.version)) |
| 7229 | packed.append(struct.pack("!B", self.type)) |
| 7230 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7231 | packed.append(struct.pack("!L", self.xid)) |
| 7232 | packed.append(struct.pack("!H", self.flags)) |
| 7233 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 7234 | length = sum([len(x) for x in packed]) |
| 7235 | packed[2] = struct.pack("!H", length) |
| 7236 | return ''.join(packed) |
| 7237 | |
| 7238 | @staticmethod |
| 7239 | def unpack(buf): |
| 7240 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 7241 | obj = set_config() |
| 7242 | if type(buf) == loxi.generic_util.OFReader: |
| 7243 | reader = buf |
| 7244 | else: |
| 7245 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7246 | _version = reader.read("!B")[0] |
| 7247 | assert(_version == 3) |
| 7248 | _type = reader.read("!B")[0] |
| 7249 | assert(_type == 9) |
| 7250 | _length = reader.read("!H")[0] |
| 7251 | obj.xid = reader.read("!L")[0] |
| 7252 | obj.flags = reader.read("!H")[0] |
| 7253 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7254 | return obj |
| 7255 | |
| 7256 | def __eq__(self, other): |
| 7257 | if type(self) != type(other): return False |
| 7258 | if self.version != other.version: return False |
| 7259 | if self.type != other.type: return False |
| 7260 | if self.xid != other.xid: return False |
| 7261 | if self.flags != other.flags: return False |
| 7262 | if self.miss_send_len != other.miss_send_len: return False |
| 7263 | return True |
| 7264 | |
| 7265 | def __ne__(self, other): |
| 7266 | return not self.__eq__(other) |
| 7267 | |
| 7268 | def __str__(self): |
| 7269 | return self.show() |
| 7270 | |
| 7271 | def show(self): |
| 7272 | import loxi.pp |
| 7273 | return loxi.pp.pp(self) |
| 7274 | |
| 7275 | def pretty_print(self, q): |
| 7276 | q.text("set_config {") |
| 7277 | with q.group(): |
| 7278 | with q.indent(2): |
| 7279 | q.breakable() |
| 7280 | q.text("xid = "); |
| 7281 | if self.xid != None: |
| 7282 | q.text("%#x" % self.xid) |
| 7283 | else: |
| 7284 | q.text('None') |
| 7285 | q.text(","); q.breakable() |
| 7286 | q.text("flags = "); |
| 7287 | q.text("%#x" % self.flags) |
| 7288 | q.text(","); q.breakable() |
| 7289 | q.text("miss_send_len = "); |
| 7290 | q.text("%#x" % self.miss_send_len) |
| 7291 | q.breakable() |
| 7292 | q.text('}') |
| 7293 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7294 | class switch_config_failed_error_msg(Message): |
| 7295 | version = 3 |
| 7296 | type = 1 |
| 7297 | err_type = 10 |
| 7298 | |
| 7299 | def __init__(self, xid=None, code=None, data=None): |
| 7300 | self.xid = xid |
| 7301 | if code != None: |
| 7302 | self.code = code |
| 7303 | else: |
| 7304 | self.code = 0 |
| 7305 | if data != None: |
| 7306 | self.data = data |
| 7307 | else: |
| 7308 | self.data = '' |
| 7309 | |
| 7310 | def pack(self): |
| 7311 | packed = [] |
| 7312 | packed.append(struct.pack("!B", self.version)) |
| 7313 | packed.append(struct.pack("!B", self.type)) |
| 7314 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7315 | packed.append(struct.pack("!L", self.xid)) |
| 7316 | packed.append(struct.pack("!H", self.err_type)) |
| 7317 | packed.append(struct.pack("!H", self.code)) |
| 7318 | packed.append(self.data) |
| 7319 | length = sum([len(x) for x in packed]) |
| 7320 | packed[2] = struct.pack("!H", length) |
| 7321 | return ''.join(packed) |
| 7322 | |
| 7323 | @staticmethod |
| 7324 | def unpack(buf): |
| 7325 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 7326 | obj = switch_config_failed_error_msg() |
| 7327 | if type(buf) == loxi.generic_util.OFReader: |
| 7328 | reader = buf |
| 7329 | else: |
| 7330 | reader = loxi.generic_util.OFReader(buf) |
| 7331 | _version = reader.read("!B")[0] |
| 7332 | assert(_version == 3) |
| 7333 | _type = reader.read("!B")[0] |
| 7334 | assert(_type == 1) |
| 7335 | _length = reader.read("!H")[0] |
| 7336 | obj.xid = reader.read("!L")[0] |
| 7337 | _err_type = reader.read("!H")[0] |
| 7338 | assert(_err_type == 10) |
| 7339 | obj.code = reader.read("!H")[0] |
| 7340 | obj.data = str(reader.read_all()) |
| 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.code != other.code: return False |
| 7349 | if self.data != other.data: 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("switch_config_failed_error_msg {") |
| 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("code = "); |
| 7374 | q.text("%#x" % self.code) |
| 7375 | q.text(","); q.breakable() |
| 7376 | q.text("data = "); |
| 7377 | q.pp(self.data) |
| 7378 | q.breakable() |
| 7379 | q.text('}') |
| 7380 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7381 | class table_mod(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7382 | version = 3 |
| 7383 | type = 17 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7384 | |
| 7385 | def __init__(self, xid=None, table_id=None, config=None): |
| 7386 | self.xid = xid |
| 7387 | if table_id != None: |
| 7388 | self.table_id = table_id |
| 7389 | else: |
| 7390 | self.table_id = 0 |
| 7391 | if config != None: |
| 7392 | self.config = config |
| 7393 | else: |
| 7394 | self.config = 0 |
| 7395 | |
| 7396 | def pack(self): |
| 7397 | packed = [] |
| 7398 | packed.append(struct.pack("!B", self.version)) |
| 7399 | packed.append(struct.pack("!B", self.type)) |
| 7400 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7401 | packed.append(struct.pack("!L", self.xid)) |
| 7402 | packed.append(struct.pack("!B", self.table_id)) |
| 7403 | packed.append('\x00' * 3) |
| 7404 | packed.append(struct.pack("!L", self.config)) |
| 7405 | length = sum([len(x) for x in packed]) |
| 7406 | packed[2] = struct.pack("!H", length) |
| 7407 | return ''.join(packed) |
| 7408 | |
| 7409 | @staticmethod |
| 7410 | def unpack(buf): |
| 7411 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 7412 | obj = table_mod() |
| 7413 | if type(buf) == loxi.generic_util.OFReader: |
| 7414 | reader = buf |
| 7415 | else: |
| 7416 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7417 | _version = reader.read("!B")[0] |
| 7418 | assert(_version == 3) |
| 7419 | _type = reader.read("!B")[0] |
| 7420 | assert(_type == 17) |
| 7421 | _length = reader.read("!H")[0] |
| 7422 | obj.xid = reader.read("!L")[0] |
| 7423 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7424 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7425 | obj.config = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7426 | return obj |
| 7427 | |
| 7428 | def __eq__(self, other): |
| 7429 | if type(self) != type(other): return False |
| 7430 | if self.version != other.version: return False |
| 7431 | if self.type != other.type: return False |
| 7432 | if self.xid != other.xid: return False |
| 7433 | if self.table_id != other.table_id: return False |
| 7434 | if self.config != other.config: return False |
| 7435 | return True |
| 7436 | |
| 7437 | def __ne__(self, other): |
| 7438 | return not self.__eq__(other) |
| 7439 | |
| 7440 | def __str__(self): |
| 7441 | return self.show() |
| 7442 | |
| 7443 | def show(self): |
| 7444 | import loxi.pp |
| 7445 | return loxi.pp.pp(self) |
| 7446 | |
| 7447 | def pretty_print(self, q): |
| 7448 | q.text("table_mod {") |
| 7449 | with q.group(): |
| 7450 | with q.indent(2): |
| 7451 | q.breakable() |
| 7452 | q.text("xid = "); |
| 7453 | if self.xid != None: |
| 7454 | q.text("%#x" % self.xid) |
| 7455 | else: |
| 7456 | q.text('None') |
| 7457 | q.text(","); q.breakable() |
| 7458 | q.text("table_id = "); |
| 7459 | q.text("%#x" % self.table_id) |
| 7460 | q.text(","); q.breakable() |
| 7461 | q.text("config = "); |
| 7462 | q.text("%#x" % self.config) |
| 7463 | q.breakable() |
| 7464 | q.text('}') |
| 7465 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7466 | class table_mod_failed_error_msg(Message): |
| 7467 | version = 3 |
| 7468 | type = 1 |
| 7469 | err_type = 8 |
| 7470 | |
| 7471 | def __init__(self, xid=None, code=None, data=None): |
| 7472 | self.xid = xid |
| 7473 | if code != None: |
| 7474 | self.code = code |
| 7475 | else: |
| 7476 | self.code = 0 |
| 7477 | if data != None: |
| 7478 | self.data = data |
| 7479 | else: |
| 7480 | self.data = '' |
| 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.err_type)) |
| 7489 | packed.append(struct.pack("!H", self.code)) |
| 7490 | packed.append(self.data) |
| 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_mod_failed_error_msg() |
| 7499 | if type(buf) == loxi.generic_util.OFReader: |
| 7500 | reader = buf |
| 7501 | else: |
| 7502 | reader = loxi.generic_util.OFReader(buf) |
| 7503 | _version = reader.read("!B")[0] |
| 7504 | assert(_version == 3) |
| 7505 | _type = reader.read("!B")[0] |
| 7506 | assert(_type == 1) |
| 7507 | _length = reader.read("!H")[0] |
| 7508 | obj.xid = reader.read("!L")[0] |
| 7509 | _err_type = reader.read("!H")[0] |
| 7510 | assert(_err_type == 8) |
| 7511 | obj.code = reader.read("!H")[0] |
| 7512 | obj.data = str(reader.read_all()) |
| 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.code != other.code: return False |
| 7521 | if self.data != other.data: return False |
| 7522 | return True |
| 7523 | |
| 7524 | def __ne__(self, other): |
| 7525 | return not self.__eq__(other) |
| 7526 | |
| 7527 | def __str__(self): |
| 7528 | return self.show() |
| 7529 | |
| 7530 | def show(self): |
| 7531 | import loxi.pp |
| 7532 | return loxi.pp.pp(self) |
| 7533 | |
| 7534 | def pretty_print(self, q): |
| 7535 | q.text("table_mod_failed_error_msg {") |
| 7536 | with q.group(): |
| 7537 | with q.indent(2): |
| 7538 | q.breakable() |
| 7539 | q.text("xid = "); |
| 7540 | if self.xid != None: |
| 7541 | q.text("%#x" % self.xid) |
| 7542 | else: |
| 7543 | q.text('None') |
| 7544 | q.text(","); q.breakable() |
| 7545 | q.text("code = "); |
| 7546 | q.text("%#x" % self.code) |
| 7547 | q.text(","); q.breakable() |
| 7548 | q.text("data = "); |
| 7549 | q.pp(self.data) |
| 7550 | q.breakable() |
| 7551 | q.text('}') |
| 7552 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7553 | class table_stats_reply(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7554 | version = 3 |
| 7555 | type = 19 |
| 7556 | stats_type = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7557 | |
| 7558 | def __init__(self, xid=None, flags=None, entries=None): |
| 7559 | self.xid = xid |
| 7560 | if flags != None: |
| 7561 | self.flags = flags |
| 7562 | else: |
| 7563 | self.flags = 0 |
| 7564 | if entries != None: |
| 7565 | self.entries = entries |
| 7566 | else: |
| 7567 | self.entries = [] |
| 7568 | |
| 7569 | def pack(self): |
| 7570 | packed = [] |
| 7571 | packed.append(struct.pack("!B", self.version)) |
| 7572 | packed.append(struct.pack("!B", self.type)) |
| 7573 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7574 | packed.append(struct.pack("!L", self.xid)) |
| 7575 | packed.append(struct.pack("!H", self.stats_type)) |
| 7576 | packed.append(struct.pack("!H", self.flags)) |
| 7577 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7578 | packed.append(util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7579 | length = sum([len(x) for x in packed]) |
| 7580 | packed[2] = struct.pack("!H", length) |
| 7581 | return ''.join(packed) |
| 7582 | |
| 7583 | @staticmethod |
| 7584 | def unpack(buf): |
| 7585 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 7586 | obj = table_stats_reply() |
| 7587 | if type(buf) == loxi.generic_util.OFReader: |
| 7588 | reader = buf |
| 7589 | else: |
| 7590 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7591 | _version = reader.read("!B")[0] |
| 7592 | assert(_version == 3) |
| 7593 | _type = reader.read("!B")[0] |
| 7594 | assert(_type == 19) |
| 7595 | _length = reader.read("!H")[0] |
| 7596 | obj.xid = reader.read("!L")[0] |
| 7597 | _stats_type = reader.read("!H")[0] |
| 7598 | assert(_stats_type == 3) |
| 7599 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7600 | reader.skip(4) |
| 7601 | obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack) |
| 7602 | return obj |
| 7603 | |
| 7604 | def __eq__(self, other): |
| 7605 | if type(self) != type(other): return False |
| 7606 | if self.version != other.version: return False |
| 7607 | if self.type != other.type: return False |
| 7608 | if self.xid != other.xid: return False |
| 7609 | if self.flags != other.flags: return False |
| 7610 | if self.entries != other.entries: return False |
| 7611 | return True |
| 7612 | |
| 7613 | def __ne__(self, other): |
| 7614 | return not self.__eq__(other) |
| 7615 | |
| 7616 | def __str__(self): |
| 7617 | return self.show() |
| 7618 | |
| 7619 | def show(self): |
| 7620 | import loxi.pp |
| 7621 | return loxi.pp.pp(self) |
| 7622 | |
| 7623 | def pretty_print(self, q): |
| 7624 | q.text("table_stats_reply {") |
| 7625 | with q.group(): |
| 7626 | with q.indent(2): |
| 7627 | q.breakable() |
| 7628 | q.text("xid = "); |
| 7629 | if self.xid != None: |
| 7630 | q.text("%#x" % self.xid) |
| 7631 | else: |
| 7632 | q.text('None') |
| 7633 | q.text(","); q.breakable() |
| 7634 | q.text("flags = "); |
| 7635 | q.text("%#x" % self.flags) |
| 7636 | q.text(","); q.breakable() |
| 7637 | q.text("entries = "); |
| 7638 | q.pp(self.entries) |
| 7639 | q.breakable() |
| 7640 | q.text('}') |
| 7641 | |
| 7642 | class table_stats_request(Message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7643 | version = 3 |
| 7644 | type = 18 |
| 7645 | stats_type = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7646 | |
| 7647 | def __init__(self, xid=None, flags=None): |
| 7648 | self.xid = xid |
| 7649 | if flags != None: |
| 7650 | self.flags = flags |
| 7651 | else: |
| 7652 | self.flags = 0 |
| 7653 | |
| 7654 | def pack(self): |
| 7655 | packed = [] |
| 7656 | packed.append(struct.pack("!B", self.version)) |
| 7657 | packed.append(struct.pack("!B", self.type)) |
| 7658 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7659 | packed.append(struct.pack("!L", self.xid)) |
| 7660 | packed.append(struct.pack("!H", self.stats_type)) |
| 7661 | packed.append(struct.pack("!H", self.flags)) |
| 7662 | packed.append('\x00' * 4) |
| 7663 | length = sum([len(x) for x in packed]) |
| 7664 | packed[2] = struct.pack("!H", length) |
| 7665 | return ''.join(packed) |
| 7666 | |
| 7667 | @staticmethod |
| 7668 | def unpack(buf): |
| 7669 | if len(buf) < 8: raise loxi.ProtocolError("buffer too short to contain an OpenFlow message") |
| 7670 | obj = table_stats_request() |
| 7671 | if type(buf) == loxi.generic_util.OFReader: |
| 7672 | reader = buf |
| 7673 | else: |
| 7674 | reader = loxi.generic_util.OFReader(buf) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7675 | _version = reader.read("!B")[0] |
| 7676 | assert(_version == 3) |
| 7677 | _type = reader.read("!B")[0] |
| 7678 | assert(_type == 18) |
| 7679 | _length = reader.read("!H")[0] |
| 7680 | obj.xid = reader.read("!L")[0] |
| 7681 | _stats_type = reader.read("!H")[0] |
| 7682 | assert(_stats_type == 3) |
| 7683 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7684 | reader.skip(4) |
| 7685 | return obj |
| 7686 | |
| 7687 | def __eq__(self, other): |
| 7688 | if type(self) != type(other): return False |
| 7689 | if self.version != other.version: return False |
| 7690 | if self.type != other.type: return False |
| 7691 | if self.xid != other.xid: return False |
| 7692 | if self.flags != other.flags: return False |
| 7693 | return True |
| 7694 | |
| 7695 | def __ne__(self, other): |
| 7696 | return not self.__eq__(other) |
| 7697 | |
| 7698 | def __str__(self): |
| 7699 | return self.show() |
| 7700 | |
| 7701 | def show(self): |
| 7702 | import loxi.pp |
| 7703 | return loxi.pp.pp(self) |
| 7704 | |
| 7705 | def pretty_print(self, q): |
| 7706 | q.text("table_stats_request {") |
| 7707 | with q.group(): |
| 7708 | with q.indent(2): |
| 7709 | q.breakable() |
| 7710 | q.text("xid = "); |
| 7711 | if self.xid != None: |
| 7712 | q.text("%#x" % self.xid) |
| 7713 | else: |
| 7714 | q.text('None') |
| 7715 | q.text(","); q.breakable() |
| 7716 | q.text("flags = "); |
| 7717 | q.text("%#x" % self.flags) |
| 7718 | q.breakable() |
| 7719 | q.text('}') |
| 7720 | |
| 7721 | |
| 7722 | def parse_header(buf): |
| 7723 | if len(buf) < 8: |
| 7724 | raise loxi.ProtocolError("too short to be an OpenFlow message") |
| 7725 | return struct.unpack_from("!BBHL", buf) |
| 7726 | |
| 7727 | def parse_message(buf): |
| 7728 | msg_ver, msg_type, msg_len, msg_xid = parse_header(buf) |
Rich Lane | fe600f5 | 2013-07-09 13:22:32 -0700 | [diff] [blame] | 7729 | if msg_ver != const.OFP_VERSION and msg_type != const.OFPT_HELLO: |
| 7730 | 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] | 7731 | if len(buf) != msg_len: |
| 7732 | raise loxi.ProtocolError("incorrect message size") |
| 7733 | if msg_type in parsers: |
| 7734 | return parsers[msg_type](buf) |
| 7735 | else: |
| 7736 | raise loxi.ProtocolError("unexpected message type") |
| 7737 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7738 | def parse_error(buf): |
| 7739 | if len(buf) < 8 + 2: |
| 7740 | raise loxi.ProtocolError("message too short") |
| 7741 | err_type, = struct.unpack_from("!H", buf, 8) |
| 7742 | if err_type in error_msg_parsers: |
| 7743 | return error_msg_parsers[err_type](buf) |
| 7744 | else: |
| 7745 | raise loxi.ProtocolError("unexpected error type %u" % err_type) |
| 7746 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7747 | def parse_flow_mod(buf): |
Rich Lane | fe600f5 | 2013-07-09 13:22:32 -0700 | [diff] [blame] | 7748 | if len(buf) < 25 + 1: |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7749 | raise loxi.ProtocolError("message too short") |
Rich Lane | fe600f5 | 2013-07-09 13:22:32 -0700 | [diff] [blame] | 7750 | # Technically uint16_t for OF 1.0 |
| 7751 | cmd, = struct.unpack_from("!B", buf, 25) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7752 | if cmd in flow_mod_parsers: |
| 7753 | return flow_mod_parsers[cmd](buf) |
| 7754 | else: |
| 7755 | raise loxi.ProtocolError("unexpected flow mod cmd %u" % cmd) |
| 7756 | |
| 7757 | def parse_stats_reply(buf): |
| 7758 | if len(buf) < 8 + 2: |
| 7759 | raise loxi.ProtocolError("message too short") |
| 7760 | stats_type, = struct.unpack_from("!H", buf, 8) |
| 7761 | if stats_type in stats_reply_parsers: |
| 7762 | return stats_reply_parsers[stats_type](buf) |
| 7763 | else: |
| 7764 | raise loxi.ProtocolError("unexpected stats type %u" % stats_type) |
| 7765 | |
| 7766 | def parse_stats_request(buf): |
| 7767 | if len(buf) < 8 + 2: |
| 7768 | raise loxi.ProtocolError("message too short") |
| 7769 | stats_type, = struct.unpack_from("!H", buf, 8) |
| 7770 | if stats_type in stats_request_parsers: |
| 7771 | return stats_request_parsers[stats_type](buf) |
| 7772 | else: |
| 7773 | raise loxi.ProtocolError("unexpected stats type %u" % stats_type) |
| 7774 | |
| 7775 | def parse_experimenter(buf): |
| 7776 | if len(buf) < 16: |
| 7777 | raise loxi.ProtocolError("experimenter message too short") |
| 7778 | |
| 7779 | experimenter, = struct.unpack_from("!L", buf, 8) |
| 7780 | if experimenter == 0x005c16c7: # Big Switch Networks |
| 7781 | subtype, = struct.unpack_from("!L", buf, 12) |
| 7782 | elif experimenter == 0x00002320: # Nicira |
| 7783 | subtype, = struct.unpack_from("!L", buf, 12) |
| 7784 | else: |
| 7785 | raise loxi.ProtocolError("unexpected experimenter id %#x" % experimenter) |
| 7786 | |
| 7787 | if subtype in experimenter_parsers[experimenter]: |
| 7788 | return experimenter_parsers[experimenter][subtype](buf) |
| 7789 | else: |
| 7790 | raise loxi.ProtocolError("unexpected experimenter %#x subtype %#x" % (experimenter, subtype)) |
| 7791 | |
| 7792 | parsers = { |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7793 | const.OFPT_HELLO : hello.unpack, |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7794 | const.OFPT_ERROR : parse_error, |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7795 | const.OFPT_ECHO_REQUEST : echo_request.unpack, |
| 7796 | const.OFPT_ECHO_REPLY : echo_reply.unpack, |
| 7797 | const.OFPT_EXPERIMENTER : parse_experimenter, |
| 7798 | const.OFPT_FEATURES_REQUEST : features_request.unpack, |
| 7799 | const.OFPT_FEATURES_REPLY : features_reply.unpack, |
| 7800 | const.OFPT_GET_CONFIG_REQUEST : get_config_request.unpack, |
| 7801 | const.OFPT_GET_CONFIG_REPLY : get_config_reply.unpack, |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7802 | const.OFPT_SET_CONFIG : set_config.unpack, |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7803 | const.OFPT_PACKET_IN : packet_in.unpack, |
| 7804 | const.OFPT_FLOW_REMOVED : flow_removed.unpack, |
| 7805 | const.OFPT_PORT_STATUS : port_status.unpack, |
| 7806 | const.OFPT_PACKET_OUT : packet_out.unpack, |
| 7807 | const.OFPT_FLOW_MOD : parse_flow_mod, |
| 7808 | const.OFPT_GROUP_MOD : group_mod.unpack, |
| 7809 | const.OFPT_PORT_MOD : port_mod.unpack, |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7810 | const.OFPT_TABLE_MOD : table_mod.unpack, |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7811 | const.OFPT_STATS_REQUEST : parse_stats_request, |
| 7812 | const.OFPT_STATS_REPLY : parse_stats_reply, |
| 7813 | const.OFPT_BARRIER_REQUEST : barrier_request.unpack, |
| 7814 | const.OFPT_BARRIER_REPLY : barrier_reply.unpack, |
| 7815 | const.OFPT_QUEUE_GET_CONFIG_REQUEST : queue_get_config_request.unpack, |
| 7816 | const.OFPT_QUEUE_GET_CONFIG_REPLY : queue_get_config_reply.unpack, |
| 7817 | const.OFPT_ROLE_REQUEST : role_request.unpack, |
| 7818 | const.OFPT_ROLE_REPLY : role_reply.unpack, |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7819 | } |
| 7820 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7821 | error_msg_parsers = { |
| 7822 | const.OFPET_HELLO_FAILED : hello_failed_error_msg.unpack, |
| 7823 | const.OFPET_BAD_REQUEST : bad_request_error_msg.unpack, |
| 7824 | const.OFPET_BAD_ACTION : bad_action_error_msg.unpack, |
| 7825 | const.OFPET_FLOW_MOD_FAILED : flow_mod_failed_error_msg.unpack, |
| 7826 | const.OFPET_PORT_MOD_FAILED : port_mod_failed_error_msg.unpack, |
| 7827 | const.OFPET_QUEUE_OP_FAILED : queue_op_failed_error_msg.unpack, |
| 7828 | const.OFPET_BAD_INSTRUCTION : bad_instruction_error_msg.unpack, |
| 7829 | const.OFPET_BAD_MATCH : bad_match_error_msg.unpack, |
| 7830 | const.OFPET_GROUP_MOD_FAILED : group_mod_failed_error_msg.unpack, |
| 7831 | const.OFPET_TABLE_MOD_FAILED : table_mod_failed_error_msg.unpack, |
| 7832 | const.OFPET_SWITCH_CONFIG_FAILED : switch_config_failed_error_msg.unpack, |
| 7833 | const.OFPET_ROLE_REQUEST_FAILED : role_request_failed_error_msg.unpack, |
| 7834 | const.OFPET_EXPERIMENTER : experimenter_error_msg.unpack, |
| 7835 | } |
| 7836 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7837 | flow_mod_parsers = { |
| 7838 | const.OFPFC_ADD : flow_add.unpack, |
| 7839 | const.OFPFC_MODIFY : flow_modify.unpack, |
| 7840 | const.OFPFC_MODIFY_STRICT : flow_modify_strict.unpack, |
| 7841 | const.OFPFC_DELETE : flow_delete.unpack, |
| 7842 | const.OFPFC_DELETE_STRICT : flow_delete_strict.unpack, |
| 7843 | } |
| 7844 | |
| 7845 | stats_reply_parsers = { |
| 7846 | const.OFPST_DESC : desc_stats_reply.unpack, |
| 7847 | const.OFPST_FLOW : flow_stats_reply.unpack, |
| 7848 | const.OFPST_AGGREGATE : aggregate_stats_reply.unpack, |
| 7849 | const.OFPST_TABLE : table_stats_reply.unpack, |
| 7850 | const.OFPST_PORT : port_stats_reply.unpack, |
| 7851 | const.OFPST_QUEUE : queue_stats_reply.unpack, |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 7852 | const.OFPST_GROUP : group_stats_reply.unpack, |
| 7853 | const.OFPST_GROUP_DESC : group_desc_stats_reply.unpack, |
| 7854 | const.OFPST_GROUP_FEATURES : group_features_stats_reply.unpack, |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7855 | } |
| 7856 | |
| 7857 | stats_request_parsers = { |
| 7858 | const.OFPST_DESC : desc_stats_request.unpack, |
| 7859 | const.OFPST_FLOW : flow_stats_request.unpack, |
| 7860 | const.OFPST_AGGREGATE : aggregate_stats_request.unpack, |
| 7861 | const.OFPST_TABLE : table_stats_request.unpack, |
| 7862 | const.OFPST_PORT : port_stats_request.unpack, |
| 7863 | const.OFPST_QUEUE : queue_stats_request.unpack, |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 7864 | const.OFPST_GROUP : group_stats_request.unpack, |
| 7865 | const.OFPST_GROUP_DESC : group_desc_stats_request.unpack, |
| 7866 | const.OFPST_GROUP_FEATURES : group_features_stats_request.unpack, |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7867 | } |
| 7868 | |
| 7869 | experimenter_parsers = { |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7870 | 6035143 : { |
| 7871 | 22: bsn_bw_clear_data_reply.unpack, |
| 7872 | 21: bsn_bw_clear_data_request.unpack, |
| 7873 | 20: bsn_bw_enable_get_reply.unpack, |
| 7874 | 19: bsn_bw_enable_get_request.unpack, |
| 7875 | 23: bsn_bw_enable_set_reply.unpack, |
| 7876 | 18: bsn_bw_enable_set_request.unpack, |
| 7877 | 10: bsn_get_interfaces_reply.unpack, |
| 7878 | 9: bsn_get_interfaces_request.unpack, |
| 7879 | 5: bsn_get_mirroring_reply.unpack, |
| 7880 | 4: bsn_get_mirroring_request.unpack, |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7881 | 34: bsn_pdu_rx_reply.unpack, |
| 7882 | 33: bsn_pdu_rx_request.unpack, |
| 7883 | 35: bsn_pdu_rx_timeout.unpack, |
| 7884 | 32: bsn_pdu_tx_reply.unpack, |
| 7885 | 31: bsn_pdu_tx_request.unpack, |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7886 | 3: bsn_set_mirroring.unpack, |
| 7887 | 25: bsn_set_pktin_suppression_reply.unpack, |
| 7888 | 11: bsn_set_pktin_suppression_request.unpack, |
| 7889 | 16: bsn_virtual_port_create_reply.unpack, |
| 7890 | 15: bsn_virtual_port_create_request.unpack, |
| 7891 | 26: bsn_virtual_port_remove_reply.unpack, |
| 7892 | 17: bsn_virtual_port_remove_request.unpack, |
| 7893 | }, |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7894 | } |