Rich Lane | 2e079da | 2014-10-29 15:30:24 -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. |
| 4 | # See the file LICENSE.pyloxi which should have been included in the source distribution |
| 5 | |
| 6 | # Automatically generated by LOXI from template module.py |
| 7 | # Do not modify |
| 8 | |
| 9 | import struct |
| 10 | import loxi |
| 11 | import const |
| 12 | import port_desc_prop |
| 13 | import meter_band |
| 14 | import table_mod_prop |
| 15 | import instruction |
| 16 | import queue_desc_prop |
| 17 | import oxm |
| 18 | import bundle_prop |
| 19 | import common |
| 20 | import instruction_id |
| 21 | import action |
| 22 | import role_prop |
| 23 | import message |
| 24 | import queue_stats_prop |
| 25 | import port_stats_prop |
| 26 | import port_mod_prop |
| 27 | import async_config_prop |
| 28 | import action_id |
| 29 | import util |
| 30 | import loxi.generic_util |
| 31 | |
| 32 | class message(loxi.OFObject): |
| 33 | subtypes = {} |
| 34 | |
| 35 | version = 5 |
| 36 | |
| 37 | def __init__(self, type=None, xid=None): |
| 38 | if type != None: |
| 39 | self.type = type |
| 40 | else: |
| 41 | self.type = 0 |
| 42 | if xid != None: |
| 43 | self.xid = xid |
| 44 | else: |
| 45 | self.xid = None |
| 46 | return |
| 47 | |
| 48 | def pack(self): |
| 49 | packed = [] |
| 50 | packed.append(struct.pack("!B", self.version)) |
| 51 | packed.append(struct.pack("!B", self.type)) |
| 52 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 53 | packed.append(struct.pack("!L", self.xid)) |
| 54 | length = sum([len(x) for x in packed]) |
| 55 | packed[2] = struct.pack("!H", length) |
| 56 | return ''.join(packed) |
| 57 | |
| 58 | @staticmethod |
| 59 | def unpack(reader): |
| 60 | subtype, = reader.peek('B', 1) |
| 61 | subclass = message.subtypes.get(subtype) |
| 62 | if subclass: |
| 63 | return subclass.unpack(reader) |
| 64 | |
| 65 | obj = message() |
| 66 | _version = reader.read("!B")[0] |
| 67 | assert(_version == 5) |
| 68 | obj.type = reader.read("!B")[0] |
| 69 | _length = reader.read("!H")[0] |
| 70 | orig_reader = reader |
| 71 | reader = orig_reader.slice(_length - (2 + 2)) |
| 72 | obj.xid = reader.read("!L")[0] |
| 73 | return obj |
| 74 | |
| 75 | def __eq__(self, other): |
| 76 | if type(self) != type(other): return False |
| 77 | if self.type != other.type: return False |
| 78 | if self.xid != other.xid: return False |
| 79 | return True |
| 80 | |
| 81 | def pretty_print(self, q): |
| 82 | q.text("message {") |
| 83 | with q.group(): |
| 84 | with q.indent(2): |
| 85 | q.breakable() |
| 86 | q.text("xid = "); |
| 87 | if self.xid != None: |
| 88 | q.text("%#x" % self.xid) |
| 89 | else: |
| 90 | q.text('None') |
| 91 | q.breakable() |
| 92 | q.text('}') |
| 93 | |
| 94 | |
| 95 | class stats_reply(message): |
| 96 | subtypes = {} |
| 97 | |
| 98 | version = 5 |
| 99 | type = 19 |
| 100 | |
| 101 | def __init__(self, xid=None, stats_type=None, flags=None): |
| 102 | if xid != None: |
| 103 | self.xid = xid |
| 104 | else: |
| 105 | self.xid = None |
| 106 | if stats_type != None: |
| 107 | self.stats_type = stats_type |
| 108 | else: |
| 109 | self.stats_type = 0 |
| 110 | if flags != None: |
| 111 | self.flags = flags |
| 112 | else: |
| 113 | self.flags = 0 |
| 114 | return |
| 115 | |
| 116 | def pack(self): |
| 117 | packed = [] |
| 118 | packed.append(struct.pack("!B", self.version)) |
| 119 | packed.append(struct.pack("!B", self.type)) |
| 120 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 121 | packed.append(struct.pack("!L", self.xid)) |
| 122 | packed.append(struct.pack("!H", self.stats_type)) |
| 123 | packed.append(struct.pack("!H", self.flags)) |
| 124 | packed.append('\x00' * 4) |
| 125 | length = sum([len(x) for x in packed]) |
| 126 | packed[2] = struct.pack("!H", length) |
| 127 | return ''.join(packed) |
| 128 | |
| 129 | @staticmethod |
| 130 | def unpack(reader): |
| 131 | subtype, = reader.peek('!H', 8) |
| 132 | subclass = stats_reply.subtypes.get(subtype) |
| 133 | if subclass: |
| 134 | return subclass.unpack(reader) |
| 135 | |
| 136 | obj = stats_reply() |
| 137 | _version = reader.read("!B")[0] |
| 138 | assert(_version == 5) |
| 139 | _type = reader.read("!B")[0] |
| 140 | assert(_type == 19) |
| 141 | _length = reader.read("!H")[0] |
| 142 | orig_reader = reader |
| 143 | reader = orig_reader.slice(_length - (2 + 2)) |
| 144 | obj.xid = reader.read("!L")[0] |
| 145 | obj.stats_type = reader.read("!H")[0] |
| 146 | obj.flags = reader.read("!H")[0] |
| 147 | reader.skip(4) |
| 148 | return obj |
| 149 | |
| 150 | def __eq__(self, other): |
| 151 | if type(self) != type(other): return False |
| 152 | if self.xid != other.xid: return False |
| 153 | if self.stats_type != other.stats_type: return False |
| 154 | if self.flags != other.flags: return False |
| 155 | return True |
| 156 | |
| 157 | def pretty_print(self, q): |
| 158 | q.text("stats_reply {") |
| 159 | with q.group(): |
| 160 | with q.indent(2): |
| 161 | q.breakable() |
| 162 | q.text("xid = "); |
| 163 | if self.xid != None: |
| 164 | q.text("%#x" % self.xid) |
| 165 | else: |
| 166 | q.text('None') |
| 167 | q.text(","); q.breakable() |
| 168 | q.text("flags = "); |
| 169 | q.text("%#x" % self.flags) |
| 170 | q.breakable() |
| 171 | q.text('}') |
| 172 | |
| 173 | message.subtypes[19] = stats_reply |
| 174 | |
| 175 | class aggregate_stats_reply(stats_reply): |
| 176 | version = 5 |
| 177 | type = 19 |
| 178 | stats_type = 2 |
| 179 | |
| 180 | def __init__(self, xid=None, flags=None, packet_count=None, byte_count=None, flow_count=None): |
| 181 | if xid != None: |
| 182 | self.xid = xid |
| 183 | else: |
| 184 | self.xid = None |
| 185 | if flags != None: |
| 186 | self.flags = flags |
| 187 | else: |
| 188 | self.flags = 0 |
| 189 | if packet_count != None: |
| 190 | self.packet_count = packet_count |
| 191 | else: |
| 192 | self.packet_count = 0 |
| 193 | if byte_count != None: |
| 194 | self.byte_count = byte_count |
| 195 | else: |
| 196 | self.byte_count = 0 |
| 197 | if flow_count != None: |
| 198 | self.flow_count = flow_count |
| 199 | else: |
| 200 | self.flow_count = 0 |
| 201 | return |
| 202 | |
| 203 | def pack(self): |
| 204 | packed = [] |
| 205 | packed.append(struct.pack("!B", self.version)) |
| 206 | packed.append(struct.pack("!B", self.type)) |
| 207 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 208 | packed.append(struct.pack("!L", self.xid)) |
| 209 | packed.append(struct.pack("!H", self.stats_type)) |
| 210 | packed.append(struct.pack("!H", self.flags)) |
| 211 | packed.append('\x00' * 4) |
| 212 | packed.append(struct.pack("!Q", self.packet_count)) |
| 213 | packed.append(struct.pack("!Q", self.byte_count)) |
| 214 | packed.append(struct.pack("!L", self.flow_count)) |
| 215 | packed.append('\x00' * 4) |
| 216 | length = sum([len(x) for x in packed]) |
| 217 | packed[2] = struct.pack("!H", length) |
| 218 | return ''.join(packed) |
| 219 | |
| 220 | @staticmethod |
| 221 | def unpack(reader): |
| 222 | obj = aggregate_stats_reply() |
| 223 | _version = reader.read("!B")[0] |
| 224 | assert(_version == 5) |
| 225 | _type = reader.read("!B")[0] |
| 226 | assert(_type == 19) |
| 227 | _length = reader.read("!H")[0] |
| 228 | orig_reader = reader |
| 229 | reader = orig_reader.slice(_length - (2 + 2)) |
| 230 | obj.xid = reader.read("!L")[0] |
| 231 | _stats_type = reader.read("!H")[0] |
| 232 | assert(_stats_type == 2) |
| 233 | obj.flags = reader.read("!H")[0] |
| 234 | reader.skip(4) |
| 235 | obj.packet_count = reader.read("!Q")[0] |
| 236 | obj.byte_count = reader.read("!Q")[0] |
| 237 | obj.flow_count = reader.read("!L")[0] |
| 238 | reader.skip(4) |
| 239 | return obj |
| 240 | |
| 241 | def __eq__(self, other): |
| 242 | if type(self) != type(other): return False |
| 243 | if self.xid != other.xid: return False |
| 244 | if self.flags != other.flags: return False |
| 245 | if self.packet_count != other.packet_count: return False |
| 246 | if self.byte_count != other.byte_count: return False |
| 247 | if self.flow_count != other.flow_count: return False |
| 248 | return True |
| 249 | |
| 250 | def pretty_print(self, q): |
| 251 | q.text("aggregate_stats_reply {") |
| 252 | with q.group(): |
| 253 | with q.indent(2): |
| 254 | q.breakable() |
| 255 | q.text("xid = "); |
| 256 | if self.xid != None: |
| 257 | q.text("%#x" % self.xid) |
| 258 | else: |
| 259 | q.text('None') |
| 260 | q.text(","); q.breakable() |
| 261 | q.text("flags = "); |
| 262 | q.text("%#x" % self.flags) |
| 263 | q.text(","); q.breakable() |
| 264 | q.text("packet_count = "); |
| 265 | q.text("%#x" % self.packet_count) |
| 266 | q.text(","); q.breakable() |
| 267 | q.text("byte_count = "); |
| 268 | q.text("%#x" % self.byte_count) |
| 269 | q.text(","); q.breakable() |
| 270 | q.text("flow_count = "); |
| 271 | q.text("%#x" % self.flow_count) |
| 272 | q.breakable() |
| 273 | q.text('}') |
| 274 | |
| 275 | stats_reply.subtypes[2] = aggregate_stats_reply |
| 276 | |
| 277 | class stats_request(message): |
| 278 | subtypes = {} |
| 279 | |
| 280 | version = 5 |
| 281 | type = 18 |
| 282 | |
| 283 | def __init__(self, xid=None, stats_type=None, flags=None): |
| 284 | if xid != None: |
| 285 | self.xid = xid |
| 286 | else: |
| 287 | self.xid = None |
| 288 | if stats_type != None: |
| 289 | self.stats_type = stats_type |
| 290 | else: |
| 291 | self.stats_type = 0 |
| 292 | if flags != None: |
| 293 | self.flags = flags |
| 294 | else: |
| 295 | self.flags = 0 |
| 296 | return |
| 297 | |
| 298 | def pack(self): |
| 299 | packed = [] |
| 300 | packed.append(struct.pack("!B", self.version)) |
| 301 | packed.append(struct.pack("!B", self.type)) |
| 302 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 303 | packed.append(struct.pack("!L", self.xid)) |
| 304 | packed.append(struct.pack("!H", self.stats_type)) |
| 305 | packed.append(struct.pack("!H", self.flags)) |
| 306 | packed.append('\x00' * 4) |
| 307 | length = sum([len(x) for x in packed]) |
| 308 | packed[2] = struct.pack("!H", length) |
| 309 | return ''.join(packed) |
| 310 | |
| 311 | @staticmethod |
| 312 | def unpack(reader): |
| 313 | subtype, = reader.peek('!H', 8) |
| 314 | subclass = stats_request.subtypes.get(subtype) |
| 315 | if subclass: |
| 316 | return subclass.unpack(reader) |
| 317 | |
| 318 | obj = stats_request() |
| 319 | _version = reader.read("!B")[0] |
| 320 | assert(_version == 5) |
| 321 | _type = reader.read("!B")[0] |
| 322 | assert(_type == 18) |
| 323 | _length = reader.read("!H")[0] |
| 324 | orig_reader = reader |
| 325 | reader = orig_reader.slice(_length - (2 + 2)) |
| 326 | obj.xid = reader.read("!L")[0] |
| 327 | obj.stats_type = reader.read("!H")[0] |
| 328 | obj.flags = reader.read("!H")[0] |
| 329 | reader.skip(4) |
| 330 | return obj |
| 331 | |
| 332 | def __eq__(self, other): |
| 333 | if type(self) != type(other): return False |
| 334 | if self.xid != other.xid: return False |
| 335 | if self.stats_type != other.stats_type: return False |
| 336 | if self.flags != other.flags: return False |
| 337 | return True |
| 338 | |
| 339 | def pretty_print(self, q): |
| 340 | q.text("stats_request {") |
| 341 | with q.group(): |
| 342 | with q.indent(2): |
| 343 | q.breakable() |
| 344 | q.text("xid = "); |
| 345 | if self.xid != None: |
| 346 | q.text("%#x" % self.xid) |
| 347 | else: |
| 348 | q.text('None') |
| 349 | q.text(","); q.breakable() |
| 350 | q.text("flags = "); |
| 351 | q.text("%#x" % self.flags) |
| 352 | q.breakable() |
| 353 | q.text('}') |
| 354 | |
| 355 | message.subtypes[18] = stats_request |
| 356 | |
| 357 | class aggregate_stats_request(stats_request): |
| 358 | version = 5 |
| 359 | type = 18 |
| 360 | stats_type = 2 |
| 361 | |
| 362 | def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None): |
| 363 | if xid != None: |
| 364 | self.xid = xid |
| 365 | else: |
| 366 | self.xid = None |
| 367 | if flags != None: |
| 368 | self.flags = flags |
| 369 | else: |
| 370 | self.flags = 0 |
| 371 | if table_id != None: |
| 372 | self.table_id = table_id |
| 373 | else: |
| 374 | self.table_id = 0 |
| 375 | if out_port != None: |
| 376 | self.out_port = out_port |
| 377 | else: |
| 378 | self.out_port = 0 |
| 379 | if out_group != None: |
| 380 | self.out_group = out_group |
| 381 | else: |
| 382 | self.out_group = 0 |
| 383 | if cookie != None: |
| 384 | self.cookie = cookie |
| 385 | else: |
| 386 | self.cookie = 0 |
| 387 | if cookie_mask != None: |
| 388 | self.cookie_mask = cookie_mask |
| 389 | else: |
| 390 | self.cookie_mask = 0 |
| 391 | if match != None: |
| 392 | self.match = match |
| 393 | else: |
| 394 | self.match = common.match() |
| 395 | return |
| 396 | |
| 397 | def pack(self): |
| 398 | packed = [] |
| 399 | packed.append(struct.pack("!B", self.version)) |
| 400 | packed.append(struct.pack("!B", self.type)) |
| 401 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 402 | packed.append(struct.pack("!L", self.xid)) |
| 403 | packed.append(struct.pack("!H", self.stats_type)) |
| 404 | packed.append(struct.pack("!H", self.flags)) |
| 405 | packed.append('\x00' * 4) |
| 406 | packed.append(struct.pack("!B", self.table_id)) |
| 407 | packed.append('\x00' * 3) |
| 408 | packed.append(util.pack_port_no(self.out_port)) |
| 409 | packed.append(struct.pack("!L", self.out_group)) |
| 410 | packed.append('\x00' * 4) |
| 411 | packed.append(struct.pack("!Q", self.cookie)) |
| 412 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 413 | packed.append(self.match.pack()) |
| 414 | length = sum([len(x) for x in packed]) |
| 415 | packed[2] = struct.pack("!H", length) |
| 416 | return ''.join(packed) |
| 417 | |
| 418 | @staticmethod |
| 419 | def unpack(reader): |
| 420 | obj = aggregate_stats_request() |
| 421 | _version = reader.read("!B")[0] |
| 422 | assert(_version == 5) |
| 423 | _type = reader.read("!B")[0] |
| 424 | assert(_type == 18) |
| 425 | _length = reader.read("!H")[0] |
| 426 | orig_reader = reader |
| 427 | reader = orig_reader.slice(_length - (2 + 2)) |
| 428 | obj.xid = reader.read("!L")[0] |
| 429 | _stats_type = reader.read("!H")[0] |
| 430 | assert(_stats_type == 2) |
| 431 | obj.flags = reader.read("!H")[0] |
| 432 | reader.skip(4) |
| 433 | obj.table_id = reader.read("!B")[0] |
| 434 | reader.skip(3) |
| 435 | obj.out_port = util.unpack_port_no(reader) |
| 436 | obj.out_group = reader.read("!L")[0] |
| 437 | reader.skip(4) |
| 438 | obj.cookie = reader.read("!Q")[0] |
| 439 | obj.cookie_mask = reader.read("!Q")[0] |
| 440 | obj.match = common.match.unpack(reader) |
| 441 | return obj |
| 442 | |
| 443 | def __eq__(self, other): |
| 444 | if type(self) != type(other): return False |
| 445 | if self.xid != other.xid: return False |
| 446 | if self.flags != other.flags: return False |
| 447 | if self.table_id != other.table_id: return False |
| 448 | if self.out_port != other.out_port: return False |
| 449 | if self.out_group != other.out_group: return False |
| 450 | if self.cookie != other.cookie: return False |
| 451 | if self.cookie_mask != other.cookie_mask: return False |
| 452 | if self.match != other.match: return False |
| 453 | return True |
| 454 | |
| 455 | def pretty_print(self, q): |
| 456 | q.text("aggregate_stats_request {") |
| 457 | with q.group(): |
| 458 | with q.indent(2): |
| 459 | q.breakable() |
| 460 | q.text("xid = "); |
| 461 | if self.xid != None: |
| 462 | q.text("%#x" % self.xid) |
| 463 | else: |
| 464 | q.text('None') |
| 465 | q.text(","); q.breakable() |
| 466 | q.text("flags = "); |
| 467 | q.text("%#x" % self.flags) |
| 468 | q.text(","); q.breakable() |
| 469 | q.text("table_id = "); |
| 470 | q.text("%#x" % self.table_id) |
| 471 | q.text(","); q.breakable() |
| 472 | q.text("out_port = "); |
| 473 | q.text(util.pretty_port(self.out_port)) |
| 474 | q.text(","); q.breakable() |
| 475 | q.text("out_group = "); |
| 476 | q.text("%#x" % self.out_group) |
| 477 | q.text(","); q.breakable() |
| 478 | q.text("cookie = "); |
| 479 | q.text("%#x" % self.cookie) |
| 480 | q.text(","); q.breakable() |
| 481 | q.text("cookie_mask = "); |
| 482 | q.text("%#x" % self.cookie_mask) |
| 483 | q.text(","); q.breakable() |
| 484 | q.text("match = "); |
| 485 | q.pp(self.match) |
| 486 | q.breakable() |
| 487 | q.text('}') |
| 488 | |
| 489 | stats_request.subtypes[2] = aggregate_stats_request |
| 490 | |
| 491 | class async_get_reply(message): |
| 492 | version = 5 |
| 493 | type = 27 |
| 494 | |
| 495 | def __init__(self, xid=None, properties=None): |
| 496 | if xid != None: |
| 497 | self.xid = xid |
| 498 | else: |
| 499 | self.xid = None |
| 500 | if properties != None: |
| 501 | self.properties = properties |
| 502 | else: |
| 503 | self.properties = [] |
| 504 | return |
| 505 | |
| 506 | def pack(self): |
| 507 | packed = [] |
| 508 | packed.append(struct.pack("!B", self.version)) |
| 509 | packed.append(struct.pack("!B", self.type)) |
| 510 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 511 | packed.append(struct.pack("!L", self.xid)) |
| 512 | packed.append(loxi.generic_util.pack_list(self.properties)) |
| 513 | length = sum([len(x) for x in packed]) |
| 514 | packed[2] = struct.pack("!H", length) |
| 515 | return ''.join(packed) |
| 516 | |
| 517 | @staticmethod |
| 518 | def unpack(reader): |
| 519 | obj = async_get_reply() |
| 520 | _version = reader.read("!B")[0] |
| 521 | assert(_version == 5) |
| 522 | _type = reader.read("!B")[0] |
| 523 | assert(_type == 27) |
| 524 | _length = reader.read("!H")[0] |
| 525 | orig_reader = reader |
| 526 | reader = orig_reader.slice(_length - (2 + 2)) |
| 527 | obj.xid = reader.read("!L")[0] |
| 528 | obj.properties = loxi.generic_util.unpack_list(reader, async_config_prop.async_config_prop.unpack) |
| 529 | return obj |
| 530 | |
| 531 | def __eq__(self, other): |
| 532 | if type(self) != type(other): return False |
| 533 | if self.xid != other.xid: return False |
| 534 | if self.properties != other.properties: return False |
| 535 | return True |
| 536 | |
| 537 | def pretty_print(self, q): |
| 538 | q.text("async_get_reply {") |
| 539 | with q.group(): |
| 540 | with q.indent(2): |
| 541 | q.breakable() |
| 542 | q.text("xid = "); |
| 543 | if self.xid != None: |
| 544 | q.text("%#x" % self.xid) |
| 545 | else: |
| 546 | q.text('None') |
| 547 | q.text(","); q.breakable() |
| 548 | q.text("properties = "); |
| 549 | q.pp(self.properties) |
| 550 | q.breakable() |
| 551 | q.text('}') |
| 552 | |
| 553 | message.subtypes[27] = async_get_reply |
| 554 | |
| 555 | class async_get_request(message): |
| 556 | version = 5 |
| 557 | type = 26 |
| 558 | |
| 559 | def __init__(self, xid=None, properties=None): |
| 560 | if xid != None: |
| 561 | self.xid = xid |
| 562 | else: |
| 563 | self.xid = None |
| 564 | if properties != None: |
| 565 | self.properties = properties |
| 566 | else: |
| 567 | self.properties = [] |
| 568 | return |
| 569 | |
| 570 | def pack(self): |
| 571 | packed = [] |
| 572 | packed.append(struct.pack("!B", self.version)) |
| 573 | packed.append(struct.pack("!B", self.type)) |
| 574 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 575 | packed.append(struct.pack("!L", self.xid)) |
| 576 | packed.append(loxi.generic_util.pack_list(self.properties)) |
| 577 | length = sum([len(x) for x in packed]) |
| 578 | packed[2] = struct.pack("!H", length) |
| 579 | return ''.join(packed) |
| 580 | |
| 581 | @staticmethod |
| 582 | def unpack(reader): |
| 583 | obj = async_get_request() |
| 584 | _version = reader.read("!B")[0] |
| 585 | assert(_version == 5) |
| 586 | _type = reader.read("!B")[0] |
| 587 | assert(_type == 26) |
| 588 | _length = reader.read("!H")[0] |
| 589 | orig_reader = reader |
| 590 | reader = orig_reader.slice(_length - (2 + 2)) |
| 591 | obj.xid = reader.read("!L")[0] |
| 592 | obj.properties = loxi.generic_util.unpack_list(reader, async_config_prop.async_config_prop.unpack) |
| 593 | return obj |
| 594 | |
| 595 | def __eq__(self, other): |
| 596 | if type(self) != type(other): return False |
| 597 | if self.xid != other.xid: return False |
| 598 | if self.properties != other.properties: return False |
| 599 | return True |
| 600 | |
| 601 | def pretty_print(self, q): |
| 602 | q.text("async_get_request {") |
| 603 | with q.group(): |
| 604 | with q.indent(2): |
| 605 | q.breakable() |
| 606 | q.text("xid = "); |
| 607 | if self.xid != None: |
| 608 | q.text("%#x" % self.xid) |
| 609 | else: |
| 610 | q.text('None') |
| 611 | q.text(","); q.breakable() |
| 612 | q.text("properties = "); |
| 613 | q.pp(self.properties) |
| 614 | q.breakable() |
| 615 | q.text('}') |
| 616 | |
| 617 | message.subtypes[26] = async_get_request |
| 618 | |
| 619 | class async_set(message): |
| 620 | version = 5 |
| 621 | type = 28 |
| 622 | |
| 623 | def __init__(self, xid=None, properties=None): |
| 624 | if xid != None: |
| 625 | self.xid = xid |
| 626 | else: |
| 627 | self.xid = None |
| 628 | if properties != None: |
| 629 | self.properties = properties |
| 630 | else: |
| 631 | self.properties = [] |
| 632 | return |
| 633 | |
| 634 | def pack(self): |
| 635 | packed = [] |
| 636 | packed.append(struct.pack("!B", self.version)) |
| 637 | packed.append(struct.pack("!B", self.type)) |
| 638 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 639 | packed.append(struct.pack("!L", self.xid)) |
| 640 | packed.append(loxi.generic_util.pack_list(self.properties)) |
| 641 | length = sum([len(x) for x in packed]) |
| 642 | packed[2] = struct.pack("!H", length) |
| 643 | return ''.join(packed) |
| 644 | |
| 645 | @staticmethod |
| 646 | def unpack(reader): |
| 647 | obj = async_set() |
| 648 | _version = reader.read("!B")[0] |
| 649 | assert(_version == 5) |
| 650 | _type = reader.read("!B")[0] |
| 651 | assert(_type == 28) |
| 652 | _length = reader.read("!H")[0] |
| 653 | orig_reader = reader |
| 654 | reader = orig_reader.slice(_length - (2 + 2)) |
| 655 | obj.xid = reader.read("!L")[0] |
| 656 | obj.properties = loxi.generic_util.unpack_list(reader, async_config_prop.async_config_prop.unpack) |
| 657 | return obj |
| 658 | |
| 659 | def __eq__(self, other): |
| 660 | if type(self) != type(other): return False |
| 661 | if self.xid != other.xid: return False |
| 662 | if self.properties != other.properties: return False |
| 663 | return True |
| 664 | |
| 665 | def pretty_print(self, q): |
| 666 | q.text("async_set {") |
| 667 | with q.group(): |
| 668 | with q.indent(2): |
| 669 | q.breakable() |
| 670 | q.text("xid = "); |
| 671 | if self.xid != None: |
| 672 | q.text("%#x" % self.xid) |
| 673 | else: |
| 674 | q.text('None') |
| 675 | q.text(","); q.breakable() |
| 676 | q.text("properties = "); |
| 677 | q.pp(self.properties) |
| 678 | q.breakable() |
| 679 | q.text('}') |
| 680 | |
| 681 | message.subtypes[28] = async_set |
| 682 | |
| 683 | class error_msg(message): |
| 684 | subtypes = {} |
| 685 | |
| 686 | version = 5 |
| 687 | type = 1 |
| 688 | |
| 689 | def __init__(self, xid=None, err_type=None): |
| 690 | if xid != None: |
| 691 | self.xid = xid |
| 692 | else: |
| 693 | self.xid = None |
| 694 | if err_type != None: |
| 695 | self.err_type = err_type |
| 696 | else: |
| 697 | self.err_type = 0 |
| 698 | return |
| 699 | |
| 700 | def pack(self): |
| 701 | packed = [] |
| 702 | packed.append(struct.pack("!B", self.version)) |
| 703 | packed.append(struct.pack("!B", self.type)) |
| 704 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 705 | packed.append(struct.pack("!L", self.xid)) |
| 706 | packed.append(struct.pack("!H", self.err_type)) |
| 707 | length = sum([len(x) for x in packed]) |
| 708 | packed[2] = struct.pack("!H", length) |
| 709 | return ''.join(packed) |
| 710 | |
| 711 | @staticmethod |
| 712 | def unpack(reader): |
| 713 | subtype, = reader.peek('!H', 8) |
| 714 | subclass = error_msg.subtypes.get(subtype) |
| 715 | if subclass: |
| 716 | return subclass.unpack(reader) |
| 717 | |
| 718 | obj = error_msg() |
| 719 | _version = reader.read("!B")[0] |
| 720 | assert(_version == 5) |
| 721 | _type = reader.read("!B")[0] |
| 722 | assert(_type == 1) |
| 723 | _length = reader.read("!H")[0] |
| 724 | orig_reader = reader |
| 725 | reader = orig_reader.slice(_length - (2 + 2)) |
| 726 | obj.xid = reader.read("!L")[0] |
| 727 | obj.err_type = reader.read("!H")[0] |
| 728 | return obj |
| 729 | |
| 730 | def __eq__(self, other): |
| 731 | if type(self) != type(other): return False |
| 732 | if self.xid != other.xid: return False |
| 733 | if self.err_type != other.err_type: return False |
| 734 | return True |
| 735 | |
| 736 | def pretty_print(self, q): |
| 737 | q.text("error_msg {") |
| 738 | with q.group(): |
| 739 | with q.indent(2): |
| 740 | q.breakable() |
| 741 | q.text("xid = "); |
| 742 | if self.xid != None: |
| 743 | q.text("%#x" % self.xid) |
| 744 | else: |
| 745 | q.text('None') |
| 746 | q.breakable() |
| 747 | q.text('}') |
| 748 | |
| 749 | message.subtypes[1] = error_msg |
| 750 | |
| 751 | class bad_action_error_msg(error_msg): |
| 752 | version = 5 |
| 753 | type = 1 |
| 754 | err_type = 2 |
| 755 | |
| 756 | def __init__(self, xid=None, code=None, data=None): |
| 757 | if xid != None: |
| 758 | self.xid = xid |
| 759 | else: |
| 760 | self.xid = None |
| 761 | if code != None: |
| 762 | self.code = code |
| 763 | else: |
| 764 | self.code = 0 |
| 765 | if data != None: |
| 766 | self.data = data |
| 767 | else: |
| 768 | self.data = '' |
| 769 | return |
| 770 | |
| 771 | def pack(self): |
| 772 | packed = [] |
| 773 | packed.append(struct.pack("!B", self.version)) |
| 774 | packed.append(struct.pack("!B", self.type)) |
| 775 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 776 | packed.append(struct.pack("!L", self.xid)) |
| 777 | packed.append(struct.pack("!H", self.err_type)) |
| 778 | packed.append(struct.pack("!H", self.code)) |
| 779 | packed.append(self.data) |
| 780 | length = sum([len(x) for x in packed]) |
| 781 | packed[2] = struct.pack("!H", length) |
| 782 | return ''.join(packed) |
| 783 | |
| 784 | @staticmethod |
| 785 | def unpack(reader): |
| 786 | obj = bad_action_error_msg() |
| 787 | _version = reader.read("!B")[0] |
| 788 | assert(_version == 5) |
| 789 | _type = reader.read("!B")[0] |
| 790 | assert(_type == 1) |
| 791 | _length = reader.read("!H")[0] |
| 792 | orig_reader = reader |
| 793 | reader = orig_reader.slice(_length - (2 + 2)) |
| 794 | obj.xid = reader.read("!L")[0] |
| 795 | _err_type = reader.read("!H")[0] |
| 796 | assert(_err_type == 2) |
| 797 | obj.code = reader.read("!H")[0] |
| 798 | obj.data = str(reader.read_all()) |
| 799 | return obj |
| 800 | |
| 801 | def __eq__(self, other): |
| 802 | if type(self) != type(other): return False |
| 803 | if self.xid != other.xid: return False |
| 804 | if self.code != other.code: return False |
| 805 | if self.data != other.data: return False |
| 806 | return True |
| 807 | |
| 808 | def pretty_print(self, q): |
| 809 | q.text("bad_action_error_msg {") |
| 810 | with q.group(): |
| 811 | with q.indent(2): |
| 812 | q.breakable() |
| 813 | q.text("xid = "); |
| 814 | if self.xid != None: |
| 815 | q.text("%#x" % self.xid) |
| 816 | else: |
| 817 | q.text('None') |
| 818 | q.text(","); q.breakable() |
| 819 | q.text("code = "); |
| 820 | q.text("%#x" % self.code) |
| 821 | q.text(","); q.breakable() |
| 822 | q.text("data = "); |
| 823 | q.pp(self.data) |
| 824 | q.breakable() |
| 825 | q.text('}') |
| 826 | |
| 827 | error_msg.subtypes[2] = bad_action_error_msg |
| 828 | |
| 829 | class bad_instruction_error_msg(error_msg): |
| 830 | version = 5 |
| 831 | type = 1 |
| 832 | err_type = 3 |
| 833 | |
| 834 | def __init__(self, xid=None, code=None, data=None): |
| 835 | if xid != None: |
| 836 | self.xid = xid |
| 837 | else: |
| 838 | self.xid = None |
| 839 | if code != None: |
| 840 | self.code = code |
| 841 | else: |
| 842 | self.code = 0 |
| 843 | if data != None: |
| 844 | self.data = data |
| 845 | else: |
| 846 | self.data = '' |
| 847 | return |
| 848 | |
| 849 | def pack(self): |
| 850 | packed = [] |
| 851 | packed.append(struct.pack("!B", self.version)) |
| 852 | packed.append(struct.pack("!B", self.type)) |
| 853 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 854 | packed.append(struct.pack("!L", self.xid)) |
| 855 | packed.append(struct.pack("!H", self.err_type)) |
| 856 | packed.append(struct.pack("!H", self.code)) |
| 857 | packed.append(self.data) |
| 858 | length = sum([len(x) for x in packed]) |
| 859 | packed[2] = struct.pack("!H", length) |
| 860 | return ''.join(packed) |
| 861 | |
| 862 | @staticmethod |
| 863 | def unpack(reader): |
| 864 | obj = bad_instruction_error_msg() |
| 865 | _version = reader.read("!B")[0] |
| 866 | assert(_version == 5) |
| 867 | _type = reader.read("!B")[0] |
| 868 | assert(_type == 1) |
| 869 | _length = reader.read("!H")[0] |
| 870 | orig_reader = reader |
| 871 | reader = orig_reader.slice(_length - (2 + 2)) |
| 872 | obj.xid = reader.read("!L")[0] |
| 873 | _err_type = reader.read("!H")[0] |
| 874 | assert(_err_type == 3) |
| 875 | obj.code = reader.read("!H")[0] |
| 876 | obj.data = str(reader.read_all()) |
| 877 | return obj |
| 878 | |
| 879 | def __eq__(self, other): |
| 880 | if type(self) != type(other): return False |
| 881 | if self.xid != other.xid: return False |
| 882 | if self.code != other.code: return False |
| 883 | if self.data != other.data: return False |
| 884 | return True |
| 885 | |
| 886 | def pretty_print(self, q): |
| 887 | q.text("bad_instruction_error_msg {") |
| 888 | with q.group(): |
| 889 | with q.indent(2): |
| 890 | q.breakable() |
| 891 | q.text("xid = "); |
| 892 | if self.xid != None: |
| 893 | q.text("%#x" % self.xid) |
| 894 | else: |
| 895 | q.text('None') |
| 896 | q.text(","); q.breakable() |
| 897 | q.text("code = "); |
| 898 | q.text("%#x" % self.code) |
| 899 | q.text(","); q.breakable() |
| 900 | q.text("data = "); |
| 901 | q.pp(self.data) |
| 902 | q.breakable() |
| 903 | q.text('}') |
| 904 | |
| 905 | error_msg.subtypes[3] = bad_instruction_error_msg |
| 906 | |
| 907 | class bad_match_error_msg(error_msg): |
| 908 | version = 5 |
| 909 | type = 1 |
| 910 | err_type = 4 |
| 911 | |
| 912 | def __init__(self, xid=None, code=None, data=None): |
| 913 | if xid != None: |
| 914 | self.xid = xid |
| 915 | else: |
| 916 | self.xid = None |
| 917 | if code != None: |
| 918 | self.code = code |
| 919 | else: |
| 920 | self.code = 0 |
| 921 | if data != None: |
| 922 | self.data = data |
| 923 | else: |
| 924 | self.data = '' |
| 925 | return |
| 926 | |
| 927 | def pack(self): |
| 928 | packed = [] |
| 929 | packed.append(struct.pack("!B", self.version)) |
| 930 | packed.append(struct.pack("!B", self.type)) |
| 931 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 932 | packed.append(struct.pack("!L", self.xid)) |
| 933 | packed.append(struct.pack("!H", self.err_type)) |
| 934 | packed.append(struct.pack("!H", self.code)) |
| 935 | packed.append(self.data) |
| 936 | length = sum([len(x) for x in packed]) |
| 937 | packed[2] = struct.pack("!H", length) |
| 938 | return ''.join(packed) |
| 939 | |
| 940 | @staticmethod |
| 941 | def unpack(reader): |
| 942 | obj = bad_match_error_msg() |
| 943 | _version = reader.read("!B")[0] |
| 944 | assert(_version == 5) |
| 945 | _type = reader.read("!B")[0] |
| 946 | assert(_type == 1) |
| 947 | _length = reader.read("!H")[0] |
| 948 | orig_reader = reader |
| 949 | reader = orig_reader.slice(_length - (2 + 2)) |
| 950 | obj.xid = reader.read("!L")[0] |
| 951 | _err_type = reader.read("!H")[0] |
| 952 | assert(_err_type == 4) |
| 953 | obj.code = reader.read("!H")[0] |
| 954 | obj.data = str(reader.read_all()) |
| 955 | return obj |
| 956 | |
| 957 | def __eq__(self, other): |
| 958 | if type(self) != type(other): return False |
| 959 | if self.xid != other.xid: return False |
| 960 | if self.code != other.code: return False |
| 961 | if self.data != other.data: return False |
| 962 | return True |
| 963 | |
| 964 | def pretty_print(self, q): |
| 965 | q.text("bad_match_error_msg {") |
| 966 | with q.group(): |
| 967 | with q.indent(2): |
| 968 | q.breakable() |
| 969 | q.text("xid = "); |
| 970 | if self.xid != None: |
| 971 | q.text("%#x" % self.xid) |
| 972 | else: |
| 973 | q.text('None') |
| 974 | q.text(","); q.breakable() |
| 975 | q.text("code = "); |
| 976 | q.text("%#x" % self.code) |
| 977 | q.text(","); q.breakable() |
| 978 | q.text("data = "); |
| 979 | q.pp(self.data) |
| 980 | q.breakable() |
| 981 | q.text('}') |
| 982 | |
| 983 | error_msg.subtypes[4] = bad_match_error_msg |
| 984 | |
| 985 | class bad_request_error_msg(error_msg): |
| 986 | version = 5 |
| 987 | type = 1 |
| 988 | err_type = 1 |
| 989 | |
| 990 | def __init__(self, xid=None, code=None, data=None): |
| 991 | if xid != None: |
| 992 | self.xid = xid |
| 993 | else: |
| 994 | self.xid = None |
| 995 | if code != None: |
| 996 | self.code = code |
| 997 | else: |
| 998 | self.code = 0 |
| 999 | if data != None: |
| 1000 | self.data = data |
| 1001 | else: |
| 1002 | self.data = '' |
| 1003 | return |
| 1004 | |
| 1005 | def pack(self): |
| 1006 | packed = [] |
| 1007 | packed.append(struct.pack("!B", self.version)) |
| 1008 | packed.append(struct.pack("!B", self.type)) |
| 1009 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1010 | packed.append(struct.pack("!L", self.xid)) |
| 1011 | packed.append(struct.pack("!H", self.err_type)) |
| 1012 | packed.append(struct.pack("!H", self.code)) |
| 1013 | packed.append(self.data) |
| 1014 | length = sum([len(x) for x in packed]) |
| 1015 | packed[2] = struct.pack("!H", length) |
| 1016 | return ''.join(packed) |
| 1017 | |
| 1018 | @staticmethod |
| 1019 | def unpack(reader): |
| 1020 | obj = bad_request_error_msg() |
| 1021 | _version = reader.read("!B")[0] |
| 1022 | assert(_version == 5) |
| 1023 | _type = reader.read("!B")[0] |
| 1024 | assert(_type == 1) |
| 1025 | _length = reader.read("!H")[0] |
| 1026 | orig_reader = reader |
| 1027 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1028 | obj.xid = reader.read("!L")[0] |
| 1029 | _err_type = reader.read("!H")[0] |
| 1030 | assert(_err_type == 1) |
| 1031 | obj.code = reader.read("!H")[0] |
| 1032 | obj.data = str(reader.read_all()) |
| 1033 | return obj |
| 1034 | |
| 1035 | def __eq__(self, other): |
| 1036 | if type(self) != type(other): return False |
| 1037 | if self.xid != other.xid: return False |
| 1038 | if self.code != other.code: return False |
| 1039 | if self.data != other.data: return False |
| 1040 | return True |
| 1041 | |
| 1042 | def pretty_print(self, q): |
| 1043 | q.text("bad_request_error_msg {") |
| 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.text(","); q.breakable() |
| 1053 | q.text("code = "); |
| 1054 | q.text("%#x" % self.code) |
| 1055 | q.text(","); q.breakable() |
| 1056 | q.text("data = "); |
| 1057 | q.pp(self.data) |
| 1058 | q.breakable() |
| 1059 | q.text('}') |
| 1060 | |
| 1061 | error_msg.subtypes[1] = bad_request_error_msg |
| 1062 | |
| 1063 | class barrier_reply(message): |
| 1064 | version = 5 |
| 1065 | type = 21 |
| 1066 | |
| 1067 | def __init__(self, xid=None): |
| 1068 | if xid != None: |
| 1069 | self.xid = xid |
| 1070 | else: |
| 1071 | self.xid = None |
| 1072 | return |
| 1073 | |
| 1074 | def pack(self): |
| 1075 | packed = [] |
| 1076 | packed.append(struct.pack("!B", self.version)) |
| 1077 | packed.append(struct.pack("!B", self.type)) |
| 1078 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1079 | packed.append(struct.pack("!L", self.xid)) |
| 1080 | length = sum([len(x) for x in packed]) |
| 1081 | packed[2] = struct.pack("!H", length) |
| 1082 | return ''.join(packed) |
| 1083 | |
| 1084 | @staticmethod |
| 1085 | def unpack(reader): |
| 1086 | obj = barrier_reply() |
| 1087 | _version = reader.read("!B")[0] |
| 1088 | assert(_version == 5) |
| 1089 | _type = reader.read("!B")[0] |
| 1090 | assert(_type == 21) |
| 1091 | _length = reader.read("!H")[0] |
| 1092 | orig_reader = reader |
| 1093 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1094 | obj.xid = reader.read("!L")[0] |
| 1095 | return obj |
| 1096 | |
| 1097 | def __eq__(self, other): |
| 1098 | if type(self) != type(other): return False |
| 1099 | if self.xid != other.xid: return False |
| 1100 | return True |
| 1101 | |
| 1102 | def pretty_print(self, q): |
| 1103 | q.text("barrier_reply {") |
| 1104 | with q.group(): |
| 1105 | with q.indent(2): |
| 1106 | q.breakable() |
| 1107 | q.text("xid = "); |
| 1108 | if self.xid != None: |
| 1109 | q.text("%#x" % self.xid) |
| 1110 | else: |
| 1111 | q.text('None') |
| 1112 | q.breakable() |
| 1113 | q.text('}') |
| 1114 | |
| 1115 | message.subtypes[21] = barrier_reply |
| 1116 | |
| 1117 | class barrier_request(message): |
| 1118 | version = 5 |
| 1119 | type = 20 |
| 1120 | |
| 1121 | def __init__(self, xid=None): |
| 1122 | if xid != None: |
| 1123 | self.xid = xid |
| 1124 | else: |
| 1125 | self.xid = None |
| 1126 | return |
| 1127 | |
| 1128 | def pack(self): |
| 1129 | packed = [] |
| 1130 | packed.append(struct.pack("!B", self.version)) |
| 1131 | packed.append(struct.pack("!B", self.type)) |
| 1132 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1133 | packed.append(struct.pack("!L", self.xid)) |
| 1134 | length = sum([len(x) for x in packed]) |
| 1135 | packed[2] = struct.pack("!H", length) |
| 1136 | return ''.join(packed) |
| 1137 | |
| 1138 | @staticmethod |
| 1139 | def unpack(reader): |
| 1140 | obj = barrier_request() |
| 1141 | _version = reader.read("!B")[0] |
| 1142 | assert(_version == 5) |
| 1143 | _type = reader.read("!B")[0] |
| 1144 | assert(_type == 20) |
| 1145 | _length = reader.read("!H")[0] |
| 1146 | orig_reader = reader |
| 1147 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1148 | obj.xid = reader.read("!L")[0] |
| 1149 | return obj |
| 1150 | |
| 1151 | def __eq__(self, other): |
| 1152 | if type(self) != type(other): return False |
| 1153 | if self.xid != other.xid: return False |
| 1154 | return True |
| 1155 | |
| 1156 | def pretty_print(self, q): |
| 1157 | q.text("barrier_request {") |
| 1158 | with q.group(): |
| 1159 | with q.indent(2): |
| 1160 | q.breakable() |
| 1161 | q.text("xid = "); |
| 1162 | if self.xid != None: |
| 1163 | q.text("%#x" % self.xid) |
| 1164 | else: |
| 1165 | q.text('None') |
| 1166 | q.breakable() |
| 1167 | q.text('}') |
| 1168 | |
| 1169 | message.subtypes[20] = barrier_request |
| 1170 | |
| 1171 | class experimenter(message): |
| 1172 | subtypes = {} |
| 1173 | |
| 1174 | version = 5 |
| 1175 | type = 4 |
| 1176 | |
| 1177 | def __init__(self, xid=None, experimenter=None, subtype=None, data=None): |
| 1178 | if xid != None: |
| 1179 | self.xid = xid |
| 1180 | else: |
| 1181 | self.xid = None |
| 1182 | if experimenter != None: |
| 1183 | self.experimenter = experimenter |
| 1184 | else: |
| 1185 | self.experimenter = 0 |
| 1186 | if subtype != None: |
| 1187 | self.subtype = subtype |
| 1188 | else: |
| 1189 | self.subtype = 0 |
| 1190 | if data != None: |
| 1191 | self.data = data |
| 1192 | else: |
| 1193 | self.data = '' |
| 1194 | return |
| 1195 | |
| 1196 | def pack(self): |
| 1197 | packed = [] |
| 1198 | packed.append(struct.pack("!B", self.version)) |
| 1199 | packed.append(struct.pack("!B", self.type)) |
| 1200 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1201 | packed.append(struct.pack("!L", self.xid)) |
| 1202 | packed.append(struct.pack("!L", self.experimenter)) |
| 1203 | packed.append(struct.pack("!L", self.subtype)) |
| 1204 | packed.append(self.data) |
| 1205 | length = sum([len(x) for x in packed]) |
| 1206 | packed[2] = struct.pack("!H", length) |
| 1207 | return ''.join(packed) |
| 1208 | |
| 1209 | @staticmethod |
| 1210 | def unpack(reader): |
| 1211 | subtype, = reader.peek('!L', 8) |
| 1212 | subclass = experimenter.subtypes.get(subtype) |
| 1213 | if subclass: |
| 1214 | return subclass.unpack(reader) |
| 1215 | |
| 1216 | obj = experimenter() |
| 1217 | _version = reader.read("!B")[0] |
| 1218 | assert(_version == 5) |
| 1219 | _type = reader.read("!B")[0] |
| 1220 | assert(_type == 4) |
| 1221 | _length = reader.read("!H")[0] |
| 1222 | orig_reader = reader |
| 1223 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1224 | obj.xid = reader.read("!L")[0] |
| 1225 | obj.experimenter = reader.read("!L")[0] |
| 1226 | obj.subtype = reader.read("!L")[0] |
| 1227 | obj.data = str(reader.read_all()) |
| 1228 | return obj |
| 1229 | |
| 1230 | def __eq__(self, other): |
| 1231 | if type(self) != type(other): return False |
| 1232 | if self.xid != other.xid: return False |
| 1233 | if self.experimenter != other.experimenter: return False |
| 1234 | if self.subtype != other.subtype: return False |
| 1235 | if self.data != other.data: return False |
| 1236 | return True |
| 1237 | |
| 1238 | def pretty_print(self, q): |
| 1239 | q.text("experimenter {") |
| 1240 | with q.group(): |
| 1241 | with q.indent(2): |
| 1242 | q.breakable() |
| 1243 | q.text("xid = "); |
| 1244 | if self.xid != None: |
| 1245 | q.text("%#x" % self.xid) |
| 1246 | else: |
| 1247 | q.text('None') |
| 1248 | q.text(","); q.breakable() |
| 1249 | q.text("subtype = "); |
| 1250 | q.text("%#x" % self.subtype) |
| 1251 | q.text(","); q.breakable() |
| 1252 | q.text("data = "); |
| 1253 | q.pp(self.data) |
| 1254 | q.breakable() |
| 1255 | q.text('}') |
| 1256 | |
| 1257 | message.subtypes[4] = experimenter |
| 1258 | |
| 1259 | class bsn_header(experimenter): |
| 1260 | subtypes = {} |
| 1261 | |
| 1262 | version = 5 |
| 1263 | type = 4 |
| 1264 | experimenter = 6035143 |
| 1265 | |
| 1266 | def __init__(self, xid=None, subtype=None): |
| 1267 | if xid != None: |
| 1268 | self.xid = xid |
| 1269 | else: |
| 1270 | self.xid = None |
| 1271 | if subtype != None: |
| 1272 | self.subtype = subtype |
| 1273 | else: |
| 1274 | self.subtype = 0 |
| 1275 | return |
| 1276 | |
| 1277 | def pack(self): |
| 1278 | packed = [] |
| 1279 | packed.append(struct.pack("!B", self.version)) |
| 1280 | packed.append(struct.pack("!B", self.type)) |
| 1281 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1282 | packed.append(struct.pack("!L", self.xid)) |
| 1283 | packed.append(struct.pack("!L", self.experimenter)) |
| 1284 | packed.append(struct.pack("!L", self.subtype)) |
| 1285 | length = sum([len(x) for x in packed]) |
| 1286 | packed[2] = struct.pack("!H", length) |
| 1287 | return ''.join(packed) |
| 1288 | |
| 1289 | @staticmethod |
| 1290 | def unpack(reader): |
| 1291 | subtype, = reader.peek('!L', 12) |
| 1292 | subclass = bsn_header.subtypes.get(subtype) |
| 1293 | if subclass: |
| 1294 | return subclass.unpack(reader) |
| 1295 | |
| 1296 | obj = bsn_header() |
| 1297 | _version = reader.read("!B")[0] |
| 1298 | assert(_version == 5) |
| 1299 | _type = reader.read("!B")[0] |
| 1300 | assert(_type == 4) |
| 1301 | _length = reader.read("!H")[0] |
| 1302 | orig_reader = reader |
| 1303 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1304 | obj.xid = reader.read("!L")[0] |
| 1305 | _experimenter = reader.read("!L")[0] |
| 1306 | assert(_experimenter == 6035143) |
| 1307 | obj.subtype = reader.read("!L")[0] |
| 1308 | return obj |
| 1309 | |
| 1310 | def __eq__(self, other): |
| 1311 | if type(self) != type(other): return False |
| 1312 | if self.xid != other.xid: return False |
| 1313 | if self.subtype != other.subtype: return False |
| 1314 | return True |
| 1315 | |
| 1316 | def pretty_print(self, q): |
| 1317 | q.text("bsn_header {") |
| 1318 | with q.group(): |
| 1319 | with q.indent(2): |
| 1320 | q.breakable() |
| 1321 | q.text("xid = "); |
| 1322 | if self.xid != None: |
| 1323 | q.text("%#x" % self.xid) |
| 1324 | else: |
| 1325 | q.text('None') |
| 1326 | q.breakable() |
| 1327 | q.text('}') |
| 1328 | |
| 1329 | experimenter.subtypes[6035143] = bsn_header |
| 1330 | |
| 1331 | class bsn_bw_clear_data_reply(bsn_header): |
| 1332 | version = 5 |
| 1333 | type = 4 |
| 1334 | experimenter = 6035143 |
| 1335 | subtype = 22 |
| 1336 | |
| 1337 | def __init__(self, xid=None, status=None): |
| 1338 | if xid != None: |
| 1339 | self.xid = xid |
| 1340 | else: |
| 1341 | self.xid = None |
| 1342 | if status != None: |
| 1343 | self.status = status |
| 1344 | else: |
| 1345 | self.status = 0 |
| 1346 | return |
| 1347 | |
| 1348 | def pack(self): |
| 1349 | packed = [] |
| 1350 | packed.append(struct.pack("!B", self.version)) |
| 1351 | packed.append(struct.pack("!B", self.type)) |
| 1352 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1353 | packed.append(struct.pack("!L", self.xid)) |
| 1354 | packed.append(struct.pack("!L", self.experimenter)) |
| 1355 | packed.append(struct.pack("!L", self.subtype)) |
| 1356 | packed.append(struct.pack("!L", self.status)) |
| 1357 | length = sum([len(x) for x in packed]) |
| 1358 | packed[2] = struct.pack("!H", length) |
| 1359 | return ''.join(packed) |
| 1360 | |
| 1361 | @staticmethod |
| 1362 | def unpack(reader): |
| 1363 | obj = bsn_bw_clear_data_reply() |
| 1364 | _version = reader.read("!B")[0] |
| 1365 | assert(_version == 5) |
| 1366 | _type = reader.read("!B")[0] |
| 1367 | assert(_type == 4) |
| 1368 | _length = reader.read("!H")[0] |
| 1369 | orig_reader = reader |
| 1370 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1371 | obj.xid = reader.read("!L")[0] |
| 1372 | _experimenter = reader.read("!L")[0] |
| 1373 | assert(_experimenter == 6035143) |
| 1374 | _subtype = reader.read("!L")[0] |
| 1375 | assert(_subtype == 22) |
| 1376 | obj.status = reader.read("!L")[0] |
| 1377 | return obj |
| 1378 | |
| 1379 | def __eq__(self, other): |
| 1380 | if type(self) != type(other): return False |
| 1381 | if self.xid != other.xid: return False |
| 1382 | if self.status != other.status: return False |
| 1383 | return True |
| 1384 | |
| 1385 | def pretty_print(self, q): |
| 1386 | q.text("bsn_bw_clear_data_reply {") |
| 1387 | with q.group(): |
| 1388 | with q.indent(2): |
| 1389 | q.breakable() |
| 1390 | q.text("xid = "); |
| 1391 | if self.xid != None: |
| 1392 | q.text("%#x" % self.xid) |
| 1393 | else: |
| 1394 | q.text('None') |
| 1395 | q.text(","); q.breakable() |
| 1396 | q.text("status = "); |
| 1397 | q.text("%#x" % self.status) |
| 1398 | q.breakable() |
| 1399 | q.text('}') |
| 1400 | |
| 1401 | bsn_header.subtypes[22] = bsn_bw_clear_data_reply |
| 1402 | |
| 1403 | class bsn_bw_clear_data_request(bsn_header): |
| 1404 | version = 5 |
| 1405 | type = 4 |
| 1406 | experimenter = 6035143 |
| 1407 | subtype = 21 |
| 1408 | |
| 1409 | def __init__(self, xid=None): |
| 1410 | if xid != None: |
| 1411 | self.xid = xid |
| 1412 | else: |
| 1413 | self.xid = None |
| 1414 | return |
| 1415 | |
| 1416 | def pack(self): |
| 1417 | packed = [] |
| 1418 | packed.append(struct.pack("!B", self.version)) |
| 1419 | packed.append(struct.pack("!B", self.type)) |
| 1420 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1421 | packed.append(struct.pack("!L", self.xid)) |
| 1422 | packed.append(struct.pack("!L", self.experimenter)) |
| 1423 | packed.append(struct.pack("!L", self.subtype)) |
| 1424 | length = sum([len(x) for x in packed]) |
| 1425 | packed[2] = struct.pack("!H", length) |
| 1426 | return ''.join(packed) |
| 1427 | |
| 1428 | @staticmethod |
| 1429 | def unpack(reader): |
| 1430 | obj = bsn_bw_clear_data_request() |
| 1431 | _version = reader.read("!B")[0] |
| 1432 | assert(_version == 5) |
| 1433 | _type = reader.read("!B")[0] |
| 1434 | assert(_type == 4) |
| 1435 | _length = reader.read("!H")[0] |
| 1436 | orig_reader = reader |
| 1437 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1438 | obj.xid = reader.read("!L")[0] |
| 1439 | _experimenter = reader.read("!L")[0] |
| 1440 | assert(_experimenter == 6035143) |
| 1441 | _subtype = reader.read("!L")[0] |
| 1442 | assert(_subtype == 21) |
| 1443 | return obj |
| 1444 | |
| 1445 | def __eq__(self, other): |
| 1446 | if type(self) != type(other): return False |
| 1447 | if self.xid != other.xid: return False |
| 1448 | return True |
| 1449 | |
| 1450 | def pretty_print(self, q): |
| 1451 | q.text("bsn_bw_clear_data_request {") |
| 1452 | with q.group(): |
| 1453 | with q.indent(2): |
| 1454 | q.breakable() |
| 1455 | q.text("xid = "); |
| 1456 | if self.xid != None: |
| 1457 | q.text("%#x" % self.xid) |
| 1458 | else: |
| 1459 | q.text('None') |
| 1460 | q.breakable() |
| 1461 | q.text('}') |
| 1462 | |
| 1463 | bsn_header.subtypes[21] = bsn_bw_clear_data_request |
| 1464 | |
| 1465 | class bsn_bw_enable_get_reply(bsn_header): |
| 1466 | version = 5 |
| 1467 | type = 4 |
| 1468 | experimenter = 6035143 |
| 1469 | subtype = 20 |
| 1470 | |
| 1471 | def __init__(self, xid=None, enabled=None): |
| 1472 | if xid != None: |
| 1473 | self.xid = xid |
| 1474 | else: |
| 1475 | self.xid = None |
| 1476 | if enabled != None: |
| 1477 | self.enabled = enabled |
| 1478 | else: |
| 1479 | self.enabled = 0 |
| 1480 | return |
| 1481 | |
| 1482 | def pack(self): |
| 1483 | packed = [] |
| 1484 | packed.append(struct.pack("!B", self.version)) |
| 1485 | packed.append(struct.pack("!B", self.type)) |
| 1486 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1487 | packed.append(struct.pack("!L", self.xid)) |
| 1488 | packed.append(struct.pack("!L", self.experimenter)) |
| 1489 | packed.append(struct.pack("!L", self.subtype)) |
| 1490 | packed.append(struct.pack("!L", self.enabled)) |
| 1491 | length = sum([len(x) for x in packed]) |
| 1492 | packed[2] = struct.pack("!H", length) |
| 1493 | return ''.join(packed) |
| 1494 | |
| 1495 | @staticmethod |
| 1496 | def unpack(reader): |
| 1497 | obj = bsn_bw_enable_get_reply() |
| 1498 | _version = reader.read("!B")[0] |
| 1499 | assert(_version == 5) |
| 1500 | _type = reader.read("!B")[0] |
| 1501 | assert(_type == 4) |
| 1502 | _length = reader.read("!H")[0] |
| 1503 | orig_reader = reader |
| 1504 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1505 | obj.xid = reader.read("!L")[0] |
| 1506 | _experimenter = reader.read("!L")[0] |
| 1507 | assert(_experimenter == 6035143) |
| 1508 | _subtype = reader.read("!L")[0] |
| 1509 | assert(_subtype == 20) |
| 1510 | obj.enabled = reader.read("!L")[0] |
| 1511 | return obj |
| 1512 | |
| 1513 | def __eq__(self, other): |
| 1514 | if type(self) != type(other): return False |
| 1515 | if self.xid != other.xid: return False |
| 1516 | if self.enabled != other.enabled: return False |
| 1517 | return True |
| 1518 | |
| 1519 | def pretty_print(self, q): |
| 1520 | q.text("bsn_bw_enable_get_reply {") |
| 1521 | with q.group(): |
| 1522 | with q.indent(2): |
| 1523 | q.breakable() |
| 1524 | q.text("xid = "); |
| 1525 | if self.xid != None: |
| 1526 | q.text("%#x" % self.xid) |
| 1527 | else: |
| 1528 | q.text('None') |
| 1529 | q.text(","); q.breakable() |
| 1530 | q.text("enabled = "); |
| 1531 | q.text("%#x" % self.enabled) |
| 1532 | q.breakable() |
| 1533 | q.text('}') |
| 1534 | |
| 1535 | bsn_header.subtypes[20] = bsn_bw_enable_get_reply |
| 1536 | |
| 1537 | class bsn_bw_enable_get_request(bsn_header): |
| 1538 | version = 5 |
| 1539 | type = 4 |
| 1540 | experimenter = 6035143 |
| 1541 | subtype = 19 |
| 1542 | |
| 1543 | def __init__(self, xid=None): |
| 1544 | if xid != None: |
| 1545 | self.xid = xid |
| 1546 | else: |
| 1547 | self.xid = None |
| 1548 | return |
| 1549 | |
| 1550 | def pack(self): |
| 1551 | packed = [] |
| 1552 | packed.append(struct.pack("!B", self.version)) |
| 1553 | packed.append(struct.pack("!B", self.type)) |
| 1554 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1555 | packed.append(struct.pack("!L", self.xid)) |
| 1556 | packed.append(struct.pack("!L", self.experimenter)) |
| 1557 | packed.append(struct.pack("!L", self.subtype)) |
| 1558 | length = sum([len(x) for x in packed]) |
| 1559 | packed[2] = struct.pack("!H", length) |
| 1560 | return ''.join(packed) |
| 1561 | |
| 1562 | @staticmethod |
| 1563 | def unpack(reader): |
| 1564 | obj = bsn_bw_enable_get_request() |
| 1565 | _version = reader.read("!B")[0] |
| 1566 | assert(_version == 5) |
| 1567 | _type = reader.read("!B")[0] |
| 1568 | assert(_type == 4) |
| 1569 | _length = reader.read("!H")[0] |
| 1570 | orig_reader = reader |
| 1571 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1572 | obj.xid = reader.read("!L")[0] |
| 1573 | _experimenter = reader.read("!L")[0] |
| 1574 | assert(_experimenter == 6035143) |
| 1575 | _subtype = reader.read("!L")[0] |
| 1576 | assert(_subtype == 19) |
| 1577 | return obj |
| 1578 | |
| 1579 | def __eq__(self, other): |
| 1580 | if type(self) != type(other): return False |
| 1581 | if self.xid != other.xid: return False |
| 1582 | return True |
| 1583 | |
| 1584 | def pretty_print(self, q): |
| 1585 | q.text("bsn_bw_enable_get_request {") |
| 1586 | with q.group(): |
| 1587 | with q.indent(2): |
| 1588 | q.breakable() |
| 1589 | q.text("xid = "); |
| 1590 | if self.xid != None: |
| 1591 | q.text("%#x" % self.xid) |
| 1592 | else: |
| 1593 | q.text('None') |
| 1594 | q.breakable() |
| 1595 | q.text('}') |
| 1596 | |
| 1597 | bsn_header.subtypes[19] = bsn_bw_enable_get_request |
| 1598 | |
| 1599 | class bsn_bw_enable_set_reply(bsn_header): |
| 1600 | version = 5 |
| 1601 | type = 4 |
| 1602 | experimenter = 6035143 |
| 1603 | subtype = 23 |
| 1604 | |
| 1605 | def __init__(self, xid=None, enable=None, status=None): |
| 1606 | if xid != None: |
| 1607 | self.xid = xid |
| 1608 | else: |
| 1609 | self.xid = None |
| 1610 | if enable != None: |
| 1611 | self.enable = enable |
| 1612 | else: |
| 1613 | self.enable = 0 |
| 1614 | if status != None: |
| 1615 | self.status = status |
| 1616 | else: |
| 1617 | self.status = 0 |
| 1618 | return |
| 1619 | |
| 1620 | def pack(self): |
| 1621 | packed = [] |
| 1622 | packed.append(struct.pack("!B", self.version)) |
| 1623 | packed.append(struct.pack("!B", self.type)) |
| 1624 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1625 | packed.append(struct.pack("!L", self.xid)) |
| 1626 | packed.append(struct.pack("!L", self.experimenter)) |
| 1627 | packed.append(struct.pack("!L", self.subtype)) |
| 1628 | packed.append(struct.pack("!L", self.enable)) |
| 1629 | packed.append(struct.pack("!L", self.status)) |
| 1630 | length = sum([len(x) for x in packed]) |
| 1631 | packed[2] = struct.pack("!H", length) |
| 1632 | return ''.join(packed) |
| 1633 | |
| 1634 | @staticmethod |
| 1635 | def unpack(reader): |
| 1636 | obj = bsn_bw_enable_set_reply() |
| 1637 | _version = reader.read("!B")[0] |
| 1638 | assert(_version == 5) |
| 1639 | _type = reader.read("!B")[0] |
| 1640 | assert(_type == 4) |
| 1641 | _length = reader.read("!H")[0] |
| 1642 | orig_reader = reader |
| 1643 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1644 | obj.xid = reader.read("!L")[0] |
| 1645 | _experimenter = reader.read("!L")[0] |
| 1646 | assert(_experimenter == 6035143) |
| 1647 | _subtype = reader.read("!L")[0] |
| 1648 | assert(_subtype == 23) |
| 1649 | obj.enable = reader.read("!L")[0] |
| 1650 | obj.status = reader.read("!L")[0] |
| 1651 | return obj |
| 1652 | |
| 1653 | def __eq__(self, other): |
| 1654 | if type(self) != type(other): return False |
| 1655 | if self.xid != other.xid: return False |
| 1656 | if self.enable != other.enable: return False |
| 1657 | if self.status != other.status: return False |
| 1658 | return True |
| 1659 | |
| 1660 | def pretty_print(self, q): |
| 1661 | q.text("bsn_bw_enable_set_reply {") |
| 1662 | with q.group(): |
| 1663 | with q.indent(2): |
| 1664 | q.breakable() |
| 1665 | q.text("xid = "); |
| 1666 | if self.xid != None: |
| 1667 | q.text("%#x" % self.xid) |
| 1668 | else: |
| 1669 | q.text('None') |
| 1670 | q.text(","); q.breakable() |
| 1671 | q.text("enable = "); |
| 1672 | q.text("%#x" % self.enable) |
| 1673 | q.text(","); q.breakable() |
| 1674 | q.text("status = "); |
| 1675 | q.text("%#x" % self.status) |
| 1676 | q.breakable() |
| 1677 | q.text('}') |
| 1678 | |
| 1679 | bsn_header.subtypes[23] = bsn_bw_enable_set_reply |
| 1680 | |
| 1681 | class bsn_bw_enable_set_request(bsn_header): |
| 1682 | version = 5 |
| 1683 | type = 4 |
| 1684 | experimenter = 6035143 |
| 1685 | subtype = 18 |
| 1686 | |
| 1687 | def __init__(self, xid=None, enable=None): |
| 1688 | if xid != None: |
| 1689 | self.xid = xid |
| 1690 | else: |
| 1691 | self.xid = None |
| 1692 | if enable != None: |
| 1693 | self.enable = enable |
| 1694 | else: |
| 1695 | self.enable = 0 |
| 1696 | return |
| 1697 | |
| 1698 | def pack(self): |
| 1699 | packed = [] |
| 1700 | packed.append(struct.pack("!B", self.version)) |
| 1701 | packed.append(struct.pack("!B", self.type)) |
| 1702 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1703 | packed.append(struct.pack("!L", self.xid)) |
| 1704 | packed.append(struct.pack("!L", self.experimenter)) |
| 1705 | packed.append(struct.pack("!L", self.subtype)) |
| 1706 | packed.append(struct.pack("!L", self.enable)) |
| 1707 | length = sum([len(x) for x in packed]) |
| 1708 | packed[2] = struct.pack("!H", length) |
| 1709 | return ''.join(packed) |
| 1710 | |
| 1711 | @staticmethod |
| 1712 | def unpack(reader): |
| 1713 | obj = bsn_bw_enable_set_request() |
| 1714 | _version = reader.read("!B")[0] |
| 1715 | assert(_version == 5) |
| 1716 | _type = reader.read("!B")[0] |
| 1717 | assert(_type == 4) |
| 1718 | _length = reader.read("!H")[0] |
| 1719 | orig_reader = reader |
| 1720 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1721 | obj.xid = reader.read("!L")[0] |
| 1722 | _experimenter = reader.read("!L")[0] |
| 1723 | assert(_experimenter == 6035143) |
| 1724 | _subtype = reader.read("!L")[0] |
| 1725 | assert(_subtype == 18) |
| 1726 | obj.enable = reader.read("!L")[0] |
| 1727 | return obj |
| 1728 | |
| 1729 | def __eq__(self, other): |
| 1730 | if type(self) != type(other): return False |
| 1731 | if self.xid != other.xid: return False |
| 1732 | if self.enable != other.enable: return False |
| 1733 | return True |
| 1734 | |
| 1735 | def pretty_print(self, q): |
| 1736 | q.text("bsn_bw_enable_set_request {") |
| 1737 | with q.group(): |
| 1738 | with q.indent(2): |
| 1739 | q.breakable() |
| 1740 | q.text("xid = "); |
| 1741 | if self.xid != None: |
| 1742 | q.text("%#x" % self.xid) |
| 1743 | else: |
| 1744 | q.text('None') |
| 1745 | q.text(","); q.breakable() |
| 1746 | q.text("enable = "); |
| 1747 | q.text("%#x" % self.enable) |
| 1748 | q.breakable() |
| 1749 | q.text('}') |
| 1750 | |
| 1751 | bsn_header.subtypes[18] = bsn_bw_enable_set_request |
| 1752 | |
| 1753 | class bsn_get_interfaces_reply(bsn_header): |
| 1754 | version = 5 |
| 1755 | type = 4 |
| 1756 | experimenter = 6035143 |
| 1757 | subtype = 10 |
| 1758 | |
| 1759 | def __init__(self, xid=None, interfaces=None): |
| 1760 | if xid != None: |
| 1761 | self.xid = xid |
| 1762 | else: |
| 1763 | self.xid = None |
| 1764 | if interfaces != None: |
| 1765 | self.interfaces = interfaces |
| 1766 | else: |
| 1767 | self.interfaces = [] |
| 1768 | return |
| 1769 | |
| 1770 | def pack(self): |
| 1771 | packed = [] |
| 1772 | packed.append(struct.pack("!B", self.version)) |
| 1773 | packed.append(struct.pack("!B", self.type)) |
| 1774 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1775 | packed.append(struct.pack("!L", self.xid)) |
| 1776 | packed.append(struct.pack("!L", self.experimenter)) |
| 1777 | packed.append(struct.pack("!L", self.subtype)) |
| 1778 | packed.append(loxi.generic_util.pack_list(self.interfaces)) |
| 1779 | length = sum([len(x) for x in packed]) |
| 1780 | packed[2] = struct.pack("!H", length) |
| 1781 | return ''.join(packed) |
| 1782 | |
| 1783 | @staticmethod |
| 1784 | def unpack(reader): |
| 1785 | obj = bsn_get_interfaces_reply() |
| 1786 | _version = reader.read("!B")[0] |
| 1787 | assert(_version == 5) |
| 1788 | _type = reader.read("!B")[0] |
| 1789 | assert(_type == 4) |
| 1790 | _length = reader.read("!H")[0] |
| 1791 | orig_reader = reader |
| 1792 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1793 | obj.xid = reader.read("!L")[0] |
| 1794 | _experimenter = reader.read("!L")[0] |
| 1795 | assert(_experimenter == 6035143) |
| 1796 | _subtype = reader.read("!L")[0] |
| 1797 | assert(_subtype == 10) |
| 1798 | obj.interfaces = loxi.generic_util.unpack_list(reader, common.bsn_interface.unpack) |
| 1799 | return obj |
| 1800 | |
| 1801 | def __eq__(self, other): |
| 1802 | if type(self) != type(other): return False |
| 1803 | if self.xid != other.xid: return False |
| 1804 | if self.interfaces != other.interfaces: return False |
| 1805 | return True |
| 1806 | |
| 1807 | def pretty_print(self, q): |
| 1808 | q.text("bsn_get_interfaces_reply {") |
| 1809 | with q.group(): |
| 1810 | with q.indent(2): |
| 1811 | q.breakable() |
| 1812 | q.text("xid = "); |
| 1813 | if self.xid != None: |
| 1814 | q.text("%#x" % self.xid) |
| 1815 | else: |
| 1816 | q.text('None') |
| 1817 | q.text(","); q.breakable() |
| 1818 | q.text("interfaces = "); |
| 1819 | q.pp(self.interfaces) |
| 1820 | q.breakable() |
| 1821 | q.text('}') |
| 1822 | |
| 1823 | bsn_header.subtypes[10] = bsn_get_interfaces_reply |
| 1824 | |
| 1825 | class bsn_get_interfaces_request(bsn_header): |
| 1826 | version = 5 |
| 1827 | type = 4 |
| 1828 | experimenter = 6035143 |
| 1829 | subtype = 9 |
| 1830 | |
| 1831 | def __init__(self, xid=None): |
| 1832 | if xid != None: |
| 1833 | self.xid = xid |
| 1834 | else: |
| 1835 | self.xid = None |
| 1836 | return |
| 1837 | |
| 1838 | def pack(self): |
| 1839 | packed = [] |
| 1840 | packed.append(struct.pack("!B", self.version)) |
| 1841 | packed.append(struct.pack("!B", self.type)) |
| 1842 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1843 | packed.append(struct.pack("!L", self.xid)) |
| 1844 | packed.append(struct.pack("!L", self.experimenter)) |
| 1845 | packed.append(struct.pack("!L", self.subtype)) |
| 1846 | length = sum([len(x) for x in packed]) |
| 1847 | packed[2] = struct.pack("!H", length) |
| 1848 | return ''.join(packed) |
| 1849 | |
| 1850 | @staticmethod |
| 1851 | def unpack(reader): |
| 1852 | obj = bsn_get_interfaces_request() |
| 1853 | _version = reader.read("!B")[0] |
| 1854 | assert(_version == 5) |
| 1855 | _type = reader.read("!B")[0] |
| 1856 | assert(_type == 4) |
| 1857 | _length = reader.read("!H")[0] |
| 1858 | orig_reader = reader |
| 1859 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1860 | obj.xid = reader.read("!L")[0] |
| 1861 | _experimenter = reader.read("!L")[0] |
| 1862 | assert(_experimenter == 6035143) |
| 1863 | _subtype = reader.read("!L")[0] |
| 1864 | assert(_subtype == 9) |
| 1865 | return obj |
| 1866 | |
| 1867 | def __eq__(self, other): |
| 1868 | if type(self) != type(other): return False |
| 1869 | if self.xid != other.xid: return False |
| 1870 | return True |
| 1871 | |
| 1872 | def pretty_print(self, q): |
| 1873 | q.text("bsn_get_interfaces_request {") |
| 1874 | with q.group(): |
| 1875 | with q.indent(2): |
| 1876 | q.breakable() |
| 1877 | q.text("xid = "); |
| 1878 | if self.xid != None: |
| 1879 | q.text("%#x" % self.xid) |
| 1880 | else: |
| 1881 | q.text('None') |
| 1882 | q.breakable() |
| 1883 | q.text('}') |
| 1884 | |
| 1885 | bsn_header.subtypes[9] = bsn_get_interfaces_request |
| 1886 | |
| 1887 | class bsn_get_mirroring_reply(bsn_header): |
| 1888 | version = 5 |
| 1889 | type = 4 |
| 1890 | experimenter = 6035143 |
| 1891 | subtype = 5 |
| 1892 | |
| 1893 | def __init__(self, xid=None, report_mirror_ports=None): |
| 1894 | if xid != None: |
| 1895 | self.xid = xid |
| 1896 | else: |
| 1897 | self.xid = None |
| 1898 | if report_mirror_ports != None: |
| 1899 | self.report_mirror_ports = report_mirror_ports |
| 1900 | else: |
| 1901 | self.report_mirror_ports = 0 |
| 1902 | return |
| 1903 | |
| 1904 | def pack(self): |
| 1905 | packed = [] |
| 1906 | packed.append(struct.pack("!B", self.version)) |
| 1907 | packed.append(struct.pack("!B", self.type)) |
| 1908 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1909 | packed.append(struct.pack("!L", self.xid)) |
| 1910 | packed.append(struct.pack("!L", self.experimenter)) |
| 1911 | packed.append(struct.pack("!L", self.subtype)) |
| 1912 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 1913 | packed.append('\x00' * 3) |
| 1914 | length = sum([len(x) for x in packed]) |
| 1915 | packed[2] = struct.pack("!H", length) |
| 1916 | return ''.join(packed) |
| 1917 | |
| 1918 | @staticmethod |
| 1919 | def unpack(reader): |
| 1920 | obj = bsn_get_mirroring_reply() |
| 1921 | _version = reader.read("!B")[0] |
| 1922 | assert(_version == 5) |
| 1923 | _type = reader.read("!B")[0] |
| 1924 | assert(_type == 4) |
| 1925 | _length = reader.read("!H")[0] |
| 1926 | orig_reader = reader |
| 1927 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1928 | obj.xid = reader.read("!L")[0] |
| 1929 | _experimenter = reader.read("!L")[0] |
| 1930 | assert(_experimenter == 6035143) |
| 1931 | _subtype = reader.read("!L")[0] |
| 1932 | assert(_subtype == 5) |
| 1933 | obj.report_mirror_ports = reader.read("!B")[0] |
| 1934 | reader.skip(3) |
| 1935 | return obj |
| 1936 | |
| 1937 | def __eq__(self, other): |
| 1938 | if type(self) != type(other): return False |
| 1939 | if self.xid != other.xid: return False |
| 1940 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 1941 | return True |
| 1942 | |
| 1943 | def pretty_print(self, q): |
| 1944 | q.text("bsn_get_mirroring_reply {") |
| 1945 | with q.group(): |
| 1946 | with q.indent(2): |
| 1947 | q.breakable() |
| 1948 | q.text("xid = "); |
| 1949 | if self.xid != None: |
| 1950 | q.text("%#x" % self.xid) |
| 1951 | else: |
| 1952 | q.text('None') |
| 1953 | q.text(","); q.breakable() |
| 1954 | q.text("report_mirror_ports = "); |
| 1955 | q.text("%#x" % self.report_mirror_ports) |
| 1956 | q.breakable() |
| 1957 | q.text('}') |
| 1958 | |
| 1959 | bsn_header.subtypes[5] = bsn_get_mirroring_reply |
| 1960 | |
| 1961 | class bsn_get_mirroring_request(bsn_header): |
| 1962 | version = 5 |
| 1963 | type = 4 |
| 1964 | experimenter = 6035143 |
| 1965 | subtype = 4 |
| 1966 | |
| 1967 | def __init__(self, xid=None, report_mirror_ports=None): |
| 1968 | if xid != None: |
| 1969 | self.xid = xid |
| 1970 | else: |
| 1971 | self.xid = None |
| 1972 | if report_mirror_ports != None: |
| 1973 | self.report_mirror_ports = report_mirror_ports |
| 1974 | else: |
| 1975 | self.report_mirror_ports = 0 |
| 1976 | return |
| 1977 | |
| 1978 | def pack(self): |
| 1979 | packed = [] |
| 1980 | packed.append(struct.pack("!B", self.version)) |
| 1981 | packed.append(struct.pack("!B", self.type)) |
| 1982 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1983 | packed.append(struct.pack("!L", self.xid)) |
| 1984 | packed.append(struct.pack("!L", self.experimenter)) |
| 1985 | packed.append(struct.pack("!L", self.subtype)) |
| 1986 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 1987 | packed.append('\x00' * 3) |
| 1988 | length = sum([len(x) for x in packed]) |
| 1989 | packed[2] = struct.pack("!H", length) |
| 1990 | return ''.join(packed) |
| 1991 | |
| 1992 | @staticmethod |
| 1993 | def unpack(reader): |
| 1994 | obj = bsn_get_mirroring_request() |
| 1995 | _version = reader.read("!B")[0] |
| 1996 | assert(_version == 5) |
| 1997 | _type = reader.read("!B")[0] |
| 1998 | assert(_type == 4) |
| 1999 | _length = reader.read("!H")[0] |
| 2000 | orig_reader = reader |
| 2001 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2002 | obj.xid = reader.read("!L")[0] |
| 2003 | _experimenter = reader.read("!L")[0] |
| 2004 | assert(_experimenter == 6035143) |
| 2005 | _subtype = reader.read("!L")[0] |
| 2006 | assert(_subtype == 4) |
| 2007 | obj.report_mirror_ports = reader.read("!B")[0] |
| 2008 | reader.skip(3) |
| 2009 | return obj |
| 2010 | |
| 2011 | def __eq__(self, other): |
| 2012 | if type(self) != type(other): return False |
| 2013 | if self.xid != other.xid: return False |
| 2014 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 2015 | return True |
| 2016 | |
| 2017 | def pretty_print(self, q): |
| 2018 | q.text("bsn_get_mirroring_request {") |
| 2019 | with q.group(): |
| 2020 | with q.indent(2): |
| 2021 | q.breakable() |
| 2022 | q.text("xid = "); |
| 2023 | if self.xid != None: |
| 2024 | q.text("%#x" % self.xid) |
| 2025 | else: |
| 2026 | q.text('None') |
| 2027 | q.text(","); q.breakable() |
| 2028 | q.text("report_mirror_ports = "); |
| 2029 | q.text("%#x" % self.report_mirror_ports) |
| 2030 | q.breakable() |
| 2031 | q.text('}') |
| 2032 | |
| 2033 | bsn_header.subtypes[4] = bsn_get_mirroring_request |
| 2034 | |
| 2035 | class bsn_pdu_rx_reply(bsn_header): |
| 2036 | version = 5 |
| 2037 | type = 4 |
| 2038 | experimenter = 6035143 |
| 2039 | subtype = 34 |
| 2040 | |
| 2041 | def __init__(self, xid=None, status=None, port_no=None, slot_num=None): |
| 2042 | if xid != None: |
| 2043 | self.xid = xid |
| 2044 | else: |
| 2045 | self.xid = None |
| 2046 | if status != None: |
| 2047 | self.status = status |
| 2048 | else: |
| 2049 | self.status = 0 |
| 2050 | if port_no != None: |
| 2051 | self.port_no = port_no |
| 2052 | else: |
| 2053 | self.port_no = 0 |
| 2054 | if slot_num != None: |
| 2055 | self.slot_num = slot_num |
| 2056 | else: |
| 2057 | self.slot_num = 0 |
| 2058 | return |
| 2059 | |
| 2060 | def pack(self): |
| 2061 | packed = [] |
| 2062 | packed.append(struct.pack("!B", self.version)) |
| 2063 | packed.append(struct.pack("!B", self.type)) |
| 2064 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2065 | packed.append(struct.pack("!L", self.xid)) |
| 2066 | packed.append(struct.pack("!L", self.experimenter)) |
| 2067 | packed.append(struct.pack("!L", self.subtype)) |
| 2068 | packed.append(struct.pack("!L", self.status)) |
| 2069 | packed.append(util.pack_port_no(self.port_no)) |
| 2070 | packed.append(struct.pack("!B", self.slot_num)) |
| 2071 | length = sum([len(x) for x in packed]) |
| 2072 | packed[2] = struct.pack("!H", length) |
| 2073 | return ''.join(packed) |
| 2074 | |
| 2075 | @staticmethod |
| 2076 | def unpack(reader): |
| 2077 | obj = bsn_pdu_rx_reply() |
| 2078 | _version = reader.read("!B")[0] |
| 2079 | assert(_version == 5) |
| 2080 | _type = reader.read("!B")[0] |
| 2081 | assert(_type == 4) |
| 2082 | _length = reader.read("!H")[0] |
| 2083 | orig_reader = reader |
| 2084 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2085 | obj.xid = reader.read("!L")[0] |
| 2086 | _experimenter = reader.read("!L")[0] |
| 2087 | assert(_experimenter == 6035143) |
| 2088 | _subtype = reader.read("!L")[0] |
| 2089 | assert(_subtype == 34) |
| 2090 | obj.status = reader.read("!L")[0] |
| 2091 | obj.port_no = util.unpack_port_no(reader) |
| 2092 | obj.slot_num = reader.read("!B")[0] |
| 2093 | return obj |
| 2094 | |
| 2095 | def __eq__(self, other): |
| 2096 | if type(self) != type(other): return False |
| 2097 | if self.xid != other.xid: return False |
| 2098 | if self.status != other.status: return False |
| 2099 | if self.port_no != other.port_no: return False |
| 2100 | if self.slot_num != other.slot_num: return False |
| 2101 | return True |
| 2102 | |
| 2103 | def pretty_print(self, q): |
| 2104 | q.text("bsn_pdu_rx_reply {") |
| 2105 | with q.group(): |
| 2106 | with q.indent(2): |
| 2107 | q.breakable() |
| 2108 | q.text("xid = "); |
| 2109 | if self.xid != None: |
| 2110 | q.text("%#x" % self.xid) |
| 2111 | else: |
| 2112 | q.text('None') |
| 2113 | q.text(","); q.breakable() |
| 2114 | q.text("status = "); |
| 2115 | q.text("%#x" % self.status) |
| 2116 | q.text(","); q.breakable() |
| 2117 | q.text("port_no = "); |
| 2118 | q.text(util.pretty_port(self.port_no)) |
| 2119 | q.text(","); q.breakable() |
| 2120 | q.text("slot_num = "); |
| 2121 | q.text("%#x" % self.slot_num) |
| 2122 | q.breakable() |
| 2123 | q.text('}') |
| 2124 | |
| 2125 | bsn_header.subtypes[34] = bsn_pdu_rx_reply |
| 2126 | |
| 2127 | class bsn_pdu_rx_request(bsn_header): |
| 2128 | version = 5 |
| 2129 | type = 4 |
| 2130 | experimenter = 6035143 |
| 2131 | subtype = 33 |
| 2132 | |
| 2133 | def __init__(self, xid=None, timeout_ms=None, port_no=None, slot_num=None, data=None): |
| 2134 | if xid != None: |
| 2135 | self.xid = xid |
| 2136 | else: |
| 2137 | self.xid = None |
| 2138 | if timeout_ms != None: |
| 2139 | self.timeout_ms = timeout_ms |
| 2140 | else: |
| 2141 | self.timeout_ms = 0 |
| 2142 | if port_no != None: |
| 2143 | self.port_no = port_no |
| 2144 | else: |
| 2145 | self.port_no = 0 |
| 2146 | if slot_num != None: |
| 2147 | self.slot_num = slot_num |
| 2148 | else: |
| 2149 | self.slot_num = 0 |
| 2150 | if data != None: |
| 2151 | self.data = data |
| 2152 | else: |
| 2153 | self.data = '' |
| 2154 | return |
| 2155 | |
| 2156 | def pack(self): |
| 2157 | packed = [] |
| 2158 | packed.append(struct.pack("!B", self.version)) |
| 2159 | packed.append(struct.pack("!B", self.type)) |
| 2160 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2161 | packed.append(struct.pack("!L", self.xid)) |
| 2162 | packed.append(struct.pack("!L", self.experimenter)) |
| 2163 | packed.append(struct.pack("!L", self.subtype)) |
| 2164 | packed.append(struct.pack("!L", self.timeout_ms)) |
| 2165 | packed.append(util.pack_port_no(self.port_no)) |
| 2166 | packed.append(struct.pack("!B", self.slot_num)) |
| 2167 | packed.append('\x00' * 3) |
| 2168 | packed.append(self.data) |
| 2169 | length = sum([len(x) for x in packed]) |
| 2170 | packed[2] = struct.pack("!H", length) |
| 2171 | return ''.join(packed) |
| 2172 | |
| 2173 | @staticmethod |
| 2174 | def unpack(reader): |
| 2175 | obj = bsn_pdu_rx_request() |
| 2176 | _version = reader.read("!B")[0] |
| 2177 | assert(_version == 5) |
| 2178 | _type = reader.read("!B")[0] |
| 2179 | assert(_type == 4) |
| 2180 | _length = reader.read("!H")[0] |
| 2181 | orig_reader = reader |
| 2182 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2183 | obj.xid = reader.read("!L")[0] |
| 2184 | _experimenter = reader.read("!L")[0] |
| 2185 | assert(_experimenter == 6035143) |
| 2186 | _subtype = reader.read("!L")[0] |
| 2187 | assert(_subtype == 33) |
| 2188 | obj.timeout_ms = reader.read("!L")[0] |
| 2189 | obj.port_no = util.unpack_port_no(reader) |
| 2190 | obj.slot_num = reader.read("!B")[0] |
| 2191 | reader.skip(3) |
| 2192 | obj.data = str(reader.read_all()) |
| 2193 | return obj |
| 2194 | |
| 2195 | def __eq__(self, other): |
| 2196 | if type(self) != type(other): return False |
| 2197 | if self.xid != other.xid: return False |
| 2198 | if self.timeout_ms != other.timeout_ms: return False |
| 2199 | if self.port_no != other.port_no: return False |
| 2200 | if self.slot_num != other.slot_num: return False |
| 2201 | if self.data != other.data: return False |
| 2202 | return True |
| 2203 | |
| 2204 | def pretty_print(self, q): |
| 2205 | q.text("bsn_pdu_rx_request {") |
| 2206 | with q.group(): |
| 2207 | with q.indent(2): |
| 2208 | q.breakable() |
| 2209 | q.text("xid = "); |
| 2210 | if self.xid != None: |
| 2211 | q.text("%#x" % self.xid) |
| 2212 | else: |
| 2213 | q.text('None') |
| 2214 | q.text(","); q.breakable() |
| 2215 | q.text("timeout_ms = "); |
| 2216 | q.text("%#x" % self.timeout_ms) |
| 2217 | q.text(","); q.breakable() |
| 2218 | q.text("port_no = "); |
| 2219 | q.text(util.pretty_port(self.port_no)) |
| 2220 | q.text(","); q.breakable() |
| 2221 | q.text("slot_num = "); |
| 2222 | q.text("%#x" % self.slot_num) |
| 2223 | q.text(","); q.breakable() |
| 2224 | q.text("data = "); |
| 2225 | q.pp(self.data) |
| 2226 | q.breakable() |
| 2227 | q.text('}') |
| 2228 | |
| 2229 | bsn_header.subtypes[33] = bsn_pdu_rx_request |
| 2230 | |
| 2231 | class bsn_pdu_rx_timeout(bsn_header): |
| 2232 | version = 5 |
| 2233 | type = 4 |
| 2234 | experimenter = 6035143 |
| 2235 | subtype = 35 |
| 2236 | |
| 2237 | def __init__(self, xid=None, port_no=None, slot_num=None): |
| 2238 | if xid != None: |
| 2239 | self.xid = xid |
| 2240 | else: |
| 2241 | self.xid = None |
| 2242 | if port_no != None: |
| 2243 | self.port_no = port_no |
| 2244 | else: |
| 2245 | self.port_no = 0 |
| 2246 | if slot_num != None: |
| 2247 | self.slot_num = slot_num |
| 2248 | else: |
| 2249 | self.slot_num = 0 |
| 2250 | return |
| 2251 | |
| 2252 | def pack(self): |
| 2253 | packed = [] |
| 2254 | packed.append(struct.pack("!B", self.version)) |
| 2255 | packed.append(struct.pack("!B", self.type)) |
| 2256 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2257 | packed.append(struct.pack("!L", self.xid)) |
| 2258 | packed.append(struct.pack("!L", self.experimenter)) |
| 2259 | packed.append(struct.pack("!L", self.subtype)) |
| 2260 | packed.append(util.pack_port_no(self.port_no)) |
| 2261 | packed.append(struct.pack("!B", self.slot_num)) |
| 2262 | length = sum([len(x) for x in packed]) |
| 2263 | packed[2] = struct.pack("!H", length) |
| 2264 | return ''.join(packed) |
| 2265 | |
| 2266 | @staticmethod |
| 2267 | def unpack(reader): |
| 2268 | obj = bsn_pdu_rx_timeout() |
| 2269 | _version = reader.read("!B")[0] |
| 2270 | assert(_version == 5) |
| 2271 | _type = reader.read("!B")[0] |
| 2272 | assert(_type == 4) |
| 2273 | _length = reader.read("!H")[0] |
| 2274 | orig_reader = reader |
| 2275 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2276 | obj.xid = reader.read("!L")[0] |
| 2277 | _experimenter = reader.read("!L")[0] |
| 2278 | assert(_experimenter == 6035143) |
| 2279 | _subtype = reader.read("!L")[0] |
| 2280 | assert(_subtype == 35) |
| 2281 | obj.port_no = util.unpack_port_no(reader) |
| 2282 | obj.slot_num = reader.read("!B")[0] |
| 2283 | return obj |
| 2284 | |
| 2285 | def __eq__(self, other): |
| 2286 | if type(self) != type(other): return False |
| 2287 | if self.xid != other.xid: return False |
| 2288 | if self.port_no != other.port_no: return False |
| 2289 | if self.slot_num != other.slot_num: return False |
| 2290 | return True |
| 2291 | |
| 2292 | def pretty_print(self, q): |
| 2293 | q.text("bsn_pdu_rx_timeout {") |
| 2294 | with q.group(): |
| 2295 | with q.indent(2): |
| 2296 | q.breakable() |
| 2297 | q.text("xid = "); |
| 2298 | if self.xid != None: |
| 2299 | q.text("%#x" % self.xid) |
| 2300 | else: |
| 2301 | q.text('None') |
| 2302 | q.text(","); q.breakable() |
| 2303 | q.text("port_no = "); |
| 2304 | q.text(util.pretty_port(self.port_no)) |
| 2305 | q.text(","); q.breakable() |
| 2306 | q.text("slot_num = "); |
| 2307 | q.text("%#x" % self.slot_num) |
| 2308 | q.breakable() |
| 2309 | q.text('}') |
| 2310 | |
| 2311 | bsn_header.subtypes[35] = bsn_pdu_rx_timeout |
| 2312 | |
| 2313 | class bsn_pdu_tx_reply(bsn_header): |
| 2314 | version = 5 |
| 2315 | type = 4 |
| 2316 | experimenter = 6035143 |
| 2317 | subtype = 32 |
| 2318 | |
| 2319 | def __init__(self, xid=None, status=None, port_no=None, slot_num=None): |
| 2320 | if xid != None: |
| 2321 | self.xid = xid |
| 2322 | else: |
| 2323 | self.xid = None |
| 2324 | if status != None: |
| 2325 | self.status = status |
| 2326 | else: |
| 2327 | self.status = 0 |
| 2328 | if port_no != None: |
| 2329 | self.port_no = port_no |
| 2330 | else: |
| 2331 | self.port_no = 0 |
| 2332 | if slot_num != None: |
| 2333 | self.slot_num = slot_num |
| 2334 | else: |
| 2335 | self.slot_num = 0 |
| 2336 | return |
| 2337 | |
| 2338 | def pack(self): |
| 2339 | packed = [] |
| 2340 | packed.append(struct.pack("!B", self.version)) |
| 2341 | packed.append(struct.pack("!B", self.type)) |
| 2342 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2343 | packed.append(struct.pack("!L", self.xid)) |
| 2344 | packed.append(struct.pack("!L", self.experimenter)) |
| 2345 | packed.append(struct.pack("!L", self.subtype)) |
| 2346 | packed.append(struct.pack("!L", self.status)) |
| 2347 | packed.append(util.pack_port_no(self.port_no)) |
| 2348 | packed.append(struct.pack("!B", self.slot_num)) |
| 2349 | length = sum([len(x) for x in packed]) |
| 2350 | packed[2] = struct.pack("!H", length) |
| 2351 | return ''.join(packed) |
| 2352 | |
| 2353 | @staticmethod |
| 2354 | def unpack(reader): |
| 2355 | obj = bsn_pdu_tx_reply() |
| 2356 | _version = reader.read("!B")[0] |
| 2357 | assert(_version == 5) |
| 2358 | _type = reader.read("!B")[0] |
| 2359 | assert(_type == 4) |
| 2360 | _length = reader.read("!H")[0] |
| 2361 | orig_reader = reader |
| 2362 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2363 | obj.xid = reader.read("!L")[0] |
| 2364 | _experimenter = reader.read("!L")[0] |
| 2365 | assert(_experimenter == 6035143) |
| 2366 | _subtype = reader.read("!L")[0] |
| 2367 | assert(_subtype == 32) |
| 2368 | obj.status = reader.read("!L")[0] |
| 2369 | obj.port_no = util.unpack_port_no(reader) |
| 2370 | obj.slot_num = reader.read("!B")[0] |
| 2371 | return obj |
| 2372 | |
| 2373 | def __eq__(self, other): |
| 2374 | if type(self) != type(other): return False |
| 2375 | if self.xid != other.xid: return False |
| 2376 | if self.status != other.status: return False |
| 2377 | if self.port_no != other.port_no: return False |
| 2378 | if self.slot_num != other.slot_num: return False |
| 2379 | return True |
| 2380 | |
| 2381 | def pretty_print(self, q): |
| 2382 | q.text("bsn_pdu_tx_reply {") |
| 2383 | with q.group(): |
| 2384 | with q.indent(2): |
| 2385 | q.breakable() |
| 2386 | q.text("xid = "); |
| 2387 | if self.xid != None: |
| 2388 | q.text("%#x" % self.xid) |
| 2389 | else: |
| 2390 | q.text('None') |
| 2391 | q.text(","); q.breakable() |
| 2392 | q.text("status = "); |
| 2393 | q.text("%#x" % self.status) |
| 2394 | q.text(","); q.breakable() |
| 2395 | q.text("port_no = "); |
| 2396 | q.text(util.pretty_port(self.port_no)) |
| 2397 | q.text(","); q.breakable() |
| 2398 | q.text("slot_num = "); |
| 2399 | q.text("%#x" % self.slot_num) |
| 2400 | q.breakable() |
| 2401 | q.text('}') |
| 2402 | |
| 2403 | bsn_header.subtypes[32] = bsn_pdu_tx_reply |
| 2404 | |
| 2405 | class bsn_pdu_tx_request(bsn_header): |
| 2406 | version = 5 |
| 2407 | type = 4 |
| 2408 | experimenter = 6035143 |
| 2409 | subtype = 31 |
| 2410 | |
| 2411 | def __init__(self, xid=None, tx_interval_ms=None, port_no=None, slot_num=None, data=None): |
| 2412 | if xid != None: |
| 2413 | self.xid = xid |
| 2414 | else: |
| 2415 | self.xid = None |
| 2416 | if tx_interval_ms != None: |
| 2417 | self.tx_interval_ms = tx_interval_ms |
| 2418 | else: |
| 2419 | self.tx_interval_ms = 0 |
| 2420 | if port_no != None: |
| 2421 | self.port_no = port_no |
| 2422 | else: |
| 2423 | self.port_no = 0 |
| 2424 | if slot_num != None: |
| 2425 | self.slot_num = slot_num |
| 2426 | else: |
| 2427 | self.slot_num = 0 |
| 2428 | if data != None: |
| 2429 | self.data = data |
| 2430 | else: |
| 2431 | self.data = '' |
| 2432 | return |
| 2433 | |
| 2434 | def pack(self): |
| 2435 | packed = [] |
| 2436 | packed.append(struct.pack("!B", self.version)) |
| 2437 | packed.append(struct.pack("!B", self.type)) |
| 2438 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2439 | packed.append(struct.pack("!L", self.xid)) |
| 2440 | packed.append(struct.pack("!L", self.experimenter)) |
| 2441 | packed.append(struct.pack("!L", self.subtype)) |
| 2442 | packed.append(struct.pack("!L", self.tx_interval_ms)) |
| 2443 | packed.append(util.pack_port_no(self.port_no)) |
| 2444 | packed.append(struct.pack("!B", self.slot_num)) |
| 2445 | packed.append('\x00' * 3) |
| 2446 | packed.append(self.data) |
| 2447 | length = sum([len(x) for x in packed]) |
| 2448 | packed[2] = struct.pack("!H", length) |
| 2449 | return ''.join(packed) |
| 2450 | |
| 2451 | @staticmethod |
| 2452 | def unpack(reader): |
| 2453 | obj = bsn_pdu_tx_request() |
| 2454 | _version = reader.read("!B")[0] |
| 2455 | assert(_version == 5) |
| 2456 | _type = reader.read("!B")[0] |
| 2457 | assert(_type == 4) |
| 2458 | _length = reader.read("!H")[0] |
| 2459 | orig_reader = reader |
| 2460 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2461 | obj.xid = reader.read("!L")[0] |
| 2462 | _experimenter = reader.read("!L")[0] |
| 2463 | assert(_experimenter == 6035143) |
| 2464 | _subtype = reader.read("!L")[0] |
| 2465 | assert(_subtype == 31) |
| 2466 | obj.tx_interval_ms = reader.read("!L")[0] |
| 2467 | obj.port_no = util.unpack_port_no(reader) |
| 2468 | obj.slot_num = reader.read("!B")[0] |
| 2469 | reader.skip(3) |
| 2470 | obj.data = str(reader.read_all()) |
| 2471 | return obj |
| 2472 | |
| 2473 | def __eq__(self, other): |
| 2474 | if type(self) != type(other): return False |
| 2475 | if self.xid != other.xid: return False |
| 2476 | if self.tx_interval_ms != other.tx_interval_ms: return False |
| 2477 | if self.port_no != other.port_no: return False |
| 2478 | if self.slot_num != other.slot_num: return False |
| 2479 | if self.data != other.data: return False |
| 2480 | return True |
| 2481 | |
| 2482 | def pretty_print(self, q): |
| 2483 | q.text("bsn_pdu_tx_request {") |
| 2484 | with q.group(): |
| 2485 | with q.indent(2): |
| 2486 | q.breakable() |
| 2487 | q.text("xid = "); |
| 2488 | if self.xid != None: |
| 2489 | q.text("%#x" % self.xid) |
| 2490 | else: |
| 2491 | q.text('None') |
| 2492 | q.text(","); q.breakable() |
| 2493 | q.text("tx_interval_ms = "); |
| 2494 | q.text("%#x" % self.tx_interval_ms) |
| 2495 | q.text(","); q.breakable() |
| 2496 | q.text("port_no = "); |
| 2497 | q.text(util.pretty_port(self.port_no)) |
| 2498 | q.text(","); q.breakable() |
| 2499 | q.text("slot_num = "); |
| 2500 | q.text("%#x" % self.slot_num) |
| 2501 | q.text(","); q.breakable() |
| 2502 | q.text("data = "); |
| 2503 | q.pp(self.data) |
| 2504 | q.breakable() |
| 2505 | q.text('}') |
| 2506 | |
| 2507 | bsn_header.subtypes[31] = bsn_pdu_tx_request |
| 2508 | |
| 2509 | class bsn_set_mirroring(bsn_header): |
| 2510 | version = 5 |
| 2511 | type = 4 |
| 2512 | experimenter = 6035143 |
| 2513 | subtype = 3 |
| 2514 | |
| 2515 | def __init__(self, xid=None, report_mirror_ports=None): |
| 2516 | if xid != None: |
| 2517 | self.xid = xid |
| 2518 | else: |
| 2519 | self.xid = None |
| 2520 | if report_mirror_ports != None: |
| 2521 | self.report_mirror_ports = report_mirror_ports |
| 2522 | else: |
| 2523 | self.report_mirror_ports = 0 |
| 2524 | return |
| 2525 | |
| 2526 | def pack(self): |
| 2527 | packed = [] |
| 2528 | packed.append(struct.pack("!B", self.version)) |
| 2529 | packed.append(struct.pack("!B", self.type)) |
| 2530 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2531 | packed.append(struct.pack("!L", self.xid)) |
| 2532 | packed.append(struct.pack("!L", self.experimenter)) |
| 2533 | packed.append(struct.pack("!L", self.subtype)) |
| 2534 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 2535 | packed.append('\x00' * 3) |
| 2536 | length = sum([len(x) for x in packed]) |
| 2537 | packed[2] = struct.pack("!H", length) |
| 2538 | return ''.join(packed) |
| 2539 | |
| 2540 | @staticmethod |
| 2541 | def unpack(reader): |
| 2542 | obj = bsn_set_mirroring() |
| 2543 | _version = reader.read("!B")[0] |
| 2544 | assert(_version == 5) |
| 2545 | _type = reader.read("!B")[0] |
| 2546 | assert(_type == 4) |
| 2547 | _length = reader.read("!H")[0] |
| 2548 | orig_reader = reader |
| 2549 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2550 | obj.xid = reader.read("!L")[0] |
| 2551 | _experimenter = reader.read("!L")[0] |
| 2552 | assert(_experimenter == 6035143) |
| 2553 | _subtype = reader.read("!L")[0] |
| 2554 | assert(_subtype == 3) |
| 2555 | obj.report_mirror_ports = reader.read("!B")[0] |
| 2556 | reader.skip(3) |
| 2557 | return obj |
| 2558 | |
| 2559 | def __eq__(self, other): |
| 2560 | if type(self) != type(other): return False |
| 2561 | if self.xid != other.xid: return False |
| 2562 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 2563 | return True |
| 2564 | |
| 2565 | def pretty_print(self, q): |
| 2566 | q.text("bsn_set_mirroring {") |
| 2567 | with q.group(): |
| 2568 | with q.indent(2): |
| 2569 | q.breakable() |
| 2570 | q.text("xid = "); |
| 2571 | if self.xid != None: |
| 2572 | q.text("%#x" % self.xid) |
| 2573 | else: |
| 2574 | q.text('None') |
| 2575 | q.text(","); q.breakable() |
| 2576 | q.text("report_mirror_ports = "); |
| 2577 | q.text("%#x" % self.report_mirror_ports) |
| 2578 | q.breakable() |
| 2579 | q.text('}') |
| 2580 | |
| 2581 | bsn_header.subtypes[3] = bsn_set_mirroring |
| 2582 | |
| 2583 | class bsn_set_pktin_suppression_reply(bsn_header): |
| 2584 | version = 5 |
| 2585 | type = 4 |
| 2586 | experimenter = 6035143 |
| 2587 | subtype = 25 |
| 2588 | |
| 2589 | def __init__(self, xid=None, status=None): |
| 2590 | if xid != None: |
| 2591 | self.xid = xid |
| 2592 | else: |
| 2593 | self.xid = None |
| 2594 | if status != None: |
| 2595 | self.status = status |
| 2596 | else: |
| 2597 | self.status = 0 |
| 2598 | return |
| 2599 | |
| 2600 | def pack(self): |
| 2601 | packed = [] |
| 2602 | packed.append(struct.pack("!B", self.version)) |
| 2603 | packed.append(struct.pack("!B", self.type)) |
| 2604 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2605 | packed.append(struct.pack("!L", self.xid)) |
| 2606 | packed.append(struct.pack("!L", self.experimenter)) |
| 2607 | packed.append(struct.pack("!L", self.subtype)) |
| 2608 | packed.append(struct.pack("!L", self.status)) |
| 2609 | length = sum([len(x) for x in packed]) |
| 2610 | packed[2] = struct.pack("!H", length) |
| 2611 | return ''.join(packed) |
| 2612 | |
| 2613 | @staticmethod |
| 2614 | def unpack(reader): |
| 2615 | obj = bsn_set_pktin_suppression_reply() |
| 2616 | _version = reader.read("!B")[0] |
| 2617 | assert(_version == 5) |
| 2618 | _type = reader.read("!B")[0] |
| 2619 | assert(_type == 4) |
| 2620 | _length = reader.read("!H")[0] |
| 2621 | orig_reader = reader |
| 2622 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2623 | obj.xid = reader.read("!L")[0] |
| 2624 | _experimenter = reader.read("!L")[0] |
| 2625 | assert(_experimenter == 6035143) |
| 2626 | _subtype = reader.read("!L")[0] |
| 2627 | assert(_subtype == 25) |
| 2628 | obj.status = reader.read("!L")[0] |
| 2629 | return obj |
| 2630 | |
| 2631 | def __eq__(self, other): |
| 2632 | if type(self) != type(other): return False |
| 2633 | if self.xid != other.xid: return False |
| 2634 | if self.status != other.status: return False |
| 2635 | return True |
| 2636 | |
| 2637 | def pretty_print(self, q): |
| 2638 | q.text("bsn_set_pktin_suppression_reply {") |
| 2639 | with q.group(): |
| 2640 | with q.indent(2): |
| 2641 | q.breakable() |
| 2642 | q.text("xid = "); |
| 2643 | if self.xid != None: |
| 2644 | q.text("%#x" % self.xid) |
| 2645 | else: |
| 2646 | q.text('None') |
| 2647 | q.text(","); q.breakable() |
| 2648 | q.text("status = "); |
| 2649 | q.text("%#x" % self.status) |
| 2650 | q.breakable() |
| 2651 | q.text('}') |
| 2652 | |
| 2653 | bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply |
| 2654 | |
| 2655 | class bsn_set_pktin_suppression_request(bsn_header): |
| 2656 | version = 5 |
| 2657 | type = 4 |
| 2658 | experimenter = 6035143 |
| 2659 | subtype = 11 |
| 2660 | |
| 2661 | def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None): |
| 2662 | if xid != None: |
| 2663 | self.xid = xid |
| 2664 | else: |
| 2665 | self.xid = None |
| 2666 | if enabled != None: |
| 2667 | self.enabled = enabled |
| 2668 | else: |
| 2669 | self.enabled = 0 |
| 2670 | if idle_timeout != None: |
| 2671 | self.idle_timeout = idle_timeout |
| 2672 | else: |
| 2673 | self.idle_timeout = 0 |
| 2674 | if hard_timeout != None: |
| 2675 | self.hard_timeout = hard_timeout |
| 2676 | else: |
| 2677 | self.hard_timeout = 0 |
| 2678 | if priority != None: |
| 2679 | self.priority = priority |
| 2680 | else: |
| 2681 | self.priority = 0 |
| 2682 | if cookie != None: |
| 2683 | self.cookie = cookie |
| 2684 | else: |
| 2685 | self.cookie = 0 |
| 2686 | return |
| 2687 | |
| 2688 | def pack(self): |
| 2689 | packed = [] |
| 2690 | packed.append(struct.pack("!B", self.version)) |
| 2691 | packed.append(struct.pack("!B", self.type)) |
| 2692 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2693 | packed.append(struct.pack("!L", self.xid)) |
| 2694 | packed.append(struct.pack("!L", self.experimenter)) |
| 2695 | packed.append(struct.pack("!L", self.subtype)) |
| 2696 | packed.append(struct.pack("!B", self.enabled)) |
| 2697 | packed.append('\x00' * 1) |
| 2698 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 2699 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 2700 | packed.append(struct.pack("!H", self.priority)) |
| 2701 | packed.append(struct.pack("!Q", self.cookie)) |
| 2702 | length = sum([len(x) for x in packed]) |
| 2703 | packed[2] = struct.pack("!H", length) |
| 2704 | return ''.join(packed) |
| 2705 | |
| 2706 | @staticmethod |
| 2707 | def unpack(reader): |
| 2708 | obj = bsn_set_pktin_suppression_request() |
| 2709 | _version = reader.read("!B")[0] |
| 2710 | assert(_version == 5) |
| 2711 | _type = reader.read("!B")[0] |
| 2712 | assert(_type == 4) |
| 2713 | _length = reader.read("!H")[0] |
| 2714 | orig_reader = reader |
| 2715 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2716 | obj.xid = reader.read("!L")[0] |
| 2717 | _experimenter = reader.read("!L")[0] |
| 2718 | assert(_experimenter == 6035143) |
| 2719 | _subtype = reader.read("!L")[0] |
| 2720 | assert(_subtype == 11) |
| 2721 | obj.enabled = reader.read("!B")[0] |
| 2722 | reader.skip(1) |
| 2723 | obj.idle_timeout = reader.read("!H")[0] |
| 2724 | obj.hard_timeout = reader.read("!H")[0] |
| 2725 | obj.priority = reader.read("!H")[0] |
| 2726 | obj.cookie = reader.read("!Q")[0] |
| 2727 | return obj |
| 2728 | |
| 2729 | def __eq__(self, other): |
| 2730 | if type(self) != type(other): return False |
| 2731 | if self.xid != other.xid: return False |
| 2732 | if self.enabled != other.enabled: return False |
| 2733 | if self.idle_timeout != other.idle_timeout: return False |
| 2734 | if self.hard_timeout != other.hard_timeout: return False |
| 2735 | if self.priority != other.priority: return False |
| 2736 | if self.cookie != other.cookie: return False |
| 2737 | return True |
| 2738 | |
| 2739 | def pretty_print(self, q): |
| 2740 | q.text("bsn_set_pktin_suppression_request {") |
| 2741 | with q.group(): |
| 2742 | with q.indent(2): |
| 2743 | q.breakable() |
| 2744 | q.text("xid = "); |
| 2745 | if self.xid != None: |
| 2746 | q.text("%#x" % self.xid) |
| 2747 | else: |
| 2748 | q.text('None') |
| 2749 | q.text(","); q.breakable() |
| 2750 | q.text("enabled = "); |
| 2751 | q.text("%#x" % self.enabled) |
| 2752 | q.text(","); q.breakable() |
| 2753 | q.text("idle_timeout = "); |
| 2754 | q.text("%#x" % self.idle_timeout) |
| 2755 | q.text(","); q.breakable() |
| 2756 | q.text("hard_timeout = "); |
| 2757 | q.text("%#x" % self.hard_timeout) |
| 2758 | q.text(","); q.breakable() |
| 2759 | q.text("priority = "); |
| 2760 | q.text("%#x" % self.priority) |
| 2761 | q.text(","); q.breakable() |
| 2762 | q.text("cookie = "); |
| 2763 | q.text("%#x" % self.cookie) |
| 2764 | q.breakable() |
| 2765 | q.text('}') |
| 2766 | |
| 2767 | bsn_header.subtypes[11] = bsn_set_pktin_suppression_request |
| 2768 | |
| 2769 | class experimenter_stats_reply(stats_reply): |
| 2770 | subtypes = {} |
| 2771 | |
| 2772 | version = 5 |
| 2773 | type = 19 |
| 2774 | stats_type = 65535 |
| 2775 | |
| 2776 | def __init__(self, xid=None, flags=None, experimenter=None, subtype=None): |
| 2777 | if xid != None: |
| 2778 | self.xid = xid |
| 2779 | else: |
| 2780 | self.xid = None |
| 2781 | if flags != None: |
| 2782 | self.flags = flags |
| 2783 | else: |
| 2784 | self.flags = 0 |
| 2785 | if experimenter != None: |
| 2786 | self.experimenter = experimenter |
| 2787 | else: |
| 2788 | self.experimenter = 0 |
| 2789 | if subtype != None: |
| 2790 | self.subtype = subtype |
| 2791 | else: |
| 2792 | self.subtype = 0 |
| 2793 | return |
| 2794 | |
| 2795 | def pack(self): |
| 2796 | packed = [] |
| 2797 | packed.append(struct.pack("!B", self.version)) |
| 2798 | packed.append(struct.pack("!B", self.type)) |
| 2799 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2800 | packed.append(struct.pack("!L", self.xid)) |
| 2801 | packed.append(struct.pack("!H", self.stats_type)) |
| 2802 | packed.append(struct.pack("!H", self.flags)) |
| 2803 | packed.append('\x00' * 4) |
| 2804 | packed.append(struct.pack("!L", self.experimenter)) |
| 2805 | packed.append(struct.pack("!L", self.subtype)) |
| 2806 | length = sum([len(x) for x in packed]) |
| 2807 | packed[2] = struct.pack("!H", length) |
| 2808 | return ''.join(packed) |
| 2809 | |
| 2810 | @staticmethod |
| 2811 | def unpack(reader): |
| 2812 | subtype, = reader.peek('!L', 16) |
| 2813 | subclass = experimenter_stats_reply.subtypes.get(subtype) |
| 2814 | if subclass: |
| 2815 | return subclass.unpack(reader) |
| 2816 | |
| 2817 | obj = experimenter_stats_reply() |
| 2818 | _version = reader.read("!B")[0] |
| 2819 | assert(_version == 5) |
| 2820 | _type = reader.read("!B")[0] |
| 2821 | assert(_type == 19) |
| 2822 | _length = reader.read("!H")[0] |
| 2823 | orig_reader = reader |
| 2824 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2825 | obj.xid = reader.read("!L")[0] |
| 2826 | _stats_type = reader.read("!H")[0] |
| 2827 | assert(_stats_type == 65535) |
| 2828 | obj.flags = reader.read("!H")[0] |
| 2829 | reader.skip(4) |
| 2830 | obj.experimenter = reader.read("!L")[0] |
| 2831 | obj.subtype = reader.read("!L")[0] |
| 2832 | return obj |
| 2833 | |
| 2834 | def __eq__(self, other): |
| 2835 | if type(self) != type(other): return False |
| 2836 | if self.xid != other.xid: return False |
| 2837 | if self.flags != other.flags: return False |
| 2838 | if self.experimenter != other.experimenter: return False |
| 2839 | if self.subtype != other.subtype: return False |
| 2840 | return True |
| 2841 | |
| 2842 | def pretty_print(self, q): |
| 2843 | q.text("experimenter_stats_reply {") |
| 2844 | with q.group(): |
| 2845 | with q.indent(2): |
| 2846 | q.breakable() |
| 2847 | q.text("xid = "); |
| 2848 | if self.xid != None: |
| 2849 | q.text("%#x" % self.xid) |
| 2850 | else: |
| 2851 | q.text('None') |
| 2852 | q.text(","); q.breakable() |
| 2853 | q.text("flags = "); |
| 2854 | q.text("%#x" % self.flags) |
| 2855 | q.text(","); q.breakable() |
| 2856 | q.text("subtype = "); |
| 2857 | q.text("%#x" % self.subtype) |
| 2858 | q.breakable() |
| 2859 | q.text('}') |
| 2860 | |
| 2861 | stats_reply.subtypes[65535] = experimenter_stats_reply |
| 2862 | |
| 2863 | class bsn_stats_reply(experimenter_stats_reply): |
| 2864 | subtypes = {} |
| 2865 | |
| 2866 | version = 5 |
| 2867 | type = 19 |
| 2868 | stats_type = 65535 |
| 2869 | experimenter = 6035143 |
| 2870 | |
| 2871 | def __init__(self, xid=None, flags=None, subtype=None): |
| 2872 | if xid != None: |
| 2873 | self.xid = xid |
| 2874 | else: |
| 2875 | self.xid = None |
| 2876 | if flags != None: |
| 2877 | self.flags = flags |
| 2878 | else: |
| 2879 | self.flags = 0 |
| 2880 | if subtype != None: |
| 2881 | self.subtype = subtype |
| 2882 | else: |
| 2883 | self.subtype = 0 |
| 2884 | return |
| 2885 | |
| 2886 | def pack(self): |
| 2887 | packed = [] |
| 2888 | packed.append(struct.pack("!B", self.version)) |
| 2889 | packed.append(struct.pack("!B", self.type)) |
| 2890 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2891 | packed.append(struct.pack("!L", self.xid)) |
| 2892 | packed.append(struct.pack("!H", self.stats_type)) |
| 2893 | packed.append(struct.pack("!H", self.flags)) |
| 2894 | packed.append('\x00' * 4) |
| 2895 | packed.append(struct.pack("!L", self.experimenter)) |
| 2896 | packed.append(struct.pack("!L", self.subtype)) |
| 2897 | length = sum([len(x) for x in packed]) |
| 2898 | packed[2] = struct.pack("!H", length) |
| 2899 | return ''.join(packed) |
| 2900 | |
| 2901 | @staticmethod |
| 2902 | def unpack(reader): |
| 2903 | subtype, = reader.peek('!L', 20) |
| 2904 | subclass = bsn_stats_reply.subtypes.get(subtype) |
| 2905 | if subclass: |
| 2906 | return subclass.unpack(reader) |
| 2907 | |
| 2908 | obj = bsn_stats_reply() |
| 2909 | _version = reader.read("!B")[0] |
| 2910 | assert(_version == 5) |
| 2911 | _type = reader.read("!B")[0] |
| 2912 | assert(_type == 19) |
| 2913 | _length = reader.read("!H")[0] |
| 2914 | orig_reader = reader |
| 2915 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2916 | obj.xid = reader.read("!L")[0] |
| 2917 | _stats_type = reader.read("!H")[0] |
| 2918 | assert(_stats_type == 65535) |
| 2919 | obj.flags = reader.read("!H")[0] |
| 2920 | reader.skip(4) |
| 2921 | _experimenter = reader.read("!L")[0] |
| 2922 | assert(_experimenter == 6035143) |
| 2923 | obj.subtype = reader.read("!L")[0] |
| 2924 | return obj |
| 2925 | |
| 2926 | def __eq__(self, other): |
| 2927 | if type(self) != type(other): return False |
| 2928 | if self.xid != other.xid: return False |
| 2929 | if self.flags != other.flags: return False |
| 2930 | if self.subtype != other.subtype: return False |
| 2931 | return True |
| 2932 | |
| 2933 | def pretty_print(self, q): |
| 2934 | q.text("bsn_stats_reply {") |
| 2935 | with q.group(): |
| 2936 | with q.indent(2): |
| 2937 | q.breakable() |
| 2938 | q.text("xid = "); |
| 2939 | if self.xid != None: |
| 2940 | q.text("%#x" % self.xid) |
| 2941 | else: |
| 2942 | q.text('None') |
| 2943 | q.text(","); q.breakable() |
| 2944 | q.text("flags = "); |
| 2945 | q.text("%#x" % self.flags) |
| 2946 | q.breakable() |
| 2947 | q.text('}') |
| 2948 | |
| 2949 | experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply |
| 2950 | |
| 2951 | class experimenter_stats_request(stats_request): |
| 2952 | subtypes = {} |
| 2953 | |
| 2954 | version = 5 |
| 2955 | type = 18 |
| 2956 | stats_type = 65535 |
| 2957 | |
| 2958 | def __init__(self, xid=None, flags=None, experimenter=None, subtype=None): |
| 2959 | if xid != None: |
| 2960 | self.xid = xid |
| 2961 | else: |
| 2962 | self.xid = None |
| 2963 | if flags != None: |
| 2964 | self.flags = flags |
| 2965 | else: |
| 2966 | self.flags = 0 |
| 2967 | if experimenter != None: |
| 2968 | self.experimenter = experimenter |
| 2969 | else: |
| 2970 | self.experimenter = 0 |
| 2971 | if subtype != None: |
| 2972 | self.subtype = subtype |
| 2973 | else: |
| 2974 | self.subtype = 0 |
| 2975 | return |
| 2976 | |
| 2977 | def pack(self): |
| 2978 | packed = [] |
| 2979 | packed.append(struct.pack("!B", self.version)) |
| 2980 | packed.append(struct.pack("!B", self.type)) |
| 2981 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2982 | packed.append(struct.pack("!L", self.xid)) |
| 2983 | packed.append(struct.pack("!H", self.stats_type)) |
| 2984 | packed.append(struct.pack("!H", self.flags)) |
| 2985 | packed.append('\x00' * 4) |
| 2986 | packed.append(struct.pack("!L", self.experimenter)) |
| 2987 | packed.append(struct.pack("!L", self.subtype)) |
| 2988 | length = sum([len(x) for x in packed]) |
| 2989 | packed[2] = struct.pack("!H", length) |
| 2990 | return ''.join(packed) |
| 2991 | |
| 2992 | @staticmethod |
| 2993 | def unpack(reader): |
| 2994 | subtype, = reader.peek('!L', 16) |
| 2995 | subclass = experimenter_stats_request.subtypes.get(subtype) |
| 2996 | if subclass: |
| 2997 | return subclass.unpack(reader) |
| 2998 | |
| 2999 | obj = experimenter_stats_request() |
| 3000 | _version = reader.read("!B")[0] |
| 3001 | assert(_version == 5) |
| 3002 | _type = reader.read("!B")[0] |
| 3003 | assert(_type == 18) |
| 3004 | _length = reader.read("!H")[0] |
| 3005 | orig_reader = reader |
| 3006 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3007 | obj.xid = reader.read("!L")[0] |
| 3008 | _stats_type = reader.read("!H")[0] |
| 3009 | assert(_stats_type == 65535) |
| 3010 | obj.flags = reader.read("!H")[0] |
| 3011 | reader.skip(4) |
| 3012 | obj.experimenter = reader.read("!L")[0] |
| 3013 | obj.subtype = reader.read("!L")[0] |
| 3014 | return obj |
| 3015 | |
| 3016 | def __eq__(self, other): |
| 3017 | if type(self) != type(other): return False |
| 3018 | if self.xid != other.xid: return False |
| 3019 | if self.flags != other.flags: return False |
| 3020 | if self.experimenter != other.experimenter: return False |
| 3021 | if self.subtype != other.subtype: return False |
| 3022 | return True |
| 3023 | |
| 3024 | def pretty_print(self, q): |
| 3025 | q.text("experimenter_stats_request {") |
| 3026 | with q.group(): |
| 3027 | with q.indent(2): |
| 3028 | q.breakable() |
| 3029 | q.text("xid = "); |
| 3030 | if self.xid != None: |
| 3031 | q.text("%#x" % self.xid) |
| 3032 | else: |
| 3033 | q.text('None') |
| 3034 | q.text(","); q.breakable() |
| 3035 | q.text("flags = "); |
| 3036 | q.text("%#x" % self.flags) |
| 3037 | q.text(","); q.breakable() |
| 3038 | q.text("subtype = "); |
| 3039 | q.text("%#x" % self.subtype) |
| 3040 | q.breakable() |
| 3041 | q.text('}') |
| 3042 | |
| 3043 | stats_request.subtypes[65535] = experimenter_stats_request |
| 3044 | |
| 3045 | class bsn_stats_request(experimenter_stats_request): |
| 3046 | subtypes = {} |
| 3047 | |
| 3048 | version = 5 |
| 3049 | type = 18 |
| 3050 | stats_type = 65535 |
| 3051 | experimenter = 6035143 |
| 3052 | |
| 3053 | def __init__(self, xid=None, flags=None, subtype=None): |
| 3054 | if xid != None: |
| 3055 | self.xid = xid |
| 3056 | else: |
| 3057 | self.xid = None |
| 3058 | if flags != None: |
| 3059 | self.flags = flags |
| 3060 | else: |
| 3061 | self.flags = 0 |
| 3062 | if subtype != None: |
| 3063 | self.subtype = subtype |
| 3064 | else: |
| 3065 | self.subtype = 0 |
| 3066 | return |
| 3067 | |
| 3068 | def pack(self): |
| 3069 | packed = [] |
| 3070 | packed.append(struct.pack("!B", self.version)) |
| 3071 | packed.append(struct.pack("!B", self.type)) |
| 3072 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3073 | packed.append(struct.pack("!L", self.xid)) |
| 3074 | packed.append(struct.pack("!H", self.stats_type)) |
| 3075 | packed.append(struct.pack("!H", self.flags)) |
| 3076 | packed.append('\x00' * 4) |
| 3077 | packed.append(struct.pack("!L", self.experimenter)) |
| 3078 | packed.append(struct.pack("!L", self.subtype)) |
| 3079 | length = sum([len(x) for x in packed]) |
| 3080 | packed[2] = struct.pack("!H", length) |
| 3081 | return ''.join(packed) |
| 3082 | |
| 3083 | @staticmethod |
| 3084 | def unpack(reader): |
| 3085 | subtype, = reader.peek('!L', 20) |
| 3086 | subclass = bsn_stats_request.subtypes.get(subtype) |
| 3087 | if subclass: |
| 3088 | return subclass.unpack(reader) |
| 3089 | |
| 3090 | obj = bsn_stats_request() |
| 3091 | _version = reader.read("!B")[0] |
| 3092 | assert(_version == 5) |
| 3093 | _type = reader.read("!B")[0] |
| 3094 | assert(_type == 18) |
| 3095 | _length = reader.read("!H")[0] |
| 3096 | orig_reader = reader |
| 3097 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3098 | obj.xid = reader.read("!L")[0] |
| 3099 | _stats_type = reader.read("!H")[0] |
| 3100 | assert(_stats_type == 65535) |
| 3101 | obj.flags = reader.read("!H")[0] |
| 3102 | reader.skip(4) |
| 3103 | _experimenter = reader.read("!L")[0] |
| 3104 | assert(_experimenter == 6035143) |
| 3105 | obj.subtype = reader.read("!L")[0] |
| 3106 | return obj |
| 3107 | |
| 3108 | def __eq__(self, other): |
| 3109 | if type(self) != type(other): return False |
| 3110 | if self.xid != other.xid: return False |
| 3111 | if self.flags != other.flags: return False |
| 3112 | if self.subtype != other.subtype: return False |
| 3113 | return True |
| 3114 | |
| 3115 | def pretty_print(self, q): |
| 3116 | q.text("bsn_stats_request {") |
| 3117 | with q.group(): |
| 3118 | with q.indent(2): |
| 3119 | q.breakable() |
| 3120 | q.text("xid = "); |
| 3121 | if self.xid != None: |
| 3122 | q.text("%#x" % self.xid) |
| 3123 | else: |
| 3124 | q.text('None') |
| 3125 | q.text(","); q.breakable() |
| 3126 | q.text("flags = "); |
| 3127 | q.text("%#x" % self.flags) |
| 3128 | q.breakable() |
| 3129 | q.text('}') |
| 3130 | |
| 3131 | experimenter_stats_request.subtypes[6035143] = bsn_stats_request |
| 3132 | |
| 3133 | class bsn_virtual_port_create_reply(bsn_header): |
| 3134 | version = 5 |
| 3135 | type = 4 |
| 3136 | experimenter = 6035143 |
| 3137 | subtype = 16 |
| 3138 | |
| 3139 | def __init__(self, xid=None, status=None, vport_no=None): |
| 3140 | if xid != None: |
| 3141 | self.xid = xid |
| 3142 | else: |
| 3143 | self.xid = None |
| 3144 | if status != None: |
| 3145 | self.status = status |
| 3146 | else: |
| 3147 | self.status = 0 |
| 3148 | if vport_no != None: |
| 3149 | self.vport_no = vport_no |
| 3150 | else: |
| 3151 | self.vport_no = 0 |
| 3152 | return |
| 3153 | |
| 3154 | def pack(self): |
| 3155 | packed = [] |
| 3156 | packed.append(struct.pack("!B", self.version)) |
| 3157 | packed.append(struct.pack("!B", self.type)) |
| 3158 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3159 | packed.append(struct.pack("!L", self.xid)) |
| 3160 | packed.append(struct.pack("!L", self.experimenter)) |
| 3161 | packed.append(struct.pack("!L", self.subtype)) |
| 3162 | packed.append(struct.pack("!L", self.status)) |
| 3163 | packed.append(struct.pack("!L", self.vport_no)) |
| 3164 | length = sum([len(x) for x in packed]) |
| 3165 | packed[2] = struct.pack("!H", length) |
| 3166 | return ''.join(packed) |
| 3167 | |
| 3168 | @staticmethod |
| 3169 | def unpack(reader): |
| 3170 | obj = bsn_virtual_port_create_reply() |
| 3171 | _version = reader.read("!B")[0] |
| 3172 | assert(_version == 5) |
| 3173 | _type = reader.read("!B")[0] |
| 3174 | assert(_type == 4) |
| 3175 | _length = reader.read("!H")[0] |
| 3176 | orig_reader = reader |
| 3177 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3178 | obj.xid = reader.read("!L")[0] |
| 3179 | _experimenter = reader.read("!L")[0] |
| 3180 | assert(_experimenter == 6035143) |
| 3181 | _subtype = reader.read("!L")[0] |
| 3182 | assert(_subtype == 16) |
| 3183 | obj.status = reader.read("!L")[0] |
| 3184 | obj.vport_no = reader.read("!L")[0] |
| 3185 | return obj |
| 3186 | |
| 3187 | def __eq__(self, other): |
| 3188 | if type(self) != type(other): return False |
| 3189 | if self.xid != other.xid: return False |
| 3190 | if self.status != other.status: return False |
| 3191 | if self.vport_no != other.vport_no: return False |
| 3192 | return True |
| 3193 | |
| 3194 | def pretty_print(self, q): |
| 3195 | q.text("bsn_virtual_port_create_reply {") |
| 3196 | with q.group(): |
| 3197 | with q.indent(2): |
| 3198 | q.breakable() |
| 3199 | q.text("xid = "); |
| 3200 | if self.xid != None: |
| 3201 | q.text("%#x" % self.xid) |
| 3202 | else: |
| 3203 | q.text('None') |
| 3204 | q.text(","); q.breakable() |
| 3205 | q.text("status = "); |
| 3206 | q.text("%#x" % self.status) |
| 3207 | q.text(","); q.breakable() |
| 3208 | q.text("vport_no = "); |
| 3209 | q.text("%#x" % self.vport_no) |
| 3210 | q.breakable() |
| 3211 | q.text('}') |
| 3212 | |
| 3213 | bsn_header.subtypes[16] = bsn_virtual_port_create_reply |
| 3214 | |
| 3215 | class bsn_virtual_port_create_request(bsn_header): |
| 3216 | version = 5 |
| 3217 | type = 4 |
| 3218 | experimenter = 6035143 |
| 3219 | subtype = 15 |
| 3220 | |
| 3221 | def __init__(self, xid=None, vport=None): |
| 3222 | if xid != None: |
| 3223 | self.xid = xid |
| 3224 | else: |
| 3225 | self.xid = None |
| 3226 | if vport != None: |
| 3227 | self.vport = vport |
| 3228 | else: |
| 3229 | self.vport = common.bsn_vport() |
| 3230 | return |
| 3231 | |
| 3232 | def pack(self): |
| 3233 | packed = [] |
| 3234 | packed.append(struct.pack("!B", self.version)) |
| 3235 | packed.append(struct.pack("!B", self.type)) |
| 3236 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3237 | packed.append(struct.pack("!L", self.xid)) |
| 3238 | packed.append(struct.pack("!L", self.experimenter)) |
| 3239 | packed.append(struct.pack("!L", self.subtype)) |
| 3240 | packed.append(self.vport.pack()) |
| 3241 | length = sum([len(x) for x in packed]) |
| 3242 | packed[2] = struct.pack("!H", length) |
| 3243 | return ''.join(packed) |
| 3244 | |
| 3245 | @staticmethod |
| 3246 | def unpack(reader): |
| 3247 | obj = bsn_virtual_port_create_request() |
| 3248 | _version = reader.read("!B")[0] |
| 3249 | assert(_version == 5) |
| 3250 | _type = reader.read("!B")[0] |
| 3251 | assert(_type == 4) |
| 3252 | _length = reader.read("!H")[0] |
| 3253 | orig_reader = reader |
| 3254 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3255 | obj.xid = reader.read("!L")[0] |
| 3256 | _experimenter = reader.read("!L")[0] |
| 3257 | assert(_experimenter == 6035143) |
| 3258 | _subtype = reader.read("!L")[0] |
| 3259 | assert(_subtype == 15) |
| 3260 | obj.vport = common.bsn_vport.unpack(reader) |
| 3261 | return obj |
| 3262 | |
| 3263 | def __eq__(self, other): |
| 3264 | if type(self) != type(other): return False |
| 3265 | if self.xid != other.xid: return False |
| 3266 | if self.vport != other.vport: return False |
| 3267 | return True |
| 3268 | |
| 3269 | def pretty_print(self, q): |
| 3270 | q.text("bsn_virtual_port_create_request {") |
| 3271 | with q.group(): |
| 3272 | with q.indent(2): |
| 3273 | q.breakable() |
| 3274 | q.text("xid = "); |
| 3275 | if self.xid != None: |
| 3276 | q.text("%#x" % self.xid) |
| 3277 | else: |
| 3278 | q.text('None') |
| 3279 | q.text(","); q.breakable() |
| 3280 | q.text("vport = "); |
| 3281 | q.pp(self.vport) |
| 3282 | q.breakable() |
| 3283 | q.text('}') |
| 3284 | |
| 3285 | bsn_header.subtypes[15] = bsn_virtual_port_create_request |
| 3286 | |
| 3287 | class bsn_virtual_port_remove_reply(bsn_header): |
| 3288 | version = 5 |
| 3289 | type = 4 |
| 3290 | experimenter = 6035143 |
| 3291 | subtype = 26 |
| 3292 | |
| 3293 | def __init__(self, xid=None, status=None): |
| 3294 | if xid != None: |
| 3295 | self.xid = xid |
| 3296 | else: |
| 3297 | self.xid = None |
| 3298 | if status != None: |
| 3299 | self.status = status |
| 3300 | else: |
| 3301 | self.status = 0 |
| 3302 | return |
| 3303 | |
| 3304 | def pack(self): |
| 3305 | packed = [] |
| 3306 | packed.append(struct.pack("!B", self.version)) |
| 3307 | packed.append(struct.pack("!B", self.type)) |
| 3308 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3309 | packed.append(struct.pack("!L", self.xid)) |
| 3310 | packed.append(struct.pack("!L", self.experimenter)) |
| 3311 | packed.append(struct.pack("!L", self.subtype)) |
| 3312 | packed.append(struct.pack("!L", self.status)) |
| 3313 | length = sum([len(x) for x in packed]) |
| 3314 | packed[2] = struct.pack("!H", length) |
| 3315 | return ''.join(packed) |
| 3316 | |
| 3317 | @staticmethod |
| 3318 | def unpack(reader): |
| 3319 | obj = bsn_virtual_port_remove_reply() |
| 3320 | _version = reader.read("!B")[0] |
| 3321 | assert(_version == 5) |
| 3322 | _type = reader.read("!B")[0] |
| 3323 | assert(_type == 4) |
| 3324 | _length = reader.read("!H")[0] |
| 3325 | orig_reader = reader |
| 3326 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3327 | obj.xid = reader.read("!L")[0] |
| 3328 | _experimenter = reader.read("!L")[0] |
| 3329 | assert(_experimenter == 6035143) |
| 3330 | _subtype = reader.read("!L")[0] |
| 3331 | assert(_subtype == 26) |
| 3332 | obj.status = reader.read("!L")[0] |
| 3333 | return obj |
| 3334 | |
| 3335 | def __eq__(self, other): |
| 3336 | if type(self) != type(other): return False |
| 3337 | if self.xid != other.xid: return False |
| 3338 | if self.status != other.status: return False |
| 3339 | return True |
| 3340 | |
| 3341 | def pretty_print(self, q): |
| 3342 | q.text("bsn_virtual_port_remove_reply {") |
| 3343 | with q.group(): |
| 3344 | with q.indent(2): |
| 3345 | q.breakable() |
| 3346 | q.text("xid = "); |
| 3347 | if self.xid != None: |
| 3348 | q.text("%#x" % self.xid) |
| 3349 | else: |
| 3350 | q.text('None') |
| 3351 | q.text(","); q.breakable() |
| 3352 | q.text("status = "); |
| 3353 | q.text("%#x" % self.status) |
| 3354 | q.breakable() |
| 3355 | q.text('}') |
| 3356 | |
| 3357 | bsn_header.subtypes[26] = bsn_virtual_port_remove_reply |
| 3358 | |
| 3359 | class bsn_virtual_port_remove_request(bsn_header): |
| 3360 | version = 5 |
| 3361 | type = 4 |
| 3362 | experimenter = 6035143 |
| 3363 | subtype = 17 |
| 3364 | |
| 3365 | def __init__(self, xid=None, vport_no=None): |
| 3366 | if xid != None: |
| 3367 | self.xid = xid |
| 3368 | else: |
| 3369 | self.xid = None |
| 3370 | if vport_no != None: |
| 3371 | self.vport_no = vport_no |
| 3372 | else: |
| 3373 | self.vport_no = 0 |
| 3374 | return |
| 3375 | |
| 3376 | def pack(self): |
| 3377 | packed = [] |
| 3378 | packed.append(struct.pack("!B", self.version)) |
| 3379 | packed.append(struct.pack("!B", self.type)) |
| 3380 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3381 | packed.append(struct.pack("!L", self.xid)) |
| 3382 | packed.append(struct.pack("!L", self.experimenter)) |
| 3383 | packed.append(struct.pack("!L", self.subtype)) |
| 3384 | packed.append(struct.pack("!L", self.vport_no)) |
| 3385 | length = sum([len(x) for x in packed]) |
| 3386 | packed[2] = struct.pack("!H", length) |
| 3387 | return ''.join(packed) |
| 3388 | |
| 3389 | @staticmethod |
| 3390 | def unpack(reader): |
| 3391 | obj = bsn_virtual_port_remove_request() |
| 3392 | _version = reader.read("!B")[0] |
| 3393 | assert(_version == 5) |
| 3394 | _type = reader.read("!B")[0] |
| 3395 | assert(_type == 4) |
| 3396 | _length = reader.read("!H")[0] |
| 3397 | orig_reader = reader |
| 3398 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3399 | obj.xid = reader.read("!L")[0] |
| 3400 | _experimenter = reader.read("!L")[0] |
| 3401 | assert(_experimenter == 6035143) |
| 3402 | _subtype = reader.read("!L")[0] |
| 3403 | assert(_subtype == 17) |
| 3404 | obj.vport_no = reader.read("!L")[0] |
| 3405 | return obj |
| 3406 | |
| 3407 | def __eq__(self, other): |
| 3408 | if type(self) != type(other): return False |
| 3409 | if self.xid != other.xid: return False |
| 3410 | if self.vport_no != other.vport_no: return False |
| 3411 | return True |
| 3412 | |
| 3413 | def pretty_print(self, q): |
| 3414 | q.text("bsn_virtual_port_remove_request {") |
| 3415 | with q.group(): |
| 3416 | with q.indent(2): |
| 3417 | q.breakable() |
| 3418 | q.text("xid = "); |
| 3419 | if self.xid != None: |
| 3420 | q.text("%#x" % self.xid) |
| 3421 | else: |
| 3422 | q.text('None') |
| 3423 | q.text(","); q.breakable() |
| 3424 | q.text("vport_no = "); |
| 3425 | q.text("%#x" % self.vport_no) |
| 3426 | q.breakable() |
| 3427 | q.text('}') |
| 3428 | |
| 3429 | bsn_header.subtypes[17] = bsn_virtual_port_remove_request |
| 3430 | |
| 3431 | class bundle_add_msg(message): |
| 3432 | version = 5 |
| 3433 | type = 34 |
| 3434 | |
| 3435 | def __init__(self, xid=None, bundle_id=None, flags=None, data=None): |
| 3436 | if xid != None: |
| 3437 | self.xid = xid |
| 3438 | else: |
| 3439 | self.xid = None |
| 3440 | if bundle_id != None: |
| 3441 | self.bundle_id = bundle_id |
| 3442 | else: |
| 3443 | self.bundle_id = 0 |
| 3444 | if flags != None: |
| 3445 | self.flags = flags |
| 3446 | else: |
| 3447 | self.flags = 0 |
| 3448 | if data != None: |
| 3449 | self.data = data |
| 3450 | else: |
| 3451 | self.data = '' |
| 3452 | return |
| 3453 | |
| 3454 | def pack(self): |
| 3455 | packed = [] |
| 3456 | packed.append(struct.pack("!B", self.version)) |
| 3457 | packed.append(struct.pack("!B", self.type)) |
| 3458 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3459 | packed.append(struct.pack("!L", self.xid)) |
| 3460 | packed.append(struct.pack("!L", self.bundle_id)) |
| 3461 | packed.append('\x00' * 2) |
| 3462 | packed.append(struct.pack("!H", self.flags)) |
| 3463 | packed.append(self.data) |
| 3464 | length = sum([len(x) for x in packed]) |
| 3465 | packed[2] = struct.pack("!H", length) |
| 3466 | return ''.join(packed) |
| 3467 | |
| 3468 | @staticmethod |
| 3469 | def unpack(reader): |
| 3470 | obj = bundle_add_msg() |
| 3471 | _version = reader.read("!B")[0] |
| 3472 | assert(_version == 5) |
| 3473 | _type = reader.read("!B")[0] |
| 3474 | assert(_type == 34) |
| 3475 | _length = reader.read("!H")[0] |
| 3476 | orig_reader = reader |
| 3477 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3478 | obj.xid = reader.read("!L")[0] |
| 3479 | obj.bundle_id = reader.read("!L")[0] |
| 3480 | reader.skip(2) |
| 3481 | obj.flags = reader.read("!H")[0] |
| 3482 | obj.data = str(reader.read_all()) |
| 3483 | return obj |
| 3484 | |
| 3485 | def __eq__(self, other): |
| 3486 | if type(self) != type(other): return False |
| 3487 | if self.xid != other.xid: return False |
| 3488 | if self.bundle_id != other.bundle_id: return False |
| 3489 | if self.flags != other.flags: return False |
| 3490 | if self.data != other.data: return False |
| 3491 | return True |
| 3492 | |
| 3493 | def pretty_print(self, q): |
| 3494 | q.text("bundle_add_msg {") |
| 3495 | with q.group(): |
| 3496 | with q.indent(2): |
| 3497 | q.breakable() |
| 3498 | q.text("xid = "); |
| 3499 | if self.xid != None: |
| 3500 | q.text("%#x" % self.xid) |
| 3501 | else: |
| 3502 | q.text('None') |
| 3503 | q.text(","); q.breakable() |
| 3504 | q.text("bundle_id = "); |
| 3505 | q.text("%#x" % self.bundle_id) |
| 3506 | q.text(","); q.breakable() |
| 3507 | q.text("flags = "); |
| 3508 | q.text("%#x" % self.flags) |
| 3509 | q.text(","); q.breakable() |
| 3510 | q.text("data = "); |
| 3511 | q.pp(self.data) |
| 3512 | q.breakable() |
| 3513 | q.text('}') |
| 3514 | |
| 3515 | message.subtypes[34] = bundle_add_msg |
| 3516 | |
| 3517 | class bundle_ctrl_msg(message): |
| 3518 | version = 5 |
| 3519 | type = 33 |
| 3520 | |
| 3521 | def __init__(self, xid=None, bundle_id=None, bundle_ctrl_type=None, flags=None, properties=None): |
| 3522 | if xid != None: |
| 3523 | self.xid = xid |
| 3524 | else: |
| 3525 | self.xid = None |
| 3526 | if bundle_id != None: |
| 3527 | self.bundle_id = bundle_id |
| 3528 | else: |
| 3529 | self.bundle_id = 0 |
| 3530 | if bundle_ctrl_type != None: |
| 3531 | self.bundle_ctrl_type = bundle_ctrl_type |
| 3532 | else: |
| 3533 | self.bundle_ctrl_type = 0 |
| 3534 | if flags != None: |
| 3535 | self.flags = flags |
| 3536 | else: |
| 3537 | self.flags = 0 |
| 3538 | if properties != None: |
| 3539 | self.properties = properties |
| 3540 | else: |
| 3541 | self.properties = [] |
| 3542 | return |
| 3543 | |
| 3544 | def pack(self): |
| 3545 | packed = [] |
| 3546 | packed.append(struct.pack("!B", self.version)) |
| 3547 | packed.append(struct.pack("!B", self.type)) |
| 3548 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3549 | packed.append(struct.pack("!L", self.xid)) |
| 3550 | packed.append(struct.pack("!L", self.bundle_id)) |
| 3551 | packed.append(struct.pack("!H", self.bundle_ctrl_type)) |
| 3552 | packed.append(struct.pack("!H", self.flags)) |
| 3553 | packed.append(loxi.generic_util.pack_list(self.properties)) |
| 3554 | length = sum([len(x) for x in packed]) |
| 3555 | packed[2] = struct.pack("!H", length) |
| 3556 | return ''.join(packed) |
| 3557 | |
| 3558 | @staticmethod |
| 3559 | def unpack(reader): |
| 3560 | obj = bundle_ctrl_msg() |
| 3561 | _version = reader.read("!B")[0] |
| 3562 | assert(_version == 5) |
| 3563 | _type = reader.read("!B")[0] |
| 3564 | assert(_type == 33) |
| 3565 | _length = reader.read("!H")[0] |
| 3566 | orig_reader = reader |
| 3567 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3568 | obj.xid = reader.read("!L")[0] |
| 3569 | obj.bundle_id = reader.read("!L")[0] |
| 3570 | obj.bundle_ctrl_type = reader.read("!H")[0] |
| 3571 | obj.flags = reader.read("!H")[0] |
| 3572 | obj.properties = loxi.generic_util.unpack_list(reader, bundle_prop.bundle_prop.unpack) |
| 3573 | return obj |
| 3574 | |
| 3575 | def __eq__(self, other): |
| 3576 | if type(self) != type(other): return False |
| 3577 | if self.xid != other.xid: return False |
| 3578 | if self.bundle_id != other.bundle_id: return False |
| 3579 | if self.bundle_ctrl_type != other.bundle_ctrl_type: return False |
| 3580 | if self.flags != other.flags: return False |
| 3581 | if self.properties != other.properties: return False |
| 3582 | return True |
| 3583 | |
| 3584 | def pretty_print(self, q): |
| 3585 | q.text("bundle_ctrl_msg {") |
| 3586 | with q.group(): |
| 3587 | with q.indent(2): |
| 3588 | q.breakable() |
| 3589 | q.text("xid = "); |
| 3590 | if self.xid != None: |
| 3591 | q.text("%#x" % self.xid) |
| 3592 | else: |
| 3593 | q.text('None') |
| 3594 | q.text(","); q.breakable() |
| 3595 | q.text("bundle_id = "); |
| 3596 | q.text("%#x" % self.bundle_id) |
| 3597 | q.text(","); q.breakable() |
| 3598 | q.text("bundle_ctrl_type = "); |
| 3599 | q.text("%#x" % self.bundle_ctrl_type) |
| 3600 | q.text(","); q.breakable() |
| 3601 | q.text("flags = "); |
| 3602 | q.text("%#x" % self.flags) |
| 3603 | q.text(","); q.breakable() |
| 3604 | q.text("properties = "); |
| 3605 | q.pp(self.properties) |
| 3606 | q.breakable() |
| 3607 | q.text('}') |
| 3608 | |
| 3609 | message.subtypes[33] = bundle_ctrl_msg |
| 3610 | |
| 3611 | class desc_stats_reply(stats_reply): |
| 3612 | version = 5 |
| 3613 | type = 19 |
| 3614 | stats_type = 0 |
| 3615 | |
| 3616 | def __init__(self, xid=None, flags=None, mfr_desc=None, hw_desc=None, sw_desc=None, serial_num=None, dp_desc=None): |
| 3617 | if xid != None: |
| 3618 | self.xid = xid |
| 3619 | else: |
| 3620 | self.xid = None |
| 3621 | if flags != None: |
| 3622 | self.flags = flags |
| 3623 | else: |
| 3624 | self.flags = 0 |
| 3625 | if mfr_desc != None: |
| 3626 | self.mfr_desc = mfr_desc |
| 3627 | else: |
| 3628 | self.mfr_desc = "" |
| 3629 | if hw_desc != None: |
| 3630 | self.hw_desc = hw_desc |
| 3631 | else: |
| 3632 | self.hw_desc = "" |
| 3633 | if sw_desc != None: |
| 3634 | self.sw_desc = sw_desc |
| 3635 | else: |
| 3636 | self.sw_desc = "" |
| 3637 | if serial_num != None: |
| 3638 | self.serial_num = serial_num |
| 3639 | else: |
| 3640 | self.serial_num = "" |
| 3641 | if dp_desc != None: |
| 3642 | self.dp_desc = dp_desc |
| 3643 | else: |
| 3644 | self.dp_desc = "" |
| 3645 | return |
| 3646 | |
| 3647 | def pack(self): |
| 3648 | packed = [] |
| 3649 | packed.append(struct.pack("!B", self.version)) |
| 3650 | packed.append(struct.pack("!B", self.type)) |
| 3651 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3652 | packed.append(struct.pack("!L", self.xid)) |
| 3653 | packed.append(struct.pack("!H", self.stats_type)) |
| 3654 | packed.append(struct.pack("!H", self.flags)) |
| 3655 | packed.append('\x00' * 4) |
| 3656 | packed.append(struct.pack("!256s", self.mfr_desc)) |
| 3657 | packed.append(struct.pack("!256s", self.hw_desc)) |
| 3658 | packed.append(struct.pack("!256s", self.sw_desc)) |
| 3659 | packed.append(struct.pack("!32s", self.serial_num)) |
| 3660 | packed.append(struct.pack("!256s", self.dp_desc)) |
| 3661 | length = sum([len(x) for x in packed]) |
| 3662 | packed[2] = struct.pack("!H", length) |
| 3663 | return ''.join(packed) |
| 3664 | |
| 3665 | @staticmethod |
| 3666 | def unpack(reader): |
| 3667 | obj = desc_stats_reply() |
| 3668 | _version = reader.read("!B")[0] |
| 3669 | assert(_version == 5) |
| 3670 | _type = reader.read("!B")[0] |
| 3671 | assert(_type == 19) |
| 3672 | _length = reader.read("!H")[0] |
| 3673 | orig_reader = reader |
| 3674 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3675 | obj.xid = reader.read("!L")[0] |
| 3676 | _stats_type = reader.read("!H")[0] |
| 3677 | assert(_stats_type == 0) |
| 3678 | obj.flags = reader.read("!H")[0] |
| 3679 | reader.skip(4) |
| 3680 | obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00") |
| 3681 | obj.hw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 3682 | obj.sw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 3683 | obj.serial_num = reader.read("!32s")[0].rstrip("\x00") |
| 3684 | obj.dp_desc = reader.read("!256s")[0].rstrip("\x00") |
| 3685 | return obj |
| 3686 | |
| 3687 | def __eq__(self, other): |
| 3688 | if type(self) != type(other): return False |
| 3689 | if self.xid != other.xid: return False |
| 3690 | if self.flags != other.flags: return False |
| 3691 | if self.mfr_desc != other.mfr_desc: return False |
| 3692 | if self.hw_desc != other.hw_desc: return False |
| 3693 | if self.sw_desc != other.sw_desc: return False |
| 3694 | if self.serial_num != other.serial_num: return False |
| 3695 | if self.dp_desc != other.dp_desc: return False |
| 3696 | return True |
| 3697 | |
| 3698 | def pretty_print(self, q): |
| 3699 | q.text("desc_stats_reply {") |
| 3700 | with q.group(): |
| 3701 | with q.indent(2): |
| 3702 | q.breakable() |
| 3703 | q.text("xid = "); |
| 3704 | if self.xid != None: |
| 3705 | q.text("%#x" % self.xid) |
| 3706 | else: |
| 3707 | q.text('None') |
| 3708 | q.text(","); q.breakable() |
| 3709 | q.text("flags = "); |
| 3710 | q.text("%#x" % self.flags) |
| 3711 | q.text(","); q.breakable() |
| 3712 | q.text("mfr_desc = "); |
| 3713 | q.pp(self.mfr_desc) |
| 3714 | q.text(","); q.breakable() |
| 3715 | q.text("hw_desc = "); |
| 3716 | q.pp(self.hw_desc) |
| 3717 | q.text(","); q.breakable() |
| 3718 | q.text("sw_desc = "); |
| 3719 | q.pp(self.sw_desc) |
| 3720 | q.text(","); q.breakable() |
| 3721 | q.text("serial_num = "); |
| 3722 | q.pp(self.serial_num) |
| 3723 | q.text(","); q.breakable() |
| 3724 | q.text("dp_desc = "); |
| 3725 | q.pp(self.dp_desc) |
| 3726 | q.breakable() |
| 3727 | q.text('}') |
| 3728 | |
| 3729 | stats_reply.subtypes[0] = desc_stats_reply |
| 3730 | |
| 3731 | class desc_stats_request(stats_request): |
| 3732 | version = 5 |
| 3733 | type = 18 |
| 3734 | stats_type = 0 |
| 3735 | |
| 3736 | def __init__(self, xid=None, flags=None): |
| 3737 | if xid != None: |
| 3738 | self.xid = xid |
| 3739 | else: |
| 3740 | self.xid = None |
| 3741 | if flags != None: |
| 3742 | self.flags = flags |
| 3743 | else: |
| 3744 | self.flags = 0 |
| 3745 | return |
| 3746 | |
| 3747 | def pack(self): |
| 3748 | packed = [] |
| 3749 | packed.append(struct.pack("!B", self.version)) |
| 3750 | packed.append(struct.pack("!B", self.type)) |
| 3751 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3752 | packed.append(struct.pack("!L", self.xid)) |
| 3753 | packed.append(struct.pack("!H", self.stats_type)) |
| 3754 | packed.append(struct.pack("!H", self.flags)) |
| 3755 | packed.append('\x00' * 4) |
| 3756 | length = sum([len(x) for x in packed]) |
| 3757 | packed[2] = struct.pack("!H", length) |
| 3758 | return ''.join(packed) |
| 3759 | |
| 3760 | @staticmethod |
| 3761 | def unpack(reader): |
| 3762 | obj = desc_stats_request() |
| 3763 | _version = reader.read("!B")[0] |
| 3764 | assert(_version == 5) |
| 3765 | _type = reader.read("!B")[0] |
| 3766 | assert(_type == 18) |
| 3767 | _length = reader.read("!H")[0] |
| 3768 | orig_reader = reader |
| 3769 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3770 | obj.xid = reader.read("!L")[0] |
| 3771 | _stats_type = reader.read("!H")[0] |
| 3772 | assert(_stats_type == 0) |
| 3773 | obj.flags = reader.read("!H")[0] |
| 3774 | reader.skip(4) |
| 3775 | return obj |
| 3776 | |
| 3777 | def __eq__(self, other): |
| 3778 | if type(self) != type(other): return False |
| 3779 | if self.xid != other.xid: return False |
| 3780 | if self.flags != other.flags: return False |
| 3781 | return True |
| 3782 | |
| 3783 | def pretty_print(self, q): |
| 3784 | q.text("desc_stats_request {") |
| 3785 | with q.group(): |
| 3786 | with q.indent(2): |
| 3787 | q.breakable() |
| 3788 | q.text("xid = "); |
| 3789 | if self.xid != None: |
| 3790 | q.text("%#x" % self.xid) |
| 3791 | else: |
| 3792 | q.text('None') |
| 3793 | q.text(","); q.breakable() |
| 3794 | q.text("flags = "); |
| 3795 | q.text("%#x" % self.flags) |
| 3796 | q.breakable() |
| 3797 | q.text('}') |
| 3798 | |
| 3799 | stats_request.subtypes[0] = desc_stats_request |
| 3800 | |
| 3801 | class echo_reply(message): |
| 3802 | version = 5 |
| 3803 | type = 3 |
| 3804 | |
| 3805 | def __init__(self, xid=None, data=None): |
| 3806 | if xid != None: |
| 3807 | self.xid = xid |
| 3808 | else: |
| 3809 | self.xid = None |
| 3810 | if data != None: |
| 3811 | self.data = data |
| 3812 | else: |
| 3813 | self.data = '' |
| 3814 | return |
| 3815 | |
| 3816 | def pack(self): |
| 3817 | packed = [] |
| 3818 | packed.append(struct.pack("!B", self.version)) |
| 3819 | packed.append(struct.pack("!B", self.type)) |
| 3820 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3821 | packed.append(struct.pack("!L", self.xid)) |
| 3822 | packed.append(self.data) |
| 3823 | length = sum([len(x) for x in packed]) |
| 3824 | packed[2] = struct.pack("!H", length) |
| 3825 | return ''.join(packed) |
| 3826 | |
| 3827 | @staticmethod |
| 3828 | def unpack(reader): |
| 3829 | obj = echo_reply() |
| 3830 | _version = reader.read("!B")[0] |
| 3831 | assert(_version == 5) |
| 3832 | _type = reader.read("!B")[0] |
| 3833 | assert(_type == 3) |
| 3834 | _length = reader.read("!H")[0] |
| 3835 | orig_reader = reader |
| 3836 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3837 | obj.xid = reader.read("!L")[0] |
| 3838 | obj.data = str(reader.read_all()) |
| 3839 | return obj |
| 3840 | |
| 3841 | def __eq__(self, other): |
| 3842 | if type(self) != type(other): return False |
| 3843 | if self.xid != other.xid: return False |
| 3844 | if self.data != other.data: return False |
| 3845 | return True |
| 3846 | |
| 3847 | def pretty_print(self, q): |
| 3848 | q.text("echo_reply {") |
| 3849 | with q.group(): |
| 3850 | with q.indent(2): |
| 3851 | q.breakable() |
| 3852 | q.text("xid = "); |
| 3853 | if self.xid != None: |
| 3854 | q.text("%#x" % self.xid) |
| 3855 | else: |
| 3856 | q.text('None') |
| 3857 | q.text(","); q.breakable() |
| 3858 | q.text("data = "); |
| 3859 | q.pp(self.data) |
| 3860 | q.breakable() |
| 3861 | q.text('}') |
| 3862 | |
| 3863 | message.subtypes[3] = echo_reply |
| 3864 | |
| 3865 | class echo_request(message): |
| 3866 | version = 5 |
| 3867 | type = 2 |
| 3868 | |
| 3869 | def __init__(self, xid=None, data=None): |
| 3870 | if xid != None: |
| 3871 | self.xid = xid |
| 3872 | else: |
| 3873 | self.xid = None |
| 3874 | if data != None: |
| 3875 | self.data = data |
| 3876 | else: |
| 3877 | self.data = '' |
| 3878 | return |
| 3879 | |
| 3880 | def pack(self): |
| 3881 | packed = [] |
| 3882 | packed.append(struct.pack("!B", self.version)) |
| 3883 | packed.append(struct.pack("!B", self.type)) |
| 3884 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3885 | packed.append(struct.pack("!L", self.xid)) |
| 3886 | packed.append(self.data) |
| 3887 | length = sum([len(x) for x in packed]) |
| 3888 | packed[2] = struct.pack("!H", length) |
| 3889 | return ''.join(packed) |
| 3890 | |
| 3891 | @staticmethod |
| 3892 | def unpack(reader): |
| 3893 | obj = echo_request() |
| 3894 | _version = reader.read("!B")[0] |
| 3895 | assert(_version == 5) |
| 3896 | _type = reader.read("!B")[0] |
| 3897 | assert(_type == 2) |
| 3898 | _length = reader.read("!H")[0] |
| 3899 | orig_reader = reader |
| 3900 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3901 | obj.xid = reader.read("!L")[0] |
| 3902 | obj.data = str(reader.read_all()) |
| 3903 | return obj |
| 3904 | |
| 3905 | def __eq__(self, other): |
| 3906 | if type(self) != type(other): return False |
| 3907 | if self.xid != other.xid: return False |
| 3908 | if self.data != other.data: return False |
| 3909 | return True |
| 3910 | |
| 3911 | def pretty_print(self, q): |
| 3912 | q.text("echo_request {") |
| 3913 | with q.group(): |
| 3914 | with q.indent(2): |
| 3915 | q.breakable() |
| 3916 | q.text("xid = "); |
| 3917 | if self.xid != None: |
| 3918 | q.text("%#x" % self.xid) |
| 3919 | else: |
| 3920 | q.text('None') |
| 3921 | q.text(","); q.breakable() |
| 3922 | q.text("data = "); |
| 3923 | q.pp(self.data) |
| 3924 | q.breakable() |
| 3925 | q.text('}') |
| 3926 | |
| 3927 | message.subtypes[2] = echo_request |
| 3928 | |
| 3929 | class experimenter_error_msg(error_msg): |
| 3930 | version = 5 |
| 3931 | type = 1 |
| 3932 | err_type = 65535 |
| 3933 | |
| 3934 | def __init__(self, xid=None, subtype=None, experimenter=None, data=None): |
| 3935 | if xid != None: |
| 3936 | self.xid = xid |
| 3937 | else: |
| 3938 | self.xid = None |
| 3939 | if subtype != None: |
| 3940 | self.subtype = subtype |
| 3941 | else: |
| 3942 | self.subtype = 0 |
| 3943 | if experimenter != None: |
| 3944 | self.experimenter = experimenter |
| 3945 | else: |
| 3946 | self.experimenter = 0 |
| 3947 | if data != None: |
| 3948 | self.data = data |
| 3949 | else: |
| 3950 | self.data = '' |
| 3951 | return |
| 3952 | |
| 3953 | def pack(self): |
| 3954 | packed = [] |
| 3955 | packed.append(struct.pack("!B", self.version)) |
| 3956 | packed.append(struct.pack("!B", self.type)) |
| 3957 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3958 | packed.append(struct.pack("!L", self.xid)) |
| 3959 | packed.append(struct.pack("!H", self.err_type)) |
| 3960 | packed.append(struct.pack("!H", self.subtype)) |
| 3961 | packed.append(struct.pack("!L", self.experimenter)) |
| 3962 | packed.append(self.data) |
| 3963 | length = sum([len(x) for x in packed]) |
| 3964 | packed[2] = struct.pack("!H", length) |
| 3965 | return ''.join(packed) |
| 3966 | |
| 3967 | @staticmethod |
| 3968 | def unpack(reader): |
| 3969 | obj = experimenter_error_msg() |
| 3970 | _version = reader.read("!B")[0] |
| 3971 | assert(_version == 5) |
| 3972 | _type = reader.read("!B")[0] |
| 3973 | assert(_type == 1) |
| 3974 | _length = reader.read("!H")[0] |
| 3975 | orig_reader = reader |
| 3976 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3977 | obj.xid = reader.read("!L")[0] |
| 3978 | _err_type = reader.read("!H")[0] |
| 3979 | assert(_err_type == 65535) |
| 3980 | obj.subtype = reader.read("!H")[0] |
| 3981 | obj.experimenter = reader.read("!L")[0] |
| 3982 | obj.data = str(reader.read_all()) |
| 3983 | return obj |
| 3984 | |
| 3985 | def __eq__(self, other): |
| 3986 | if type(self) != type(other): return False |
| 3987 | if self.xid != other.xid: return False |
| 3988 | if self.subtype != other.subtype: return False |
| 3989 | if self.experimenter != other.experimenter: return False |
| 3990 | if self.data != other.data: return False |
| 3991 | return True |
| 3992 | |
| 3993 | def pretty_print(self, q): |
| 3994 | q.text("experimenter_error_msg {") |
| 3995 | with q.group(): |
| 3996 | with q.indent(2): |
| 3997 | q.breakable() |
| 3998 | q.text("xid = "); |
| 3999 | if self.xid != None: |
| 4000 | q.text("%#x" % self.xid) |
| 4001 | else: |
| 4002 | q.text('None') |
| 4003 | q.text(","); q.breakable() |
| 4004 | q.text("subtype = "); |
| 4005 | q.text("%#x" % self.subtype) |
| 4006 | q.text(","); q.breakable() |
| 4007 | q.text("experimenter = "); |
| 4008 | q.text("%#x" % self.experimenter) |
| 4009 | q.text(","); q.breakable() |
| 4010 | q.text("data = "); |
| 4011 | q.pp(self.data) |
| 4012 | q.breakable() |
| 4013 | q.text('}') |
| 4014 | |
| 4015 | error_msg.subtypes[65535] = experimenter_error_msg |
| 4016 | |
| 4017 | class features_reply(message): |
| 4018 | version = 5 |
| 4019 | type = 6 |
| 4020 | |
| 4021 | def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, auxiliary_id=None, capabilities=None, reserved=None): |
| 4022 | if xid != None: |
| 4023 | self.xid = xid |
| 4024 | else: |
| 4025 | self.xid = None |
| 4026 | if datapath_id != None: |
| 4027 | self.datapath_id = datapath_id |
| 4028 | else: |
| 4029 | self.datapath_id = 0 |
| 4030 | if n_buffers != None: |
| 4031 | self.n_buffers = n_buffers |
| 4032 | else: |
| 4033 | self.n_buffers = 0 |
| 4034 | if n_tables != None: |
| 4035 | self.n_tables = n_tables |
| 4036 | else: |
| 4037 | self.n_tables = 0 |
| 4038 | if auxiliary_id != None: |
| 4039 | self.auxiliary_id = auxiliary_id |
| 4040 | else: |
| 4041 | self.auxiliary_id = 0 |
| 4042 | if capabilities != None: |
| 4043 | self.capabilities = capabilities |
| 4044 | else: |
| 4045 | self.capabilities = 0 |
| 4046 | if reserved != None: |
| 4047 | self.reserved = reserved |
| 4048 | else: |
| 4049 | self.reserved = 0 |
| 4050 | return |
| 4051 | |
| 4052 | def pack(self): |
| 4053 | packed = [] |
| 4054 | packed.append(struct.pack("!B", self.version)) |
| 4055 | packed.append(struct.pack("!B", self.type)) |
| 4056 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4057 | packed.append(struct.pack("!L", self.xid)) |
| 4058 | packed.append(struct.pack("!Q", self.datapath_id)) |
| 4059 | packed.append(struct.pack("!L", self.n_buffers)) |
| 4060 | packed.append(struct.pack("!B", self.n_tables)) |
| 4061 | packed.append(struct.pack("!B", self.auxiliary_id)) |
| 4062 | packed.append('\x00' * 2) |
| 4063 | packed.append(struct.pack("!L", self.capabilities)) |
| 4064 | packed.append(struct.pack("!L", self.reserved)) |
| 4065 | length = sum([len(x) for x in packed]) |
| 4066 | packed[2] = struct.pack("!H", length) |
| 4067 | return ''.join(packed) |
| 4068 | |
| 4069 | @staticmethod |
| 4070 | def unpack(reader): |
| 4071 | obj = features_reply() |
| 4072 | _version = reader.read("!B")[0] |
| 4073 | assert(_version == 5) |
| 4074 | _type = reader.read("!B")[0] |
| 4075 | assert(_type == 6) |
| 4076 | _length = reader.read("!H")[0] |
| 4077 | orig_reader = reader |
| 4078 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4079 | obj.xid = reader.read("!L")[0] |
| 4080 | obj.datapath_id = reader.read("!Q")[0] |
| 4081 | obj.n_buffers = reader.read("!L")[0] |
| 4082 | obj.n_tables = reader.read("!B")[0] |
| 4083 | obj.auxiliary_id = reader.read("!B")[0] |
| 4084 | reader.skip(2) |
| 4085 | obj.capabilities = reader.read("!L")[0] |
| 4086 | obj.reserved = reader.read("!L")[0] |
| 4087 | return obj |
| 4088 | |
| 4089 | def __eq__(self, other): |
| 4090 | if type(self) != type(other): return False |
| 4091 | if self.xid != other.xid: return False |
| 4092 | if self.datapath_id != other.datapath_id: return False |
| 4093 | if self.n_buffers != other.n_buffers: return False |
| 4094 | if self.n_tables != other.n_tables: return False |
| 4095 | if self.auxiliary_id != other.auxiliary_id: return False |
| 4096 | if self.capabilities != other.capabilities: return False |
| 4097 | if self.reserved != other.reserved: return False |
| 4098 | return True |
| 4099 | |
| 4100 | def pretty_print(self, q): |
| 4101 | q.text("features_reply {") |
| 4102 | with q.group(): |
| 4103 | with q.indent(2): |
| 4104 | q.breakable() |
| 4105 | q.text("xid = "); |
| 4106 | if self.xid != None: |
| 4107 | q.text("%#x" % self.xid) |
| 4108 | else: |
| 4109 | q.text('None') |
| 4110 | q.text(","); q.breakable() |
| 4111 | q.text("datapath_id = "); |
| 4112 | q.text("%#x" % self.datapath_id) |
| 4113 | q.text(","); q.breakable() |
| 4114 | q.text("n_buffers = "); |
| 4115 | q.text("%#x" % self.n_buffers) |
| 4116 | q.text(","); q.breakable() |
| 4117 | q.text("n_tables = "); |
| 4118 | q.text("%#x" % self.n_tables) |
| 4119 | q.text(","); q.breakable() |
| 4120 | q.text("auxiliary_id = "); |
| 4121 | q.text("%#x" % self.auxiliary_id) |
| 4122 | q.text(","); q.breakable() |
| 4123 | q.text("capabilities = "); |
| 4124 | q.text("%#x" % self.capabilities) |
| 4125 | q.text(","); q.breakable() |
| 4126 | q.text("reserved = "); |
| 4127 | q.text("%#x" % self.reserved) |
| 4128 | q.breakable() |
| 4129 | q.text('}') |
| 4130 | |
| 4131 | message.subtypes[6] = features_reply |
| 4132 | |
| 4133 | class features_request(message): |
| 4134 | version = 5 |
| 4135 | type = 5 |
| 4136 | |
| 4137 | def __init__(self, xid=None): |
| 4138 | if xid != None: |
| 4139 | self.xid = xid |
| 4140 | else: |
| 4141 | self.xid = None |
| 4142 | return |
| 4143 | |
| 4144 | def pack(self): |
| 4145 | packed = [] |
| 4146 | packed.append(struct.pack("!B", self.version)) |
| 4147 | packed.append(struct.pack("!B", self.type)) |
| 4148 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4149 | packed.append(struct.pack("!L", self.xid)) |
| 4150 | length = sum([len(x) for x in packed]) |
| 4151 | packed[2] = struct.pack("!H", length) |
| 4152 | return ''.join(packed) |
| 4153 | |
| 4154 | @staticmethod |
| 4155 | def unpack(reader): |
| 4156 | obj = features_request() |
| 4157 | _version = reader.read("!B")[0] |
| 4158 | assert(_version == 5) |
| 4159 | _type = reader.read("!B")[0] |
| 4160 | assert(_type == 5) |
| 4161 | _length = reader.read("!H")[0] |
| 4162 | orig_reader = reader |
| 4163 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4164 | obj.xid = reader.read("!L")[0] |
| 4165 | return obj |
| 4166 | |
| 4167 | def __eq__(self, other): |
| 4168 | if type(self) != type(other): return False |
| 4169 | if self.xid != other.xid: return False |
| 4170 | return True |
| 4171 | |
| 4172 | def pretty_print(self, q): |
| 4173 | q.text("features_request {") |
| 4174 | with q.group(): |
| 4175 | with q.indent(2): |
| 4176 | q.breakable() |
| 4177 | q.text("xid = "); |
| 4178 | if self.xid != None: |
| 4179 | q.text("%#x" % self.xid) |
| 4180 | else: |
| 4181 | q.text('None') |
| 4182 | q.breakable() |
| 4183 | q.text('}') |
| 4184 | |
| 4185 | message.subtypes[5] = features_request |
| 4186 | |
| 4187 | class flow_mod(message): |
| 4188 | subtypes = {} |
| 4189 | |
| 4190 | version = 5 |
| 4191 | type = 14 |
| 4192 | |
| 4193 | def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, _command=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None): |
| 4194 | if xid != None: |
| 4195 | self.xid = xid |
| 4196 | else: |
| 4197 | self.xid = None |
| 4198 | if cookie != None: |
| 4199 | self.cookie = cookie |
| 4200 | else: |
| 4201 | self.cookie = 0 |
| 4202 | if cookie_mask != None: |
| 4203 | self.cookie_mask = cookie_mask |
| 4204 | else: |
| 4205 | self.cookie_mask = 0 |
| 4206 | if table_id != None: |
| 4207 | self.table_id = table_id |
| 4208 | else: |
| 4209 | self.table_id = 0 |
| 4210 | if _command != None: |
| 4211 | self._command = _command |
| 4212 | else: |
| 4213 | self._command = 0 |
| 4214 | if idle_timeout != None: |
| 4215 | self.idle_timeout = idle_timeout |
| 4216 | else: |
| 4217 | self.idle_timeout = 0 |
| 4218 | if hard_timeout != None: |
| 4219 | self.hard_timeout = hard_timeout |
| 4220 | else: |
| 4221 | self.hard_timeout = 0 |
| 4222 | if priority != None: |
| 4223 | self.priority = priority |
| 4224 | else: |
| 4225 | self.priority = 0 |
| 4226 | if buffer_id != None: |
| 4227 | self.buffer_id = buffer_id |
| 4228 | else: |
| 4229 | self.buffer_id = 0 |
| 4230 | if out_port != None: |
| 4231 | self.out_port = out_port |
| 4232 | else: |
| 4233 | self.out_port = 0 |
| 4234 | if out_group != None: |
| 4235 | self.out_group = out_group |
| 4236 | else: |
| 4237 | self.out_group = 0 |
| 4238 | if flags != None: |
| 4239 | self.flags = flags |
| 4240 | else: |
| 4241 | self.flags = 0 |
| 4242 | if match != None: |
| 4243 | self.match = match |
| 4244 | else: |
| 4245 | self.match = common.match() |
| 4246 | if instructions != None: |
| 4247 | self.instructions = instructions |
| 4248 | else: |
| 4249 | self.instructions = [] |
| 4250 | return |
| 4251 | |
| 4252 | def pack(self): |
| 4253 | packed = [] |
| 4254 | packed.append(struct.pack("!B", self.version)) |
| 4255 | packed.append(struct.pack("!B", self.type)) |
| 4256 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4257 | packed.append(struct.pack("!L", self.xid)) |
| 4258 | packed.append(struct.pack("!Q", self.cookie)) |
| 4259 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 4260 | packed.append(struct.pack("!B", self.table_id)) |
| 4261 | packed.append(util.pack_fm_cmd(self._command)) |
| 4262 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 4263 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 4264 | packed.append(struct.pack("!H", self.priority)) |
| 4265 | packed.append(struct.pack("!L", self.buffer_id)) |
| 4266 | packed.append(util.pack_port_no(self.out_port)) |
| 4267 | packed.append(struct.pack("!L", self.out_group)) |
| 4268 | packed.append(struct.pack("!H", self.flags)) |
| 4269 | packed.append('\x00' * 2) |
| 4270 | packed.append(self.match.pack()) |
| 4271 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
| 4272 | length = sum([len(x) for x in packed]) |
| 4273 | packed[2] = struct.pack("!H", length) |
| 4274 | return ''.join(packed) |
| 4275 | |
| 4276 | @staticmethod |
| 4277 | def unpack(reader): |
| 4278 | subtype, = reader.peek('B', 25) |
| 4279 | subclass = flow_mod.subtypes.get(subtype) |
| 4280 | if subclass: |
| 4281 | return subclass.unpack(reader) |
| 4282 | |
| 4283 | obj = flow_mod() |
| 4284 | _version = reader.read("!B")[0] |
| 4285 | assert(_version == 5) |
| 4286 | _type = reader.read("!B")[0] |
| 4287 | assert(_type == 14) |
| 4288 | _length = reader.read("!H")[0] |
| 4289 | orig_reader = reader |
| 4290 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4291 | obj.xid = reader.read("!L")[0] |
| 4292 | obj.cookie = reader.read("!Q")[0] |
| 4293 | obj.cookie_mask = reader.read("!Q")[0] |
| 4294 | obj.table_id = reader.read("!B")[0] |
| 4295 | obj._command = util.unpack_fm_cmd(reader) |
| 4296 | obj.idle_timeout = reader.read("!H")[0] |
| 4297 | obj.hard_timeout = reader.read("!H")[0] |
| 4298 | obj.priority = reader.read("!H")[0] |
| 4299 | obj.buffer_id = reader.read("!L")[0] |
| 4300 | obj.out_port = util.unpack_port_no(reader) |
| 4301 | obj.out_group = reader.read("!L")[0] |
| 4302 | obj.flags = reader.read("!H")[0] |
| 4303 | reader.skip(2) |
| 4304 | obj.match = common.match.unpack(reader) |
| 4305 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
| 4306 | return obj |
| 4307 | |
| 4308 | def __eq__(self, other): |
| 4309 | if type(self) != type(other): return False |
| 4310 | if self.xid != other.xid: return False |
| 4311 | if self.cookie != other.cookie: return False |
| 4312 | if self.cookie_mask != other.cookie_mask: return False |
| 4313 | if self.table_id != other.table_id: return False |
| 4314 | if self._command != other._command: return False |
| 4315 | if self.idle_timeout != other.idle_timeout: return False |
| 4316 | if self.hard_timeout != other.hard_timeout: return False |
| 4317 | if self.priority != other.priority: return False |
| 4318 | if self.buffer_id != other.buffer_id: return False |
| 4319 | if self.out_port != other.out_port: return False |
| 4320 | if self.out_group != other.out_group: return False |
| 4321 | if self.flags != other.flags: return False |
| 4322 | if self.match != other.match: return False |
| 4323 | if self.instructions != other.instructions: return False |
| 4324 | return True |
| 4325 | |
| 4326 | def pretty_print(self, q): |
| 4327 | q.text("flow_mod {") |
| 4328 | with q.group(): |
| 4329 | with q.indent(2): |
| 4330 | q.breakable() |
| 4331 | q.text("xid = "); |
| 4332 | if self.xid != None: |
| 4333 | q.text("%#x" % self.xid) |
| 4334 | else: |
| 4335 | q.text('None') |
| 4336 | q.text(","); q.breakable() |
| 4337 | q.text("cookie = "); |
| 4338 | q.text("%#x" % self.cookie) |
| 4339 | q.text(","); q.breakable() |
| 4340 | q.text("cookie_mask = "); |
| 4341 | q.text("%#x" % self.cookie_mask) |
| 4342 | q.text(","); q.breakable() |
| 4343 | q.text("table_id = "); |
| 4344 | q.text("%#x" % self.table_id) |
| 4345 | q.text(","); q.breakable() |
| 4346 | q.text("idle_timeout = "); |
| 4347 | q.text("%#x" % self.idle_timeout) |
| 4348 | q.text(","); q.breakable() |
| 4349 | q.text("hard_timeout = "); |
| 4350 | q.text("%#x" % self.hard_timeout) |
| 4351 | q.text(","); q.breakable() |
| 4352 | q.text("priority = "); |
| 4353 | q.text("%#x" % self.priority) |
| 4354 | q.text(","); q.breakable() |
| 4355 | q.text("buffer_id = "); |
| 4356 | q.text("%#x" % self.buffer_id) |
| 4357 | q.text(","); q.breakable() |
| 4358 | q.text("out_port = "); |
| 4359 | q.text(util.pretty_port(self.out_port)) |
| 4360 | q.text(","); q.breakable() |
| 4361 | q.text("out_group = "); |
| 4362 | q.text("%#x" % self.out_group) |
| 4363 | q.text(","); q.breakable() |
| 4364 | q.text("flags = "); |
| 4365 | q.text("%#x" % self.flags) |
| 4366 | q.text(","); q.breakable() |
| 4367 | q.text("match = "); |
| 4368 | q.pp(self.match) |
| 4369 | q.text(","); q.breakable() |
| 4370 | q.text("instructions = "); |
| 4371 | q.pp(self.instructions) |
| 4372 | q.breakable() |
| 4373 | q.text('}') |
| 4374 | |
| 4375 | message.subtypes[14] = flow_mod |
| 4376 | |
| 4377 | class flow_add(flow_mod): |
| 4378 | version = 5 |
| 4379 | type = 14 |
| 4380 | _command = 0 |
| 4381 | |
| 4382 | 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, importance=None, match=None, instructions=None): |
| 4383 | if xid != None: |
| 4384 | self.xid = xid |
| 4385 | else: |
| 4386 | self.xid = None |
| 4387 | if cookie != None: |
| 4388 | self.cookie = cookie |
| 4389 | else: |
| 4390 | self.cookie = 0 |
| 4391 | if cookie_mask != None: |
| 4392 | self.cookie_mask = cookie_mask |
| 4393 | else: |
| 4394 | self.cookie_mask = 0 |
| 4395 | if table_id != None: |
| 4396 | self.table_id = table_id |
| 4397 | else: |
| 4398 | self.table_id = 0 |
| 4399 | if idle_timeout != None: |
| 4400 | self.idle_timeout = idle_timeout |
| 4401 | else: |
| 4402 | self.idle_timeout = 0 |
| 4403 | if hard_timeout != None: |
| 4404 | self.hard_timeout = hard_timeout |
| 4405 | else: |
| 4406 | self.hard_timeout = 0 |
| 4407 | if priority != None: |
| 4408 | self.priority = priority |
| 4409 | else: |
| 4410 | self.priority = 0 |
| 4411 | if buffer_id != None: |
| 4412 | self.buffer_id = buffer_id |
| 4413 | else: |
| 4414 | self.buffer_id = 0 |
| 4415 | if out_port != None: |
| 4416 | self.out_port = out_port |
| 4417 | else: |
| 4418 | self.out_port = 0 |
| 4419 | if out_group != None: |
| 4420 | self.out_group = out_group |
| 4421 | else: |
| 4422 | self.out_group = 0 |
| 4423 | if flags != None: |
| 4424 | self.flags = flags |
| 4425 | else: |
| 4426 | self.flags = 0 |
| 4427 | if importance != None: |
| 4428 | self.importance = importance |
| 4429 | else: |
| 4430 | self.importance = 0 |
| 4431 | if match != None: |
| 4432 | self.match = match |
| 4433 | else: |
| 4434 | self.match = common.match() |
| 4435 | if instructions != None: |
| 4436 | self.instructions = instructions |
| 4437 | else: |
| 4438 | self.instructions = [] |
| 4439 | return |
| 4440 | |
| 4441 | def pack(self): |
| 4442 | packed = [] |
| 4443 | packed.append(struct.pack("!B", self.version)) |
| 4444 | packed.append(struct.pack("!B", self.type)) |
| 4445 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4446 | packed.append(struct.pack("!L", self.xid)) |
| 4447 | packed.append(struct.pack("!Q", self.cookie)) |
| 4448 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 4449 | packed.append(struct.pack("!B", self.table_id)) |
| 4450 | packed.append(util.pack_fm_cmd(self._command)) |
| 4451 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 4452 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 4453 | packed.append(struct.pack("!H", self.priority)) |
| 4454 | packed.append(struct.pack("!L", self.buffer_id)) |
| 4455 | packed.append(util.pack_port_no(self.out_port)) |
| 4456 | packed.append(struct.pack("!L", self.out_group)) |
| 4457 | packed.append(struct.pack("!H", self.flags)) |
| 4458 | packed.append(struct.pack("!H", self.importance)) |
| 4459 | packed.append(self.match.pack()) |
| 4460 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
| 4461 | length = sum([len(x) for x in packed]) |
| 4462 | packed[2] = struct.pack("!H", length) |
| 4463 | return ''.join(packed) |
| 4464 | |
| 4465 | @staticmethod |
| 4466 | def unpack(reader): |
| 4467 | obj = flow_add() |
| 4468 | _version = reader.read("!B")[0] |
| 4469 | assert(_version == 5) |
| 4470 | _type = reader.read("!B")[0] |
| 4471 | assert(_type == 14) |
| 4472 | _length = reader.read("!H")[0] |
| 4473 | orig_reader = reader |
| 4474 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4475 | obj.xid = reader.read("!L")[0] |
| 4476 | obj.cookie = reader.read("!Q")[0] |
| 4477 | obj.cookie_mask = reader.read("!Q")[0] |
| 4478 | obj.table_id = reader.read("!B")[0] |
| 4479 | __command = util.unpack_fm_cmd(reader) |
| 4480 | assert(__command == 0) |
| 4481 | obj.idle_timeout = reader.read("!H")[0] |
| 4482 | obj.hard_timeout = reader.read("!H")[0] |
| 4483 | obj.priority = reader.read("!H")[0] |
| 4484 | obj.buffer_id = reader.read("!L")[0] |
| 4485 | obj.out_port = util.unpack_port_no(reader) |
| 4486 | obj.out_group = reader.read("!L")[0] |
| 4487 | obj.flags = reader.read("!H")[0] |
| 4488 | obj.importance = reader.read("!H")[0] |
| 4489 | obj.match = common.match.unpack(reader) |
| 4490 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
| 4491 | return obj |
| 4492 | |
| 4493 | def __eq__(self, other): |
| 4494 | if type(self) != type(other): return False |
| 4495 | if self.xid != other.xid: return False |
| 4496 | if self.cookie != other.cookie: return False |
| 4497 | if self.cookie_mask != other.cookie_mask: return False |
| 4498 | if self.table_id != other.table_id: return False |
| 4499 | if self.idle_timeout != other.idle_timeout: return False |
| 4500 | if self.hard_timeout != other.hard_timeout: return False |
| 4501 | if self.priority != other.priority: return False |
| 4502 | if self.buffer_id != other.buffer_id: return False |
| 4503 | if self.out_port != other.out_port: return False |
| 4504 | if self.out_group != other.out_group: return False |
| 4505 | if self.flags != other.flags: return False |
| 4506 | if self.importance != other.importance: return False |
| 4507 | if self.match != other.match: return False |
| 4508 | if self.instructions != other.instructions: return False |
| 4509 | return True |
| 4510 | |
| 4511 | def pretty_print(self, q): |
| 4512 | q.text("flow_add {") |
| 4513 | with q.group(): |
| 4514 | with q.indent(2): |
| 4515 | q.breakable() |
| 4516 | q.text("xid = "); |
| 4517 | if self.xid != None: |
| 4518 | q.text("%#x" % self.xid) |
| 4519 | else: |
| 4520 | q.text('None') |
| 4521 | q.text(","); q.breakable() |
| 4522 | q.text("cookie = "); |
| 4523 | q.text("%#x" % self.cookie) |
| 4524 | q.text(","); q.breakable() |
| 4525 | q.text("cookie_mask = "); |
| 4526 | q.text("%#x" % self.cookie_mask) |
| 4527 | q.text(","); q.breakable() |
| 4528 | q.text("table_id = "); |
| 4529 | q.text("%#x" % self.table_id) |
| 4530 | q.text(","); q.breakable() |
| 4531 | q.text("idle_timeout = "); |
| 4532 | q.text("%#x" % self.idle_timeout) |
| 4533 | q.text(","); q.breakable() |
| 4534 | q.text("hard_timeout = "); |
| 4535 | q.text("%#x" % self.hard_timeout) |
| 4536 | q.text(","); q.breakable() |
| 4537 | q.text("priority = "); |
| 4538 | q.text("%#x" % self.priority) |
| 4539 | q.text(","); q.breakable() |
| 4540 | q.text("buffer_id = "); |
| 4541 | q.text("%#x" % self.buffer_id) |
| 4542 | q.text(","); q.breakable() |
| 4543 | q.text("out_port = "); |
| 4544 | q.text(util.pretty_port(self.out_port)) |
| 4545 | q.text(","); q.breakable() |
| 4546 | q.text("out_group = "); |
| 4547 | q.text("%#x" % self.out_group) |
| 4548 | q.text(","); q.breakable() |
| 4549 | q.text("flags = "); |
| 4550 | q.text("%#x" % self.flags) |
| 4551 | q.text(","); q.breakable() |
| 4552 | q.text("importance = "); |
| 4553 | q.text("%#x" % self.importance) |
| 4554 | q.text(","); q.breakable() |
| 4555 | q.text("match = "); |
| 4556 | q.pp(self.match) |
| 4557 | q.text(","); q.breakable() |
| 4558 | q.text("instructions = "); |
| 4559 | q.pp(self.instructions) |
| 4560 | q.breakable() |
| 4561 | q.text('}') |
| 4562 | |
| 4563 | flow_mod.subtypes[0] = flow_add |
| 4564 | |
| 4565 | class flow_delete(flow_mod): |
| 4566 | version = 5 |
| 4567 | type = 14 |
| 4568 | _command = 3 |
| 4569 | |
| 4570 | 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, importance=None, match=None, instructions=None): |
| 4571 | if xid != None: |
| 4572 | self.xid = xid |
| 4573 | else: |
| 4574 | self.xid = None |
| 4575 | if cookie != None: |
| 4576 | self.cookie = cookie |
| 4577 | else: |
| 4578 | self.cookie = 0 |
| 4579 | if cookie_mask != None: |
| 4580 | self.cookie_mask = cookie_mask |
| 4581 | else: |
| 4582 | self.cookie_mask = 0 |
| 4583 | if table_id != None: |
| 4584 | self.table_id = table_id |
| 4585 | else: |
| 4586 | self.table_id = 0 |
| 4587 | if idle_timeout != None: |
| 4588 | self.idle_timeout = idle_timeout |
| 4589 | else: |
| 4590 | self.idle_timeout = 0 |
| 4591 | if hard_timeout != None: |
| 4592 | self.hard_timeout = hard_timeout |
| 4593 | else: |
| 4594 | self.hard_timeout = 0 |
| 4595 | if priority != None: |
| 4596 | self.priority = priority |
| 4597 | else: |
| 4598 | self.priority = 0 |
| 4599 | if buffer_id != None: |
| 4600 | self.buffer_id = buffer_id |
| 4601 | else: |
| 4602 | self.buffer_id = 0 |
| 4603 | if out_port != None: |
| 4604 | self.out_port = out_port |
| 4605 | else: |
| 4606 | self.out_port = 0 |
| 4607 | if out_group != None: |
| 4608 | self.out_group = out_group |
| 4609 | else: |
| 4610 | self.out_group = 0 |
| 4611 | if flags != None: |
| 4612 | self.flags = flags |
| 4613 | else: |
| 4614 | self.flags = 0 |
| 4615 | if importance != None: |
| 4616 | self.importance = importance |
| 4617 | else: |
| 4618 | self.importance = 0 |
| 4619 | if match != None: |
| 4620 | self.match = match |
| 4621 | else: |
| 4622 | self.match = common.match() |
| 4623 | if instructions != None: |
| 4624 | self.instructions = instructions |
| 4625 | else: |
| 4626 | self.instructions = [] |
| 4627 | return |
| 4628 | |
| 4629 | def pack(self): |
| 4630 | packed = [] |
| 4631 | packed.append(struct.pack("!B", self.version)) |
| 4632 | packed.append(struct.pack("!B", self.type)) |
| 4633 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4634 | packed.append(struct.pack("!L", self.xid)) |
| 4635 | packed.append(struct.pack("!Q", self.cookie)) |
| 4636 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 4637 | packed.append(struct.pack("!B", self.table_id)) |
| 4638 | packed.append(util.pack_fm_cmd(self._command)) |
| 4639 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 4640 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 4641 | packed.append(struct.pack("!H", self.priority)) |
| 4642 | packed.append(struct.pack("!L", self.buffer_id)) |
| 4643 | packed.append(util.pack_port_no(self.out_port)) |
| 4644 | packed.append(struct.pack("!L", self.out_group)) |
| 4645 | packed.append(struct.pack("!H", self.flags)) |
| 4646 | packed.append(struct.pack("!H", self.importance)) |
| 4647 | packed.append(self.match.pack()) |
| 4648 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
| 4649 | length = sum([len(x) for x in packed]) |
| 4650 | packed[2] = struct.pack("!H", length) |
| 4651 | return ''.join(packed) |
| 4652 | |
| 4653 | @staticmethod |
| 4654 | def unpack(reader): |
| 4655 | obj = flow_delete() |
| 4656 | _version = reader.read("!B")[0] |
| 4657 | assert(_version == 5) |
| 4658 | _type = reader.read("!B")[0] |
| 4659 | assert(_type == 14) |
| 4660 | _length = reader.read("!H")[0] |
| 4661 | orig_reader = reader |
| 4662 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4663 | obj.xid = reader.read("!L")[0] |
| 4664 | obj.cookie = reader.read("!Q")[0] |
| 4665 | obj.cookie_mask = reader.read("!Q")[0] |
| 4666 | obj.table_id = reader.read("!B")[0] |
| 4667 | __command = util.unpack_fm_cmd(reader) |
| 4668 | assert(__command == 3) |
| 4669 | obj.idle_timeout = reader.read("!H")[0] |
| 4670 | obj.hard_timeout = reader.read("!H")[0] |
| 4671 | obj.priority = reader.read("!H")[0] |
| 4672 | obj.buffer_id = reader.read("!L")[0] |
| 4673 | obj.out_port = util.unpack_port_no(reader) |
| 4674 | obj.out_group = reader.read("!L")[0] |
| 4675 | obj.flags = reader.read("!H")[0] |
| 4676 | obj.importance = reader.read("!H")[0] |
| 4677 | obj.match = common.match.unpack(reader) |
| 4678 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
| 4679 | return obj |
| 4680 | |
| 4681 | def __eq__(self, other): |
| 4682 | if type(self) != type(other): return False |
| 4683 | if self.xid != other.xid: return False |
| 4684 | if self.cookie != other.cookie: return False |
| 4685 | if self.cookie_mask != other.cookie_mask: return False |
| 4686 | if self.table_id != other.table_id: return False |
| 4687 | if self.idle_timeout != other.idle_timeout: return False |
| 4688 | if self.hard_timeout != other.hard_timeout: return False |
| 4689 | if self.priority != other.priority: return False |
| 4690 | if self.buffer_id != other.buffer_id: return False |
| 4691 | if self.out_port != other.out_port: return False |
| 4692 | if self.out_group != other.out_group: return False |
| 4693 | if self.flags != other.flags: return False |
| 4694 | if self.importance != other.importance: return False |
| 4695 | if self.match != other.match: return False |
| 4696 | if self.instructions != other.instructions: return False |
| 4697 | return True |
| 4698 | |
| 4699 | def pretty_print(self, q): |
| 4700 | q.text("flow_delete {") |
| 4701 | with q.group(): |
| 4702 | with q.indent(2): |
| 4703 | q.breakable() |
| 4704 | q.text("xid = "); |
| 4705 | if self.xid != None: |
| 4706 | q.text("%#x" % self.xid) |
| 4707 | else: |
| 4708 | q.text('None') |
| 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("table_id = "); |
| 4717 | q.text("%#x" % self.table_id) |
| 4718 | q.text(","); q.breakable() |
| 4719 | q.text("idle_timeout = "); |
| 4720 | q.text("%#x" % self.idle_timeout) |
| 4721 | q.text(","); q.breakable() |
| 4722 | q.text("hard_timeout = "); |
| 4723 | q.text("%#x" % self.hard_timeout) |
| 4724 | q.text(","); q.breakable() |
| 4725 | q.text("priority = "); |
| 4726 | q.text("%#x" % self.priority) |
| 4727 | q.text(","); q.breakable() |
| 4728 | q.text("buffer_id = "); |
| 4729 | q.text("%#x" % self.buffer_id) |
| 4730 | q.text(","); q.breakable() |
| 4731 | q.text("out_port = "); |
| 4732 | q.text(util.pretty_port(self.out_port)) |
| 4733 | q.text(","); q.breakable() |
| 4734 | q.text("out_group = "); |
| 4735 | q.text("%#x" % self.out_group) |
| 4736 | q.text(","); q.breakable() |
| 4737 | q.text("flags = "); |
| 4738 | q.text("%#x" % self.flags) |
| 4739 | q.text(","); q.breakable() |
| 4740 | q.text("importance = "); |
| 4741 | q.text("%#x" % self.importance) |
| 4742 | q.text(","); q.breakable() |
| 4743 | q.text("match = "); |
| 4744 | q.pp(self.match) |
| 4745 | q.text(","); q.breakable() |
| 4746 | q.text("instructions = "); |
| 4747 | q.pp(self.instructions) |
| 4748 | q.breakable() |
| 4749 | q.text('}') |
| 4750 | |
| 4751 | flow_mod.subtypes[3] = flow_delete |
| 4752 | |
| 4753 | class flow_delete_strict(flow_mod): |
| 4754 | version = 5 |
| 4755 | type = 14 |
| 4756 | _command = 4 |
| 4757 | |
| 4758 | 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, importance=None, match=None, instructions=None): |
| 4759 | if xid != None: |
| 4760 | self.xid = xid |
| 4761 | else: |
| 4762 | self.xid = None |
| 4763 | if cookie != None: |
| 4764 | self.cookie = cookie |
| 4765 | else: |
| 4766 | self.cookie = 0 |
| 4767 | if cookie_mask != None: |
| 4768 | self.cookie_mask = cookie_mask |
| 4769 | else: |
| 4770 | self.cookie_mask = 0 |
| 4771 | if table_id != None: |
| 4772 | self.table_id = table_id |
| 4773 | else: |
| 4774 | self.table_id = 0 |
| 4775 | if idle_timeout != None: |
| 4776 | self.idle_timeout = idle_timeout |
| 4777 | else: |
| 4778 | self.idle_timeout = 0 |
| 4779 | if hard_timeout != None: |
| 4780 | self.hard_timeout = hard_timeout |
| 4781 | else: |
| 4782 | self.hard_timeout = 0 |
| 4783 | if priority != None: |
| 4784 | self.priority = priority |
| 4785 | else: |
| 4786 | self.priority = 0 |
| 4787 | if buffer_id != None: |
| 4788 | self.buffer_id = buffer_id |
| 4789 | else: |
| 4790 | self.buffer_id = 0 |
| 4791 | if out_port != None: |
| 4792 | self.out_port = out_port |
| 4793 | else: |
| 4794 | self.out_port = 0 |
| 4795 | if out_group != None: |
| 4796 | self.out_group = out_group |
| 4797 | else: |
| 4798 | self.out_group = 0 |
| 4799 | if flags != None: |
| 4800 | self.flags = flags |
| 4801 | else: |
| 4802 | self.flags = 0 |
| 4803 | if importance != None: |
| 4804 | self.importance = importance |
| 4805 | else: |
| 4806 | self.importance = 0 |
| 4807 | if match != None: |
| 4808 | self.match = match |
| 4809 | else: |
| 4810 | self.match = common.match() |
| 4811 | if instructions != None: |
| 4812 | self.instructions = instructions |
| 4813 | else: |
| 4814 | self.instructions = [] |
| 4815 | return |
| 4816 | |
| 4817 | def pack(self): |
| 4818 | packed = [] |
| 4819 | packed.append(struct.pack("!B", self.version)) |
| 4820 | packed.append(struct.pack("!B", self.type)) |
| 4821 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4822 | packed.append(struct.pack("!L", self.xid)) |
| 4823 | packed.append(struct.pack("!Q", self.cookie)) |
| 4824 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 4825 | packed.append(struct.pack("!B", self.table_id)) |
| 4826 | packed.append(util.pack_fm_cmd(self._command)) |
| 4827 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 4828 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 4829 | packed.append(struct.pack("!H", self.priority)) |
| 4830 | packed.append(struct.pack("!L", self.buffer_id)) |
| 4831 | packed.append(util.pack_port_no(self.out_port)) |
| 4832 | packed.append(struct.pack("!L", self.out_group)) |
| 4833 | packed.append(struct.pack("!H", self.flags)) |
| 4834 | packed.append(struct.pack("!H", self.importance)) |
| 4835 | packed.append(self.match.pack()) |
| 4836 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
| 4837 | length = sum([len(x) for x in packed]) |
| 4838 | packed[2] = struct.pack("!H", length) |
| 4839 | return ''.join(packed) |
| 4840 | |
| 4841 | @staticmethod |
| 4842 | def unpack(reader): |
| 4843 | obj = flow_delete_strict() |
| 4844 | _version = reader.read("!B")[0] |
| 4845 | assert(_version == 5) |
| 4846 | _type = reader.read("!B")[0] |
| 4847 | assert(_type == 14) |
| 4848 | _length = reader.read("!H")[0] |
| 4849 | orig_reader = reader |
| 4850 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4851 | obj.xid = reader.read("!L")[0] |
| 4852 | obj.cookie = reader.read("!Q")[0] |
| 4853 | obj.cookie_mask = reader.read("!Q")[0] |
| 4854 | obj.table_id = reader.read("!B")[0] |
| 4855 | __command = util.unpack_fm_cmd(reader) |
| 4856 | assert(__command == 4) |
| 4857 | obj.idle_timeout = reader.read("!H")[0] |
| 4858 | obj.hard_timeout = reader.read("!H")[0] |
| 4859 | obj.priority = reader.read("!H")[0] |
| 4860 | obj.buffer_id = reader.read("!L")[0] |
| 4861 | obj.out_port = util.unpack_port_no(reader) |
| 4862 | obj.out_group = reader.read("!L")[0] |
| 4863 | obj.flags = reader.read("!H")[0] |
| 4864 | obj.importance = reader.read("!H")[0] |
| 4865 | obj.match = common.match.unpack(reader) |
| 4866 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
| 4867 | return obj |
| 4868 | |
| 4869 | def __eq__(self, other): |
| 4870 | if type(self) != type(other): return False |
| 4871 | if self.xid != other.xid: return False |
| 4872 | if self.cookie != other.cookie: return False |
| 4873 | if self.cookie_mask != other.cookie_mask: return False |
| 4874 | if self.table_id != other.table_id: return False |
| 4875 | if self.idle_timeout != other.idle_timeout: return False |
| 4876 | if self.hard_timeout != other.hard_timeout: return False |
| 4877 | if self.priority != other.priority: return False |
| 4878 | if self.buffer_id != other.buffer_id: return False |
| 4879 | if self.out_port != other.out_port: return False |
| 4880 | if self.out_group != other.out_group: return False |
| 4881 | if self.flags != other.flags: return False |
| 4882 | if self.importance != other.importance: return False |
| 4883 | if self.match != other.match: return False |
| 4884 | if self.instructions != other.instructions: return False |
| 4885 | return True |
| 4886 | |
| 4887 | def pretty_print(self, q): |
| 4888 | q.text("flow_delete_strict {") |
| 4889 | with q.group(): |
| 4890 | with q.indent(2): |
| 4891 | q.breakable() |
| 4892 | q.text("xid = "); |
| 4893 | if self.xid != None: |
| 4894 | q.text("%#x" % self.xid) |
| 4895 | else: |
| 4896 | q.text('None') |
| 4897 | q.text(","); q.breakable() |
| 4898 | q.text("cookie = "); |
| 4899 | q.text("%#x" % self.cookie) |
| 4900 | q.text(","); q.breakable() |
| 4901 | q.text("cookie_mask = "); |
| 4902 | q.text("%#x" % self.cookie_mask) |
| 4903 | q.text(","); q.breakable() |
| 4904 | q.text("table_id = "); |
| 4905 | q.text("%#x" % self.table_id) |
| 4906 | q.text(","); q.breakable() |
| 4907 | q.text("idle_timeout = "); |
| 4908 | q.text("%#x" % self.idle_timeout) |
| 4909 | q.text(","); q.breakable() |
| 4910 | q.text("hard_timeout = "); |
| 4911 | q.text("%#x" % self.hard_timeout) |
| 4912 | q.text(","); q.breakable() |
| 4913 | q.text("priority = "); |
| 4914 | q.text("%#x" % self.priority) |
| 4915 | q.text(","); q.breakable() |
| 4916 | q.text("buffer_id = "); |
| 4917 | q.text("%#x" % self.buffer_id) |
| 4918 | q.text(","); q.breakable() |
| 4919 | q.text("out_port = "); |
| 4920 | q.text(util.pretty_port(self.out_port)) |
| 4921 | q.text(","); q.breakable() |
| 4922 | q.text("out_group = "); |
| 4923 | q.text("%#x" % self.out_group) |
| 4924 | q.text(","); q.breakable() |
| 4925 | q.text("flags = "); |
| 4926 | q.text("%#x" % self.flags) |
| 4927 | q.text(","); q.breakable() |
| 4928 | q.text("importance = "); |
| 4929 | q.text("%#x" % self.importance) |
| 4930 | q.text(","); q.breakable() |
| 4931 | q.text("match = "); |
| 4932 | q.pp(self.match) |
| 4933 | q.text(","); q.breakable() |
| 4934 | q.text("instructions = "); |
| 4935 | q.pp(self.instructions) |
| 4936 | q.breakable() |
| 4937 | q.text('}') |
| 4938 | |
| 4939 | flow_mod.subtypes[4] = flow_delete_strict |
| 4940 | |
| 4941 | class flow_mod_failed_error_msg(error_msg): |
| 4942 | version = 5 |
| 4943 | type = 1 |
| 4944 | err_type = 5 |
| 4945 | |
| 4946 | def __init__(self, xid=None, code=None, data=None): |
| 4947 | if xid != None: |
| 4948 | self.xid = xid |
| 4949 | else: |
| 4950 | self.xid = None |
| 4951 | if code != None: |
| 4952 | self.code = code |
| 4953 | else: |
| 4954 | self.code = 0 |
| 4955 | if data != None: |
| 4956 | self.data = data |
| 4957 | else: |
| 4958 | self.data = '' |
| 4959 | return |
| 4960 | |
| 4961 | def pack(self): |
| 4962 | packed = [] |
| 4963 | packed.append(struct.pack("!B", self.version)) |
| 4964 | packed.append(struct.pack("!B", self.type)) |
| 4965 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4966 | packed.append(struct.pack("!L", self.xid)) |
| 4967 | packed.append(struct.pack("!H", self.err_type)) |
| 4968 | packed.append(struct.pack("!H", self.code)) |
| 4969 | packed.append(self.data) |
| 4970 | length = sum([len(x) for x in packed]) |
| 4971 | packed[2] = struct.pack("!H", length) |
| 4972 | return ''.join(packed) |
| 4973 | |
| 4974 | @staticmethod |
| 4975 | def unpack(reader): |
| 4976 | obj = flow_mod_failed_error_msg() |
| 4977 | _version = reader.read("!B")[0] |
| 4978 | assert(_version == 5) |
| 4979 | _type = reader.read("!B")[0] |
| 4980 | assert(_type == 1) |
| 4981 | _length = reader.read("!H")[0] |
| 4982 | orig_reader = reader |
| 4983 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4984 | obj.xid = reader.read("!L")[0] |
| 4985 | _err_type = reader.read("!H")[0] |
| 4986 | assert(_err_type == 5) |
| 4987 | obj.code = reader.read("!H")[0] |
| 4988 | obj.data = str(reader.read_all()) |
| 4989 | return obj |
| 4990 | |
| 4991 | def __eq__(self, other): |
| 4992 | if type(self) != type(other): return False |
| 4993 | if self.xid != other.xid: return False |
| 4994 | if self.code != other.code: return False |
| 4995 | if self.data != other.data: return False |
| 4996 | return True |
| 4997 | |
| 4998 | def pretty_print(self, q): |
| 4999 | q.text("flow_mod_failed_error_msg {") |
| 5000 | with q.group(): |
| 5001 | with q.indent(2): |
| 5002 | q.breakable() |
| 5003 | q.text("xid = "); |
| 5004 | if self.xid != None: |
| 5005 | q.text("%#x" % self.xid) |
| 5006 | else: |
| 5007 | q.text('None') |
| 5008 | q.text(","); q.breakable() |
| 5009 | q.text("code = "); |
| 5010 | q.text("%#x" % self.code) |
| 5011 | q.text(","); q.breakable() |
| 5012 | q.text("data = "); |
| 5013 | q.pp(self.data) |
| 5014 | q.breakable() |
| 5015 | q.text('}') |
| 5016 | |
| 5017 | error_msg.subtypes[5] = flow_mod_failed_error_msg |
| 5018 | |
| 5019 | class flow_modify(flow_mod): |
| 5020 | version = 5 |
| 5021 | type = 14 |
| 5022 | _command = 1 |
| 5023 | |
| 5024 | 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, importance=None, match=None, instructions=None): |
| 5025 | if xid != None: |
| 5026 | self.xid = xid |
| 5027 | else: |
| 5028 | self.xid = None |
| 5029 | if cookie != None: |
| 5030 | self.cookie = cookie |
| 5031 | else: |
| 5032 | self.cookie = 0 |
| 5033 | if cookie_mask != None: |
| 5034 | self.cookie_mask = cookie_mask |
| 5035 | else: |
| 5036 | self.cookie_mask = 0 |
| 5037 | if table_id != None: |
| 5038 | self.table_id = table_id |
| 5039 | else: |
| 5040 | self.table_id = 0 |
| 5041 | if idle_timeout != None: |
| 5042 | self.idle_timeout = idle_timeout |
| 5043 | else: |
| 5044 | self.idle_timeout = 0 |
| 5045 | if hard_timeout != None: |
| 5046 | self.hard_timeout = hard_timeout |
| 5047 | else: |
| 5048 | self.hard_timeout = 0 |
| 5049 | if priority != None: |
| 5050 | self.priority = priority |
| 5051 | else: |
| 5052 | self.priority = 0 |
| 5053 | if buffer_id != None: |
| 5054 | self.buffer_id = buffer_id |
| 5055 | else: |
| 5056 | self.buffer_id = 0 |
| 5057 | if out_port != None: |
| 5058 | self.out_port = out_port |
| 5059 | else: |
| 5060 | self.out_port = 0 |
| 5061 | if out_group != None: |
| 5062 | self.out_group = out_group |
| 5063 | else: |
| 5064 | self.out_group = 0 |
| 5065 | if flags != None: |
| 5066 | self.flags = flags |
| 5067 | else: |
| 5068 | self.flags = 0 |
| 5069 | if importance != None: |
| 5070 | self.importance = importance |
| 5071 | else: |
| 5072 | self.importance = 0 |
| 5073 | if match != None: |
| 5074 | self.match = match |
| 5075 | else: |
| 5076 | self.match = common.match() |
| 5077 | if instructions != None: |
| 5078 | self.instructions = instructions |
| 5079 | else: |
| 5080 | self.instructions = [] |
| 5081 | return |
| 5082 | |
| 5083 | def pack(self): |
| 5084 | packed = [] |
| 5085 | packed.append(struct.pack("!B", self.version)) |
| 5086 | packed.append(struct.pack("!B", self.type)) |
| 5087 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5088 | packed.append(struct.pack("!L", self.xid)) |
| 5089 | packed.append(struct.pack("!Q", self.cookie)) |
| 5090 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 5091 | packed.append(struct.pack("!B", self.table_id)) |
| 5092 | packed.append(util.pack_fm_cmd(self._command)) |
| 5093 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 5094 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 5095 | packed.append(struct.pack("!H", self.priority)) |
| 5096 | packed.append(struct.pack("!L", self.buffer_id)) |
| 5097 | packed.append(util.pack_port_no(self.out_port)) |
| 5098 | packed.append(struct.pack("!L", self.out_group)) |
| 5099 | packed.append(struct.pack("!H", self.flags)) |
| 5100 | packed.append(struct.pack("!H", self.importance)) |
| 5101 | packed.append(self.match.pack()) |
| 5102 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
| 5103 | length = sum([len(x) for x in packed]) |
| 5104 | packed[2] = struct.pack("!H", length) |
| 5105 | return ''.join(packed) |
| 5106 | |
| 5107 | @staticmethod |
| 5108 | def unpack(reader): |
| 5109 | obj = flow_modify() |
| 5110 | _version = reader.read("!B")[0] |
| 5111 | assert(_version == 5) |
| 5112 | _type = reader.read("!B")[0] |
| 5113 | assert(_type == 14) |
| 5114 | _length = reader.read("!H")[0] |
| 5115 | orig_reader = reader |
| 5116 | reader = orig_reader.slice(_length - (2 + 2)) |
| 5117 | obj.xid = reader.read("!L")[0] |
| 5118 | obj.cookie = reader.read("!Q")[0] |
| 5119 | obj.cookie_mask = reader.read("!Q")[0] |
| 5120 | obj.table_id = reader.read("!B")[0] |
| 5121 | __command = util.unpack_fm_cmd(reader) |
| 5122 | assert(__command == 1) |
| 5123 | obj.idle_timeout = reader.read("!H")[0] |
| 5124 | obj.hard_timeout = reader.read("!H")[0] |
| 5125 | obj.priority = reader.read("!H")[0] |
| 5126 | obj.buffer_id = reader.read("!L")[0] |
| 5127 | obj.out_port = util.unpack_port_no(reader) |
| 5128 | obj.out_group = reader.read("!L")[0] |
| 5129 | obj.flags = reader.read("!H")[0] |
| 5130 | obj.importance = reader.read("!H")[0] |
| 5131 | obj.match = common.match.unpack(reader) |
| 5132 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
| 5133 | return obj |
| 5134 | |
| 5135 | def __eq__(self, other): |
| 5136 | if type(self) != type(other): return False |
| 5137 | if self.xid != other.xid: return False |
| 5138 | if self.cookie != other.cookie: return False |
| 5139 | if self.cookie_mask != other.cookie_mask: return False |
| 5140 | if self.table_id != other.table_id: return False |
| 5141 | if self.idle_timeout != other.idle_timeout: return False |
| 5142 | if self.hard_timeout != other.hard_timeout: return False |
| 5143 | if self.priority != other.priority: return False |
| 5144 | if self.buffer_id != other.buffer_id: return False |
| 5145 | if self.out_port != other.out_port: return False |
| 5146 | if self.out_group != other.out_group: return False |
| 5147 | if self.flags != other.flags: return False |
| 5148 | if self.importance != other.importance: return False |
| 5149 | if self.match != other.match: return False |
| 5150 | if self.instructions != other.instructions: return False |
| 5151 | return True |
| 5152 | |
| 5153 | def pretty_print(self, q): |
| 5154 | q.text("flow_modify {") |
| 5155 | with q.group(): |
| 5156 | with q.indent(2): |
| 5157 | q.breakable() |
| 5158 | q.text("xid = "); |
| 5159 | if self.xid != None: |
| 5160 | q.text("%#x" % self.xid) |
| 5161 | else: |
| 5162 | q.text('None') |
| 5163 | q.text(","); q.breakable() |
| 5164 | q.text("cookie = "); |
| 5165 | q.text("%#x" % self.cookie) |
| 5166 | q.text(","); q.breakable() |
| 5167 | q.text("cookie_mask = "); |
| 5168 | q.text("%#x" % self.cookie_mask) |
| 5169 | q.text(","); q.breakable() |
| 5170 | q.text("table_id = "); |
| 5171 | q.text("%#x" % self.table_id) |
| 5172 | q.text(","); q.breakable() |
| 5173 | q.text("idle_timeout = "); |
| 5174 | q.text("%#x" % self.idle_timeout) |
| 5175 | q.text(","); q.breakable() |
| 5176 | q.text("hard_timeout = "); |
| 5177 | q.text("%#x" % self.hard_timeout) |
| 5178 | q.text(","); q.breakable() |
| 5179 | q.text("priority = "); |
| 5180 | q.text("%#x" % self.priority) |
| 5181 | q.text(","); q.breakable() |
| 5182 | q.text("buffer_id = "); |
| 5183 | q.text("%#x" % self.buffer_id) |
| 5184 | q.text(","); q.breakable() |
| 5185 | q.text("out_port = "); |
| 5186 | q.text(util.pretty_port(self.out_port)) |
| 5187 | q.text(","); q.breakable() |
| 5188 | q.text("out_group = "); |
| 5189 | q.text("%#x" % self.out_group) |
| 5190 | q.text(","); q.breakable() |
| 5191 | q.text("flags = "); |
| 5192 | q.text("%#x" % self.flags) |
| 5193 | q.text(","); q.breakable() |
| 5194 | q.text("importance = "); |
| 5195 | q.text("%#x" % self.importance) |
| 5196 | q.text(","); q.breakable() |
| 5197 | q.text("match = "); |
| 5198 | q.pp(self.match) |
| 5199 | q.text(","); q.breakable() |
| 5200 | q.text("instructions = "); |
| 5201 | q.pp(self.instructions) |
| 5202 | q.breakable() |
| 5203 | q.text('}') |
| 5204 | |
| 5205 | flow_mod.subtypes[1] = flow_modify |
| 5206 | |
| 5207 | class flow_modify_strict(flow_mod): |
| 5208 | version = 5 |
| 5209 | type = 14 |
| 5210 | _command = 2 |
| 5211 | |
| 5212 | 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, importance=None, match=None, instructions=None): |
| 5213 | if xid != None: |
| 5214 | self.xid = xid |
| 5215 | else: |
| 5216 | self.xid = None |
| 5217 | if cookie != None: |
| 5218 | self.cookie = cookie |
| 5219 | else: |
| 5220 | self.cookie = 0 |
| 5221 | if cookie_mask != None: |
| 5222 | self.cookie_mask = cookie_mask |
| 5223 | else: |
| 5224 | self.cookie_mask = 0 |
| 5225 | if table_id != None: |
| 5226 | self.table_id = table_id |
| 5227 | else: |
| 5228 | self.table_id = 0 |
| 5229 | if idle_timeout != None: |
| 5230 | self.idle_timeout = idle_timeout |
| 5231 | else: |
| 5232 | self.idle_timeout = 0 |
| 5233 | if hard_timeout != None: |
| 5234 | self.hard_timeout = hard_timeout |
| 5235 | else: |
| 5236 | self.hard_timeout = 0 |
| 5237 | if priority != None: |
| 5238 | self.priority = priority |
| 5239 | else: |
| 5240 | self.priority = 0 |
| 5241 | if buffer_id != None: |
| 5242 | self.buffer_id = buffer_id |
| 5243 | else: |
| 5244 | self.buffer_id = 0 |
| 5245 | if out_port != None: |
| 5246 | self.out_port = out_port |
| 5247 | else: |
| 5248 | self.out_port = 0 |
| 5249 | if out_group != None: |
| 5250 | self.out_group = out_group |
| 5251 | else: |
| 5252 | self.out_group = 0 |
| 5253 | if flags != None: |
| 5254 | self.flags = flags |
| 5255 | else: |
| 5256 | self.flags = 0 |
| 5257 | if importance != None: |
| 5258 | self.importance = importance |
| 5259 | else: |
| 5260 | self.importance = 0 |
| 5261 | if match != None: |
| 5262 | self.match = match |
| 5263 | else: |
| 5264 | self.match = common.match() |
| 5265 | if instructions != None: |
| 5266 | self.instructions = instructions |
| 5267 | else: |
| 5268 | self.instructions = [] |
| 5269 | return |
| 5270 | |
| 5271 | def pack(self): |
| 5272 | packed = [] |
| 5273 | packed.append(struct.pack("!B", self.version)) |
| 5274 | packed.append(struct.pack("!B", self.type)) |
| 5275 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5276 | packed.append(struct.pack("!L", self.xid)) |
| 5277 | packed.append(struct.pack("!Q", self.cookie)) |
| 5278 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 5279 | packed.append(struct.pack("!B", self.table_id)) |
| 5280 | packed.append(util.pack_fm_cmd(self._command)) |
| 5281 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 5282 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 5283 | packed.append(struct.pack("!H", self.priority)) |
| 5284 | packed.append(struct.pack("!L", self.buffer_id)) |
| 5285 | packed.append(util.pack_port_no(self.out_port)) |
| 5286 | packed.append(struct.pack("!L", self.out_group)) |
| 5287 | packed.append(struct.pack("!H", self.flags)) |
| 5288 | packed.append(struct.pack("!H", self.importance)) |
| 5289 | packed.append(self.match.pack()) |
| 5290 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
| 5291 | length = sum([len(x) for x in packed]) |
| 5292 | packed[2] = struct.pack("!H", length) |
| 5293 | return ''.join(packed) |
| 5294 | |
| 5295 | @staticmethod |
| 5296 | def unpack(reader): |
| 5297 | obj = flow_modify_strict() |
| 5298 | _version = reader.read("!B")[0] |
| 5299 | assert(_version == 5) |
| 5300 | _type = reader.read("!B")[0] |
| 5301 | assert(_type == 14) |
| 5302 | _length = reader.read("!H")[0] |
| 5303 | orig_reader = reader |
| 5304 | reader = orig_reader.slice(_length - (2 + 2)) |
| 5305 | obj.xid = reader.read("!L")[0] |
| 5306 | obj.cookie = reader.read("!Q")[0] |
| 5307 | obj.cookie_mask = reader.read("!Q")[0] |
| 5308 | obj.table_id = reader.read("!B")[0] |
| 5309 | __command = util.unpack_fm_cmd(reader) |
| 5310 | assert(__command == 2) |
| 5311 | obj.idle_timeout = reader.read("!H")[0] |
| 5312 | obj.hard_timeout = reader.read("!H")[0] |
| 5313 | obj.priority = reader.read("!H")[0] |
| 5314 | obj.buffer_id = reader.read("!L")[0] |
| 5315 | obj.out_port = util.unpack_port_no(reader) |
| 5316 | obj.out_group = reader.read("!L")[0] |
| 5317 | obj.flags = reader.read("!H")[0] |
| 5318 | obj.importance = reader.read("!H")[0] |
| 5319 | obj.match = common.match.unpack(reader) |
| 5320 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
| 5321 | return obj |
| 5322 | |
| 5323 | def __eq__(self, other): |
| 5324 | if type(self) != type(other): return False |
| 5325 | if self.xid != other.xid: return False |
| 5326 | if self.cookie != other.cookie: return False |
| 5327 | if self.cookie_mask != other.cookie_mask: return False |
| 5328 | if self.table_id != other.table_id: return False |
| 5329 | if self.idle_timeout != other.idle_timeout: return False |
| 5330 | if self.hard_timeout != other.hard_timeout: return False |
| 5331 | if self.priority != other.priority: return False |
| 5332 | if self.buffer_id != other.buffer_id: return False |
| 5333 | if self.out_port != other.out_port: return False |
| 5334 | if self.out_group != other.out_group: return False |
| 5335 | if self.flags != other.flags: return False |
| 5336 | if self.importance != other.importance: return False |
| 5337 | if self.match != other.match: return False |
| 5338 | if self.instructions != other.instructions: return False |
| 5339 | return True |
| 5340 | |
| 5341 | def pretty_print(self, q): |
| 5342 | q.text("flow_modify_strict {") |
| 5343 | with q.group(): |
| 5344 | with q.indent(2): |
| 5345 | q.breakable() |
| 5346 | q.text("xid = "); |
| 5347 | if self.xid != None: |
| 5348 | q.text("%#x" % self.xid) |
| 5349 | else: |
| 5350 | q.text('None') |
| 5351 | q.text(","); q.breakable() |
| 5352 | q.text("cookie = "); |
| 5353 | q.text("%#x" % self.cookie) |
| 5354 | q.text(","); q.breakable() |
| 5355 | q.text("cookie_mask = "); |
| 5356 | q.text("%#x" % self.cookie_mask) |
| 5357 | q.text(","); q.breakable() |
| 5358 | q.text("table_id = "); |
| 5359 | q.text("%#x" % self.table_id) |
| 5360 | q.text(","); q.breakable() |
| 5361 | q.text("idle_timeout = "); |
| 5362 | q.text("%#x" % self.idle_timeout) |
| 5363 | q.text(","); q.breakable() |
| 5364 | q.text("hard_timeout = "); |
| 5365 | q.text("%#x" % self.hard_timeout) |
| 5366 | q.text(","); q.breakable() |
| 5367 | q.text("priority = "); |
| 5368 | q.text("%#x" % self.priority) |
| 5369 | q.text(","); q.breakable() |
| 5370 | q.text("buffer_id = "); |
| 5371 | q.text("%#x" % self.buffer_id) |
| 5372 | q.text(","); q.breakable() |
| 5373 | q.text("out_port = "); |
| 5374 | q.text(util.pretty_port(self.out_port)) |
| 5375 | q.text(","); q.breakable() |
| 5376 | q.text("out_group = "); |
| 5377 | q.text("%#x" % self.out_group) |
| 5378 | q.text(","); q.breakable() |
| 5379 | q.text("flags = "); |
| 5380 | q.text("%#x" % self.flags) |
| 5381 | q.text(","); q.breakable() |
| 5382 | q.text("importance = "); |
| 5383 | q.text("%#x" % self.importance) |
| 5384 | q.text(","); q.breakable() |
| 5385 | q.text("match = "); |
| 5386 | q.pp(self.match) |
| 5387 | q.text(","); q.breakable() |
| 5388 | q.text("instructions = "); |
| 5389 | q.pp(self.instructions) |
| 5390 | q.breakable() |
| 5391 | q.text('}') |
| 5392 | |
| 5393 | flow_mod.subtypes[2] = flow_modify_strict |
| 5394 | |
| 5395 | class flow_removed(message): |
| 5396 | version = 5 |
| 5397 | type = 11 |
| 5398 | |
| 5399 | 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): |
| 5400 | if xid != None: |
| 5401 | self.xid = xid |
| 5402 | else: |
| 5403 | self.xid = None |
| 5404 | if cookie != None: |
| 5405 | self.cookie = cookie |
| 5406 | else: |
| 5407 | self.cookie = 0 |
| 5408 | if priority != None: |
| 5409 | self.priority = priority |
| 5410 | else: |
| 5411 | self.priority = 0 |
| 5412 | if reason != None: |
| 5413 | self.reason = reason |
| 5414 | else: |
| 5415 | self.reason = 0 |
| 5416 | if table_id != None: |
| 5417 | self.table_id = table_id |
| 5418 | else: |
| 5419 | self.table_id = 0 |
| 5420 | if duration_sec != None: |
| 5421 | self.duration_sec = duration_sec |
| 5422 | else: |
| 5423 | self.duration_sec = 0 |
| 5424 | if duration_nsec != None: |
| 5425 | self.duration_nsec = duration_nsec |
| 5426 | else: |
| 5427 | self.duration_nsec = 0 |
| 5428 | if idle_timeout != None: |
| 5429 | self.idle_timeout = idle_timeout |
| 5430 | else: |
| 5431 | self.idle_timeout = 0 |
| 5432 | if hard_timeout != None: |
| 5433 | self.hard_timeout = hard_timeout |
| 5434 | else: |
| 5435 | self.hard_timeout = 0 |
| 5436 | if packet_count != None: |
| 5437 | self.packet_count = packet_count |
| 5438 | else: |
| 5439 | self.packet_count = 0 |
| 5440 | if byte_count != None: |
| 5441 | self.byte_count = byte_count |
| 5442 | else: |
| 5443 | self.byte_count = 0 |
| 5444 | if match != None: |
| 5445 | self.match = match |
| 5446 | else: |
| 5447 | self.match = common.match() |
| 5448 | return |
| 5449 | |
| 5450 | def pack(self): |
| 5451 | packed = [] |
| 5452 | packed.append(struct.pack("!B", self.version)) |
| 5453 | packed.append(struct.pack("!B", self.type)) |
| 5454 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5455 | packed.append(struct.pack("!L", self.xid)) |
| 5456 | packed.append(struct.pack("!Q", self.cookie)) |
| 5457 | packed.append(struct.pack("!H", self.priority)) |
| 5458 | packed.append(struct.pack("!B", self.reason)) |
| 5459 | packed.append(struct.pack("!B", self.table_id)) |
| 5460 | packed.append(struct.pack("!L", self.duration_sec)) |
| 5461 | packed.append(struct.pack("!L", self.duration_nsec)) |
| 5462 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 5463 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 5464 | packed.append(struct.pack("!Q", self.packet_count)) |
| 5465 | packed.append(struct.pack("!Q", self.byte_count)) |
| 5466 | packed.append(self.match.pack()) |
| 5467 | length = sum([len(x) for x in packed]) |
| 5468 | packed[2] = struct.pack("!H", length) |
| 5469 | return ''.join(packed) |
| 5470 | |
| 5471 | @staticmethod |
| 5472 | def unpack(reader): |
| 5473 | obj = flow_removed() |
| 5474 | _version = reader.read("!B")[0] |
| 5475 | assert(_version == 5) |
| 5476 | _type = reader.read("!B")[0] |
| 5477 | assert(_type == 11) |
| 5478 | _length = reader.read("!H")[0] |
| 5479 | orig_reader = reader |
| 5480 | reader = orig_reader.slice(_length - (2 + 2)) |
| 5481 | obj.xid = reader.read("!L")[0] |
| 5482 | obj.cookie = reader.read("!Q")[0] |
| 5483 | obj.priority = reader.read("!H")[0] |
| 5484 | obj.reason = reader.read("!B")[0] |
| 5485 | obj.table_id = reader.read("!B")[0] |
| 5486 | obj.duration_sec = reader.read("!L")[0] |
| 5487 | obj.duration_nsec = reader.read("!L")[0] |
| 5488 | obj.idle_timeout = reader.read("!H")[0] |
| 5489 | obj.hard_timeout = reader.read("!H")[0] |
| 5490 | obj.packet_count = reader.read("!Q")[0] |
| 5491 | obj.byte_count = reader.read("!Q")[0] |
| 5492 | obj.match = common.match.unpack(reader) |
| 5493 | return obj |
| 5494 | |
| 5495 | def __eq__(self, other): |
| 5496 | if type(self) != type(other): return False |
| 5497 | if self.xid != other.xid: return False |
| 5498 | if self.cookie != other.cookie: return False |
| 5499 | if self.priority != other.priority: return False |
| 5500 | if self.reason != other.reason: return False |
| 5501 | if self.table_id != other.table_id: return False |
| 5502 | if self.duration_sec != other.duration_sec: return False |
| 5503 | if self.duration_nsec != other.duration_nsec: return False |
| 5504 | if self.idle_timeout != other.idle_timeout: return False |
| 5505 | if self.hard_timeout != other.hard_timeout: return False |
| 5506 | if self.packet_count != other.packet_count: return False |
| 5507 | if self.byte_count != other.byte_count: return False |
| 5508 | if self.match != other.match: return False |
| 5509 | return True |
| 5510 | |
| 5511 | def pretty_print(self, q): |
| 5512 | q.text("flow_removed {") |
| 5513 | with q.group(): |
| 5514 | with q.indent(2): |
| 5515 | q.breakable() |
| 5516 | q.text("xid = "); |
| 5517 | if self.xid != None: |
| 5518 | q.text("%#x" % self.xid) |
| 5519 | else: |
| 5520 | q.text('None') |
| 5521 | q.text(","); q.breakable() |
| 5522 | q.text("cookie = "); |
| 5523 | q.text("%#x" % self.cookie) |
| 5524 | q.text(","); q.breakable() |
| 5525 | q.text("priority = "); |
| 5526 | q.text("%#x" % self.priority) |
| 5527 | q.text(","); q.breakable() |
| 5528 | q.text("reason = "); |
| 5529 | q.text("%#x" % self.reason) |
| 5530 | q.text(","); q.breakable() |
| 5531 | q.text("table_id = "); |
| 5532 | q.text("%#x" % self.table_id) |
| 5533 | q.text(","); q.breakable() |
| 5534 | q.text("duration_sec = "); |
| 5535 | q.text("%#x" % self.duration_sec) |
| 5536 | q.text(","); q.breakable() |
| 5537 | q.text("duration_nsec = "); |
| 5538 | q.text("%#x" % self.duration_nsec) |
| 5539 | q.text(","); q.breakable() |
| 5540 | q.text("idle_timeout = "); |
| 5541 | q.text("%#x" % self.idle_timeout) |
| 5542 | q.text(","); q.breakable() |
| 5543 | q.text("hard_timeout = "); |
| 5544 | q.text("%#x" % self.hard_timeout) |
| 5545 | q.text(","); q.breakable() |
| 5546 | q.text("packet_count = "); |
| 5547 | q.text("%#x" % self.packet_count) |
| 5548 | q.text(","); q.breakable() |
| 5549 | q.text("byte_count = "); |
| 5550 | q.text("%#x" % self.byte_count) |
| 5551 | q.text(","); q.breakable() |
| 5552 | q.text("match = "); |
| 5553 | q.pp(self.match) |
| 5554 | q.breakable() |
| 5555 | q.text('}') |
| 5556 | |
| 5557 | message.subtypes[11] = flow_removed |
| 5558 | |
| 5559 | class flow_stats_reply(stats_reply): |
| 5560 | version = 5 |
| 5561 | type = 19 |
| 5562 | stats_type = 1 |
| 5563 | |
| 5564 | def __init__(self, xid=None, flags=None, entries=None): |
| 5565 | if xid != None: |
| 5566 | self.xid = xid |
| 5567 | else: |
| 5568 | self.xid = None |
| 5569 | if flags != None: |
| 5570 | self.flags = flags |
| 5571 | else: |
| 5572 | self.flags = 0 |
| 5573 | if entries != None: |
| 5574 | self.entries = entries |
| 5575 | else: |
| 5576 | self.entries = [] |
| 5577 | return |
| 5578 | |
| 5579 | def pack(self): |
| 5580 | packed = [] |
| 5581 | packed.append(struct.pack("!B", self.version)) |
| 5582 | packed.append(struct.pack("!B", self.type)) |
| 5583 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5584 | packed.append(struct.pack("!L", self.xid)) |
| 5585 | packed.append(struct.pack("!H", self.stats_type)) |
| 5586 | packed.append(struct.pack("!H", self.flags)) |
| 5587 | packed.append('\x00' * 4) |
| 5588 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 5589 | length = sum([len(x) for x in packed]) |
| 5590 | packed[2] = struct.pack("!H", length) |
| 5591 | return ''.join(packed) |
| 5592 | |
| 5593 | @staticmethod |
| 5594 | def unpack(reader): |
| 5595 | obj = flow_stats_reply() |
| 5596 | _version = reader.read("!B")[0] |
| 5597 | assert(_version == 5) |
| 5598 | _type = reader.read("!B")[0] |
| 5599 | assert(_type == 19) |
| 5600 | _length = reader.read("!H")[0] |
| 5601 | orig_reader = reader |
| 5602 | reader = orig_reader.slice(_length - (2 + 2)) |
| 5603 | obj.xid = reader.read("!L")[0] |
| 5604 | _stats_type = reader.read("!H")[0] |
| 5605 | assert(_stats_type == 1) |
| 5606 | obj.flags = reader.read("!H")[0] |
| 5607 | reader.skip(4) |
| 5608 | obj.entries = loxi.generic_util.unpack_list(reader, common.flow_stats_entry.unpack) |
| 5609 | return obj |
| 5610 | |
| 5611 | def __eq__(self, other): |
| 5612 | if type(self) != type(other): return False |
| 5613 | if self.xid != other.xid: return False |
| 5614 | if self.flags != other.flags: return False |
| 5615 | if self.entries != other.entries: return False |
| 5616 | return True |
| 5617 | |
| 5618 | def pretty_print(self, q): |
| 5619 | q.text("flow_stats_reply {") |
| 5620 | with q.group(): |
| 5621 | with q.indent(2): |
| 5622 | q.breakable() |
| 5623 | q.text("xid = "); |
| 5624 | if self.xid != None: |
| 5625 | q.text("%#x" % self.xid) |
| 5626 | else: |
| 5627 | q.text('None') |
| 5628 | q.text(","); q.breakable() |
| 5629 | q.text("flags = "); |
| 5630 | q.text("%#x" % self.flags) |
| 5631 | q.text(","); q.breakable() |
| 5632 | q.text("entries = "); |
| 5633 | q.pp(self.entries) |
| 5634 | q.breakable() |
| 5635 | q.text('}') |
| 5636 | |
| 5637 | stats_reply.subtypes[1] = flow_stats_reply |
| 5638 | |
| 5639 | class flow_stats_request(stats_request): |
| 5640 | version = 5 |
| 5641 | type = 18 |
| 5642 | stats_type = 1 |
| 5643 | |
| 5644 | def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None): |
| 5645 | if xid != None: |
| 5646 | self.xid = xid |
| 5647 | else: |
| 5648 | self.xid = None |
| 5649 | if flags != None: |
| 5650 | self.flags = flags |
| 5651 | else: |
| 5652 | self.flags = 0 |
| 5653 | if table_id != None: |
| 5654 | self.table_id = table_id |
| 5655 | else: |
| 5656 | self.table_id = 0 |
| 5657 | if out_port != None: |
| 5658 | self.out_port = out_port |
| 5659 | else: |
| 5660 | self.out_port = 0 |
| 5661 | if out_group != None: |
| 5662 | self.out_group = out_group |
| 5663 | else: |
| 5664 | self.out_group = 0 |
| 5665 | if cookie != None: |
| 5666 | self.cookie = cookie |
| 5667 | else: |
| 5668 | self.cookie = 0 |
| 5669 | if cookie_mask != None: |
| 5670 | self.cookie_mask = cookie_mask |
| 5671 | else: |
| 5672 | self.cookie_mask = 0 |
| 5673 | if match != None: |
| 5674 | self.match = match |
| 5675 | else: |
| 5676 | self.match = common.match() |
| 5677 | return |
| 5678 | |
| 5679 | def pack(self): |
| 5680 | packed = [] |
| 5681 | packed.append(struct.pack("!B", self.version)) |
| 5682 | packed.append(struct.pack("!B", self.type)) |
| 5683 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5684 | packed.append(struct.pack("!L", self.xid)) |
| 5685 | packed.append(struct.pack("!H", self.stats_type)) |
| 5686 | packed.append(struct.pack("!H", self.flags)) |
| 5687 | packed.append('\x00' * 4) |
| 5688 | packed.append(struct.pack("!B", self.table_id)) |
| 5689 | packed.append('\x00' * 3) |
| 5690 | packed.append(util.pack_port_no(self.out_port)) |
| 5691 | packed.append(struct.pack("!L", self.out_group)) |
| 5692 | packed.append('\x00' * 4) |
| 5693 | packed.append(struct.pack("!Q", self.cookie)) |
| 5694 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 5695 | packed.append(self.match.pack()) |
| 5696 | length = sum([len(x) for x in packed]) |
| 5697 | packed[2] = struct.pack("!H", length) |
| 5698 | return ''.join(packed) |
| 5699 | |
| 5700 | @staticmethod |
| 5701 | def unpack(reader): |
| 5702 | obj = flow_stats_request() |
| 5703 | _version = reader.read("!B")[0] |
| 5704 | assert(_version == 5) |
| 5705 | _type = reader.read("!B")[0] |
| 5706 | assert(_type == 18) |
| 5707 | _length = reader.read("!H")[0] |
| 5708 | orig_reader = reader |
| 5709 | reader = orig_reader.slice(_length - (2 + 2)) |
| 5710 | obj.xid = reader.read("!L")[0] |
| 5711 | _stats_type = reader.read("!H")[0] |
| 5712 | assert(_stats_type == 1) |
| 5713 | obj.flags = reader.read("!H")[0] |
| 5714 | reader.skip(4) |
| 5715 | obj.table_id = reader.read("!B")[0] |
| 5716 | reader.skip(3) |
| 5717 | obj.out_port = util.unpack_port_no(reader) |
| 5718 | obj.out_group = reader.read("!L")[0] |
| 5719 | reader.skip(4) |
| 5720 | obj.cookie = reader.read("!Q")[0] |
| 5721 | obj.cookie_mask = reader.read("!Q")[0] |
| 5722 | obj.match = common.match.unpack(reader) |
| 5723 | return obj |
| 5724 | |
| 5725 | def __eq__(self, other): |
| 5726 | if type(self) != type(other): return False |
| 5727 | if self.xid != other.xid: return False |
| 5728 | if self.flags != other.flags: return False |
| 5729 | if self.table_id != other.table_id: return False |
| 5730 | if self.out_port != other.out_port: return False |
| 5731 | if self.out_group != other.out_group: return False |
| 5732 | if self.cookie != other.cookie: return False |
| 5733 | if self.cookie_mask != other.cookie_mask: return False |
| 5734 | if self.match != other.match: return False |
| 5735 | return True |
| 5736 | |
| 5737 | def pretty_print(self, q): |
| 5738 | q.text("flow_stats_request {") |
| 5739 | with q.group(): |
| 5740 | with q.indent(2): |
| 5741 | q.breakable() |
| 5742 | q.text("xid = "); |
| 5743 | if self.xid != None: |
| 5744 | q.text("%#x" % self.xid) |
| 5745 | else: |
| 5746 | q.text('None') |
| 5747 | q.text(","); q.breakable() |
| 5748 | q.text("flags = "); |
| 5749 | q.text("%#x" % self.flags) |
| 5750 | q.text(","); q.breakable() |
| 5751 | q.text("table_id = "); |
| 5752 | q.text("%#x" % self.table_id) |
| 5753 | q.text(","); q.breakable() |
| 5754 | q.text("out_port = "); |
| 5755 | q.text(util.pretty_port(self.out_port)) |
| 5756 | q.text(","); q.breakable() |
| 5757 | q.text("out_group = "); |
| 5758 | q.text("%#x" % self.out_group) |
| 5759 | q.text(","); q.breakable() |
| 5760 | q.text("cookie = "); |
| 5761 | q.text("%#x" % self.cookie) |
| 5762 | q.text(","); q.breakable() |
| 5763 | q.text("cookie_mask = "); |
| 5764 | q.text("%#x" % self.cookie_mask) |
| 5765 | q.text(","); q.breakable() |
| 5766 | q.text("match = "); |
| 5767 | q.pp(self.match) |
| 5768 | q.breakable() |
| 5769 | q.text('}') |
| 5770 | |
| 5771 | stats_request.subtypes[1] = flow_stats_request |
| 5772 | |
| 5773 | class get_config_reply(message): |
| 5774 | version = 5 |
| 5775 | type = 8 |
| 5776 | |
| 5777 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
| 5778 | if xid != None: |
| 5779 | self.xid = xid |
| 5780 | else: |
| 5781 | self.xid = None |
| 5782 | if flags != None: |
| 5783 | self.flags = flags |
| 5784 | else: |
| 5785 | self.flags = 0 |
| 5786 | if miss_send_len != None: |
| 5787 | self.miss_send_len = miss_send_len |
| 5788 | else: |
| 5789 | self.miss_send_len = 0 |
| 5790 | return |
| 5791 | |
| 5792 | def pack(self): |
| 5793 | packed = [] |
| 5794 | packed.append(struct.pack("!B", self.version)) |
| 5795 | packed.append(struct.pack("!B", self.type)) |
| 5796 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5797 | packed.append(struct.pack("!L", self.xid)) |
| 5798 | packed.append(struct.pack("!H", self.flags)) |
| 5799 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 5800 | length = sum([len(x) for x in packed]) |
| 5801 | packed[2] = struct.pack("!H", length) |
| 5802 | return ''.join(packed) |
| 5803 | |
| 5804 | @staticmethod |
| 5805 | def unpack(reader): |
| 5806 | obj = get_config_reply() |
| 5807 | _version = reader.read("!B")[0] |
| 5808 | assert(_version == 5) |
| 5809 | _type = reader.read("!B")[0] |
| 5810 | assert(_type == 8) |
| 5811 | _length = reader.read("!H")[0] |
| 5812 | orig_reader = reader |
| 5813 | reader = orig_reader.slice(_length - (2 + 2)) |
| 5814 | obj.xid = reader.read("!L")[0] |
| 5815 | obj.flags = reader.read("!H")[0] |
| 5816 | obj.miss_send_len = reader.read("!H")[0] |
| 5817 | return obj |
| 5818 | |
| 5819 | def __eq__(self, other): |
| 5820 | if type(self) != type(other): return False |
| 5821 | if self.xid != other.xid: return False |
| 5822 | if self.flags != other.flags: return False |
| 5823 | if self.miss_send_len != other.miss_send_len: return False |
| 5824 | return True |
| 5825 | |
| 5826 | def pretty_print(self, q): |
| 5827 | q.text("get_config_reply {") |
| 5828 | with q.group(): |
| 5829 | with q.indent(2): |
| 5830 | q.breakable() |
| 5831 | q.text("xid = "); |
| 5832 | if self.xid != None: |
| 5833 | q.text("%#x" % self.xid) |
| 5834 | else: |
| 5835 | q.text('None') |
| 5836 | q.text(","); q.breakable() |
| 5837 | q.text("flags = "); |
| 5838 | q.text("%#x" % self.flags) |
| 5839 | q.text(","); q.breakable() |
| 5840 | q.text("miss_send_len = "); |
| 5841 | q.text("%#x" % self.miss_send_len) |
| 5842 | q.breakable() |
| 5843 | q.text('}') |
| 5844 | |
| 5845 | message.subtypes[8] = get_config_reply |
| 5846 | |
| 5847 | class get_config_request(message): |
| 5848 | version = 5 |
| 5849 | type = 7 |
| 5850 | |
| 5851 | def __init__(self, xid=None): |
| 5852 | if xid != None: |
| 5853 | self.xid = xid |
| 5854 | else: |
| 5855 | self.xid = None |
| 5856 | return |
| 5857 | |
| 5858 | def pack(self): |
| 5859 | packed = [] |
| 5860 | packed.append(struct.pack("!B", self.version)) |
| 5861 | packed.append(struct.pack("!B", self.type)) |
| 5862 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5863 | packed.append(struct.pack("!L", self.xid)) |
| 5864 | length = sum([len(x) for x in packed]) |
| 5865 | packed[2] = struct.pack("!H", length) |
| 5866 | return ''.join(packed) |
| 5867 | |
| 5868 | @staticmethod |
| 5869 | def unpack(reader): |
| 5870 | obj = get_config_request() |
| 5871 | _version = reader.read("!B")[0] |
| 5872 | assert(_version == 5) |
| 5873 | _type = reader.read("!B")[0] |
| 5874 | assert(_type == 7) |
| 5875 | _length = reader.read("!H")[0] |
| 5876 | orig_reader = reader |
| 5877 | reader = orig_reader.slice(_length - (2 + 2)) |
| 5878 | obj.xid = reader.read("!L")[0] |
| 5879 | return obj |
| 5880 | |
| 5881 | def __eq__(self, other): |
| 5882 | if type(self) != type(other): return False |
| 5883 | if self.xid != other.xid: return False |
| 5884 | return True |
| 5885 | |
| 5886 | def pretty_print(self, q): |
| 5887 | q.text("get_config_request {") |
| 5888 | with q.group(): |
| 5889 | with q.indent(2): |
| 5890 | q.breakable() |
| 5891 | q.text("xid = "); |
| 5892 | if self.xid != None: |
| 5893 | q.text("%#x" % self.xid) |
| 5894 | else: |
| 5895 | q.text('None') |
| 5896 | q.breakable() |
| 5897 | q.text('}') |
| 5898 | |
| 5899 | message.subtypes[7] = get_config_request |
| 5900 | |
| 5901 | class group_mod(message): |
| 5902 | subtypes = {} |
| 5903 | |
| 5904 | version = 5 |
| 5905 | type = 15 |
| 5906 | |
| 5907 | def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None): |
| 5908 | if xid != None: |
| 5909 | self.xid = xid |
| 5910 | else: |
| 5911 | self.xid = None |
| 5912 | if command != None: |
| 5913 | self.command = command |
| 5914 | else: |
| 5915 | self.command = 0 |
| 5916 | if group_type != None: |
| 5917 | self.group_type = group_type |
| 5918 | else: |
| 5919 | self.group_type = 0 |
| 5920 | if group_id != None: |
| 5921 | self.group_id = group_id |
| 5922 | else: |
| 5923 | self.group_id = 0 |
| 5924 | if buckets != None: |
| 5925 | self.buckets = buckets |
| 5926 | else: |
| 5927 | self.buckets = [] |
| 5928 | return |
| 5929 | |
| 5930 | def pack(self): |
| 5931 | packed = [] |
| 5932 | packed.append(struct.pack("!B", self.version)) |
| 5933 | packed.append(struct.pack("!B", self.type)) |
| 5934 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5935 | packed.append(struct.pack("!L", self.xid)) |
| 5936 | packed.append(struct.pack("!H", self.command)) |
| 5937 | packed.append(struct.pack("!B", self.group_type)) |
| 5938 | packed.append('\x00' * 1) |
| 5939 | packed.append(struct.pack("!L", self.group_id)) |
| 5940 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
| 5941 | length = sum([len(x) for x in packed]) |
| 5942 | packed[2] = struct.pack("!H", length) |
| 5943 | return ''.join(packed) |
| 5944 | |
| 5945 | @staticmethod |
| 5946 | def unpack(reader): |
| 5947 | subtype, = reader.peek('!H', 8) |
| 5948 | subclass = group_mod.subtypes.get(subtype) |
| 5949 | if subclass: |
| 5950 | return subclass.unpack(reader) |
| 5951 | |
| 5952 | obj = group_mod() |
| 5953 | _version = reader.read("!B")[0] |
| 5954 | assert(_version == 5) |
| 5955 | _type = reader.read("!B")[0] |
| 5956 | assert(_type == 15) |
| 5957 | _length = reader.read("!H")[0] |
| 5958 | orig_reader = reader |
| 5959 | reader = orig_reader.slice(_length - (2 + 2)) |
| 5960 | obj.xid = reader.read("!L")[0] |
| 5961 | obj.command = reader.read("!H")[0] |
| 5962 | obj.group_type = reader.read("!B")[0] |
| 5963 | reader.skip(1) |
| 5964 | obj.group_id = reader.read("!L")[0] |
| 5965 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
| 5966 | return obj |
| 5967 | |
| 5968 | def __eq__(self, other): |
| 5969 | if type(self) != type(other): return False |
| 5970 | if self.xid != other.xid: return False |
| 5971 | if self.command != other.command: return False |
| 5972 | if self.group_type != other.group_type: return False |
| 5973 | if self.group_id != other.group_id: return False |
| 5974 | if self.buckets != other.buckets: return False |
| 5975 | return True |
| 5976 | |
| 5977 | def pretty_print(self, q): |
| 5978 | q.text("group_mod {") |
| 5979 | with q.group(): |
| 5980 | with q.indent(2): |
| 5981 | q.breakable() |
| 5982 | q.text("xid = "); |
| 5983 | if self.xid != None: |
| 5984 | q.text("%#x" % self.xid) |
| 5985 | else: |
| 5986 | q.text('None') |
| 5987 | q.text(","); q.breakable() |
| 5988 | q.text("group_type = "); |
| 5989 | q.text("%#x" % self.group_type) |
| 5990 | q.text(","); q.breakable() |
| 5991 | q.text("group_id = "); |
| 5992 | q.text("%#x" % self.group_id) |
| 5993 | q.text(","); q.breakable() |
| 5994 | q.text("buckets = "); |
| 5995 | q.pp(self.buckets) |
| 5996 | q.breakable() |
| 5997 | q.text('}') |
| 5998 | |
| 5999 | message.subtypes[15] = group_mod |
| 6000 | |
| 6001 | class group_add(group_mod): |
| 6002 | version = 5 |
| 6003 | type = 15 |
| 6004 | command = 0 |
| 6005 | |
| 6006 | def __init__(self, xid=None, group_type=None, group_id=None, buckets=None): |
| 6007 | if xid != None: |
| 6008 | self.xid = xid |
| 6009 | else: |
| 6010 | self.xid = None |
| 6011 | if group_type != None: |
| 6012 | self.group_type = group_type |
| 6013 | else: |
| 6014 | self.group_type = 0 |
| 6015 | if group_id != None: |
| 6016 | self.group_id = group_id |
| 6017 | else: |
| 6018 | self.group_id = 0 |
| 6019 | if buckets != None: |
| 6020 | self.buckets = buckets |
| 6021 | else: |
| 6022 | self.buckets = [] |
| 6023 | return |
| 6024 | |
| 6025 | def pack(self): |
| 6026 | packed = [] |
| 6027 | packed.append(struct.pack("!B", self.version)) |
| 6028 | packed.append(struct.pack("!B", self.type)) |
| 6029 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6030 | packed.append(struct.pack("!L", self.xid)) |
| 6031 | packed.append(struct.pack("!H", self.command)) |
| 6032 | packed.append(struct.pack("!B", self.group_type)) |
| 6033 | packed.append('\x00' * 1) |
| 6034 | packed.append(struct.pack("!L", self.group_id)) |
| 6035 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
| 6036 | length = sum([len(x) for x in packed]) |
| 6037 | packed[2] = struct.pack("!H", length) |
| 6038 | return ''.join(packed) |
| 6039 | |
| 6040 | @staticmethod |
| 6041 | def unpack(reader): |
| 6042 | obj = group_add() |
| 6043 | _version = reader.read("!B")[0] |
| 6044 | assert(_version == 5) |
| 6045 | _type = reader.read("!B")[0] |
| 6046 | assert(_type == 15) |
| 6047 | _length = reader.read("!H")[0] |
| 6048 | orig_reader = reader |
| 6049 | reader = orig_reader.slice(_length - (2 + 2)) |
| 6050 | obj.xid = reader.read("!L")[0] |
| 6051 | _command = reader.read("!H")[0] |
| 6052 | assert(_command == 0) |
| 6053 | obj.group_type = reader.read("!B")[0] |
| 6054 | reader.skip(1) |
| 6055 | obj.group_id = reader.read("!L")[0] |
| 6056 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
| 6057 | return obj |
| 6058 | |
| 6059 | def __eq__(self, other): |
| 6060 | if type(self) != type(other): return False |
| 6061 | if self.xid != other.xid: return False |
| 6062 | if self.group_type != other.group_type: return False |
| 6063 | if self.group_id != other.group_id: return False |
| 6064 | if self.buckets != other.buckets: return False |
| 6065 | return True |
| 6066 | |
| 6067 | def pretty_print(self, q): |
| 6068 | q.text("group_add {") |
| 6069 | with q.group(): |
| 6070 | with q.indent(2): |
| 6071 | q.breakable() |
| 6072 | q.text("xid = "); |
| 6073 | if self.xid != None: |
| 6074 | q.text("%#x" % self.xid) |
| 6075 | else: |
| 6076 | q.text('None') |
| 6077 | q.text(","); q.breakable() |
| 6078 | q.text("group_type = "); |
| 6079 | q.text("%#x" % self.group_type) |
| 6080 | q.text(","); q.breakable() |
| 6081 | q.text("group_id = "); |
| 6082 | q.text("%#x" % self.group_id) |
| 6083 | q.text(","); q.breakable() |
| 6084 | q.text("buckets = "); |
| 6085 | q.pp(self.buckets) |
| 6086 | q.breakable() |
| 6087 | q.text('}') |
| 6088 | |
| 6089 | group_mod.subtypes[0] = group_add |
| 6090 | |
| 6091 | class group_delete(group_mod): |
| 6092 | version = 5 |
| 6093 | type = 15 |
| 6094 | command = 2 |
| 6095 | |
| 6096 | def __init__(self, xid=None, group_type=None, group_id=None, buckets=None): |
| 6097 | if xid != None: |
| 6098 | self.xid = xid |
| 6099 | else: |
| 6100 | self.xid = None |
| 6101 | if group_type != None: |
| 6102 | self.group_type = group_type |
| 6103 | else: |
| 6104 | self.group_type = 0 |
| 6105 | if group_id != None: |
| 6106 | self.group_id = group_id |
| 6107 | else: |
| 6108 | self.group_id = 0 |
| 6109 | if buckets != None: |
| 6110 | self.buckets = buckets |
| 6111 | else: |
| 6112 | self.buckets = [] |
| 6113 | return |
| 6114 | |
| 6115 | def pack(self): |
| 6116 | packed = [] |
| 6117 | packed.append(struct.pack("!B", self.version)) |
| 6118 | packed.append(struct.pack("!B", self.type)) |
| 6119 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6120 | packed.append(struct.pack("!L", self.xid)) |
| 6121 | packed.append(struct.pack("!H", self.command)) |
| 6122 | packed.append(struct.pack("!B", self.group_type)) |
| 6123 | packed.append('\x00' * 1) |
| 6124 | packed.append(struct.pack("!L", self.group_id)) |
| 6125 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
| 6126 | length = sum([len(x) for x in packed]) |
| 6127 | packed[2] = struct.pack("!H", length) |
| 6128 | return ''.join(packed) |
| 6129 | |
| 6130 | @staticmethod |
| 6131 | def unpack(reader): |
| 6132 | obj = group_delete() |
| 6133 | _version = reader.read("!B")[0] |
| 6134 | assert(_version == 5) |
| 6135 | _type = reader.read("!B")[0] |
| 6136 | assert(_type == 15) |
| 6137 | _length = reader.read("!H")[0] |
| 6138 | orig_reader = reader |
| 6139 | reader = orig_reader.slice(_length - (2 + 2)) |
| 6140 | obj.xid = reader.read("!L")[0] |
| 6141 | _command = reader.read("!H")[0] |
| 6142 | assert(_command == 2) |
| 6143 | obj.group_type = reader.read("!B")[0] |
| 6144 | reader.skip(1) |
| 6145 | obj.group_id = reader.read("!L")[0] |
| 6146 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
| 6147 | return obj |
| 6148 | |
| 6149 | def __eq__(self, other): |
| 6150 | if type(self) != type(other): return False |
| 6151 | if self.xid != other.xid: return False |
| 6152 | if self.group_type != other.group_type: return False |
| 6153 | if self.group_id != other.group_id: return False |
| 6154 | if self.buckets != other.buckets: return False |
| 6155 | return True |
| 6156 | |
| 6157 | def pretty_print(self, q): |
| 6158 | q.text("group_delete {") |
| 6159 | with q.group(): |
| 6160 | with q.indent(2): |
| 6161 | q.breakable() |
| 6162 | q.text("xid = "); |
| 6163 | if self.xid != None: |
| 6164 | q.text("%#x" % self.xid) |
| 6165 | else: |
| 6166 | q.text('None') |
| 6167 | q.text(","); q.breakable() |
| 6168 | q.text("group_type = "); |
| 6169 | q.text("%#x" % self.group_type) |
| 6170 | q.text(","); q.breakable() |
| 6171 | q.text("group_id = "); |
| 6172 | q.text("%#x" % self.group_id) |
| 6173 | q.text(","); q.breakable() |
| 6174 | q.text("buckets = "); |
| 6175 | q.pp(self.buckets) |
| 6176 | q.breakable() |
| 6177 | q.text('}') |
| 6178 | |
| 6179 | group_mod.subtypes[2] = group_delete |
| 6180 | |
| 6181 | class group_desc_stats_reply(stats_reply): |
| 6182 | version = 5 |
| 6183 | type = 19 |
| 6184 | stats_type = 7 |
| 6185 | |
| 6186 | def __init__(self, xid=None, flags=None, entries=None): |
| 6187 | if xid != None: |
| 6188 | self.xid = xid |
| 6189 | else: |
| 6190 | self.xid = None |
| 6191 | if flags != None: |
| 6192 | self.flags = flags |
| 6193 | else: |
| 6194 | self.flags = 0 |
| 6195 | if entries != None: |
| 6196 | self.entries = entries |
| 6197 | else: |
| 6198 | self.entries = [] |
| 6199 | return |
| 6200 | |
| 6201 | def pack(self): |
| 6202 | packed = [] |
| 6203 | packed.append(struct.pack("!B", self.version)) |
| 6204 | packed.append(struct.pack("!B", self.type)) |
| 6205 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6206 | packed.append(struct.pack("!L", self.xid)) |
| 6207 | packed.append(struct.pack("!H", self.stats_type)) |
| 6208 | packed.append(struct.pack("!H", self.flags)) |
| 6209 | packed.append('\x00' * 4) |
| 6210 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 6211 | length = sum([len(x) for x in packed]) |
| 6212 | packed[2] = struct.pack("!H", length) |
| 6213 | return ''.join(packed) |
| 6214 | |
| 6215 | @staticmethod |
| 6216 | def unpack(reader): |
| 6217 | obj = group_desc_stats_reply() |
| 6218 | _version = reader.read("!B")[0] |
| 6219 | assert(_version == 5) |
| 6220 | _type = reader.read("!B")[0] |
| 6221 | assert(_type == 19) |
| 6222 | _length = reader.read("!H")[0] |
| 6223 | orig_reader = reader |
| 6224 | reader = orig_reader.slice(_length - (2 + 2)) |
| 6225 | obj.xid = reader.read("!L")[0] |
| 6226 | _stats_type = reader.read("!H")[0] |
| 6227 | assert(_stats_type == 7) |
| 6228 | obj.flags = reader.read("!H")[0] |
| 6229 | reader.skip(4) |
| 6230 | obj.entries = loxi.generic_util.unpack_list(reader, common.group_desc_stats_entry.unpack) |
| 6231 | return obj |
| 6232 | |
| 6233 | def __eq__(self, other): |
| 6234 | if type(self) != type(other): return False |
| 6235 | if self.xid != other.xid: return False |
| 6236 | if self.flags != other.flags: return False |
| 6237 | if self.entries != other.entries: return False |
| 6238 | return True |
| 6239 | |
| 6240 | def pretty_print(self, q): |
| 6241 | q.text("group_desc_stats_reply {") |
| 6242 | with q.group(): |
| 6243 | with q.indent(2): |
| 6244 | q.breakable() |
| 6245 | q.text("xid = "); |
| 6246 | if self.xid != None: |
| 6247 | q.text("%#x" % self.xid) |
| 6248 | else: |
| 6249 | q.text('None') |
| 6250 | q.text(","); q.breakable() |
| 6251 | q.text("flags = "); |
| 6252 | q.text("%#x" % self.flags) |
| 6253 | q.text(","); q.breakable() |
| 6254 | q.text("entries = "); |
| 6255 | q.pp(self.entries) |
| 6256 | q.breakable() |
| 6257 | q.text('}') |
| 6258 | |
| 6259 | stats_reply.subtypes[7] = group_desc_stats_reply |
| 6260 | |
| 6261 | class group_desc_stats_request(stats_request): |
| 6262 | version = 5 |
| 6263 | type = 18 |
| 6264 | stats_type = 7 |
| 6265 | |
| 6266 | def __init__(self, xid=None, flags=None): |
| 6267 | if xid != None: |
| 6268 | self.xid = xid |
| 6269 | else: |
| 6270 | self.xid = None |
| 6271 | if flags != None: |
| 6272 | self.flags = flags |
| 6273 | else: |
| 6274 | self.flags = 0 |
| 6275 | return |
| 6276 | |
| 6277 | def pack(self): |
| 6278 | packed = [] |
| 6279 | packed.append(struct.pack("!B", self.version)) |
| 6280 | packed.append(struct.pack("!B", self.type)) |
| 6281 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6282 | packed.append(struct.pack("!L", self.xid)) |
| 6283 | packed.append(struct.pack("!H", self.stats_type)) |
| 6284 | packed.append(struct.pack("!H", self.flags)) |
| 6285 | packed.append('\x00' * 4) |
| 6286 | length = sum([len(x) for x in packed]) |
| 6287 | packed[2] = struct.pack("!H", length) |
| 6288 | return ''.join(packed) |
| 6289 | |
| 6290 | @staticmethod |
| 6291 | def unpack(reader): |
| 6292 | obj = group_desc_stats_request() |
| 6293 | _version = reader.read("!B")[0] |
| 6294 | assert(_version == 5) |
| 6295 | _type = reader.read("!B")[0] |
| 6296 | assert(_type == 18) |
| 6297 | _length = reader.read("!H")[0] |
| 6298 | orig_reader = reader |
| 6299 | reader = orig_reader.slice(_length - (2 + 2)) |
| 6300 | obj.xid = reader.read("!L")[0] |
| 6301 | _stats_type = reader.read("!H")[0] |
| 6302 | assert(_stats_type == 7) |
| 6303 | obj.flags = reader.read("!H")[0] |
| 6304 | reader.skip(4) |
| 6305 | return obj |
| 6306 | |
| 6307 | def __eq__(self, other): |
| 6308 | if type(self) != type(other): return False |
| 6309 | if self.xid != other.xid: return False |
| 6310 | if self.flags != other.flags: return False |
| 6311 | return True |
| 6312 | |
| 6313 | def pretty_print(self, q): |
| 6314 | q.text("group_desc_stats_request {") |
| 6315 | with q.group(): |
| 6316 | with q.indent(2): |
| 6317 | q.breakable() |
| 6318 | q.text("xid = "); |
| 6319 | if self.xid != None: |
| 6320 | q.text("%#x" % self.xid) |
| 6321 | else: |
| 6322 | q.text('None') |
| 6323 | q.text(","); q.breakable() |
| 6324 | q.text("flags = "); |
| 6325 | q.text("%#x" % self.flags) |
| 6326 | q.breakable() |
| 6327 | q.text('}') |
| 6328 | |
| 6329 | stats_request.subtypes[7] = group_desc_stats_request |
| 6330 | |
| 6331 | class group_features_stats_reply(stats_reply): |
| 6332 | version = 5 |
| 6333 | type = 19 |
| 6334 | stats_type = 8 |
| 6335 | |
| 6336 | 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): |
| 6337 | if xid != None: |
| 6338 | self.xid = xid |
| 6339 | else: |
| 6340 | self.xid = None |
| 6341 | if flags != None: |
| 6342 | self.flags = flags |
| 6343 | else: |
| 6344 | self.flags = 0 |
| 6345 | if types != None: |
| 6346 | self.types = types |
| 6347 | else: |
| 6348 | self.types = 0 |
| 6349 | if capabilities != None: |
| 6350 | self.capabilities = capabilities |
| 6351 | else: |
| 6352 | self.capabilities = 0 |
| 6353 | if max_groups_all != None: |
| 6354 | self.max_groups_all = max_groups_all |
| 6355 | else: |
| 6356 | self.max_groups_all = 0 |
| 6357 | if max_groups_select != None: |
| 6358 | self.max_groups_select = max_groups_select |
| 6359 | else: |
| 6360 | self.max_groups_select = 0 |
| 6361 | if max_groups_indirect != None: |
| 6362 | self.max_groups_indirect = max_groups_indirect |
| 6363 | else: |
| 6364 | self.max_groups_indirect = 0 |
| 6365 | if max_groups_ff != None: |
| 6366 | self.max_groups_ff = max_groups_ff |
| 6367 | else: |
| 6368 | self.max_groups_ff = 0 |
| 6369 | if actions_all != None: |
| 6370 | self.actions_all = actions_all |
| 6371 | else: |
| 6372 | self.actions_all = 0 |
| 6373 | if actions_select != None: |
| 6374 | self.actions_select = actions_select |
| 6375 | else: |
| 6376 | self.actions_select = 0 |
| 6377 | if actions_indirect != None: |
| 6378 | self.actions_indirect = actions_indirect |
| 6379 | else: |
| 6380 | self.actions_indirect = 0 |
| 6381 | if actions_ff != None: |
| 6382 | self.actions_ff = actions_ff |
| 6383 | else: |
| 6384 | self.actions_ff = 0 |
| 6385 | return |
| 6386 | |
| 6387 | def pack(self): |
| 6388 | packed = [] |
| 6389 | packed.append(struct.pack("!B", self.version)) |
| 6390 | packed.append(struct.pack("!B", self.type)) |
| 6391 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6392 | packed.append(struct.pack("!L", self.xid)) |
| 6393 | packed.append(struct.pack("!H", self.stats_type)) |
| 6394 | packed.append(struct.pack("!H", self.flags)) |
| 6395 | packed.append('\x00' * 4) |
| 6396 | packed.append(struct.pack("!L", self.types)) |
| 6397 | packed.append(struct.pack("!L", self.capabilities)) |
| 6398 | packed.append(struct.pack("!L", self.max_groups_all)) |
| 6399 | packed.append(struct.pack("!L", self.max_groups_select)) |
| 6400 | packed.append(struct.pack("!L", self.max_groups_indirect)) |
| 6401 | packed.append(struct.pack("!L", self.max_groups_ff)) |
| 6402 | packed.append(struct.pack("!L", self.actions_all)) |
| 6403 | packed.append(struct.pack("!L", self.actions_select)) |
| 6404 | packed.append(struct.pack("!L", self.actions_indirect)) |
| 6405 | packed.append(struct.pack("!L", self.actions_ff)) |
| 6406 | length = sum([len(x) for x in packed]) |
| 6407 | packed[2] = struct.pack("!H", length) |
| 6408 | return ''.join(packed) |
| 6409 | |
| 6410 | @staticmethod |
| 6411 | def unpack(reader): |
| 6412 | obj = group_features_stats_reply() |
| 6413 | _version = reader.read("!B")[0] |
| 6414 | assert(_version == 5) |
| 6415 | _type = reader.read("!B")[0] |
| 6416 | assert(_type == 19) |
| 6417 | _length = reader.read("!H")[0] |
| 6418 | orig_reader = reader |
| 6419 | reader = orig_reader.slice(_length - (2 + 2)) |
| 6420 | obj.xid = reader.read("!L")[0] |
| 6421 | _stats_type = reader.read("!H")[0] |
| 6422 | assert(_stats_type == 8) |
| 6423 | obj.flags = reader.read("!H")[0] |
| 6424 | reader.skip(4) |
| 6425 | obj.types = reader.read("!L")[0] |
| 6426 | obj.capabilities = reader.read("!L")[0] |
| 6427 | obj.max_groups_all = reader.read("!L")[0] |
| 6428 | obj.max_groups_select = reader.read("!L")[0] |
| 6429 | obj.max_groups_indirect = reader.read("!L")[0] |
| 6430 | obj.max_groups_ff = reader.read("!L")[0] |
| 6431 | obj.actions_all = reader.read("!L")[0] |
| 6432 | obj.actions_select = reader.read("!L")[0] |
| 6433 | obj.actions_indirect = reader.read("!L")[0] |
| 6434 | obj.actions_ff = reader.read("!L")[0] |
| 6435 | return obj |
| 6436 | |
| 6437 | def __eq__(self, other): |
| 6438 | if type(self) != type(other): return False |
| 6439 | if self.xid != other.xid: return False |
| 6440 | if self.flags != other.flags: return False |
| 6441 | if self.types != other.types: return False |
| 6442 | if self.capabilities != other.capabilities: return False |
| 6443 | if self.max_groups_all != other.max_groups_all: return False |
| 6444 | if self.max_groups_select != other.max_groups_select: return False |
| 6445 | if self.max_groups_indirect != other.max_groups_indirect: return False |
| 6446 | if self.max_groups_ff != other.max_groups_ff: return False |
| 6447 | if self.actions_all != other.actions_all: return False |
| 6448 | if self.actions_select != other.actions_select: return False |
| 6449 | if self.actions_indirect != other.actions_indirect: return False |
| 6450 | if self.actions_ff != other.actions_ff: return False |
| 6451 | return True |
| 6452 | |
| 6453 | def pretty_print(self, q): |
| 6454 | q.text("group_features_stats_reply {") |
| 6455 | with q.group(): |
| 6456 | with q.indent(2): |
| 6457 | q.breakable() |
| 6458 | q.text("xid = "); |
| 6459 | if self.xid != None: |
| 6460 | q.text("%#x" % self.xid) |
| 6461 | else: |
| 6462 | q.text('None') |
| 6463 | q.text(","); q.breakable() |
| 6464 | q.text("flags = "); |
| 6465 | q.text("%#x" % self.flags) |
| 6466 | q.text(","); q.breakable() |
| 6467 | q.text("types = "); |
| 6468 | q.text("%#x" % self.types) |
| 6469 | q.text(","); q.breakable() |
| 6470 | q.text("capabilities = "); |
| 6471 | q.text("%#x" % self.capabilities) |
| 6472 | q.text(","); q.breakable() |
| 6473 | q.text("max_groups_all = "); |
| 6474 | q.text("%#x" % self.max_groups_all) |
| 6475 | q.text(","); q.breakable() |
| 6476 | q.text("max_groups_select = "); |
| 6477 | q.text("%#x" % self.max_groups_select) |
| 6478 | q.text(","); q.breakable() |
| 6479 | q.text("max_groups_indirect = "); |
| 6480 | q.text("%#x" % self.max_groups_indirect) |
| 6481 | q.text(","); q.breakable() |
| 6482 | q.text("max_groups_ff = "); |
| 6483 | q.text("%#x" % self.max_groups_ff) |
| 6484 | q.text(","); q.breakable() |
| 6485 | q.text("actions_all = "); |
| 6486 | q.text("%#x" % self.actions_all) |
| 6487 | q.text(","); q.breakable() |
| 6488 | q.text("actions_select = "); |
| 6489 | q.text("%#x" % self.actions_select) |
| 6490 | q.text(","); q.breakable() |
| 6491 | q.text("actions_indirect = "); |
| 6492 | q.text("%#x" % self.actions_indirect) |
| 6493 | q.text(","); q.breakable() |
| 6494 | q.text("actions_ff = "); |
| 6495 | q.text("%#x" % self.actions_ff) |
| 6496 | q.breakable() |
| 6497 | q.text('}') |
| 6498 | |
| 6499 | stats_reply.subtypes[8] = group_features_stats_reply |
| 6500 | |
| 6501 | class group_features_stats_request(stats_request): |
| 6502 | version = 5 |
| 6503 | type = 18 |
| 6504 | stats_type = 8 |
| 6505 | |
| 6506 | def __init__(self, xid=None, flags=None): |
| 6507 | if xid != None: |
| 6508 | self.xid = xid |
| 6509 | else: |
| 6510 | self.xid = None |
| 6511 | if flags != None: |
| 6512 | self.flags = flags |
| 6513 | else: |
| 6514 | self.flags = 0 |
| 6515 | return |
| 6516 | |
| 6517 | def pack(self): |
| 6518 | packed = [] |
| 6519 | packed.append(struct.pack("!B", self.version)) |
| 6520 | packed.append(struct.pack("!B", self.type)) |
| 6521 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6522 | packed.append(struct.pack("!L", self.xid)) |
| 6523 | packed.append(struct.pack("!H", self.stats_type)) |
| 6524 | packed.append(struct.pack("!H", self.flags)) |
| 6525 | packed.append('\x00' * 4) |
| 6526 | length = sum([len(x) for x in packed]) |
| 6527 | packed[2] = struct.pack("!H", length) |
| 6528 | return ''.join(packed) |
| 6529 | |
| 6530 | @staticmethod |
| 6531 | def unpack(reader): |
| 6532 | obj = group_features_stats_request() |
| 6533 | _version = reader.read("!B")[0] |
| 6534 | assert(_version == 5) |
| 6535 | _type = reader.read("!B")[0] |
| 6536 | assert(_type == 18) |
| 6537 | _length = reader.read("!H")[0] |
| 6538 | orig_reader = reader |
| 6539 | reader = orig_reader.slice(_length - (2 + 2)) |
| 6540 | obj.xid = reader.read("!L")[0] |
| 6541 | _stats_type = reader.read("!H")[0] |
| 6542 | assert(_stats_type == 8) |
| 6543 | obj.flags = reader.read("!H")[0] |
| 6544 | reader.skip(4) |
| 6545 | return obj |
| 6546 | |
| 6547 | def __eq__(self, other): |
| 6548 | if type(self) != type(other): return False |
| 6549 | if self.xid != other.xid: return False |
| 6550 | if self.flags != other.flags: return False |
| 6551 | return True |
| 6552 | |
| 6553 | def pretty_print(self, q): |
| 6554 | q.text("group_features_stats_request {") |
| 6555 | with q.group(): |
| 6556 | with q.indent(2): |
| 6557 | q.breakable() |
| 6558 | q.text("xid = "); |
| 6559 | if self.xid != None: |
| 6560 | q.text("%#x" % self.xid) |
| 6561 | else: |
| 6562 | q.text('None') |
| 6563 | q.text(","); q.breakable() |
| 6564 | q.text("flags = "); |
| 6565 | q.text("%#x" % self.flags) |
| 6566 | q.breakable() |
| 6567 | q.text('}') |
| 6568 | |
| 6569 | stats_request.subtypes[8] = group_features_stats_request |
| 6570 | |
| 6571 | class group_mod_failed_error_msg(error_msg): |
| 6572 | version = 5 |
| 6573 | type = 1 |
| 6574 | err_type = 6 |
| 6575 | |
| 6576 | def __init__(self, xid=None, code=None, data=None): |
| 6577 | if xid != None: |
| 6578 | self.xid = xid |
| 6579 | else: |
| 6580 | self.xid = None |
| 6581 | if code != None: |
| 6582 | self.code = code |
| 6583 | else: |
| 6584 | self.code = 0 |
| 6585 | if data != None: |
| 6586 | self.data = data |
| 6587 | else: |
| 6588 | self.data = '' |
| 6589 | return |
| 6590 | |
| 6591 | def pack(self): |
| 6592 | packed = [] |
| 6593 | packed.append(struct.pack("!B", self.version)) |
| 6594 | packed.append(struct.pack("!B", self.type)) |
| 6595 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6596 | packed.append(struct.pack("!L", self.xid)) |
| 6597 | packed.append(struct.pack("!H", self.err_type)) |
| 6598 | packed.append(struct.pack("!H", self.code)) |
| 6599 | packed.append(self.data) |
| 6600 | length = sum([len(x) for x in packed]) |
| 6601 | packed[2] = struct.pack("!H", length) |
| 6602 | return ''.join(packed) |
| 6603 | |
| 6604 | @staticmethod |
| 6605 | def unpack(reader): |
| 6606 | obj = group_mod_failed_error_msg() |
| 6607 | _version = reader.read("!B")[0] |
| 6608 | assert(_version == 5) |
| 6609 | _type = reader.read("!B")[0] |
| 6610 | assert(_type == 1) |
| 6611 | _length = reader.read("!H")[0] |
| 6612 | orig_reader = reader |
| 6613 | reader = orig_reader.slice(_length - (2 + 2)) |
| 6614 | obj.xid = reader.read("!L")[0] |
| 6615 | _err_type = reader.read("!H")[0] |
| 6616 | assert(_err_type == 6) |
| 6617 | obj.code = reader.read("!H")[0] |
| 6618 | obj.data = str(reader.read_all()) |
| 6619 | return obj |
| 6620 | |
| 6621 | def __eq__(self, other): |
| 6622 | if type(self) != type(other): return False |
| 6623 | if self.xid != other.xid: return False |
| 6624 | if self.code != other.code: return False |
| 6625 | if self.data != other.data: return False |
| 6626 | return True |
| 6627 | |
| 6628 | def pretty_print(self, q): |
| 6629 | q.text("group_mod_failed_error_msg {") |
| 6630 | with q.group(): |
| 6631 | with q.indent(2): |
| 6632 | q.breakable() |
| 6633 | q.text("xid = "); |
| 6634 | if self.xid != None: |
| 6635 | q.text("%#x" % self.xid) |
| 6636 | else: |
| 6637 | q.text('None') |
| 6638 | q.text(","); q.breakable() |
| 6639 | q.text("code = "); |
| 6640 | q.text("%#x" % self.code) |
| 6641 | q.text(","); q.breakable() |
| 6642 | q.text("data = "); |
| 6643 | q.pp(self.data) |
| 6644 | q.breakable() |
| 6645 | q.text('}') |
| 6646 | |
| 6647 | error_msg.subtypes[6] = group_mod_failed_error_msg |
| 6648 | |
| 6649 | class group_modify(group_mod): |
| 6650 | version = 5 |
| 6651 | type = 15 |
| 6652 | command = 1 |
| 6653 | |
| 6654 | def __init__(self, xid=None, group_type=None, group_id=None, buckets=None): |
| 6655 | if xid != None: |
| 6656 | self.xid = xid |
| 6657 | else: |
| 6658 | self.xid = None |
| 6659 | if group_type != None: |
| 6660 | self.group_type = group_type |
| 6661 | else: |
| 6662 | self.group_type = 0 |
| 6663 | if group_id != None: |
| 6664 | self.group_id = group_id |
| 6665 | else: |
| 6666 | self.group_id = 0 |
| 6667 | if buckets != None: |
| 6668 | self.buckets = buckets |
| 6669 | else: |
| 6670 | self.buckets = [] |
| 6671 | return |
| 6672 | |
| 6673 | def pack(self): |
| 6674 | packed = [] |
| 6675 | packed.append(struct.pack("!B", self.version)) |
| 6676 | packed.append(struct.pack("!B", self.type)) |
| 6677 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6678 | packed.append(struct.pack("!L", self.xid)) |
| 6679 | packed.append(struct.pack("!H", self.command)) |
| 6680 | packed.append(struct.pack("!B", self.group_type)) |
| 6681 | packed.append('\x00' * 1) |
| 6682 | packed.append(struct.pack("!L", self.group_id)) |
| 6683 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
| 6684 | length = sum([len(x) for x in packed]) |
| 6685 | packed[2] = struct.pack("!H", length) |
| 6686 | return ''.join(packed) |
| 6687 | |
| 6688 | @staticmethod |
| 6689 | def unpack(reader): |
| 6690 | obj = group_modify() |
| 6691 | _version = reader.read("!B")[0] |
| 6692 | assert(_version == 5) |
| 6693 | _type = reader.read("!B")[0] |
| 6694 | assert(_type == 15) |
| 6695 | _length = reader.read("!H")[0] |
| 6696 | orig_reader = reader |
| 6697 | reader = orig_reader.slice(_length - (2 + 2)) |
| 6698 | obj.xid = reader.read("!L")[0] |
| 6699 | _command = reader.read("!H")[0] |
| 6700 | assert(_command == 1) |
| 6701 | obj.group_type = reader.read("!B")[0] |
| 6702 | reader.skip(1) |
| 6703 | obj.group_id = reader.read("!L")[0] |
| 6704 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
| 6705 | return obj |
| 6706 | |
| 6707 | def __eq__(self, other): |
| 6708 | if type(self) != type(other): return False |
| 6709 | if self.xid != other.xid: return False |
| 6710 | if self.group_type != other.group_type: return False |
| 6711 | if self.group_id != other.group_id: return False |
| 6712 | if self.buckets != other.buckets: return False |
| 6713 | return True |
| 6714 | |
| 6715 | def pretty_print(self, q): |
| 6716 | q.text("group_modify {") |
| 6717 | with q.group(): |
| 6718 | with q.indent(2): |
| 6719 | q.breakable() |
| 6720 | q.text("xid = "); |
| 6721 | if self.xid != None: |
| 6722 | q.text("%#x" % self.xid) |
| 6723 | else: |
| 6724 | q.text('None') |
| 6725 | q.text(","); q.breakable() |
| 6726 | q.text("group_type = "); |
| 6727 | q.text("%#x" % self.group_type) |
| 6728 | q.text(","); q.breakable() |
| 6729 | q.text("group_id = "); |
| 6730 | q.text("%#x" % self.group_id) |
| 6731 | q.text(","); q.breakable() |
| 6732 | q.text("buckets = "); |
| 6733 | q.pp(self.buckets) |
| 6734 | q.breakable() |
| 6735 | q.text('}') |
| 6736 | |
| 6737 | group_mod.subtypes[1] = group_modify |
| 6738 | |
| 6739 | class group_stats_reply(stats_reply): |
| 6740 | version = 5 |
| 6741 | type = 19 |
| 6742 | stats_type = 6 |
| 6743 | |
| 6744 | def __init__(self, xid=None, flags=None, entries=None): |
| 6745 | if xid != None: |
| 6746 | self.xid = xid |
| 6747 | else: |
| 6748 | self.xid = None |
| 6749 | if flags != None: |
| 6750 | self.flags = flags |
| 6751 | else: |
| 6752 | self.flags = 0 |
| 6753 | if entries != None: |
| 6754 | self.entries = entries |
| 6755 | else: |
| 6756 | self.entries = [] |
| 6757 | return |
| 6758 | |
| 6759 | def pack(self): |
| 6760 | packed = [] |
| 6761 | packed.append(struct.pack("!B", self.version)) |
| 6762 | packed.append(struct.pack("!B", self.type)) |
| 6763 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6764 | packed.append(struct.pack("!L", self.xid)) |
| 6765 | packed.append(struct.pack("!H", self.stats_type)) |
| 6766 | packed.append(struct.pack("!H", self.flags)) |
| 6767 | packed.append('\x00' * 4) |
| 6768 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 6769 | length = sum([len(x) for x in packed]) |
| 6770 | packed[2] = struct.pack("!H", length) |
| 6771 | return ''.join(packed) |
| 6772 | |
| 6773 | @staticmethod |
| 6774 | def unpack(reader): |
| 6775 | obj = group_stats_reply() |
| 6776 | _version = reader.read("!B")[0] |
| 6777 | assert(_version == 5) |
| 6778 | _type = reader.read("!B")[0] |
| 6779 | assert(_type == 19) |
| 6780 | _length = reader.read("!H")[0] |
| 6781 | orig_reader = reader |
| 6782 | reader = orig_reader.slice(_length - (2 + 2)) |
| 6783 | obj.xid = reader.read("!L")[0] |
| 6784 | _stats_type = reader.read("!H")[0] |
| 6785 | assert(_stats_type == 6) |
| 6786 | obj.flags = reader.read("!H")[0] |
| 6787 | reader.skip(4) |
| 6788 | obj.entries = loxi.generic_util.unpack_list(reader, common.group_stats_entry.unpack) |
| 6789 | return obj |
| 6790 | |
| 6791 | def __eq__(self, other): |
| 6792 | if type(self) != type(other): return False |
| 6793 | if self.xid != other.xid: return False |
| 6794 | if self.flags != other.flags: return False |
| 6795 | if self.entries != other.entries: return False |
| 6796 | return True |
| 6797 | |
| 6798 | def pretty_print(self, q): |
| 6799 | q.text("group_stats_reply {") |
| 6800 | with q.group(): |
| 6801 | with q.indent(2): |
| 6802 | q.breakable() |
| 6803 | q.text("xid = "); |
| 6804 | if self.xid != None: |
| 6805 | q.text("%#x" % self.xid) |
| 6806 | else: |
| 6807 | q.text('None') |
| 6808 | q.text(","); q.breakable() |
| 6809 | q.text("flags = "); |
| 6810 | q.text("%#x" % self.flags) |
| 6811 | q.text(","); q.breakable() |
| 6812 | q.text("entries = "); |
| 6813 | q.pp(self.entries) |
| 6814 | q.breakable() |
| 6815 | q.text('}') |
| 6816 | |
| 6817 | stats_reply.subtypes[6] = group_stats_reply |
| 6818 | |
| 6819 | class group_stats_request(stats_request): |
| 6820 | version = 5 |
| 6821 | type = 18 |
| 6822 | stats_type = 6 |
| 6823 | |
| 6824 | def __init__(self, xid=None, flags=None, group_id=None): |
| 6825 | if xid != None: |
| 6826 | self.xid = xid |
| 6827 | else: |
| 6828 | self.xid = None |
| 6829 | if flags != None: |
| 6830 | self.flags = flags |
| 6831 | else: |
| 6832 | self.flags = 0 |
| 6833 | if group_id != None: |
| 6834 | self.group_id = group_id |
| 6835 | else: |
| 6836 | self.group_id = 0 |
| 6837 | return |
| 6838 | |
| 6839 | def pack(self): |
| 6840 | packed = [] |
| 6841 | packed.append(struct.pack("!B", self.version)) |
| 6842 | packed.append(struct.pack("!B", self.type)) |
| 6843 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6844 | packed.append(struct.pack("!L", self.xid)) |
| 6845 | packed.append(struct.pack("!H", self.stats_type)) |
| 6846 | packed.append(struct.pack("!H", self.flags)) |
| 6847 | packed.append('\x00' * 4) |
| 6848 | packed.append(struct.pack("!L", self.group_id)) |
| 6849 | packed.append('\x00' * 4) |
| 6850 | length = sum([len(x) for x in packed]) |
| 6851 | packed[2] = struct.pack("!H", length) |
| 6852 | return ''.join(packed) |
| 6853 | |
| 6854 | @staticmethod |
| 6855 | def unpack(reader): |
| 6856 | obj = group_stats_request() |
| 6857 | _version = reader.read("!B")[0] |
| 6858 | assert(_version == 5) |
| 6859 | _type = reader.read("!B")[0] |
| 6860 | assert(_type == 18) |
| 6861 | _length = reader.read("!H")[0] |
| 6862 | orig_reader = reader |
| 6863 | reader = orig_reader.slice(_length - (2 + 2)) |
| 6864 | obj.xid = reader.read("!L")[0] |
| 6865 | _stats_type = reader.read("!H")[0] |
| 6866 | assert(_stats_type == 6) |
| 6867 | obj.flags = reader.read("!H")[0] |
| 6868 | reader.skip(4) |
| 6869 | obj.group_id = reader.read("!L")[0] |
| 6870 | reader.skip(4) |
| 6871 | return obj |
| 6872 | |
| 6873 | def __eq__(self, other): |
| 6874 | if type(self) != type(other): return False |
| 6875 | if self.xid != other.xid: return False |
| 6876 | if self.flags != other.flags: return False |
| 6877 | if self.group_id != other.group_id: return False |
| 6878 | return True |
| 6879 | |
| 6880 | def pretty_print(self, q): |
| 6881 | q.text("group_stats_request {") |
| 6882 | with q.group(): |
| 6883 | with q.indent(2): |
| 6884 | q.breakable() |
| 6885 | q.text("xid = "); |
| 6886 | if self.xid != None: |
| 6887 | q.text("%#x" % self.xid) |
| 6888 | else: |
| 6889 | q.text('None') |
| 6890 | q.text(","); q.breakable() |
| 6891 | q.text("flags = "); |
| 6892 | q.text("%#x" % self.flags) |
| 6893 | q.text(","); q.breakable() |
| 6894 | q.text("group_id = "); |
| 6895 | q.text("%#x" % self.group_id) |
| 6896 | q.breakable() |
| 6897 | q.text('}') |
| 6898 | |
| 6899 | stats_request.subtypes[6] = group_stats_request |
| 6900 | |
| 6901 | class hello(message): |
| 6902 | version = 5 |
| 6903 | type = 0 |
| 6904 | |
| 6905 | def __init__(self, xid=None, elements=None): |
| 6906 | if xid != None: |
| 6907 | self.xid = xid |
| 6908 | else: |
| 6909 | self.xid = None |
| 6910 | if elements != None: |
| 6911 | self.elements = elements |
| 6912 | else: |
| 6913 | self.elements = [] |
| 6914 | return |
| 6915 | |
| 6916 | def pack(self): |
| 6917 | packed = [] |
| 6918 | packed.append(struct.pack("!B", self.version)) |
| 6919 | packed.append(struct.pack("!B", self.type)) |
| 6920 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6921 | packed.append(struct.pack("!L", self.xid)) |
| 6922 | packed.append(loxi.generic_util.pack_list(self.elements)) |
| 6923 | length = sum([len(x) for x in packed]) |
| 6924 | packed[2] = struct.pack("!H", length) |
| 6925 | return ''.join(packed) |
| 6926 | |
| 6927 | @staticmethod |
| 6928 | def unpack(reader): |
| 6929 | obj = hello() |
| 6930 | _version = reader.read("!B")[0] |
| 6931 | assert(_version == 5) |
| 6932 | _type = reader.read("!B")[0] |
| 6933 | assert(_type == 0) |
| 6934 | _length = reader.read("!H")[0] |
| 6935 | orig_reader = reader |
| 6936 | reader = orig_reader.slice(_length - (2 + 2)) |
| 6937 | obj.xid = reader.read("!L")[0] |
| 6938 | obj.elements = loxi.generic_util.unpack_list(reader, common.hello_elem.unpack) |
| 6939 | return obj |
| 6940 | |
| 6941 | def __eq__(self, other): |
| 6942 | if type(self) != type(other): return False |
| 6943 | if self.xid != other.xid: return False |
| 6944 | if self.elements != other.elements: return False |
| 6945 | return True |
| 6946 | |
| 6947 | def pretty_print(self, q): |
| 6948 | q.text("hello {") |
| 6949 | with q.group(): |
| 6950 | with q.indent(2): |
| 6951 | q.breakable() |
| 6952 | q.text("xid = "); |
| 6953 | if self.xid != None: |
| 6954 | q.text("%#x" % self.xid) |
| 6955 | else: |
| 6956 | q.text('None') |
| 6957 | q.text(","); q.breakable() |
| 6958 | q.text("elements = "); |
| 6959 | q.pp(self.elements) |
| 6960 | q.breakable() |
| 6961 | q.text('}') |
| 6962 | |
| 6963 | message.subtypes[0] = hello |
| 6964 | |
| 6965 | class hello_failed_error_msg(error_msg): |
| 6966 | version = 5 |
| 6967 | type = 1 |
| 6968 | err_type = 0 |
| 6969 | |
| 6970 | def __init__(self, xid=None, code=None, data=None): |
| 6971 | if xid != None: |
| 6972 | self.xid = xid |
| 6973 | else: |
| 6974 | self.xid = None |
| 6975 | if code != None: |
| 6976 | self.code = code |
| 6977 | else: |
| 6978 | self.code = 0 |
| 6979 | if data != None: |
| 6980 | self.data = data |
| 6981 | else: |
| 6982 | self.data = '' |
| 6983 | return |
| 6984 | |
| 6985 | def pack(self): |
| 6986 | packed = [] |
| 6987 | packed.append(struct.pack("!B", self.version)) |
| 6988 | packed.append(struct.pack("!B", self.type)) |
| 6989 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6990 | packed.append(struct.pack("!L", self.xid)) |
| 6991 | packed.append(struct.pack("!H", self.err_type)) |
| 6992 | packed.append(struct.pack("!H", self.code)) |
| 6993 | packed.append(self.data) |
| 6994 | length = sum([len(x) for x in packed]) |
| 6995 | packed[2] = struct.pack("!H", length) |
| 6996 | return ''.join(packed) |
| 6997 | |
| 6998 | @staticmethod |
| 6999 | def unpack(reader): |
| 7000 | obj = hello_failed_error_msg() |
| 7001 | _version = reader.read("!B")[0] |
| 7002 | assert(_version == 5) |
| 7003 | _type = reader.read("!B")[0] |
| 7004 | assert(_type == 1) |
| 7005 | _length = reader.read("!H")[0] |
| 7006 | orig_reader = reader |
| 7007 | reader = orig_reader.slice(_length - (2 + 2)) |
| 7008 | obj.xid = reader.read("!L")[0] |
| 7009 | _err_type = reader.read("!H")[0] |
| 7010 | assert(_err_type == 0) |
| 7011 | obj.code = reader.read("!H")[0] |
| 7012 | obj.data = str(reader.read_all()) |
| 7013 | return obj |
| 7014 | |
| 7015 | def __eq__(self, other): |
| 7016 | if type(self) != type(other): return False |
| 7017 | if self.xid != other.xid: return False |
| 7018 | if self.code != other.code: return False |
| 7019 | if self.data != other.data: return False |
| 7020 | return True |
| 7021 | |
| 7022 | def pretty_print(self, q): |
| 7023 | q.text("hello_failed_error_msg {") |
| 7024 | with q.group(): |
| 7025 | with q.indent(2): |
| 7026 | q.breakable() |
| 7027 | q.text("xid = "); |
| 7028 | if self.xid != None: |
| 7029 | q.text("%#x" % self.xid) |
| 7030 | else: |
| 7031 | q.text('None') |
| 7032 | q.text(","); q.breakable() |
| 7033 | q.text("code = "); |
| 7034 | q.text("%#x" % self.code) |
| 7035 | q.text(","); q.breakable() |
| 7036 | q.text("data = "); |
| 7037 | q.pp(self.data) |
| 7038 | q.breakable() |
| 7039 | q.text('}') |
| 7040 | |
| 7041 | error_msg.subtypes[0] = hello_failed_error_msg |
| 7042 | |
| 7043 | class meter_config_stats_reply(stats_reply): |
| 7044 | version = 5 |
| 7045 | type = 19 |
| 7046 | stats_type = 10 |
| 7047 | |
| 7048 | def __init__(self, xid=None, flags=None, entries=None): |
| 7049 | if xid != None: |
| 7050 | self.xid = xid |
| 7051 | else: |
| 7052 | self.xid = None |
| 7053 | if flags != None: |
| 7054 | self.flags = flags |
| 7055 | else: |
| 7056 | self.flags = 0 |
| 7057 | if entries != None: |
| 7058 | self.entries = entries |
| 7059 | else: |
| 7060 | self.entries = [] |
| 7061 | return |
| 7062 | |
| 7063 | def pack(self): |
| 7064 | packed = [] |
| 7065 | packed.append(struct.pack("!B", self.version)) |
| 7066 | packed.append(struct.pack("!B", self.type)) |
| 7067 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7068 | packed.append(struct.pack("!L", self.xid)) |
| 7069 | packed.append(struct.pack("!H", self.stats_type)) |
| 7070 | packed.append(struct.pack("!H", self.flags)) |
| 7071 | packed.append('\x00' * 4) |
| 7072 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 7073 | length = sum([len(x) for x in packed]) |
| 7074 | packed[2] = struct.pack("!H", length) |
| 7075 | return ''.join(packed) |
| 7076 | |
| 7077 | @staticmethod |
| 7078 | def unpack(reader): |
| 7079 | obj = meter_config_stats_reply() |
| 7080 | _version = reader.read("!B")[0] |
| 7081 | assert(_version == 5) |
| 7082 | _type = reader.read("!B")[0] |
| 7083 | assert(_type == 19) |
| 7084 | _length = reader.read("!H")[0] |
| 7085 | orig_reader = reader |
| 7086 | reader = orig_reader.slice(_length - (2 + 2)) |
| 7087 | obj.xid = reader.read("!L")[0] |
| 7088 | _stats_type = reader.read("!H")[0] |
| 7089 | assert(_stats_type == 10) |
| 7090 | obj.flags = reader.read("!H")[0] |
| 7091 | reader.skip(4) |
| 7092 | obj.entries = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack) |
| 7093 | return obj |
| 7094 | |
| 7095 | def __eq__(self, other): |
| 7096 | if type(self) != type(other): return False |
| 7097 | if self.xid != other.xid: return False |
| 7098 | if self.flags != other.flags: return False |
| 7099 | if self.entries != other.entries: return False |
| 7100 | return True |
| 7101 | |
| 7102 | def pretty_print(self, q): |
| 7103 | q.text("meter_config_stats_reply {") |
| 7104 | with q.group(): |
| 7105 | with q.indent(2): |
| 7106 | q.breakable() |
| 7107 | q.text("xid = "); |
| 7108 | if self.xid != None: |
| 7109 | q.text("%#x" % self.xid) |
| 7110 | else: |
| 7111 | q.text('None') |
| 7112 | q.text(","); q.breakable() |
| 7113 | q.text("flags = "); |
| 7114 | q.text("%#x" % self.flags) |
| 7115 | q.text(","); q.breakable() |
| 7116 | q.text("entries = "); |
| 7117 | q.pp(self.entries) |
| 7118 | q.breakable() |
| 7119 | q.text('}') |
| 7120 | |
| 7121 | stats_reply.subtypes[10] = meter_config_stats_reply |
| 7122 | |
| 7123 | class meter_config_stats_request(stats_request): |
| 7124 | version = 5 |
| 7125 | type = 18 |
| 7126 | stats_type = 10 |
| 7127 | |
| 7128 | def __init__(self, xid=None, flags=None, meter_id=None): |
| 7129 | if xid != None: |
| 7130 | self.xid = xid |
| 7131 | else: |
| 7132 | self.xid = None |
| 7133 | if flags != None: |
| 7134 | self.flags = flags |
| 7135 | else: |
| 7136 | self.flags = 0 |
| 7137 | if meter_id != None: |
| 7138 | self.meter_id = meter_id |
| 7139 | else: |
| 7140 | self.meter_id = 0 |
| 7141 | return |
| 7142 | |
| 7143 | def pack(self): |
| 7144 | packed = [] |
| 7145 | packed.append(struct.pack("!B", self.version)) |
| 7146 | packed.append(struct.pack("!B", self.type)) |
| 7147 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7148 | packed.append(struct.pack("!L", self.xid)) |
| 7149 | packed.append(struct.pack("!H", self.stats_type)) |
| 7150 | packed.append(struct.pack("!H", self.flags)) |
| 7151 | packed.append('\x00' * 4) |
| 7152 | packed.append(struct.pack("!L", self.meter_id)) |
| 7153 | packed.append('\x00' * 4) |
| 7154 | length = sum([len(x) for x in packed]) |
| 7155 | packed[2] = struct.pack("!H", length) |
| 7156 | return ''.join(packed) |
| 7157 | |
| 7158 | @staticmethod |
| 7159 | def unpack(reader): |
| 7160 | obj = meter_config_stats_request() |
| 7161 | _version = reader.read("!B")[0] |
| 7162 | assert(_version == 5) |
| 7163 | _type = reader.read("!B")[0] |
| 7164 | assert(_type == 18) |
| 7165 | _length = reader.read("!H")[0] |
| 7166 | orig_reader = reader |
| 7167 | reader = orig_reader.slice(_length - (2 + 2)) |
| 7168 | obj.xid = reader.read("!L")[0] |
| 7169 | _stats_type = reader.read("!H")[0] |
| 7170 | assert(_stats_type == 10) |
| 7171 | obj.flags = reader.read("!H")[0] |
| 7172 | reader.skip(4) |
| 7173 | obj.meter_id = reader.read("!L")[0] |
| 7174 | reader.skip(4) |
| 7175 | return obj |
| 7176 | |
| 7177 | def __eq__(self, other): |
| 7178 | if type(self) != type(other): return False |
| 7179 | if self.xid != other.xid: return False |
| 7180 | if self.flags != other.flags: return False |
| 7181 | if self.meter_id != other.meter_id: return False |
| 7182 | return True |
| 7183 | |
| 7184 | def pretty_print(self, q): |
| 7185 | q.text("meter_config_stats_request {") |
| 7186 | with q.group(): |
| 7187 | with q.indent(2): |
| 7188 | q.breakable() |
| 7189 | q.text("xid = "); |
| 7190 | if self.xid != None: |
| 7191 | q.text("%#x" % self.xid) |
| 7192 | else: |
| 7193 | q.text('None') |
| 7194 | q.text(","); q.breakable() |
| 7195 | q.text("flags = "); |
| 7196 | q.text("%#x" % self.flags) |
| 7197 | q.text(","); q.breakable() |
| 7198 | q.text("meter_id = "); |
| 7199 | q.text("%#x" % self.meter_id) |
| 7200 | q.breakable() |
| 7201 | q.text('}') |
| 7202 | |
| 7203 | stats_request.subtypes[10] = meter_config_stats_request |
| 7204 | |
| 7205 | class meter_features_stats_reply(stats_reply): |
| 7206 | version = 5 |
| 7207 | type = 19 |
| 7208 | stats_type = 11 |
| 7209 | |
| 7210 | def __init__(self, xid=None, flags=None, features=None): |
| 7211 | if xid != None: |
| 7212 | self.xid = xid |
| 7213 | else: |
| 7214 | self.xid = None |
| 7215 | if flags != None: |
| 7216 | self.flags = flags |
| 7217 | else: |
| 7218 | self.flags = 0 |
| 7219 | if features != None: |
| 7220 | self.features = features |
| 7221 | else: |
| 7222 | self.features = common.meter_features() |
| 7223 | return |
| 7224 | |
| 7225 | def pack(self): |
| 7226 | packed = [] |
| 7227 | packed.append(struct.pack("!B", self.version)) |
| 7228 | packed.append(struct.pack("!B", self.type)) |
| 7229 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7230 | packed.append(struct.pack("!L", self.xid)) |
| 7231 | packed.append(struct.pack("!H", self.stats_type)) |
| 7232 | packed.append(struct.pack("!H", self.flags)) |
| 7233 | packed.append('\x00' * 4) |
| 7234 | packed.append(self.features.pack()) |
| 7235 | length = sum([len(x) for x in packed]) |
| 7236 | packed[2] = struct.pack("!H", length) |
| 7237 | return ''.join(packed) |
| 7238 | |
| 7239 | @staticmethod |
| 7240 | def unpack(reader): |
| 7241 | obj = meter_features_stats_reply() |
| 7242 | _version = reader.read("!B")[0] |
| 7243 | assert(_version == 5) |
| 7244 | _type = reader.read("!B")[0] |
| 7245 | assert(_type == 19) |
| 7246 | _length = reader.read("!H")[0] |
| 7247 | orig_reader = reader |
| 7248 | reader = orig_reader.slice(_length - (2 + 2)) |
| 7249 | obj.xid = reader.read("!L")[0] |
| 7250 | _stats_type = reader.read("!H")[0] |
| 7251 | assert(_stats_type == 11) |
| 7252 | obj.flags = reader.read("!H")[0] |
| 7253 | reader.skip(4) |
| 7254 | obj.features = common.meter_features.unpack(reader) |
| 7255 | return obj |
| 7256 | |
| 7257 | def __eq__(self, other): |
| 7258 | if type(self) != type(other): return False |
| 7259 | if self.xid != other.xid: return False |
| 7260 | if self.flags != other.flags: return False |
| 7261 | if self.features != other.features: return False |
| 7262 | return True |
| 7263 | |
| 7264 | def pretty_print(self, q): |
| 7265 | q.text("meter_features_stats_reply {") |
| 7266 | with q.group(): |
| 7267 | with q.indent(2): |
| 7268 | q.breakable() |
| 7269 | q.text("xid = "); |
| 7270 | if self.xid != None: |
| 7271 | q.text("%#x" % self.xid) |
| 7272 | else: |
| 7273 | q.text('None') |
| 7274 | q.text(","); q.breakable() |
| 7275 | q.text("flags = "); |
| 7276 | q.text("%#x" % self.flags) |
| 7277 | q.text(","); q.breakable() |
| 7278 | q.text("features = "); |
| 7279 | q.pp(self.features) |
| 7280 | q.breakable() |
| 7281 | q.text('}') |
| 7282 | |
| 7283 | stats_reply.subtypes[11] = meter_features_stats_reply |
| 7284 | |
| 7285 | class meter_features_stats_request(stats_request): |
| 7286 | version = 5 |
| 7287 | type = 18 |
| 7288 | stats_type = 11 |
| 7289 | |
| 7290 | def __init__(self, xid=None, flags=None): |
| 7291 | if xid != None: |
| 7292 | self.xid = xid |
| 7293 | else: |
| 7294 | self.xid = None |
| 7295 | if flags != None: |
| 7296 | self.flags = flags |
| 7297 | else: |
| 7298 | self.flags = 0 |
| 7299 | return |
| 7300 | |
| 7301 | def pack(self): |
| 7302 | packed = [] |
| 7303 | packed.append(struct.pack("!B", self.version)) |
| 7304 | packed.append(struct.pack("!B", self.type)) |
| 7305 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7306 | packed.append(struct.pack("!L", self.xid)) |
| 7307 | packed.append(struct.pack("!H", self.stats_type)) |
| 7308 | packed.append(struct.pack("!H", self.flags)) |
| 7309 | packed.append('\x00' * 4) |
| 7310 | length = sum([len(x) for x in packed]) |
| 7311 | packed[2] = struct.pack("!H", length) |
| 7312 | return ''.join(packed) |
| 7313 | |
| 7314 | @staticmethod |
| 7315 | def unpack(reader): |
| 7316 | obj = meter_features_stats_request() |
| 7317 | _version = reader.read("!B")[0] |
| 7318 | assert(_version == 5) |
| 7319 | _type = reader.read("!B")[0] |
| 7320 | assert(_type == 18) |
| 7321 | _length = reader.read("!H")[0] |
| 7322 | orig_reader = reader |
| 7323 | reader = orig_reader.slice(_length - (2 + 2)) |
| 7324 | obj.xid = reader.read("!L")[0] |
| 7325 | _stats_type = reader.read("!H")[0] |
| 7326 | assert(_stats_type == 11) |
| 7327 | obj.flags = reader.read("!H")[0] |
| 7328 | reader.skip(4) |
| 7329 | return obj |
| 7330 | |
| 7331 | def __eq__(self, other): |
| 7332 | if type(self) != type(other): return False |
| 7333 | if self.xid != other.xid: return False |
| 7334 | if self.flags != other.flags: return False |
| 7335 | return True |
| 7336 | |
| 7337 | def pretty_print(self, q): |
| 7338 | q.text("meter_features_stats_request {") |
| 7339 | with q.group(): |
| 7340 | with q.indent(2): |
| 7341 | q.breakable() |
| 7342 | q.text("xid = "); |
| 7343 | if self.xid != None: |
| 7344 | q.text("%#x" % self.xid) |
| 7345 | else: |
| 7346 | q.text('None') |
| 7347 | q.text(","); q.breakable() |
| 7348 | q.text("flags = "); |
| 7349 | q.text("%#x" % self.flags) |
| 7350 | q.breakable() |
| 7351 | q.text('}') |
| 7352 | |
| 7353 | stats_request.subtypes[11] = meter_features_stats_request |
| 7354 | |
| 7355 | class meter_mod(message): |
| 7356 | version = 5 |
| 7357 | type = 29 |
| 7358 | |
| 7359 | def __init__(self, xid=None, command=None, flags=None, meter_id=None, bands=None): |
| 7360 | if xid != None: |
| 7361 | self.xid = xid |
| 7362 | else: |
| 7363 | self.xid = None |
| 7364 | if command != None: |
| 7365 | self.command = command |
| 7366 | else: |
| 7367 | self.command = 0 |
| 7368 | if flags != None: |
| 7369 | self.flags = flags |
| 7370 | else: |
| 7371 | self.flags = 0 |
| 7372 | if meter_id != None: |
| 7373 | self.meter_id = meter_id |
| 7374 | else: |
| 7375 | self.meter_id = 0 |
| 7376 | if bands != None: |
| 7377 | self.bands = bands |
| 7378 | else: |
| 7379 | self.bands = [] |
| 7380 | return |
| 7381 | |
| 7382 | def pack(self): |
| 7383 | packed = [] |
| 7384 | packed.append(struct.pack("!B", self.version)) |
| 7385 | packed.append(struct.pack("!B", self.type)) |
| 7386 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7387 | packed.append(struct.pack("!L", self.xid)) |
| 7388 | packed.append(struct.pack("!H", self.command)) |
| 7389 | packed.append(struct.pack("!H", self.flags)) |
| 7390 | packed.append(struct.pack("!L", self.meter_id)) |
| 7391 | packed.append(loxi.generic_util.pack_list(self.bands)) |
| 7392 | length = sum([len(x) for x in packed]) |
| 7393 | packed[2] = struct.pack("!H", length) |
| 7394 | return ''.join(packed) |
| 7395 | |
| 7396 | @staticmethod |
| 7397 | def unpack(reader): |
| 7398 | obj = meter_mod() |
| 7399 | _version = reader.read("!B")[0] |
| 7400 | assert(_version == 5) |
| 7401 | _type = reader.read("!B")[0] |
| 7402 | assert(_type == 29) |
| 7403 | _length = reader.read("!H")[0] |
| 7404 | orig_reader = reader |
| 7405 | reader = orig_reader.slice(_length - (2 + 2)) |
| 7406 | obj.xid = reader.read("!L")[0] |
| 7407 | obj.command = reader.read("!H")[0] |
| 7408 | obj.flags = reader.read("!H")[0] |
| 7409 | obj.meter_id = reader.read("!L")[0] |
| 7410 | obj.bands = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack) |
| 7411 | return obj |
| 7412 | |
| 7413 | def __eq__(self, other): |
| 7414 | if type(self) != type(other): return False |
| 7415 | if self.xid != other.xid: return False |
| 7416 | if self.command != other.command: return False |
| 7417 | if self.flags != other.flags: return False |
| 7418 | if self.meter_id != other.meter_id: return False |
| 7419 | if self.bands != other.bands: return False |
| 7420 | return True |
| 7421 | |
| 7422 | def pretty_print(self, q): |
| 7423 | q.text("meter_mod {") |
| 7424 | with q.group(): |
| 7425 | with q.indent(2): |
| 7426 | q.breakable() |
| 7427 | q.text("xid = "); |
| 7428 | if self.xid != None: |
| 7429 | q.text("%#x" % self.xid) |
| 7430 | else: |
| 7431 | q.text('None') |
| 7432 | q.text(","); q.breakable() |
| 7433 | q.text("command = "); |
| 7434 | q.text("%#x" % self.command) |
| 7435 | q.text(","); q.breakable() |
| 7436 | q.text("flags = "); |
| 7437 | q.text("%#x" % self.flags) |
| 7438 | q.text(","); q.breakable() |
| 7439 | q.text("meter_id = "); |
| 7440 | q.text("%#x" % self.meter_id) |
| 7441 | q.text(","); q.breakable() |
| 7442 | q.text("bands = "); |
| 7443 | q.pp(self.bands) |
| 7444 | q.breakable() |
| 7445 | q.text('}') |
| 7446 | |
| 7447 | message.subtypes[29] = meter_mod |
| 7448 | |
| 7449 | class meter_mod_failed_error_msg(error_msg): |
| 7450 | version = 5 |
| 7451 | type = 1 |
| 7452 | err_type = 12 |
| 7453 | |
| 7454 | def __init__(self, xid=None, code=None, data=None): |
| 7455 | if xid != None: |
| 7456 | self.xid = xid |
| 7457 | else: |
| 7458 | self.xid = None |
| 7459 | if code != None: |
| 7460 | self.code = code |
| 7461 | else: |
| 7462 | self.code = 0 |
| 7463 | if data != None: |
| 7464 | self.data = data |
| 7465 | else: |
| 7466 | self.data = '' |
| 7467 | return |
| 7468 | |
| 7469 | def pack(self): |
| 7470 | packed = [] |
| 7471 | packed.append(struct.pack("!B", self.version)) |
| 7472 | packed.append(struct.pack("!B", self.type)) |
| 7473 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7474 | packed.append(struct.pack("!L", self.xid)) |
| 7475 | packed.append(struct.pack("!H", self.err_type)) |
| 7476 | packed.append(struct.pack("!H", self.code)) |
| 7477 | packed.append(self.data) |
| 7478 | length = sum([len(x) for x in packed]) |
| 7479 | packed[2] = struct.pack("!H", length) |
| 7480 | return ''.join(packed) |
| 7481 | |
| 7482 | @staticmethod |
| 7483 | def unpack(reader): |
| 7484 | obj = meter_mod_failed_error_msg() |
| 7485 | _version = reader.read("!B")[0] |
| 7486 | assert(_version == 5) |
| 7487 | _type = reader.read("!B")[0] |
| 7488 | assert(_type == 1) |
| 7489 | _length = reader.read("!H")[0] |
| 7490 | orig_reader = reader |
| 7491 | reader = orig_reader.slice(_length - (2 + 2)) |
| 7492 | obj.xid = reader.read("!L")[0] |
| 7493 | _err_type = reader.read("!H")[0] |
| 7494 | assert(_err_type == 12) |
| 7495 | obj.code = reader.read("!H")[0] |
| 7496 | obj.data = str(reader.read_all()) |
| 7497 | return obj |
| 7498 | |
| 7499 | def __eq__(self, other): |
| 7500 | if type(self) != type(other): return False |
| 7501 | if self.xid != other.xid: return False |
| 7502 | if self.code != other.code: return False |
| 7503 | if self.data != other.data: return False |
| 7504 | return True |
| 7505 | |
| 7506 | def pretty_print(self, q): |
| 7507 | q.text("meter_mod_failed_error_msg {") |
| 7508 | with q.group(): |
| 7509 | with q.indent(2): |
| 7510 | q.breakable() |
| 7511 | q.text("xid = "); |
| 7512 | if self.xid != None: |
| 7513 | q.text("%#x" % self.xid) |
| 7514 | else: |
| 7515 | q.text('None') |
| 7516 | q.text(","); q.breakable() |
| 7517 | q.text("code = "); |
| 7518 | q.text("%#x" % self.code) |
| 7519 | q.text(","); q.breakable() |
| 7520 | q.text("data = "); |
| 7521 | q.pp(self.data) |
| 7522 | q.breakable() |
| 7523 | q.text('}') |
| 7524 | |
| 7525 | error_msg.subtypes[12] = meter_mod_failed_error_msg |
| 7526 | |
| 7527 | class meter_stats_reply(stats_reply): |
| 7528 | version = 5 |
| 7529 | type = 19 |
| 7530 | stats_type = 9 |
| 7531 | |
| 7532 | def __init__(self, xid=None, flags=None, entries=None): |
| 7533 | if xid != None: |
| 7534 | self.xid = xid |
| 7535 | else: |
| 7536 | self.xid = None |
| 7537 | if flags != None: |
| 7538 | self.flags = flags |
| 7539 | else: |
| 7540 | self.flags = 0 |
| 7541 | if entries != None: |
| 7542 | self.entries = entries |
| 7543 | else: |
| 7544 | self.entries = [] |
| 7545 | return |
| 7546 | |
| 7547 | def pack(self): |
| 7548 | packed = [] |
| 7549 | packed.append(struct.pack("!B", self.version)) |
| 7550 | packed.append(struct.pack("!B", self.type)) |
| 7551 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7552 | packed.append(struct.pack("!L", self.xid)) |
| 7553 | packed.append(struct.pack("!H", self.stats_type)) |
| 7554 | packed.append(struct.pack("!H", self.flags)) |
| 7555 | packed.append('\x00' * 4) |
| 7556 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 7557 | length = sum([len(x) for x in packed]) |
| 7558 | packed[2] = struct.pack("!H", length) |
| 7559 | return ''.join(packed) |
| 7560 | |
| 7561 | @staticmethod |
| 7562 | def unpack(reader): |
| 7563 | obj = meter_stats_reply() |
| 7564 | _version = reader.read("!B")[0] |
| 7565 | assert(_version == 5) |
| 7566 | _type = reader.read("!B")[0] |
| 7567 | assert(_type == 19) |
| 7568 | _length = reader.read("!H")[0] |
| 7569 | orig_reader = reader |
| 7570 | reader = orig_reader.slice(_length - (2 + 2)) |
| 7571 | obj.xid = reader.read("!L")[0] |
| 7572 | _stats_type = reader.read("!H")[0] |
| 7573 | assert(_stats_type == 9) |
| 7574 | obj.flags = reader.read("!H")[0] |
| 7575 | reader.skip(4) |
| 7576 | obj.entries = loxi.generic_util.unpack_list(reader, common.meter_stats.unpack) |
| 7577 | return obj |
| 7578 | |
| 7579 | def __eq__(self, other): |
| 7580 | if type(self) != type(other): return False |
| 7581 | if self.xid != other.xid: return False |
| 7582 | if self.flags != other.flags: return False |
| 7583 | if self.entries != other.entries: return False |
| 7584 | return True |
| 7585 | |
| 7586 | def pretty_print(self, q): |
| 7587 | q.text("meter_stats_reply {") |
| 7588 | with q.group(): |
| 7589 | with q.indent(2): |
| 7590 | q.breakable() |
| 7591 | q.text("xid = "); |
| 7592 | if self.xid != None: |
| 7593 | q.text("%#x" % self.xid) |
| 7594 | else: |
| 7595 | q.text('None') |
| 7596 | q.text(","); q.breakable() |
| 7597 | q.text("flags = "); |
| 7598 | q.text("%#x" % self.flags) |
| 7599 | q.text(","); q.breakable() |
| 7600 | q.text("entries = "); |
| 7601 | q.pp(self.entries) |
| 7602 | q.breakable() |
| 7603 | q.text('}') |
| 7604 | |
| 7605 | stats_reply.subtypes[9] = meter_stats_reply |
| 7606 | |
| 7607 | class meter_stats_request(stats_request): |
| 7608 | version = 5 |
| 7609 | type = 18 |
| 7610 | stats_type = 9 |
| 7611 | |
| 7612 | def __init__(self, xid=None, flags=None, meter_id=None): |
| 7613 | if xid != None: |
| 7614 | self.xid = xid |
| 7615 | else: |
| 7616 | self.xid = None |
| 7617 | if flags != None: |
| 7618 | self.flags = flags |
| 7619 | else: |
| 7620 | self.flags = 0 |
| 7621 | if meter_id != None: |
| 7622 | self.meter_id = meter_id |
| 7623 | else: |
| 7624 | self.meter_id = 0 |
| 7625 | return |
| 7626 | |
| 7627 | def pack(self): |
| 7628 | packed = [] |
| 7629 | packed.append(struct.pack("!B", self.version)) |
| 7630 | packed.append(struct.pack("!B", self.type)) |
| 7631 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7632 | packed.append(struct.pack("!L", self.xid)) |
| 7633 | packed.append(struct.pack("!H", self.stats_type)) |
| 7634 | packed.append(struct.pack("!H", self.flags)) |
| 7635 | packed.append('\x00' * 4) |
| 7636 | packed.append(struct.pack("!L", self.meter_id)) |
| 7637 | packed.append('\x00' * 4) |
| 7638 | length = sum([len(x) for x in packed]) |
| 7639 | packed[2] = struct.pack("!H", length) |
| 7640 | return ''.join(packed) |
| 7641 | |
| 7642 | @staticmethod |
| 7643 | def unpack(reader): |
| 7644 | obj = meter_stats_request() |
| 7645 | _version = reader.read("!B")[0] |
| 7646 | assert(_version == 5) |
| 7647 | _type = reader.read("!B")[0] |
| 7648 | assert(_type == 18) |
| 7649 | _length = reader.read("!H")[0] |
| 7650 | orig_reader = reader |
| 7651 | reader = orig_reader.slice(_length - (2 + 2)) |
| 7652 | obj.xid = reader.read("!L")[0] |
| 7653 | _stats_type = reader.read("!H")[0] |
| 7654 | assert(_stats_type == 9) |
| 7655 | obj.flags = reader.read("!H")[0] |
| 7656 | reader.skip(4) |
| 7657 | obj.meter_id = reader.read("!L")[0] |
| 7658 | reader.skip(4) |
| 7659 | return obj |
| 7660 | |
| 7661 | def __eq__(self, other): |
| 7662 | if type(self) != type(other): return False |
| 7663 | if self.xid != other.xid: return False |
| 7664 | if self.flags != other.flags: return False |
| 7665 | if self.meter_id != other.meter_id: return False |
| 7666 | return True |
| 7667 | |
| 7668 | def pretty_print(self, q): |
| 7669 | q.text("meter_stats_request {") |
| 7670 | with q.group(): |
| 7671 | with q.indent(2): |
| 7672 | q.breakable() |
| 7673 | q.text("xid = "); |
| 7674 | if self.xid != None: |
| 7675 | q.text("%#x" % self.xid) |
| 7676 | else: |
| 7677 | q.text('None') |
| 7678 | q.text(","); q.breakable() |
| 7679 | q.text("flags = "); |
| 7680 | q.text("%#x" % self.flags) |
| 7681 | q.text(","); q.breakable() |
| 7682 | q.text("meter_id = "); |
| 7683 | q.text("%#x" % self.meter_id) |
| 7684 | q.breakable() |
| 7685 | q.text('}') |
| 7686 | |
| 7687 | stats_request.subtypes[9] = meter_stats_request |
| 7688 | |
| 7689 | class nicira_header(experimenter): |
| 7690 | subtypes = {} |
| 7691 | |
| 7692 | version = 5 |
| 7693 | type = 4 |
| 7694 | experimenter = 8992 |
| 7695 | |
| 7696 | def __init__(self, xid=None, subtype=None): |
| 7697 | if xid != None: |
| 7698 | self.xid = xid |
| 7699 | else: |
| 7700 | self.xid = None |
| 7701 | if subtype != None: |
| 7702 | self.subtype = subtype |
| 7703 | else: |
| 7704 | self.subtype = 0 |
| 7705 | return |
| 7706 | |
| 7707 | def pack(self): |
| 7708 | packed = [] |
| 7709 | packed.append(struct.pack("!B", self.version)) |
| 7710 | packed.append(struct.pack("!B", self.type)) |
| 7711 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7712 | packed.append(struct.pack("!L", self.xid)) |
| 7713 | packed.append(struct.pack("!L", self.experimenter)) |
| 7714 | packed.append(struct.pack("!L", self.subtype)) |
| 7715 | length = sum([len(x) for x in packed]) |
| 7716 | packed[2] = struct.pack("!H", length) |
| 7717 | return ''.join(packed) |
| 7718 | |
| 7719 | @staticmethod |
| 7720 | def unpack(reader): |
| 7721 | subtype, = reader.peek('!L', 12) |
| 7722 | subclass = nicira_header.subtypes.get(subtype) |
| 7723 | if subclass: |
| 7724 | return subclass.unpack(reader) |
| 7725 | |
| 7726 | obj = nicira_header() |
| 7727 | _version = reader.read("!B")[0] |
| 7728 | assert(_version == 5) |
| 7729 | _type = reader.read("!B")[0] |
| 7730 | assert(_type == 4) |
| 7731 | _length = reader.read("!H")[0] |
| 7732 | orig_reader = reader |
| 7733 | reader = orig_reader.slice(_length - (2 + 2)) |
| 7734 | obj.xid = reader.read("!L")[0] |
| 7735 | _experimenter = reader.read("!L")[0] |
| 7736 | assert(_experimenter == 8992) |
| 7737 | obj.subtype = reader.read("!L")[0] |
| 7738 | return obj |
| 7739 | |
| 7740 | def __eq__(self, other): |
| 7741 | if type(self) != type(other): return False |
| 7742 | if self.xid != other.xid: return False |
| 7743 | if self.subtype != other.subtype: return False |
| 7744 | return True |
| 7745 | |
| 7746 | def pretty_print(self, q): |
| 7747 | q.text("nicira_header {") |
| 7748 | with q.group(): |
| 7749 | with q.indent(2): |
| 7750 | q.breakable() |
| 7751 | q.text("xid = "); |
| 7752 | if self.xid != None: |
| 7753 | q.text("%#x" % self.xid) |
| 7754 | else: |
| 7755 | q.text('None') |
| 7756 | q.breakable() |
| 7757 | q.text('}') |
| 7758 | |
| 7759 | experimenter.subtypes[8992] = nicira_header |
| 7760 | |
| 7761 | class packet_in(message): |
| 7762 | version = 5 |
| 7763 | type = 10 |
| 7764 | |
| 7765 | def __init__(self, xid=None, buffer_id=None, total_len=None, reason=None, table_id=None, cookie=None, match=None, data=None): |
| 7766 | if xid != None: |
| 7767 | self.xid = xid |
| 7768 | else: |
| 7769 | self.xid = None |
| 7770 | if buffer_id != None: |
| 7771 | self.buffer_id = buffer_id |
| 7772 | else: |
| 7773 | self.buffer_id = 0 |
| 7774 | if total_len != None: |
| 7775 | self.total_len = total_len |
| 7776 | else: |
| 7777 | self.total_len = 0 |
| 7778 | if reason != None: |
| 7779 | self.reason = reason |
| 7780 | else: |
| 7781 | self.reason = 0 |
| 7782 | if table_id != None: |
| 7783 | self.table_id = table_id |
| 7784 | else: |
| 7785 | self.table_id = 0 |
| 7786 | if cookie != None: |
| 7787 | self.cookie = cookie |
| 7788 | else: |
| 7789 | self.cookie = 0 |
| 7790 | if match != None: |
| 7791 | self.match = match |
| 7792 | else: |
| 7793 | self.match = common.match() |
| 7794 | if data != None: |
| 7795 | self.data = data |
| 7796 | else: |
| 7797 | self.data = '' |
| 7798 | return |
| 7799 | |
| 7800 | def pack(self): |
| 7801 | packed = [] |
| 7802 | packed.append(struct.pack("!B", self.version)) |
| 7803 | packed.append(struct.pack("!B", self.type)) |
| 7804 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7805 | packed.append(struct.pack("!L", self.xid)) |
| 7806 | packed.append(struct.pack("!L", self.buffer_id)) |
| 7807 | packed.append(struct.pack("!H", self.total_len)) |
| 7808 | packed.append(struct.pack("!B", self.reason)) |
| 7809 | packed.append(struct.pack("!B", self.table_id)) |
| 7810 | packed.append(struct.pack("!Q", self.cookie)) |
| 7811 | packed.append(self.match.pack()) |
| 7812 | packed.append('\x00' * 2) |
| 7813 | packed.append(self.data) |
| 7814 | length = sum([len(x) for x in packed]) |
| 7815 | packed[2] = struct.pack("!H", length) |
| 7816 | return ''.join(packed) |
| 7817 | |
| 7818 | @staticmethod |
| 7819 | def unpack(reader): |
| 7820 | obj = packet_in() |
| 7821 | _version = reader.read("!B")[0] |
| 7822 | assert(_version == 5) |
| 7823 | _type = reader.read("!B")[0] |
| 7824 | assert(_type == 10) |
| 7825 | _length = reader.read("!H")[0] |
| 7826 | orig_reader = reader |
| 7827 | reader = orig_reader.slice(_length - (2 + 2)) |
| 7828 | obj.xid = reader.read("!L")[0] |
| 7829 | obj.buffer_id = reader.read("!L")[0] |
| 7830 | obj.total_len = reader.read("!H")[0] |
| 7831 | obj.reason = reader.read("!B")[0] |
| 7832 | obj.table_id = reader.read("!B")[0] |
| 7833 | obj.cookie = reader.read("!Q")[0] |
| 7834 | obj.match = common.match.unpack(reader) |
| 7835 | reader.skip(2) |
| 7836 | obj.data = str(reader.read_all()) |
| 7837 | return obj |
| 7838 | |
| 7839 | def __eq__(self, other): |
| 7840 | if type(self) != type(other): return False |
| 7841 | if self.xid != other.xid: return False |
| 7842 | if self.buffer_id != other.buffer_id: return False |
| 7843 | if self.total_len != other.total_len: return False |
| 7844 | if self.reason != other.reason: return False |
| 7845 | if self.table_id != other.table_id: return False |
| 7846 | if self.cookie != other.cookie: return False |
| 7847 | if self.match != other.match: return False |
| 7848 | if self.data != other.data: return False |
| 7849 | return True |
| 7850 | |
| 7851 | def pretty_print(self, q): |
| 7852 | q.text("packet_in {") |
| 7853 | with q.group(): |
| 7854 | with q.indent(2): |
| 7855 | q.breakable() |
| 7856 | q.text("xid = "); |
| 7857 | if self.xid != None: |
| 7858 | q.text("%#x" % self.xid) |
| 7859 | else: |
| 7860 | q.text('None') |
| 7861 | q.text(","); q.breakable() |
| 7862 | q.text("buffer_id = "); |
| 7863 | q.text("%#x" % self.buffer_id) |
| 7864 | q.text(","); q.breakable() |
| 7865 | q.text("total_len = "); |
| 7866 | q.text("%#x" % self.total_len) |
| 7867 | q.text(","); q.breakable() |
| 7868 | q.text("reason = "); |
| 7869 | q.text("%#x" % self.reason) |
| 7870 | q.text(","); q.breakable() |
| 7871 | q.text("table_id = "); |
| 7872 | q.text("%#x" % self.table_id) |
| 7873 | q.text(","); q.breakable() |
| 7874 | q.text("cookie = "); |
| 7875 | q.text("%#x" % self.cookie) |
| 7876 | q.text(","); q.breakable() |
| 7877 | q.text("match = "); |
| 7878 | q.pp(self.match) |
| 7879 | q.text(","); q.breakable() |
| 7880 | q.text("data = "); |
| 7881 | q.pp(self.data) |
| 7882 | q.breakable() |
| 7883 | q.text('}') |
| 7884 | |
| 7885 | message.subtypes[10] = packet_in |
| 7886 | |
| 7887 | class packet_out(message): |
| 7888 | version = 5 |
| 7889 | type = 13 |
| 7890 | |
| 7891 | def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None): |
| 7892 | if xid != None: |
| 7893 | self.xid = xid |
| 7894 | else: |
| 7895 | self.xid = None |
| 7896 | if buffer_id != None: |
| 7897 | self.buffer_id = buffer_id |
| 7898 | else: |
| 7899 | self.buffer_id = 0 |
| 7900 | if in_port != None: |
| 7901 | self.in_port = in_port |
| 7902 | else: |
| 7903 | self.in_port = 0 |
| 7904 | if actions != None: |
| 7905 | self.actions = actions |
| 7906 | else: |
| 7907 | self.actions = [] |
| 7908 | if data != None: |
| 7909 | self.data = data |
| 7910 | else: |
| 7911 | self.data = '' |
| 7912 | return |
| 7913 | |
| 7914 | def pack(self): |
| 7915 | packed = [] |
| 7916 | packed.append(struct.pack("!B", self.version)) |
| 7917 | packed.append(struct.pack("!B", self.type)) |
| 7918 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7919 | packed.append(struct.pack("!L", self.xid)) |
| 7920 | packed.append(struct.pack("!L", self.buffer_id)) |
| 7921 | packed.append(util.pack_port_no(self.in_port)) |
| 7922 | packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6 |
| 7923 | packed.append('\x00' * 6) |
| 7924 | packed.append(loxi.generic_util.pack_list(self.actions)) |
| 7925 | packed[6] = struct.pack("!H", len(packed[-1])) |
| 7926 | packed.append(self.data) |
| 7927 | length = sum([len(x) for x in packed]) |
| 7928 | packed[2] = struct.pack("!H", length) |
| 7929 | return ''.join(packed) |
| 7930 | |
| 7931 | @staticmethod |
| 7932 | def unpack(reader): |
| 7933 | obj = packet_out() |
| 7934 | _version = reader.read("!B")[0] |
| 7935 | assert(_version == 5) |
| 7936 | _type = reader.read("!B")[0] |
| 7937 | assert(_type == 13) |
| 7938 | _length = reader.read("!H")[0] |
| 7939 | orig_reader = reader |
| 7940 | reader = orig_reader.slice(_length - (2 + 2)) |
| 7941 | obj.xid = reader.read("!L")[0] |
| 7942 | obj.buffer_id = reader.read("!L")[0] |
| 7943 | obj.in_port = util.unpack_port_no(reader) |
| 7944 | _actions_len = reader.read("!H")[0] |
| 7945 | reader.skip(6) |
| 7946 | obj.actions = loxi.generic_util.unpack_list(reader.slice(_actions_len), action.action.unpack) |
| 7947 | obj.data = str(reader.read_all()) |
| 7948 | return obj |
| 7949 | |
| 7950 | def __eq__(self, other): |
| 7951 | if type(self) != type(other): return False |
| 7952 | if self.xid != other.xid: return False |
| 7953 | if self.buffer_id != other.buffer_id: return False |
| 7954 | if self.in_port != other.in_port: return False |
| 7955 | if self.actions != other.actions: return False |
| 7956 | if self.data != other.data: return False |
| 7957 | return True |
| 7958 | |
| 7959 | def pretty_print(self, q): |
| 7960 | q.text("packet_out {") |
| 7961 | with q.group(): |
| 7962 | with q.indent(2): |
| 7963 | q.breakable() |
| 7964 | q.text("xid = "); |
| 7965 | if self.xid != None: |
| 7966 | q.text("%#x" % self.xid) |
| 7967 | else: |
| 7968 | q.text('None') |
| 7969 | q.text(","); q.breakable() |
| 7970 | q.text("buffer_id = "); |
| 7971 | q.text("%#x" % self.buffer_id) |
| 7972 | q.text(","); q.breakable() |
| 7973 | q.text("in_port = "); |
| 7974 | q.text(util.pretty_port(self.in_port)) |
| 7975 | q.text(","); q.breakable() |
| 7976 | q.text("actions = "); |
| 7977 | q.pp(self.actions) |
| 7978 | q.text(","); q.breakable() |
| 7979 | q.text("data = "); |
| 7980 | q.pp(self.data) |
| 7981 | q.breakable() |
| 7982 | q.text('}') |
| 7983 | |
| 7984 | message.subtypes[13] = packet_out |
| 7985 | |
| 7986 | class port_desc_stats_reply(stats_reply): |
| 7987 | version = 5 |
| 7988 | type = 19 |
| 7989 | stats_type = 13 |
| 7990 | |
| 7991 | def __init__(self, xid=None, flags=None, entries=None): |
| 7992 | if xid != None: |
| 7993 | self.xid = xid |
| 7994 | else: |
| 7995 | self.xid = None |
| 7996 | if flags != None: |
| 7997 | self.flags = flags |
| 7998 | else: |
| 7999 | self.flags = 0 |
| 8000 | if entries != None: |
| 8001 | self.entries = entries |
| 8002 | else: |
| 8003 | self.entries = [] |
| 8004 | return |
| 8005 | |
| 8006 | def pack(self): |
| 8007 | packed = [] |
| 8008 | packed.append(struct.pack("!B", self.version)) |
| 8009 | packed.append(struct.pack("!B", self.type)) |
| 8010 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8011 | packed.append(struct.pack("!L", self.xid)) |
| 8012 | packed.append(struct.pack("!H", self.stats_type)) |
| 8013 | packed.append(struct.pack("!H", self.flags)) |
| 8014 | packed.append('\x00' * 4) |
| 8015 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 8016 | length = sum([len(x) for x in packed]) |
| 8017 | packed[2] = struct.pack("!H", length) |
| 8018 | return ''.join(packed) |
| 8019 | |
| 8020 | @staticmethod |
| 8021 | def unpack(reader): |
| 8022 | obj = port_desc_stats_reply() |
| 8023 | _version = reader.read("!B")[0] |
| 8024 | assert(_version == 5) |
| 8025 | _type = reader.read("!B")[0] |
| 8026 | assert(_type == 19) |
| 8027 | _length = reader.read("!H")[0] |
| 8028 | orig_reader = reader |
| 8029 | reader = orig_reader.slice(_length - (2 + 2)) |
| 8030 | obj.xid = reader.read("!L")[0] |
| 8031 | _stats_type = reader.read("!H")[0] |
| 8032 | assert(_stats_type == 13) |
| 8033 | obj.flags = reader.read("!H")[0] |
| 8034 | reader.skip(4) |
| 8035 | obj.entries = loxi.generic_util.unpack_list(reader, common.port_desc.unpack) |
| 8036 | return obj |
| 8037 | |
| 8038 | def __eq__(self, other): |
| 8039 | if type(self) != type(other): return False |
| 8040 | if self.xid != other.xid: return False |
| 8041 | if self.flags != other.flags: return False |
| 8042 | if self.entries != other.entries: return False |
| 8043 | return True |
| 8044 | |
| 8045 | def pretty_print(self, q): |
| 8046 | q.text("port_desc_stats_reply {") |
| 8047 | with q.group(): |
| 8048 | with q.indent(2): |
| 8049 | q.breakable() |
| 8050 | q.text("xid = "); |
| 8051 | if self.xid != None: |
| 8052 | q.text("%#x" % self.xid) |
| 8053 | else: |
| 8054 | q.text('None') |
| 8055 | q.text(","); q.breakable() |
| 8056 | q.text("flags = "); |
| 8057 | q.text("%#x" % self.flags) |
| 8058 | q.text(","); q.breakable() |
| 8059 | q.text("entries = "); |
| 8060 | q.pp(self.entries) |
| 8061 | q.breakable() |
| 8062 | q.text('}') |
| 8063 | |
| 8064 | stats_reply.subtypes[13] = port_desc_stats_reply |
| 8065 | |
| 8066 | class port_desc_stats_request(stats_request): |
| 8067 | version = 5 |
| 8068 | type = 18 |
| 8069 | stats_type = 13 |
| 8070 | |
| 8071 | def __init__(self, xid=None, flags=None): |
| 8072 | if xid != None: |
| 8073 | self.xid = xid |
| 8074 | else: |
| 8075 | self.xid = None |
| 8076 | if flags != None: |
| 8077 | self.flags = flags |
| 8078 | else: |
| 8079 | self.flags = 0 |
| 8080 | return |
| 8081 | |
| 8082 | def pack(self): |
| 8083 | packed = [] |
| 8084 | packed.append(struct.pack("!B", self.version)) |
| 8085 | packed.append(struct.pack("!B", self.type)) |
| 8086 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8087 | packed.append(struct.pack("!L", self.xid)) |
| 8088 | packed.append(struct.pack("!H", self.stats_type)) |
| 8089 | packed.append(struct.pack("!H", self.flags)) |
| 8090 | packed.append('\x00' * 4) |
| 8091 | length = sum([len(x) for x in packed]) |
| 8092 | packed[2] = struct.pack("!H", length) |
| 8093 | return ''.join(packed) |
| 8094 | |
| 8095 | @staticmethod |
| 8096 | def unpack(reader): |
| 8097 | obj = port_desc_stats_request() |
| 8098 | _version = reader.read("!B")[0] |
| 8099 | assert(_version == 5) |
| 8100 | _type = reader.read("!B")[0] |
| 8101 | assert(_type == 18) |
| 8102 | _length = reader.read("!H")[0] |
| 8103 | orig_reader = reader |
| 8104 | reader = orig_reader.slice(_length - (2 + 2)) |
| 8105 | obj.xid = reader.read("!L")[0] |
| 8106 | _stats_type = reader.read("!H")[0] |
| 8107 | assert(_stats_type == 13) |
| 8108 | obj.flags = reader.read("!H")[0] |
| 8109 | reader.skip(4) |
| 8110 | return obj |
| 8111 | |
| 8112 | def __eq__(self, other): |
| 8113 | if type(self) != type(other): return False |
| 8114 | if self.xid != other.xid: return False |
| 8115 | if self.flags != other.flags: return False |
| 8116 | return True |
| 8117 | |
| 8118 | def pretty_print(self, q): |
| 8119 | q.text("port_desc_stats_request {") |
| 8120 | with q.group(): |
| 8121 | with q.indent(2): |
| 8122 | q.breakable() |
| 8123 | q.text("xid = "); |
| 8124 | if self.xid != None: |
| 8125 | q.text("%#x" % self.xid) |
| 8126 | else: |
| 8127 | q.text('None') |
| 8128 | q.text(","); q.breakable() |
| 8129 | q.text("flags = "); |
| 8130 | q.text("%#x" % self.flags) |
| 8131 | q.breakable() |
| 8132 | q.text('}') |
| 8133 | |
| 8134 | stats_request.subtypes[13] = port_desc_stats_request |
| 8135 | |
| 8136 | class port_mod(message): |
| 8137 | version = 5 |
| 8138 | type = 16 |
| 8139 | |
| 8140 | def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, properties=None): |
| 8141 | if xid != None: |
| 8142 | self.xid = xid |
| 8143 | else: |
| 8144 | self.xid = None |
| 8145 | if port_no != None: |
| 8146 | self.port_no = port_no |
| 8147 | else: |
| 8148 | self.port_no = 0 |
| 8149 | if hw_addr != None: |
| 8150 | self.hw_addr = hw_addr |
| 8151 | else: |
| 8152 | self.hw_addr = [0,0,0,0,0,0] |
| 8153 | if config != None: |
| 8154 | self.config = config |
| 8155 | else: |
| 8156 | self.config = 0 |
| 8157 | if mask != None: |
| 8158 | self.mask = mask |
| 8159 | else: |
| 8160 | self.mask = 0 |
| 8161 | if properties != None: |
| 8162 | self.properties = properties |
| 8163 | else: |
| 8164 | self.properties = [] |
| 8165 | return |
| 8166 | |
| 8167 | def pack(self): |
| 8168 | packed = [] |
| 8169 | packed.append(struct.pack("!B", self.version)) |
| 8170 | packed.append(struct.pack("!B", self.type)) |
| 8171 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8172 | packed.append(struct.pack("!L", self.xid)) |
| 8173 | packed.append(util.pack_port_no(self.port_no)) |
| 8174 | packed.append('\x00' * 4) |
| 8175 | packed.append(struct.pack("!6B", *self.hw_addr)) |
| 8176 | packed.append('\x00' * 2) |
| 8177 | packed.append(struct.pack("!L", self.config)) |
| 8178 | packed.append(struct.pack("!L", self.mask)) |
| 8179 | packed.append(loxi.generic_util.pack_list(self.properties)) |
| 8180 | length = sum([len(x) for x in packed]) |
| 8181 | packed[2] = struct.pack("!H", length) |
| 8182 | return ''.join(packed) |
| 8183 | |
| 8184 | @staticmethod |
| 8185 | def unpack(reader): |
| 8186 | obj = port_mod() |
| 8187 | _version = reader.read("!B")[0] |
| 8188 | assert(_version == 5) |
| 8189 | _type = reader.read("!B")[0] |
| 8190 | assert(_type == 16) |
| 8191 | _length = reader.read("!H")[0] |
| 8192 | orig_reader = reader |
| 8193 | reader = orig_reader.slice(_length - (2 + 2)) |
| 8194 | obj.xid = reader.read("!L")[0] |
| 8195 | obj.port_no = util.unpack_port_no(reader) |
| 8196 | reader.skip(4) |
| 8197 | obj.hw_addr = list(reader.read('!6B')) |
| 8198 | reader.skip(2) |
| 8199 | obj.config = reader.read("!L")[0] |
| 8200 | obj.mask = reader.read("!L")[0] |
| 8201 | obj.properties = loxi.generic_util.unpack_list(reader, port_mod_prop.port_mod_prop.unpack) |
| 8202 | return obj |
| 8203 | |
| 8204 | def __eq__(self, other): |
| 8205 | if type(self) != type(other): return False |
| 8206 | if self.xid != other.xid: return False |
| 8207 | if self.port_no != other.port_no: return False |
| 8208 | if self.hw_addr != other.hw_addr: return False |
| 8209 | if self.config != other.config: return False |
| 8210 | if self.mask != other.mask: return False |
| 8211 | if self.properties != other.properties: return False |
| 8212 | return True |
| 8213 | |
| 8214 | def pretty_print(self, q): |
| 8215 | q.text("port_mod {") |
| 8216 | with q.group(): |
| 8217 | with q.indent(2): |
| 8218 | q.breakable() |
| 8219 | q.text("xid = "); |
| 8220 | if self.xid != None: |
| 8221 | q.text("%#x" % self.xid) |
| 8222 | else: |
| 8223 | q.text('None') |
| 8224 | q.text(","); q.breakable() |
| 8225 | q.text("port_no = "); |
| 8226 | q.text(util.pretty_port(self.port_no)) |
| 8227 | q.text(","); q.breakable() |
| 8228 | q.text("hw_addr = "); |
| 8229 | q.text(util.pretty_mac(self.hw_addr)) |
| 8230 | q.text(","); q.breakable() |
| 8231 | q.text("config = "); |
| 8232 | q.text("%#x" % self.config) |
| 8233 | q.text(","); q.breakable() |
| 8234 | q.text("mask = "); |
| 8235 | q.text("%#x" % self.mask) |
| 8236 | q.text(","); q.breakable() |
| 8237 | q.text("properties = "); |
| 8238 | q.pp(self.properties) |
| 8239 | q.breakable() |
| 8240 | q.text('}') |
| 8241 | |
| 8242 | message.subtypes[16] = port_mod |
| 8243 | |
| 8244 | class port_mod_failed_error_msg(error_msg): |
| 8245 | version = 5 |
| 8246 | type = 1 |
| 8247 | err_type = 7 |
| 8248 | |
| 8249 | def __init__(self, xid=None, code=None, data=None): |
| 8250 | if xid != None: |
| 8251 | self.xid = xid |
| 8252 | else: |
| 8253 | self.xid = None |
| 8254 | if code != None: |
| 8255 | self.code = code |
| 8256 | else: |
| 8257 | self.code = 0 |
| 8258 | if data != None: |
| 8259 | self.data = data |
| 8260 | else: |
| 8261 | self.data = '' |
| 8262 | return |
| 8263 | |
| 8264 | def pack(self): |
| 8265 | packed = [] |
| 8266 | packed.append(struct.pack("!B", self.version)) |
| 8267 | packed.append(struct.pack("!B", self.type)) |
| 8268 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8269 | packed.append(struct.pack("!L", self.xid)) |
| 8270 | packed.append(struct.pack("!H", self.err_type)) |
| 8271 | packed.append(struct.pack("!H", self.code)) |
| 8272 | packed.append(self.data) |
| 8273 | length = sum([len(x) for x in packed]) |
| 8274 | packed[2] = struct.pack("!H", length) |
| 8275 | return ''.join(packed) |
| 8276 | |
| 8277 | @staticmethod |
| 8278 | def unpack(reader): |
| 8279 | obj = port_mod_failed_error_msg() |
| 8280 | _version = reader.read("!B")[0] |
| 8281 | assert(_version == 5) |
| 8282 | _type = reader.read("!B")[0] |
| 8283 | assert(_type == 1) |
| 8284 | _length = reader.read("!H")[0] |
| 8285 | orig_reader = reader |
| 8286 | reader = orig_reader.slice(_length - (2 + 2)) |
| 8287 | obj.xid = reader.read("!L")[0] |
| 8288 | _err_type = reader.read("!H")[0] |
| 8289 | assert(_err_type == 7) |
| 8290 | obj.code = reader.read("!H")[0] |
| 8291 | obj.data = str(reader.read_all()) |
| 8292 | return obj |
| 8293 | |
| 8294 | def __eq__(self, other): |
| 8295 | if type(self) != type(other): return False |
| 8296 | if self.xid != other.xid: return False |
| 8297 | if self.code != other.code: return False |
| 8298 | if self.data != other.data: return False |
| 8299 | return True |
| 8300 | |
| 8301 | def pretty_print(self, q): |
| 8302 | q.text("port_mod_failed_error_msg {") |
| 8303 | with q.group(): |
| 8304 | with q.indent(2): |
| 8305 | q.breakable() |
| 8306 | q.text("xid = "); |
| 8307 | if self.xid != None: |
| 8308 | q.text("%#x" % self.xid) |
| 8309 | else: |
| 8310 | q.text('None') |
| 8311 | q.text(","); q.breakable() |
| 8312 | q.text("code = "); |
| 8313 | q.text("%#x" % self.code) |
| 8314 | q.text(","); q.breakable() |
| 8315 | q.text("data = "); |
| 8316 | q.pp(self.data) |
| 8317 | q.breakable() |
| 8318 | q.text('}') |
| 8319 | |
| 8320 | error_msg.subtypes[7] = port_mod_failed_error_msg |
| 8321 | |
| 8322 | class port_stats_reply(stats_reply): |
| 8323 | version = 5 |
| 8324 | type = 19 |
| 8325 | stats_type = 4 |
| 8326 | |
| 8327 | def __init__(self, xid=None, flags=None, entries=None): |
| 8328 | if xid != None: |
| 8329 | self.xid = xid |
| 8330 | else: |
| 8331 | self.xid = None |
| 8332 | if flags != None: |
| 8333 | self.flags = flags |
| 8334 | else: |
| 8335 | self.flags = 0 |
| 8336 | if entries != None: |
| 8337 | self.entries = entries |
| 8338 | else: |
| 8339 | self.entries = [] |
| 8340 | return |
| 8341 | |
| 8342 | def pack(self): |
| 8343 | packed = [] |
| 8344 | packed.append(struct.pack("!B", self.version)) |
| 8345 | packed.append(struct.pack("!B", self.type)) |
| 8346 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8347 | packed.append(struct.pack("!L", self.xid)) |
| 8348 | packed.append(struct.pack("!H", self.stats_type)) |
| 8349 | packed.append(struct.pack("!H", self.flags)) |
| 8350 | packed.append('\x00' * 4) |
| 8351 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 8352 | length = sum([len(x) for x in packed]) |
| 8353 | packed[2] = struct.pack("!H", length) |
| 8354 | return ''.join(packed) |
| 8355 | |
| 8356 | @staticmethod |
| 8357 | def unpack(reader): |
| 8358 | obj = port_stats_reply() |
| 8359 | _version = reader.read("!B")[0] |
| 8360 | assert(_version == 5) |
| 8361 | _type = reader.read("!B")[0] |
| 8362 | assert(_type == 19) |
| 8363 | _length = reader.read("!H")[0] |
| 8364 | orig_reader = reader |
| 8365 | reader = orig_reader.slice(_length - (2 + 2)) |
| 8366 | obj.xid = reader.read("!L")[0] |
| 8367 | _stats_type = reader.read("!H")[0] |
| 8368 | assert(_stats_type == 4) |
| 8369 | obj.flags = reader.read("!H")[0] |
| 8370 | reader.skip(4) |
| 8371 | obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack) |
| 8372 | return obj |
| 8373 | |
| 8374 | def __eq__(self, other): |
| 8375 | if type(self) != type(other): return False |
| 8376 | if self.xid != other.xid: return False |
| 8377 | if self.flags != other.flags: return False |
| 8378 | if self.entries != other.entries: return False |
| 8379 | return True |
| 8380 | |
| 8381 | def pretty_print(self, q): |
| 8382 | q.text("port_stats_reply {") |
| 8383 | with q.group(): |
| 8384 | with q.indent(2): |
| 8385 | q.breakable() |
| 8386 | q.text("xid = "); |
| 8387 | if self.xid != None: |
| 8388 | q.text("%#x" % self.xid) |
| 8389 | else: |
| 8390 | q.text('None') |
| 8391 | q.text(","); q.breakable() |
| 8392 | q.text("flags = "); |
| 8393 | q.text("%#x" % self.flags) |
| 8394 | q.text(","); q.breakable() |
| 8395 | q.text("entries = "); |
| 8396 | q.pp(self.entries) |
| 8397 | q.breakable() |
| 8398 | q.text('}') |
| 8399 | |
| 8400 | stats_reply.subtypes[4] = port_stats_reply |
| 8401 | |
| 8402 | class port_stats_request(stats_request): |
| 8403 | version = 5 |
| 8404 | type = 18 |
| 8405 | stats_type = 4 |
| 8406 | |
| 8407 | def __init__(self, xid=None, flags=None, port_no=None): |
| 8408 | if xid != None: |
| 8409 | self.xid = xid |
| 8410 | else: |
| 8411 | self.xid = None |
| 8412 | if flags != None: |
| 8413 | self.flags = flags |
| 8414 | else: |
| 8415 | self.flags = 0 |
| 8416 | if port_no != None: |
| 8417 | self.port_no = port_no |
| 8418 | else: |
| 8419 | self.port_no = 0 |
| 8420 | return |
| 8421 | |
| 8422 | def pack(self): |
| 8423 | packed = [] |
| 8424 | packed.append(struct.pack("!B", self.version)) |
| 8425 | packed.append(struct.pack("!B", self.type)) |
| 8426 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8427 | packed.append(struct.pack("!L", self.xid)) |
| 8428 | packed.append(struct.pack("!H", self.stats_type)) |
| 8429 | packed.append(struct.pack("!H", self.flags)) |
| 8430 | packed.append('\x00' * 4) |
| 8431 | packed.append(util.pack_port_no(self.port_no)) |
| 8432 | packed.append('\x00' * 4) |
| 8433 | length = sum([len(x) for x in packed]) |
| 8434 | packed[2] = struct.pack("!H", length) |
| 8435 | return ''.join(packed) |
| 8436 | |
| 8437 | @staticmethod |
| 8438 | def unpack(reader): |
| 8439 | obj = port_stats_request() |
| 8440 | _version = reader.read("!B")[0] |
| 8441 | assert(_version == 5) |
| 8442 | _type = reader.read("!B")[0] |
| 8443 | assert(_type == 18) |
| 8444 | _length = reader.read("!H")[0] |
| 8445 | orig_reader = reader |
| 8446 | reader = orig_reader.slice(_length - (2 + 2)) |
| 8447 | obj.xid = reader.read("!L")[0] |
| 8448 | _stats_type = reader.read("!H")[0] |
| 8449 | assert(_stats_type == 4) |
| 8450 | obj.flags = reader.read("!H")[0] |
| 8451 | reader.skip(4) |
| 8452 | obj.port_no = util.unpack_port_no(reader) |
| 8453 | reader.skip(4) |
| 8454 | return obj |
| 8455 | |
| 8456 | def __eq__(self, other): |
| 8457 | if type(self) != type(other): return False |
| 8458 | if self.xid != other.xid: return False |
| 8459 | if self.flags != other.flags: return False |
| 8460 | if self.port_no != other.port_no: return False |
| 8461 | return True |
| 8462 | |
| 8463 | def pretty_print(self, q): |
| 8464 | q.text("port_stats_request {") |
| 8465 | with q.group(): |
| 8466 | with q.indent(2): |
| 8467 | q.breakable() |
| 8468 | q.text("xid = "); |
| 8469 | if self.xid != None: |
| 8470 | q.text("%#x" % self.xid) |
| 8471 | else: |
| 8472 | q.text('None') |
| 8473 | q.text(","); q.breakable() |
| 8474 | q.text("flags = "); |
| 8475 | q.text("%#x" % self.flags) |
| 8476 | q.text(","); q.breakable() |
| 8477 | q.text("port_no = "); |
| 8478 | q.text(util.pretty_port(self.port_no)) |
| 8479 | q.breakable() |
| 8480 | q.text('}') |
| 8481 | |
| 8482 | stats_request.subtypes[4] = port_stats_request |
| 8483 | |
| 8484 | class port_status(message): |
| 8485 | version = 5 |
| 8486 | type = 12 |
| 8487 | |
| 8488 | def __init__(self, xid=None, reason=None, desc=None): |
| 8489 | if xid != None: |
| 8490 | self.xid = xid |
| 8491 | else: |
| 8492 | self.xid = None |
| 8493 | if reason != None: |
| 8494 | self.reason = reason |
| 8495 | else: |
| 8496 | self.reason = 0 |
| 8497 | if desc != None: |
| 8498 | self.desc = desc |
| 8499 | else: |
| 8500 | self.desc = common.port_desc() |
| 8501 | return |
| 8502 | |
| 8503 | def pack(self): |
| 8504 | packed = [] |
| 8505 | packed.append(struct.pack("!B", self.version)) |
| 8506 | packed.append(struct.pack("!B", self.type)) |
| 8507 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8508 | packed.append(struct.pack("!L", self.xid)) |
| 8509 | packed.append(struct.pack("!B", self.reason)) |
| 8510 | packed.append('\x00' * 7) |
| 8511 | packed.append(self.desc.pack()) |
| 8512 | length = sum([len(x) for x in packed]) |
| 8513 | packed[2] = struct.pack("!H", length) |
| 8514 | return ''.join(packed) |
| 8515 | |
| 8516 | @staticmethod |
| 8517 | def unpack(reader): |
| 8518 | obj = port_status() |
| 8519 | _version = reader.read("!B")[0] |
| 8520 | assert(_version == 5) |
| 8521 | _type = reader.read("!B")[0] |
| 8522 | assert(_type == 12) |
| 8523 | _length = reader.read("!H")[0] |
| 8524 | orig_reader = reader |
| 8525 | reader = orig_reader.slice(_length - (2 + 2)) |
| 8526 | obj.xid = reader.read("!L")[0] |
| 8527 | obj.reason = reader.read("!B")[0] |
| 8528 | reader.skip(7) |
| 8529 | obj.desc = common.port_desc.unpack(reader) |
| 8530 | return obj |
| 8531 | |
| 8532 | def __eq__(self, other): |
| 8533 | if type(self) != type(other): return False |
| 8534 | if self.xid != other.xid: return False |
| 8535 | if self.reason != other.reason: return False |
| 8536 | if self.desc != other.desc: return False |
| 8537 | return True |
| 8538 | |
| 8539 | def pretty_print(self, q): |
| 8540 | q.text("port_status {") |
| 8541 | with q.group(): |
| 8542 | with q.indent(2): |
| 8543 | q.breakable() |
| 8544 | q.text("xid = "); |
| 8545 | if self.xid != None: |
| 8546 | q.text("%#x" % self.xid) |
| 8547 | else: |
| 8548 | q.text('None') |
| 8549 | q.text(","); q.breakable() |
| 8550 | q.text("reason = "); |
| 8551 | q.text("%#x" % self.reason) |
| 8552 | q.text(","); q.breakable() |
| 8553 | q.text("desc = "); |
| 8554 | q.pp(self.desc) |
| 8555 | q.breakable() |
| 8556 | q.text('}') |
| 8557 | |
| 8558 | message.subtypes[12] = port_status |
| 8559 | |
| 8560 | class queue_desc_stats_reply(stats_reply): |
| 8561 | version = 5 |
| 8562 | type = 19 |
| 8563 | stats_type = 15 |
| 8564 | |
| 8565 | def __init__(self, xid=None, flags=None, entries=None): |
| 8566 | if xid != None: |
| 8567 | self.xid = xid |
| 8568 | else: |
| 8569 | self.xid = None |
| 8570 | if flags != None: |
| 8571 | self.flags = flags |
| 8572 | else: |
| 8573 | self.flags = 0 |
| 8574 | if entries != None: |
| 8575 | self.entries = entries |
| 8576 | else: |
| 8577 | self.entries = [] |
| 8578 | return |
| 8579 | |
| 8580 | def pack(self): |
| 8581 | packed = [] |
| 8582 | packed.append(struct.pack("!B", self.version)) |
| 8583 | packed.append(struct.pack("!B", self.type)) |
| 8584 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8585 | packed.append(struct.pack("!L", self.xid)) |
| 8586 | packed.append(struct.pack("!H", self.stats_type)) |
| 8587 | packed.append(struct.pack("!H", self.flags)) |
| 8588 | packed.append('\x00' * 4) |
| 8589 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 8590 | length = sum([len(x) for x in packed]) |
| 8591 | packed[2] = struct.pack("!H", length) |
| 8592 | return ''.join(packed) |
| 8593 | |
| 8594 | @staticmethod |
| 8595 | def unpack(reader): |
| 8596 | obj = queue_desc_stats_reply() |
| 8597 | _version = reader.read("!B")[0] |
| 8598 | assert(_version == 5) |
| 8599 | _type = reader.read("!B")[0] |
| 8600 | assert(_type == 19) |
| 8601 | _length = reader.read("!H")[0] |
| 8602 | orig_reader = reader |
| 8603 | reader = orig_reader.slice(_length - (2 + 2)) |
| 8604 | obj.xid = reader.read("!L")[0] |
| 8605 | _stats_type = reader.read("!H")[0] |
| 8606 | assert(_stats_type == 15) |
| 8607 | obj.flags = reader.read("!H")[0] |
| 8608 | reader.skip(4) |
| 8609 | obj.entries = loxi.generic_util.unpack_list(reader, common.queue_desc.unpack) |
| 8610 | return obj |
| 8611 | |
| 8612 | def __eq__(self, other): |
| 8613 | if type(self) != type(other): return False |
| 8614 | if self.xid != other.xid: return False |
| 8615 | if self.flags != other.flags: return False |
| 8616 | if self.entries != other.entries: return False |
| 8617 | return True |
| 8618 | |
| 8619 | def pretty_print(self, q): |
| 8620 | q.text("queue_desc_stats_reply {") |
| 8621 | with q.group(): |
| 8622 | with q.indent(2): |
| 8623 | q.breakable() |
| 8624 | q.text("xid = "); |
| 8625 | if self.xid != None: |
| 8626 | q.text("%#x" % self.xid) |
| 8627 | else: |
| 8628 | q.text('None') |
| 8629 | q.text(","); q.breakable() |
| 8630 | q.text("flags = "); |
| 8631 | q.text("%#x" % self.flags) |
| 8632 | q.text(","); q.breakable() |
| 8633 | q.text("entries = "); |
| 8634 | q.pp(self.entries) |
| 8635 | q.breakable() |
| 8636 | q.text('}') |
| 8637 | |
| 8638 | stats_reply.subtypes[15] = queue_desc_stats_reply |
| 8639 | |
| 8640 | class queue_desc_stats_request(stats_request): |
| 8641 | version = 5 |
| 8642 | type = 18 |
| 8643 | stats_type = 15 |
| 8644 | |
| 8645 | def __init__(self, xid=None, flags=None): |
| 8646 | if xid != None: |
| 8647 | self.xid = xid |
| 8648 | else: |
| 8649 | self.xid = None |
| 8650 | if flags != None: |
| 8651 | self.flags = flags |
| 8652 | else: |
| 8653 | self.flags = 0 |
| 8654 | return |
| 8655 | |
| 8656 | def pack(self): |
| 8657 | packed = [] |
| 8658 | packed.append(struct.pack("!B", self.version)) |
| 8659 | packed.append(struct.pack("!B", self.type)) |
| 8660 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8661 | packed.append(struct.pack("!L", self.xid)) |
| 8662 | packed.append(struct.pack("!H", self.stats_type)) |
| 8663 | packed.append(struct.pack("!H", self.flags)) |
| 8664 | packed.append('\x00' * 4) |
| 8665 | length = sum([len(x) for x in packed]) |
| 8666 | packed[2] = struct.pack("!H", length) |
| 8667 | return ''.join(packed) |
| 8668 | |
| 8669 | @staticmethod |
| 8670 | def unpack(reader): |
| 8671 | obj = queue_desc_stats_request() |
| 8672 | _version = reader.read("!B")[0] |
| 8673 | assert(_version == 5) |
| 8674 | _type = reader.read("!B")[0] |
| 8675 | assert(_type == 18) |
| 8676 | _length = reader.read("!H")[0] |
| 8677 | orig_reader = reader |
| 8678 | reader = orig_reader.slice(_length - (2 + 2)) |
| 8679 | obj.xid = reader.read("!L")[0] |
| 8680 | _stats_type = reader.read("!H")[0] |
| 8681 | assert(_stats_type == 15) |
| 8682 | obj.flags = reader.read("!H")[0] |
| 8683 | reader.skip(4) |
| 8684 | return obj |
| 8685 | |
| 8686 | def __eq__(self, other): |
| 8687 | if type(self) != type(other): return False |
| 8688 | if self.xid != other.xid: return False |
| 8689 | if self.flags != other.flags: return False |
| 8690 | return True |
| 8691 | |
| 8692 | def pretty_print(self, q): |
| 8693 | q.text("queue_desc_stats_request {") |
| 8694 | with q.group(): |
| 8695 | with q.indent(2): |
| 8696 | q.breakable() |
| 8697 | q.text("xid = "); |
| 8698 | if self.xid != None: |
| 8699 | q.text("%#x" % self.xid) |
| 8700 | else: |
| 8701 | q.text('None') |
| 8702 | q.text(","); q.breakable() |
| 8703 | q.text("flags = "); |
| 8704 | q.text("%#x" % self.flags) |
| 8705 | q.breakable() |
| 8706 | q.text('}') |
| 8707 | |
| 8708 | stats_request.subtypes[15] = queue_desc_stats_request |
| 8709 | |
| 8710 | class queue_op_failed_error_msg(error_msg): |
| 8711 | version = 5 |
| 8712 | type = 1 |
| 8713 | err_type = 9 |
| 8714 | |
| 8715 | def __init__(self, xid=None, code=None, data=None): |
| 8716 | if xid != None: |
| 8717 | self.xid = xid |
| 8718 | else: |
| 8719 | self.xid = None |
| 8720 | if code != None: |
| 8721 | self.code = code |
| 8722 | else: |
| 8723 | self.code = 0 |
| 8724 | if data != None: |
| 8725 | self.data = data |
| 8726 | else: |
| 8727 | self.data = '' |
| 8728 | return |
| 8729 | |
| 8730 | def pack(self): |
| 8731 | packed = [] |
| 8732 | packed.append(struct.pack("!B", self.version)) |
| 8733 | packed.append(struct.pack("!B", self.type)) |
| 8734 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8735 | packed.append(struct.pack("!L", self.xid)) |
| 8736 | packed.append(struct.pack("!H", self.err_type)) |
| 8737 | packed.append(struct.pack("!H", self.code)) |
| 8738 | packed.append(self.data) |
| 8739 | length = sum([len(x) for x in packed]) |
| 8740 | packed[2] = struct.pack("!H", length) |
| 8741 | return ''.join(packed) |
| 8742 | |
| 8743 | @staticmethod |
| 8744 | def unpack(reader): |
| 8745 | obj = queue_op_failed_error_msg() |
| 8746 | _version = reader.read("!B")[0] |
| 8747 | assert(_version == 5) |
| 8748 | _type = reader.read("!B")[0] |
| 8749 | assert(_type == 1) |
| 8750 | _length = reader.read("!H")[0] |
| 8751 | orig_reader = reader |
| 8752 | reader = orig_reader.slice(_length - (2 + 2)) |
| 8753 | obj.xid = reader.read("!L")[0] |
| 8754 | _err_type = reader.read("!H")[0] |
| 8755 | assert(_err_type == 9) |
| 8756 | obj.code = reader.read("!H")[0] |
| 8757 | obj.data = str(reader.read_all()) |
| 8758 | return obj |
| 8759 | |
| 8760 | def __eq__(self, other): |
| 8761 | if type(self) != type(other): return False |
| 8762 | if self.xid != other.xid: return False |
| 8763 | if self.code != other.code: return False |
| 8764 | if self.data != other.data: return False |
| 8765 | return True |
| 8766 | |
| 8767 | def pretty_print(self, q): |
| 8768 | q.text("queue_op_failed_error_msg {") |
| 8769 | with q.group(): |
| 8770 | with q.indent(2): |
| 8771 | q.breakable() |
| 8772 | q.text("xid = "); |
| 8773 | if self.xid != None: |
| 8774 | q.text("%#x" % self.xid) |
| 8775 | else: |
| 8776 | q.text('None') |
| 8777 | q.text(","); q.breakable() |
| 8778 | q.text("code = "); |
| 8779 | q.text("%#x" % self.code) |
| 8780 | q.text(","); q.breakable() |
| 8781 | q.text("data = "); |
| 8782 | q.pp(self.data) |
| 8783 | q.breakable() |
| 8784 | q.text('}') |
| 8785 | |
| 8786 | error_msg.subtypes[9] = queue_op_failed_error_msg |
| 8787 | |
| 8788 | class queue_stats_reply(stats_reply): |
| 8789 | version = 5 |
| 8790 | type = 19 |
| 8791 | stats_type = 5 |
| 8792 | |
| 8793 | def __init__(self, xid=None, flags=None, entries=None): |
| 8794 | if xid != None: |
| 8795 | self.xid = xid |
| 8796 | else: |
| 8797 | self.xid = None |
| 8798 | if flags != None: |
| 8799 | self.flags = flags |
| 8800 | else: |
| 8801 | self.flags = 0 |
| 8802 | if entries != None: |
| 8803 | self.entries = entries |
| 8804 | else: |
| 8805 | self.entries = [] |
| 8806 | return |
| 8807 | |
| 8808 | def pack(self): |
| 8809 | packed = [] |
| 8810 | packed.append(struct.pack("!B", self.version)) |
| 8811 | packed.append(struct.pack("!B", self.type)) |
| 8812 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8813 | packed.append(struct.pack("!L", self.xid)) |
| 8814 | packed.append(struct.pack("!H", self.stats_type)) |
| 8815 | packed.append(struct.pack("!H", self.flags)) |
| 8816 | packed.append('\x00' * 4) |
| 8817 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 8818 | length = sum([len(x) for x in packed]) |
| 8819 | packed[2] = struct.pack("!H", length) |
| 8820 | return ''.join(packed) |
| 8821 | |
| 8822 | @staticmethod |
| 8823 | def unpack(reader): |
| 8824 | obj = queue_stats_reply() |
| 8825 | _version = reader.read("!B")[0] |
| 8826 | assert(_version == 5) |
| 8827 | _type = reader.read("!B")[0] |
| 8828 | assert(_type == 19) |
| 8829 | _length = reader.read("!H")[0] |
| 8830 | orig_reader = reader |
| 8831 | reader = orig_reader.slice(_length - (2 + 2)) |
| 8832 | obj.xid = reader.read("!L")[0] |
| 8833 | _stats_type = reader.read("!H")[0] |
| 8834 | assert(_stats_type == 5) |
| 8835 | obj.flags = reader.read("!H")[0] |
| 8836 | reader.skip(4) |
| 8837 | obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack) |
| 8838 | return obj |
| 8839 | |
| 8840 | def __eq__(self, other): |
| 8841 | if type(self) != type(other): return False |
| 8842 | if self.xid != other.xid: return False |
| 8843 | if self.flags != other.flags: return False |
| 8844 | if self.entries != other.entries: return False |
| 8845 | return True |
| 8846 | |
| 8847 | def pretty_print(self, q): |
| 8848 | q.text("queue_stats_reply {") |
| 8849 | with q.group(): |
| 8850 | with q.indent(2): |
| 8851 | q.breakable() |
| 8852 | q.text("xid = "); |
| 8853 | if self.xid != None: |
| 8854 | q.text("%#x" % self.xid) |
| 8855 | else: |
| 8856 | q.text('None') |
| 8857 | q.text(","); q.breakable() |
| 8858 | q.text("flags = "); |
| 8859 | q.text("%#x" % self.flags) |
| 8860 | q.text(","); q.breakable() |
| 8861 | q.text("entries = "); |
| 8862 | q.pp(self.entries) |
| 8863 | q.breakable() |
| 8864 | q.text('}') |
| 8865 | |
| 8866 | stats_reply.subtypes[5] = queue_stats_reply |
| 8867 | |
| 8868 | class queue_stats_request(stats_request): |
| 8869 | version = 5 |
| 8870 | type = 18 |
| 8871 | stats_type = 5 |
| 8872 | |
| 8873 | def __init__(self, xid=None, flags=None, port_no=None, queue_id=None): |
| 8874 | if xid != None: |
| 8875 | self.xid = xid |
| 8876 | else: |
| 8877 | self.xid = None |
| 8878 | if flags != None: |
| 8879 | self.flags = flags |
| 8880 | else: |
| 8881 | self.flags = 0 |
| 8882 | if port_no != None: |
| 8883 | self.port_no = port_no |
| 8884 | else: |
| 8885 | self.port_no = 0 |
| 8886 | if queue_id != None: |
| 8887 | self.queue_id = queue_id |
| 8888 | else: |
| 8889 | self.queue_id = 0 |
| 8890 | return |
| 8891 | |
| 8892 | def pack(self): |
| 8893 | packed = [] |
| 8894 | packed.append(struct.pack("!B", self.version)) |
| 8895 | packed.append(struct.pack("!B", self.type)) |
| 8896 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8897 | packed.append(struct.pack("!L", self.xid)) |
| 8898 | packed.append(struct.pack("!H", self.stats_type)) |
| 8899 | packed.append(struct.pack("!H", self.flags)) |
| 8900 | packed.append('\x00' * 4) |
| 8901 | packed.append(util.pack_port_no(self.port_no)) |
| 8902 | packed.append(struct.pack("!L", self.queue_id)) |
| 8903 | length = sum([len(x) for x in packed]) |
| 8904 | packed[2] = struct.pack("!H", length) |
| 8905 | return ''.join(packed) |
| 8906 | |
| 8907 | @staticmethod |
| 8908 | def unpack(reader): |
| 8909 | obj = queue_stats_request() |
| 8910 | _version = reader.read("!B")[0] |
| 8911 | assert(_version == 5) |
| 8912 | _type = reader.read("!B")[0] |
| 8913 | assert(_type == 18) |
| 8914 | _length = reader.read("!H")[0] |
| 8915 | orig_reader = reader |
| 8916 | reader = orig_reader.slice(_length - (2 + 2)) |
| 8917 | obj.xid = reader.read("!L")[0] |
| 8918 | _stats_type = reader.read("!H")[0] |
| 8919 | assert(_stats_type == 5) |
| 8920 | obj.flags = reader.read("!H")[0] |
| 8921 | reader.skip(4) |
| 8922 | obj.port_no = util.unpack_port_no(reader) |
| 8923 | obj.queue_id = reader.read("!L")[0] |
| 8924 | return obj |
| 8925 | |
| 8926 | def __eq__(self, other): |
| 8927 | if type(self) != type(other): return False |
| 8928 | if self.xid != other.xid: return False |
| 8929 | if self.flags != other.flags: return False |
| 8930 | if self.port_no != other.port_no: return False |
| 8931 | if self.queue_id != other.queue_id: return False |
| 8932 | return True |
| 8933 | |
| 8934 | def pretty_print(self, q): |
| 8935 | q.text("queue_stats_request {") |
| 8936 | with q.group(): |
| 8937 | with q.indent(2): |
| 8938 | q.breakable() |
| 8939 | q.text("xid = "); |
| 8940 | if self.xid != None: |
| 8941 | q.text("%#x" % self.xid) |
| 8942 | else: |
| 8943 | q.text('None') |
| 8944 | q.text(","); q.breakable() |
| 8945 | q.text("flags = "); |
| 8946 | q.text("%#x" % self.flags) |
| 8947 | q.text(","); q.breakable() |
| 8948 | q.text("port_no = "); |
| 8949 | q.text(util.pretty_port(self.port_no)) |
| 8950 | q.text(","); q.breakable() |
| 8951 | q.text("queue_id = "); |
| 8952 | q.text("%#x" % self.queue_id) |
| 8953 | q.breakable() |
| 8954 | q.text('}') |
| 8955 | |
| 8956 | stats_request.subtypes[5] = queue_stats_request |
| 8957 | |
| 8958 | class requestforward(message): |
| 8959 | version = 5 |
| 8960 | type = 32 |
| 8961 | |
| 8962 | def __init__(self, xid=None, role=None, data=None): |
| 8963 | if xid != None: |
| 8964 | self.xid = xid |
| 8965 | else: |
| 8966 | self.xid = None |
| 8967 | if role != None: |
| 8968 | self.role = role |
| 8969 | else: |
| 8970 | self.role = 0 |
| 8971 | if data != None: |
| 8972 | self.data = data |
| 8973 | else: |
| 8974 | self.data = '' |
| 8975 | return |
| 8976 | |
| 8977 | def pack(self): |
| 8978 | packed = [] |
| 8979 | packed.append(struct.pack("!B", self.version)) |
| 8980 | packed.append(struct.pack("!B", self.type)) |
| 8981 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8982 | packed.append(struct.pack("!L", self.xid)) |
| 8983 | packed.append(struct.pack("!L", self.role)) |
| 8984 | packed.append(self.data) |
| 8985 | length = sum([len(x) for x in packed]) |
| 8986 | packed[2] = struct.pack("!H", length) |
| 8987 | return ''.join(packed) |
| 8988 | |
| 8989 | @staticmethod |
| 8990 | def unpack(reader): |
| 8991 | obj = requestforward() |
| 8992 | _version = reader.read("!B")[0] |
| 8993 | assert(_version == 5) |
| 8994 | _type = reader.read("!B")[0] |
| 8995 | assert(_type == 32) |
| 8996 | _length = reader.read("!H")[0] |
| 8997 | orig_reader = reader |
| 8998 | reader = orig_reader.slice(_length - (2 + 2)) |
| 8999 | obj.xid = reader.read("!L")[0] |
| 9000 | obj.role = reader.read("!L")[0] |
| 9001 | obj.data = str(reader.read_all()) |
| 9002 | return obj |
| 9003 | |
| 9004 | def __eq__(self, other): |
| 9005 | if type(self) != type(other): return False |
| 9006 | if self.xid != other.xid: return False |
| 9007 | if self.role != other.role: return False |
| 9008 | if self.data != other.data: return False |
| 9009 | return True |
| 9010 | |
| 9011 | def pretty_print(self, q): |
| 9012 | q.text("requestforward {") |
| 9013 | with q.group(): |
| 9014 | with q.indent(2): |
| 9015 | q.breakable() |
| 9016 | q.text("xid = "); |
| 9017 | if self.xid != None: |
| 9018 | q.text("%#x" % self.xid) |
| 9019 | else: |
| 9020 | q.text('None') |
| 9021 | q.text(","); q.breakable() |
| 9022 | q.text("role = "); |
| 9023 | q.text("%#x" % self.role) |
| 9024 | q.text(","); q.breakable() |
| 9025 | q.text("data = "); |
| 9026 | q.pp(self.data) |
| 9027 | q.breakable() |
| 9028 | q.text('}') |
| 9029 | |
| 9030 | message.subtypes[32] = requestforward |
| 9031 | |
| 9032 | class role_reply(message): |
| 9033 | version = 5 |
| 9034 | type = 25 |
| 9035 | |
| 9036 | def __init__(self, xid=None, role=None, generation_id=None): |
| 9037 | if xid != None: |
| 9038 | self.xid = xid |
| 9039 | else: |
| 9040 | self.xid = None |
| 9041 | if role != None: |
| 9042 | self.role = role |
| 9043 | else: |
| 9044 | self.role = 0 |
| 9045 | if generation_id != None: |
| 9046 | self.generation_id = generation_id |
| 9047 | else: |
| 9048 | self.generation_id = 0 |
| 9049 | return |
| 9050 | |
| 9051 | def pack(self): |
| 9052 | packed = [] |
| 9053 | packed.append(struct.pack("!B", self.version)) |
| 9054 | packed.append(struct.pack("!B", self.type)) |
| 9055 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9056 | packed.append(struct.pack("!L", self.xid)) |
| 9057 | packed.append(struct.pack("!L", self.role)) |
| 9058 | packed.append('\x00' * 4) |
| 9059 | packed.append(struct.pack("!Q", self.generation_id)) |
| 9060 | length = sum([len(x) for x in packed]) |
| 9061 | packed[2] = struct.pack("!H", length) |
| 9062 | return ''.join(packed) |
| 9063 | |
| 9064 | @staticmethod |
| 9065 | def unpack(reader): |
| 9066 | obj = role_reply() |
| 9067 | _version = reader.read("!B")[0] |
| 9068 | assert(_version == 5) |
| 9069 | _type = reader.read("!B")[0] |
| 9070 | assert(_type == 25) |
| 9071 | _length = reader.read("!H")[0] |
| 9072 | orig_reader = reader |
| 9073 | reader = orig_reader.slice(_length - (2 + 2)) |
| 9074 | obj.xid = reader.read("!L")[0] |
| 9075 | obj.role = reader.read("!L")[0] |
| 9076 | reader.skip(4) |
| 9077 | obj.generation_id = reader.read("!Q")[0] |
| 9078 | return obj |
| 9079 | |
| 9080 | def __eq__(self, other): |
| 9081 | if type(self) != type(other): return False |
| 9082 | if self.xid != other.xid: return False |
| 9083 | if self.role != other.role: return False |
| 9084 | if self.generation_id != other.generation_id: return False |
| 9085 | return True |
| 9086 | |
| 9087 | def pretty_print(self, q): |
| 9088 | q.text("role_reply {") |
| 9089 | with q.group(): |
| 9090 | with q.indent(2): |
| 9091 | q.breakable() |
| 9092 | q.text("xid = "); |
| 9093 | if self.xid != None: |
| 9094 | q.text("%#x" % self.xid) |
| 9095 | else: |
| 9096 | q.text('None') |
| 9097 | q.text(","); q.breakable() |
| 9098 | q.text("role = "); |
| 9099 | q.text("%#x" % self.role) |
| 9100 | q.text(","); q.breakable() |
| 9101 | q.text("generation_id = "); |
| 9102 | q.text("%#x" % self.generation_id) |
| 9103 | q.breakable() |
| 9104 | q.text('}') |
| 9105 | |
| 9106 | message.subtypes[25] = role_reply |
| 9107 | |
| 9108 | class role_request(message): |
| 9109 | version = 5 |
| 9110 | type = 24 |
| 9111 | |
| 9112 | def __init__(self, xid=None, role=None, generation_id=None): |
| 9113 | if xid != None: |
| 9114 | self.xid = xid |
| 9115 | else: |
| 9116 | self.xid = None |
| 9117 | if role != None: |
| 9118 | self.role = role |
| 9119 | else: |
| 9120 | self.role = 0 |
| 9121 | if generation_id != None: |
| 9122 | self.generation_id = generation_id |
| 9123 | else: |
| 9124 | self.generation_id = 0 |
| 9125 | return |
| 9126 | |
| 9127 | def pack(self): |
| 9128 | packed = [] |
| 9129 | packed.append(struct.pack("!B", self.version)) |
| 9130 | packed.append(struct.pack("!B", self.type)) |
| 9131 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9132 | packed.append(struct.pack("!L", self.xid)) |
| 9133 | packed.append(struct.pack("!L", self.role)) |
| 9134 | packed.append('\x00' * 4) |
| 9135 | packed.append(struct.pack("!Q", self.generation_id)) |
| 9136 | length = sum([len(x) for x in packed]) |
| 9137 | packed[2] = struct.pack("!H", length) |
| 9138 | return ''.join(packed) |
| 9139 | |
| 9140 | @staticmethod |
| 9141 | def unpack(reader): |
| 9142 | obj = role_request() |
| 9143 | _version = reader.read("!B")[0] |
| 9144 | assert(_version == 5) |
| 9145 | _type = reader.read("!B")[0] |
| 9146 | assert(_type == 24) |
| 9147 | _length = reader.read("!H")[0] |
| 9148 | orig_reader = reader |
| 9149 | reader = orig_reader.slice(_length - (2 + 2)) |
| 9150 | obj.xid = reader.read("!L")[0] |
| 9151 | obj.role = reader.read("!L")[0] |
| 9152 | reader.skip(4) |
| 9153 | obj.generation_id = reader.read("!Q")[0] |
| 9154 | return obj |
| 9155 | |
| 9156 | def __eq__(self, other): |
| 9157 | if type(self) != type(other): return False |
| 9158 | if self.xid != other.xid: return False |
| 9159 | if self.role != other.role: return False |
| 9160 | if self.generation_id != other.generation_id: return False |
| 9161 | return True |
| 9162 | |
| 9163 | def pretty_print(self, q): |
| 9164 | q.text("role_request {") |
| 9165 | with q.group(): |
| 9166 | with q.indent(2): |
| 9167 | q.breakable() |
| 9168 | q.text("xid = "); |
| 9169 | if self.xid != None: |
| 9170 | q.text("%#x" % self.xid) |
| 9171 | else: |
| 9172 | q.text('None') |
| 9173 | q.text(","); q.breakable() |
| 9174 | q.text("role = "); |
| 9175 | q.text("%#x" % self.role) |
| 9176 | q.text(","); q.breakable() |
| 9177 | q.text("generation_id = "); |
| 9178 | q.text("%#x" % self.generation_id) |
| 9179 | q.breakable() |
| 9180 | q.text('}') |
| 9181 | |
| 9182 | message.subtypes[24] = role_request |
| 9183 | |
| 9184 | class role_request_failed_error_msg(error_msg): |
| 9185 | version = 5 |
| 9186 | type = 1 |
| 9187 | err_type = 11 |
| 9188 | |
| 9189 | def __init__(self, xid=None, code=None, data=None): |
| 9190 | if xid != None: |
| 9191 | self.xid = xid |
| 9192 | else: |
| 9193 | self.xid = None |
| 9194 | if code != None: |
| 9195 | self.code = code |
| 9196 | else: |
| 9197 | self.code = 0 |
| 9198 | if data != None: |
| 9199 | self.data = data |
| 9200 | else: |
| 9201 | self.data = '' |
| 9202 | return |
| 9203 | |
| 9204 | def pack(self): |
| 9205 | packed = [] |
| 9206 | packed.append(struct.pack("!B", self.version)) |
| 9207 | packed.append(struct.pack("!B", self.type)) |
| 9208 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9209 | packed.append(struct.pack("!L", self.xid)) |
| 9210 | packed.append(struct.pack("!H", self.err_type)) |
| 9211 | packed.append(struct.pack("!H", self.code)) |
| 9212 | packed.append(self.data) |
| 9213 | length = sum([len(x) for x in packed]) |
| 9214 | packed[2] = struct.pack("!H", length) |
| 9215 | return ''.join(packed) |
| 9216 | |
| 9217 | @staticmethod |
| 9218 | def unpack(reader): |
| 9219 | obj = role_request_failed_error_msg() |
| 9220 | _version = reader.read("!B")[0] |
| 9221 | assert(_version == 5) |
| 9222 | _type = reader.read("!B")[0] |
| 9223 | assert(_type == 1) |
| 9224 | _length = reader.read("!H")[0] |
| 9225 | orig_reader = reader |
| 9226 | reader = orig_reader.slice(_length - (2 + 2)) |
| 9227 | obj.xid = reader.read("!L")[0] |
| 9228 | _err_type = reader.read("!H")[0] |
| 9229 | assert(_err_type == 11) |
| 9230 | obj.code = reader.read("!H")[0] |
| 9231 | obj.data = str(reader.read_all()) |
| 9232 | return obj |
| 9233 | |
| 9234 | def __eq__(self, other): |
| 9235 | if type(self) != type(other): return False |
| 9236 | if self.xid != other.xid: return False |
| 9237 | if self.code != other.code: return False |
| 9238 | if self.data != other.data: return False |
| 9239 | return True |
| 9240 | |
| 9241 | def pretty_print(self, q): |
| 9242 | q.text("role_request_failed_error_msg {") |
| 9243 | with q.group(): |
| 9244 | with q.indent(2): |
| 9245 | q.breakable() |
| 9246 | q.text("xid = "); |
| 9247 | if self.xid != None: |
| 9248 | q.text("%#x" % self.xid) |
| 9249 | else: |
| 9250 | q.text('None') |
| 9251 | q.text(","); q.breakable() |
| 9252 | q.text("code = "); |
| 9253 | q.text("%#x" % self.code) |
| 9254 | q.text(","); q.breakable() |
| 9255 | q.text("data = "); |
| 9256 | q.pp(self.data) |
| 9257 | q.breakable() |
| 9258 | q.text('}') |
| 9259 | |
| 9260 | error_msg.subtypes[11] = role_request_failed_error_msg |
| 9261 | |
| 9262 | class role_status(message): |
| 9263 | version = 5 |
| 9264 | type = 30 |
| 9265 | |
| 9266 | def __init__(self, xid=None, role=None, reason=None, generation_id=None, properties=None): |
| 9267 | if xid != None: |
| 9268 | self.xid = xid |
| 9269 | else: |
| 9270 | self.xid = None |
| 9271 | if role != None: |
| 9272 | self.role = role |
| 9273 | else: |
| 9274 | self.role = 0 |
| 9275 | if reason != None: |
| 9276 | self.reason = reason |
| 9277 | else: |
| 9278 | self.reason = 0 |
| 9279 | if generation_id != None: |
| 9280 | self.generation_id = generation_id |
| 9281 | else: |
| 9282 | self.generation_id = 0 |
| 9283 | if properties != None: |
| 9284 | self.properties = properties |
| 9285 | else: |
| 9286 | self.properties = [] |
| 9287 | return |
| 9288 | |
| 9289 | def pack(self): |
| 9290 | packed = [] |
| 9291 | packed.append(struct.pack("!B", self.version)) |
| 9292 | packed.append(struct.pack("!B", self.type)) |
| 9293 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9294 | packed.append(struct.pack("!L", self.xid)) |
| 9295 | packed.append(struct.pack("!L", self.role)) |
| 9296 | packed.append(struct.pack("!B", self.reason)) |
| 9297 | packed.append('\x00' * 3) |
| 9298 | packed.append(struct.pack("!Q", self.generation_id)) |
| 9299 | packed.append(loxi.generic_util.pack_list(self.properties)) |
| 9300 | length = sum([len(x) for x in packed]) |
| 9301 | packed[2] = struct.pack("!H", length) |
| 9302 | return ''.join(packed) |
| 9303 | |
| 9304 | @staticmethod |
| 9305 | def unpack(reader): |
| 9306 | obj = role_status() |
| 9307 | _version = reader.read("!B")[0] |
| 9308 | assert(_version == 5) |
| 9309 | _type = reader.read("!B")[0] |
| 9310 | assert(_type == 30) |
| 9311 | _length = reader.read("!H")[0] |
| 9312 | orig_reader = reader |
| 9313 | reader = orig_reader.slice(_length - (2 + 2)) |
| 9314 | obj.xid = reader.read("!L")[0] |
| 9315 | obj.role = reader.read("!L")[0] |
| 9316 | obj.reason = reader.read("!B")[0] |
| 9317 | reader.skip(3) |
| 9318 | obj.generation_id = reader.read("!Q")[0] |
| 9319 | obj.properties = loxi.generic_util.unpack_list(reader, role_prop.role_prop.unpack) |
| 9320 | return obj |
| 9321 | |
| 9322 | def __eq__(self, other): |
| 9323 | if type(self) != type(other): return False |
| 9324 | if self.xid != other.xid: return False |
| 9325 | if self.role != other.role: return False |
| 9326 | if self.reason != other.reason: return False |
| 9327 | if self.generation_id != other.generation_id: return False |
| 9328 | if self.properties != other.properties: return False |
| 9329 | return True |
| 9330 | |
| 9331 | def pretty_print(self, q): |
| 9332 | q.text("role_status {") |
| 9333 | with q.group(): |
| 9334 | with q.indent(2): |
| 9335 | q.breakable() |
| 9336 | q.text("xid = "); |
| 9337 | if self.xid != None: |
| 9338 | q.text("%#x" % self.xid) |
| 9339 | else: |
| 9340 | q.text('None') |
| 9341 | q.text(","); q.breakable() |
| 9342 | q.text("role = "); |
| 9343 | q.text("%#x" % self.role) |
| 9344 | q.text(","); q.breakable() |
| 9345 | q.text("reason = "); |
| 9346 | q.text("%#x" % self.reason) |
| 9347 | q.text(","); q.breakable() |
| 9348 | q.text("generation_id = "); |
| 9349 | q.text("%#x" % self.generation_id) |
| 9350 | q.text(","); q.breakable() |
| 9351 | q.text("properties = "); |
| 9352 | q.pp(self.properties) |
| 9353 | q.breakable() |
| 9354 | q.text('}') |
| 9355 | |
| 9356 | message.subtypes[30] = role_status |
| 9357 | |
| 9358 | class set_config(message): |
| 9359 | version = 5 |
| 9360 | type = 9 |
| 9361 | |
| 9362 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
| 9363 | if xid != None: |
| 9364 | self.xid = xid |
| 9365 | else: |
| 9366 | self.xid = None |
| 9367 | if flags != None: |
| 9368 | self.flags = flags |
| 9369 | else: |
| 9370 | self.flags = 0 |
| 9371 | if miss_send_len != None: |
| 9372 | self.miss_send_len = miss_send_len |
| 9373 | else: |
| 9374 | self.miss_send_len = 0 |
| 9375 | return |
| 9376 | |
| 9377 | def pack(self): |
| 9378 | packed = [] |
| 9379 | packed.append(struct.pack("!B", self.version)) |
| 9380 | packed.append(struct.pack("!B", self.type)) |
| 9381 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9382 | packed.append(struct.pack("!L", self.xid)) |
| 9383 | packed.append(struct.pack("!H", self.flags)) |
| 9384 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 9385 | length = sum([len(x) for x in packed]) |
| 9386 | packed[2] = struct.pack("!H", length) |
| 9387 | return ''.join(packed) |
| 9388 | |
| 9389 | @staticmethod |
| 9390 | def unpack(reader): |
| 9391 | obj = set_config() |
| 9392 | _version = reader.read("!B")[0] |
| 9393 | assert(_version == 5) |
| 9394 | _type = reader.read("!B")[0] |
| 9395 | assert(_type == 9) |
| 9396 | _length = reader.read("!H")[0] |
| 9397 | orig_reader = reader |
| 9398 | reader = orig_reader.slice(_length - (2 + 2)) |
| 9399 | obj.xid = reader.read("!L")[0] |
| 9400 | obj.flags = reader.read("!H")[0] |
| 9401 | obj.miss_send_len = reader.read("!H")[0] |
| 9402 | return obj |
| 9403 | |
| 9404 | def __eq__(self, other): |
| 9405 | if type(self) != type(other): return False |
| 9406 | if self.xid != other.xid: return False |
| 9407 | if self.flags != other.flags: return False |
| 9408 | if self.miss_send_len != other.miss_send_len: return False |
| 9409 | return True |
| 9410 | |
| 9411 | def pretty_print(self, q): |
| 9412 | q.text("set_config {") |
| 9413 | with q.group(): |
| 9414 | with q.indent(2): |
| 9415 | q.breakable() |
| 9416 | q.text("xid = "); |
| 9417 | if self.xid != None: |
| 9418 | q.text("%#x" % self.xid) |
| 9419 | else: |
| 9420 | q.text('None') |
| 9421 | q.text(","); q.breakable() |
| 9422 | q.text("flags = "); |
| 9423 | q.text("%#x" % self.flags) |
| 9424 | q.text(","); q.breakable() |
| 9425 | q.text("miss_send_len = "); |
| 9426 | q.text("%#x" % self.miss_send_len) |
| 9427 | q.breakable() |
| 9428 | q.text('}') |
| 9429 | |
| 9430 | message.subtypes[9] = set_config |
| 9431 | |
| 9432 | class switch_config_failed_error_msg(error_msg): |
| 9433 | version = 5 |
| 9434 | type = 1 |
| 9435 | err_type = 10 |
| 9436 | |
| 9437 | def __init__(self, xid=None, code=None, data=None): |
| 9438 | if xid != None: |
| 9439 | self.xid = xid |
| 9440 | else: |
| 9441 | self.xid = None |
| 9442 | if code != None: |
| 9443 | self.code = code |
| 9444 | else: |
| 9445 | self.code = 0 |
| 9446 | if data != None: |
| 9447 | self.data = data |
| 9448 | else: |
| 9449 | self.data = '' |
| 9450 | return |
| 9451 | |
| 9452 | def pack(self): |
| 9453 | packed = [] |
| 9454 | packed.append(struct.pack("!B", self.version)) |
| 9455 | packed.append(struct.pack("!B", self.type)) |
| 9456 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9457 | packed.append(struct.pack("!L", self.xid)) |
| 9458 | packed.append(struct.pack("!H", self.err_type)) |
| 9459 | packed.append(struct.pack("!H", self.code)) |
| 9460 | packed.append(self.data) |
| 9461 | length = sum([len(x) for x in packed]) |
| 9462 | packed[2] = struct.pack("!H", length) |
| 9463 | return ''.join(packed) |
| 9464 | |
| 9465 | @staticmethod |
| 9466 | def unpack(reader): |
| 9467 | obj = switch_config_failed_error_msg() |
| 9468 | _version = reader.read("!B")[0] |
| 9469 | assert(_version == 5) |
| 9470 | _type = reader.read("!B")[0] |
| 9471 | assert(_type == 1) |
| 9472 | _length = reader.read("!H")[0] |
| 9473 | orig_reader = reader |
| 9474 | reader = orig_reader.slice(_length - (2 + 2)) |
| 9475 | obj.xid = reader.read("!L")[0] |
| 9476 | _err_type = reader.read("!H")[0] |
| 9477 | assert(_err_type == 10) |
| 9478 | obj.code = reader.read("!H")[0] |
| 9479 | obj.data = str(reader.read_all()) |
| 9480 | return obj |
| 9481 | |
| 9482 | def __eq__(self, other): |
| 9483 | if type(self) != type(other): return False |
| 9484 | if self.xid != other.xid: return False |
| 9485 | if self.code != other.code: return False |
| 9486 | if self.data != other.data: return False |
| 9487 | return True |
| 9488 | |
| 9489 | def pretty_print(self, q): |
| 9490 | q.text("switch_config_failed_error_msg {") |
| 9491 | with q.group(): |
| 9492 | with q.indent(2): |
| 9493 | q.breakable() |
| 9494 | q.text("xid = "); |
| 9495 | if self.xid != None: |
| 9496 | q.text("%#x" % self.xid) |
| 9497 | else: |
| 9498 | q.text('None') |
| 9499 | q.text(","); q.breakable() |
| 9500 | q.text("code = "); |
| 9501 | q.text("%#x" % self.code) |
| 9502 | q.text(","); q.breakable() |
| 9503 | q.text("data = "); |
| 9504 | q.pp(self.data) |
| 9505 | q.breakable() |
| 9506 | q.text('}') |
| 9507 | |
| 9508 | error_msg.subtypes[10] = switch_config_failed_error_msg |
| 9509 | |
| 9510 | class table_desc_stats_reply(stats_reply): |
| 9511 | version = 5 |
| 9512 | type = 19 |
| 9513 | stats_type = 14 |
| 9514 | |
| 9515 | def __init__(self, xid=None, flags=None, entries=None): |
| 9516 | if xid != None: |
| 9517 | self.xid = xid |
| 9518 | else: |
| 9519 | self.xid = None |
| 9520 | if flags != None: |
| 9521 | self.flags = flags |
| 9522 | else: |
| 9523 | self.flags = 0 |
| 9524 | if entries != None: |
| 9525 | self.entries = entries |
| 9526 | else: |
| 9527 | self.entries = [] |
| 9528 | return |
| 9529 | |
| 9530 | def pack(self): |
| 9531 | packed = [] |
| 9532 | packed.append(struct.pack("!B", self.version)) |
| 9533 | packed.append(struct.pack("!B", self.type)) |
| 9534 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9535 | packed.append(struct.pack("!L", self.xid)) |
| 9536 | packed.append(struct.pack("!H", self.stats_type)) |
| 9537 | packed.append(struct.pack("!H", self.flags)) |
| 9538 | packed.append('\x00' * 4) |
| 9539 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 9540 | length = sum([len(x) for x in packed]) |
| 9541 | packed[2] = struct.pack("!H", length) |
| 9542 | return ''.join(packed) |
| 9543 | |
| 9544 | @staticmethod |
| 9545 | def unpack(reader): |
| 9546 | obj = table_desc_stats_reply() |
| 9547 | _version = reader.read("!B")[0] |
| 9548 | assert(_version == 5) |
| 9549 | _type = reader.read("!B")[0] |
| 9550 | assert(_type == 19) |
| 9551 | _length = reader.read("!H")[0] |
| 9552 | orig_reader = reader |
| 9553 | reader = orig_reader.slice(_length - (2 + 2)) |
| 9554 | obj.xid = reader.read("!L")[0] |
| 9555 | _stats_type = reader.read("!H")[0] |
| 9556 | assert(_stats_type == 14) |
| 9557 | obj.flags = reader.read("!H")[0] |
| 9558 | reader.skip(4) |
| 9559 | obj.entries = loxi.generic_util.unpack_list(reader, common.table_desc.unpack) |
| 9560 | return obj |
| 9561 | |
| 9562 | def __eq__(self, other): |
| 9563 | if type(self) != type(other): return False |
| 9564 | if self.xid != other.xid: return False |
| 9565 | if self.flags != other.flags: return False |
| 9566 | if self.entries != other.entries: return False |
| 9567 | return True |
| 9568 | |
| 9569 | def pretty_print(self, q): |
| 9570 | q.text("table_desc_stats_reply {") |
| 9571 | with q.group(): |
| 9572 | with q.indent(2): |
| 9573 | q.breakable() |
| 9574 | q.text("xid = "); |
| 9575 | if self.xid != None: |
| 9576 | q.text("%#x" % self.xid) |
| 9577 | else: |
| 9578 | q.text('None') |
| 9579 | q.text(","); q.breakable() |
| 9580 | q.text("flags = "); |
| 9581 | q.text("%#x" % self.flags) |
| 9582 | q.text(","); q.breakable() |
| 9583 | q.text("entries = "); |
| 9584 | q.pp(self.entries) |
| 9585 | q.breakable() |
| 9586 | q.text('}') |
| 9587 | |
| 9588 | stats_reply.subtypes[14] = table_desc_stats_reply |
| 9589 | |
| 9590 | class table_desc_stats_request(stats_request): |
| 9591 | version = 5 |
| 9592 | type = 18 |
| 9593 | stats_type = 14 |
| 9594 | |
| 9595 | def __init__(self, xid=None, flags=None): |
| 9596 | if xid != None: |
| 9597 | self.xid = xid |
| 9598 | else: |
| 9599 | self.xid = None |
| 9600 | if flags != None: |
| 9601 | self.flags = flags |
| 9602 | else: |
| 9603 | self.flags = 0 |
| 9604 | return |
| 9605 | |
| 9606 | def pack(self): |
| 9607 | packed = [] |
| 9608 | packed.append(struct.pack("!B", self.version)) |
| 9609 | packed.append(struct.pack("!B", self.type)) |
| 9610 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9611 | packed.append(struct.pack("!L", self.xid)) |
| 9612 | packed.append(struct.pack("!H", self.stats_type)) |
| 9613 | packed.append(struct.pack("!H", self.flags)) |
| 9614 | packed.append('\x00' * 4) |
| 9615 | length = sum([len(x) for x in packed]) |
| 9616 | packed[2] = struct.pack("!H", length) |
| 9617 | return ''.join(packed) |
| 9618 | |
| 9619 | @staticmethod |
| 9620 | def unpack(reader): |
| 9621 | obj = table_desc_stats_request() |
| 9622 | _version = reader.read("!B")[0] |
| 9623 | assert(_version == 5) |
| 9624 | _type = reader.read("!B")[0] |
| 9625 | assert(_type == 18) |
| 9626 | _length = reader.read("!H")[0] |
| 9627 | orig_reader = reader |
| 9628 | reader = orig_reader.slice(_length - (2 + 2)) |
| 9629 | obj.xid = reader.read("!L")[0] |
| 9630 | _stats_type = reader.read("!H")[0] |
| 9631 | assert(_stats_type == 14) |
| 9632 | obj.flags = reader.read("!H")[0] |
| 9633 | reader.skip(4) |
| 9634 | return obj |
| 9635 | |
| 9636 | def __eq__(self, other): |
| 9637 | if type(self) != type(other): return False |
| 9638 | if self.xid != other.xid: return False |
| 9639 | if self.flags != other.flags: return False |
| 9640 | return True |
| 9641 | |
| 9642 | def pretty_print(self, q): |
| 9643 | q.text("table_desc_stats_request {") |
| 9644 | with q.group(): |
| 9645 | with q.indent(2): |
| 9646 | q.breakable() |
| 9647 | q.text("xid = "); |
| 9648 | if self.xid != None: |
| 9649 | q.text("%#x" % self.xid) |
| 9650 | else: |
| 9651 | q.text('None') |
| 9652 | q.text(","); q.breakable() |
| 9653 | q.text("flags = "); |
| 9654 | q.text("%#x" % self.flags) |
| 9655 | q.breakable() |
| 9656 | q.text('}') |
| 9657 | |
| 9658 | stats_request.subtypes[14] = table_desc_stats_request |
| 9659 | |
| 9660 | class table_features_failed_error_msg(error_msg): |
| 9661 | version = 5 |
| 9662 | type = 1 |
| 9663 | err_type = 13 |
| 9664 | |
| 9665 | def __init__(self, xid=None, code=None, data=None): |
| 9666 | if xid != None: |
| 9667 | self.xid = xid |
| 9668 | else: |
| 9669 | self.xid = None |
| 9670 | if code != None: |
| 9671 | self.code = code |
| 9672 | else: |
| 9673 | self.code = 0 |
| 9674 | if data != None: |
| 9675 | self.data = data |
| 9676 | else: |
| 9677 | self.data = '' |
| 9678 | return |
| 9679 | |
| 9680 | def pack(self): |
| 9681 | packed = [] |
| 9682 | packed.append(struct.pack("!B", self.version)) |
| 9683 | packed.append(struct.pack("!B", self.type)) |
| 9684 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9685 | packed.append(struct.pack("!L", self.xid)) |
| 9686 | packed.append(struct.pack("!H", self.err_type)) |
| 9687 | packed.append(struct.pack("!H", self.code)) |
| 9688 | packed.append(self.data) |
| 9689 | length = sum([len(x) for x in packed]) |
| 9690 | packed[2] = struct.pack("!H", length) |
| 9691 | return ''.join(packed) |
| 9692 | |
| 9693 | @staticmethod |
| 9694 | def unpack(reader): |
| 9695 | obj = table_features_failed_error_msg() |
| 9696 | _version = reader.read("!B")[0] |
| 9697 | assert(_version == 5) |
| 9698 | _type = reader.read("!B")[0] |
| 9699 | assert(_type == 1) |
| 9700 | _length = reader.read("!H")[0] |
| 9701 | orig_reader = reader |
| 9702 | reader = orig_reader.slice(_length - (2 + 2)) |
| 9703 | obj.xid = reader.read("!L")[0] |
| 9704 | _err_type = reader.read("!H")[0] |
| 9705 | assert(_err_type == 13) |
| 9706 | obj.code = reader.read("!H")[0] |
| 9707 | obj.data = str(reader.read_all()) |
| 9708 | return obj |
| 9709 | |
| 9710 | def __eq__(self, other): |
| 9711 | if type(self) != type(other): return False |
| 9712 | if self.xid != other.xid: return False |
| 9713 | if self.code != other.code: return False |
| 9714 | if self.data != other.data: return False |
| 9715 | return True |
| 9716 | |
| 9717 | def pretty_print(self, q): |
| 9718 | q.text("table_features_failed_error_msg {") |
| 9719 | with q.group(): |
| 9720 | with q.indent(2): |
| 9721 | q.breakable() |
| 9722 | q.text("xid = "); |
| 9723 | if self.xid != None: |
| 9724 | q.text("%#x" % self.xid) |
| 9725 | else: |
| 9726 | q.text('None') |
| 9727 | q.text(","); q.breakable() |
| 9728 | q.text("code = "); |
| 9729 | q.text("%#x" % self.code) |
| 9730 | q.text(","); q.breakable() |
| 9731 | q.text("data = "); |
| 9732 | q.pp(self.data) |
| 9733 | q.breakable() |
| 9734 | q.text('}') |
| 9735 | |
| 9736 | error_msg.subtypes[13] = table_features_failed_error_msg |
| 9737 | |
| 9738 | class table_features_stats_reply(stats_reply): |
| 9739 | version = 5 |
| 9740 | type = 19 |
| 9741 | stats_type = 12 |
| 9742 | |
| 9743 | def __init__(self, xid=None, flags=None, entries=None): |
| 9744 | if xid != None: |
| 9745 | self.xid = xid |
| 9746 | else: |
| 9747 | self.xid = None |
| 9748 | if flags != None: |
| 9749 | self.flags = flags |
| 9750 | else: |
| 9751 | self.flags = 0 |
| 9752 | if entries != None: |
| 9753 | self.entries = entries |
| 9754 | else: |
| 9755 | self.entries = [] |
| 9756 | return |
| 9757 | |
| 9758 | def pack(self): |
| 9759 | packed = [] |
| 9760 | packed.append(struct.pack("!B", self.version)) |
| 9761 | packed.append(struct.pack("!B", self.type)) |
| 9762 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9763 | packed.append(struct.pack("!L", self.xid)) |
| 9764 | packed.append(struct.pack("!H", self.stats_type)) |
| 9765 | packed.append(struct.pack("!H", self.flags)) |
| 9766 | packed.append('\x00' * 4) |
| 9767 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 9768 | length = sum([len(x) for x in packed]) |
| 9769 | packed[2] = struct.pack("!H", length) |
| 9770 | return ''.join(packed) |
| 9771 | |
| 9772 | @staticmethod |
| 9773 | def unpack(reader): |
| 9774 | obj = table_features_stats_reply() |
| 9775 | _version = reader.read("!B")[0] |
| 9776 | assert(_version == 5) |
| 9777 | _type = reader.read("!B")[0] |
| 9778 | assert(_type == 19) |
| 9779 | _length = reader.read("!H")[0] |
| 9780 | orig_reader = reader |
| 9781 | reader = orig_reader.slice(_length - (2 + 2)) |
| 9782 | obj.xid = reader.read("!L")[0] |
| 9783 | _stats_type = reader.read("!H")[0] |
| 9784 | assert(_stats_type == 12) |
| 9785 | obj.flags = reader.read("!H")[0] |
| 9786 | reader.skip(4) |
| 9787 | obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack) |
| 9788 | return obj |
| 9789 | |
| 9790 | def __eq__(self, other): |
| 9791 | if type(self) != type(other): return False |
| 9792 | if self.xid != other.xid: return False |
| 9793 | if self.flags != other.flags: return False |
| 9794 | if self.entries != other.entries: return False |
| 9795 | return True |
| 9796 | |
| 9797 | def pretty_print(self, q): |
| 9798 | q.text("table_features_stats_reply {") |
| 9799 | with q.group(): |
| 9800 | with q.indent(2): |
| 9801 | q.breakable() |
| 9802 | q.text("xid = "); |
| 9803 | if self.xid != None: |
| 9804 | q.text("%#x" % self.xid) |
| 9805 | else: |
| 9806 | q.text('None') |
| 9807 | q.text(","); q.breakable() |
| 9808 | q.text("flags = "); |
| 9809 | q.text("%#x" % self.flags) |
| 9810 | q.text(","); q.breakable() |
| 9811 | q.text("entries = "); |
| 9812 | q.pp(self.entries) |
| 9813 | q.breakable() |
| 9814 | q.text('}') |
| 9815 | |
| 9816 | stats_reply.subtypes[12] = table_features_stats_reply |
| 9817 | |
| 9818 | class table_features_stats_request(stats_request): |
| 9819 | version = 5 |
| 9820 | type = 18 |
| 9821 | stats_type = 12 |
| 9822 | |
| 9823 | def __init__(self, xid=None, flags=None, entries=None): |
| 9824 | if xid != None: |
| 9825 | self.xid = xid |
| 9826 | else: |
| 9827 | self.xid = None |
| 9828 | if flags != None: |
| 9829 | self.flags = flags |
| 9830 | else: |
| 9831 | self.flags = 0 |
| 9832 | if entries != None: |
| 9833 | self.entries = entries |
| 9834 | else: |
| 9835 | self.entries = [] |
| 9836 | return |
| 9837 | |
| 9838 | def pack(self): |
| 9839 | packed = [] |
| 9840 | packed.append(struct.pack("!B", self.version)) |
| 9841 | packed.append(struct.pack("!B", self.type)) |
| 9842 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9843 | packed.append(struct.pack("!L", self.xid)) |
| 9844 | packed.append(struct.pack("!H", self.stats_type)) |
| 9845 | packed.append(struct.pack("!H", self.flags)) |
| 9846 | packed.append('\x00' * 4) |
| 9847 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 9848 | length = sum([len(x) for x in packed]) |
| 9849 | packed[2] = struct.pack("!H", length) |
| 9850 | return ''.join(packed) |
| 9851 | |
| 9852 | @staticmethod |
| 9853 | def unpack(reader): |
| 9854 | obj = table_features_stats_request() |
| 9855 | _version = reader.read("!B")[0] |
| 9856 | assert(_version == 5) |
| 9857 | _type = reader.read("!B")[0] |
| 9858 | assert(_type == 18) |
| 9859 | _length = reader.read("!H")[0] |
| 9860 | orig_reader = reader |
| 9861 | reader = orig_reader.slice(_length - (2 + 2)) |
| 9862 | obj.xid = reader.read("!L")[0] |
| 9863 | _stats_type = reader.read("!H")[0] |
| 9864 | assert(_stats_type == 12) |
| 9865 | obj.flags = reader.read("!H")[0] |
| 9866 | reader.skip(4) |
| 9867 | obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack) |
| 9868 | return obj |
| 9869 | |
| 9870 | def __eq__(self, other): |
| 9871 | if type(self) != type(other): return False |
| 9872 | if self.xid != other.xid: return False |
| 9873 | if self.flags != other.flags: return False |
| 9874 | if self.entries != other.entries: return False |
| 9875 | return True |
| 9876 | |
| 9877 | def pretty_print(self, q): |
| 9878 | q.text("table_features_stats_request {") |
| 9879 | with q.group(): |
| 9880 | with q.indent(2): |
| 9881 | q.breakable() |
| 9882 | q.text("xid = "); |
| 9883 | if self.xid != None: |
| 9884 | q.text("%#x" % self.xid) |
| 9885 | else: |
| 9886 | q.text('None') |
| 9887 | q.text(","); q.breakable() |
| 9888 | q.text("flags = "); |
| 9889 | q.text("%#x" % self.flags) |
| 9890 | q.text(","); q.breakable() |
| 9891 | q.text("entries = "); |
| 9892 | q.pp(self.entries) |
| 9893 | q.breakable() |
| 9894 | q.text('}') |
| 9895 | |
| 9896 | stats_request.subtypes[12] = table_features_stats_request |
| 9897 | |
| 9898 | class table_mod(message): |
| 9899 | version = 5 |
| 9900 | type = 17 |
| 9901 | |
| 9902 | def __init__(self, xid=None, table_id=None, config=None, properties=None): |
| 9903 | if xid != None: |
| 9904 | self.xid = xid |
| 9905 | else: |
| 9906 | self.xid = None |
| 9907 | if table_id != None: |
| 9908 | self.table_id = table_id |
| 9909 | else: |
| 9910 | self.table_id = 0 |
| 9911 | if config != None: |
| 9912 | self.config = config |
| 9913 | else: |
| 9914 | self.config = 0 |
| 9915 | if properties != None: |
| 9916 | self.properties = properties |
| 9917 | else: |
| 9918 | self.properties = [] |
| 9919 | return |
| 9920 | |
| 9921 | def pack(self): |
| 9922 | packed = [] |
| 9923 | packed.append(struct.pack("!B", self.version)) |
| 9924 | packed.append(struct.pack("!B", self.type)) |
| 9925 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9926 | packed.append(struct.pack("!L", self.xid)) |
| 9927 | packed.append(struct.pack("!B", self.table_id)) |
| 9928 | packed.append('\x00' * 3) |
| 9929 | packed.append(struct.pack("!L", self.config)) |
| 9930 | packed.append(loxi.generic_util.pack_list(self.properties)) |
| 9931 | length = sum([len(x) for x in packed]) |
| 9932 | packed[2] = struct.pack("!H", length) |
| 9933 | return ''.join(packed) |
| 9934 | |
| 9935 | @staticmethod |
| 9936 | def unpack(reader): |
| 9937 | obj = table_mod() |
| 9938 | _version = reader.read("!B")[0] |
| 9939 | assert(_version == 5) |
| 9940 | _type = reader.read("!B")[0] |
| 9941 | assert(_type == 17) |
| 9942 | _length = reader.read("!H")[0] |
| 9943 | orig_reader = reader |
| 9944 | reader = orig_reader.slice(_length - (2 + 2)) |
| 9945 | obj.xid = reader.read("!L")[0] |
| 9946 | obj.table_id = reader.read("!B")[0] |
| 9947 | reader.skip(3) |
| 9948 | obj.config = reader.read("!L")[0] |
| 9949 | obj.properties = loxi.generic_util.unpack_list(reader, table_mod_prop.table_mod_prop.unpack) |
| 9950 | return obj |
| 9951 | |
| 9952 | def __eq__(self, other): |
| 9953 | if type(self) != type(other): return False |
| 9954 | if self.xid != other.xid: return False |
| 9955 | if self.table_id != other.table_id: return False |
| 9956 | if self.config != other.config: return False |
| 9957 | if self.properties != other.properties: return False |
| 9958 | return True |
| 9959 | |
| 9960 | def pretty_print(self, q): |
| 9961 | q.text("table_mod {") |
| 9962 | with q.group(): |
| 9963 | with q.indent(2): |
| 9964 | q.breakable() |
| 9965 | q.text("xid = "); |
| 9966 | if self.xid != None: |
| 9967 | q.text("%#x" % self.xid) |
| 9968 | else: |
| 9969 | q.text('None') |
| 9970 | q.text(","); q.breakable() |
| 9971 | q.text("table_id = "); |
| 9972 | q.text("%#x" % self.table_id) |
| 9973 | q.text(","); q.breakable() |
| 9974 | q.text("config = "); |
| 9975 | q.text("%#x" % self.config) |
| 9976 | q.text(","); q.breakable() |
| 9977 | q.text("properties = "); |
| 9978 | q.pp(self.properties) |
| 9979 | q.breakable() |
| 9980 | q.text('}') |
| 9981 | |
| 9982 | message.subtypes[17] = table_mod |
| 9983 | |
| 9984 | class table_mod_failed_error_msg(error_msg): |
| 9985 | version = 5 |
| 9986 | type = 1 |
| 9987 | err_type = 8 |
| 9988 | |
| 9989 | def __init__(self, xid=None, code=None, data=None): |
| 9990 | if xid != None: |
| 9991 | self.xid = xid |
| 9992 | else: |
| 9993 | self.xid = None |
| 9994 | if code != None: |
| 9995 | self.code = code |
| 9996 | else: |
| 9997 | self.code = 0 |
| 9998 | if data != None: |
| 9999 | self.data = data |
| 10000 | else: |
| 10001 | self.data = '' |
| 10002 | return |
| 10003 | |
| 10004 | def pack(self): |
| 10005 | packed = [] |
| 10006 | packed.append(struct.pack("!B", self.version)) |
| 10007 | packed.append(struct.pack("!B", self.type)) |
| 10008 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10009 | packed.append(struct.pack("!L", self.xid)) |
| 10010 | packed.append(struct.pack("!H", self.err_type)) |
| 10011 | packed.append(struct.pack("!H", self.code)) |
| 10012 | packed.append(self.data) |
| 10013 | length = sum([len(x) for x in packed]) |
| 10014 | packed[2] = struct.pack("!H", length) |
| 10015 | return ''.join(packed) |
| 10016 | |
| 10017 | @staticmethod |
| 10018 | def unpack(reader): |
| 10019 | obj = table_mod_failed_error_msg() |
| 10020 | _version = reader.read("!B")[0] |
| 10021 | assert(_version == 5) |
| 10022 | _type = reader.read("!B")[0] |
| 10023 | assert(_type == 1) |
| 10024 | _length = reader.read("!H")[0] |
| 10025 | orig_reader = reader |
| 10026 | reader = orig_reader.slice(_length - (2 + 2)) |
| 10027 | obj.xid = reader.read("!L")[0] |
| 10028 | _err_type = reader.read("!H")[0] |
| 10029 | assert(_err_type == 8) |
| 10030 | obj.code = reader.read("!H")[0] |
| 10031 | obj.data = str(reader.read_all()) |
| 10032 | return obj |
| 10033 | |
| 10034 | def __eq__(self, other): |
| 10035 | if type(self) != type(other): return False |
| 10036 | if self.xid != other.xid: return False |
| 10037 | if self.code != other.code: return False |
| 10038 | if self.data != other.data: return False |
| 10039 | return True |
| 10040 | |
| 10041 | def pretty_print(self, q): |
| 10042 | q.text("table_mod_failed_error_msg {") |
| 10043 | with q.group(): |
| 10044 | with q.indent(2): |
| 10045 | q.breakable() |
| 10046 | q.text("xid = "); |
| 10047 | if self.xid != None: |
| 10048 | q.text("%#x" % self.xid) |
| 10049 | else: |
| 10050 | q.text('None') |
| 10051 | q.text(","); q.breakable() |
| 10052 | q.text("code = "); |
| 10053 | q.text("%#x" % self.code) |
| 10054 | q.text(","); q.breakable() |
| 10055 | q.text("data = "); |
| 10056 | q.pp(self.data) |
| 10057 | q.breakable() |
| 10058 | q.text('}') |
| 10059 | |
| 10060 | error_msg.subtypes[8] = table_mod_failed_error_msg |
| 10061 | |
| 10062 | class table_stats_reply(stats_reply): |
| 10063 | version = 5 |
| 10064 | type = 19 |
| 10065 | stats_type = 3 |
| 10066 | |
| 10067 | def __init__(self, xid=None, flags=None, entries=None): |
| 10068 | if xid != None: |
| 10069 | self.xid = xid |
| 10070 | else: |
| 10071 | self.xid = None |
| 10072 | if flags != None: |
| 10073 | self.flags = flags |
| 10074 | else: |
| 10075 | self.flags = 0 |
| 10076 | if entries != None: |
| 10077 | self.entries = entries |
| 10078 | else: |
| 10079 | self.entries = [] |
| 10080 | return |
| 10081 | |
| 10082 | def pack(self): |
| 10083 | packed = [] |
| 10084 | packed.append(struct.pack("!B", self.version)) |
| 10085 | packed.append(struct.pack("!B", self.type)) |
| 10086 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10087 | packed.append(struct.pack("!L", self.xid)) |
| 10088 | packed.append(struct.pack("!H", self.stats_type)) |
| 10089 | packed.append(struct.pack("!H", self.flags)) |
| 10090 | packed.append('\x00' * 4) |
| 10091 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 10092 | length = sum([len(x) for x in packed]) |
| 10093 | packed[2] = struct.pack("!H", length) |
| 10094 | return ''.join(packed) |
| 10095 | |
| 10096 | @staticmethod |
| 10097 | def unpack(reader): |
| 10098 | obj = table_stats_reply() |
| 10099 | _version = reader.read("!B")[0] |
| 10100 | assert(_version == 5) |
| 10101 | _type = reader.read("!B")[0] |
| 10102 | assert(_type == 19) |
| 10103 | _length = reader.read("!H")[0] |
| 10104 | orig_reader = reader |
| 10105 | reader = orig_reader.slice(_length - (2 + 2)) |
| 10106 | obj.xid = reader.read("!L")[0] |
| 10107 | _stats_type = reader.read("!H")[0] |
| 10108 | assert(_stats_type == 3) |
| 10109 | obj.flags = reader.read("!H")[0] |
| 10110 | reader.skip(4) |
| 10111 | obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack) |
| 10112 | return obj |
| 10113 | |
| 10114 | def __eq__(self, other): |
| 10115 | if type(self) != type(other): return False |
| 10116 | if self.xid != other.xid: return False |
| 10117 | if self.flags != other.flags: return False |
| 10118 | if self.entries != other.entries: return False |
| 10119 | return True |
| 10120 | |
| 10121 | def pretty_print(self, q): |
| 10122 | q.text("table_stats_reply {") |
| 10123 | with q.group(): |
| 10124 | with q.indent(2): |
| 10125 | q.breakable() |
| 10126 | q.text("xid = "); |
| 10127 | if self.xid != None: |
| 10128 | q.text("%#x" % self.xid) |
| 10129 | else: |
| 10130 | q.text('None') |
| 10131 | q.text(","); q.breakable() |
| 10132 | q.text("flags = "); |
| 10133 | q.text("%#x" % self.flags) |
| 10134 | q.text(","); q.breakable() |
| 10135 | q.text("entries = "); |
| 10136 | q.pp(self.entries) |
| 10137 | q.breakable() |
| 10138 | q.text('}') |
| 10139 | |
| 10140 | stats_reply.subtypes[3] = table_stats_reply |
| 10141 | |
| 10142 | class table_stats_request(stats_request): |
| 10143 | version = 5 |
| 10144 | type = 18 |
| 10145 | stats_type = 3 |
| 10146 | |
| 10147 | def __init__(self, xid=None, flags=None): |
| 10148 | if xid != None: |
| 10149 | self.xid = xid |
| 10150 | else: |
| 10151 | self.xid = None |
| 10152 | if flags != None: |
| 10153 | self.flags = flags |
| 10154 | else: |
| 10155 | self.flags = 0 |
| 10156 | return |
| 10157 | |
| 10158 | def pack(self): |
| 10159 | packed = [] |
| 10160 | packed.append(struct.pack("!B", self.version)) |
| 10161 | packed.append(struct.pack("!B", self.type)) |
| 10162 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10163 | packed.append(struct.pack("!L", self.xid)) |
| 10164 | packed.append(struct.pack("!H", self.stats_type)) |
| 10165 | packed.append(struct.pack("!H", self.flags)) |
| 10166 | packed.append('\x00' * 4) |
| 10167 | length = sum([len(x) for x in packed]) |
| 10168 | packed[2] = struct.pack("!H", length) |
| 10169 | return ''.join(packed) |
| 10170 | |
| 10171 | @staticmethod |
| 10172 | def unpack(reader): |
| 10173 | obj = table_stats_request() |
| 10174 | _version = reader.read("!B")[0] |
| 10175 | assert(_version == 5) |
| 10176 | _type = reader.read("!B")[0] |
| 10177 | assert(_type == 18) |
| 10178 | _length = reader.read("!H")[0] |
| 10179 | orig_reader = reader |
| 10180 | reader = orig_reader.slice(_length - (2 + 2)) |
| 10181 | obj.xid = reader.read("!L")[0] |
| 10182 | _stats_type = reader.read("!H")[0] |
| 10183 | assert(_stats_type == 3) |
| 10184 | obj.flags = reader.read("!H")[0] |
| 10185 | reader.skip(4) |
| 10186 | return obj |
| 10187 | |
| 10188 | def __eq__(self, other): |
| 10189 | if type(self) != type(other): return False |
| 10190 | if self.xid != other.xid: return False |
| 10191 | if self.flags != other.flags: return False |
| 10192 | return True |
| 10193 | |
| 10194 | def pretty_print(self, q): |
| 10195 | q.text("table_stats_request {") |
| 10196 | with q.group(): |
| 10197 | with q.indent(2): |
| 10198 | q.breakable() |
| 10199 | q.text("xid = "); |
| 10200 | if self.xid != None: |
| 10201 | q.text("%#x" % self.xid) |
| 10202 | else: |
| 10203 | q.text('None') |
| 10204 | q.text(","); q.breakable() |
| 10205 | q.text("flags = "); |
| 10206 | q.text("%#x" % self.flags) |
| 10207 | q.breakable() |
| 10208 | q.text('}') |
| 10209 | |
| 10210 | stats_request.subtypes[3] = table_stats_request |
| 10211 | |
| 10212 | class table_status(message): |
| 10213 | version = 5 |
| 10214 | type = 31 |
| 10215 | |
| 10216 | def __init__(self, xid=None, role=None, reason=None, table=None): |
| 10217 | if xid != None: |
| 10218 | self.xid = xid |
| 10219 | else: |
| 10220 | self.xid = None |
| 10221 | if role != None: |
| 10222 | self.role = role |
| 10223 | else: |
| 10224 | self.role = 0 |
| 10225 | if reason != None: |
| 10226 | self.reason = reason |
| 10227 | else: |
| 10228 | self.reason = 0 |
| 10229 | if table != None: |
| 10230 | self.table = table |
| 10231 | else: |
| 10232 | self.table = common.table_desc() |
| 10233 | return |
| 10234 | |
| 10235 | def pack(self): |
| 10236 | packed = [] |
| 10237 | packed.append(struct.pack("!B", self.version)) |
| 10238 | packed.append(struct.pack("!B", self.type)) |
| 10239 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10240 | packed.append(struct.pack("!L", self.xid)) |
| 10241 | packed.append(struct.pack("!L", self.role)) |
| 10242 | packed.append(struct.pack("!B", self.reason)) |
| 10243 | packed.append('\x00' * 7) |
| 10244 | packed.append(self.table.pack()) |
| 10245 | length = sum([len(x) for x in packed]) |
| 10246 | packed[2] = struct.pack("!H", length) |
| 10247 | return ''.join(packed) |
| 10248 | |
| 10249 | @staticmethod |
| 10250 | def unpack(reader): |
| 10251 | obj = table_status() |
| 10252 | _version = reader.read("!B")[0] |
| 10253 | assert(_version == 5) |
| 10254 | _type = reader.read("!B")[0] |
| 10255 | assert(_type == 31) |
| 10256 | _length = reader.read("!H")[0] |
| 10257 | orig_reader = reader |
| 10258 | reader = orig_reader.slice(_length - (2 + 2)) |
| 10259 | obj.xid = reader.read("!L")[0] |
| 10260 | obj.role = reader.read("!L")[0] |
| 10261 | obj.reason = reader.read("!B")[0] |
| 10262 | reader.skip(7) |
| 10263 | obj.table = common.table_desc.unpack(reader) |
| 10264 | return obj |
| 10265 | |
| 10266 | def __eq__(self, other): |
| 10267 | if type(self) != type(other): return False |
| 10268 | if self.xid != other.xid: return False |
| 10269 | if self.role != other.role: return False |
| 10270 | if self.reason != other.reason: return False |
| 10271 | if self.table != other.table: return False |
| 10272 | return True |
| 10273 | |
| 10274 | def pretty_print(self, q): |
| 10275 | q.text("table_status {") |
| 10276 | with q.group(): |
| 10277 | with q.indent(2): |
| 10278 | q.breakable() |
| 10279 | q.text("xid = "); |
| 10280 | if self.xid != None: |
| 10281 | q.text("%#x" % self.xid) |
| 10282 | else: |
| 10283 | q.text('None') |
| 10284 | q.text(","); q.breakable() |
| 10285 | q.text("role = "); |
| 10286 | q.text("%#x" % self.role) |
| 10287 | q.text(","); q.breakable() |
| 10288 | q.text("reason = "); |
| 10289 | q.text("%#x" % self.reason) |
| 10290 | q.text(","); q.breakable() |
| 10291 | q.text("table = "); |
| 10292 | q.pp(self.table) |
| 10293 | q.breakable() |
| 10294 | q.text('}') |
| 10295 | |
| 10296 | message.subtypes[31] = table_status |
| 10297 | |
| 10298 | |
| 10299 | def parse_header(buf): |
| 10300 | if len(buf) < 8: |
| 10301 | raise loxi.ProtocolError("too short to be an OpenFlow message") |
| 10302 | return struct.unpack_from("!BBHL", buf) |
| 10303 | |
| 10304 | def parse_message(buf): |
| 10305 | msg_ver, msg_type, msg_len, msg_xid = parse_header(buf) |
| 10306 | if msg_ver != const.OFP_VERSION and msg_type != const.OFPT_HELLO: |
| 10307 | raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (const.OFP_VERSION, msg_ver)) |
| 10308 | if len(buf) != msg_len: |
| 10309 | raise loxi.ProtocolError("incorrect message size") |
| 10310 | return message.unpack(loxi.generic_util.OFReader(buf)) |