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 |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 11 | import util |
| 12 | import loxi.generic_util |
| 13 | |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 14 | import sys |
| 15 | ofp = sys.modules['loxi.of14'] |
| 16 | |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 17 | class message(loxi.OFObject): |
| 18 | subtypes = {} |
| 19 | |
| 20 | version = 5 |
| 21 | |
| 22 | def __init__(self, type=None, xid=None): |
| 23 | if type != None: |
| 24 | self.type = type |
| 25 | else: |
| 26 | self.type = 0 |
| 27 | if xid != None: |
| 28 | self.xid = xid |
| 29 | else: |
| 30 | self.xid = None |
| 31 | return |
| 32 | |
| 33 | def pack(self): |
| 34 | packed = [] |
| 35 | packed.append(struct.pack("!B", self.version)) |
| 36 | packed.append(struct.pack("!B", self.type)) |
| 37 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 38 | packed.append(struct.pack("!L", self.xid)) |
| 39 | length = sum([len(x) for x in packed]) |
| 40 | packed[2] = struct.pack("!H", length) |
| 41 | return ''.join(packed) |
| 42 | |
| 43 | @staticmethod |
| 44 | def unpack(reader): |
| 45 | subtype, = reader.peek('B', 1) |
| 46 | subclass = message.subtypes.get(subtype) |
| 47 | if subclass: |
| 48 | return subclass.unpack(reader) |
| 49 | |
| 50 | obj = message() |
| 51 | _version = reader.read("!B")[0] |
| 52 | assert(_version == 5) |
| 53 | obj.type = reader.read("!B")[0] |
| 54 | _length = reader.read("!H")[0] |
| 55 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 56 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 57 | obj.xid = reader.read("!L")[0] |
| 58 | return obj |
| 59 | |
| 60 | def __eq__(self, other): |
| 61 | if type(self) != type(other): return False |
| 62 | if self.type != other.type: return False |
| 63 | if self.xid != other.xid: return False |
| 64 | return True |
| 65 | |
| 66 | def pretty_print(self, q): |
| 67 | q.text("message {") |
| 68 | with q.group(): |
| 69 | with q.indent(2): |
| 70 | q.breakable() |
| 71 | q.text("xid = "); |
| 72 | if self.xid != None: |
| 73 | q.text("%#x" % self.xid) |
| 74 | else: |
| 75 | q.text('None') |
| 76 | q.breakable() |
| 77 | q.text('}') |
| 78 | |
| 79 | |
| 80 | class stats_reply(message): |
| 81 | subtypes = {} |
| 82 | |
| 83 | version = 5 |
| 84 | type = 19 |
| 85 | |
| 86 | def __init__(self, xid=None, stats_type=None, flags=None): |
| 87 | if xid != None: |
| 88 | self.xid = xid |
| 89 | else: |
| 90 | self.xid = None |
| 91 | if stats_type != None: |
| 92 | self.stats_type = stats_type |
| 93 | else: |
| 94 | self.stats_type = 0 |
| 95 | if flags != None: |
| 96 | self.flags = flags |
| 97 | else: |
| 98 | self.flags = 0 |
| 99 | return |
| 100 | |
| 101 | def pack(self): |
| 102 | packed = [] |
| 103 | packed.append(struct.pack("!B", self.version)) |
| 104 | packed.append(struct.pack("!B", self.type)) |
| 105 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 106 | packed.append(struct.pack("!L", self.xid)) |
| 107 | packed.append(struct.pack("!H", self.stats_type)) |
| 108 | packed.append(struct.pack("!H", self.flags)) |
| 109 | packed.append('\x00' * 4) |
| 110 | length = sum([len(x) for x in packed]) |
| 111 | packed[2] = struct.pack("!H", length) |
| 112 | return ''.join(packed) |
| 113 | |
| 114 | @staticmethod |
| 115 | def unpack(reader): |
| 116 | subtype, = reader.peek('!H', 8) |
| 117 | subclass = stats_reply.subtypes.get(subtype) |
| 118 | if subclass: |
| 119 | return subclass.unpack(reader) |
| 120 | |
| 121 | obj = stats_reply() |
| 122 | _version = reader.read("!B")[0] |
| 123 | assert(_version == 5) |
| 124 | _type = reader.read("!B")[0] |
| 125 | assert(_type == 19) |
| 126 | _length = reader.read("!H")[0] |
| 127 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 128 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 129 | obj.xid = reader.read("!L")[0] |
| 130 | obj.stats_type = reader.read("!H")[0] |
| 131 | obj.flags = reader.read("!H")[0] |
| 132 | reader.skip(4) |
| 133 | return obj |
| 134 | |
| 135 | def __eq__(self, other): |
| 136 | if type(self) != type(other): return False |
| 137 | if self.xid != other.xid: return False |
| 138 | if self.stats_type != other.stats_type: return False |
| 139 | if self.flags != other.flags: return False |
| 140 | return True |
| 141 | |
| 142 | def pretty_print(self, q): |
| 143 | q.text("stats_reply {") |
| 144 | with q.group(): |
| 145 | with q.indent(2): |
| 146 | q.breakable() |
| 147 | q.text("xid = "); |
| 148 | if self.xid != None: |
| 149 | q.text("%#x" % self.xid) |
| 150 | else: |
| 151 | q.text('None') |
| 152 | q.text(","); q.breakable() |
| 153 | q.text("flags = "); |
| 154 | q.text("%#x" % self.flags) |
| 155 | q.breakable() |
| 156 | q.text('}') |
| 157 | |
| 158 | message.subtypes[19] = stats_reply |
| 159 | |
| 160 | class aggregate_stats_reply(stats_reply): |
| 161 | version = 5 |
| 162 | type = 19 |
| 163 | stats_type = 2 |
| 164 | |
| 165 | def __init__(self, xid=None, flags=None, packet_count=None, byte_count=None, flow_count=None): |
| 166 | if xid != None: |
| 167 | self.xid = xid |
| 168 | else: |
| 169 | self.xid = None |
| 170 | if flags != None: |
| 171 | self.flags = flags |
| 172 | else: |
| 173 | self.flags = 0 |
| 174 | if packet_count != None: |
| 175 | self.packet_count = packet_count |
| 176 | else: |
| 177 | self.packet_count = 0 |
| 178 | if byte_count != None: |
| 179 | self.byte_count = byte_count |
| 180 | else: |
| 181 | self.byte_count = 0 |
| 182 | if flow_count != None: |
| 183 | self.flow_count = flow_count |
| 184 | else: |
| 185 | self.flow_count = 0 |
| 186 | return |
| 187 | |
| 188 | def pack(self): |
| 189 | packed = [] |
| 190 | packed.append(struct.pack("!B", self.version)) |
| 191 | packed.append(struct.pack("!B", self.type)) |
| 192 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 193 | packed.append(struct.pack("!L", self.xid)) |
| 194 | packed.append(struct.pack("!H", self.stats_type)) |
| 195 | packed.append(struct.pack("!H", self.flags)) |
| 196 | packed.append('\x00' * 4) |
| 197 | packed.append(struct.pack("!Q", self.packet_count)) |
| 198 | packed.append(struct.pack("!Q", self.byte_count)) |
| 199 | packed.append(struct.pack("!L", self.flow_count)) |
| 200 | packed.append('\x00' * 4) |
| 201 | length = sum([len(x) for x in packed]) |
| 202 | packed[2] = struct.pack("!H", length) |
| 203 | return ''.join(packed) |
| 204 | |
| 205 | @staticmethod |
| 206 | def unpack(reader): |
| 207 | obj = aggregate_stats_reply() |
| 208 | _version = reader.read("!B")[0] |
| 209 | assert(_version == 5) |
| 210 | _type = reader.read("!B")[0] |
| 211 | assert(_type == 19) |
| 212 | _length = reader.read("!H")[0] |
| 213 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 214 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 215 | obj.xid = reader.read("!L")[0] |
| 216 | _stats_type = reader.read("!H")[0] |
| 217 | assert(_stats_type == 2) |
| 218 | obj.flags = reader.read("!H")[0] |
| 219 | reader.skip(4) |
| 220 | obj.packet_count = reader.read("!Q")[0] |
| 221 | obj.byte_count = reader.read("!Q")[0] |
| 222 | obj.flow_count = reader.read("!L")[0] |
| 223 | reader.skip(4) |
| 224 | return obj |
| 225 | |
| 226 | def __eq__(self, other): |
| 227 | if type(self) != type(other): return False |
| 228 | if self.xid != other.xid: return False |
| 229 | if self.flags != other.flags: return False |
| 230 | if self.packet_count != other.packet_count: return False |
| 231 | if self.byte_count != other.byte_count: return False |
| 232 | if self.flow_count != other.flow_count: return False |
| 233 | return True |
| 234 | |
| 235 | def pretty_print(self, q): |
| 236 | q.text("aggregate_stats_reply {") |
| 237 | with q.group(): |
| 238 | with q.indent(2): |
| 239 | q.breakable() |
| 240 | q.text("xid = "); |
| 241 | if self.xid != None: |
| 242 | q.text("%#x" % self.xid) |
| 243 | else: |
| 244 | q.text('None') |
| 245 | q.text(","); q.breakable() |
| 246 | q.text("flags = "); |
| 247 | q.text("%#x" % self.flags) |
| 248 | q.text(","); q.breakable() |
| 249 | q.text("packet_count = "); |
| 250 | q.text("%#x" % self.packet_count) |
| 251 | q.text(","); q.breakable() |
| 252 | q.text("byte_count = "); |
| 253 | q.text("%#x" % self.byte_count) |
| 254 | q.text(","); q.breakable() |
| 255 | q.text("flow_count = "); |
| 256 | q.text("%#x" % self.flow_count) |
| 257 | q.breakable() |
| 258 | q.text('}') |
| 259 | |
| 260 | stats_reply.subtypes[2] = aggregate_stats_reply |
| 261 | |
| 262 | class stats_request(message): |
| 263 | subtypes = {} |
| 264 | |
| 265 | version = 5 |
| 266 | type = 18 |
| 267 | |
| 268 | def __init__(self, xid=None, stats_type=None, flags=None): |
| 269 | if xid != None: |
| 270 | self.xid = xid |
| 271 | else: |
| 272 | self.xid = None |
| 273 | if stats_type != None: |
| 274 | self.stats_type = stats_type |
| 275 | else: |
| 276 | self.stats_type = 0 |
| 277 | if flags != None: |
| 278 | self.flags = flags |
| 279 | else: |
| 280 | self.flags = 0 |
| 281 | return |
| 282 | |
| 283 | def pack(self): |
| 284 | packed = [] |
| 285 | packed.append(struct.pack("!B", self.version)) |
| 286 | packed.append(struct.pack("!B", self.type)) |
| 287 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 288 | packed.append(struct.pack("!L", self.xid)) |
| 289 | packed.append(struct.pack("!H", self.stats_type)) |
| 290 | packed.append(struct.pack("!H", self.flags)) |
| 291 | packed.append('\x00' * 4) |
| 292 | length = sum([len(x) for x in packed]) |
| 293 | packed[2] = struct.pack("!H", length) |
| 294 | return ''.join(packed) |
| 295 | |
| 296 | @staticmethod |
| 297 | def unpack(reader): |
| 298 | subtype, = reader.peek('!H', 8) |
| 299 | subclass = stats_request.subtypes.get(subtype) |
| 300 | if subclass: |
| 301 | return subclass.unpack(reader) |
| 302 | |
| 303 | obj = stats_request() |
| 304 | _version = reader.read("!B")[0] |
| 305 | assert(_version == 5) |
| 306 | _type = reader.read("!B")[0] |
| 307 | assert(_type == 18) |
| 308 | _length = reader.read("!H")[0] |
| 309 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 310 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 311 | obj.xid = reader.read("!L")[0] |
| 312 | obj.stats_type = reader.read("!H")[0] |
| 313 | obj.flags = reader.read("!H")[0] |
| 314 | reader.skip(4) |
| 315 | return obj |
| 316 | |
| 317 | def __eq__(self, other): |
| 318 | if type(self) != type(other): return False |
| 319 | if self.xid != other.xid: return False |
| 320 | if self.stats_type != other.stats_type: return False |
| 321 | if self.flags != other.flags: return False |
| 322 | return True |
| 323 | |
| 324 | def pretty_print(self, q): |
| 325 | q.text("stats_request {") |
| 326 | with q.group(): |
| 327 | with q.indent(2): |
| 328 | q.breakable() |
| 329 | q.text("xid = "); |
| 330 | if self.xid != None: |
| 331 | q.text("%#x" % self.xid) |
| 332 | else: |
| 333 | q.text('None') |
| 334 | q.text(","); q.breakable() |
| 335 | q.text("flags = "); |
| 336 | q.text("%#x" % self.flags) |
| 337 | q.breakable() |
| 338 | q.text('}') |
| 339 | |
| 340 | message.subtypes[18] = stats_request |
| 341 | |
| 342 | class aggregate_stats_request(stats_request): |
| 343 | version = 5 |
| 344 | type = 18 |
| 345 | stats_type = 2 |
| 346 | |
| 347 | def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None): |
| 348 | if xid != None: |
| 349 | self.xid = xid |
| 350 | else: |
| 351 | self.xid = None |
| 352 | if flags != None: |
| 353 | self.flags = flags |
| 354 | else: |
| 355 | self.flags = 0 |
| 356 | if table_id != None: |
| 357 | self.table_id = table_id |
| 358 | else: |
| 359 | self.table_id = 0 |
| 360 | if out_port != None: |
| 361 | self.out_port = out_port |
| 362 | else: |
| 363 | self.out_port = 0 |
| 364 | if out_group != None: |
| 365 | self.out_group = out_group |
| 366 | else: |
| 367 | self.out_group = 0 |
| 368 | if cookie != None: |
| 369 | self.cookie = cookie |
| 370 | else: |
| 371 | self.cookie = 0 |
| 372 | if cookie_mask != None: |
| 373 | self.cookie_mask = cookie_mask |
| 374 | else: |
| 375 | self.cookie_mask = 0 |
| 376 | if match != None: |
| 377 | self.match = match |
| 378 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 379 | self.match = ofp.match() |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 380 | return |
| 381 | |
| 382 | def pack(self): |
| 383 | packed = [] |
| 384 | packed.append(struct.pack("!B", self.version)) |
| 385 | packed.append(struct.pack("!B", self.type)) |
| 386 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 387 | packed.append(struct.pack("!L", self.xid)) |
| 388 | packed.append(struct.pack("!H", self.stats_type)) |
| 389 | packed.append(struct.pack("!H", self.flags)) |
| 390 | packed.append('\x00' * 4) |
| 391 | packed.append(struct.pack("!B", self.table_id)) |
| 392 | packed.append('\x00' * 3) |
| 393 | packed.append(util.pack_port_no(self.out_port)) |
| 394 | packed.append(struct.pack("!L", self.out_group)) |
| 395 | packed.append('\x00' * 4) |
| 396 | packed.append(struct.pack("!Q", self.cookie)) |
| 397 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 398 | packed.append(self.match.pack()) |
| 399 | length = sum([len(x) for x in packed]) |
| 400 | packed[2] = struct.pack("!H", length) |
| 401 | return ''.join(packed) |
| 402 | |
| 403 | @staticmethod |
| 404 | def unpack(reader): |
| 405 | obj = aggregate_stats_request() |
| 406 | _version = reader.read("!B")[0] |
| 407 | assert(_version == 5) |
| 408 | _type = reader.read("!B")[0] |
| 409 | assert(_type == 18) |
| 410 | _length = reader.read("!H")[0] |
| 411 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 412 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 413 | obj.xid = reader.read("!L")[0] |
| 414 | _stats_type = reader.read("!H")[0] |
| 415 | assert(_stats_type == 2) |
| 416 | obj.flags = reader.read("!H")[0] |
| 417 | reader.skip(4) |
| 418 | obj.table_id = reader.read("!B")[0] |
| 419 | reader.skip(3) |
| 420 | obj.out_port = util.unpack_port_no(reader) |
| 421 | obj.out_group = reader.read("!L")[0] |
| 422 | reader.skip(4) |
| 423 | obj.cookie = reader.read("!Q")[0] |
| 424 | obj.cookie_mask = reader.read("!Q")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 425 | obj.match = ofp.match.unpack(reader) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 426 | return obj |
| 427 | |
| 428 | def __eq__(self, other): |
| 429 | if type(self) != type(other): return False |
| 430 | if self.xid != other.xid: return False |
| 431 | if self.flags != other.flags: return False |
| 432 | if self.table_id != other.table_id: return False |
| 433 | if self.out_port != other.out_port: return False |
| 434 | if self.out_group != other.out_group: return False |
| 435 | if self.cookie != other.cookie: return False |
| 436 | if self.cookie_mask != other.cookie_mask: return False |
| 437 | if self.match != other.match: return False |
| 438 | return True |
| 439 | |
| 440 | def pretty_print(self, q): |
| 441 | q.text("aggregate_stats_request {") |
| 442 | with q.group(): |
| 443 | with q.indent(2): |
| 444 | q.breakable() |
| 445 | q.text("xid = "); |
| 446 | if self.xid != None: |
| 447 | q.text("%#x" % self.xid) |
| 448 | else: |
| 449 | q.text('None') |
| 450 | q.text(","); q.breakable() |
| 451 | q.text("flags = "); |
| 452 | q.text("%#x" % self.flags) |
| 453 | q.text(","); q.breakable() |
| 454 | q.text("table_id = "); |
| 455 | q.text("%#x" % self.table_id) |
| 456 | q.text(","); q.breakable() |
| 457 | q.text("out_port = "); |
| 458 | q.text(util.pretty_port(self.out_port)) |
| 459 | q.text(","); q.breakable() |
| 460 | q.text("out_group = "); |
| 461 | q.text("%#x" % self.out_group) |
| 462 | q.text(","); q.breakable() |
| 463 | q.text("cookie = "); |
| 464 | q.text("%#x" % self.cookie) |
| 465 | q.text(","); q.breakable() |
| 466 | q.text("cookie_mask = "); |
| 467 | q.text("%#x" % self.cookie_mask) |
| 468 | q.text(","); q.breakable() |
| 469 | q.text("match = "); |
| 470 | q.pp(self.match) |
| 471 | q.breakable() |
| 472 | q.text('}') |
| 473 | |
| 474 | stats_request.subtypes[2] = aggregate_stats_request |
| 475 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 476 | class error_msg(message): |
| 477 | subtypes = {} |
| 478 | |
| 479 | version = 5 |
| 480 | type = 1 |
| 481 | |
| 482 | def __init__(self, xid=None, err_type=None): |
| 483 | if xid != None: |
| 484 | self.xid = xid |
| 485 | else: |
| 486 | self.xid = None |
| 487 | if err_type != None: |
| 488 | self.err_type = err_type |
| 489 | else: |
| 490 | self.err_type = 0 |
| 491 | return |
| 492 | |
| 493 | def pack(self): |
| 494 | packed = [] |
| 495 | packed.append(struct.pack("!B", self.version)) |
| 496 | packed.append(struct.pack("!B", self.type)) |
| 497 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 498 | packed.append(struct.pack("!L", self.xid)) |
| 499 | packed.append(struct.pack("!H", self.err_type)) |
| 500 | length = sum([len(x) for x in packed]) |
| 501 | packed[2] = struct.pack("!H", length) |
| 502 | return ''.join(packed) |
| 503 | |
| 504 | @staticmethod |
| 505 | def unpack(reader): |
| 506 | subtype, = reader.peek('!H', 8) |
| 507 | subclass = error_msg.subtypes.get(subtype) |
| 508 | if subclass: |
| 509 | return subclass.unpack(reader) |
| 510 | |
| 511 | obj = error_msg() |
| 512 | _version = reader.read("!B")[0] |
| 513 | assert(_version == 5) |
| 514 | _type = reader.read("!B")[0] |
| 515 | assert(_type == 1) |
| 516 | _length = reader.read("!H")[0] |
| 517 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 518 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 519 | obj.xid = reader.read("!L")[0] |
| 520 | obj.err_type = reader.read("!H")[0] |
| 521 | return obj |
| 522 | |
| 523 | def __eq__(self, other): |
| 524 | if type(self) != type(other): return False |
| 525 | if self.xid != other.xid: return False |
| 526 | if self.err_type != other.err_type: return False |
| 527 | return True |
| 528 | |
| 529 | def pretty_print(self, q): |
| 530 | q.text("error_msg {") |
| 531 | with q.group(): |
| 532 | with q.indent(2): |
| 533 | q.breakable() |
| 534 | q.text("xid = "); |
| 535 | if self.xid != None: |
| 536 | q.text("%#x" % self.xid) |
| 537 | else: |
| 538 | q.text('None') |
| 539 | q.breakable() |
| 540 | q.text('}') |
| 541 | |
| 542 | message.subtypes[1] = error_msg |
| 543 | |
| 544 | class async_config_failed_error_msg(error_msg): |
| 545 | version = 5 |
| 546 | type = 1 |
| 547 | err_type = 15 |
| 548 | |
| 549 | def __init__(self, xid=None, code=None, data=None): |
| 550 | if xid != None: |
| 551 | self.xid = xid |
| 552 | else: |
| 553 | self.xid = None |
| 554 | if code != None: |
| 555 | self.code = code |
| 556 | else: |
| 557 | self.code = 0 |
| 558 | if data != None: |
| 559 | self.data = data |
| 560 | else: |
| 561 | self.data = '' |
| 562 | return |
| 563 | |
| 564 | def pack(self): |
| 565 | packed = [] |
| 566 | packed.append(struct.pack("!B", self.version)) |
| 567 | packed.append(struct.pack("!B", self.type)) |
| 568 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 569 | packed.append(struct.pack("!L", self.xid)) |
| 570 | packed.append(struct.pack("!H", self.err_type)) |
| 571 | packed.append(struct.pack("!H", self.code)) |
| 572 | packed.append(self.data) |
| 573 | length = sum([len(x) for x in packed]) |
| 574 | packed[2] = struct.pack("!H", length) |
| 575 | return ''.join(packed) |
| 576 | |
| 577 | @staticmethod |
| 578 | def unpack(reader): |
| 579 | obj = async_config_failed_error_msg() |
| 580 | _version = reader.read("!B")[0] |
| 581 | assert(_version == 5) |
| 582 | _type = reader.read("!B")[0] |
| 583 | assert(_type == 1) |
| 584 | _length = reader.read("!H")[0] |
| 585 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 586 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 587 | obj.xid = reader.read("!L")[0] |
| 588 | _err_type = reader.read("!H")[0] |
| 589 | assert(_err_type == 15) |
| 590 | obj.code = reader.read("!H")[0] |
| 591 | obj.data = str(reader.read_all()) |
| 592 | return obj |
| 593 | |
| 594 | def __eq__(self, other): |
| 595 | if type(self) != type(other): return False |
| 596 | if self.xid != other.xid: return False |
| 597 | if self.code != other.code: return False |
| 598 | if self.data != other.data: return False |
| 599 | return True |
| 600 | |
| 601 | def pretty_print(self, q): |
| 602 | q.text("async_config_failed_error_msg {") |
| 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("code = "); |
| 613 | q.text("%#x" % self.code) |
| 614 | q.text(","); q.breakable() |
| 615 | q.text("data = "); |
| 616 | q.pp(self.data) |
| 617 | q.breakable() |
| 618 | q.text('}') |
| 619 | |
| 620 | error_msg.subtypes[15] = async_config_failed_error_msg |
| 621 | |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 622 | class async_get_reply(message): |
| 623 | version = 5 |
| 624 | type = 27 |
| 625 | |
| 626 | def __init__(self, xid=None, properties=None): |
| 627 | if xid != None: |
| 628 | self.xid = xid |
| 629 | else: |
| 630 | self.xid = None |
| 631 | if properties != None: |
| 632 | self.properties = properties |
| 633 | else: |
| 634 | self.properties = [] |
| 635 | return |
| 636 | |
| 637 | def pack(self): |
| 638 | packed = [] |
| 639 | packed.append(struct.pack("!B", self.version)) |
| 640 | packed.append(struct.pack("!B", self.type)) |
| 641 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 642 | packed.append(struct.pack("!L", self.xid)) |
| 643 | packed.append(loxi.generic_util.pack_list(self.properties)) |
| 644 | length = sum([len(x) for x in packed]) |
| 645 | packed[2] = struct.pack("!H", length) |
| 646 | return ''.join(packed) |
| 647 | |
| 648 | @staticmethod |
| 649 | def unpack(reader): |
| 650 | obj = async_get_reply() |
| 651 | _version = reader.read("!B")[0] |
| 652 | assert(_version == 5) |
| 653 | _type = reader.read("!B")[0] |
| 654 | assert(_type == 27) |
| 655 | _length = reader.read("!H")[0] |
| 656 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 657 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 658 | obj.xid = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 659 | obj.properties = loxi.generic_util.unpack_list(reader, ofp.async_config_prop.async_config_prop.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 660 | return obj |
| 661 | |
| 662 | def __eq__(self, other): |
| 663 | if type(self) != type(other): return False |
| 664 | if self.xid != other.xid: return False |
| 665 | if self.properties != other.properties: return False |
| 666 | return True |
| 667 | |
| 668 | def pretty_print(self, q): |
| 669 | q.text("async_get_reply {") |
| 670 | with q.group(): |
| 671 | with q.indent(2): |
| 672 | q.breakable() |
| 673 | q.text("xid = "); |
| 674 | if self.xid != None: |
| 675 | q.text("%#x" % self.xid) |
| 676 | else: |
| 677 | q.text('None') |
| 678 | q.text(","); q.breakable() |
| 679 | q.text("properties = "); |
| 680 | q.pp(self.properties) |
| 681 | q.breakable() |
| 682 | q.text('}') |
| 683 | |
| 684 | message.subtypes[27] = async_get_reply |
| 685 | |
| 686 | class async_get_request(message): |
| 687 | version = 5 |
| 688 | type = 26 |
| 689 | |
| 690 | def __init__(self, xid=None, properties=None): |
| 691 | if xid != None: |
| 692 | self.xid = xid |
| 693 | else: |
| 694 | self.xid = None |
| 695 | if properties != None: |
| 696 | self.properties = properties |
| 697 | else: |
| 698 | self.properties = [] |
| 699 | return |
| 700 | |
| 701 | def pack(self): |
| 702 | packed = [] |
| 703 | packed.append(struct.pack("!B", self.version)) |
| 704 | packed.append(struct.pack("!B", self.type)) |
| 705 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 706 | packed.append(struct.pack("!L", self.xid)) |
| 707 | packed.append(loxi.generic_util.pack_list(self.properties)) |
| 708 | length = sum([len(x) for x in packed]) |
| 709 | packed[2] = struct.pack("!H", length) |
| 710 | return ''.join(packed) |
| 711 | |
| 712 | @staticmethod |
| 713 | def unpack(reader): |
| 714 | obj = async_get_request() |
| 715 | _version = reader.read("!B")[0] |
| 716 | assert(_version == 5) |
| 717 | _type = reader.read("!B")[0] |
| 718 | assert(_type == 26) |
| 719 | _length = reader.read("!H")[0] |
| 720 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 721 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 722 | obj.xid = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 723 | obj.properties = loxi.generic_util.unpack_list(reader, ofp.async_config_prop.async_config_prop.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 724 | return obj |
| 725 | |
| 726 | def __eq__(self, other): |
| 727 | if type(self) != type(other): return False |
| 728 | if self.xid != other.xid: return False |
| 729 | if self.properties != other.properties: return False |
| 730 | return True |
| 731 | |
| 732 | def pretty_print(self, q): |
| 733 | q.text("async_get_request {") |
| 734 | with q.group(): |
| 735 | with q.indent(2): |
| 736 | q.breakable() |
| 737 | q.text("xid = "); |
| 738 | if self.xid != None: |
| 739 | q.text("%#x" % self.xid) |
| 740 | else: |
| 741 | q.text('None') |
| 742 | q.text(","); q.breakable() |
| 743 | q.text("properties = "); |
| 744 | q.pp(self.properties) |
| 745 | q.breakable() |
| 746 | q.text('}') |
| 747 | |
| 748 | message.subtypes[26] = async_get_request |
| 749 | |
| 750 | class async_set(message): |
| 751 | version = 5 |
| 752 | type = 28 |
| 753 | |
| 754 | def __init__(self, xid=None, properties=None): |
| 755 | if xid != None: |
| 756 | self.xid = xid |
| 757 | else: |
| 758 | self.xid = None |
| 759 | if properties != None: |
| 760 | self.properties = properties |
| 761 | else: |
| 762 | self.properties = [] |
| 763 | return |
| 764 | |
| 765 | def pack(self): |
| 766 | packed = [] |
| 767 | packed.append(struct.pack("!B", self.version)) |
| 768 | packed.append(struct.pack("!B", self.type)) |
| 769 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 770 | packed.append(struct.pack("!L", self.xid)) |
| 771 | packed.append(loxi.generic_util.pack_list(self.properties)) |
| 772 | length = sum([len(x) for x in packed]) |
| 773 | packed[2] = struct.pack("!H", length) |
| 774 | return ''.join(packed) |
| 775 | |
| 776 | @staticmethod |
| 777 | def unpack(reader): |
| 778 | obj = async_set() |
| 779 | _version = reader.read("!B")[0] |
| 780 | assert(_version == 5) |
| 781 | _type = reader.read("!B")[0] |
| 782 | assert(_type == 28) |
| 783 | _length = reader.read("!H")[0] |
| 784 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 785 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 786 | obj.xid = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 787 | obj.properties = loxi.generic_util.unpack_list(reader, ofp.async_config_prop.async_config_prop.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 788 | return obj |
| 789 | |
| 790 | def __eq__(self, other): |
| 791 | if type(self) != type(other): return False |
| 792 | if self.xid != other.xid: return False |
| 793 | if self.properties != other.properties: return False |
| 794 | return True |
| 795 | |
| 796 | def pretty_print(self, q): |
| 797 | q.text("async_set {") |
| 798 | with q.group(): |
| 799 | with q.indent(2): |
| 800 | q.breakable() |
| 801 | q.text("xid = "); |
| 802 | if self.xid != None: |
| 803 | q.text("%#x" % self.xid) |
| 804 | else: |
| 805 | q.text('None') |
| 806 | q.text(","); q.breakable() |
| 807 | q.text("properties = "); |
| 808 | q.pp(self.properties) |
| 809 | q.breakable() |
| 810 | q.text('}') |
| 811 | |
| 812 | message.subtypes[28] = async_set |
| 813 | |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 814 | class bad_action_error_msg(error_msg): |
| 815 | version = 5 |
| 816 | type = 1 |
| 817 | err_type = 2 |
| 818 | |
| 819 | def __init__(self, xid=None, code=None, data=None): |
| 820 | if xid != None: |
| 821 | self.xid = xid |
| 822 | else: |
| 823 | self.xid = None |
| 824 | if code != None: |
| 825 | self.code = code |
| 826 | else: |
| 827 | self.code = 0 |
| 828 | if data != None: |
| 829 | self.data = data |
| 830 | else: |
| 831 | self.data = '' |
| 832 | return |
| 833 | |
| 834 | def pack(self): |
| 835 | packed = [] |
| 836 | packed.append(struct.pack("!B", self.version)) |
| 837 | packed.append(struct.pack("!B", self.type)) |
| 838 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 839 | packed.append(struct.pack("!L", self.xid)) |
| 840 | packed.append(struct.pack("!H", self.err_type)) |
| 841 | packed.append(struct.pack("!H", self.code)) |
| 842 | packed.append(self.data) |
| 843 | length = sum([len(x) for x in packed]) |
| 844 | packed[2] = struct.pack("!H", length) |
| 845 | return ''.join(packed) |
| 846 | |
| 847 | @staticmethod |
| 848 | def unpack(reader): |
| 849 | obj = bad_action_error_msg() |
| 850 | _version = reader.read("!B")[0] |
| 851 | assert(_version == 5) |
| 852 | _type = reader.read("!B")[0] |
| 853 | assert(_type == 1) |
| 854 | _length = reader.read("!H")[0] |
| 855 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 856 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 857 | obj.xid = reader.read("!L")[0] |
| 858 | _err_type = reader.read("!H")[0] |
| 859 | assert(_err_type == 2) |
| 860 | obj.code = reader.read("!H")[0] |
| 861 | obj.data = str(reader.read_all()) |
| 862 | return obj |
| 863 | |
| 864 | def __eq__(self, other): |
| 865 | if type(self) != type(other): return False |
| 866 | if self.xid != other.xid: return False |
| 867 | if self.code != other.code: return False |
| 868 | if self.data != other.data: return False |
| 869 | return True |
| 870 | |
| 871 | def pretty_print(self, q): |
| 872 | q.text("bad_action_error_msg {") |
| 873 | with q.group(): |
| 874 | with q.indent(2): |
| 875 | q.breakable() |
| 876 | q.text("xid = "); |
| 877 | if self.xid != None: |
| 878 | q.text("%#x" % self.xid) |
| 879 | else: |
| 880 | q.text('None') |
| 881 | q.text(","); q.breakable() |
| 882 | q.text("code = "); |
| 883 | q.text("%#x" % self.code) |
| 884 | q.text(","); q.breakable() |
| 885 | q.text("data = "); |
| 886 | q.pp(self.data) |
| 887 | q.breakable() |
| 888 | q.text('}') |
| 889 | |
| 890 | error_msg.subtypes[2] = bad_action_error_msg |
| 891 | |
| 892 | class bad_instruction_error_msg(error_msg): |
| 893 | version = 5 |
| 894 | type = 1 |
| 895 | err_type = 3 |
| 896 | |
| 897 | def __init__(self, xid=None, code=None, data=None): |
| 898 | if xid != None: |
| 899 | self.xid = xid |
| 900 | else: |
| 901 | self.xid = None |
| 902 | if code != None: |
| 903 | self.code = code |
| 904 | else: |
| 905 | self.code = 0 |
| 906 | if data != None: |
| 907 | self.data = data |
| 908 | else: |
| 909 | self.data = '' |
| 910 | return |
| 911 | |
| 912 | def pack(self): |
| 913 | packed = [] |
| 914 | packed.append(struct.pack("!B", self.version)) |
| 915 | packed.append(struct.pack("!B", self.type)) |
| 916 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 917 | packed.append(struct.pack("!L", self.xid)) |
| 918 | packed.append(struct.pack("!H", self.err_type)) |
| 919 | packed.append(struct.pack("!H", self.code)) |
| 920 | packed.append(self.data) |
| 921 | length = sum([len(x) for x in packed]) |
| 922 | packed[2] = struct.pack("!H", length) |
| 923 | return ''.join(packed) |
| 924 | |
| 925 | @staticmethod |
| 926 | def unpack(reader): |
| 927 | obj = bad_instruction_error_msg() |
| 928 | _version = reader.read("!B")[0] |
| 929 | assert(_version == 5) |
| 930 | _type = reader.read("!B")[0] |
| 931 | assert(_type == 1) |
| 932 | _length = reader.read("!H")[0] |
| 933 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 934 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 935 | obj.xid = reader.read("!L")[0] |
| 936 | _err_type = reader.read("!H")[0] |
| 937 | assert(_err_type == 3) |
| 938 | obj.code = reader.read("!H")[0] |
| 939 | obj.data = str(reader.read_all()) |
| 940 | return obj |
| 941 | |
| 942 | def __eq__(self, other): |
| 943 | if type(self) != type(other): return False |
| 944 | if self.xid != other.xid: return False |
| 945 | if self.code != other.code: return False |
| 946 | if self.data != other.data: return False |
| 947 | return True |
| 948 | |
| 949 | def pretty_print(self, q): |
| 950 | q.text("bad_instruction_error_msg {") |
| 951 | with q.group(): |
| 952 | with q.indent(2): |
| 953 | q.breakable() |
| 954 | q.text("xid = "); |
| 955 | if self.xid != None: |
| 956 | q.text("%#x" % self.xid) |
| 957 | else: |
| 958 | q.text('None') |
| 959 | q.text(","); q.breakable() |
| 960 | q.text("code = "); |
| 961 | q.text("%#x" % self.code) |
| 962 | q.text(","); q.breakable() |
| 963 | q.text("data = "); |
| 964 | q.pp(self.data) |
| 965 | q.breakable() |
| 966 | q.text('}') |
| 967 | |
| 968 | error_msg.subtypes[3] = bad_instruction_error_msg |
| 969 | |
| 970 | class bad_match_error_msg(error_msg): |
| 971 | version = 5 |
| 972 | type = 1 |
| 973 | err_type = 4 |
| 974 | |
| 975 | def __init__(self, xid=None, code=None, data=None): |
| 976 | if xid != None: |
| 977 | self.xid = xid |
| 978 | else: |
| 979 | self.xid = None |
| 980 | if code != None: |
| 981 | self.code = code |
| 982 | else: |
| 983 | self.code = 0 |
| 984 | if data != None: |
| 985 | self.data = data |
| 986 | else: |
| 987 | self.data = '' |
| 988 | return |
| 989 | |
| 990 | def pack(self): |
| 991 | packed = [] |
| 992 | packed.append(struct.pack("!B", self.version)) |
| 993 | packed.append(struct.pack("!B", self.type)) |
| 994 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 995 | packed.append(struct.pack("!L", self.xid)) |
| 996 | packed.append(struct.pack("!H", self.err_type)) |
| 997 | packed.append(struct.pack("!H", self.code)) |
| 998 | packed.append(self.data) |
| 999 | length = sum([len(x) for x in packed]) |
| 1000 | packed[2] = struct.pack("!H", length) |
| 1001 | return ''.join(packed) |
| 1002 | |
| 1003 | @staticmethod |
| 1004 | def unpack(reader): |
| 1005 | obj = bad_match_error_msg() |
| 1006 | _version = reader.read("!B")[0] |
| 1007 | assert(_version == 5) |
| 1008 | _type = reader.read("!B")[0] |
| 1009 | assert(_type == 1) |
| 1010 | _length = reader.read("!H")[0] |
| 1011 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1012 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 1013 | obj.xid = reader.read("!L")[0] |
| 1014 | _err_type = reader.read("!H")[0] |
| 1015 | assert(_err_type == 4) |
| 1016 | obj.code = reader.read("!H")[0] |
| 1017 | obj.data = str(reader.read_all()) |
| 1018 | return obj |
| 1019 | |
| 1020 | def __eq__(self, other): |
| 1021 | if type(self) != type(other): return False |
| 1022 | if self.xid != other.xid: return False |
| 1023 | if self.code != other.code: return False |
| 1024 | if self.data != other.data: return False |
| 1025 | return True |
| 1026 | |
| 1027 | def pretty_print(self, q): |
| 1028 | q.text("bad_match_error_msg {") |
| 1029 | with q.group(): |
| 1030 | with q.indent(2): |
| 1031 | q.breakable() |
| 1032 | q.text("xid = "); |
| 1033 | if self.xid != None: |
| 1034 | q.text("%#x" % self.xid) |
| 1035 | else: |
| 1036 | q.text('None') |
| 1037 | q.text(","); q.breakable() |
| 1038 | q.text("code = "); |
| 1039 | q.text("%#x" % self.code) |
| 1040 | q.text(","); q.breakable() |
| 1041 | q.text("data = "); |
| 1042 | q.pp(self.data) |
| 1043 | q.breakable() |
| 1044 | q.text('}') |
| 1045 | |
| 1046 | error_msg.subtypes[4] = bad_match_error_msg |
| 1047 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1048 | class bad_property_error_msg(error_msg): |
| 1049 | version = 5 |
| 1050 | type = 1 |
| 1051 | err_type = 14 |
| 1052 | |
| 1053 | def __init__(self, xid=None, code=None, data=None): |
| 1054 | if xid != None: |
| 1055 | self.xid = xid |
| 1056 | else: |
| 1057 | self.xid = None |
| 1058 | if code != None: |
| 1059 | self.code = code |
| 1060 | else: |
| 1061 | self.code = 0 |
| 1062 | if data != None: |
| 1063 | self.data = data |
| 1064 | else: |
| 1065 | self.data = '' |
| 1066 | return |
| 1067 | |
| 1068 | def pack(self): |
| 1069 | packed = [] |
| 1070 | packed.append(struct.pack("!B", self.version)) |
| 1071 | packed.append(struct.pack("!B", self.type)) |
| 1072 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1073 | packed.append(struct.pack("!L", self.xid)) |
| 1074 | packed.append(struct.pack("!H", self.err_type)) |
| 1075 | packed.append(struct.pack("!H", self.code)) |
| 1076 | packed.append(self.data) |
| 1077 | length = sum([len(x) for x in packed]) |
| 1078 | packed[2] = struct.pack("!H", length) |
| 1079 | return ''.join(packed) |
| 1080 | |
| 1081 | @staticmethod |
| 1082 | def unpack(reader): |
| 1083 | obj = bad_property_error_msg() |
| 1084 | _version = reader.read("!B")[0] |
| 1085 | assert(_version == 5) |
| 1086 | _type = reader.read("!B")[0] |
| 1087 | assert(_type == 1) |
| 1088 | _length = reader.read("!H")[0] |
| 1089 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1090 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1091 | obj.xid = reader.read("!L")[0] |
| 1092 | _err_type = reader.read("!H")[0] |
| 1093 | assert(_err_type == 14) |
| 1094 | obj.code = reader.read("!H")[0] |
| 1095 | obj.data = str(reader.read_all()) |
| 1096 | return obj |
| 1097 | |
| 1098 | def __eq__(self, other): |
| 1099 | if type(self) != type(other): return False |
| 1100 | if self.xid != other.xid: return False |
| 1101 | if self.code != other.code: return False |
| 1102 | if self.data != other.data: return False |
| 1103 | return True |
| 1104 | |
| 1105 | def pretty_print(self, q): |
| 1106 | q.text("bad_property_error_msg {") |
| 1107 | with q.group(): |
| 1108 | with q.indent(2): |
| 1109 | q.breakable() |
| 1110 | q.text("xid = "); |
| 1111 | if self.xid != None: |
| 1112 | q.text("%#x" % self.xid) |
| 1113 | else: |
| 1114 | q.text('None') |
| 1115 | q.text(","); q.breakable() |
| 1116 | q.text("code = "); |
| 1117 | q.text("%#x" % self.code) |
| 1118 | q.text(","); q.breakable() |
| 1119 | q.text("data = "); |
| 1120 | q.pp(self.data) |
| 1121 | q.breakable() |
| 1122 | q.text('}') |
| 1123 | |
| 1124 | error_msg.subtypes[14] = bad_property_error_msg |
| 1125 | |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 1126 | class bad_request_error_msg(error_msg): |
| 1127 | version = 5 |
| 1128 | type = 1 |
| 1129 | err_type = 1 |
| 1130 | |
| 1131 | def __init__(self, xid=None, code=None, data=None): |
| 1132 | if xid != None: |
| 1133 | self.xid = xid |
| 1134 | else: |
| 1135 | self.xid = None |
| 1136 | if code != None: |
| 1137 | self.code = code |
| 1138 | else: |
| 1139 | self.code = 0 |
| 1140 | if data != None: |
| 1141 | self.data = data |
| 1142 | else: |
| 1143 | self.data = '' |
| 1144 | return |
| 1145 | |
| 1146 | def pack(self): |
| 1147 | packed = [] |
| 1148 | packed.append(struct.pack("!B", self.version)) |
| 1149 | packed.append(struct.pack("!B", self.type)) |
| 1150 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1151 | packed.append(struct.pack("!L", self.xid)) |
| 1152 | packed.append(struct.pack("!H", self.err_type)) |
| 1153 | packed.append(struct.pack("!H", self.code)) |
| 1154 | packed.append(self.data) |
| 1155 | length = sum([len(x) for x in packed]) |
| 1156 | packed[2] = struct.pack("!H", length) |
| 1157 | return ''.join(packed) |
| 1158 | |
| 1159 | @staticmethod |
| 1160 | def unpack(reader): |
| 1161 | obj = bad_request_error_msg() |
| 1162 | _version = reader.read("!B")[0] |
| 1163 | assert(_version == 5) |
| 1164 | _type = reader.read("!B")[0] |
| 1165 | assert(_type == 1) |
| 1166 | _length = reader.read("!H")[0] |
| 1167 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1168 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 1169 | obj.xid = reader.read("!L")[0] |
| 1170 | _err_type = reader.read("!H")[0] |
| 1171 | assert(_err_type == 1) |
| 1172 | obj.code = reader.read("!H")[0] |
| 1173 | obj.data = str(reader.read_all()) |
| 1174 | return obj |
| 1175 | |
| 1176 | def __eq__(self, other): |
| 1177 | if type(self) != type(other): return False |
| 1178 | if self.xid != other.xid: return False |
| 1179 | if self.code != other.code: return False |
| 1180 | if self.data != other.data: return False |
| 1181 | return True |
| 1182 | |
| 1183 | def pretty_print(self, q): |
| 1184 | q.text("bad_request_error_msg {") |
| 1185 | with q.group(): |
| 1186 | with q.indent(2): |
| 1187 | q.breakable() |
| 1188 | q.text("xid = "); |
| 1189 | if self.xid != None: |
| 1190 | q.text("%#x" % self.xid) |
| 1191 | else: |
| 1192 | q.text('None') |
| 1193 | q.text(","); q.breakable() |
| 1194 | q.text("code = "); |
| 1195 | q.text("%#x" % self.code) |
| 1196 | q.text(","); q.breakable() |
| 1197 | q.text("data = "); |
| 1198 | q.pp(self.data) |
| 1199 | q.breakable() |
| 1200 | q.text('}') |
| 1201 | |
| 1202 | error_msg.subtypes[1] = bad_request_error_msg |
| 1203 | |
| 1204 | class barrier_reply(message): |
| 1205 | version = 5 |
| 1206 | type = 21 |
| 1207 | |
| 1208 | def __init__(self, xid=None): |
| 1209 | if xid != None: |
| 1210 | self.xid = xid |
| 1211 | else: |
| 1212 | self.xid = None |
| 1213 | return |
| 1214 | |
| 1215 | def pack(self): |
| 1216 | packed = [] |
| 1217 | packed.append(struct.pack("!B", self.version)) |
| 1218 | packed.append(struct.pack("!B", self.type)) |
| 1219 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1220 | packed.append(struct.pack("!L", self.xid)) |
| 1221 | length = sum([len(x) for x in packed]) |
| 1222 | packed[2] = struct.pack("!H", length) |
| 1223 | return ''.join(packed) |
| 1224 | |
| 1225 | @staticmethod |
| 1226 | def unpack(reader): |
| 1227 | obj = barrier_reply() |
| 1228 | _version = reader.read("!B")[0] |
| 1229 | assert(_version == 5) |
| 1230 | _type = reader.read("!B")[0] |
| 1231 | assert(_type == 21) |
| 1232 | _length = reader.read("!H")[0] |
| 1233 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1234 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 1235 | obj.xid = reader.read("!L")[0] |
| 1236 | return obj |
| 1237 | |
| 1238 | def __eq__(self, other): |
| 1239 | if type(self) != type(other): return False |
| 1240 | if self.xid != other.xid: return False |
| 1241 | return True |
| 1242 | |
| 1243 | def pretty_print(self, q): |
| 1244 | q.text("barrier_reply {") |
| 1245 | with q.group(): |
| 1246 | with q.indent(2): |
| 1247 | q.breakable() |
| 1248 | q.text("xid = "); |
| 1249 | if self.xid != None: |
| 1250 | q.text("%#x" % self.xid) |
| 1251 | else: |
| 1252 | q.text('None') |
| 1253 | q.breakable() |
| 1254 | q.text('}') |
| 1255 | |
| 1256 | message.subtypes[21] = barrier_reply |
| 1257 | |
| 1258 | class barrier_request(message): |
| 1259 | version = 5 |
| 1260 | type = 20 |
| 1261 | |
| 1262 | def __init__(self, xid=None): |
| 1263 | if xid != None: |
| 1264 | self.xid = xid |
| 1265 | else: |
| 1266 | self.xid = None |
| 1267 | return |
| 1268 | |
| 1269 | def pack(self): |
| 1270 | packed = [] |
| 1271 | packed.append(struct.pack("!B", self.version)) |
| 1272 | packed.append(struct.pack("!B", self.type)) |
| 1273 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1274 | packed.append(struct.pack("!L", self.xid)) |
| 1275 | length = sum([len(x) for x in packed]) |
| 1276 | packed[2] = struct.pack("!H", length) |
| 1277 | return ''.join(packed) |
| 1278 | |
| 1279 | @staticmethod |
| 1280 | def unpack(reader): |
| 1281 | obj = barrier_request() |
| 1282 | _version = reader.read("!B")[0] |
| 1283 | assert(_version == 5) |
| 1284 | _type = reader.read("!B")[0] |
| 1285 | assert(_type == 20) |
| 1286 | _length = reader.read("!H")[0] |
| 1287 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1288 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 1289 | obj.xid = reader.read("!L")[0] |
| 1290 | return obj |
| 1291 | |
| 1292 | def __eq__(self, other): |
| 1293 | if type(self) != type(other): return False |
| 1294 | if self.xid != other.xid: return False |
| 1295 | return True |
| 1296 | |
| 1297 | def pretty_print(self, q): |
| 1298 | q.text("barrier_request {") |
| 1299 | with q.group(): |
| 1300 | with q.indent(2): |
| 1301 | q.breakable() |
| 1302 | q.text("xid = "); |
| 1303 | if self.xid != None: |
| 1304 | q.text("%#x" % self.xid) |
| 1305 | else: |
| 1306 | q.text('None') |
| 1307 | q.breakable() |
| 1308 | q.text('}') |
| 1309 | |
| 1310 | message.subtypes[20] = barrier_request |
| 1311 | |
| 1312 | class experimenter(message): |
| 1313 | subtypes = {} |
| 1314 | |
| 1315 | version = 5 |
| 1316 | type = 4 |
| 1317 | |
| 1318 | def __init__(self, xid=None, experimenter=None, subtype=None, data=None): |
| 1319 | if xid != None: |
| 1320 | self.xid = xid |
| 1321 | else: |
| 1322 | self.xid = None |
| 1323 | if experimenter != None: |
| 1324 | self.experimenter = experimenter |
| 1325 | else: |
| 1326 | self.experimenter = 0 |
| 1327 | if subtype != None: |
| 1328 | self.subtype = subtype |
| 1329 | else: |
| 1330 | self.subtype = 0 |
| 1331 | if data != None: |
| 1332 | self.data = data |
| 1333 | else: |
| 1334 | self.data = '' |
| 1335 | return |
| 1336 | |
| 1337 | def pack(self): |
| 1338 | packed = [] |
| 1339 | packed.append(struct.pack("!B", self.version)) |
| 1340 | packed.append(struct.pack("!B", self.type)) |
| 1341 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1342 | packed.append(struct.pack("!L", self.xid)) |
| 1343 | packed.append(struct.pack("!L", self.experimenter)) |
| 1344 | packed.append(struct.pack("!L", self.subtype)) |
| 1345 | packed.append(self.data) |
| 1346 | length = sum([len(x) for x in packed]) |
| 1347 | packed[2] = struct.pack("!H", length) |
| 1348 | return ''.join(packed) |
| 1349 | |
| 1350 | @staticmethod |
| 1351 | def unpack(reader): |
| 1352 | subtype, = reader.peek('!L', 8) |
| 1353 | subclass = experimenter.subtypes.get(subtype) |
| 1354 | if subclass: |
| 1355 | return subclass.unpack(reader) |
| 1356 | |
| 1357 | obj = experimenter() |
| 1358 | _version = reader.read("!B")[0] |
| 1359 | assert(_version == 5) |
| 1360 | _type = reader.read("!B")[0] |
| 1361 | assert(_type == 4) |
| 1362 | _length = reader.read("!H")[0] |
| 1363 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1364 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 1365 | obj.xid = reader.read("!L")[0] |
| 1366 | obj.experimenter = reader.read("!L")[0] |
| 1367 | obj.subtype = reader.read("!L")[0] |
| 1368 | obj.data = str(reader.read_all()) |
| 1369 | return obj |
| 1370 | |
| 1371 | def __eq__(self, other): |
| 1372 | if type(self) != type(other): return False |
| 1373 | if self.xid != other.xid: return False |
| 1374 | if self.experimenter != other.experimenter: return False |
| 1375 | if self.subtype != other.subtype: return False |
| 1376 | if self.data != other.data: return False |
| 1377 | return True |
| 1378 | |
| 1379 | def pretty_print(self, q): |
| 1380 | q.text("experimenter {") |
| 1381 | with q.group(): |
| 1382 | with q.indent(2): |
| 1383 | q.breakable() |
| 1384 | q.text("xid = "); |
| 1385 | if self.xid != None: |
| 1386 | q.text("%#x" % self.xid) |
| 1387 | else: |
| 1388 | q.text('None') |
| 1389 | q.text(","); q.breakable() |
| 1390 | q.text("subtype = "); |
| 1391 | q.text("%#x" % self.subtype) |
| 1392 | q.text(","); q.breakable() |
| 1393 | q.text("data = "); |
| 1394 | q.pp(self.data) |
| 1395 | q.breakable() |
| 1396 | q.text('}') |
| 1397 | |
| 1398 | message.subtypes[4] = experimenter |
| 1399 | |
| 1400 | class bsn_header(experimenter): |
| 1401 | subtypes = {} |
| 1402 | |
| 1403 | version = 5 |
| 1404 | type = 4 |
| 1405 | experimenter = 6035143 |
| 1406 | |
| 1407 | def __init__(self, xid=None, subtype=None): |
| 1408 | if xid != None: |
| 1409 | self.xid = xid |
| 1410 | else: |
| 1411 | self.xid = None |
| 1412 | if subtype != None: |
| 1413 | self.subtype = subtype |
| 1414 | else: |
| 1415 | self.subtype = 0 |
| 1416 | return |
| 1417 | |
| 1418 | def pack(self): |
| 1419 | packed = [] |
| 1420 | packed.append(struct.pack("!B", self.version)) |
| 1421 | packed.append(struct.pack("!B", self.type)) |
| 1422 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1423 | packed.append(struct.pack("!L", self.xid)) |
| 1424 | packed.append(struct.pack("!L", self.experimenter)) |
| 1425 | packed.append(struct.pack("!L", self.subtype)) |
| 1426 | length = sum([len(x) for x in packed]) |
| 1427 | packed[2] = struct.pack("!H", length) |
| 1428 | return ''.join(packed) |
| 1429 | |
| 1430 | @staticmethod |
| 1431 | def unpack(reader): |
| 1432 | subtype, = reader.peek('!L', 12) |
| 1433 | subclass = bsn_header.subtypes.get(subtype) |
| 1434 | if subclass: |
| 1435 | return subclass.unpack(reader) |
| 1436 | |
| 1437 | obj = bsn_header() |
| 1438 | _version = reader.read("!B")[0] |
| 1439 | assert(_version == 5) |
| 1440 | _type = reader.read("!B")[0] |
| 1441 | assert(_type == 4) |
| 1442 | _length = reader.read("!H")[0] |
| 1443 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1444 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 1445 | obj.xid = reader.read("!L")[0] |
| 1446 | _experimenter = reader.read("!L")[0] |
| 1447 | assert(_experimenter == 6035143) |
| 1448 | obj.subtype = reader.read("!L")[0] |
| 1449 | return obj |
| 1450 | |
| 1451 | def __eq__(self, other): |
| 1452 | if type(self) != type(other): return False |
| 1453 | if self.xid != other.xid: return False |
| 1454 | if self.subtype != other.subtype: return False |
| 1455 | return True |
| 1456 | |
| 1457 | def pretty_print(self, q): |
| 1458 | q.text("bsn_header {") |
| 1459 | with q.group(): |
| 1460 | with q.indent(2): |
| 1461 | q.breakable() |
| 1462 | q.text("xid = "); |
| 1463 | if self.xid != None: |
| 1464 | q.text("%#x" % self.xid) |
| 1465 | else: |
| 1466 | q.text('None') |
| 1467 | q.breakable() |
| 1468 | q.text('}') |
| 1469 | |
| 1470 | experimenter.subtypes[6035143] = bsn_header |
| 1471 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1472 | class bsn_arp_idle(bsn_header): |
| 1473 | version = 5 |
| 1474 | type = 4 |
| 1475 | experimenter = 6035143 |
| 1476 | subtype = 60 |
| 1477 | |
| 1478 | def __init__(self, xid=None, vlan_vid=None, ipv4_addr=None): |
| 1479 | if xid != None: |
| 1480 | self.xid = xid |
| 1481 | else: |
| 1482 | self.xid = None |
| 1483 | if vlan_vid != None: |
| 1484 | self.vlan_vid = vlan_vid |
| 1485 | else: |
| 1486 | self.vlan_vid = 0 |
| 1487 | if ipv4_addr != None: |
| 1488 | self.ipv4_addr = ipv4_addr |
| 1489 | else: |
| 1490 | self.ipv4_addr = 0 |
| 1491 | return |
| 1492 | |
| 1493 | def pack(self): |
| 1494 | packed = [] |
| 1495 | packed.append(struct.pack("!B", self.version)) |
| 1496 | packed.append(struct.pack("!B", self.type)) |
| 1497 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1498 | packed.append(struct.pack("!L", self.xid)) |
| 1499 | packed.append(struct.pack("!L", self.experimenter)) |
| 1500 | packed.append(struct.pack("!L", self.subtype)) |
| 1501 | packed.append(struct.pack("!H", self.vlan_vid)) |
| 1502 | packed.append('\x00' * 2) |
| 1503 | packed.append(struct.pack("!L", self.ipv4_addr)) |
| 1504 | length = sum([len(x) for x in packed]) |
| 1505 | packed[2] = struct.pack("!H", length) |
| 1506 | return ''.join(packed) |
| 1507 | |
| 1508 | @staticmethod |
| 1509 | def unpack(reader): |
| 1510 | obj = bsn_arp_idle() |
| 1511 | _version = reader.read("!B")[0] |
| 1512 | assert(_version == 5) |
| 1513 | _type = reader.read("!B")[0] |
| 1514 | assert(_type == 4) |
| 1515 | _length = reader.read("!H")[0] |
| 1516 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1517 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1518 | obj.xid = reader.read("!L")[0] |
| 1519 | _experimenter = reader.read("!L")[0] |
| 1520 | assert(_experimenter == 6035143) |
| 1521 | _subtype = reader.read("!L")[0] |
| 1522 | assert(_subtype == 60) |
| 1523 | obj.vlan_vid = reader.read("!H")[0] |
| 1524 | reader.skip(2) |
| 1525 | obj.ipv4_addr = reader.read("!L")[0] |
| 1526 | return obj |
| 1527 | |
| 1528 | def __eq__(self, other): |
| 1529 | if type(self) != type(other): return False |
| 1530 | if self.xid != other.xid: return False |
| 1531 | if self.vlan_vid != other.vlan_vid: return False |
| 1532 | if self.ipv4_addr != other.ipv4_addr: return False |
| 1533 | return True |
| 1534 | |
| 1535 | def pretty_print(self, q): |
| 1536 | q.text("bsn_arp_idle {") |
| 1537 | with q.group(): |
| 1538 | with q.indent(2): |
| 1539 | q.breakable() |
| 1540 | q.text("xid = "); |
| 1541 | if self.xid != None: |
| 1542 | q.text("%#x" % self.xid) |
| 1543 | else: |
| 1544 | q.text('None') |
| 1545 | q.text(","); q.breakable() |
| 1546 | q.text("vlan_vid = "); |
| 1547 | q.text("%#x" % self.vlan_vid) |
| 1548 | q.text(","); q.breakable() |
| 1549 | q.text("ipv4_addr = "); |
| 1550 | q.text(util.pretty_ipv4(self.ipv4_addr)) |
| 1551 | q.breakable() |
| 1552 | q.text('}') |
| 1553 | |
| 1554 | bsn_header.subtypes[60] = bsn_arp_idle |
| 1555 | |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 1556 | class bsn_bw_clear_data_reply(bsn_header): |
| 1557 | version = 5 |
| 1558 | type = 4 |
| 1559 | experimenter = 6035143 |
| 1560 | subtype = 22 |
| 1561 | |
| 1562 | def __init__(self, xid=None, status=None): |
| 1563 | if xid != None: |
| 1564 | self.xid = xid |
| 1565 | else: |
| 1566 | self.xid = None |
| 1567 | if status != None: |
| 1568 | self.status = status |
| 1569 | else: |
| 1570 | self.status = 0 |
| 1571 | return |
| 1572 | |
| 1573 | def pack(self): |
| 1574 | packed = [] |
| 1575 | packed.append(struct.pack("!B", self.version)) |
| 1576 | packed.append(struct.pack("!B", self.type)) |
| 1577 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1578 | packed.append(struct.pack("!L", self.xid)) |
| 1579 | packed.append(struct.pack("!L", self.experimenter)) |
| 1580 | packed.append(struct.pack("!L", self.subtype)) |
| 1581 | packed.append(struct.pack("!L", self.status)) |
| 1582 | length = sum([len(x) for x in packed]) |
| 1583 | packed[2] = struct.pack("!H", length) |
| 1584 | return ''.join(packed) |
| 1585 | |
| 1586 | @staticmethod |
| 1587 | def unpack(reader): |
| 1588 | obj = bsn_bw_clear_data_reply() |
| 1589 | _version = reader.read("!B")[0] |
| 1590 | assert(_version == 5) |
| 1591 | _type = reader.read("!B")[0] |
| 1592 | assert(_type == 4) |
| 1593 | _length = reader.read("!H")[0] |
| 1594 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1595 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 1596 | obj.xid = reader.read("!L")[0] |
| 1597 | _experimenter = reader.read("!L")[0] |
| 1598 | assert(_experimenter == 6035143) |
| 1599 | _subtype = reader.read("!L")[0] |
| 1600 | assert(_subtype == 22) |
| 1601 | obj.status = reader.read("!L")[0] |
| 1602 | return obj |
| 1603 | |
| 1604 | def __eq__(self, other): |
| 1605 | if type(self) != type(other): return False |
| 1606 | if self.xid != other.xid: return False |
| 1607 | if self.status != other.status: return False |
| 1608 | return True |
| 1609 | |
| 1610 | def pretty_print(self, q): |
| 1611 | q.text("bsn_bw_clear_data_reply {") |
| 1612 | with q.group(): |
| 1613 | with q.indent(2): |
| 1614 | q.breakable() |
| 1615 | q.text("xid = "); |
| 1616 | if self.xid != None: |
| 1617 | q.text("%#x" % self.xid) |
| 1618 | else: |
| 1619 | q.text('None') |
| 1620 | q.text(","); q.breakable() |
| 1621 | q.text("status = "); |
| 1622 | q.text("%#x" % self.status) |
| 1623 | q.breakable() |
| 1624 | q.text('}') |
| 1625 | |
| 1626 | bsn_header.subtypes[22] = bsn_bw_clear_data_reply |
| 1627 | |
| 1628 | class bsn_bw_clear_data_request(bsn_header): |
| 1629 | version = 5 |
| 1630 | type = 4 |
| 1631 | experimenter = 6035143 |
| 1632 | subtype = 21 |
| 1633 | |
| 1634 | def __init__(self, xid=None): |
| 1635 | if xid != None: |
| 1636 | self.xid = xid |
| 1637 | else: |
| 1638 | self.xid = None |
| 1639 | return |
| 1640 | |
| 1641 | def pack(self): |
| 1642 | packed = [] |
| 1643 | packed.append(struct.pack("!B", self.version)) |
| 1644 | packed.append(struct.pack("!B", self.type)) |
| 1645 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1646 | packed.append(struct.pack("!L", self.xid)) |
| 1647 | packed.append(struct.pack("!L", self.experimenter)) |
| 1648 | packed.append(struct.pack("!L", self.subtype)) |
| 1649 | length = sum([len(x) for x in packed]) |
| 1650 | packed[2] = struct.pack("!H", length) |
| 1651 | return ''.join(packed) |
| 1652 | |
| 1653 | @staticmethod |
| 1654 | def unpack(reader): |
| 1655 | obj = bsn_bw_clear_data_request() |
| 1656 | _version = reader.read("!B")[0] |
| 1657 | assert(_version == 5) |
| 1658 | _type = reader.read("!B")[0] |
| 1659 | assert(_type == 4) |
| 1660 | _length = reader.read("!H")[0] |
| 1661 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1662 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 1663 | obj.xid = reader.read("!L")[0] |
| 1664 | _experimenter = reader.read("!L")[0] |
| 1665 | assert(_experimenter == 6035143) |
| 1666 | _subtype = reader.read("!L")[0] |
| 1667 | assert(_subtype == 21) |
| 1668 | return obj |
| 1669 | |
| 1670 | def __eq__(self, other): |
| 1671 | if type(self) != type(other): return False |
| 1672 | if self.xid != other.xid: return False |
| 1673 | return True |
| 1674 | |
| 1675 | def pretty_print(self, q): |
| 1676 | q.text("bsn_bw_clear_data_request {") |
| 1677 | with q.group(): |
| 1678 | with q.indent(2): |
| 1679 | q.breakable() |
| 1680 | q.text("xid = "); |
| 1681 | if self.xid != None: |
| 1682 | q.text("%#x" % self.xid) |
| 1683 | else: |
| 1684 | q.text('None') |
| 1685 | q.breakable() |
| 1686 | q.text('}') |
| 1687 | |
| 1688 | bsn_header.subtypes[21] = bsn_bw_clear_data_request |
| 1689 | |
| 1690 | class bsn_bw_enable_get_reply(bsn_header): |
| 1691 | version = 5 |
| 1692 | type = 4 |
| 1693 | experimenter = 6035143 |
| 1694 | subtype = 20 |
| 1695 | |
| 1696 | def __init__(self, xid=None, enabled=None): |
| 1697 | if xid != None: |
| 1698 | self.xid = xid |
| 1699 | else: |
| 1700 | self.xid = None |
| 1701 | if enabled != None: |
| 1702 | self.enabled = enabled |
| 1703 | else: |
| 1704 | self.enabled = 0 |
| 1705 | return |
| 1706 | |
| 1707 | def pack(self): |
| 1708 | packed = [] |
| 1709 | packed.append(struct.pack("!B", self.version)) |
| 1710 | packed.append(struct.pack("!B", self.type)) |
| 1711 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1712 | packed.append(struct.pack("!L", self.xid)) |
| 1713 | packed.append(struct.pack("!L", self.experimenter)) |
| 1714 | packed.append(struct.pack("!L", self.subtype)) |
| 1715 | packed.append(struct.pack("!L", self.enabled)) |
| 1716 | length = sum([len(x) for x in packed]) |
| 1717 | packed[2] = struct.pack("!H", length) |
| 1718 | return ''.join(packed) |
| 1719 | |
| 1720 | @staticmethod |
| 1721 | def unpack(reader): |
| 1722 | obj = bsn_bw_enable_get_reply() |
| 1723 | _version = reader.read("!B")[0] |
| 1724 | assert(_version == 5) |
| 1725 | _type = reader.read("!B")[0] |
| 1726 | assert(_type == 4) |
| 1727 | _length = reader.read("!H")[0] |
| 1728 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1729 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 1730 | obj.xid = reader.read("!L")[0] |
| 1731 | _experimenter = reader.read("!L")[0] |
| 1732 | assert(_experimenter == 6035143) |
| 1733 | _subtype = reader.read("!L")[0] |
| 1734 | assert(_subtype == 20) |
| 1735 | obj.enabled = reader.read("!L")[0] |
| 1736 | return obj |
| 1737 | |
| 1738 | def __eq__(self, other): |
| 1739 | if type(self) != type(other): return False |
| 1740 | if self.xid != other.xid: return False |
| 1741 | if self.enabled != other.enabled: return False |
| 1742 | return True |
| 1743 | |
| 1744 | def pretty_print(self, q): |
| 1745 | q.text("bsn_bw_enable_get_reply {") |
| 1746 | with q.group(): |
| 1747 | with q.indent(2): |
| 1748 | q.breakable() |
| 1749 | q.text("xid = "); |
| 1750 | if self.xid != None: |
| 1751 | q.text("%#x" % self.xid) |
| 1752 | else: |
| 1753 | q.text('None') |
| 1754 | q.text(","); q.breakable() |
| 1755 | q.text("enabled = "); |
| 1756 | q.text("%#x" % self.enabled) |
| 1757 | q.breakable() |
| 1758 | q.text('}') |
| 1759 | |
| 1760 | bsn_header.subtypes[20] = bsn_bw_enable_get_reply |
| 1761 | |
| 1762 | class bsn_bw_enable_get_request(bsn_header): |
| 1763 | version = 5 |
| 1764 | type = 4 |
| 1765 | experimenter = 6035143 |
| 1766 | subtype = 19 |
| 1767 | |
| 1768 | def __init__(self, xid=None): |
| 1769 | if xid != None: |
| 1770 | self.xid = xid |
| 1771 | else: |
| 1772 | self.xid = None |
| 1773 | return |
| 1774 | |
| 1775 | def pack(self): |
| 1776 | packed = [] |
| 1777 | packed.append(struct.pack("!B", self.version)) |
| 1778 | packed.append(struct.pack("!B", self.type)) |
| 1779 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1780 | packed.append(struct.pack("!L", self.xid)) |
| 1781 | packed.append(struct.pack("!L", self.experimenter)) |
| 1782 | packed.append(struct.pack("!L", self.subtype)) |
| 1783 | length = sum([len(x) for x in packed]) |
| 1784 | packed[2] = struct.pack("!H", length) |
| 1785 | return ''.join(packed) |
| 1786 | |
| 1787 | @staticmethod |
| 1788 | def unpack(reader): |
| 1789 | obj = bsn_bw_enable_get_request() |
| 1790 | _version = reader.read("!B")[0] |
| 1791 | assert(_version == 5) |
| 1792 | _type = reader.read("!B")[0] |
| 1793 | assert(_type == 4) |
| 1794 | _length = reader.read("!H")[0] |
| 1795 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1796 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 1797 | obj.xid = reader.read("!L")[0] |
| 1798 | _experimenter = reader.read("!L")[0] |
| 1799 | assert(_experimenter == 6035143) |
| 1800 | _subtype = reader.read("!L")[0] |
| 1801 | assert(_subtype == 19) |
| 1802 | return obj |
| 1803 | |
| 1804 | def __eq__(self, other): |
| 1805 | if type(self) != type(other): return False |
| 1806 | if self.xid != other.xid: return False |
| 1807 | return True |
| 1808 | |
| 1809 | def pretty_print(self, q): |
| 1810 | q.text("bsn_bw_enable_get_request {") |
| 1811 | with q.group(): |
| 1812 | with q.indent(2): |
| 1813 | q.breakable() |
| 1814 | q.text("xid = "); |
| 1815 | if self.xid != None: |
| 1816 | q.text("%#x" % self.xid) |
| 1817 | else: |
| 1818 | q.text('None') |
| 1819 | q.breakable() |
| 1820 | q.text('}') |
| 1821 | |
| 1822 | bsn_header.subtypes[19] = bsn_bw_enable_get_request |
| 1823 | |
| 1824 | class bsn_bw_enable_set_reply(bsn_header): |
| 1825 | version = 5 |
| 1826 | type = 4 |
| 1827 | experimenter = 6035143 |
| 1828 | subtype = 23 |
| 1829 | |
| 1830 | def __init__(self, xid=None, enable=None, status=None): |
| 1831 | if xid != None: |
| 1832 | self.xid = xid |
| 1833 | else: |
| 1834 | self.xid = None |
| 1835 | if enable != None: |
| 1836 | self.enable = enable |
| 1837 | else: |
| 1838 | self.enable = 0 |
| 1839 | if status != None: |
| 1840 | self.status = status |
| 1841 | else: |
| 1842 | self.status = 0 |
| 1843 | return |
| 1844 | |
| 1845 | def pack(self): |
| 1846 | packed = [] |
| 1847 | packed.append(struct.pack("!B", self.version)) |
| 1848 | packed.append(struct.pack("!B", self.type)) |
| 1849 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1850 | packed.append(struct.pack("!L", self.xid)) |
| 1851 | packed.append(struct.pack("!L", self.experimenter)) |
| 1852 | packed.append(struct.pack("!L", self.subtype)) |
| 1853 | packed.append(struct.pack("!L", self.enable)) |
| 1854 | packed.append(struct.pack("!L", self.status)) |
| 1855 | length = sum([len(x) for x in packed]) |
| 1856 | packed[2] = struct.pack("!H", length) |
| 1857 | return ''.join(packed) |
| 1858 | |
| 1859 | @staticmethod |
| 1860 | def unpack(reader): |
| 1861 | obj = bsn_bw_enable_set_reply() |
| 1862 | _version = reader.read("!B")[0] |
| 1863 | assert(_version == 5) |
| 1864 | _type = reader.read("!B")[0] |
| 1865 | assert(_type == 4) |
| 1866 | _length = reader.read("!H")[0] |
| 1867 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1868 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 1869 | obj.xid = reader.read("!L")[0] |
| 1870 | _experimenter = reader.read("!L")[0] |
| 1871 | assert(_experimenter == 6035143) |
| 1872 | _subtype = reader.read("!L")[0] |
| 1873 | assert(_subtype == 23) |
| 1874 | obj.enable = reader.read("!L")[0] |
| 1875 | obj.status = reader.read("!L")[0] |
| 1876 | return obj |
| 1877 | |
| 1878 | def __eq__(self, other): |
| 1879 | if type(self) != type(other): return False |
| 1880 | if self.xid != other.xid: return False |
| 1881 | if self.enable != other.enable: return False |
| 1882 | if self.status != other.status: return False |
| 1883 | return True |
| 1884 | |
| 1885 | def pretty_print(self, q): |
| 1886 | q.text("bsn_bw_enable_set_reply {") |
| 1887 | with q.group(): |
| 1888 | with q.indent(2): |
| 1889 | q.breakable() |
| 1890 | q.text("xid = "); |
| 1891 | if self.xid != None: |
| 1892 | q.text("%#x" % self.xid) |
| 1893 | else: |
| 1894 | q.text('None') |
| 1895 | q.text(","); q.breakable() |
| 1896 | q.text("enable = "); |
| 1897 | q.text("%#x" % self.enable) |
| 1898 | q.text(","); q.breakable() |
| 1899 | q.text("status = "); |
| 1900 | q.text("%#x" % self.status) |
| 1901 | q.breakable() |
| 1902 | q.text('}') |
| 1903 | |
| 1904 | bsn_header.subtypes[23] = bsn_bw_enable_set_reply |
| 1905 | |
| 1906 | class bsn_bw_enable_set_request(bsn_header): |
| 1907 | version = 5 |
| 1908 | type = 4 |
| 1909 | experimenter = 6035143 |
| 1910 | subtype = 18 |
| 1911 | |
| 1912 | def __init__(self, xid=None, enable=None): |
| 1913 | if xid != None: |
| 1914 | self.xid = xid |
| 1915 | else: |
| 1916 | self.xid = None |
| 1917 | if enable != None: |
| 1918 | self.enable = enable |
| 1919 | else: |
| 1920 | self.enable = 0 |
| 1921 | return |
| 1922 | |
| 1923 | def pack(self): |
| 1924 | packed = [] |
| 1925 | packed.append(struct.pack("!B", self.version)) |
| 1926 | packed.append(struct.pack("!B", self.type)) |
| 1927 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1928 | packed.append(struct.pack("!L", self.xid)) |
| 1929 | packed.append(struct.pack("!L", self.experimenter)) |
| 1930 | packed.append(struct.pack("!L", self.subtype)) |
| 1931 | packed.append(struct.pack("!L", self.enable)) |
| 1932 | length = sum([len(x) for x in packed]) |
| 1933 | packed[2] = struct.pack("!H", length) |
| 1934 | return ''.join(packed) |
| 1935 | |
| 1936 | @staticmethod |
| 1937 | def unpack(reader): |
| 1938 | obj = bsn_bw_enable_set_request() |
| 1939 | _version = reader.read("!B")[0] |
| 1940 | assert(_version == 5) |
| 1941 | _type = reader.read("!B")[0] |
| 1942 | assert(_type == 4) |
| 1943 | _length = reader.read("!H")[0] |
| 1944 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1945 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 1946 | obj.xid = reader.read("!L")[0] |
| 1947 | _experimenter = reader.read("!L")[0] |
| 1948 | assert(_experimenter == 6035143) |
| 1949 | _subtype = reader.read("!L")[0] |
| 1950 | assert(_subtype == 18) |
| 1951 | obj.enable = reader.read("!L")[0] |
| 1952 | return obj |
| 1953 | |
| 1954 | def __eq__(self, other): |
| 1955 | if type(self) != type(other): return False |
| 1956 | if self.xid != other.xid: return False |
| 1957 | if self.enable != other.enable: return False |
| 1958 | return True |
| 1959 | |
| 1960 | def pretty_print(self, q): |
| 1961 | q.text("bsn_bw_enable_set_request {") |
| 1962 | with q.group(): |
| 1963 | with q.indent(2): |
| 1964 | q.breakable() |
| 1965 | q.text("xid = "); |
| 1966 | if self.xid != None: |
| 1967 | q.text("%#x" % self.xid) |
| 1968 | else: |
| 1969 | q.text('None') |
| 1970 | q.text(","); q.breakable() |
| 1971 | q.text("enable = "); |
| 1972 | q.text("%#x" % self.enable) |
| 1973 | q.breakable() |
| 1974 | q.text('}') |
| 1975 | |
| 1976 | bsn_header.subtypes[18] = bsn_bw_enable_set_request |
| 1977 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 1978 | class bsn_controller_connections_reply(bsn_header): |
| 1979 | version = 5 |
| 1980 | type = 4 |
| 1981 | experimenter = 6035143 |
| 1982 | subtype = 57 |
| 1983 | |
| 1984 | def __init__(self, xid=None, connections=None): |
| 1985 | if xid != None: |
| 1986 | self.xid = xid |
| 1987 | else: |
| 1988 | self.xid = None |
| 1989 | if connections != None: |
| 1990 | self.connections = connections |
| 1991 | else: |
| 1992 | self.connections = [] |
| 1993 | return |
| 1994 | |
| 1995 | def pack(self): |
| 1996 | packed = [] |
| 1997 | packed.append(struct.pack("!B", self.version)) |
| 1998 | packed.append(struct.pack("!B", self.type)) |
| 1999 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2000 | packed.append(struct.pack("!L", self.xid)) |
| 2001 | packed.append(struct.pack("!L", self.experimenter)) |
| 2002 | packed.append(struct.pack("!L", self.subtype)) |
| 2003 | packed.append(loxi.generic_util.pack_list(self.connections)) |
| 2004 | length = sum([len(x) for x in packed]) |
| 2005 | packed[2] = struct.pack("!H", length) |
| 2006 | return ''.join(packed) |
| 2007 | |
| 2008 | @staticmethod |
| 2009 | def unpack(reader): |
| 2010 | obj = bsn_controller_connections_reply() |
| 2011 | _version = reader.read("!B")[0] |
| 2012 | assert(_version == 5) |
| 2013 | _type = reader.read("!B")[0] |
| 2014 | assert(_type == 4) |
| 2015 | _length = reader.read("!H")[0] |
| 2016 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2017 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2018 | obj.xid = reader.read("!L")[0] |
| 2019 | _experimenter = reader.read("!L")[0] |
| 2020 | assert(_experimenter == 6035143) |
| 2021 | _subtype = reader.read("!L")[0] |
| 2022 | assert(_subtype == 57) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 2023 | obj.connections = loxi.generic_util.unpack_list(reader, ofp.common.bsn_controller_connection.unpack) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2024 | return obj |
| 2025 | |
| 2026 | def __eq__(self, other): |
| 2027 | if type(self) != type(other): return False |
| 2028 | if self.xid != other.xid: return False |
| 2029 | if self.connections != other.connections: return False |
| 2030 | return True |
| 2031 | |
| 2032 | def pretty_print(self, q): |
| 2033 | q.text("bsn_controller_connections_reply {") |
| 2034 | with q.group(): |
| 2035 | with q.indent(2): |
| 2036 | q.breakable() |
| 2037 | q.text("xid = "); |
| 2038 | if self.xid != None: |
| 2039 | q.text("%#x" % self.xid) |
| 2040 | else: |
| 2041 | q.text('None') |
| 2042 | q.text(","); q.breakable() |
| 2043 | q.text("connections = "); |
| 2044 | q.pp(self.connections) |
| 2045 | q.breakable() |
| 2046 | q.text('}') |
| 2047 | |
| 2048 | bsn_header.subtypes[57] = bsn_controller_connections_reply |
| 2049 | |
| 2050 | class bsn_controller_connections_request(bsn_header): |
| 2051 | version = 5 |
| 2052 | type = 4 |
| 2053 | experimenter = 6035143 |
| 2054 | subtype = 56 |
| 2055 | |
| 2056 | def __init__(self, xid=None): |
| 2057 | if xid != None: |
| 2058 | self.xid = xid |
| 2059 | else: |
| 2060 | self.xid = None |
| 2061 | return |
| 2062 | |
| 2063 | def pack(self): |
| 2064 | packed = [] |
| 2065 | packed.append(struct.pack("!B", self.version)) |
| 2066 | packed.append(struct.pack("!B", self.type)) |
| 2067 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2068 | packed.append(struct.pack("!L", self.xid)) |
| 2069 | packed.append(struct.pack("!L", self.experimenter)) |
| 2070 | packed.append(struct.pack("!L", self.subtype)) |
| 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_controller_connections_request() |
| 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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2084 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 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 == 56) |
| 2090 | return obj |
| 2091 | |
| 2092 | def __eq__(self, other): |
| 2093 | if type(self) != type(other): return False |
| 2094 | if self.xid != other.xid: return False |
| 2095 | return True |
| 2096 | |
| 2097 | def pretty_print(self, q): |
| 2098 | q.text("bsn_controller_connections_request {") |
| 2099 | with q.group(): |
| 2100 | with q.indent(2): |
| 2101 | q.breakable() |
| 2102 | q.text("xid = "); |
| 2103 | if self.xid != None: |
| 2104 | q.text("%#x" % self.xid) |
| 2105 | else: |
| 2106 | q.text('None') |
| 2107 | q.breakable() |
| 2108 | q.text('}') |
| 2109 | |
| 2110 | bsn_header.subtypes[56] = bsn_controller_connections_request |
| 2111 | |
| 2112 | class experimenter_stats_reply(stats_reply): |
| 2113 | subtypes = {} |
| 2114 | |
| 2115 | version = 5 |
| 2116 | type = 19 |
| 2117 | stats_type = 65535 |
| 2118 | |
| 2119 | def __init__(self, xid=None, flags=None, experimenter=None, subtype=None): |
| 2120 | if xid != None: |
| 2121 | self.xid = xid |
| 2122 | else: |
| 2123 | self.xid = None |
| 2124 | if flags != None: |
| 2125 | self.flags = flags |
| 2126 | else: |
| 2127 | self.flags = 0 |
| 2128 | if experimenter != None: |
| 2129 | self.experimenter = experimenter |
| 2130 | else: |
| 2131 | self.experimenter = 0 |
| 2132 | if subtype != None: |
| 2133 | self.subtype = subtype |
| 2134 | else: |
| 2135 | self.subtype = 0 |
| 2136 | return |
| 2137 | |
| 2138 | def pack(self): |
| 2139 | packed = [] |
| 2140 | packed.append(struct.pack("!B", self.version)) |
| 2141 | packed.append(struct.pack("!B", self.type)) |
| 2142 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2143 | packed.append(struct.pack("!L", self.xid)) |
| 2144 | packed.append(struct.pack("!H", self.stats_type)) |
| 2145 | packed.append(struct.pack("!H", self.flags)) |
| 2146 | packed.append('\x00' * 4) |
| 2147 | packed.append(struct.pack("!L", self.experimenter)) |
| 2148 | packed.append(struct.pack("!L", self.subtype)) |
| 2149 | length = sum([len(x) for x in packed]) |
| 2150 | packed[2] = struct.pack("!H", length) |
| 2151 | return ''.join(packed) |
| 2152 | |
| 2153 | @staticmethod |
| 2154 | def unpack(reader): |
| 2155 | subtype, = reader.peek('!L', 16) |
| 2156 | subclass = experimenter_stats_reply.subtypes.get(subtype) |
| 2157 | if subclass: |
| 2158 | return subclass.unpack(reader) |
| 2159 | |
| 2160 | obj = experimenter_stats_reply() |
| 2161 | _version = reader.read("!B")[0] |
| 2162 | assert(_version == 5) |
| 2163 | _type = reader.read("!B")[0] |
| 2164 | assert(_type == 19) |
| 2165 | _length = reader.read("!H")[0] |
| 2166 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2167 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2168 | obj.xid = reader.read("!L")[0] |
| 2169 | _stats_type = reader.read("!H")[0] |
| 2170 | assert(_stats_type == 65535) |
| 2171 | obj.flags = reader.read("!H")[0] |
| 2172 | reader.skip(4) |
| 2173 | obj.experimenter = reader.read("!L")[0] |
| 2174 | obj.subtype = reader.read("!L")[0] |
| 2175 | return obj |
| 2176 | |
| 2177 | def __eq__(self, other): |
| 2178 | if type(self) != type(other): return False |
| 2179 | if self.xid != other.xid: return False |
| 2180 | if self.flags != other.flags: return False |
| 2181 | if self.experimenter != other.experimenter: return False |
| 2182 | if self.subtype != other.subtype: return False |
| 2183 | return True |
| 2184 | |
| 2185 | def pretty_print(self, q): |
| 2186 | q.text("experimenter_stats_reply {") |
| 2187 | with q.group(): |
| 2188 | with q.indent(2): |
| 2189 | q.breakable() |
| 2190 | q.text("xid = "); |
| 2191 | if self.xid != None: |
| 2192 | q.text("%#x" % self.xid) |
| 2193 | else: |
| 2194 | q.text('None') |
| 2195 | q.text(","); q.breakable() |
| 2196 | q.text("flags = "); |
| 2197 | q.text("%#x" % self.flags) |
| 2198 | q.text(","); q.breakable() |
| 2199 | q.text("subtype = "); |
| 2200 | q.text("%#x" % self.subtype) |
| 2201 | q.breakable() |
| 2202 | q.text('}') |
| 2203 | |
| 2204 | stats_reply.subtypes[65535] = experimenter_stats_reply |
| 2205 | |
| 2206 | class bsn_stats_reply(experimenter_stats_reply): |
| 2207 | subtypes = {} |
| 2208 | |
| 2209 | version = 5 |
| 2210 | type = 19 |
| 2211 | stats_type = 65535 |
| 2212 | experimenter = 6035143 |
| 2213 | |
| 2214 | def __init__(self, xid=None, flags=None, subtype=None): |
| 2215 | if xid != None: |
| 2216 | self.xid = xid |
| 2217 | else: |
| 2218 | self.xid = None |
| 2219 | if flags != None: |
| 2220 | self.flags = flags |
| 2221 | else: |
| 2222 | self.flags = 0 |
| 2223 | if subtype != None: |
| 2224 | self.subtype = subtype |
| 2225 | else: |
| 2226 | self.subtype = 0 |
| 2227 | return |
| 2228 | |
| 2229 | def pack(self): |
| 2230 | packed = [] |
| 2231 | packed.append(struct.pack("!B", self.version)) |
| 2232 | packed.append(struct.pack("!B", self.type)) |
| 2233 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2234 | packed.append(struct.pack("!L", self.xid)) |
| 2235 | packed.append(struct.pack("!H", self.stats_type)) |
| 2236 | packed.append(struct.pack("!H", self.flags)) |
| 2237 | packed.append('\x00' * 4) |
| 2238 | packed.append(struct.pack("!L", self.experimenter)) |
| 2239 | packed.append(struct.pack("!L", self.subtype)) |
| 2240 | length = sum([len(x) for x in packed]) |
| 2241 | packed[2] = struct.pack("!H", length) |
| 2242 | return ''.join(packed) |
| 2243 | |
| 2244 | @staticmethod |
| 2245 | def unpack(reader): |
| 2246 | subtype, = reader.peek('!L', 20) |
| 2247 | subclass = bsn_stats_reply.subtypes.get(subtype) |
| 2248 | if subclass: |
| 2249 | return subclass.unpack(reader) |
| 2250 | |
| 2251 | obj = bsn_stats_reply() |
| 2252 | _version = reader.read("!B")[0] |
| 2253 | assert(_version == 5) |
| 2254 | _type = reader.read("!B")[0] |
| 2255 | assert(_type == 19) |
| 2256 | _length = reader.read("!H")[0] |
| 2257 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2258 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2259 | obj.xid = reader.read("!L")[0] |
| 2260 | _stats_type = reader.read("!H")[0] |
| 2261 | assert(_stats_type == 65535) |
| 2262 | obj.flags = reader.read("!H")[0] |
| 2263 | reader.skip(4) |
| 2264 | _experimenter = reader.read("!L")[0] |
| 2265 | assert(_experimenter == 6035143) |
| 2266 | obj.subtype = reader.read("!L")[0] |
| 2267 | return obj |
| 2268 | |
| 2269 | def __eq__(self, other): |
| 2270 | if type(self) != type(other): return False |
| 2271 | if self.xid != other.xid: return False |
| 2272 | if self.flags != other.flags: return False |
| 2273 | if self.subtype != other.subtype: return False |
| 2274 | return True |
| 2275 | |
| 2276 | def pretty_print(self, q): |
| 2277 | q.text("bsn_stats_reply {") |
| 2278 | with q.group(): |
| 2279 | with q.indent(2): |
| 2280 | q.breakable() |
| 2281 | q.text("xid = "); |
| 2282 | if self.xid != None: |
| 2283 | q.text("%#x" % self.xid) |
| 2284 | else: |
| 2285 | q.text('None') |
| 2286 | q.text(","); q.breakable() |
| 2287 | q.text("flags = "); |
| 2288 | q.text("%#x" % self.flags) |
| 2289 | q.breakable() |
| 2290 | q.text('}') |
| 2291 | |
| 2292 | experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply |
| 2293 | |
| 2294 | class bsn_debug_counter_desc_stats_reply(bsn_stats_reply): |
| 2295 | version = 5 |
| 2296 | type = 19 |
| 2297 | stats_type = 65535 |
| 2298 | experimenter = 6035143 |
| 2299 | subtype = 13 |
| 2300 | |
| 2301 | def __init__(self, xid=None, flags=None, entries=None): |
| 2302 | if xid != None: |
| 2303 | self.xid = xid |
| 2304 | else: |
| 2305 | self.xid = None |
| 2306 | if flags != None: |
| 2307 | self.flags = flags |
| 2308 | else: |
| 2309 | self.flags = 0 |
| 2310 | if entries != None: |
| 2311 | self.entries = entries |
| 2312 | else: |
| 2313 | self.entries = [] |
| 2314 | return |
| 2315 | |
| 2316 | def pack(self): |
| 2317 | packed = [] |
| 2318 | packed.append(struct.pack("!B", self.version)) |
| 2319 | packed.append(struct.pack("!B", self.type)) |
| 2320 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2321 | packed.append(struct.pack("!L", self.xid)) |
| 2322 | packed.append(struct.pack("!H", self.stats_type)) |
| 2323 | packed.append(struct.pack("!H", self.flags)) |
| 2324 | packed.append('\x00' * 4) |
| 2325 | packed.append(struct.pack("!L", self.experimenter)) |
| 2326 | packed.append(struct.pack("!L", self.subtype)) |
| 2327 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 2328 | length = sum([len(x) for x in packed]) |
| 2329 | packed[2] = struct.pack("!H", length) |
| 2330 | return ''.join(packed) |
| 2331 | |
| 2332 | @staticmethod |
| 2333 | def unpack(reader): |
| 2334 | obj = bsn_debug_counter_desc_stats_reply() |
| 2335 | _version = reader.read("!B")[0] |
| 2336 | assert(_version == 5) |
| 2337 | _type = reader.read("!B")[0] |
| 2338 | assert(_type == 19) |
| 2339 | _length = reader.read("!H")[0] |
| 2340 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2341 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2342 | obj.xid = reader.read("!L")[0] |
| 2343 | _stats_type = reader.read("!H")[0] |
| 2344 | assert(_stats_type == 65535) |
| 2345 | obj.flags = reader.read("!H")[0] |
| 2346 | reader.skip(4) |
| 2347 | _experimenter = reader.read("!L")[0] |
| 2348 | assert(_experimenter == 6035143) |
| 2349 | _subtype = reader.read("!L")[0] |
| 2350 | assert(_subtype == 13) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 2351 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_debug_counter_desc_stats_entry.unpack) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2352 | return obj |
| 2353 | |
| 2354 | def __eq__(self, other): |
| 2355 | if type(self) != type(other): return False |
| 2356 | if self.xid != other.xid: return False |
| 2357 | if self.flags != other.flags: return False |
| 2358 | if self.entries != other.entries: return False |
| 2359 | return True |
| 2360 | |
| 2361 | def pretty_print(self, q): |
| 2362 | q.text("bsn_debug_counter_desc_stats_reply {") |
| 2363 | with q.group(): |
| 2364 | with q.indent(2): |
| 2365 | q.breakable() |
| 2366 | q.text("xid = "); |
| 2367 | if self.xid != None: |
| 2368 | q.text("%#x" % self.xid) |
| 2369 | else: |
| 2370 | q.text('None') |
| 2371 | q.text(","); q.breakable() |
| 2372 | q.text("flags = "); |
| 2373 | q.text("%#x" % self.flags) |
| 2374 | q.text(","); q.breakable() |
| 2375 | q.text("entries = "); |
| 2376 | q.pp(self.entries) |
| 2377 | q.breakable() |
| 2378 | q.text('}') |
| 2379 | |
| 2380 | bsn_stats_reply.subtypes[13] = bsn_debug_counter_desc_stats_reply |
| 2381 | |
| 2382 | class experimenter_stats_request(stats_request): |
| 2383 | subtypes = {} |
| 2384 | |
| 2385 | version = 5 |
| 2386 | type = 18 |
| 2387 | stats_type = 65535 |
| 2388 | |
| 2389 | def __init__(self, xid=None, flags=None, experimenter=None, subtype=None): |
| 2390 | if xid != None: |
| 2391 | self.xid = xid |
| 2392 | else: |
| 2393 | self.xid = None |
| 2394 | if flags != None: |
| 2395 | self.flags = flags |
| 2396 | else: |
| 2397 | self.flags = 0 |
| 2398 | if experimenter != None: |
| 2399 | self.experimenter = experimenter |
| 2400 | else: |
| 2401 | self.experimenter = 0 |
| 2402 | if subtype != None: |
| 2403 | self.subtype = subtype |
| 2404 | else: |
| 2405 | self.subtype = 0 |
| 2406 | return |
| 2407 | |
| 2408 | def pack(self): |
| 2409 | packed = [] |
| 2410 | packed.append(struct.pack("!B", self.version)) |
| 2411 | packed.append(struct.pack("!B", self.type)) |
| 2412 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2413 | packed.append(struct.pack("!L", self.xid)) |
| 2414 | packed.append(struct.pack("!H", self.stats_type)) |
| 2415 | packed.append(struct.pack("!H", self.flags)) |
| 2416 | packed.append('\x00' * 4) |
| 2417 | packed.append(struct.pack("!L", self.experimenter)) |
| 2418 | packed.append(struct.pack("!L", self.subtype)) |
| 2419 | length = sum([len(x) for x in packed]) |
| 2420 | packed[2] = struct.pack("!H", length) |
| 2421 | return ''.join(packed) |
| 2422 | |
| 2423 | @staticmethod |
| 2424 | def unpack(reader): |
| 2425 | subtype, = reader.peek('!L', 16) |
| 2426 | subclass = experimenter_stats_request.subtypes.get(subtype) |
| 2427 | if subclass: |
| 2428 | return subclass.unpack(reader) |
| 2429 | |
| 2430 | obj = experimenter_stats_request() |
| 2431 | _version = reader.read("!B")[0] |
| 2432 | assert(_version == 5) |
| 2433 | _type = reader.read("!B")[0] |
| 2434 | assert(_type == 18) |
| 2435 | _length = reader.read("!H")[0] |
| 2436 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2437 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2438 | obj.xid = reader.read("!L")[0] |
| 2439 | _stats_type = reader.read("!H")[0] |
| 2440 | assert(_stats_type == 65535) |
| 2441 | obj.flags = reader.read("!H")[0] |
| 2442 | reader.skip(4) |
| 2443 | obj.experimenter = reader.read("!L")[0] |
| 2444 | obj.subtype = reader.read("!L")[0] |
| 2445 | return obj |
| 2446 | |
| 2447 | def __eq__(self, other): |
| 2448 | if type(self) != type(other): return False |
| 2449 | if self.xid != other.xid: return False |
| 2450 | if self.flags != other.flags: return False |
| 2451 | if self.experimenter != other.experimenter: return False |
| 2452 | if self.subtype != other.subtype: return False |
| 2453 | return True |
| 2454 | |
| 2455 | def pretty_print(self, q): |
| 2456 | q.text("experimenter_stats_request {") |
| 2457 | with q.group(): |
| 2458 | with q.indent(2): |
| 2459 | q.breakable() |
| 2460 | q.text("xid = "); |
| 2461 | if self.xid != None: |
| 2462 | q.text("%#x" % self.xid) |
| 2463 | else: |
| 2464 | q.text('None') |
| 2465 | q.text(","); q.breakable() |
| 2466 | q.text("flags = "); |
| 2467 | q.text("%#x" % self.flags) |
| 2468 | q.text(","); q.breakable() |
| 2469 | q.text("subtype = "); |
| 2470 | q.text("%#x" % self.subtype) |
| 2471 | q.breakable() |
| 2472 | q.text('}') |
| 2473 | |
| 2474 | stats_request.subtypes[65535] = experimenter_stats_request |
| 2475 | |
| 2476 | class bsn_stats_request(experimenter_stats_request): |
| 2477 | subtypes = {} |
| 2478 | |
| 2479 | version = 5 |
| 2480 | type = 18 |
| 2481 | stats_type = 65535 |
| 2482 | experimenter = 6035143 |
| 2483 | |
| 2484 | def __init__(self, xid=None, flags=None, subtype=None): |
| 2485 | if xid != None: |
| 2486 | self.xid = xid |
| 2487 | else: |
| 2488 | self.xid = None |
| 2489 | if flags != None: |
| 2490 | self.flags = flags |
| 2491 | else: |
| 2492 | self.flags = 0 |
| 2493 | if subtype != None: |
| 2494 | self.subtype = subtype |
| 2495 | else: |
| 2496 | self.subtype = 0 |
| 2497 | return |
| 2498 | |
| 2499 | def pack(self): |
| 2500 | packed = [] |
| 2501 | packed.append(struct.pack("!B", self.version)) |
| 2502 | packed.append(struct.pack("!B", self.type)) |
| 2503 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2504 | packed.append(struct.pack("!L", self.xid)) |
| 2505 | packed.append(struct.pack("!H", self.stats_type)) |
| 2506 | packed.append(struct.pack("!H", self.flags)) |
| 2507 | packed.append('\x00' * 4) |
| 2508 | packed.append(struct.pack("!L", self.experimenter)) |
| 2509 | packed.append(struct.pack("!L", self.subtype)) |
| 2510 | length = sum([len(x) for x in packed]) |
| 2511 | packed[2] = struct.pack("!H", length) |
| 2512 | return ''.join(packed) |
| 2513 | |
| 2514 | @staticmethod |
| 2515 | def unpack(reader): |
| 2516 | subtype, = reader.peek('!L', 20) |
| 2517 | subclass = bsn_stats_request.subtypes.get(subtype) |
| 2518 | if subclass: |
| 2519 | return subclass.unpack(reader) |
| 2520 | |
| 2521 | obj = bsn_stats_request() |
| 2522 | _version = reader.read("!B")[0] |
| 2523 | assert(_version == 5) |
| 2524 | _type = reader.read("!B")[0] |
| 2525 | assert(_type == 18) |
| 2526 | _length = reader.read("!H")[0] |
| 2527 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2528 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2529 | obj.xid = reader.read("!L")[0] |
| 2530 | _stats_type = reader.read("!H")[0] |
| 2531 | assert(_stats_type == 65535) |
| 2532 | obj.flags = reader.read("!H")[0] |
| 2533 | reader.skip(4) |
| 2534 | _experimenter = reader.read("!L")[0] |
| 2535 | assert(_experimenter == 6035143) |
| 2536 | obj.subtype = reader.read("!L")[0] |
| 2537 | return obj |
| 2538 | |
| 2539 | def __eq__(self, other): |
| 2540 | if type(self) != type(other): return False |
| 2541 | if self.xid != other.xid: return False |
| 2542 | if self.flags != other.flags: return False |
| 2543 | if self.subtype != other.subtype: return False |
| 2544 | return True |
| 2545 | |
| 2546 | def pretty_print(self, q): |
| 2547 | q.text("bsn_stats_request {") |
| 2548 | with q.group(): |
| 2549 | with q.indent(2): |
| 2550 | q.breakable() |
| 2551 | q.text("xid = "); |
| 2552 | if self.xid != None: |
| 2553 | q.text("%#x" % self.xid) |
| 2554 | else: |
| 2555 | q.text('None') |
| 2556 | q.text(","); q.breakable() |
| 2557 | q.text("flags = "); |
| 2558 | q.text("%#x" % self.flags) |
| 2559 | q.breakable() |
| 2560 | q.text('}') |
| 2561 | |
| 2562 | experimenter_stats_request.subtypes[6035143] = bsn_stats_request |
| 2563 | |
| 2564 | class bsn_debug_counter_desc_stats_request(bsn_stats_request): |
| 2565 | version = 5 |
| 2566 | type = 18 |
| 2567 | stats_type = 65535 |
| 2568 | experimenter = 6035143 |
| 2569 | subtype = 13 |
| 2570 | |
| 2571 | def __init__(self, xid=None, flags=None): |
| 2572 | if xid != None: |
| 2573 | self.xid = xid |
| 2574 | else: |
| 2575 | self.xid = None |
| 2576 | if flags != None: |
| 2577 | self.flags = flags |
| 2578 | else: |
| 2579 | self.flags = 0 |
| 2580 | return |
| 2581 | |
| 2582 | def pack(self): |
| 2583 | packed = [] |
| 2584 | packed.append(struct.pack("!B", self.version)) |
| 2585 | packed.append(struct.pack("!B", self.type)) |
| 2586 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2587 | packed.append(struct.pack("!L", self.xid)) |
| 2588 | packed.append(struct.pack("!H", self.stats_type)) |
| 2589 | packed.append(struct.pack("!H", self.flags)) |
| 2590 | packed.append('\x00' * 4) |
| 2591 | packed.append(struct.pack("!L", self.experimenter)) |
| 2592 | packed.append(struct.pack("!L", self.subtype)) |
| 2593 | length = sum([len(x) for x in packed]) |
| 2594 | packed[2] = struct.pack("!H", length) |
| 2595 | return ''.join(packed) |
| 2596 | |
| 2597 | @staticmethod |
| 2598 | def unpack(reader): |
| 2599 | obj = bsn_debug_counter_desc_stats_request() |
| 2600 | _version = reader.read("!B")[0] |
| 2601 | assert(_version == 5) |
| 2602 | _type = reader.read("!B")[0] |
| 2603 | assert(_type == 18) |
| 2604 | _length = reader.read("!H")[0] |
| 2605 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2606 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2607 | obj.xid = reader.read("!L")[0] |
| 2608 | _stats_type = reader.read("!H")[0] |
| 2609 | assert(_stats_type == 65535) |
| 2610 | obj.flags = reader.read("!H")[0] |
| 2611 | reader.skip(4) |
| 2612 | _experimenter = reader.read("!L")[0] |
| 2613 | assert(_experimenter == 6035143) |
| 2614 | _subtype = reader.read("!L")[0] |
| 2615 | assert(_subtype == 13) |
| 2616 | return obj |
| 2617 | |
| 2618 | def __eq__(self, other): |
| 2619 | if type(self) != type(other): return False |
| 2620 | if self.xid != other.xid: return False |
| 2621 | if self.flags != other.flags: return False |
| 2622 | return True |
| 2623 | |
| 2624 | def pretty_print(self, q): |
| 2625 | q.text("bsn_debug_counter_desc_stats_request {") |
| 2626 | with q.group(): |
| 2627 | with q.indent(2): |
| 2628 | q.breakable() |
| 2629 | q.text("xid = "); |
| 2630 | if self.xid != None: |
| 2631 | q.text("%#x" % self.xid) |
| 2632 | else: |
| 2633 | q.text('None') |
| 2634 | q.text(","); q.breakable() |
| 2635 | q.text("flags = "); |
| 2636 | q.text("%#x" % self.flags) |
| 2637 | q.breakable() |
| 2638 | q.text('}') |
| 2639 | |
| 2640 | bsn_stats_request.subtypes[13] = bsn_debug_counter_desc_stats_request |
| 2641 | |
| 2642 | class bsn_debug_counter_stats_reply(bsn_stats_reply): |
| 2643 | version = 5 |
| 2644 | type = 19 |
| 2645 | stats_type = 65535 |
| 2646 | experimenter = 6035143 |
| 2647 | subtype = 12 |
| 2648 | |
| 2649 | def __init__(self, xid=None, flags=None, entries=None): |
| 2650 | if xid != None: |
| 2651 | self.xid = xid |
| 2652 | else: |
| 2653 | self.xid = None |
| 2654 | if flags != None: |
| 2655 | self.flags = flags |
| 2656 | else: |
| 2657 | self.flags = 0 |
| 2658 | if entries != None: |
| 2659 | self.entries = entries |
| 2660 | else: |
| 2661 | self.entries = [] |
| 2662 | return |
| 2663 | |
| 2664 | def pack(self): |
| 2665 | packed = [] |
| 2666 | packed.append(struct.pack("!B", self.version)) |
| 2667 | packed.append(struct.pack("!B", self.type)) |
| 2668 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2669 | packed.append(struct.pack("!L", self.xid)) |
| 2670 | packed.append(struct.pack("!H", self.stats_type)) |
| 2671 | packed.append(struct.pack("!H", self.flags)) |
| 2672 | packed.append('\x00' * 4) |
| 2673 | packed.append(struct.pack("!L", self.experimenter)) |
| 2674 | packed.append(struct.pack("!L", self.subtype)) |
| 2675 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 2676 | length = sum([len(x) for x in packed]) |
| 2677 | packed[2] = struct.pack("!H", length) |
| 2678 | return ''.join(packed) |
| 2679 | |
| 2680 | @staticmethod |
| 2681 | def unpack(reader): |
| 2682 | obj = bsn_debug_counter_stats_reply() |
| 2683 | _version = reader.read("!B")[0] |
| 2684 | assert(_version == 5) |
| 2685 | _type = reader.read("!B")[0] |
| 2686 | assert(_type == 19) |
| 2687 | _length = reader.read("!H")[0] |
| 2688 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2689 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2690 | obj.xid = reader.read("!L")[0] |
| 2691 | _stats_type = reader.read("!H")[0] |
| 2692 | assert(_stats_type == 65535) |
| 2693 | obj.flags = reader.read("!H")[0] |
| 2694 | reader.skip(4) |
| 2695 | _experimenter = reader.read("!L")[0] |
| 2696 | assert(_experimenter == 6035143) |
| 2697 | _subtype = reader.read("!L")[0] |
| 2698 | assert(_subtype == 12) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 2699 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_debug_counter_stats_entry.unpack) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2700 | return obj |
| 2701 | |
| 2702 | def __eq__(self, other): |
| 2703 | if type(self) != type(other): return False |
| 2704 | if self.xid != other.xid: return False |
| 2705 | if self.flags != other.flags: return False |
| 2706 | if self.entries != other.entries: return False |
| 2707 | return True |
| 2708 | |
| 2709 | def pretty_print(self, q): |
| 2710 | q.text("bsn_debug_counter_stats_reply {") |
| 2711 | with q.group(): |
| 2712 | with q.indent(2): |
| 2713 | q.breakable() |
| 2714 | q.text("xid = "); |
| 2715 | if self.xid != None: |
| 2716 | q.text("%#x" % self.xid) |
| 2717 | else: |
| 2718 | q.text('None') |
| 2719 | q.text(","); q.breakable() |
| 2720 | q.text("flags = "); |
| 2721 | q.text("%#x" % self.flags) |
| 2722 | q.text(","); q.breakable() |
| 2723 | q.text("entries = "); |
| 2724 | q.pp(self.entries) |
| 2725 | q.breakable() |
| 2726 | q.text('}') |
| 2727 | |
| 2728 | bsn_stats_reply.subtypes[12] = bsn_debug_counter_stats_reply |
| 2729 | |
| 2730 | class bsn_debug_counter_stats_request(bsn_stats_request): |
| 2731 | version = 5 |
| 2732 | type = 18 |
| 2733 | stats_type = 65535 |
| 2734 | experimenter = 6035143 |
| 2735 | subtype = 12 |
| 2736 | |
| 2737 | def __init__(self, xid=None, flags=None): |
| 2738 | if xid != None: |
| 2739 | self.xid = xid |
| 2740 | else: |
| 2741 | self.xid = None |
| 2742 | if flags != None: |
| 2743 | self.flags = flags |
| 2744 | else: |
| 2745 | self.flags = 0 |
| 2746 | return |
| 2747 | |
| 2748 | def pack(self): |
| 2749 | packed = [] |
| 2750 | packed.append(struct.pack("!B", self.version)) |
| 2751 | packed.append(struct.pack("!B", self.type)) |
| 2752 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2753 | packed.append(struct.pack("!L", self.xid)) |
| 2754 | packed.append(struct.pack("!H", self.stats_type)) |
| 2755 | packed.append(struct.pack("!H", self.flags)) |
| 2756 | packed.append('\x00' * 4) |
| 2757 | packed.append(struct.pack("!L", self.experimenter)) |
| 2758 | packed.append(struct.pack("!L", self.subtype)) |
| 2759 | length = sum([len(x) for x in packed]) |
| 2760 | packed[2] = struct.pack("!H", length) |
| 2761 | return ''.join(packed) |
| 2762 | |
| 2763 | @staticmethod |
| 2764 | def unpack(reader): |
| 2765 | obj = bsn_debug_counter_stats_request() |
| 2766 | _version = reader.read("!B")[0] |
| 2767 | assert(_version == 5) |
| 2768 | _type = reader.read("!B")[0] |
| 2769 | assert(_type == 18) |
| 2770 | _length = reader.read("!H")[0] |
| 2771 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2772 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2773 | obj.xid = reader.read("!L")[0] |
| 2774 | _stats_type = reader.read("!H")[0] |
| 2775 | assert(_stats_type == 65535) |
| 2776 | obj.flags = reader.read("!H")[0] |
| 2777 | reader.skip(4) |
| 2778 | _experimenter = reader.read("!L")[0] |
| 2779 | assert(_experimenter == 6035143) |
| 2780 | _subtype = reader.read("!L")[0] |
| 2781 | assert(_subtype == 12) |
| 2782 | return obj |
| 2783 | |
| 2784 | def __eq__(self, other): |
| 2785 | if type(self) != type(other): return False |
| 2786 | if self.xid != other.xid: return False |
| 2787 | if self.flags != other.flags: return False |
| 2788 | return True |
| 2789 | |
| 2790 | def pretty_print(self, q): |
| 2791 | q.text("bsn_debug_counter_stats_request {") |
| 2792 | with q.group(): |
| 2793 | with q.indent(2): |
| 2794 | q.breakable() |
| 2795 | q.text("xid = "); |
| 2796 | if self.xid != None: |
| 2797 | q.text("%#x" % self.xid) |
| 2798 | else: |
| 2799 | q.text('None') |
| 2800 | q.text(","); q.breakable() |
| 2801 | q.text("flags = "); |
| 2802 | q.text("%#x" % self.flags) |
| 2803 | q.breakable() |
| 2804 | q.text('}') |
| 2805 | |
| 2806 | bsn_stats_request.subtypes[12] = bsn_debug_counter_stats_request |
| 2807 | |
| 2808 | class bsn_flow_checksum_bucket_stats_reply(bsn_stats_reply): |
| 2809 | version = 5 |
| 2810 | type = 19 |
| 2811 | stats_type = 65535 |
| 2812 | experimenter = 6035143 |
| 2813 | subtype = 10 |
| 2814 | |
| 2815 | def __init__(self, xid=None, flags=None, entries=None): |
| 2816 | if xid != None: |
| 2817 | self.xid = xid |
| 2818 | else: |
| 2819 | self.xid = None |
| 2820 | if flags != None: |
| 2821 | self.flags = flags |
| 2822 | else: |
| 2823 | self.flags = 0 |
| 2824 | if entries != None: |
| 2825 | self.entries = entries |
| 2826 | else: |
| 2827 | self.entries = [] |
| 2828 | return |
| 2829 | |
| 2830 | def pack(self): |
| 2831 | packed = [] |
| 2832 | packed.append(struct.pack("!B", self.version)) |
| 2833 | packed.append(struct.pack("!B", self.type)) |
| 2834 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2835 | packed.append(struct.pack("!L", self.xid)) |
| 2836 | packed.append(struct.pack("!H", self.stats_type)) |
| 2837 | packed.append(struct.pack("!H", self.flags)) |
| 2838 | packed.append('\x00' * 4) |
| 2839 | packed.append(struct.pack("!L", self.experimenter)) |
| 2840 | packed.append(struct.pack("!L", self.subtype)) |
| 2841 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 2842 | length = sum([len(x) for x in packed]) |
| 2843 | packed[2] = struct.pack("!H", length) |
| 2844 | return ''.join(packed) |
| 2845 | |
| 2846 | @staticmethod |
| 2847 | def unpack(reader): |
| 2848 | obj = bsn_flow_checksum_bucket_stats_reply() |
| 2849 | _version = reader.read("!B")[0] |
| 2850 | assert(_version == 5) |
| 2851 | _type = reader.read("!B")[0] |
| 2852 | assert(_type == 19) |
| 2853 | _length = reader.read("!H")[0] |
| 2854 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2855 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2856 | obj.xid = reader.read("!L")[0] |
| 2857 | _stats_type = reader.read("!H")[0] |
| 2858 | assert(_stats_type == 65535) |
| 2859 | obj.flags = reader.read("!H")[0] |
| 2860 | reader.skip(4) |
| 2861 | _experimenter = reader.read("!L")[0] |
| 2862 | assert(_experimenter == 6035143) |
| 2863 | _subtype = reader.read("!L")[0] |
| 2864 | assert(_subtype == 10) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 2865 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_flow_checksum_bucket_stats_entry.unpack) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2866 | return obj |
| 2867 | |
| 2868 | def __eq__(self, other): |
| 2869 | if type(self) != type(other): return False |
| 2870 | if self.xid != other.xid: return False |
| 2871 | if self.flags != other.flags: return False |
| 2872 | if self.entries != other.entries: return False |
| 2873 | return True |
| 2874 | |
| 2875 | def pretty_print(self, q): |
| 2876 | q.text("bsn_flow_checksum_bucket_stats_reply {") |
| 2877 | with q.group(): |
| 2878 | with q.indent(2): |
| 2879 | q.breakable() |
| 2880 | q.text("xid = "); |
| 2881 | if self.xid != None: |
| 2882 | q.text("%#x" % self.xid) |
| 2883 | else: |
| 2884 | q.text('None') |
| 2885 | q.text(","); q.breakable() |
| 2886 | q.text("flags = "); |
| 2887 | q.text("%#x" % self.flags) |
| 2888 | q.text(","); q.breakable() |
| 2889 | q.text("entries = "); |
| 2890 | q.pp(self.entries) |
| 2891 | q.breakable() |
| 2892 | q.text('}') |
| 2893 | |
| 2894 | bsn_stats_reply.subtypes[10] = bsn_flow_checksum_bucket_stats_reply |
| 2895 | |
| 2896 | class bsn_flow_checksum_bucket_stats_request(bsn_stats_request): |
| 2897 | version = 5 |
| 2898 | type = 18 |
| 2899 | stats_type = 65535 |
| 2900 | experimenter = 6035143 |
| 2901 | subtype = 10 |
| 2902 | |
| 2903 | def __init__(self, xid=None, flags=None, table_id=None): |
| 2904 | if xid != None: |
| 2905 | self.xid = xid |
| 2906 | else: |
| 2907 | self.xid = None |
| 2908 | if flags != None: |
| 2909 | self.flags = flags |
| 2910 | else: |
| 2911 | self.flags = 0 |
| 2912 | if table_id != None: |
| 2913 | self.table_id = table_id |
| 2914 | else: |
| 2915 | self.table_id = 0 |
| 2916 | return |
| 2917 | |
| 2918 | def pack(self): |
| 2919 | packed = [] |
| 2920 | packed.append(struct.pack("!B", self.version)) |
| 2921 | packed.append(struct.pack("!B", self.type)) |
| 2922 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2923 | packed.append(struct.pack("!L", self.xid)) |
| 2924 | packed.append(struct.pack("!H", self.stats_type)) |
| 2925 | packed.append(struct.pack("!H", self.flags)) |
| 2926 | packed.append('\x00' * 4) |
| 2927 | packed.append(struct.pack("!L", self.experimenter)) |
| 2928 | packed.append(struct.pack("!L", self.subtype)) |
| 2929 | packed.append(struct.pack("!B", self.table_id)) |
| 2930 | length = sum([len(x) for x in packed]) |
| 2931 | packed[2] = struct.pack("!H", length) |
| 2932 | return ''.join(packed) |
| 2933 | |
| 2934 | @staticmethod |
| 2935 | def unpack(reader): |
| 2936 | obj = bsn_flow_checksum_bucket_stats_request() |
| 2937 | _version = reader.read("!B")[0] |
| 2938 | assert(_version == 5) |
| 2939 | _type = reader.read("!B")[0] |
| 2940 | assert(_type == 18) |
| 2941 | _length = reader.read("!H")[0] |
| 2942 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2943 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 2944 | obj.xid = reader.read("!L")[0] |
| 2945 | _stats_type = reader.read("!H")[0] |
| 2946 | assert(_stats_type == 65535) |
| 2947 | obj.flags = reader.read("!H")[0] |
| 2948 | reader.skip(4) |
| 2949 | _experimenter = reader.read("!L")[0] |
| 2950 | assert(_experimenter == 6035143) |
| 2951 | _subtype = reader.read("!L")[0] |
| 2952 | assert(_subtype == 10) |
| 2953 | obj.table_id = reader.read("!B")[0] |
| 2954 | return obj |
| 2955 | |
| 2956 | def __eq__(self, other): |
| 2957 | if type(self) != type(other): return False |
| 2958 | if self.xid != other.xid: return False |
| 2959 | if self.flags != other.flags: return False |
| 2960 | if self.table_id != other.table_id: return False |
| 2961 | return True |
| 2962 | |
| 2963 | def pretty_print(self, q): |
| 2964 | q.text("bsn_flow_checksum_bucket_stats_request {") |
| 2965 | with q.group(): |
| 2966 | with q.indent(2): |
| 2967 | q.breakable() |
| 2968 | q.text("xid = "); |
| 2969 | if self.xid != None: |
| 2970 | q.text("%#x" % self.xid) |
| 2971 | else: |
| 2972 | q.text('None') |
| 2973 | q.text(","); q.breakable() |
| 2974 | q.text("flags = "); |
| 2975 | q.text("%#x" % self.flags) |
| 2976 | q.text(","); q.breakable() |
| 2977 | q.text("table_id = "); |
| 2978 | q.text("%#x" % self.table_id) |
| 2979 | q.breakable() |
| 2980 | q.text('}') |
| 2981 | |
| 2982 | bsn_stats_request.subtypes[10] = bsn_flow_checksum_bucket_stats_request |
| 2983 | |
| 2984 | class bsn_flow_idle(bsn_header): |
| 2985 | version = 5 |
| 2986 | type = 4 |
| 2987 | experimenter = 6035143 |
| 2988 | subtype = 40 |
| 2989 | |
| 2990 | def __init__(self, xid=None, cookie=None, priority=None, table_id=None, match=None): |
| 2991 | if xid != None: |
| 2992 | self.xid = xid |
| 2993 | else: |
| 2994 | self.xid = None |
| 2995 | if cookie != None: |
| 2996 | self.cookie = cookie |
| 2997 | else: |
| 2998 | self.cookie = 0 |
| 2999 | if priority != None: |
| 3000 | self.priority = priority |
| 3001 | else: |
| 3002 | self.priority = 0 |
| 3003 | if table_id != None: |
| 3004 | self.table_id = table_id |
| 3005 | else: |
| 3006 | self.table_id = 0 |
| 3007 | if match != None: |
| 3008 | self.match = match |
| 3009 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 3010 | self.match = ofp.match() |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3011 | return |
| 3012 | |
| 3013 | def pack(self): |
| 3014 | packed = [] |
| 3015 | packed.append(struct.pack("!B", self.version)) |
| 3016 | packed.append(struct.pack("!B", self.type)) |
| 3017 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3018 | packed.append(struct.pack("!L", self.xid)) |
| 3019 | packed.append(struct.pack("!L", self.experimenter)) |
| 3020 | packed.append(struct.pack("!L", self.subtype)) |
| 3021 | packed.append(struct.pack("!Q", self.cookie)) |
| 3022 | packed.append(struct.pack("!H", self.priority)) |
| 3023 | packed.append(struct.pack("!B", self.table_id)) |
| 3024 | packed.append('\x00' * 5) |
| 3025 | packed.append(self.match.pack()) |
| 3026 | length = sum([len(x) for x in packed]) |
| 3027 | packed[2] = struct.pack("!H", length) |
| 3028 | return ''.join(packed) |
| 3029 | |
| 3030 | @staticmethod |
| 3031 | def unpack(reader): |
| 3032 | obj = bsn_flow_idle() |
| 3033 | _version = reader.read("!B")[0] |
| 3034 | assert(_version == 5) |
| 3035 | _type = reader.read("!B")[0] |
| 3036 | assert(_type == 4) |
| 3037 | _length = reader.read("!H")[0] |
| 3038 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3039 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3040 | obj.xid = reader.read("!L")[0] |
| 3041 | _experimenter = reader.read("!L")[0] |
| 3042 | assert(_experimenter == 6035143) |
| 3043 | _subtype = reader.read("!L")[0] |
| 3044 | assert(_subtype == 40) |
| 3045 | obj.cookie = reader.read("!Q")[0] |
| 3046 | obj.priority = reader.read("!H")[0] |
| 3047 | obj.table_id = reader.read("!B")[0] |
| 3048 | reader.skip(5) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 3049 | obj.match = ofp.match.unpack(reader) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3050 | return obj |
| 3051 | |
| 3052 | def __eq__(self, other): |
| 3053 | if type(self) != type(other): return False |
| 3054 | if self.xid != other.xid: return False |
| 3055 | if self.cookie != other.cookie: return False |
| 3056 | if self.priority != other.priority: return False |
| 3057 | if self.table_id != other.table_id: return False |
| 3058 | if self.match != other.match: return False |
| 3059 | return True |
| 3060 | |
| 3061 | def pretty_print(self, q): |
| 3062 | q.text("bsn_flow_idle {") |
| 3063 | with q.group(): |
| 3064 | with q.indent(2): |
| 3065 | q.breakable() |
| 3066 | q.text("xid = "); |
| 3067 | if self.xid != None: |
| 3068 | q.text("%#x" % self.xid) |
| 3069 | else: |
| 3070 | q.text('None') |
| 3071 | q.text(","); q.breakable() |
| 3072 | q.text("cookie = "); |
| 3073 | q.text("%#x" % self.cookie) |
| 3074 | q.text(","); q.breakable() |
| 3075 | q.text("priority = "); |
| 3076 | q.text("%#x" % self.priority) |
| 3077 | q.text(","); q.breakable() |
| 3078 | q.text("table_id = "); |
| 3079 | q.text("%#x" % self.table_id) |
| 3080 | q.text(","); q.breakable() |
| 3081 | q.text("match = "); |
| 3082 | q.pp(self.match) |
| 3083 | q.breakable() |
| 3084 | q.text('}') |
| 3085 | |
| 3086 | bsn_header.subtypes[40] = bsn_flow_idle |
| 3087 | |
| 3088 | class bsn_flow_idle_enable_get_reply(bsn_header): |
| 3089 | version = 5 |
| 3090 | type = 4 |
| 3091 | experimenter = 6035143 |
| 3092 | subtype = 39 |
| 3093 | |
| 3094 | def __init__(self, xid=None, enabled=None): |
| 3095 | if xid != None: |
| 3096 | self.xid = xid |
| 3097 | else: |
| 3098 | self.xid = None |
| 3099 | if enabled != None: |
| 3100 | self.enabled = enabled |
| 3101 | else: |
| 3102 | self.enabled = 0 |
| 3103 | return |
| 3104 | |
| 3105 | def pack(self): |
| 3106 | packed = [] |
| 3107 | packed.append(struct.pack("!B", self.version)) |
| 3108 | packed.append(struct.pack("!B", self.type)) |
| 3109 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3110 | packed.append(struct.pack("!L", self.xid)) |
| 3111 | packed.append(struct.pack("!L", self.experimenter)) |
| 3112 | packed.append(struct.pack("!L", self.subtype)) |
| 3113 | packed.append(struct.pack("!L", self.enabled)) |
| 3114 | length = sum([len(x) for x in packed]) |
| 3115 | packed[2] = struct.pack("!H", length) |
| 3116 | return ''.join(packed) |
| 3117 | |
| 3118 | @staticmethod |
| 3119 | def unpack(reader): |
| 3120 | obj = bsn_flow_idle_enable_get_reply() |
| 3121 | _version = reader.read("!B")[0] |
| 3122 | assert(_version == 5) |
| 3123 | _type = reader.read("!B")[0] |
| 3124 | assert(_type == 4) |
| 3125 | _length = reader.read("!H")[0] |
| 3126 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3127 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3128 | obj.xid = reader.read("!L")[0] |
| 3129 | _experimenter = reader.read("!L")[0] |
| 3130 | assert(_experimenter == 6035143) |
| 3131 | _subtype = reader.read("!L")[0] |
| 3132 | assert(_subtype == 39) |
| 3133 | obj.enabled = reader.read("!L")[0] |
| 3134 | return obj |
| 3135 | |
| 3136 | def __eq__(self, other): |
| 3137 | if type(self) != type(other): return False |
| 3138 | if self.xid != other.xid: return False |
| 3139 | if self.enabled != other.enabled: return False |
| 3140 | return True |
| 3141 | |
| 3142 | def pretty_print(self, q): |
| 3143 | q.text("bsn_flow_idle_enable_get_reply {") |
| 3144 | with q.group(): |
| 3145 | with q.indent(2): |
| 3146 | q.breakable() |
| 3147 | q.text("xid = "); |
| 3148 | if self.xid != None: |
| 3149 | q.text("%#x" % self.xid) |
| 3150 | else: |
| 3151 | q.text('None') |
| 3152 | q.text(","); q.breakable() |
| 3153 | q.text("enabled = "); |
| 3154 | q.text("%#x" % self.enabled) |
| 3155 | q.breakable() |
| 3156 | q.text('}') |
| 3157 | |
| 3158 | bsn_header.subtypes[39] = bsn_flow_idle_enable_get_reply |
| 3159 | |
| 3160 | class bsn_flow_idle_enable_get_request(bsn_header): |
| 3161 | version = 5 |
| 3162 | type = 4 |
| 3163 | experimenter = 6035143 |
| 3164 | subtype = 38 |
| 3165 | |
| 3166 | def __init__(self, xid=None): |
| 3167 | if xid != None: |
| 3168 | self.xid = xid |
| 3169 | else: |
| 3170 | self.xid = None |
| 3171 | return |
| 3172 | |
| 3173 | def pack(self): |
| 3174 | packed = [] |
| 3175 | packed.append(struct.pack("!B", self.version)) |
| 3176 | packed.append(struct.pack("!B", self.type)) |
| 3177 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3178 | packed.append(struct.pack("!L", self.xid)) |
| 3179 | packed.append(struct.pack("!L", self.experimenter)) |
| 3180 | packed.append(struct.pack("!L", self.subtype)) |
| 3181 | length = sum([len(x) for x in packed]) |
| 3182 | packed[2] = struct.pack("!H", length) |
| 3183 | return ''.join(packed) |
| 3184 | |
| 3185 | @staticmethod |
| 3186 | def unpack(reader): |
| 3187 | obj = bsn_flow_idle_enable_get_request() |
| 3188 | _version = reader.read("!B")[0] |
| 3189 | assert(_version == 5) |
| 3190 | _type = reader.read("!B")[0] |
| 3191 | assert(_type == 4) |
| 3192 | _length = reader.read("!H")[0] |
| 3193 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3194 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3195 | obj.xid = reader.read("!L")[0] |
| 3196 | _experimenter = reader.read("!L")[0] |
| 3197 | assert(_experimenter == 6035143) |
| 3198 | _subtype = reader.read("!L")[0] |
| 3199 | assert(_subtype == 38) |
| 3200 | return obj |
| 3201 | |
| 3202 | def __eq__(self, other): |
| 3203 | if type(self) != type(other): return False |
| 3204 | if self.xid != other.xid: return False |
| 3205 | return True |
| 3206 | |
| 3207 | def pretty_print(self, q): |
| 3208 | q.text("bsn_flow_idle_enable_get_request {") |
| 3209 | with q.group(): |
| 3210 | with q.indent(2): |
| 3211 | q.breakable() |
| 3212 | q.text("xid = "); |
| 3213 | if self.xid != None: |
| 3214 | q.text("%#x" % self.xid) |
| 3215 | else: |
| 3216 | q.text('None') |
| 3217 | q.breakable() |
| 3218 | q.text('}') |
| 3219 | |
| 3220 | bsn_header.subtypes[38] = bsn_flow_idle_enable_get_request |
| 3221 | |
| 3222 | class bsn_flow_idle_enable_set_reply(bsn_header): |
| 3223 | version = 5 |
| 3224 | type = 4 |
| 3225 | experimenter = 6035143 |
| 3226 | subtype = 37 |
| 3227 | |
| 3228 | def __init__(self, xid=None, enable=None, status=None): |
| 3229 | if xid != None: |
| 3230 | self.xid = xid |
| 3231 | else: |
| 3232 | self.xid = None |
| 3233 | if enable != None: |
| 3234 | self.enable = enable |
| 3235 | else: |
| 3236 | self.enable = 0 |
| 3237 | if status != None: |
| 3238 | self.status = status |
| 3239 | else: |
| 3240 | self.status = 0 |
| 3241 | return |
| 3242 | |
| 3243 | def pack(self): |
| 3244 | packed = [] |
| 3245 | packed.append(struct.pack("!B", self.version)) |
| 3246 | packed.append(struct.pack("!B", self.type)) |
| 3247 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3248 | packed.append(struct.pack("!L", self.xid)) |
| 3249 | packed.append(struct.pack("!L", self.experimenter)) |
| 3250 | packed.append(struct.pack("!L", self.subtype)) |
| 3251 | packed.append(struct.pack("!L", self.enable)) |
| 3252 | packed.append(struct.pack("!L", self.status)) |
| 3253 | length = sum([len(x) for x in packed]) |
| 3254 | packed[2] = struct.pack("!H", length) |
| 3255 | return ''.join(packed) |
| 3256 | |
| 3257 | @staticmethod |
| 3258 | def unpack(reader): |
| 3259 | obj = bsn_flow_idle_enable_set_reply() |
| 3260 | _version = reader.read("!B")[0] |
| 3261 | assert(_version == 5) |
| 3262 | _type = reader.read("!B")[0] |
| 3263 | assert(_type == 4) |
| 3264 | _length = reader.read("!H")[0] |
| 3265 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3266 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3267 | obj.xid = reader.read("!L")[0] |
| 3268 | _experimenter = reader.read("!L")[0] |
| 3269 | assert(_experimenter == 6035143) |
| 3270 | _subtype = reader.read("!L")[0] |
| 3271 | assert(_subtype == 37) |
| 3272 | obj.enable = reader.read("!L")[0] |
| 3273 | obj.status = reader.read("!L")[0] |
| 3274 | return obj |
| 3275 | |
| 3276 | def __eq__(self, other): |
| 3277 | if type(self) != type(other): return False |
| 3278 | if self.xid != other.xid: return False |
| 3279 | if self.enable != other.enable: return False |
| 3280 | if self.status != other.status: return False |
| 3281 | return True |
| 3282 | |
| 3283 | def pretty_print(self, q): |
| 3284 | q.text("bsn_flow_idle_enable_set_reply {") |
| 3285 | with q.group(): |
| 3286 | with q.indent(2): |
| 3287 | q.breakable() |
| 3288 | q.text("xid = "); |
| 3289 | if self.xid != None: |
| 3290 | q.text("%#x" % self.xid) |
| 3291 | else: |
| 3292 | q.text('None') |
| 3293 | q.text(","); q.breakable() |
| 3294 | q.text("enable = "); |
| 3295 | q.text("%#x" % self.enable) |
| 3296 | q.text(","); q.breakable() |
| 3297 | q.text("status = "); |
| 3298 | q.text("%#x" % self.status) |
| 3299 | q.breakable() |
| 3300 | q.text('}') |
| 3301 | |
| 3302 | bsn_header.subtypes[37] = bsn_flow_idle_enable_set_reply |
| 3303 | |
| 3304 | class bsn_flow_idle_enable_set_request(bsn_header): |
| 3305 | version = 5 |
| 3306 | type = 4 |
| 3307 | experimenter = 6035143 |
| 3308 | subtype = 36 |
| 3309 | |
| 3310 | def __init__(self, xid=None, enable=None): |
| 3311 | if xid != None: |
| 3312 | self.xid = xid |
| 3313 | else: |
| 3314 | self.xid = None |
| 3315 | if enable != None: |
| 3316 | self.enable = enable |
| 3317 | else: |
| 3318 | self.enable = 0 |
| 3319 | return |
| 3320 | |
| 3321 | def pack(self): |
| 3322 | packed = [] |
| 3323 | packed.append(struct.pack("!B", self.version)) |
| 3324 | packed.append(struct.pack("!B", self.type)) |
| 3325 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3326 | packed.append(struct.pack("!L", self.xid)) |
| 3327 | packed.append(struct.pack("!L", self.experimenter)) |
| 3328 | packed.append(struct.pack("!L", self.subtype)) |
| 3329 | packed.append(struct.pack("!L", self.enable)) |
| 3330 | length = sum([len(x) for x in packed]) |
| 3331 | packed[2] = struct.pack("!H", length) |
| 3332 | return ''.join(packed) |
| 3333 | |
| 3334 | @staticmethod |
| 3335 | def unpack(reader): |
| 3336 | obj = bsn_flow_idle_enable_set_request() |
| 3337 | _version = reader.read("!B")[0] |
| 3338 | assert(_version == 5) |
| 3339 | _type = reader.read("!B")[0] |
| 3340 | assert(_type == 4) |
| 3341 | _length = reader.read("!H")[0] |
| 3342 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3343 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3344 | obj.xid = reader.read("!L")[0] |
| 3345 | _experimenter = reader.read("!L")[0] |
| 3346 | assert(_experimenter == 6035143) |
| 3347 | _subtype = reader.read("!L")[0] |
| 3348 | assert(_subtype == 36) |
| 3349 | obj.enable = reader.read("!L")[0] |
| 3350 | return obj |
| 3351 | |
| 3352 | def __eq__(self, other): |
| 3353 | if type(self) != type(other): return False |
| 3354 | if self.xid != other.xid: return False |
| 3355 | if self.enable != other.enable: return False |
| 3356 | return True |
| 3357 | |
| 3358 | def pretty_print(self, q): |
| 3359 | q.text("bsn_flow_idle_enable_set_request {") |
| 3360 | with q.group(): |
| 3361 | with q.indent(2): |
| 3362 | q.breakable() |
| 3363 | q.text("xid = "); |
| 3364 | if self.xid != None: |
| 3365 | q.text("%#x" % self.xid) |
| 3366 | else: |
| 3367 | q.text('None') |
| 3368 | q.text(","); q.breakable() |
| 3369 | q.text("enable = "); |
| 3370 | q.text("%#x" % self.enable) |
| 3371 | q.breakable() |
| 3372 | q.text('}') |
| 3373 | |
| 3374 | bsn_header.subtypes[36] = bsn_flow_idle_enable_set_request |
| 3375 | |
Rich Lane | 5116831 | 2015-06-25 13:13:54 -0700 | [diff] [blame] | 3376 | class bsn_generic_async(bsn_header): |
| 3377 | version = 5 |
| 3378 | type = 4 |
| 3379 | experimenter = 6035143 |
| 3380 | subtype = 68 |
| 3381 | |
| 3382 | def __init__(self, xid=None, name=None, tlvs=None): |
| 3383 | if xid != None: |
| 3384 | self.xid = xid |
| 3385 | else: |
| 3386 | self.xid = None |
| 3387 | if name != None: |
| 3388 | self.name = name |
| 3389 | else: |
| 3390 | self.name = "" |
| 3391 | if tlvs != None: |
| 3392 | self.tlvs = tlvs |
| 3393 | else: |
| 3394 | self.tlvs = [] |
| 3395 | return |
| 3396 | |
| 3397 | def pack(self): |
| 3398 | packed = [] |
| 3399 | packed.append(struct.pack("!B", self.version)) |
| 3400 | packed.append(struct.pack("!B", self.type)) |
| 3401 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3402 | packed.append(struct.pack("!L", self.xid)) |
| 3403 | packed.append(struct.pack("!L", self.experimenter)) |
| 3404 | packed.append(struct.pack("!L", self.subtype)) |
| 3405 | packed.append(struct.pack("!64s", self.name)) |
| 3406 | packed.append(loxi.generic_util.pack_list(self.tlvs)) |
| 3407 | length = sum([len(x) for x in packed]) |
| 3408 | packed[2] = struct.pack("!H", length) |
| 3409 | return ''.join(packed) |
| 3410 | |
| 3411 | @staticmethod |
| 3412 | def unpack(reader): |
| 3413 | obj = bsn_generic_async() |
| 3414 | _version = reader.read("!B")[0] |
| 3415 | assert(_version == 5) |
| 3416 | _type = reader.read("!B")[0] |
| 3417 | assert(_type == 4) |
| 3418 | _length = reader.read("!H")[0] |
| 3419 | orig_reader = reader |
| 3420 | reader = orig_reader.slice(_length, 4) |
| 3421 | obj.xid = reader.read("!L")[0] |
| 3422 | _experimenter = reader.read("!L")[0] |
| 3423 | assert(_experimenter == 6035143) |
| 3424 | _subtype = reader.read("!L")[0] |
| 3425 | assert(_subtype == 68) |
| 3426 | obj.name = reader.read("!64s")[0].rstrip("\x00") |
| 3427 | obj.tlvs = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack) |
| 3428 | return obj |
| 3429 | |
| 3430 | def __eq__(self, other): |
| 3431 | if type(self) != type(other): return False |
| 3432 | if self.xid != other.xid: return False |
| 3433 | if self.name != other.name: return False |
| 3434 | if self.tlvs != other.tlvs: return False |
| 3435 | return True |
| 3436 | |
| 3437 | def pretty_print(self, q): |
| 3438 | q.text("bsn_generic_async {") |
| 3439 | with q.group(): |
| 3440 | with q.indent(2): |
| 3441 | q.breakable() |
| 3442 | q.text("xid = "); |
| 3443 | if self.xid != None: |
| 3444 | q.text("%#x" % self.xid) |
| 3445 | else: |
| 3446 | q.text('None') |
| 3447 | q.text(","); q.breakable() |
| 3448 | q.text("name = "); |
| 3449 | q.pp(self.name) |
| 3450 | q.text(","); q.breakable() |
| 3451 | q.text("tlvs = "); |
| 3452 | q.pp(self.tlvs) |
| 3453 | q.breakable() |
| 3454 | q.text('}') |
| 3455 | |
| 3456 | bsn_header.subtypes[68] = bsn_generic_async |
| 3457 | |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3458 | class bsn_generic_stats_reply(bsn_stats_reply): |
| 3459 | version = 5 |
| 3460 | type = 19 |
| 3461 | stats_type = 65535 |
| 3462 | experimenter = 6035143 |
| 3463 | subtype = 16 |
| 3464 | |
| 3465 | def __init__(self, xid=None, flags=None, entries=None): |
| 3466 | if xid != None: |
| 3467 | self.xid = xid |
| 3468 | else: |
| 3469 | self.xid = None |
| 3470 | if flags != None: |
| 3471 | self.flags = flags |
| 3472 | else: |
| 3473 | self.flags = 0 |
| 3474 | if entries != None: |
| 3475 | self.entries = entries |
| 3476 | else: |
| 3477 | self.entries = [] |
| 3478 | return |
| 3479 | |
| 3480 | def pack(self): |
| 3481 | packed = [] |
| 3482 | packed.append(struct.pack("!B", self.version)) |
| 3483 | packed.append(struct.pack("!B", self.type)) |
| 3484 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3485 | packed.append(struct.pack("!L", self.xid)) |
| 3486 | packed.append(struct.pack("!H", self.stats_type)) |
| 3487 | packed.append(struct.pack("!H", self.flags)) |
| 3488 | packed.append('\x00' * 4) |
| 3489 | packed.append(struct.pack("!L", self.experimenter)) |
| 3490 | packed.append(struct.pack("!L", self.subtype)) |
| 3491 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 3492 | length = sum([len(x) for x in packed]) |
| 3493 | packed[2] = struct.pack("!H", length) |
| 3494 | return ''.join(packed) |
| 3495 | |
| 3496 | @staticmethod |
| 3497 | def unpack(reader): |
| 3498 | obj = bsn_generic_stats_reply() |
| 3499 | _version = reader.read("!B")[0] |
| 3500 | assert(_version == 5) |
| 3501 | _type = reader.read("!B")[0] |
| 3502 | assert(_type == 19) |
| 3503 | _length = reader.read("!H")[0] |
| 3504 | orig_reader = reader |
| 3505 | reader = orig_reader.slice(_length, 4) |
| 3506 | obj.xid = reader.read("!L")[0] |
| 3507 | _stats_type = reader.read("!H")[0] |
| 3508 | assert(_stats_type == 65535) |
| 3509 | obj.flags = reader.read("!H")[0] |
| 3510 | reader.skip(4) |
| 3511 | _experimenter = reader.read("!L")[0] |
| 3512 | assert(_experimenter == 6035143) |
| 3513 | _subtype = reader.read("!L")[0] |
| 3514 | assert(_subtype == 16) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 3515 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_generic_stats_entry.unpack) |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3516 | return obj |
| 3517 | |
| 3518 | def __eq__(self, other): |
| 3519 | if type(self) != type(other): return False |
| 3520 | if self.xid != other.xid: return False |
| 3521 | if self.flags != other.flags: return False |
| 3522 | if self.entries != other.entries: return False |
| 3523 | return True |
| 3524 | |
| 3525 | def pretty_print(self, q): |
| 3526 | q.text("bsn_generic_stats_reply {") |
| 3527 | with q.group(): |
| 3528 | with q.indent(2): |
| 3529 | q.breakable() |
| 3530 | q.text("xid = "); |
| 3531 | if self.xid != None: |
| 3532 | q.text("%#x" % self.xid) |
| 3533 | else: |
| 3534 | q.text('None') |
| 3535 | q.text(","); q.breakable() |
| 3536 | q.text("flags = "); |
| 3537 | q.text("%#x" % self.flags) |
| 3538 | q.text(","); q.breakable() |
| 3539 | q.text("entries = "); |
| 3540 | q.pp(self.entries) |
| 3541 | q.breakable() |
| 3542 | q.text('}') |
| 3543 | |
| 3544 | bsn_stats_reply.subtypes[16] = bsn_generic_stats_reply |
| 3545 | |
| 3546 | class bsn_generic_stats_request(bsn_stats_request): |
| 3547 | version = 5 |
| 3548 | type = 18 |
| 3549 | stats_type = 65535 |
| 3550 | experimenter = 6035143 |
| 3551 | subtype = 16 |
| 3552 | |
| 3553 | def __init__(self, xid=None, flags=None, name=None, tlvs=None): |
| 3554 | if xid != None: |
| 3555 | self.xid = xid |
| 3556 | else: |
| 3557 | self.xid = None |
| 3558 | if flags != None: |
| 3559 | self.flags = flags |
| 3560 | else: |
| 3561 | self.flags = 0 |
| 3562 | if name != None: |
| 3563 | self.name = name |
| 3564 | else: |
| 3565 | self.name = "" |
| 3566 | if tlvs != None: |
| 3567 | self.tlvs = tlvs |
| 3568 | else: |
| 3569 | self.tlvs = [] |
| 3570 | return |
| 3571 | |
| 3572 | def pack(self): |
| 3573 | packed = [] |
| 3574 | packed.append(struct.pack("!B", self.version)) |
| 3575 | packed.append(struct.pack("!B", self.type)) |
| 3576 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3577 | packed.append(struct.pack("!L", self.xid)) |
| 3578 | packed.append(struct.pack("!H", self.stats_type)) |
| 3579 | packed.append(struct.pack("!H", self.flags)) |
| 3580 | packed.append('\x00' * 4) |
| 3581 | packed.append(struct.pack("!L", self.experimenter)) |
| 3582 | packed.append(struct.pack("!L", self.subtype)) |
| 3583 | packed.append(struct.pack("!64s", self.name)) |
| 3584 | packed.append(loxi.generic_util.pack_list(self.tlvs)) |
| 3585 | length = sum([len(x) for x in packed]) |
| 3586 | packed[2] = struct.pack("!H", length) |
| 3587 | return ''.join(packed) |
| 3588 | |
| 3589 | @staticmethod |
| 3590 | def unpack(reader): |
| 3591 | obj = bsn_generic_stats_request() |
| 3592 | _version = reader.read("!B")[0] |
| 3593 | assert(_version == 5) |
| 3594 | _type = reader.read("!B")[0] |
| 3595 | assert(_type == 18) |
| 3596 | _length = reader.read("!H")[0] |
| 3597 | orig_reader = reader |
| 3598 | reader = orig_reader.slice(_length, 4) |
| 3599 | obj.xid = reader.read("!L")[0] |
| 3600 | _stats_type = reader.read("!H")[0] |
| 3601 | assert(_stats_type == 65535) |
| 3602 | obj.flags = reader.read("!H")[0] |
| 3603 | reader.skip(4) |
| 3604 | _experimenter = reader.read("!L")[0] |
| 3605 | assert(_experimenter == 6035143) |
| 3606 | _subtype = reader.read("!L")[0] |
| 3607 | assert(_subtype == 16) |
| 3608 | obj.name = reader.read("!64s")[0].rstrip("\x00") |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 3609 | obj.tlvs = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack) |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3610 | return obj |
| 3611 | |
| 3612 | def __eq__(self, other): |
| 3613 | if type(self) != type(other): return False |
| 3614 | if self.xid != other.xid: return False |
| 3615 | if self.flags != other.flags: return False |
| 3616 | if self.name != other.name: return False |
| 3617 | if self.tlvs != other.tlvs: return False |
| 3618 | return True |
| 3619 | |
| 3620 | def pretty_print(self, q): |
| 3621 | q.text("bsn_generic_stats_request {") |
| 3622 | with q.group(): |
| 3623 | with q.indent(2): |
| 3624 | q.breakable() |
| 3625 | q.text("xid = "); |
| 3626 | if self.xid != None: |
| 3627 | q.text("%#x" % self.xid) |
| 3628 | else: |
| 3629 | q.text('None') |
| 3630 | q.text(","); q.breakable() |
| 3631 | q.text("flags = "); |
| 3632 | q.text("%#x" % self.flags) |
| 3633 | q.text(","); q.breakable() |
| 3634 | q.text("name = "); |
| 3635 | q.pp(self.name) |
| 3636 | q.text(","); q.breakable() |
| 3637 | q.text("tlvs = "); |
| 3638 | q.pp(self.tlvs) |
| 3639 | q.breakable() |
| 3640 | q.text('}') |
| 3641 | |
| 3642 | bsn_stats_request.subtypes[16] = bsn_generic_stats_request |
| 3643 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3644 | class bsn_gentable_bucket_stats_reply(bsn_stats_reply): |
| 3645 | version = 5 |
| 3646 | type = 19 |
| 3647 | stats_type = 65535 |
| 3648 | experimenter = 6035143 |
| 3649 | subtype = 5 |
| 3650 | |
| 3651 | def __init__(self, xid=None, flags=None, entries=None): |
| 3652 | if xid != None: |
| 3653 | self.xid = xid |
| 3654 | else: |
| 3655 | self.xid = None |
| 3656 | if flags != None: |
| 3657 | self.flags = flags |
| 3658 | else: |
| 3659 | self.flags = 0 |
| 3660 | if entries != None: |
| 3661 | self.entries = entries |
| 3662 | else: |
| 3663 | self.entries = [] |
| 3664 | return |
| 3665 | |
| 3666 | def pack(self): |
| 3667 | packed = [] |
| 3668 | packed.append(struct.pack("!B", self.version)) |
| 3669 | packed.append(struct.pack("!B", self.type)) |
| 3670 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3671 | packed.append(struct.pack("!L", self.xid)) |
| 3672 | packed.append(struct.pack("!H", self.stats_type)) |
| 3673 | packed.append(struct.pack("!H", self.flags)) |
| 3674 | packed.append('\x00' * 4) |
| 3675 | packed.append(struct.pack("!L", self.experimenter)) |
| 3676 | packed.append(struct.pack("!L", self.subtype)) |
| 3677 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 3678 | length = sum([len(x) for x in packed]) |
| 3679 | packed[2] = struct.pack("!H", length) |
| 3680 | return ''.join(packed) |
| 3681 | |
| 3682 | @staticmethod |
| 3683 | def unpack(reader): |
| 3684 | obj = bsn_gentable_bucket_stats_reply() |
| 3685 | _version = reader.read("!B")[0] |
| 3686 | assert(_version == 5) |
| 3687 | _type = reader.read("!B")[0] |
| 3688 | assert(_type == 19) |
| 3689 | _length = reader.read("!H")[0] |
| 3690 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3691 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3692 | obj.xid = reader.read("!L")[0] |
| 3693 | _stats_type = reader.read("!H")[0] |
| 3694 | assert(_stats_type == 65535) |
| 3695 | obj.flags = reader.read("!H")[0] |
| 3696 | reader.skip(4) |
| 3697 | _experimenter = reader.read("!L")[0] |
| 3698 | assert(_experimenter == 6035143) |
| 3699 | _subtype = reader.read("!L")[0] |
| 3700 | assert(_subtype == 5) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 3701 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_bucket_stats_entry.unpack) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3702 | return obj |
| 3703 | |
| 3704 | def __eq__(self, other): |
| 3705 | if type(self) != type(other): return False |
| 3706 | if self.xid != other.xid: return False |
| 3707 | if self.flags != other.flags: return False |
| 3708 | if self.entries != other.entries: return False |
| 3709 | return True |
| 3710 | |
| 3711 | def pretty_print(self, q): |
| 3712 | q.text("bsn_gentable_bucket_stats_reply {") |
| 3713 | with q.group(): |
| 3714 | with q.indent(2): |
| 3715 | q.breakable() |
| 3716 | q.text("xid = "); |
| 3717 | if self.xid != None: |
| 3718 | q.text("%#x" % self.xid) |
| 3719 | else: |
| 3720 | q.text('None') |
| 3721 | q.text(","); q.breakable() |
| 3722 | q.text("flags = "); |
| 3723 | q.text("%#x" % self.flags) |
| 3724 | q.text(","); q.breakable() |
| 3725 | q.text("entries = "); |
| 3726 | q.pp(self.entries) |
| 3727 | q.breakable() |
| 3728 | q.text('}') |
| 3729 | |
| 3730 | bsn_stats_reply.subtypes[5] = bsn_gentable_bucket_stats_reply |
| 3731 | |
| 3732 | class bsn_gentable_bucket_stats_request(bsn_stats_request): |
| 3733 | version = 5 |
| 3734 | type = 18 |
| 3735 | stats_type = 65535 |
| 3736 | experimenter = 6035143 |
| 3737 | subtype = 5 |
| 3738 | |
| 3739 | def __init__(self, xid=None, flags=None, table_id=None): |
| 3740 | if xid != None: |
| 3741 | self.xid = xid |
| 3742 | else: |
| 3743 | self.xid = None |
| 3744 | if flags != None: |
| 3745 | self.flags = flags |
| 3746 | else: |
| 3747 | self.flags = 0 |
| 3748 | if table_id != None: |
| 3749 | self.table_id = table_id |
| 3750 | else: |
| 3751 | self.table_id = 0 |
| 3752 | return |
| 3753 | |
| 3754 | def pack(self): |
| 3755 | packed = [] |
| 3756 | packed.append(struct.pack("!B", self.version)) |
| 3757 | packed.append(struct.pack("!B", self.type)) |
| 3758 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3759 | packed.append(struct.pack("!L", self.xid)) |
| 3760 | packed.append(struct.pack("!H", self.stats_type)) |
| 3761 | packed.append(struct.pack("!H", self.flags)) |
| 3762 | packed.append('\x00' * 4) |
| 3763 | packed.append(struct.pack("!L", self.experimenter)) |
| 3764 | packed.append(struct.pack("!L", self.subtype)) |
| 3765 | packed.append(struct.pack("!H", self.table_id)) |
| 3766 | length = sum([len(x) for x in packed]) |
| 3767 | packed[2] = struct.pack("!H", length) |
| 3768 | return ''.join(packed) |
| 3769 | |
| 3770 | @staticmethod |
| 3771 | def unpack(reader): |
| 3772 | obj = bsn_gentable_bucket_stats_request() |
| 3773 | _version = reader.read("!B")[0] |
| 3774 | assert(_version == 5) |
| 3775 | _type = reader.read("!B")[0] |
| 3776 | assert(_type == 18) |
| 3777 | _length = reader.read("!H")[0] |
| 3778 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3779 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3780 | obj.xid = reader.read("!L")[0] |
| 3781 | _stats_type = reader.read("!H")[0] |
| 3782 | assert(_stats_type == 65535) |
| 3783 | obj.flags = reader.read("!H")[0] |
| 3784 | reader.skip(4) |
| 3785 | _experimenter = reader.read("!L")[0] |
| 3786 | assert(_experimenter == 6035143) |
| 3787 | _subtype = reader.read("!L")[0] |
| 3788 | assert(_subtype == 5) |
| 3789 | obj.table_id = reader.read("!H")[0] |
| 3790 | return obj |
| 3791 | |
| 3792 | def __eq__(self, other): |
| 3793 | if type(self) != type(other): return False |
| 3794 | if self.xid != other.xid: return False |
| 3795 | if self.flags != other.flags: return False |
| 3796 | if self.table_id != other.table_id: return False |
| 3797 | return True |
| 3798 | |
| 3799 | def pretty_print(self, q): |
| 3800 | q.text("bsn_gentable_bucket_stats_request {") |
| 3801 | with q.group(): |
| 3802 | with q.indent(2): |
| 3803 | q.breakable() |
| 3804 | q.text("xid = "); |
| 3805 | if self.xid != None: |
| 3806 | q.text("%#x" % self.xid) |
| 3807 | else: |
| 3808 | q.text('None') |
| 3809 | q.text(","); q.breakable() |
| 3810 | q.text("flags = "); |
| 3811 | q.text("%#x" % self.flags) |
| 3812 | q.text(","); q.breakable() |
| 3813 | q.text("table_id = "); |
| 3814 | q.text("%#x" % self.table_id) |
| 3815 | q.breakable() |
| 3816 | q.text('}') |
| 3817 | |
| 3818 | bsn_stats_request.subtypes[5] = bsn_gentable_bucket_stats_request |
| 3819 | |
| 3820 | class bsn_gentable_clear_reply(bsn_header): |
| 3821 | version = 5 |
| 3822 | type = 4 |
| 3823 | experimenter = 6035143 |
| 3824 | subtype = 49 |
| 3825 | |
| 3826 | def __init__(self, xid=None, table_id=None, deleted_count=None, error_count=None): |
| 3827 | if xid != None: |
| 3828 | self.xid = xid |
| 3829 | else: |
| 3830 | self.xid = None |
| 3831 | if table_id != None: |
| 3832 | self.table_id = table_id |
| 3833 | else: |
| 3834 | self.table_id = 0 |
| 3835 | if deleted_count != None: |
| 3836 | self.deleted_count = deleted_count |
| 3837 | else: |
| 3838 | self.deleted_count = 0 |
| 3839 | if error_count != None: |
| 3840 | self.error_count = error_count |
| 3841 | else: |
| 3842 | self.error_count = 0 |
| 3843 | return |
| 3844 | |
| 3845 | def pack(self): |
| 3846 | packed = [] |
| 3847 | packed.append(struct.pack("!B", self.version)) |
| 3848 | packed.append(struct.pack("!B", self.type)) |
| 3849 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3850 | packed.append(struct.pack("!L", self.xid)) |
| 3851 | packed.append(struct.pack("!L", self.experimenter)) |
| 3852 | packed.append(struct.pack("!L", self.subtype)) |
| 3853 | packed.append(struct.pack("!H", self.table_id)) |
| 3854 | packed.append('\x00' * 2) |
| 3855 | packed.append(struct.pack("!L", self.deleted_count)) |
| 3856 | packed.append(struct.pack("!L", self.error_count)) |
| 3857 | length = sum([len(x) for x in packed]) |
| 3858 | packed[2] = struct.pack("!H", length) |
| 3859 | return ''.join(packed) |
| 3860 | |
| 3861 | @staticmethod |
| 3862 | def unpack(reader): |
| 3863 | obj = bsn_gentable_clear_reply() |
| 3864 | _version = reader.read("!B")[0] |
| 3865 | assert(_version == 5) |
| 3866 | _type = reader.read("!B")[0] |
| 3867 | assert(_type == 4) |
| 3868 | _length = reader.read("!H")[0] |
| 3869 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3870 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3871 | obj.xid = reader.read("!L")[0] |
| 3872 | _experimenter = reader.read("!L")[0] |
| 3873 | assert(_experimenter == 6035143) |
| 3874 | _subtype = reader.read("!L")[0] |
| 3875 | assert(_subtype == 49) |
| 3876 | obj.table_id = reader.read("!H")[0] |
| 3877 | reader.skip(2) |
| 3878 | obj.deleted_count = reader.read("!L")[0] |
| 3879 | obj.error_count = reader.read("!L")[0] |
| 3880 | return obj |
| 3881 | |
| 3882 | def __eq__(self, other): |
| 3883 | if type(self) != type(other): return False |
| 3884 | if self.xid != other.xid: return False |
| 3885 | if self.table_id != other.table_id: return False |
| 3886 | if self.deleted_count != other.deleted_count: return False |
| 3887 | if self.error_count != other.error_count: return False |
| 3888 | return True |
| 3889 | |
| 3890 | def pretty_print(self, q): |
| 3891 | q.text("bsn_gentable_clear_reply {") |
| 3892 | with q.group(): |
| 3893 | with q.indent(2): |
| 3894 | q.breakable() |
| 3895 | q.text("xid = "); |
| 3896 | if self.xid != None: |
| 3897 | q.text("%#x" % self.xid) |
| 3898 | else: |
| 3899 | q.text('None') |
| 3900 | q.text(","); q.breakable() |
| 3901 | q.text("table_id = "); |
| 3902 | q.text("%#x" % self.table_id) |
| 3903 | q.text(","); q.breakable() |
| 3904 | q.text("deleted_count = "); |
| 3905 | q.text("%#x" % self.deleted_count) |
| 3906 | q.text(","); q.breakable() |
| 3907 | q.text("error_count = "); |
| 3908 | q.text("%#x" % self.error_count) |
| 3909 | q.breakable() |
| 3910 | q.text('}') |
| 3911 | |
| 3912 | bsn_header.subtypes[49] = bsn_gentable_clear_reply |
| 3913 | |
| 3914 | class bsn_gentable_clear_request(bsn_header): |
| 3915 | version = 5 |
| 3916 | type = 4 |
| 3917 | experimenter = 6035143 |
| 3918 | subtype = 48 |
| 3919 | |
| 3920 | def __init__(self, xid=None, table_id=None, checksum=None, checksum_mask=None): |
| 3921 | if xid != None: |
| 3922 | self.xid = xid |
| 3923 | else: |
| 3924 | self.xid = None |
| 3925 | if table_id != None: |
| 3926 | self.table_id = table_id |
| 3927 | else: |
| 3928 | self.table_id = 0 |
| 3929 | if checksum != None: |
| 3930 | self.checksum = checksum |
| 3931 | else: |
| 3932 | self.checksum = 0 |
| 3933 | if checksum_mask != None: |
| 3934 | self.checksum_mask = checksum_mask |
| 3935 | else: |
| 3936 | self.checksum_mask = 0 |
| 3937 | return |
| 3938 | |
| 3939 | def pack(self): |
| 3940 | packed = [] |
| 3941 | packed.append(struct.pack("!B", self.version)) |
| 3942 | packed.append(struct.pack("!B", self.type)) |
| 3943 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3944 | packed.append(struct.pack("!L", self.xid)) |
| 3945 | packed.append(struct.pack("!L", self.experimenter)) |
| 3946 | packed.append(struct.pack("!L", self.subtype)) |
| 3947 | packed.append(struct.pack("!H", self.table_id)) |
| 3948 | packed.append('\x00' * 2) |
| 3949 | packed.append(util.pack_checksum_128(self.checksum)) |
| 3950 | packed.append(util.pack_checksum_128(self.checksum_mask)) |
| 3951 | length = sum([len(x) for x in packed]) |
| 3952 | packed[2] = struct.pack("!H", length) |
| 3953 | return ''.join(packed) |
| 3954 | |
| 3955 | @staticmethod |
| 3956 | def unpack(reader): |
| 3957 | obj = bsn_gentable_clear_request() |
| 3958 | _version = reader.read("!B")[0] |
| 3959 | assert(_version == 5) |
| 3960 | _type = reader.read("!B")[0] |
| 3961 | assert(_type == 4) |
| 3962 | _length = reader.read("!H")[0] |
| 3963 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3964 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 3965 | obj.xid = reader.read("!L")[0] |
| 3966 | _experimenter = reader.read("!L")[0] |
| 3967 | assert(_experimenter == 6035143) |
| 3968 | _subtype = reader.read("!L")[0] |
| 3969 | assert(_subtype == 48) |
| 3970 | obj.table_id = reader.read("!H")[0] |
| 3971 | reader.skip(2) |
| 3972 | obj.checksum = util.unpack_checksum_128(reader) |
| 3973 | obj.checksum_mask = util.unpack_checksum_128(reader) |
| 3974 | return obj |
| 3975 | |
| 3976 | def __eq__(self, other): |
| 3977 | if type(self) != type(other): return False |
| 3978 | if self.xid != other.xid: return False |
| 3979 | if self.table_id != other.table_id: return False |
| 3980 | if self.checksum != other.checksum: return False |
| 3981 | if self.checksum_mask != other.checksum_mask: return False |
| 3982 | return True |
| 3983 | |
| 3984 | def pretty_print(self, q): |
| 3985 | q.text("bsn_gentable_clear_request {") |
| 3986 | with q.group(): |
| 3987 | with q.indent(2): |
| 3988 | q.breakable() |
| 3989 | q.text("xid = "); |
| 3990 | if self.xid != None: |
| 3991 | q.text("%#x" % self.xid) |
| 3992 | else: |
| 3993 | q.text('None') |
| 3994 | q.text(","); q.breakable() |
| 3995 | q.text("table_id = "); |
| 3996 | q.text("%#x" % self.table_id) |
| 3997 | q.text(","); q.breakable() |
| 3998 | q.text("checksum = "); |
| 3999 | q.pp(self.checksum) |
| 4000 | q.text(","); q.breakable() |
| 4001 | q.text("checksum_mask = "); |
| 4002 | q.pp(self.checksum_mask) |
| 4003 | q.breakable() |
| 4004 | q.text('}') |
| 4005 | |
| 4006 | bsn_header.subtypes[48] = bsn_gentable_clear_request |
| 4007 | |
| 4008 | class bsn_gentable_desc_stats_reply(bsn_stats_reply): |
| 4009 | version = 5 |
| 4010 | type = 19 |
| 4011 | stats_type = 65535 |
| 4012 | experimenter = 6035143 |
| 4013 | subtype = 4 |
| 4014 | |
| 4015 | def __init__(self, xid=None, flags=None, entries=None): |
| 4016 | if xid != None: |
| 4017 | self.xid = xid |
| 4018 | else: |
| 4019 | self.xid = None |
| 4020 | if flags != None: |
| 4021 | self.flags = flags |
| 4022 | else: |
| 4023 | self.flags = 0 |
| 4024 | if entries != None: |
| 4025 | self.entries = entries |
| 4026 | else: |
| 4027 | self.entries = [] |
| 4028 | return |
| 4029 | |
| 4030 | def pack(self): |
| 4031 | packed = [] |
| 4032 | packed.append(struct.pack("!B", self.version)) |
| 4033 | packed.append(struct.pack("!B", self.type)) |
| 4034 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4035 | packed.append(struct.pack("!L", self.xid)) |
| 4036 | packed.append(struct.pack("!H", self.stats_type)) |
| 4037 | packed.append(struct.pack("!H", self.flags)) |
| 4038 | packed.append('\x00' * 4) |
| 4039 | packed.append(struct.pack("!L", self.experimenter)) |
| 4040 | packed.append(struct.pack("!L", self.subtype)) |
| 4041 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 4042 | length = sum([len(x) for x in packed]) |
| 4043 | packed[2] = struct.pack("!H", length) |
| 4044 | return ''.join(packed) |
| 4045 | |
| 4046 | @staticmethod |
| 4047 | def unpack(reader): |
| 4048 | obj = bsn_gentable_desc_stats_reply() |
| 4049 | _version = reader.read("!B")[0] |
| 4050 | assert(_version == 5) |
| 4051 | _type = reader.read("!B")[0] |
| 4052 | assert(_type == 19) |
| 4053 | _length = reader.read("!H")[0] |
| 4054 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4055 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 4056 | obj.xid = reader.read("!L")[0] |
| 4057 | _stats_type = reader.read("!H")[0] |
| 4058 | assert(_stats_type == 65535) |
| 4059 | obj.flags = reader.read("!H")[0] |
| 4060 | reader.skip(4) |
| 4061 | _experimenter = reader.read("!L")[0] |
| 4062 | assert(_experimenter == 6035143) |
| 4063 | _subtype = reader.read("!L")[0] |
| 4064 | assert(_subtype == 4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4065 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_desc_stats_entry.unpack) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 4066 | return obj |
| 4067 | |
| 4068 | def __eq__(self, other): |
| 4069 | if type(self) != type(other): return False |
| 4070 | if self.xid != other.xid: return False |
| 4071 | if self.flags != other.flags: return False |
| 4072 | if self.entries != other.entries: return False |
| 4073 | return True |
| 4074 | |
| 4075 | def pretty_print(self, q): |
| 4076 | q.text("bsn_gentable_desc_stats_reply {") |
| 4077 | with q.group(): |
| 4078 | with q.indent(2): |
| 4079 | q.breakable() |
| 4080 | q.text("xid = "); |
| 4081 | if self.xid != None: |
| 4082 | q.text("%#x" % self.xid) |
| 4083 | else: |
| 4084 | q.text('None') |
| 4085 | q.text(","); q.breakable() |
| 4086 | q.text("flags = "); |
| 4087 | q.text("%#x" % self.flags) |
| 4088 | q.text(","); q.breakable() |
| 4089 | q.text("entries = "); |
| 4090 | q.pp(self.entries) |
| 4091 | q.breakable() |
| 4092 | q.text('}') |
| 4093 | |
| 4094 | bsn_stats_reply.subtypes[4] = bsn_gentable_desc_stats_reply |
| 4095 | |
| 4096 | class bsn_gentable_desc_stats_request(bsn_stats_request): |
| 4097 | version = 5 |
| 4098 | type = 18 |
| 4099 | stats_type = 65535 |
| 4100 | experimenter = 6035143 |
| 4101 | subtype = 4 |
| 4102 | |
| 4103 | def __init__(self, xid=None, flags=None): |
| 4104 | if xid != None: |
| 4105 | self.xid = xid |
| 4106 | else: |
| 4107 | self.xid = None |
| 4108 | if flags != None: |
| 4109 | self.flags = flags |
| 4110 | else: |
| 4111 | self.flags = 0 |
| 4112 | return |
| 4113 | |
| 4114 | def pack(self): |
| 4115 | packed = [] |
| 4116 | packed.append(struct.pack("!B", self.version)) |
| 4117 | packed.append(struct.pack("!B", self.type)) |
| 4118 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4119 | packed.append(struct.pack("!L", self.xid)) |
| 4120 | packed.append(struct.pack("!H", self.stats_type)) |
| 4121 | packed.append(struct.pack("!H", self.flags)) |
| 4122 | packed.append('\x00' * 4) |
| 4123 | packed.append(struct.pack("!L", self.experimenter)) |
| 4124 | packed.append(struct.pack("!L", self.subtype)) |
| 4125 | length = sum([len(x) for x in packed]) |
| 4126 | packed[2] = struct.pack("!H", length) |
| 4127 | return ''.join(packed) |
| 4128 | |
| 4129 | @staticmethod |
| 4130 | def unpack(reader): |
| 4131 | obj = bsn_gentable_desc_stats_request() |
| 4132 | _version = reader.read("!B")[0] |
| 4133 | assert(_version == 5) |
| 4134 | _type = reader.read("!B")[0] |
| 4135 | assert(_type == 18) |
| 4136 | _length = reader.read("!H")[0] |
| 4137 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4138 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 4139 | obj.xid = reader.read("!L")[0] |
| 4140 | _stats_type = reader.read("!H")[0] |
| 4141 | assert(_stats_type == 65535) |
| 4142 | obj.flags = reader.read("!H")[0] |
| 4143 | reader.skip(4) |
| 4144 | _experimenter = reader.read("!L")[0] |
| 4145 | assert(_experimenter == 6035143) |
| 4146 | _subtype = reader.read("!L")[0] |
| 4147 | assert(_subtype == 4) |
| 4148 | return obj |
| 4149 | |
| 4150 | def __eq__(self, other): |
| 4151 | if type(self) != type(other): return False |
| 4152 | if self.xid != other.xid: return False |
| 4153 | if self.flags != other.flags: return False |
| 4154 | return True |
| 4155 | |
| 4156 | def pretty_print(self, q): |
| 4157 | q.text("bsn_gentable_desc_stats_request {") |
| 4158 | with q.group(): |
| 4159 | with q.indent(2): |
| 4160 | q.breakable() |
| 4161 | q.text("xid = "); |
| 4162 | if self.xid != None: |
| 4163 | q.text("%#x" % self.xid) |
| 4164 | else: |
| 4165 | q.text('None') |
| 4166 | q.text(","); q.breakable() |
| 4167 | q.text("flags = "); |
| 4168 | q.text("%#x" % self.flags) |
| 4169 | q.breakable() |
| 4170 | q.text('}') |
| 4171 | |
| 4172 | bsn_stats_request.subtypes[4] = bsn_gentable_desc_stats_request |
| 4173 | |
| 4174 | class bsn_gentable_entry_add(bsn_header): |
| 4175 | version = 5 |
| 4176 | type = 4 |
| 4177 | experimenter = 6035143 |
| 4178 | subtype = 46 |
| 4179 | |
| 4180 | def __init__(self, xid=None, table_id=None, checksum=None, key=None, value=None): |
| 4181 | if xid != None: |
| 4182 | self.xid = xid |
| 4183 | else: |
| 4184 | self.xid = None |
| 4185 | if table_id != None: |
| 4186 | self.table_id = table_id |
| 4187 | else: |
| 4188 | self.table_id = 0 |
| 4189 | if checksum != None: |
| 4190 | self.checksum = checksum |
| 4191 | else: |
| 4192 | self.checksum = 0 |
| 4193 | if key != None: |
| 4194 | self.key = key |
| 4195 | else: |
| 4196 | self.key = [] |
| 4197 | if value != None: |
| 4198 | self.value = value |
| 4199 | else: |
| 4200 | self.value = [] |
| 4201 | return |
| 4202 | |
| 4203 | def pack(self): |
| 4204 | packed = [] |
| 4205 | packed.append(struct.pack("!B", self.version)) |
| 4206 | packed.append(struct.pack("!B", self.type)) |
| 4207 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4208 | packed.append(struct.pack("!L", self.xid)) |
| 4209 | packed.append(struct.pack("!L", self.experimenter)) |
| 4210 | packed.append(struct.pack("!L", self.subtype)) |
| 4211 | packed.append(struct.pack("!H", self.table_id)) |
| 4212 | packed.append(struct.pack("!H", 0)) # placeholder for key_length at index 7 |
| 4213 | packed.append(util.pack_checksum_128(self.checksum)) |
| 4214 | packed.append(loxi.generic_util.pack_list(self.key)) |
| 4215 | packed[7] = struct.pack("!H", len(packed[-1])) |
| 4216 | packed.append(loxi.generic_util.pack_list(self.value)) |
| 4217 | length = sum([len(x) for x in packed]) |
| 4218 | packed[2] = struct.pack("!H", length) |
| 4219 | return ''.join(packed) |
| 4220 | |
| 4221 | @staticmethod |
| 4222 | def unpack(reader): |
| 4223 | obj = bsn_gentable_entry_add() |
| 4224 | _version = reader.read("!B")[0] |
| 4225 | assert(_version == 5) |
| 4226 | _type = reader.read("!B")[0] |
| 4227 | assert(_type == 4) |
| 4228 | _length = reader.read("!H")[0] |
| 4229 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4230 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 4231 | obj.xid = reader.read("!L")[0] |
| 4232 | _experimenter = reader.read("!L")[0] |
| 4233 | assert(_experimenter == 6035143) |
| 4234 | _subtype = reader.read("!L")[0] |
| 4235 | assert(_subtype == 46) |
| 4236 | obj.table_id = reader.read("!H")[0] |
| 4237 | _key_length = reader.read("!H")[0] |
| 4238 | obj.checksum = util.unpack_checksum_128(reader) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4239 | obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), ofp.bsn_tlv.bsn_tlv.unpack) |
| 4240 | obj.value = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 4241 | return obj |
| 4242 | |
| 4243 | def __eq__(self, other): |
| 4244 | if type(self) != type(other): return False |
| 4245 | if self.xid != other.xid: return False |
| 4246 | if self.table_id != other.table_id: return False |
| 4247 | if self.checksum != other.checksum: return False |
| 4248 | if self.key != other.key: return False |
| 4249 | if self.value != other.value: return False |
| 4250 | return True |
| 4251 | |
| 4252 | def pretty_print(self, q): |
| 4253 | q.text("bsn_gentable_entry_add {") |
| 4254 | with q.group(): |
| 4255 | with q.indent(2): |
| 4256 | q.breakable() |
| 4257 | q.text("xid = "); |
| 4258 | if self.xid != None: |
| 4259 | q.text("%#x" % self.xid) |
| 4260 | else: |
| 4261 | q.text('None') |
| 4262 | q.text(","); q.breakable() |
| 4263 | q.text("table_id = "); |
| 4264 | q.text("%#x" % self.table_id) |
| 4265 | q.text(","); q.breakable() |
| 4266 | q.text("checksum = "); |
| 4267 | q.pp(self.checksum) |
| 4268 | q.text(","); q.breakable() |
| 4269 | q.text("key = "); |
| 4270 | q.pp(self.key) |
| 4271 | q.text(","); q.breakable() |
| 4272 | q.text("value = "); |
| 4273 | q.pp(self.value) |
| 4274 | q.breakable() |
| 4275 | q.text('}') |
| 4276 | |
| 4277 | bsn_header.subtypes[46] = bsn_gentable_entry_add |
| 4278 | |
| 4279 | class bsn_gentable_entry_delete(bsn_header): |
| 4280 | version = 5 |
| 4281 | type = 4 |
| 4282 | experimenter = 6035143 |
| 4283 | subtype = 47 |
| 4284 | |
| 4285 | def __init__(self, xid=None, table_id=None, key=None): |
| 4286 | if xid != None: |
| 4287 | self.xid = xid |
| 4288 | else: |
| 4289 | self.xid = None |
| 4290 | if table_id != None: |
| 4291 | self.table_id = table_id |
| 4292 | else: |
| 4293 | self.table_id = 0 |
| 4294 | if key != None: |
| 4295 | self.key = key |
| 4296 | else: |
| 4297 | self.key = [] |
| 4298 | return |
| 4299 | |
| 4300 | def pack(self): |
| 4301 | packed = [] |
| 4302 | packed.append(struct.pack("!B", self.version)) |
| 4303 | packed.append(struct.pack("!B", self.type)) |
| 4304 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4305 | packed.append(struct.pack("!L", self.xid)) |
| 4306 | packed.append(struct.pack("!L", self.experimenter)) |
| 4307 | packed.append(struct.pack("!L", self.subtype)) |
| 4308 | packed.append(struct.pack("!H", self.table_id)) |
| 4309 | packed.append(loxi.generic_util.pack_list(self.key)) |
| 4310 | length = sum([len(x) for x in packed]) |
| 4311 | packed[2] = struct.pack("!H", length) |
| 4312 | return ''.join(packed) |
| 4313 | |
| 4314 | @staticmethod |
| 4315 | def unpack(reader): |
| 4316 | obj = bsn_gentable_entry_delete() |
| 4317 | _version = reader.read("!B")[0] |
| 4318 | assert(_version == 5) |
| 4319 | _type = reader.read("!B")[0] |
| 4320 | assert(_type == 4) |
| 4321 | _length = reader.read("!H")[0] |
| 4322 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4323 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 4324 | obj.xid = reader.read("!L")[0] |
| 4325 | _experimenter = reader.read("!L")[0] |
| 4326 | assert(_experimenter == 6035143) |
| 4327 | _subtype = reader.read("!L")[0] |
| 4328 | assert(_subtype == 47) |
| 4329 | obj.table_id = reader.read("!H")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4330 | obj.key = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 4331 | return obj |
| 4332 | |
| 4333 | def __eq__(self, other): |
| 4334 | if type(self) != type(other): return False |
| 4335 | if self.xid != other.xid: return False |
| 4336 | if self.table_id != other.table_id: return False |
| 4337 | if self.key != other.key: return False |
| 4338 | return True |
| 4339 | |
| 4340 | def pretty_print(self, q): |
| 4341 | q.text("bsn_gentable_entry_delete {") |
| 4342 | with q.group(): |
| 4343 | with q.indent(2): |
| 4344 | q.breakable() |
| 4345 | q.text("xid = "); |
| 4346 | if self.xid != None: |
| 4347 | q.text("%#x" % self.xid) |
| 4348 | else: |
| 4349 | q.text('None') |
| 4350 | q.text(","); q.breakable() |
| 4351 | q.text("table_id = "); |
| 4352 | q.text("%#x" % self.table_id) |
| 4353 | q.text(","); q.breakable() |
| 4354 | q.text("key = "); |
| 4355 | q.pp(self.key) |
| 4356 | q.breakable() |
| 4357 | q.text('}') |
| 4358 | |
| 4359 | bsn_header.subtypes[47] = bsn_gentable_entry_delete |
| 4360 | |
| 4361 | class bsn_gentable_entry_desc_stats_reply(bsn_stats_reply): |
| 4362 | version = 5 |
| 4363 | type = 19 |
| 4364 | stats_type = 65535 |
| 4365 | experimenter = 6035143 |
| 4366 | subtype = 2 |
| 4367 | |
| 4368 | def __init__(self, xid=None, flags=None, entries=None): |
| 4369 | if xid != None: |
| 4370 | self.xid = xid |
| 4371 | else: |
| 4372 | self.xid = None |
| 4373 | if flags != None: |
| 4374 | self.flags = flags |
| 4375 | else: |
| 4376 | self.flags = 0 |
| 4377 | if entries != None: |
| 4378 | self.entries = entries |
| 4379 | else: |
| 4380 | self.entries = [] |
| 4381 | return |
| 4382 | |
| 4383 | def pack(self): |
| 4384 | packed = [] |
| 4385 | packed.append(struct.pack("!B", self.version)) |
| 4386 | packed.append(struct.pack("!B", self.type)) |
| 4387 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4388 | packed.append(struct.pack("!L", self.xid)) |
| 4389 | packed.append(struct.pack("!H", self.stats_type)) |
| 4390 | packed.append(struct.pack("!H", self.flags)) |
| 4391 | packed.append('\x00' * 4) |
| 4392 | packed.append(struct.pack("!L", self.experimenter)) |
| 4393 | packed.append(struct.pack("!L", self.subtype)) |
| 4394 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 4395 | length = sum([len(x) for x in packed]) |
| 4396 | packed[2] = struct.pack("!H", length) |
| 4397 | return ''.join(packed) |
| 4398 | |
| 4399 | @staticmethod |
| 4400 | def unpack(reader): |
| 4401 | obj = bsn_gentable_entry_desc_stats_reply() |
| 4402 | _version = reader.read("!B")[0] |
| 4403 | assert(_version == 5) |
| 4404 | _type = reader.read("!B")[0] |
| 4405 | assert(_type == 19) |
| 4406 | _length = reader.read("!H")[0] |
| 4407 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4408 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 4409 | obj.xid = reader.read("!L")[0] |
| 4410 | _stats_type = reader.read("!H")[0] |
| 4411 | assert(_stats_type == 65535) |
| 4412 | obj.flags = reader.read("!H")[0] |
| 4413 | reader.skip(4) |
| 4414 | _experimenter = reader.read("!L")[0] |
| 4415 | assert(_experimenter == 6035143) |
| 4416 | _subtype = reader.read("!L")[0] |
| 4417 | assert(_subtype == 2) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4418 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_entry_desc_stats_entry.unpack) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 4419 | return obj |
| 4420 | |
| 4421 | def __eq__(self, other): |
| 4422 | if type(self) != type(other): return False |
| 4423 | if self.xid != other.xid: return False |
| 4424 | if self.flags != other.flags: return False |
| 4425 | if self.entries != other.entries: return False |
| 4426 | return True |
| 4427 | |
| 4428 | def pretty_print(self, q): |
| 4429 | q.text("bsn_gentable_entry_desc_stats_reply {") |
| 4430 | with q.group(): |
| 4431 | with q.indent(2): |
| 4432 | q.breakable() |
| 4433 | q.text("xid = "); |
| 4434 | if self.xid != None: |
| 4435 | q.text("%#x" % self.xid) |
| 4436 | else: |
| 4437 | q.text('None') |
| 4438 | q.text(","); q.breakable() |
| 4439 | q.text("flags = "); |
| 4440 | q.text("%#x" % self.flags) |
| 4441 | q.text(","); q.breakable() |
| 4442 | q.text("entries = "); |
| 4443 | q.pp(self.entries) |
| 4444 | q.breakable() |
| 4445 | q.text('}') |
| 4446 | |
| 4447 | bsn_stats_reply.subtypes[2] = bsn_gentable_entry_desc_stats_reply |
| 4448 | |
| 4449 | class bsn_gentable_entry_desc_stats_request(bsn_stats_request): |
| 4450 | version = 5 |
| 4451 | type = 18 |
| 4452 | stats_type = 65535 |
| 4453 | experimenter = 6035143 |
| 4454 | subtype = 2 |
| 4455 | |
| 4456 | def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None): |
| 4457 | if xid != None: |
| 4458 | self.xid = xid |
| 4459 | else: |
| 4460 | self.xid = None |
| 4461 | if flags != None: |
| 4462 | self.flags = flags |
| 4463 | else: |
| 4464 | self.flags = 0 |
| 4465 | if table_id != None: |
| 4466 | self.table_id = table_id |
| 4467 | else: |
| 4468 | self.table_id = 0 |
| 4469 | if checksum != None: |
| 4470 | self.checksum = checksum |
| 4471 | else: |
| 4472 | self.checksum = 0 |
| 4473 | if checksum_mask != None: |
| 4474 | self.checksum_mask = checksum_mask |
| 4475 | else: |
| 4476 | self.checksum_mask = 0 |
| 4477 | return |
| 4478 | |
| 4479 | def pack(self): |
| 4480 | packed = [] |
| 4481 | packed.append(struct.pack("!B", self.version)) |
| 4482 | packed.append(struct.pack("!B", self.type)) |
| 4483 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4484 | packed.append(struct.pack("!L", self.xid)) |
| 4485 | packed.append(struct.pack("!H", self.stats_type)) |
| 4486 | packed.append(struct.pack("!H", self.flags)) |
| 4487 | packed.append('\x00' * 4) |
| 4488 | packed.append(struct.pack("!L", self.experimenter)) |
| 4489 | packed.append(struct.pack("!L", self.subtype)) |
| 4490 | packed.append(struct.pack("!H", self.table_id)) |
| 4491 | packed.append('\x00' * 2) |
| 4492 | packed.append(util.pack_checksum_128(self.checksum)) |
| 4493 | packed.append(util.pack_checksum_128(self.checksum_mask)) |
| 4494 | length = sum([len(x) for x in packed]) |
| 4495 | packed[2] = struct.pack("!H", length) |
| 4496 | return ''.join(packed) |
| 4497 | |
| 4498 | @staticmethod |
| 4499 | def unpack(reader): |
| 4500 | obj = bsn_gentable_entry_desc_stats_request() |
| 4501 | _version = reader.read("!B")[0] |
| 4502 | assert(_version == 5) |
| 4503 | _type = reader.read("!B")[0] |
| 4504 | assert(_type == 18) |
| 4505 | _length = reader.read("!H")[0] |
| 4506 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4507 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 4508 | obj.xid = reader.read("!L")[0] |
| 4509 | _stats_type = reader.read("!H")[0] |
| 4510 | assert(_stats_type == 65535) |
| 4511 | obj.flags = reader.read("!H")[0] |
| 4512 | reader.skip(4) |
| 4513 | _experimenter = reader.read("!L")[0] |
| 4514 | assert(_experimenter == 6035143) |
| 4515 | _subtype = reader.read("!L")[0] |
| 4516 | assert(_subtype == 2) |
| 4517 | obj.table_id = reader.read("!H")[0] |
| 4518 | reader.skip(2) |
| 4519 | obj.checksum = util.unpack_checksum_128(reader) |
| 4520 | obj.checksum_mask = util.unpack_checksum_128(reader) |
| 4521 | return obj |
| 4522 | |
| 4523 | def __eq__(self, other): |
| 4524 | if type(self) != type(other): return False |
| 4525 | if self.xid != other.xid: return False |
| 4526 | if self.flags != other.flags: return False |
| 4527 | if self.table_id != other.table_id: return False |
| 4528 | if self.checksum != other.checksum: return False |
| 4529 | if self.checksum_mask != other.checksum_mask: return False |
| 4530 | return True |
| 4531 | |
| 4532 | def pretty_print(self, q): |
| 4533 | q.text("bsn_gentable_entry_desc_stats_request {") |
| 4534 | with q.group(): |
| 4535 | with q.indent(2): |
| 4536 | q.breakable() |
| 4537 | q.text("xid = "); |
| 4538 | if self.xid != None: |
| 4539 | q.text("%#x" % self.xid) |
| 4540 | else: |
| 4541 | q.text('None') |
| 4542 | q.text(","); q.breakable() |
| 4543 | q.text("flags = "); |
| 4544 | q.text("%#x" % self.flags) |
| 4545 | q.text(","); q.breakable() |
| 4546 | q.text("table_id = "); |
| 4547 | q.text("%#x" % self.table_id) |
| 4548 | q.text(","); q.breakable() |
| 4549 | q.text("checksum = "); |
| 4550 | q.pp(self.checksum) |
| 4551 | q.text(","); q.breakable() |
| 4552 | q.text("checksum_mask = "); |
| 4553 | q.pp(self.checksum_mask) |
| 4554 | q.breakable() |
| 4555 | q.text('}') |
| 4556 | |
| 4557 | bsn_stats_request.subtypes[2] = bsn_gentable_entry_desc_stats_request |
| 4558 | |
| 4559 | class bsn_gentable_entry_stats_reply(bsn_stats_reply): |
| 4560 | version = 5 |
| 4561 | type = 19 |
| 4562 | stats_type = 65535 |
| 4563 | experimenter = 6035143 |
| 4564 | subtype = 3 |
| 4565 | |
| 4566 | def __init__(self, xid=None, flags=None, entries=None): |
| 4567 | if xid != None: |
| 4568 | self.xid = xid |
| 4569 | else: |
| 4570 | self.xid = None |
| 4571 | if flags != None: |
| 4572 | self.flags = flags |
| 4573 | else: |
| 4574 | self.flags = 0 |
| 4575 | if entries != None: |
| 4576 | self.entries = entries |
| 4577 | else: |
| 4578 | self.entries = [] |
| 4579 | return |
| 4580 | |
| 4581 | def pack(self): |
| 4582 | packed = [] |
| 4583 | packed.append(struct.pack("!B", self.version)) |
| 4584 | packed.append(struct.pack("!B", self.type)) |
| 4585 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4586 | packed.append(struct.pack("!L", self.xid)) |
| 4587 | packed.append(struct.pack("!H", self.stats_type)) |
| 4588 | packed.append(struct.pack("!H", self.flags)) |
| 4589 | packed.append('\x00' * 4) |
| 4590 | packed.append(struct.pack("!L", self.experimenter)) |
| 4591 | packed.append(struct.pack("!L", self.subtype)) |
| 4592 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 4593 | length = sum([len(x) for x in packed]) |
| 4594 | packed[2] = struct.pack("!H", length) |
| 4595 | return ''.join(packed) |
| 4596 | |
| 4597 | @staticmethod |
| 4598 | def unpack(reader): |
| 4599 | obj = bsn_gentable_entry_stats_reply() |
| 4600 | _version = reader.read("!B")[0] |
| 4601 | assert(_version == 5) |
| 4602 | _type = reader.read("!B")[0] |
| 4603 | assert(_type == 19) |
| 4604 | _length = reader.read("!H")[0] |
| 4605 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4606 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 4607 | obj.xid = reader.read("!L")[0] |
| 4608 | _stats_type = reader.read("!H")[0] |
| 4609 | assert(_stats_type == 65535) |
| 4610 | obj.flags = reader.read("!H")[0] |
| 4611 | reader.skip(4) |
| 4612 | _experimenter = reader.read("!L")[0] |
| 4613 | assert(_experimenter == 6035143) |
| 4614 | _subtype = reader.read("!L")[0] |
| 4615 | assert(_subtype == 3) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4616 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_entry_stats_entry.unpack) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 4617 | return obj |
| 4618 | |
| 4619 | def __eq__(self, other): |
| 4620 | if type(self) != type(other): return False |
| 4621 | if self.xid != other.xid: return False |
| 4622 | if self.flags != other.flags: return False |
| 4623 | if self.entries != other.entries: return False |
| 4624 | return True |
| 4625 | |
| 4626 | def pretty_print(self, q): |
| 4627 | q.text("bsn_gentable_entry_stats_reply {") |
| 4628 | with q.group(): |
| 4629 | with q.indent(2): |
| 4630 | q.breakable() |
| 4631 | q.text("xid = "); |
| 4632 | if self.xid != None: |
| 4633 | q.text("%#x" % self.xid) |
| 4634 | else: |
| 4635 | q.text('None') |
| 4636 | q.text(","); q.breakable() |
| 4637 | q.text("flags = "); |
| 4638 | q.text("%#x" % self.flags) |
| 4639 | q.text(","); q.breakable() |
| 4640 | q.text("entries = "); |
| 4641 | q.pp(self.entries) |
| 4642 | q.breakable() |
| 4643 | q.text('}') |
| 4644 | |
| 4645 | bsn_stats_reply.subtypes[3] = bsn_gentable_entry_stats_reply |
| 4646 | |
| 4647 | class bsn_gentable_entry_stats_request(bsn_stats_request): |
| 4648 | version = 5 |
| 4649 | type = 18 |
| 4650 | stats_type = 65535 |
| 4651 | experimenter = 6035143 |
| 4652 | subtype = 3 |
| 4653 | |
| 4654 | def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None): |
| 4655 | if xid != None: |
| 4656 | self.xid = xid |
| 4657 | else: |
| 4658 | self.xid = None |
| 4659 | if flags != None: |
| 4660 | self.flags = flags |
| 4661 | else: |
| 4662 | self.flags = 0 |
| 4663 | if table_id != None: |
| 4664 | self.table_id = table_id |
| 4665 | else: |
| 4666 | self.table_id = 0 |
| 4667 | if checksum != None: |
| 4668 | self.checksum = checksum |
| 4669 | else: |
| 4670 | self.checksum = 0 |
| 4671 | if checksum_mask != None: |
| 4672 | self.checksum_mask = checksum_mask |
| 4673 | else: |
| 4674 | self.checksum_mask = 0 |
| 4675 | return |
| 4676 | |
| 4677 | def pack(self): |
| 4678 | packed = [] |
| 4679 | packed.append(struct.pack("!B", self.version)) |
| 4680 | packed.append(struct.pack("!B", self.type)) |
| 4681 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4682 | packed.append(struct.pack("!L", self.xid)) |
| 4683 | packed.append(struct.pack("!H", self.stats_type)) |
| 4684 | packed.append(struct.pack("!H", self.flags)) |
| 4685 | packed.append('\x00' * 4) |
| 4686 | packed.append(struct.pack("!L", self.experimenter)) |
| 4687 | packed.append(struct.pack("!L", self.subtype)) |
| 4688 | packed.append(struct.pack("!H", self.table_id)) |
| 4689 | packed.append('\x00' * 2) |
| 4690 | packed.append(util.pack_checksum_128(self.checksum)) |
| 4691 | packed.append(util.pack_checksum_128(self.checksum_mask)) |
| 4692 | length = sum([len(x) for x in packed]) |
| 4693 | packed[2] = struct.pack("!H", length) |
| 4694 | return ''.join(packed) |
| 4695 | |
| 4696 | @staticmethod |
| 4697 | def unpack(reader): |
| 4698 | obj = bsn_gentable_entry_stats_request() |
| 4699 | _version = reader.read("!B")[0] |
| 4700 | assert(_version == 5) |
| 4701 | _type = reader.read("!B")[0] |
| 4702 | assert(_type == 18) |
| 4703 | _length = reader.read("!H")[0] |
| 4704 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4705 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 4706 | obj.xid = reader.read("!L")[0] |
| 4707 | _stats_type = reader.read("!H")[0] |
| 4708 | assert(_stats_type == 65535) |
| 4709 | obj.flags = reader.read("!H")[0] |
| 4710 | reader.skip(4) |
| 4711 | _experimenter = reader.read("!L")[0] |
| 4712 | assert(_experimenter == 6035143) |
| 4713 | _subtype = reader.read("!L")[0] |
| 4714 | assert(_subtype == 3) |
| 4715 | obj.table_id = reader.read("!H")[0] |
| 4716 | reader.skip(2) |
| 4717 | obj.checksum = util.unpack_checksum_128(reader) |
| 4718 | obj.checksum_mask = util.unpack_checksum_128(reader) |
| 4719 | return obj |
| 4720 | |
| 4721 | def __eq__(self, other): |
| 4722 | if type(self) != type(other): return False |
| 4723 | if self.xid != other.xid: return False |
| 4724 | if self.flags != other.flags: return False |
| 4725 | if self.table_id != other.table_id: return False |
| 4726 | if self.checksum != other.checksum: return False |
| 4727 | if self.checksum_mask != other.checksum_mask: return False |
| 4728 | return True |
| 4729 | |
| 4730 | def pretty_print(self, q): |
| 4731 | q.text("bsn_gentable_entry_stats_request {") |
| 4732 | with q.group(): |
| 4733 | with q.indent(2): |
| 4734 | q.breakable() |
| 4735 | q.text("xid = "); |
| 4736 | if self.xid != None: |
| 4737 | q.text("%#x" % self.xid) |
| 4738 | else: |
| 4739 | q.text('None') |
| 4740 | q.text(","); q.breakable() |
| 4741 | q.text("flags = "); |
| 4742 | q.text("%#x" % self.flags) |
| 4743 | q.text(","); q.breakable() |
| 4744 | q.text("table_id = "); |
| 4745 | q.text("%#x" % self.table_id) |
| 4746 | q.text(","); q.breakable() |
| 4747 | q.text("checksum = "); |
| 4748 | q.pp(self.checksum) |
| 4749 | q.text(","); q.breakable() |
| 4750 | q.text("checksum_mask = "); |
| 4751 | q.pp(self.checksum_mask) |
| 4752 | q.breakable() |
| 4753 | q.text('}') |
| 4754 | |
| 4755 | bsn_stats_request.subtypes[3] = bsn_gentable_entry_stats_request |
| 4756 | |
| 4757 | class bsn_gentable_set_buckets_size(bsn_header): |
| 4758 | version = 5 |
| 4759 | type = 4 |
| 4760 | experimenter = 6035143 |
| 4761 | subtype = 50 |
| 4762 | |
| 4763 | def __init__(self, xid=None, table_id=None, buckets_size=None): |
| 4764 | if xid != None: |
| 4765 | self.xid = xid |
| 4766 | else: |
| 4767 | self.xid = None |
| 4768 | if table_id != None: |
| 4769 | self.table_id = table_id |
| 4770 | else: |
| 4771 | self.table_id = 0 |
| 4772 | if buckets_size != None: |
| 4773 | self.buckets_size = buckets_size |
| 4774 | else: |
| 4775 | self.buckets_size = 0 |
| 4776 | return |
| 4777 | |
| 4778 | def pack(self): |
| 4779 | packed = [] |
| 4780 | packed.append(struct.pack("!B", self.version)) |
| 4781 | packed.append(struct.pack("!B", self.type)) |
| 4782 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4783 | packed.append(struct.pack("!L", self.xid)) |
| 4784 | packed.append(struct.pack("!L", self.experimenter)) |
| 4785 | packed.append(struct.pack("!L", self.subtype)) |
| 4786 | packed.append(struct.pack("!H", self.table_id)) |
| 4787 | packed.append('\x00' * 2) |
| 4788 | packed.append(struct.pack("!L", self.buckets_size)) |
| 4789 | length = sum([len(x) for x in packed]) |
| 4790 | packed[2] = struct.pack("!H", length) |
| 4791 | return ''.join(packed) |
| 4792 | |
| 4793 | @staticmethod |
| 4794 | def unpack(reader): |
| 4795 | obj = bsn_gentable_set_buckets_size() |
| 4796 | _version = reader.read("!B")[0] |
| 4797 | assert(_version == 5) |
| 4798 | _type = reader.read("!B")[0] |
| 4799 | assert(_type == 4) |
| 4800 | _length = reader.read("!H")[0] |
| 4801 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4802 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 4803 | obj.xid = reader.read("!L")[0] |
| 4804 | _experimenter = reader.read("!L")[0] |
| 4805 | assert(_experimenter == 6035143) |
| 4806 | _subtype = reader.read("!L")[0] |
| 4807 | assert(_subtype == 50) |
| 4808 | obj.table_id = reader.read("!H")[0] |
| 4809 | reader.skip(2) |
| 4810 | obj.buckets_size = reader.read("!L")[0] |
| 4811 | return obj |
| 4812 | |
| 4813 | def __eq__(self, other): |
| 4814 | if type(self) != type(other): return False |
| 4815 | if self.xid != other.xid: return False |
| 4816 | if self.table_id != other.table_id: return False |
| 4817 | if self.buckets_size != other.buckets_size: return False |
| 4818 | return True |
| 4819 | |
| 4820 | def pretty_print(self, q): |
| 4821 | q.text("bsn_gentable_set_buckets_size {") |
| 4822 | with q.group(): |
| 4823 | with q.indent(2): |
| 4824 | q.breakable() |
| 4825 | q.text("xid = "); |
| 4826 | if self.xid != None: |
| 4827 | q.text("%#x" % self.xid) |
| 4828 | else: |
| 4829 | q.text('None') |
| 4830 | q.text(","); q.breakable() |
| 4831 | q.text("table_id = "); |
| 4832 | q.text("%#x" % self.table_id) |
| 4833 | q.text(","); q.breakable() |
| 4834 | q.text("buckets_size = "); |
| 4835 | q.text("%#x" % self.buckets_size) |
| 4836 | q.breakable() |
| 4837 | q.text('}') |
| 4838 | |
| 4839 | bsn_header.subtypes[50] = bsn_gentable_set_buckets_size |
| 4840 | |
| 4841 | class bsn_gentable_stats_reply(bsn_stats_reply): |
| 4842 | version = 5 |
| 4843 | type = 19 |
| 4844 | stats_type = 65535 |
| 4845 | experimenter = 6035143 |
| 4846 | subtype = 7 |
| 4847 | |
| 4848 | def __init__(self, xid=None, flags=None, entries=None): |
| 4849 | if xid != None: |
| 4850 | self.xid = xid |
| 4851 | else: |
| 4852 | self.xid = None |
| 4853 | if flags != None: |
| 4854 | self.flags = flags |
| 4855 | else: |
| 4856 | self.flags = 0 |
| 4857 | if entries != None: |
| 4858 | self.entries = entries |
| 4859 | else: |
| 4860 | self.entries = [] |
| 4861 | return |
| 4862 | |
| 4863 | def pack(self): |
| 4864 | packed = [] |
| 4865 | packed.append(struct.pack("!B", self.version)) |
| 4866 | packed.append(struct.pack("!B", self.type)) |
| 4867 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4868 | packed.append(struct.pack("!L", self.xid)) |
| 4869 | packed.append(struct.pack("!H", self.stats_type)) |
| 4870 | packed.append(struct.pack("!H", self.flags)) |
| 4871 | packed.append('\x00' * 4) |
| 4872 | packed.append(struct.pack("!L", self.experimenter)) |
| 4873 | packed.append(struct.pack("!L", self.subtype)) |
| 4874 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 4875 | length = sum([len(x) for x in packed]) |
| 4876 | packed[2] = struct.pack("!H", length) |
| 4877 | return ''.join(packed) |
| 4878 | |
| 4879 | @staticmethod |
| 4880 | def unpack(reader): |
| 4881 | obj = bsn_gentable_stats_reply() |
| 4882 | _version = reader.read("!B")[0] |
| 4883 | assert(_version == 5) |
| 4884 | _type = reader.read("!B")[0] |
| 4885 | assert(_type == 19) |
| 4886 | _length = reader.read("!H")[0] |
| 4887 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4888 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 4889 | obj.xid = reader.read("!L")[0] |
| 4890 | _stats_type = reader.read("!H")[0] |
| 4891 | assert(_stats_type == 65535) |
| 4892 | obj.flags = reader.read("!H")[0] |
| 4893 | reader.skip(4) |
| 4894 | _experimenter = reader.read("!L")[0] |
| 4895 | assert(_experimenter == 6035143) |
| 4896 | _subtype = reader.read("!L")[0] |
| 4897 | assert(_subtype == 7) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4898 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_stats_entry.unpack) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 4899 | return obj |
| 4900 | |
| 4901 | def __eq__(self, other): |
| 4902 | if type(self) != type(other): return False |
| 4903 | if self.xid != other.xid: return False |
| 4904 | if self.flags != other.flags: return False |
| 4905 | if self.entries != other.entries: return False |
| 4906 | return True |
| 4907 | |
| 4908 | def pretty_print(self, q): |
| 4909 | q.text("bsn_gentable_stats_reply {") |
| 4910 | with q.group(): |
| 4911 | with q.indent(2): |
| 4912 | q.breakable() |
| 4913 | q.text("xid = "); |
| 4914 | if self.xid != None: |
| 4915 | q.text("%#x" % self.xid) |
| 4916 | else: |
| 4917 | q.text('None') |
| 4918 | q.text(","); q.breakable() |
| 4919 | q.text("flags = "); |
| 4920 | q.text("%#x" % self.flags) |
| 4921 | q.text(","); q.breakable() |
| 4922 | q.text("entries = "); |
| 4923 | q.pp(self.entries) |
| 4924 | q.breakable() |
| 4925 | q.text('}') |
| 4926 | |
| 4927 | bsn_stats_reply.subtypes[7] = bsn_gentable_stats_reply |
| 4928 | |
| 4929 | class bsn_gentable_stats_request(bsn_stats_request): |
| 4930 | version = 5 |
| 4931 | type = 18 |
| 4932 | stats_type = 65535 |
| 4933 | experimenter = 6035143 |
| 4934 | subtype = 7 |
| 4935 | |
| 4936 | def __init__(self, xid=None, flags=None): |
| 4937 | if xid != None: |
| 4938 | self.xid = xid |
| 4939 | else: |
| 4940 | self.xid = None |
| 4941 | if flags != None: |
| 4942 | self.flags = flags |
| 4943 | else: |
| 4944 | self.flags = 0 |
| 4945 | return |
| 4946 | |
| 4947 | def pack(self): |
| 4948 | packed = [] |
| 4949 | packed.append(struct.pack("!B", self.version)) |
| 4950 | packed.append(struct.pack("!B", self.type)) |
| 4951 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4952 | packed.append(struct.pack("!L", self.xid)) |
| 4953 | packed.append(struct.pack("!H", self.stats_type)) |
| 4954 | packed.append(struct.pack("!H", self.flags)) |
| 4955 | packed.append('\x00' * 4) |
| 4956 | packed.append(struct.pack("!L", self.experimenter)) |
| 4957 | packed.append(struct.pack("!L", self.subtype)) |
| 4958 | length = sum([len(x) for x in packed]) |
| 4959 | packed[2] = struct.pack("!H", length) |
| 4960 | return ''.join(packed) |
| 4961 | |
| 4962 | @staticmethod |
| 4963 | def unpack(reader): |
| 4964 | obj = bsn_gentable_stats_request() |
| 4965 | _version = reader.read("!B")[0] |
| 4966 | assert(_version == 5) |
| 4967 | _type = reader.read("!B")[0] |
| 4968 | assert(_type == 18) |
| 4969 | _length = reader.read("!H")[0] |
| 4970 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4971 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 4972 | obj.xid = reader.read("!L")[0] |
| 4973 | _stats_type = reader.read("!H")[0] |
| 4974 | assert(_stats_type == 65535) |
| 4975 | obj.flags = reader.read("!H")[0] |
| 4976 | reader.skip(4) |
| 4977 | _experimenter = reader.read("!L")[0] |
| 4978 | assert(_experimenter == 6035143) |
| 4979 | _subtype = reader.read("!L")[0] |
| 4980 | assert(_subtype == 7) |
| 4981 | return obj |
| 4982 | |
| 4983 | def __eq__(self, other): |
| 4984 | if type(self) != type(other): return False |
| 4985 | if self.xid != other.xid: return False |
| 4986 | if self.flags != other.flags: return False |
| 4987 | return True |
| 4988 | |
| 4989 | def pretty_print(self, q): |
| 4990 | q.text("bsn_gentable_stats_request {") |
| 4991 | with q.group(): |
| 4992 | with q.indent(2): |
| 4993 | q.breakable() |
| 4994 | q.text("xid = "); |
| 4995 | if self.xid != None: |
| 4996 | q.text("%#x" % self.xid) |
| 4997 | else: |
| 4998 | q.text('None') |
| 4999 | q.text(","); q.breakable() |
| 5000 | q.text("flags = "); |
| 5001 | q.text("%#x" % self.flags) |
| 5002 | q.breakable() |
| 5003 | q.text('}') |
| 5004 | |
| 5005 | bsn_stats_request.subtypes[7] = bsn_gentable_stats_request |
| 5006 | |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 5007 | class bsn_get_interfaces_reply(bsn_header): |
| 5008 | version = 5 |
| 5009 | type = 4 |
| 5010 | experimenter = 6035143 |
| 5011 | subtype = 10 |
| 5012 | |
| 5013 | def __init__(self, xid=None, interfaces=None): |
| 5014 | if xid != None: |
| 5015 | self.xid = xid |
| 5016 | else: |
| 5017 | self.xid = None |
| 5018 | if interfaces != None: |
| 5019 | self.interfaces = interfaces |
| 5020 | else: |
| 5021 | self.interfaces = [] |
| 5022 | return |
| 5023 | |
| 5024 | def pack(self): |
| 5025 | packed = [] |
| 5026 | packed.append(struct.pack("!B", self.version)) |
| 5027 | packed.append(struct.pack("!B", self.type)) |
| 5028 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5029 | packed.append(struct.pack("!L", self.xid)) |
| 5030 | packed.append(struct.pack("!L", self.experimenter)) |
| 5031 | packed.append(struct.pack("!L", self.subtype)) |
| 5032 | packed.append(loxi.generic_util.pack_list(self.interfaces)) |
| 5033 | length = sum([len(x) for x in packed]) |
| 5034 | packed[2] = struct.pack("!H", length) |
| 5035 | return ''.join(packed) |
| 5036 | |
| 5037 | @staticmethod |
| 5038 | def unpack(reader): |
| 5039 | obj = bsn_get_interfaces_reply() |
| 5040 | _version = reader.read("!B")[0] |
| 5041 | assert(_version == 5) |
| 5042 | _type = reader.read("!B")[0] |
| 5043 | assert(_type == 4) |
| 5044 | _length = reader.read("!H")[0] |
| 5045 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5046 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 5047 | obj.xid = reader.read("!L")[0] |
| 5048 | _experimenter = reader.read("!L")[0] |
| 5049 | assert(_experimenter == 6035143) |
| 5050 | _subtype = reader.read("!L")[0] |
| 5051 | assert(_subtype == 10) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 5052 | obj.interfaces = loxi.generic_util.unpack_list(reader, ofp.common.bsn_interface.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 5053 | return obj |
| 5054 | |
| 5055 | def __eq__(self, other): |
| 5056 | if type(self) != type(other): return False |
| 5057 | if self.xid != other.xid: return False |
| 5058 | if self.interfaces != other.interfaces: return False |
| 5059 | return True |
| 5060 | |
| 5061 | def pretty_print(self, q): |
| 5062 | q.text("bsn_get_interfaces_reply {") |
| 5063 | with q.group(): |
| 5064 | with q.indent(2): |
| 5065 | q.breakable() |
| 5066 | q.text("xid = "); |
| 5067 | if self.xid != None: |
| 5068 | q.text("%#x" % self.xid) |
| 5069 | else: |
| 5070 | q.text('None') |
| 5071 | q.text(","); q.breakable() |
| 5072 | q.text("interfaces = "); |
| 5073 | q.pp(self.interfaces) |
| 5074 | q.breakable() |
| 5075 | q.text('}') |
| 5076 | |
| 5077 | bsn_header.subtypes[10] = bsn_get_interfaces_reply |
| 5078 | |
| 5079 | class bsn_get_interfaces_request(bsn_header): |
| 5080 | version = 5 |
| 5081 | type = 4 |
| 5082 | experimenter = 6035143 |
| 5083 | subtype = 9 |
| 5084 | |
| 5085 | def __init__(self, xid=None): |
| 5086 | if xid != None: |
| 5087 | self.xid = xid |
| 5088 | else: |
| 5089 | self.xid = None |
| 5090 | return |
| 5091 | |
| 5092 | def pack(self): |
| 5093 | packed = [] |
| 5094 | packed.append(struct.pack("!B", self.version)) |
| 5095 | packed.append(struct.pack("!B", self.type)) |
| 5096 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5097 | packed.append(struct.pack("!L", self.xid)) |
| 5098 | packed.append(struct.pack("!L", self.experimenter)) |
| 5099 | packed.append(struct.pack("!L", self.subtype)) |
| 5100 | length = sum([len(x) for x in packed]) |
| 5101 | packed[2] = struct.pack("!H", length) |
| 5102 | return ''.join(packed) |
| 5103 | |
| 5104 | @staticmethod |
| 5105 | def unpack(reader): |
| 5106 | obj = bsn_get_interfaces_request() |
| 5107 | _version = reader.read("!B")[0] |
| 5108 | assert(_version == 5) |
| 5109 | _type = reader.read("!B")[0] |
| 5110 | assert(_type == 4) |
| 5111 | _length = reader.read("!H")[0] |
| 5112 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5113 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 5114 | obj.xid = reader.read("!L")[0] |
| 5115 | _experimenter = reader.read("!L")[0] |
| 5116 | assert(_experimenter == 6035143) |
| 5117 | _subtype = reader.read("!L")[0] |
| 5118 | assert(_subtype == 9) |
| 5119 | return obj |
| 5120 | |
| 5121 | def __eq__(self, other): |
| 5122 | if type(self) != type(other): return False |
| 5123 | if self.xid != other.xid: return False |
| 5124 | return True |
| 5125 | |
| 5126 | def pretty_print(self, q): |
| 5127 | q.text("bsn_get_interfaces_request {") |
| 5128 | with q.group(): |
| 5129 | with q.indent(2): |
| 5130 | q.breakable() |
| 5131 | q.text("xid = "); |
| 5132 | if self.xid != None: |
| 5133 | q.text("%#x" % self.xid) |
| 5134 | else: |
| 5135 | q.text('None') |
| 5136 | q.breakable() |
| 5137 | q.text('}') |
| 5138 | |
| 5139 | bsn_header.subtypes[9] = bsn_get_interfaces_request |
| 5140 | |
| 5141 | class bsn_get_mirroring_reply(bsn_header): |
| 5142 | version = 5 |
| 5143 | type = 4 |
| 5144 | experimenter = 6035143 |
| 5145 | subtype = 5 |
| 5146 | |
| 5147 | def __init__(self, xid=None, report_mirror_ports=None): |
| 5148 | if xid != None: |
| 5149 | self.xid = xid |
| 5150 | else: |
| 5151 | self.xid = None |
| 5152 | if report_mirror_ports != None: |
| 5153 | self.report_mirror_ports = report_mirror_ports |
| 5154 | else: |
| 5155 | self.report_mirror_ports = 0 |
| 5156 | return |
| 5157 | |
| 5158 | def pack(self): |
| 5159 | packed = [] |
| 5160 | packed.append(struct.pack("!B", self.version)) |
| 5161 | packed.append(struct.pack("!B", self.type)) |
| 5162 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5163 | packed.append(struct.pack("!L", self.xid)) |
| 5164 | packed.append(struct.pack("!L", self.experimenter)) |
| 5165 | packed.append(struct.pack("!L", self.subtype)) |
| 5166 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 5167 | packed.append('\x00' * 3) |
| 5168 | length = sum([len(x) for x in packed]) |
| 5169 | packed[2] = struct.pack("!H", length) |
| 5170 | return ''.join(packed) |
| 5171 | |
| 5172 | @staticmethod |
| 5173 | def unpack(reader): |
| 5174 | obj = bsn_get_mirroring_reply() |
| 5175 | _version = reader.read("!B")[0] |
| 5176 | assert(_version == 5) |
| 5177 | _type = reader.read("!B")[0] |
| 5178 | assert(_type == 4) |
| 5179 | _length = reader.read("!H")[0] |
| 5180 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5181 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 5182 | obj.xid = reader.read("!L")[0] |
| 5183 | _experimenter = reader.read("!L")[0] |
| 5184 | assert(_experimenter == 6035143) |
| 5185 | _subtype = reader.read("!L")[0] |
| 5186 | assert(_subtype == 5) |
| 5187 | obj.report_mirror_ports = reader.read("!B")[0] |
| 5188 | reader.skip(3) |
| 5189 | return obj |
| 5190 | |
| 5191 | def __eq__(self, other): |
| 5192 | if type(self) != type(other): return False |
| 5193 | if self.xid != other.xid: return False |
| 5194 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 5195 | return True |
| 5196 | |
| 5197 | def pretty_print(self, q): |
| 5198 | q.text("bsn_get_mirroring_reply {") |
| 5199 | with q.group(): |
| 5200 | with q.indent(2): |
| 5201 | q.breakable() |
| 5202 | q.text("xid = "); |
| 5203 | if self.xid != None: |
| 5204 | q.text("%#x" % self.xid) |
| 5205 | else: |
| 5206 | q.text('None') |
| 5207 | q.text(","); q.breakable() |
| 5208 | q.text("report_mirror_ports = "); |
| 5209 | q.text("%#x" % self.report_mirror_ports) |
| 5210 | q.breakable() |
| 5211 | q.text('}') |
| 5212 | |
| 5213 | bsn_header.subtypes[5] = bsn_get_mirroring_reply |
| 5214 | |
| 5215 | class bsn_get_mirroring_request(bsn_header): |
| 5216 | version = 5 |
| 5217 | type = 4 |
| 5218 | experimenter = 6035143 |
| 5219 | subtype = 4 |
| 5220 | |
| 5221 | def __init__(self, xid=None, report_mirror_ports=None): |
| 5222 | if xid != None: |
| 5223 | self.xid = xid |
| 5224 | else: |
| 5225 | self.xid = None |
| 5226 | if report_mirror_ports != None: |
| 5227 | self.report_mirror_ports = report_mirror_ports |
| 5228 | else: |
| 5229 | self.report_mirror_ports = 0 |
| 5230 | return |
| 5231 | |
| 5232 | def pack(self): |
| 5233 | packed = [] |
| 5234 | packed.append(struct.pack("!B", self.version)) |
| 5235 | packed.append(struct.pack("!B", self.type)) |
| 5236 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5237 | packed.append(struct.pack("!L", self.xid)) |
| 5238 | packed.append(struct.pack("!L", self.experimenter)) |
| 5239 | packed.append(struct.pack("!L", self.subtype)) |
| 5240 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 5241 | packed.append('\x00' * 3) |
| 5242 | length = sum([len(x) for x in packed]) |
| 5243 | packed[2] = struct.pack("!H", length) |
| 5244 | return ''.join(packed) |
| 5245 | |
| 5246 | @staticmethod |
| 5247 | def unpack(reader): |
| 5248 | obj = bsn_get_mirroring_request() |
| 5249 | _version = reader.read("!B")[0] |
| 5250 | assert(_version == 5) |
| 5251 | _type = reader.read("!B")[0] |
| 5252 | assert(_type == 4) |
| 5253 | _length = reader.read("!H")[0] |
| 5254 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5255 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 5256 | obj.xid = reader.read("!L")[0] |
| 5257 | _experimenter = reader.read("!L")[0] |
| 5258 | assert(_experimenter == 6035143) |
| 5259 | _subtype = reader.read("!L")[0] |
| 5260 | assert(_subtype == 4) |
| 5261 | obj.report_mirror_ports = reader.read("!B")[0] |
| 5262 | reader.skip(3) |
| 5263 | return obj |
| 5264 | |
| 5265 | def __eq__(self, other): |
| 5266 | if type(self) != type(other): return False |
| 5267 | if self.xid != other.xid: return False |
| 5268 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 5269 | return True |
| 5270 | |
| 5271 | def pretty_print(self, q): |
| 5272 | q.text("bsn_get_mirroring_request {") |
| 5273 | with q.group(): |
| 5274 | with q.indent(2): |
| 5275 | q.breakable() |
| 5276 | q.text("xid = "); |
| 5277 | if self.xid != None: |
| 5278 | q.text("%#x" % self.xid) |
| 5279 | else: |
| 5280 | q.text('None') |
| 5281 | q.text(","); q.breakable() |
| 5282 | q.text("report_mirror_ports = "); |
| 5283 | q.text("%#x" % self.report_mirror_ports) |
| 5284 | q.breakable() |
| 5285 | q.text('}') |
| 5286 | |
| 5287 | bsn_header.subtypes[4] = bsn_get_mirroring_request |
| 5288 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 5289 | class bsn_get_switch_pipeline_reply(bsn_header): |
| 5290 | version = 5 |
| 5291 | type = 4 |
| 5292 | experimenter = 6035143 |
| 5293 | subtype = 52 |
| 5294 | |
| 5295 | def __init__(self, xid=None, pipeline=None): |
| 5296 | if xid != None: |
| 5297 | self.xid = xid |
| 5298 | else: |
| 5299 | self.xid = None |
| 5300 | if pipeline != None: |
| 5301 | self.pipeline = pipeline |
| 5302 | else: |
| 5303 | self.pipeline = "" |
| 5304 | return |
| 5305 | |
| 5306 | def pack(self): |
| 5307 | packed = [] |
| 5308 | packed.append(struct.pack("!B", self.version)) |
| 5309 | packed.append(struct.pack("!B", self.type)) |
| 5310 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5311 | packed.append(struct.pack("!L", self.xid)) |
| 5312 | packed.append(struct.pack("!L", self.experimenter)) |
| 5313 | packed.append(struct.pack("!L", self.subtype)) |
| 5314 | packed.append(struct.pack("!256s", self.pipeline)) |
| 5315 | length = sum([len(x) for x in packed]) |
| 5316 | packed[2] = struct.pack("!H", length) |
| 5317 | return ''.join(packed) |
| 5318 | |
| 5319 | @staticmethod |
| 5320 | def unpack(reader): |
| 5321 | obj = bsn_get_switch_pipeline_reply() |
| 5322 | _version = reader.read("!B")[0] |
| 5323 | assert(_version == 5) |
| 5324 | _type = reader.read("!B")[0] |
| 5325 | assert(_type == 4) |
| 5326 | _length = reader.read("!H")[0] |
| 5327 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5328 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 5329 | obj.xid = reader.read("!L")[0] |
| 5330 | _experimenter = reader.read("!L")[0] |
| 5331 | assert(_experimenter == 6035143) |
| 5332 | _subtype = reader.read("!L")[0] |
| 5333 | assert(_subtype == 52) |
| 5334 | obj.pipeline = reader.read("!256s")[0].rstrip("\x00") |
| 5335 | return obj |
| 5336 | |
| 5337 | def __eq__(self, other): |
| 5338 | if type(self) != type(other): return False |
| 5339 | if self.xid != other.xid: return False |
| 5340 | if self.pipeline != other.pipeline: return False |
| 5341 | return True |
| 5342 | |
| 5343 | def pretty_print(self, q): |
| 5344 | q.text("bsn_get_switch_pipeline_reply {") |
| 5345 | with q.group(): |
| 5346 | with q.indent(2): |
| 5347 | q.breakable() |
| 5348 | q.text("xid = "); |
| 5349 | if self.xid != None: |
| 5350 | q.text("%#x" % self.xid) |
| 5351 | else: |
| 5352 | q.text('None') |
| 5353 | q.text(","); q.breakable() |
| 5354 | q.text("pipeline = "); |
| 5355 | q.pp(self.pipeline) |
| 5356 | q.breakable() |
| 5357 | q.text('}') |
| 5358 | |
| 5359 | bsn_header.subtypes[52] = bsn_get_switch_pipeline_reply |
| 5360 | |
| 5361 | class bsn_get_switch_pipeline_request(bsn_header): |
| 5362 | version = 5 |
| 5363 | type = 4 |
| 5364 | experimenter = 6035143 |
| 5365 | subtype = 51 |
| 5366 | |
| 5367 | def __init__(self, xid=None): |
| 5368 | if xid != None: |
| 5369 | self.xid = xid |
| 5370 | else: |
| 5371 | self.xid = None |
| 5372 | return |
| 5373 | |
| 5374 | def pack(self): |
| 5375 | packed = [] |
| 5376 | packed.append(struct.pack("!B", self.version)) |
| 5377 | packed.append(struct.pack("!B", self.type)) |
| 5378 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5379 | packed.append(struct.pack("!L", self.xid)) |
| 5380 | packed.append(struct.pack("!L", self.experimenter)) |
| 5381 | packed.append(struct.pack("!L", self.subtype)) |
| 5382 | length = sum([len(x) for x in packed]) |
| 5383 | packed[2] = struct.pack("!H", length) |
| 5384 | return ''.join(packed) |
| 5385 | |
| 5386 | @staticmethod |
| 5387 | def unpack(reader): |
| 5388 | obj = bsn_get_switch_pipeline_request() |
| 5389 | _version = reader.read("!B")[0] |
| 5390 | assert(_version == 5) |
| 5391 | _type = reader.read("!B")[0] |
| 5392 | assert(_type == 4) |
| 5393 | _length = reader.read("!H")[0] |
| 5394 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5395 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 5396 | obj.xid = reader.read("!L")[0] |
| 5397 | _experimenter = reader.read("!L")[0] |
| 5398 | assert(_experimenter == 6035143) |
| 5399 | _subtype = reader.read("!L")[0] |
| 5400 | assert(_subtype == 51) |
| 5401 | return obj |
| 5402 | |
| 5403 | def __eq__(self, other): |
| 5404 | if type(self) != type(other): return False |
| 5405 | if self.xid != other.xid: return False |
| 5406 | return True |
| 5407 | |
| 5408 | def pretty_print(self, q): |
| 5409 | q.text("bsn_get_switch_pipeline_request {") |
| 5410 | with q.group(): |
| 5411 | with q.indent(2): |
| 5412 | q.breakable() |
| 5413 | q.text("xid = "); |
| 5414 | if self.xid != None: |
| 5415 | q.text("%#x" % self.xid) |
| 5416 | else: |
| 5417 | q.text('None') |
| 5418 | q.breakable() |
| 5419 | q.text('}') |
| 5420 | |
| 5421 | bsn_header.subtypes[51] = bsn_get_switch_pipeline_request |
| 5422 | |
| 5423 | class bsn_image_desc_stats_reply(bsn_stats_reply): |
| 5424 | version = 5 |
| 5425 | type = 19 |
| 5426 | stats_type = 65535 |
| 5427 | experimenter = 6035143 |
| 5428 | subtype = 14 |
| 5429 | |
| 5430 | def __init__(self, xid=None, flags=None, image_checksum=None, startup_config_checksum=None): |
| 5431 | if xid != None: |
| 5432 | self.xid = xid |
| 5433 | else: |
| 5434 | self.xid = None |
| 5435 | if flags != None: |
| 5436 | self.flags = flags |
| 5437 | else: |
| 5438 | self.flags = 0 |
| 5439 | if image_checksum != None: |
| 5440 | self.image_checksum = image_checksum |
| 5441 | else: |
| 5442 | self.image_checksum = "" |
| 5443 | if startup_config_checksum != None: |
| 5444 | self.startup_config_checksum = startup_config_checksum |
| 5445 | else: |
| 5446 | self.startup_config_checksum = "" |
| 5447 | return |
| 5448 | |
| 5449 | def pack(self): |
| 5450 | packed = [] |
| 5451 | packed.append(struct.pack("!B", self.version)) |
| 5452 | packed.append(struct.pack("!B", self.type)) |
| 5453 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5454 | packed.append(struct.pack("!L", self.xid)) |
| 5455 | packed.append(struct.pack("!H", self.stats_type)) |
| 5456 | packed.append(struct.pack("!H", self.flags)) |
| 5457 | packed.append('\x00' * 4) |
| 5458 | packed.append(struct.pack("!L", self.experimenter)) |
| 5459 | packed.append(struct.pack("!L", self.subtype)) |
| 5460 | packed.append(struct.pack("!256s", self.image_checksum)) |
| 5461 | packed.append(struct.pack("!256s", self.startup_config_checksum)) |
| 5462 | length = sum([len(x) for x in packed]) |
| 5463 | packed[2] = struct.pack("!H", length) |
| 5464 | return ''.join(packed) |
| 5465 | |
| 5466 | @staticmethod |
| 5467 | def unpack(reader): |
| 5468 | obj = bsn_image_desc_stats_reply() |
| 5469 | _version = reader.read("!B")[0] |
| 5470 | assert(_version == 5) |
| 5471 | _type = reader.read("!B")[0] |
| 5472 | assert(_type == 19) |
| 5473 | _length = reader.read("!H")[0] |
| 5474 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5475 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 5476 | obj.xid = reader.read("!L")[0] |
| 5477 | _stats_type = reader.read("!H")[0] |
| 5478 | assert(_stats_type == 65535) |
| 5479 | obj.flags = reader.read("!H")[0] |
| 5480 | reader.skip(4) |
| 5481 | _experimenter = reader.read("!L")[0] |
| 5482 | assert(_experimenter == 6035143) |
| 5483 | _subtype = reader.read("!L")[0] |
| 5484 | assert(_subtype == 14) |
| 5485 | obj.image_checksum = reader.read("!256s")[0].rstrip("\x00") |
| 5486 | obj.startup_config_checksum = reader.read("!256s")[0].rstrip("\x00") |
| 5487 | return obj |
| 5488 | |
| 5489 | def __eq__(self, other): |
| 5490 | if type(self) != type(other): return False |
| 5491 | if self.xid != other.xid: return False |
| 5492 | if self.flags != other.flags: return False |
| 5493 | if self.image_checksum != other.image_checksum: return False |
| 5494 | if self.startup_config_checksum != other.startup_config_checksum: return False |
| 5495 | return True |
| 5496 | |
| 5497 | def pretty_print(self, q): |
| 5498 | q.text("bsn_image_desc_stats_reply {") |
| 5499 | with q.group(): |
| 5500 | with q.indent(2): |
| 5501 | q.breakable() |
| 5502 | q.text("xid = "); |
| 5503 | if self.xid != None: |
| 5504 | q.text("%#x" % self.xid) |
| 5505 | else: |
| 5506 | q.text('None') |
| 5507 | q.text(","); q.breakable() |
| 5508 | q.text("flags = "); |
| 5509 | q.text("%#x" % self.flags) |
| 5510 | q.text(","); q.breakable() |
| 5511 | q.text("image_checksum = "); |
| 5512 | q.pp(self.image_checksum) |
| 5513 | q.text(","); q.breakable() |
| 5514 | q.text("startup_config_checksum = "); |
| 5515 | q.pp(self.startup_config_checksum) |
| 5516 | q.breakable() |
| 5517 | q.text('}') |
| 5518 | |
| 5519 | bsn_stats_reply.subtypes[14] = bsn_image_desc_stats_reply |
| 5520 | |
| 5521 | class bsn_image_desc_stats_request(bsn_stats_request): |
| 5522 | version = 5 |
| 5523 | type = 18 |
| 5524 | stats_type = 65535 |
| 5525 | experimenter = 6035143 |
| 5526 | subtype = 14 |
| 5527 | |
| 5528 | def __init__(self, xid=None, flags=None): |
| 5529 | if xid != None: |
| 5530 | self.xid = xid |
| 5531 | else: |
| 5532 | self.xid = None |
| 5533 | if flags != None: |
| 5534 | self.flags = flags |
| 5535 | else: |
| 5536 | self.flags = 0 |
| 5537 | return |
| 5538 | |
| 5539 | def pack(self): |
| 5540 | packed = [] |
| 5541 | packed.append(struct.pack("!B", self.version)) |
| 5542 | packed.append(struct.pack("!B", self.type)) |
| 5543 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5544 | packed.append(struct.pack("!L", self.xid)) |
| 5545 | packed.append(struct.pack("!H", self.stats_type)) |
| 5546 | packed.append(struct.pack("!H", self.flags)) |
| 5547 | packed.append('\x00' * 4) |
| 5548 | packed.append(struct.pack("!L", self.experimenter)) |
| 5549 | packed.append(struct.pack("!L", self.subtype)) |
| 5550 | length = sum([len(x) for x in packed]) |
| 5551 | packed[2] = struct.pack("!H", length) |
| 5552 | return ''.join(packed) |
| 5553 | |
| 5554 | @staticmethod |
| 5555 | def unpack(reader): |
| 5556 | obj = bsn_image_desc_stats_request() |
| 5557 | _version = reader.read("!B")[0] |
| 5558 | assert(_version == 5) |
| 5559 | _type = reader.read("!B")[0] |
| 5560 | assert(_type == 18) |
| 5561 | _length = reader.read("!H")[0] |
| 5562 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5563 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 5564 | obj.xid = reader.read("!L")[0] |
| 5565 | _stats_type = reader.read("!H")[0] |
| 5566 | assert(_stats_type == 65535) |
| 5567 | obj.flags = reader.read("!H")[0] |
| 5568 | reader.skip(4) |
| 5569 | _experimenter = reader.read("!L")[0] |
| 5570 | assert(_experimenter == 6035143) |
| 5571 | _subtype = reader.read("!L")[0] |
| 5572 | assert(_subtype == 14) |
| 5573 | return obj |
| 5574 | |
| 5575 | def __eq__(self, other): |
| 5576 | if type(self) != type(other): return False |
| 5577 | if self.xid != other.xid: return False |
| 5578 | if self.flags != other.flags: return False |
| 5579 | return True |
| 5580 | |
| 5581 | def pretty_print(self, q): |
| 5582 | q.text("bsn_image_desc_stats_request {") |
| 5583 | with q.group(): |
| 5584 | with q.indent(2): |
| 5585 | q.breakable() |
| 5586 | q.text("xid = "); |
| 5587 | if self.xid != None: |
| 5588 | q.text("%#x" % self.xid) |
| 5589 | else: |
| 5590 | q.text('None') |
| 5591 | q.text(","); q.breakable() |
| 5592 | q.text("flags = "); |
| 5593 | q.text("%#x" % self.flags) |
| 5594 | q.breakable() |
| 5595 | q.text('}') |
| 5596 | |
| 5597 | bsn_stats_request.subtypes[14] = bsn_image_desc_stats_request |
| 5598 | |
| 5599 | class bsn_lacp_convergence_notif(bsn_header): |
| 5600 | version = 5 |
| 5601 | type = 4 |
| 5602 | experimenter = 6035143 |
| 5603 | subtype = 43 |
| 5604 | |
| 5605 | def __init__(self, xid=None, convergence_status=None, port_no=None, actor_sys_priority=None, actor_sys_mac=None, actor_port_priority=None, actor_port_num=None, actor_key=None, partner_sys_priority=None, partner_sys_mac=None, partner_port_priority=None, partner_port_num=None, partner_key=None): |
| 5606 | if xid != None: |
| 5607 | self.xid = xid |
| 5608 | else: |
| 5609 | self.xid = None |
| 5610 | if convergence_status != None: |
| 5611 | self.convergence_status = convergence_status |
| 5612 | else: |
| 5613 | self.convergence_status = 0 |
| 5614 | if port_no != None: |
| 5615 | self.port_no = port_no |
| 5616 | else: |
| 5617 | self.port_no = 0 |
| 5618 | if actor_sys_priority != None: |
| 5619 | self.actor_sys_priority = actor_sys_priority |
| 5620 | else: |
| 5621 | self.actor_sys_priority = 0 |
| 5622 | if actor_sys_mac != None: |
| 5623 | self.actor_sys_mac = actor_sys_mac |
| 5624 | else: |
| 5625 | self.actor_sys_mac = [0,0,0,0,0,0] |
| 5626 | if actor_port_priority != None: |
| 5627 | self.actor_port_priority = actor_port_priority |
| 5628 | else: |
| 5629 | self.actor_port_priority = 0 |
| 5630 | if actor_port_num != None: |
| 5631 | self.actor_port_num = actor_port_num |
| 5632 | else: |
| 5633 | self.actor_port_num = 0 |
| 5634 | if actor_key != None: |
| 5635 | self.actor_key = actor_key |
| 5636 | else: |
| 5637 | self.actor_key = 0 |
| 5638 | if partner_sys_priority != None: |
| 5639 | self.partner_sys_priority = partner_sys_priority |
| 5640 | else: |
| 5641 | self.partner_sys_priority = 0 |
| 5642 | if partner_sys_mac != None: |
| 5643 | self.partner_sys_mac = partner_sys_mac |
| 5644 | else: |
| 5645 | self.partner_sys_mac = [0,0,0,0,0,0] |
| 5646 | if partner_port_priority != None: |
| 5647 | self.partner_port_priority = partner_port_priority |
| 5648 | else: |
| 5649 | self.partner_port_priority = 0 |
| 5650 | if partner_port_num != None: |
| 5651 | self.partner_port_num = partner_port_num |
| 5652 | else: |
| 5653 | self.partner_port_num = 0 |
| 5654 | if partner_key != None: |
| 5655 | self.partner_key = partner_key |
| 5656 | else: |
| 5657 | self.partner_key = 0 |
| 5658 | return |
| 5659 | |
| 5660 | def pack(self): |
| 5661 | packed = [] |
| 5662 | packed.append(struct.pack("!B", self.version)) |
| 5663 | packed.append(struct.pack("!B", self.type)) |
| 5664 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5665 | packed.append(struct.pack("!L", self.xid)) |
| 5666 | packed.append(struct.pack("!L", self.experimenter)) |
| 5667 | packed.append(struct.pack("!L", self.subtype)) |
| 5668 | packed.append(struct.pack("!B", self.convergence_status)) |
| 5669 | packed.append('\x00' * 3) |
| 5670 | packed.append(util.pack_port_no(self.port_no)) |
| 5671 | packed.append(struct.pack("!H", self.actor_sys_priority)) |
| 5672 | packed.append(struct.pack("!6B", *self.actor_sys_mac)) |
| 5673 | packed.append(struct.pack("!H", self.actor_port_priority)) |
| 5674 | packed.append(struct.pack("!H", self.actor_port_num)) |
| 5675 | packed.append(struct.pack("!H", self.actor_key)) |
| 5676 | packed.append(struct.pack("!H", self.partner_sys_priority)) |
| 5677 | packed.append(struct.pack("!6B", *self.partner_sys_mac)) |
| 5678 | packed.append(struct.pack("!H", self.partner_port_priority)) |
| 5679 | packed.append(struct.pack("!H", self.partner_port_num)) |
| 5680 | packed.append(struct.pack("!H", self.partner_key)) |
| 5681 | length = sum([len(x) for x in packed]) |
| 5682 | packed[2] = struct.pack("!H", length) |
| 5683 | return ''.join(packed) |
| 5684 | |
| 5685 | @staticmethod |
| 5686 | def unpack(reader): |
| 5687 | obj = bsn_lacp_convergence_notif() |
| 5688 | _version = reader.read("!B")[0] |
| 5689 | assert(_version == 5) |
| 5690 | _type = reader.read("!B")[0] |
| 5691 | assert(_type == 4) |
| 5692 | _length = reader.read("!H")[0] |
| 5693 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5694 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 5695 | obj.xid = reader.read("!L")[0] |
| 5696 | _experimenter = reader.read("!L")[0] |
| 5697 | assert(_experimenter == 6035143) |
| 5698 | _subtype = reader.read("!L")[0] |
| 5699 | assert(_subtype == 43) |
| 5700 | obj.convergence_status = reader.read("!B")[0] |
| 5701 | reader.skip(3) |
| 5702 | obj.port_no = util.unpack_port_no(reader) |
| 5703 | obj.actor_sys_priority = reader.read("!H")[0] |
| 5704 | obj.actor_sys_mac = list(reader.read('!6B')) |
| 5705 | obj.actor_port_priority = reader.read("!H")[0] |
| 5706 | obj.actor_port_num = reader.read("!H")[0] |
| 5707 | obj.actor_key = reader.read("!H")[0] |
| 5708 | obj.partner_sys_priority = reader.read("!H")[0] |
| 5709 | obj.partner_sys_mac = list(reader.read('!6B')) |
| 5710 | obj.partner_port_priority = reader.read("!H")[0] |
| 5711 | obj.partner_port_num = reader.read("!H")[0] |
| 5712 | obj.partner_key = reader.read("!H")[0] |
| 5713 | return obj |
| 5714 | |
| 5715 | def __eq__(self, other): |
| 5716 | if type(self) != type(other): return False |
| 5717 | if self.xid != other.xid: return False |
| 5718 | if self.convergence_status != other.convergence_status: return False |
| 5719 | if self.port_no != other.port_no: return False |
| 5720 | if self.actor_sys_priority != other.actor_sys_priority: return False |
| 5721 | if self.actor_sys_mac != other.actor_sys_mac: return False |
| 5722 | if self.actor_port_priority != other.actor_port_priority: return False |
| 5723 | if self.actor_port_num != other.actor_port_num: return False |
| 5724 | if self.actor_key != other.actor_key: return False |
| 5725 | if self.partner_sys_priority != other.partner_sys_priority: return False |
| 5726 | if self.partner_sys_mac != other.partner_sys_mac: return False |
| 5727 | if self.partner_port_priority != other.partner_port_priority: return False |
| 5728 | if self.partner_port_num != other.partner_port_num: return False |
| 5729 | if self.partner_key != other.partner_key: return False |
| 5730 | return True |
| 5731 | |
| 5732 | def pretty_print(self, q): |
| 5733 | q.text("bsn_lacp_convergence_notif {") |
| 5734 | with q.group(): |
| 5735 | with q.indent(2): |
| 5736 | q.breakable() |
| 5737 | q.text("xid = "); |
| 5738 | if self.xid != None: |
| 5739 | q.text("%#x" % self.xid) |
| 5740 | else: |
| 5741 | q.text('None') |
| 5742 | q.text(","); q.breakable() |
| 5743 | q.text("convergence_status = "); |
| 5744 | q.text("%#x" % self.convergence_status) |
| 5745 | q.text(","); q.breakable() |
| 5746 | q.text("port_no = "); |
| 5747 | q.text(util.pretty_port(self.port_no)) |
| 5748 | q.text(","); q.breakable() |
| 5749 | q.text("actor_sys_priority = "); |
| 5750 | q.text("%#x" % self.actor_sys_priority) |
| 5751 | q.text(","); q.breakable() |
| 5752 | q.text("actor_sys_mac = "); |
| 5753 | q.text(util.pretty_mac(self.actor_sys_mac)) |
| 5754 | q.text(","); q.breakable() |
| 5755 | q.text("actor_port_priority = "); |
| 5756 | q.text("%#x" % self.actor_port_priority) |
| 5757 | q.text(","); q.breakable() |
| 5758 | q.text("actor_port_num = "); |
| 5759 | q.text("%#x" % self.actor_port_num) |
| 5760 | q.text(","); q.breakable() |
| 5761 | q.text("actor_key = "); |
| 5762 | q.text("%#x" % self.actor_key) |
| 5763 | q.text(","); q.breakable() |
| 5764 | q.text("partner_sys_priority = "); |
| 5765 | q.text("%#x" % self.partner_sys_priority) |
| 5766 | q.text(","); q.breakable() |
| 5767 | q.text("partner_sys_mac = "); |
| 5768 | q.text(util.pretty_mac(self.partner_sys_mac)) |
| 5769 | q.text(","); q.breakable() |
| 5770 | q.text("partner_port_priority = "); |
| 5771 | q.text("%#x" % self.partner_port_priority) |
| 5772 | q.text(","); q.breakable() |
| 5773 | q.text("partner_port_num = "); |
| 5774 | q.text("%#x" % self.partner_port_num) |
| 5775 | q.text(","); q.breakable() |
| 5776 | q.text("partner_key = "); |
| 5777 | q.text("%#x" % self.partner_key) |
| 5778 | q.breakable() |
| 5779 | q.text('}') |
| 5780 | |
| 5781 | bsn_header.subtypes[43] = bsn_lacp_convergence_notif |
| 5782 | |
| 5783 | class bsn_lacp_stats_reply(bsn_stats_reply): |
| 5784 | version = 5 |
| 5785 | type = 19 |
| 5786 | stats_type = 65535 |
| 5787 | experimenter = 6035143 |
| 5788 | subtype = 1 |
| 5789 | |
| 5790 | def __init__(self, xid=None, flags=None, entries=None): |
| 5791 | if xid != None: |
| 5792 | self.xid = xid |
| 5793 | else: |
| 5794 | self.xid = None |
| 5795 | if flags != None: |
| 5796 | self.flags = flags |
| 5797 | else: |
| 5798 | self.flags = 0 |
| 5799 | if entries != None: |
| 5800 | self.entries = entries |
| 5801 | else: |
| 5802 | self.entries = [] |
| 5803 | return |
| 5804 | |
| 5805 | def pack(self): |
| 5806 | packed = [] |
| 5807 | packed.append(struct.pack("!B", self.version)) |
| 5808 | packed.append(struct.pack("!B", self.type)) |
| 5809 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5810 | packed.append(struct.pack("!L", self.xid)) |
| 5811 | packed.append(struct.pack("!H", self.stats_type)) |
| 5812 | packed.append(struct.pack("!H", self.flags)) |
| 5813 | packed.append('\x00' * 4) |
| 5814 | packed.append(struct.pack("!L", self.experimenter)) |
| 5815 | packed.append(struct.pack("!L", self.subtype)) |
| 5816 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 5817 | length = sum([len(x) for x in packed]) |
| 5818 | packed[2] = struct.pack("!H", length) |
| 5819 | return ''.join(packed) |
| 5820 | |
| 5821 | @staticmethod |
| 5822 | def unpack(reader): |
| 5823 | obj = bsn_lacp_stats_reply() |
| 5824 | _version = reader.read("!B")[0] |
| 5825 | assert(_version == 5) |
| 5826 | _type = reader.read("!B")[0] |
| 5827 | assert(_type == 19) |
| 5828 | _length = reader.read("!H")[0] |
| 5829 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5830 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 5831 | obj.xid = reader.read("!L")[0] |
| 5832 | _stats_type = reader.read("!H")[0] |
| 5833 | assert(_stats_type == 65535) |
| 5834 | obj.flags = reader.read("!H")[0] |
| 5835 | reader.skip(4) |
| 5836 | _experimenter = reader.read("!L")[0] |
| 5837 | assert(_experimenter == 6035143) |
| 5838 | _subtype = reader.read("!L")[0] |
| 5839 | assert(_subtype == 1) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 5840 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_lacp_stats_entry.unpack) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 5841 | return obj |
| 5842 | |
| 5843 | def __eq__(self, other): |
| 5844 | if type(self) != type(other): return False |
| 5845 | if self.xid != other.xid: return False |
| 5846 | if self.flags != other.flags: return False |
| 5847 | if self.entries != other.entries: return False |
| 5848 | return True |
| 5849 | |
| 5850 | def pretty_print(self, q): |
| 5851 | q.text("bsn_lacp_stats_reply {") |
| 5852 | with q.group(): |
| 5853 | with q.indent(2): |
| 5854 | q.breakable() |
| 5855 | q.text("xid = "); |
| 5856 | if self.xid != None: |
| 5857 | q.text("%#x" % self.xid) |
| 5858 | else: |
| 5859 | q.text('None') |
| 5860 | q.text(","); q.breakable() |
| 5861 | q.text("flags = "); |
| 5862 | q.text("%#x" % self.flags) |
| 5863 | q.text(","); q.breakable() |
| 5864 | q.text("entries = "); |
| 5865 | q.pp(self.entries) |
| 5866 | q.breakable() |
| 5867 | q.text('}') |
| 5868 | |
| 5869 | bsn_stats_reply.subtypes[1] = bsn_lacp_stats_reply |
| 5870 | |
| 5871 | class bsn_lacp_stats_request(bsn_stats_request): |
| 5872 | version = 5 |
| 5873 | type = 18 |
| 5874 | stats_type = 65535 |
| 5875 | experimenter = 6035143 |
| 5876 | subtype = 1 |
| 5877 | |
| 5878 | def __init__(self, xid=None, flags=None): |
| 5879 | if xid != None: |
| 5880 | self.xid = xid |
| 5881 | else: |
| 5882 | self.xid = None |
| 5883 | if flags != None: |
| 5884 | self.flags = flags |
| 5885 | else: |
| 5886 | self.flags = 0 |
| 5887 | return |
| 5888 | |
| 5889 | def pack(self): |
| 5890 | packed = [] |
| 5891 | packed.append(struct.pack("!B", self.version)) |
| 5892 | packed.append(struct.pack("!B", self.type)) |
| 5893 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5894 | packed.append(struct.pack("!L", self.xid)) |
| 5895 | packed.append(struct.pack("!H", self.stats_type)) |
| 5896 | packed.append(struct.pack("!H", self.flags)) |
| 5897 | packed.append('\x00' * 4) |
| 5898 | packed.append(struct.pack("!L", self.experimenter)) |
| 5899 | packed.append(struct.pack("!L", self.subtype)) |
| 5900 | length = sum([len(x) for x in packed]) |
| 5901 | packed[2] = struct.pack("!H", length) |
| 5902 | return ''.join(packed) |
| 5903 | |
| 5904 | @staticmethod |
| 5905 | def unpack(reader): |
| 5906 | obj = bsn_lacp_stats_request() |
| 5907 | _version = reader.read("!B")[0] |
| 5908 | assert(_version == 5) |
| 5909 | _type = reader.read("!B")[0] |
| 5910 | assert(_type == 18) |
| 5911 | _length = reader.read("!H")[0] |
| 5912 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5913 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 5914 | obj.xid = reader.read("!L")[0] |
| 5915 | _stats_type = reader.read("!H")[0] |
| 5916 | assert(_stats_type == 65535) |
| 5917 | obj.flags = reader.read("!H")[0] |
| 5918 | reader.skip(4) |
| 5919 | _experimenter = reader.read("!L")[0] |
| 5920 | assert(_experimenter == 6035143) |
| 5921 | _subtype = reader.read("!L")[0] |
| 5922 | assert(_subtype == 1) |
| 5923 | return obj |
| 5924 | |
| 5925 | def __eq__(self, other): |
| 5926 | if type(self) != type(other): return False |
| 5927 | if self.xid != other.xid: return False |
| 5928 | if self.flags != other.flags: return False |
| 5929 | return True |
| 5930 | |
| 5931 | def pretty_print(self, q): |
| 5932 | q.text("bsn_lacp_stats_request {") |
| 5933 | with q.group(): |
| 5934 | with q.indent(2): |
| 5935 | q.breakable() |
| 5936 | q.text("xid = "); |
| 5937 | if self.xid != None: |
| 5938 | q.text("%#x" % self.xid) |
| 5939 | else: |
| 5940 | q.text('None') |
| 5941 | q.text(","); q.breakable() |
| 5942 | q.text("flags = "); |
| 5943 | q.text("%#x" % self.flags) |
| 5944 | q.breakable() |
| 5945 | q.text('}') |
| 5946 | |
| 5947 | bsn_stats_request.subtypes[1] = bsn_lacp_stats_request |
| 5948 | |
| 5949 | class bsn_log(bsn_header): |
| 5950 | version = 5 |
| 5951 | type = 4 |
| 5952 | experimenter = 6035143 |
| 5953 | subtype = 63 |
| 5954 | |
| 5955 | def __init__(self, xid=None, loglevel=None, data=None): |
| 5956 | if xid != None: |
| 5957 | self.xid = xid |
| 5958 | else: |
| 5959 | self.xid = None |
| 5960 | if loglevel != None: |
| 5961 | self.loglevel = loglevel |
| 5962 | else: |
| 5963 | self.loglevel = 0 |
| 5964 | if data != None: |
| 5965 | self.data = data |
| 5966 | else: |
| 5967 | self.data = '' |
| 5968 | return |
| 5969 | |
| 5970 | def pack(self): |
| 5971 | packed = [] |
| 5972 | packed.append(struct.pack("!B", self.version)) |
| 5973 | packed.append(struct.pack("!B", self.type)) |
| 5974 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5975 | packed.append(struct.pack("!L", self.xid)) |
| 5976 | packed.append(struct.pack("!L", self.experimenter)) |
| 5977 | packed.append(struct.pack("!L", self.subtype)) |
| 5978 | packed.append(struct.pack("!B", self.loglevel)) |
| 5979 | packed.append(self.data) |
| 5980 | length = sum([len(x) for x in packed]) |
| 5981 | packed[2] = struct.pack("!H", length) |
| 5982 | return ''.join(packed) |
| 5983 | |
| 5984 | @staticmethod |
| 5985 | def unpack(reader): |
| 5986 | obj = bsn_log() |
| 5987 | _version = reader.read("!B")[0] |
| 5988 | assert(_version == 5) |
| 5989 | _type = reader.read("!B")[0] |
| 5990 | assert(_type == 4) |
| 5991 | _length = reader.read("!H")[0] |
| 5992 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5993 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 5994 | obj.xid = reader.read("!L")[0] |
| 5995 | _experimenter = reader.read("!L")[0] |
| 5996 | assert(_experimenter == 6035143) |
| 5997 | _subtype = reader.read("!L")[0] |
| 5998 | assert(_subtype == 63) |
| 5999 | obj.loglevel = reader.read("!B")[0] |
| 6000 | obj.data = str(reader.read_all()) |
| 6001 | return obj |
| 6002 | |
| 6003 | def __eq__(self, other): |
| 6004 | if type(self) != type(other): return False |
| 6005 | if self.xid != other.xid: return False |
| 6006 | if self.loglevel != other.loglevel: return False |
| 6007 | if self.data != other.data: return False |
| 6008 | return True |
| 6009 | |
| 6010 | def pretty_print(self, q): |
| 6011 | q.text("bsn_log {") |
| 6012 | with q.group(): |
| 6013 | with q.indent(2): |
| 6014 | q.breakable() |
| 6015 | q.text("xid = "); |
| 6016 | if self.xid != None: |
| 6017 | q.text("%#x" % self.xid) |
| 6018 | else: |
| 6019 | q.text('None') |
| 6020 | q.text(","); q.breakable() |
| 6021 | q.text("loglevel = "); |
| 6022 | q.text("%#x" % self.loglevel) |
| 6023 | q.text(","); q.breakable() |
| 6024 | q.text("data = "); |
| 6025 | q.pp(self.data) |
| 6026 | q.breakable() |
| 6027 | q.text('}') |
| 6028 | |
| 6029 | bsn_header.subtypes[63] = bsn_log |
| 6030 | |
Rich Lane | 474324f | 2015-01-14 15:22:56 -0800 | [diff] [blame] | 6031 | class bsn_lua_command_reply(bsn_header): |
| 6032 | version = 5 |
| 6033 | type = 4 |
| 6034 | experimenter = 6035143 |
| 6035 | subtype = 66 |
| 6036 | |
| 6037 | def __init__(self, xid=None, data=None): |
| 6038 | if xid != None: |
| 6039 | self.xid = xid |
| 6040 | else: |
| 6041 | self.xid = None |
| 6042 | if data != None: |
| 6043 | self.data = data |
| 6044 | else: |
| 6045 | self.data = '' |
| 6046 | return |
| 6047 | |
| 6048 | def pack(self): |
| 6049 | packed = [] |
| 6050 | packed.append(struct.pack("!B", self.version)) |
| 6051 | packed.append(struct.pack("!B", self.type)) |
| 6052 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6053 | packed.append(struct.pack("!L", self.xid)) |
| 6054 | packed.append(struct.pack("!L", self.experimenter)) |
| 6055 | packed.append(struct.pack("!L", self.subtype)) |
| 6056 | packed.append(self.data) |
| 6057 | length = sum([len(x) for x in packed]) |
| 6058 | packed[2] = struct.pack("!H", length) |
| 6059 | return ''.join(packed) |
| 6060 | |
| 6061 | @staticmethod |
| 6062 | def unpack(reader): |
| 6063 | obj = bsn_lua_command_reply() |
| 6064 | _version = reader.read("!B")[0] |
| 6065 | assert(_version == 5) |
| 6066 | _type = reader.read("!B")[0] |
| 6067 | assert(_type == 4) |
| 6068 | _length = reader.read("!H")[0] |
| 6069 | orig_reader = reader |
| 6070 | reader = orig_reader.slice(_length, 4) |
| 6071 | obj.xid = reader.read("!L")[0] |
| 6072 | _experimenter = reader.read("!L")[0] |
| 6073 | assert(_experimenter == 6035143) |
| 6074 | _subtype = reader.read("!L")[0] |
| 6075 | assert(_subtype == 66) |
| 6076 | obj.data = str(reader.read_all()) |
| 6077 | return obj |
| 6078 | |
| 6079 | def __eq__(self, other): |
| 6080 | if type(self) != type(other): return False |
| 6081 | if self.xid != other.xid: return False |
| 6082 | if self.data != other.data: return False |
| 6083 | return True |
| 6084 | |
| 6085 | def pretty_print(self, q): |
| 6086 | q.text("bsn_lua_command_reply {") |
| 6087 | with q.group(): |
| 6088 | with q.indent(2): |
| 6089 | q.breakable() |
| 6090 | q.text("xid = "); |
| 6091 | if self.xid != None: |
| 6092 | q.text("%#x" % self.xid) |
| 6093 | else: |
| 6094 | q.text('None') |
| 6095 | q.text(","); q.breakable() |
| 6096 | q.text("data = "); |
| 6097 | q.pp(self.data) |
| 6098 | q.breakable() |
| 6099 | q.text('}') |
| 6100 | |
| 6101 | bsn_header.subtypes[66] = bsn_lua_command_reply |
| 6102 | |
| 6103 | class bsn_lua_command_request(bsn_header): |
| 6104 | version = 5 |
| 6105 | type = 4 |
| 6106 | experimenter = 6035143 |
| 6107 | subtype = 65 |
| 6108 | |
| 6109 | def __init__(self, xid=None, data=None): |
| 6110 | if xid != None: |
| 6111 | self.xid = xid |
| 6112 | else: |
| 6113 | self.xid = None |
| 6114 | if data != None: |
| 6115 | self.data = data |
| 6116 | else: |
| 6117 | self.data = '' |
| 6118 | return |
| 6119 | |
| 6120 | def pack(self): |
| 6121 | packed = [] |
| 6122 | packed.append(struct.pack("!B", self.version)) |
| 6123 | packed.append(struct.pack("!B", self.type)) |
| 6124 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6125 | packed.append(struct.pack("!L", self.xid)) |
| 6126 | packed.append(struct.pack("!L", self.experimenter)) |
| 6127 | packed.append(struct.pack("!L", self.subtype)) |
| 6128 | packed.append(self.data) |
| 6129 | length = sum([len(x) for x in packed]) |
| 6130 | packed[2] = struct.pack("!H", length) |
| 6131 | return ''.join(packed) |
| 6132 | |
| 6133 | @staticmethod |
| 6134 | def unpack(reader): |
| 6135 | obj = bsn_lua_command_request() |
| 6136 | _version = reader.read("!B")[0] |
| 6137 | assert(_version == 5) |
| 6138 | _type = reader.read("!B")[0] |
| 6139 | assert(_type == 4) |
| 6140 | _length = reader.read("!H")[0] |
| 6141 | orig_reader = reader |
| 6142 | reader = orig_reader.slice(_length, 4) |
| 6143 | obj.xid = reader.read("!L")[0] |
| 6144 | _experimenter = reader.read("!L")[0] |
| 6145 | assert(_experimenter == 6035143) |
| 6146 | _subtype = reader.read("!L")[0] |
| 6147 | assert(_subtype == 65) |
| 6148 | obj.data = str(reader.read_all()) |
| 6149 | return obj |
| 6150 | |
| 6151 | def __eq__(self, other): |
| 6152 | if type(self) != type(other): return False |
| 6153 | if self.xid != other.xid: return False |
| 6154 | if self.data != other.data: return False |
| 6155 | return True |
| 6156 | |
| 6157 | def pretty_print(self, q): |
| 6158 | q.text("bsn_lua_command_request {") |
| 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("data = "); |
| 6169 | q.pp(self.data) |
| 6170 | q.breakable() |
| 6171 | q.text('}') |
| 6172 | |
| 6173 | bsn_header.subtypes[65] = bsn_lua_command_request |
| 6174 | |
| 6175 | class bsn_lua_notification(bsn_header): |
| 6176 | version = 5 |
| 6177 | type = 4 |
| 6178 | experimenter = 6035143 |
| 6179 | subtype = 67 |
| 6180 | |
| 6181 | def __init__(self, xid=None, data=None): |
| 6182 | if xid != None: |
| 6183 | self.xid = xid |
| 6184 | else: |
| 6185 | self.xid = None |
| 6186 | if data != None: |
| 6187 | self.data = data |
| 6188 | else: |
| 6189 | self.data = '' |
| 6190 | return |
| 6191 | |
| 6192 | def pack(self): |
| 6193 | packed = [] |
| 6194 | packed.append(struct.pack("!B", self.version)) |
| 6195 | packed.append(struct.pack("!B", self.type)) |
| 6196 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6197 | packed.append(struct.pack("!L", self.xid)) |
| 6198 | packed.append(struct.pack("!L", self.experimenter)) |
| 6199 | packed.append(struct.pack("!L", self.subtype)) |
| 6200 | packed.append(self.data) |
| 6201 | length = sum([len(x) for x in packed]) |
| 6202 | packed[2] = struct.pack("!H", length) |
| 6203 | return ''.join(packed) |
| 6204 | |
| 6205 | @staticmethod |
| 6206 | def unpack(reader): |
| 6207 | obj = bsn_lua_notification() |
| 6208 | _version = reader.read("!B")[0] |
| 6209 | assert(_version == 5) |
| 6210 | _type = reader.read("!B")[0] |
| 6211 | assert(_type == 4) |
| 6212 | _length = reader.read("!H")[0] |
| 6213 | orig_reader = reader |
| 6214 | reader = orig_reader.slice(_length, 4) |
| 6215 | obj.xid = reader.read("!L")[0] |
| 6216 | _experimenter = reader.read("!L")[0] |
| 6217 | assert(_experimenter == 6035143) |
| 6218 | _subtype = reader.read("!L")[0] |
| 6219 | assert(_subtype == 67) |
| 6220 | obj.data = str(reader.read_all()) |
| 6221 | return obj |
| 6222 | |
| 6223 | def __eq__(self, other): |
| 6224 | if type(self) != type(other): return False |
| 6225 | if self.xid != other.xid: return False |
| 6226 | if self.data != other.data: return False |
| 6227 | return True |
| 6228 | |
| 6229 | def pretty_print(self, q): |
| 6230 | q.text("bsn_lua_notification {") |
| 6231 | with q.group(): |
| 6232 | with q.indent(2): |
| 6233 | q.breakable() |
| 6234 | q.text("xid = "); |
| 6235 | if self.xid != None: |
| 6236 | q.text("%#x" % self.xid) |
| 6237 | else: |
| 6238 | q.text('None') |
| 6239 | q.text(","); q.breakable() |
| 6240 | q.text("data = "); |
| 6241 | q.pp(self.data) |
| 6242 | q.breakable() |
| 6243 | q.text('}') |
| 6244 | |
| 6245 | bsn_header.subtypes[67] = bsn_lua_notification |
| 6246 | |
| 6247 | class bsn_lua_upload(bsn_header): |
| 6248 | version = 5 |
| 6249 | type = 4 |
| 6250 | experimenter = 6035143 |
| 6251 | subtype = 64 |
| 6252 | |
| 6253 | def __init__(self, xid=None, flags=None, filename=None, data=None): |
| 6254 | if xid != None: |
| 6255 | self.xid = xid |
| 6256 | else: |
| 6257 | self.xid = None |
| 6258 | if flags != None: |
| 6259 | self.flags = flags |
| 6260 | else: |
| 6261 | self.flags = 0 |
| 6262 | if filename != None: |
| 6263 | self.filename = filename |
| 6264 | else: |
| 6265 | self.filename = "" |
| 6266 | if data != None: |
| 6267 | self.data = data |
| 6268 | else: |
| 6269 | self.data = '' |
| 6270 | return |
| 6271 | |
| 6272 | def pack(self): |
| 6273 | packed = [] |
| 6274 | packed.append(struct.pack("!B", self.version)) |
| 6275 | packed.append(struct.pack("!B", self.type)) |
| 6276 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6277 | packed.append(struct.pack("!L", self.xid)) |
| 6278 | packed.append(struct.pack("!L", self.experimenter)) |
| 6279 | packed.append(struct.pack("!L", self.subtype)) |
| 6280 | packed.append(struct.pack("!H", self.flags)) |
| 6281 | packed.append(struct.pack("!64s", self.filename)) |
| 6282 | packed.append(self.data) |
| 6283 | length = sum([len(x) for x in packed]) |
| 6284 | packed[2] = struct.pack("!H", length) |
| 6285 | return ''.join(packed) |
| 6286 | |
| 6287 | @staticmethod |
| 6288 | def unpack(reader): |
| 6289 | obj = bsn_lua_upload() |
| 6290 | _version = reader.read("!B")[0] |
| 6291 | assert(_version == 5) |
| 6292 | _type = reader.read("!B")[0] |
| 6293 | assert(_type == 4) |
| 6294 | _length = reader.read("!H")[0] |
| 6295 | orig_reader = reader |
| 6296 | reader = orig_reader.slice(_length, 4) |
| 6297 | obj.xid = reader.read("!L")[0] |
| 6298 | _experimenter = reader.read("!L")[0] |
| 6299 | assert(_experimenter == 6035143) |
| 6300 | _subtype = reader.read("!L")[0] |
| 6301 | assert(_subtype == 64) |
| 6302 | obj.flags = reader.read("!H")[0] |
| 6303 | obj.filename = reader.read("!64s")[0].rstrip("\x00") |
| 6304 | obj.data = str(reader.read_all()) |
| 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 | if self.filename != other.filename: return False |
| 6312 | if self.data != other.data: return False |
| 6313 | return True |
| 6314 | |
| 6315 | def pretty_print(self, q): |
| 6316 | q.text("bsn_lua_upload {") |
| 6317 | with q.group(): |
| 6318 | with q.indent(2): |
| 6319 | q.breakable() |
| 6320 | q.text("xid = "); |
| 6321 | if self.xid != None: |
| 6322 | q.text("%#x" % self.xid) |
| 6323 | else: |
| 6324 | q.text('None') |
| 6325 | q.text(","); q.breakable() |
| 6326 | q.text("flags = "); |
| 6327 | q.text("%#x" % self.flags) |
| 6328 | q.text(","); q.breakable() |
| 6329 | q.text("filename = "); |
| 6330 | q.pp(self.filename) |
| 6331 | q.text(","); q.breakable() |
| 6332 | q.text("data = "); |
| 6333 | q.pp(self.data) |
| 6334 | q.breakable() |
| 6335 | q.text('}') |
| 6336 | |
| 6337 | bsn_header.subtypes[64] = bsn_lua_upload |
| 6338 | |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 6339 | class bsn_pdu_rx_reply(bsn_header): |
| 6340 | version = 5 |
| 6341 | type = 4 |
| 6342 | experimenter = 6035143 |
| 6343 | subtype = 34 |
| 6344 | |
| 6345 | def __init__(self, xid=None, status=None, port_no=None, slot_num=None): |
| 6346 | if xid != None: |
| 6347 | self.xid = xid |
| 6348 | else: |
| 6349 | self.xid = None |
| 6350 | if status != None: |
| 6351 | self.status = status |
| 6352 | else: |
| 6353 | self.status = 0 |
| 6354 | if port_no != None: |
| 6355 | self.port_no = port_no |
| 6356 | else: |
| 6357 | self.port_no = 0 |
| 6358 | if slot_num != None: |
| 6359 | self.slot_num = slot_num |
| 6360 | else: |
| 6361 | self.slot_num = 0 |
| 6362 | return |
| 6363 | |
| 6364 | def pack(self): |
| 6365 | packed = [] |
| 6366 | packed.append(struct.pack("!B", self.version)) |
| 6367 | packed.append(struct.pack("!B", self.type)) |
| 6368 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6369 | packed.append(struct.pack("!L", self.xid)) |
| 6370 | packed.append(struct.pack("!L", self.experimenter)) |
| 6371 | packed.append(struct.pack("!L", self.subtype)) |
| 6372 | packed.append(struct.pack("!L", self.status)) |
| 6373 | packed.append(util.pack_port_no(self.port_no)) |
| 6374 | packed.append(struct.pack("!B", self.slot_num)) |
| 6375 | length = sum([len(x) for x in packed]) |
| 6376 | packed[2] = struct.pack("!H", length) |
| 6377 | return ''.join(packed) |
| 6378 | |
| 6379 | @staticmethod |
| 6380 | def unpack(reader): |
| 6381 | obj = bsn_pdu_rx_reply() |
| 6382 | _version = reader.read("!B")[0] |
| 6383 | assert(_version == 5) |
| 6384 | _type = reader.read("!B")[0] |
| 6385 | assert(_type == 4) |
| 6386 | _length = reader.read("!H")[0] |
| 6387 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6388 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 6389 | obj.xid = reader.read("!L")[0] |
| 6390 | _experimenter = reader.read("!L")[0] |
| 6391 | assert(_experimenter == 6035143) |
| 6392 | _subtype = reader.read("!L")[0] |
| 6393 | assert(_subtype == 34) |
| 6394 | obj.status = reader.read("!L")[0] |
| 6395 | obj.port_no = util.unpack_port_no(reader) |
| 6396 | obj.slot_num = reader.read("!B")[0] |
| 6397 | return obj |
| 6398 | |
| 6399 | def __eq__(self, other): |
| 6400 | if type(self) != type(other): return False |
| 6401 | if self.xid != other.xid: return False |
| 6402 | if self.status != other.status: return False |
| 6403 | if self.port_no != other.port_no: return False |
| 6404 | if self.slot_num != other.slot_num: return False |
| 6405 | return True |
| 6406 | |
| 6407 | def pretty_print(self, q): |
| 6408 | q.text("bsn_pdu_rx_reply {") |
| 6409 | with q.group(): |
| 6410 | with q.indent(2): |
| 6411 | q.breakable() |
| 6412 | q.text("xid = "); |
| 6413 | if self.xid != None: |
| 6414 | q.text("%#x" % self.xid) |
| 6415 | else: |
| 6416 | q.text('None') |
| 6417 | q.text(","); q.breakable() |
| 6418 | q.text("status = "); |
| 6419 | q.text("%#x" % self.status) |
| 6420 | q.text(","); q.breakable() |
| 6421 | q.text("port_no = "); |
| 6422 | q.text(util.pretty_port(self.port_no)) |
| 6423 | q.text(","); q.breakable() |
| 6424 | q.text("slot_num = "); |
| 6425 | q.text("%#x" % self.slot_num) |
| 6426 | q.breakable() |
| 6427 | q.text('}') |
| 6428 | |
| 6429 | bsn_header.subtypes[34] = bsn_pdu_rx_reply |
| 6430 | |
| 6431 | class bsn_pdu_rx_request(bsn_header): |
| 6432 | version = 5 |
| 6433 | type = 4 |
| 6434 | experimenter = 6035143 |
| 6435 | subtype = 33 |
| 6436 | |
| 6437 | def __init__(self, xid=None, timeout_ms=None, port_no=None, slot_num=None, data=None): |
| 6438 | if xid != None: |
| 6439 | self.xid = xid |
| 6440 | else: |
| 6441 | self.xid = None |
| 6442 | if timeout_ms != None: |
| 6443 | self.timeout_ms = timeout_ms |
| 6444 | else: |
| 6445 | self.timeout_ms = 0 |
| 6446 | if port_no != None: |
| 6447 | self.port_no = port_no |
| 6448 | else: |
| 6449 | self.port_no = 0 |
| 6450 | if slot_num != None: |
| 6451 | self.slot_num = slot_num |
| 6452 | else: |
| 6453 | self.slot_num = 0 |
| 6454 | if data != None: |
| 6455 | self.data = data |
| 6456 | else: |
| 6457 | self.data = '' |
| 6458 | return |
| 6459 | |
| 6460 | def pack(self): |
| 6461 | packed = [] |
| 6462 | packed.append(struct.pack("!B", self.version)) |
| 6463 | packed.append(struct.pack("!B", self.type)) |
| 6464 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6465 | packed.append(struct.pack("!L", self.xid)) |
| 6466 | packed.append(struct.pack("!L", self.experimenter)) |
| 6467 | packed.append(struct.pack("!L", self.subtype)) |
| 6468 | packed.append(struct.pack("!L", self.timeout_ms)) |
| 6469 | packed.append(util.pack_port_no(self.port_no)) |
| 6470 | packed.append(struct.pack("!B", self.slot_num)) |
| 6471 | packed.append('\x00' * 3) |
| 6472 | packed.append(self.data) |
| 6473 | length = sum([len(x) for x in packed]) |
| 6474 | packed[2] = struct.pack("!H", length) |
| 6475 | return ''.join(packed) |
| 6476 | |
| 6477 | @staticmethod |
| 6478 | def unpack(reader): |
| 6479 | obj = bsn_pdu_rx_request() |
| 6480 | _version = reader.read("!B")[0] |
| 6481 | assert(_version == 5) |
| 6482 | _type = reader.read("!B")[0] |
| 6483 | assert(_type == 4) |
| 6484 | _length = reader.read("!H")[0] |
| 6485 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6486 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 6487 | obj.xid = reader.read("!L")[0] |
| 6488 | _experimenter = reader.read("!L")[0] |
| 6489 | assert(_experimenter == 6035143) |
| 6490 | _subtype = reader.read("!L")[0] |
| 6491 | assert(_subtype == 33) |
| 6492 | obj.timeout_ms = reader.read("!L")[0] |
| 6493 | obj.port_no = util.unpack_port_no(reader) |
| 6494 | obj.slot_num = reader.read("!B")[0] |
| 6495 | reader.skip(3) |
| 6496 | obj.data = str(reader.read_all()) |
| 6497 | return obj |
| 6498 | |
| 6499 | def __eq__(self, other): |
| 6500 | if type(self) != type(other): return False |
| 6501 | if self.xid != other.xid: return False |
| 6502 | if self.timeout_ms != other.timeout_ms: return False |
| 6503 | if self.port_no != other.port_no: return False |
| 6504 | if self.slot_num != other.slot_num: return False |
| 6505 | if self.data != other.data: return False |
| 6506 | return True |
| 6507 | |
| 6508 | def pretty_print(self, q): |
| 6509 | q.text("bsn_pdu_rx_request {") |
| 6510 | with q.group(): |
| 6511 | with q.indent(2): |
| 6512 | q.breakable() |
| 6513 | q.text("xid = "); |
| 6514 | if self.xid != None: |
| 6515 | q.text("%#x" % self.xid) |
| 6516 | else: |
| 6517 | q.text('None') |
| 6518 | q.text(","); q.breakable() |
| 6519 | q.text("timeout_ms = "); |
| 6520 | q.text("%#x" % self.timeout_ms) |
| 6521 | q.text(","); q.breakable() |
| 6522 | q.text("port_no = "); |
| 6523 | q.text(util.pretty_port(self.port_no)) |
| 6524 | q.text(","); q.breakable() |
| 6525 | q.text("slot_num = "); |
| 6526 | q.text("%#x" % self.slot_num) |
| 6527 | q.text(","); q.breakable() |
| 6528 | q.text("data = "); |
| 6529 | q.pp(self.data) |
| 6530 | q.breakable() |
| 6531 | q.text('}') |
| 6532 | |
| 6533 | bsn_header.subtypes[33] = bsn_pdu_rx_request |
| 6534 | |
| 6535 | class bsn_pdu_rx_timeout(bsn_header): |
| 6536 | version = 5 |
| 6537 | type = 4 |
| 6538 | experimenter = 6035143 |
| 6539 | subtype = 35 |
| 6540 | |
| 6541 | def __init__(self, xid=None, port_no=None, slot_num=None): |
| 6542 | if xid != None: |
| 6543 | self.xid = xid |
| 6544 | else: |
| 6545 | self.xid = None |
| 6546 | if port_no != None: |
| 6547 | self.port_no = port_no |
| 6548 | else: |
| 6549 | self.port_no = 0 |
| 6550 | if slot_num != None: |
| 6551 | self.slot_num = slot_num |
| 6552 | else: |
| 6553 | self.slot_num = 0 |
| 6554 | return |
| 6555 | |
| 6556 | def pack(self): |
| 6557 | packed = [] |
| 6558 | packed.append(struct.pack("!B", self.version)) |
| 6559 | packed.append(struct.pack("!B", self.type)) |
| 6560 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6561 | packed.append(struct.pack("!L", self.xid)) |
| 6562 | packed.append(struct.pack("!L", self.experimenter)) |
| 6563 | packed.append(struct.pack("!L", self.subtype)) |
| 6564 | packed.append(util.pack_port_no(self.port_no)) |
| 6565 | packed.append(struct.pack("!B", self.slot_num)) |
| 6566 | length = sum([len(x) for x in packed]) |
| 6567 | packed[2] = struct.pack("!H", length) |
| 6568 | return ''.join(packed) |
| 6569 | |
| 6570 | @staticmethod |
| 6571 | def unpack(reader): |
| 6572 | obj = bsn_pdu_rx_timeout() |
| 6573 | _version = reader.read("!B")[0] |
| 6574 | assert(_version == 5) |
| 6575 | _type = reader.read("!B")[0] |
| 6576 | assert(_type == 4) |
| 6577 | _length = reader.read("!H")[0] |
| 6578 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6579 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 6580 | obj.xid = reader.read("!L")[0] |
| 6581 | _experimenter = reader.read("!L")[0] |
| 6582 | assert(_experimenter == 6035143) |
| 6583 | _subtype = reader.read("!L")[0] |
| 6584 | assert(_subtype == 35) |
| 6585 | obj.port_no = util.unpack_port_no(reader) |
| 6586 | obj.slot_num = reader.read("!B")[0] |
| 6587 | return obj |
| 6588 | |
| 6589 | def __eq__(self, other): |
| 6590 | if type(self) != type(other): return False |
| 6591 | if self.xid != other.xid: return False |
| 6592 | if self.port_no != other.port_no: return False |
| 6593 | if self.slot_num != other.slot_num: return False |
| 6594 | return True |
| 6595 | |
| 6596 | def pretty_print(self, q): |
| 6597 | q.text("bsn_pdu_rx_timeout {") |
| 6598 | with q.group(): |
| 6599 | with q.indent(2): |
| 6600 | q.breakable() |
| 6601 | q.text("xid = "); |
| 6602 | if self.xid != None: |
| 6603 | q.text("%#x" % self.xid) |
| 6604 | else: |
| 6605 | q.text('None') |
| 6606 | q.text(","); q.breakable() |
| 6607 | q.text("port_no = "); |
| 6608 | q.text(util.pretty_port(self.port_no)) |
| 6609 | q.text(","); q.breakable() |
| 6610 | q.text("slot_num = "); |
| 6611 | q.text("%#x" % self.slot_num) |
| 6612 | q.breakable() |
| 6613 | q.text('}') |
| 6614 | |
| 6615 | bsn_header.subtypes[35] = bsn_pdu_rx_timeout |
| 6616 | |
| 6617 | class bsn_pdu_tx_reply(bsn_header): |
| 6618 | version = 5 |
| 6619 | type = 4 |
| 6620 | experimenter = 6035143 |
| 6621 | subtype = 32 |
| 6622 | |
| 6623 | def __init__(self, xid=None, status=None, port_no=None, slot_num=None): |
| 6624 | if xid != None: |
| 6625 | self.xid = xid |
| 6626 | else: |
| 6627 | self.xid = None |
| 6628 | if status != None: |
| 6629 | self.status = status |
| 6630 | else: |
| 6631 | self.status = 0 |
| 6632 | if port_no != None: |
| 6633 | self.port_no = port_no |
| 6634 | else: |
| 6635 | self.port_no = 0 |
| 6636 | if slot_num != None: |
| 6637 | self.slot_num = slot_num |
| 6638 | else: |
| 6639 | self.slot_num = 0 |
| 6640 | return |
| 6641 | |
| 6642 | def pack(self): |
| 6643 | packed = [] |
| 6644 | packed.append(struct.pack("!B", self.version)) |
| 6645 | packed.append(struct.pack("!B", self.type)) |
| 6646 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6647 | packed.append(struct.pack("!L", self.xid)) |
| 6648 | packed.append(struct.pack("!L", self.experimenter)) |
| 6649 | packed.append(struct.pack("!L", self.subtype)) |
| 6650 | packed.append(struct.pack("!L", self.status)) |
| 6651 | packed.append(util.pack_port_no(self.port_no)) |
| 6652 | packed.append(struct.pack("!B", self.slot_num)) |
| 6653 | length = sum([len(x) for x in packed]) |
| 6654 | packed[2] = struct.pack("!H", length) |
| 6655 | return ''.join(packed) |
| 6656 | |
| 6657 | @staticmethod |
| 6658 | def unpack(reader): |
| 6659 | obj = bsn_pdu_tx_reply() |
| 6660 | _version = reader.read("!B")[0] |
| 6661 | assert(_version == 5) |
| 6662 | _type = reader.read("!B")[0] |
| 6663 | assert(_type == 4) |
| 6664 | _length = reader.read("!H")[0] |
| 6665 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6666 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 6667 | obj.xid = reader.read("!L")[0] |
| 6668 | _experimenter = reader.read("!L")[0] |
| 6669 | assert(_experimenter == 6035143) |
| 6670 | _subtype = reader.read("!L")[0] |
| 6671 | assert(_subtype == 32) |
| 6672 | obj.status = reader.read("!L")[0] |
| 6673 | obj.port_no = util.unpack_port_no(reader) |
| 6674 | obj.slot_num = reader.read("!B")[0] |
| 6675 | return obj |
| 6676 | |
| 6677 | def __eq__(self, other): |
| 6678 | if type(self) != type(other): return False |
| 6679 | if self.xid != other.xid: return False |
| 6680 | if self.status != other.status: return False |
| 6681 | if self.port_no != other.port_no: return False |
| 6682 | if self.slot_num != other.slot_num: return False |
| 6683 | return True |
| 6684 | |
| 6685 | def pretty_print(self, q): |
| 6686 | q.text("bsn_pdu_tx_reply {") |
| 6687 | with q.group(): |
| 6688 | with q.indent(2): |
| 6689 | q.breakable() |
| 6690 | q.text("xid = "); |
| 6691 | if self.xid != None: |
| 6692 | q.text("%#x" % self.xid) |
| 6693 | else: |
| 6694 | q.text('None') |
| 6695 | q.text(","); q.breakable() |
| 6696 | q.text("status = "); |
| 6697 | q.text("%#x" % self.status) |
| 6698 | q.text(","); q.breakable() |
| 6699 | q.text("port_no = "); |
| 6700 | q.text(util.pretty_port(self.port_no)) |
| 6701 | q.text(","); q.breakable() |
| 6702 | q.text("slot_num = "); |
| 6703 | q.text("%#x" % self.slot_num) |
| 6704 | q.breakable() |
| 6705 | q.text('}') |
| 6706 | |
| 6707 | bsn_header.subtypes[32] = bsn_pdu_tx_reply |
| 6708 | |
| 6709 | class bsn_pdu_tx_request(bsn_header): |
| 6710 | version = 5 |
| 6711 | type = 4 |
| 6712 | experimenter = 6035143 |
| 6713 | subtype = 31 |
| 6714 | |
| 6715 | def __init__(self, xid=None, tx_interval_ms=None, port_no=None, slot_num=None, data=None): |
| 6716 | if xid != None: |
| 6717 | self.xid = xid |
| 6718 | else: |
| 6719 | self.xid = None |
| 6720 | if tx_interval_ms != None: |
| 6721 | self.tx_interval_ms = tx_interval_ms |
| 6722 | else: |
| 6723 | self.tx_interval_ms = 0 |
| 6724 | if port_no != None: |
| 6725 | self.port_no = port_no |
| 6726 | else: |
| 6727 | self.port_no = 0 |
| 6728 | if slot_num != None: |
| 6729 | self.slot_num = slot_num |
| 6730 | else: |
| 6731 | self.slot_num = 0 |
| 6732 | if data != None: |
| 6733 | self.data = data |
| 6734 | else: |
| 6735 | self.data = '' |
| 6736 | return |
| 6737 | |
| 6738 | def pack(self): |
| 6739 | packed = [] |
| 6740 | packed.append(struct.pack("!B", self.version)) |
| 6741 | packed.append(struct.pack("!B", self.type)) |
| 6742 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6743 | packed.append(struct.pack("!L", self.xid)) |
| 6744 | packed.append(struct.pack("!L", self.experimenter)) |
| 6745 | packed.append(struct.pack("!L", self.subtype)) |
| 6746 | packed.append(struct.pack("!L", self.tx_interval_ms)) |
| 6747 | packed.append(util.pack_port_no(self.port_no)) |
| 6748 | packed.append(struct.pack("!B", self.slot_num)) |
| 6749 | packed.append('\x00' * 3) |
| 6750 | packed.append(self.data) |
| 6751 | length = sum([len(x) for x in packed]) |
| 6752 | packed[2] = struct.pack("!H", length) |
| 6753 | return ''.join(packed) |
| 6754 | |
| 6755 | @staticmethod |
| 6756 | def unpack(reader): |
| 6757 | obj = bsn_pdu_tx_request() |
| 6758 | _version = reader.read("!B")[0] |
| 6759 | assert(_version == 5) |
| 6760 | _type = reader.read("!B")[0] |
| 6761 | assert(_type == 4) |
| 6762 | _length = reader.read("!H")[0] |
| 6763 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6764 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 6765 | obj.xid = reader.read("!L")[0] |
| 6766 | _experimenter = reader.read("!L")[0] |
| 6767 | assert(_experimenter == 6035143) |
| 6768 | _subtype = reader.read("!L")[0] |
| 6769 | assert(_subtype == 31) |
| 6770 | obj.tx_interval_ms = reader.read("!L")[0] |
| 6771 | obj.port_no = util.unpack_port_no(reader) |
| 6772 | obj.slot_num = reader.read("!B")[0] |
| 6773 | reader.skip(3) |
| 6774 | obj.data = str(reader.read_all()) |
| 6775 | return obj |
| 6776 | |
| 6777 | def __eq__(self, other): |
| 6778 | if type(self) != type(other): return False |
| 6779 | if self.xid != other.xid: return False |
| 6780 | if self.tx_interval_ms != other.tx_interval_ms: return False |
| 6781 | if self.port_no != other.port_no: return False |
| 6782 | if self.slot_num != other.slot_num: return False |
| 6783 | if self.data != other.data: return False |
| 6784 | return True |
| 6785 | |
| 6786 | def pretty_print(self, q): |
| 6787 | q.text("bsn_pdu_tx_request {") |
| 6788 | with q.group(): |
| 6789 | with q.indent(2): |
| 6790 | q.breakable() |
| 6791 | q.text("xid = "); |
| 6792 | if self.xid != None: |
| 6793 | q.text("%#x" % self.xid) |
| 6794 | else: |
| 6795 | q.text('None') |
| 6796 | q.text(","); q.breakable() |
| 6797 | q.text("tx_interval_ms = "); |
| 6798 | q.text("%#x" % self.tx_interval_ms) |
| 6799 | q.text(","); q.breakable() |
| 6800 | q.text("port_no = "); |
| 6801 | q.text(util.pretty_port(self.port_no)) |
| 6802 | q.text(","); q.breakable() |
| 6803 | q.text("slot_num = "); |
| 6804 | q.text("%#x" % self.slot_num) |
| 6805 | q.text(","); q.breakable() |
| 6806 | q.text("data = "); |
| 6807 | q.pp(self.data) |
| 6808 | q.breakable() |
| 6809 | q.text('}') |
| 6810 | |
| 6811 | bsn_header.subtypes[31] = bsn_pdu_tx_request |
| 6812 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 6813 | class bsn_port_counter_stats_reply(bsn_stats_reply): |
| 6814 | version = 5 |
| 6815 | type = 19 |
| 6816 | stats_type = 65535 |
| 6817 | experimenter = 6035143 |
| 6818 | subtype = 8 |
| 6819 | |
| 6820 | def __init__(self, xid=None, flags=None, entries=None): |
| 6821 | if xid != None: |
| 6822 | self.xid = xid |
| 6823 | else: |
| 6824 | self.xid = None |
| 6825 | if flags != None: |
| 6826 | self.flags = flags |
| 6827 | else: |
| 6828 | self.flags = 0 |
| 6829 | if entries != None: |
| 6830 | self.entries = entries |
| 6831 | else: |
| 6832 | self.entries = [] |
| 6833 | return |
| 6834 | |
| 6835 | def pack(self): |
| 6836 | packed = [] |
| 6837 | packed.append(struct.pack("!B", self.version)) |
| 6838 | packed.append(struct.pack("!B", self.type)) |
| 6839 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6840 | packed.append(struct.pack("!L", self.xid)) |
| 6841 | packed.append(struct.pack("!H", self.stats_type)) |
| 6842 | packed.append(struct.pack("!H", self.flags)) |
| 6843 | packed.append('\x00' * 4) |
| 6844 | packed.append(struct.pack("!L", self.experimenter)) |
| 6845 | packed.append(struct.pack("!L", self.subtype)) |
| 6846 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 6847 | length = sum([len(x) for x in packed]) |
| 6848 | packed[2] = struct.pack("!H", length) |
| 6849 | return ''.join(packed) |
| 6850 | |
| 6851 | @staticmethod |
| 6852 | def unpack(reader): |
| 6853 | obj = bsn_port_counter_stats_reply() |
| 6854 | _version = reader.read("!B")[0] |
| 6855 | assert(_version == 5) |
| 6856 | _type = reader.read("!B")[0] |
| 6857 | assert(_type == 19) |
| 6858 | _length = reader.read("!H")[0] |
| 6859 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6860 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 6861 | obj.xid = reader.read("!L")[0] |
| 6862 | _stats_type = reader.read("!H")[0] |
| 6863 | assert(_stats_type == 65535) |
| 6864 | obj.flags = reader.read("!H")[0] |
| 6865 | reader.skip(4) |
| 6866 | _experimenter = reader.read("!L")[0] |
| 6867 | assert(_experimenter == 6035143) |
| 6868 | _subtype = reader.read("!L")[0] |
| 6869 | assert(_subtype == 8) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 6870 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_port_counter_stats_entry.unpack) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 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.entries != other.entries: return False |
| 6878 | return True |
| 6879 | |
| 6880 | def pretty_print(self, q): |
| 6881 | q.text("bsn_port_counter_stats_reply {") |
| 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("entries = "); |
| 6895 | q.pp(self.entries) |
| 6896 | q.breakable() |
| 6897 | q.text('}') |
| 6898 | |
| 6899 | bsn_stats_reply.subtypes[8] = bsn_port_counter_stats_reply |
| 6900 | |
| 6901 | class bsn_port_counter_stats_request(bsn_stats_request): |
| 6902 | version = 5 |
| 6903 | type = 18 |
| 6904 | stats_type = 65535 |
| 6905 | experimenter = 6035143 |
| 6906 | subtype = 8 |
| 6907 | |
| 6908 | def __init__(self, xid=None, flags=None, port_no=None): |
| 6909 | if xid != None: |
| 6910 | self.xid = xid |
| 6911 | else: |
| 6912 | self.xid = None |
| 6913 | if flags != None: |
| 6914 | self.flags = flags |
| 6915 | else: |
| 6916 | self.flags = 0 |
| 6917 | if port_no != None: |
| 6918 | self.port_no = port_no |
| 6919 | else: |
| 6920 | self.port_no = 0 |
| 6921 | return |
| 6922 | |
| 6923 | def pack(self): |
| 6924 | packed = [] |
| 6925 | packed.append(struct.pack("!B", self.version)) |
| 6926 | packed.append(struct.pack("!B", self.type)) |
| 6927 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6928 | packed.append(struct.pack("!L", self.xid)) |
| 6929 | packed.append(struct.pack("!H", self.stats_type)) |
| 6930 | packed.append(struct.pack("!H", self.flags)) |
| 6931 | packed.append('\x00' * 4) |
| 6932 | packed.append(struct.pack("!L", self.experimenter)) |
| 6933 | packed.append(struct.pack("!L", self.subtype)) |
| 6934 | packed.append(util.pack_port_no(self.port_no)) |
| 6935 | length = sum([len(x) for x in packed]) |
| 6936 | packed[2] = struct.pack("!H", length) |
| 6937 | return ''.join(packed) |
| 6938 | |
| 6939 | @staticmethod |
| 6940 | def unpack(reader): |
| 6941 | obj = bsn_port_counter_stats_request() |
| 6942 | _version = reader.read("!B")[0] |
| 6943 | assert(_version == 5) |
| 6944 | _type = reader.read("!B")[0] |
| 6945 | assert(_type == 18) |
| 6946 | _length = reader.read("!H")[0] |
| 6947 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6948 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 6949 | obj.xid = reader.read("!L")[0] |
| 6950 | _stats_type = reader.read("!H")[0] |
| 6951 | assert(_stats_type == 65535) |
| 6952 | obj.flags = reader.read("!H")[0] |
| 6953 | reader.skip(4) |
| 6954 | _experimenter = reader.read("!L")[0] |
| 6955 | assert(_experimenter == 6035143) |
| 6956 | _subtype = reader.read("!L")[0] |
| 6957 | assert(_subtype == 8) |
| 6958 | obj.port_no = util.unpack_port_no(reader) |
| 6959 | return obj |
| 6960 | |
| 6961 | def __eq__(self, other): |
| 6962 | if type(self) != type(other): return False |
| 6963 | if self.xid != other.xid: return False |
| 6964 | if self.flags != other.flags: return False |
| 6965 | if self.port_no != other.port_no: return False |
| 6966 | return True |
| 6967 | |
| 6968 | def pretty_print(self, q): |
| 6969 | q.text("bsn_port_counter_stats_request {") |
| 6970 | with q.group(): |
| 6971 | with q.indent(2): |
| 6972 | q.breakable() |
| 6973 | q.text("xid = "); |
| 6974 | if self.xid != None: |
| 6975 | q.text("%#x" % self.xid) |
| 6976 | else: |
| 6977 | q.text('None') |
| 6978 | q.text(","); q.breakable() |
| 6979 | q.text("flags = "); |
| 6980 | q.text("%#x" % self.flags) |
| 6981 | q.text(","); q.breakable() |
| 6982 | q.text("port_no = "); |
| 6983 | q.text(util.pretty_port(self.port_no)) |
| 6984 | q.breakable() |
| 6985 | q.text('}') |
| 6986 | |
| 6987 | bsn_stats_request.subtypes[8] = bsn_port_counter_stats_request |
| 6988 | |
| 6989 | class bsn_set_aux_cxns_reply(bsn_header): |
| 6990 | version = 5 |
| 6991 | type = 4 |
| 6992 | experimenter = 6035143 |
| 6993 | subtype = 59 |
| 6994 | |
| 6995 | def __init__(self, xid=None, num_aux=None, status=None): |
| 6996 | if xid != None: |
| 6997 | self.xid = xid |
| 6998 | else: |
| 6999 | self.xid = None |
| 7000 | if num_aux != None: |
| 7001 | self.num_aux = num_aux |
| 7002 | else: |
| 7003 | self.num_aux = 0 |
| 7004 | if status != None: |
| 7005 | self.status = status |
| 7006 | else: |
| 7007 | self.status = 0 |
| 7008 | return |
| 7009 | |
| 7010 | def pack(self): |
| 7011 | packed = [] |
| 7012 | packed.append(struct.pack("!B", self.version)) |
| 7013 | packed.append(struct.pack("!B", self.type)) |
| 7014 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7015 | packed.append(struct.pack("!L", self.xid)) |
| 7016 | packed.append(struct.pack("!L", self.experimenter)) |
| 7017 | packed.append(struct.pack("!L", self.subtype)) |
| 7018 | packed.append(struct.pack("!L", self.num_aux)) |
| 7019 | packed.append(struct.pack("!L", self.status)) |
| 7020 | length = sum([len(x) for x in packed]) |
| 7021 | packed[2] = struct.pack("!H", length) |
| 7022 | return ''.join(packed) |
| 7023 | |
| 7024 | @staticmethod |
| 7025 | def unpack(reader): |
| 7026 | obj = bsn_set_aux_cxns_reply() |
| 7027 | _version = reader.read("!B")[0] |
| 7028 | assert(_version == 5) |
| 7029 | _type = reader.read("!B")[0] |
| 7030 | assert(_type == 4) |
| 7031 | _length = reader.read("!H")[0] |
| 7032 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7033 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7034 | obj.xid = reader.read("!L")[0] |
| 7035 | _experimenter = reader.read("!L")[0] |
| 7036 | assert(_experimenter == 6035143) |
| 7037 | _subtype = reader.read("!L")[0] |
| 7038 | assert(_subtype == 59) |
| 7039 | obj.num_aux = reader.read("!L")[0] |
| 7040 | obj.status = reader.read("!L")[0] |
| 7041 | return obj |
| 7042 | |
| 7043 | def __eq__(self, other): |
| 7044 | if type(self) != type(other): return False |
| 7045 | if self.xid != other.xid: return False |
| 7046 | if self.num_aux != other.num_aux: return False |
| 7047 | if self.status != other.status: return False |
| 7048 | return True |
| 7049 | |
| 7050 | def pretty_print(self, q): |
| 7051 | q.text("bsn_set_aux_cxns_reply {") |
| 7052 | with q.group(): |
| 7053 | with q.indent(2): |
| 7054 | q.breakable() |
| 7055 | q.text("xid = "); |
| 7056 | if self.xid != None: |
| 7057 | q.text("%#x" % self.xid) |
| 7058 | else: |
| 7059 | q.text('None') |
| 7060 | q.text(","); q.breakable() |
| 7061 | q.text("num_aux = "); |
| 7062 | q.text("%#x" % self.num_aux) |
| 7063 | q.text(","); q.breakable() |
| 7064 | q.text("status = "); |
| 7065 | q.text("%#x" % self.status) |
| 7066 | q.breakable() |
| 7067 | q.text('}') |
| 7068 | |
| 7069 | bsn_header.subtypes[59] = bsn_set_aux_cxns_reply |
| 7070 | |
| 7071 | class bsn_set_aux_cxns_request(bsn_header): |
| 7072 | version = 5 |
| 7073 | type = 4 |
| 7074 | experimenter = 6035143 |
| 7075 | subtype = 58 |
| 7076 | |
| 7077 | def __init__(self, xid=None, num_aux=None): |
| 7078 | if xid != None: |
| 7079 | self.xid = xid |
| 7080 | else: |
| 7081 | self.xid = None |
| 7082 | if num_aux != None: |
| 7083 | self.num_aux = num_aux |
| 7084 | else: |
| 7085 | self.num_aux = 0 |
| 7086 | return |
| 7087 | |
| 7088 | def pack(self): |
| 7089 | packed = [] |
| 7090 | packed.append(struct.pack("!B", self.version)) |
| 7091 | packed.append(struct.pack("!B", self.type)) |
| 7092 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7093 | packed.append(struct.pack("!L", self.xid)) |
| 7094 | packed.append(struct.pack("!L", self.experimenter)) |
| 7095 | packed.append(struct.pack("!L", self.subtype)) |
| 7096 | packed.append(struct.pack("!L", self.num_aux)) |
| 7097 | length = sum([len(x) for x in packed]) |
| 7098 | packed[2] = struct.pack("!H", length) |
| 7099 | return ''.join(packed) |
| 7100 | |
| 7101 | @staticmethod |
| 7102 | def unpack(reader): |
| 7103 | obj = bsn_set_aux_cxns_request() |
| 7104 | _version = reader.read("!B")[0] |
| 7105 | assert(_version == 5) |
| 7106 | _type = reader.read("!B")[0] |
| 7107 | assert(_type == 4) |
| 7108 | _length = reader.read("!H")[0] |
| 7109 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7110 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7111 | obj.xid = reader.read("!L")[0] |
| 7112 | _experimenter = reader.read("!L")[0] |
| 7113 | assert(_experimenter == 6035143) |
| 7114 | _subtype = reader.read("!L")[0] |
| 7115 | assert(_subtype == 58) |
| 7116 | obj.num_aux = reader.read("!L")[0] |
| 7117 | return obj |
| 7118 | |
| 7119 | def __eq__(self, other): |
| 7120 | if type(self) != type(other): return False |
| 7121 | if self.xid != other.xid: return False |
| 7122 | if self.num_aux != other.num_aux: return False |
| 7123 | return True |
| 7124 | |
| 7125 | def pretty_print(self, q): |
| 7126 | q.text("bsn_set_aux_cxns_request {") |
| 7127 | with q.group(): |
| 7128 | with q.indent(2): |
| 7129 | q.breakable() |
| 7130 | q.text("xid = "); |
| 7131 | if self.xid != None: |
| 7132 | q.text("%#x" % self.xid) |
| 7133 | else: |
| 7134 | q.text('None') |
| 7135 | q.text(","); q.breakable() |
| 7136 | q.text("num_aux = "); |
| 7137 | q.text("%#x" % self.num_aux) |
| 7138 | q.breakable() |
| 7139 | q.text('}') |
| 7140 | |
| 7141 | bsn_header.subtypes[58] = bsn_set_aux_cxns_request |
| 7142 | |
| 7143 | class bsn_set_lacp_reply(bsn_header): |
| 7144 | version = 5 |
| 7145 | type = 4 |
| 7146 | experimenter = 6035143 |
| 7147 | subtype = 42 |
| 7148 | |
| 7149 | def __init__(self, xid=None, status=None, port_no=None): |
| 7150 | if xid != None: |
| 7151 | self.xid = xid |
| 7152 | else: |
| 7153 | self.xid = None |
| 7154 | if status != None: |
| 7155 | self.status = status |
| 7156 | else: |
| 7157 | self.status = 0 |
| 7158 | if port_no != None: |
| 7159 | self.port_no = port_no |
| 7160 | else: |
| 7161 | self.port_no = 0 |
| 7162 | return |
| 7163 | |
| 7164 | def pack(self): |
| 7165 | packed = [] |
| 7166 | packed.append(struct.pack("!B", self.version)) |
| 7167 | packed.append(struct.pack("!B", self.type)) |
| 7168 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7169 | packed.append(struct.pack("!L", self.xid)) |
| 7170 | packed.append(struct.pack("!L", self.experimenter)) |
| 7171 | packed.append(struct.pack("!L", self.subtype)) |
| 7172 | packed.append(struct.pack("!L", self.status)) |
| 7173 | packed.append(util.pack_port_no(self.port_no)) |
| 7174 | length = sum([len(x) for x in packed]) |
| 7175 | packed[2] = struct.pack("!H", length) |
| 7176 | return ''.join(packed) |
| 7177 | |
| 7178 | @staticmethod |
| 7179 | def unpack(reader): |
| 7180 | obj = bsn_set_lacp_reply() |
| 7181 | _version = reader.read("!B")[0] |
| 7182 | assert(_version == 5) |
| 7183 | _type = reader.read("!B")[0] |
| 7184 | assert(_type == 4) |
| 7185 | _length = reader.read("!H")[0] |
| 7186 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7187 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7188 | obj.xid = reader.read("!L")[0] |
| 7189 | _experimenter = reader.read("!L")[0] |
| 7190 | assert(_experimenter == 6035143) |
| 7191 | _subtype = reader.read("!L")[0] |
| 7192 | assert(_subtype == 42) |
| 7193 | obj.status = reader.read("!L")[0] |
| 7194 | obj.port_no = util.unpack_port_no(reader) |
| 7195 | return obj |
| 7196 | |
| 7197 | def __eq__(self, other): |
| 7198 | if type(self) != type(other): return False |
| 7199 | if self.xid != other.xid: return False |
| 7200 | if self.status != other.status: return False |
| 7201 | if self.port_no != other.port_no: return False |
| 7202 | return True |
| 7203 | |
| 7204 | def pretty_print(self, q): |
| 7205 | q.text("bsn_set_lacp_reply {") |
| 7206 | with q.group(): |
| 7207 | with q.indent(2): |
| 7208 | q.breakable() |
| 7209 | q.text("xid = "); |
| 7210 | if self.xid != None: |
| 7211 | q.text("%#x" % self.xid) |
| 7212 | else: |
| 7213 | q.text('None') |
| 7214 | q.text(","); q.breakable() |
| 7215 | q.text("status = "); |
| 7216 | q.text("%#x" % self.status) |
| 7217 | q.text(","); q.breakable() |
| 7218 | q.text("port_no = "); |
| 7219 | q.text(util.pretty_port(self.port_no)) |
| 7220 | q.breakable() |
| 7221 | q.text('}') |
| 7222 | |
| 7223 | bsn_header.subtypes[42] = bsn_set_lacp_reply |
| 7224 | |
| 7225 | class bsn_set_lacp_request(bsn_header): |
| 7226 | version = 5 |
| 7227 | type = 4 |
| 7228 | experimenter = 6035143 |
| 7229 | subtype = 41 |
| 7230 | |
| 7231 | def __init__(self, xid=None, enabled=None, port_no=None, actor_sys_priority=None, actor_sys_mac=None, actor_port_priority=None, actor_port_num=None, actor_key=None): |
| 7232 | if xid != None: |
| 7233 | self.xid = xid |
| 7234 | else: |
| 7235 | self.xid = None |
| 7236 | if enabled != None: |
| 7237 | self.enabled = enabled |
| 7238 | else: |
| 7239 | self.enabled = 0 |
| 7240 | if port_no != None: |
| 7241 | self.port_no = port_no |
| 7242 | else: |
| 7243 | self.port_no = 0 |
| 7244 | if actor_sys_priority != None: |
| 7245 | self.actor_sys_priority = actor_sys_priority |
| 7246 | else: |
| 7247 | self.actor_sys_priority = 0 |
| 7248 | if actor_sys_mac != None: |
| 7249 | self.actor_sys_mac = actor_sys_mac |
| 7250 | else: |
| 7251 | self.actor_sys_mac = [0,0,0,0,0,0] |
| 7252 | if actor_port_priority != None: |
| 7253 | self.actor_port_priority = actor_port_priority |
| 7254 | else: |
| 7255 | self.actor_port_priority = 0 |
| 7256 | if actor_port_num != None: |
| 7257 | self.actor_port_num = actor_port_num |
| 7258 | else: |
| 7259 | self.actor_port_num = 0 |
| 7260 | if actor_key != None: |
| 7261 | self.actor_key = actor_key |
| 7262 | else: |
| 7263 | self.actor_key = 0 |
| 7264 | return |
| 7265 | |
| 7266 | def pack(self): |
| 7267 | packed = [] |
| 7268 | packed.append(struct.pack("!B", self.version)) |
| 7269 | packed.append(struct.pack("!B", self.type)) |
| 7270 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7271 | packed.append(struct.pack("!L", self.xid)) |
| 7272 | packed.append(struct.pack("!L", self.experimenter)) |
| 7273 | packed.append(struct.pack("!L", self.subtype)) |
| 7274 | packed.append(struct.pack("!B", self.enabled)) |
| 7275 | packed.append('\x00' * 3) |
| 7276 | packed.append(util.pack_port_no(self.port_no)) |
| 7277 | packed.append(struct.pack("!H", self.actor_sys_priority)) |
| 7278 | packed.append(struct.pack("!6B", *self.actor_sys_mac)) |
| 7279 | packed.append(struct.pack("!H", self.actor_port_priority)) |
| 7280 | packed.append(struct.pack("!H", self.actor_port_num)) |
| 7281 | packed.append(struct.pack("!H", self.actor_key)) |
| 7282 | length = sum([len(x) for x in packed]) |
| 7283 | packed[2] = struct.pack("!H", length) |
| 7284 | return ''.join(packed) |
| 7285 | |
| 7286 | @staticmethod |
| 7287 | def unpack(reader): |
| 7288 | obj = bsn_set_lacp_request() |
| 7289 | _version = reader.read("!B")[0] |
| 7290 | assert(_version == 5) |
| 7291 | _type = reader.read("!B")[0] |
| 7292 | assert(_type == 4) |
| 7293 | _length = reader.read("!H")[0] |
| 7294 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7295 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7296 | obj.xid = reader.read("!L")[0] |
| 7297 | _experimenter = reader.read("!L")[0] |
| 7298 | assert(_experimenter == 6035143) |
| 7299 | _subtype = reader.read("!L")[0] |
| 7300 | assert(_subtype == 41) |
| 7301 | obj.enabled = reader.read("!B")[0] |
| 7302 | reader.skip(3) |
| 7303 | obj.port_no = util.unpack_port_no(reader) |
| 7304 | obj.actor_sys_priority = reader.read("!H")[0] |
| 7305 | obj.actor_sys_mac = list(reader.read('!6B')) |
| 7306 | obj.actor_port_priority = reader.read("!H")[0] |
| 7307 | obj.actor_port_num = reader.read("!H")[0] |
| 7308 | obj.actor_key = reader.read("!H")[0] |
| 7309 | return obj |
| 7310 | |
| 7311 | def __eq__(self, other): |
| 7312 | if type(self) != type(other): return False |
| 7313 | if self.xid != other.xid: return False |
| 7314 | if self.enabled != other.enabled: return False |
| 7315 | if self.port_no != other.port_no: return False |
| 7316 | if self.actor_sys_priority != other.actor_sys_priority: return False |
| 7317 | if self.actor_sys_mac != other.actor_sys_mac: return False |
| 7318 | if self.actor_port_priority != other.actor_port_priority: return False |
| 7319 | if self.actor_port_num != other.actor_port_num: return False |
| 7320 | if self.actor_key != other.actor_key: return False |
| 7321 | return True |
| 7322 | |
| 7323 | def pretty_print(self, q): |
| 7324 | q.text("bsn_set_lacp_request {") |
| 7325 | with q.group(): |
| 7326 | with q.indent(2): |
| 7327 | q.breakable() |
| 7328 | q.text("xid = "); |
| 7329 | if self.xid != None: |
| 7330 | q.text("%#x" % self.xid) |
| 7331 | else: |
| 7332 | q.text('None') |
| 7333 | q.text(","); q.breakable() |
| 7334 | q.text("enabled = "); |
| 7335 | q.text("%#x" % self.enabled) |
| 7336 | q.text(","); q.breakable() |
| 7337 | q.text("port_no = "); |
| 7338 | q.text(util.pretty_port(self.port_no)) |
| 7339 | q.text(","); q.breakable() |
| 7340 | q.text("actor_sys_priority = "); |
| 7341 | q.text("%#x" % self.actor_sys_priority) |
| 7342 | q.text(","); q.breakable() |
| 7343 | q.text("actor_sys_mac = "); |
| 7344 | q.text(util.pretty_mac(self.actor_sys_mac)) |
| 7345 | q.text(","); q.breakable() |
| 7346 | q.text("actor_port_priority = "); |
| 7347 | q.text("%#x" % self.actor_port_priority) |
| 7348 | q.text(","); q.breakable() |
| 7349 | q.text("actor_port_num = "); |
| 7350 | q.text("%#x" % self.actor_port_num) |
| 7351 | q.text(","); q.breakable() |
| 7352 | q.text("actor_key = "); |
| 7353 | q.text("%#x" % self.actor_key) |
| 7354 | q.breakable() |
| 7355 | q.text('}') |
| 7356 | |
| 7357 | bsn_header.subtypes[41] = bsn_set_lacp_request |
| 7358 | |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7359 | class bsn_set_mirroring(bsn_header): |
| 7360 | version = 5 |
| 7361 | type = 4 |
| 7362 | experimenter = 6035143 |
| 7363 | subtype = 3 |
| 7364 | |
| 7365 | def __init__(self, xid=None, report_mirror_ports=None): |
| 7366 | if xid != None: |
| 7367 | self.xid = xid |
| 7368 | else: |
| 7369 | self.xid = None |
| 7370 | if report_mirror_ports != None: |
| 7371 | self.report_mirror_ports = report_mirror_ports |
| 7372 | else: |
| 7373 | self.report_mirror_ports = 0 |
| 7374 | return |
| 7375 | |
| 7376 | def pack(self): |
| 7377 | packed = [] |
| 7378 | packed.append(struct.pack("!B", self.version)) |
| 7379 | packed.append(struct.pack("!B", self.type)) |
| 7380 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7381 | packed.append(struct.pack("!L", self.xid)) |
| 7382 | packed.append(struct.pack("!L", self.experimenter)) |
| 7383 | packed.append(struct.pack("!L", self.subtype)) |
| 7384 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 7385 | packed.append('\x00' * 3) |
| 7386 | length = sum([len(x) for x in packed]) |
| 7387 | packed[2] = struct.pack("!H", length) |
| 7388 | return ''.join(packed) |
| 7389 | |
| 7390 | @staticmethod |
| 7391 | def unpack(reader): |
| 7392 | obj = bsn_set_mirroring() |
| 7393 | _version = reader.read("!B")[0] |
| 7394 | assert(_version == 5) |
| 7395 | _type = reader.read("!B")[0] |
| 7396 | assert(_type == 4) |
| 7397 | _length = reader.read("!H")[0] |
| 7398 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7399 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7400 | obj.xid = reader.read("!L")[0] |
| 7401 | _experimenter = reader.read("!L")[0] |
| 7402 | assert(_experimenter == 6035143) |
| 7403 | _subtype = reader.read("!L")[0] |
| 7404 | assert(_subtype == 3) |
| 7405 | obj.report_mirror_ports = reader.read("!B")[0] |
| 7406 | reader.skip(3) |
| 7407 | return obj |
| 7408 | |
| 7409 | def __eq__(self, other): |
| 7410 | if type(self) != type(other): return False |
| 7411 | if self.xid != other.xid: return False |
| 7412 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 7413 | return True |
| 7414 | |
| 7415 | def pretty_print(self, q): |
| 7416 | q.text("bsn_set_mirroring {") |
| 7417 | with q.group(): |
| 7418 | with q.indent(2): |
| 7419 | q.breakable() |
| 7420 | q.text("xid = "); |
| 7421 | if self.xid != None: |
| 7422 | q.text("%#x" % self.xid) |
| 7423 | else: |
| 7424 | q.text('None') |
| 7425 | q.text(","); q.breakable() |
| 7426 | q.text("report_mirror_ports = "); |
| 7427 | q.text("%#x" % self.report_mirror_ports) |
| 7428 | q.breakable() |
| 7429 | q.text('}') |
| 7430 | |
| 7431 | bsn_header.subtypes[3] = bsn_set_mirroring |
| 7432 | |
| 7433 | class bsn_set_pktin_suppression_reply(bsn_header): |
| 7434 | version = 5 |
| 7435 | type = 4 |
| 7436 | experimenter = 6035143 |
| 7437 | subtype = 25 |
| 7438 | |
| 7439 | def __init__(self, xid=None, status=None): |
| 7440 | if xid != None: |
| 7441 | self.xid = xid |
| 7442 | else: |
| 7443 | self.xid = None |
| 7444 | if status != None: |
| 7445 | self.status = status |
| 7446 | else: |
| 7447 | self.status = 0 |
| 7448 | return |
| 7449 | |
| 7450 | def pack(self): |
| 7451 | packed = [] |
| 7452 | packed.append(struct.pack("!B", self.version)) |
| 7453 | packed.append(struct.pack("!B", self.type)) |
| 7454 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7455 | packed.append(struct.pack("!L", self.xid)) |
| 7456 | packed.append(struct.pack("!L", self.experimenter)) |
| 7457 | packed.append(struct.pack("!L", self.subtype)) |
| 7458 | packed.append(struct.pack("!L", self.status)) |
| 7459 | length = sum([len(x) for x in packed]) |
| 7460 | packed[2] = struct.pack("!H", length) |
| 7461 | return ''.join(packed) |
| 7462 | |
| 7463 | @staticmethod |
| 7464 | def unpack(reader): |
| 7465 | obj = bsn_set_pktin_suppression_reply() |
| 7466 | _version = reader.read("!B")[0] |
| 7467 | assert(_version == 5) |
| 7468 | _type = reader.read("!B")[0] |
| 7469 | assert(_type == 4) |
| 7470 | _length = reader.read("!H")[0] |
| 7471 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7472 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7473 | obj.xid = reader.read("!L")[0] |
| 7474 | _experimenter = reader.read("!L")[0] |
| 7475 | assert(_experimenter == 6035143) |
| 7476 | _subtype = reader.read("!L")[0] |
| 7477 | assert(_subtype == 25) |
| 7478 | obj.status = reader.read("!L")[0] |
| 7479 | return obj |
| 7480 | |
| 7481 | def __eq__(self, other): |
| 7482 | if type(self) != type(other): return False |
| 7483 | if self.xid != other.xid: return False |
| 7484 | if self.status != other.status: return False |
| 7485 | return True |
| 7486 | |
| 7487 | def pretty_print(self, q): |
| 7488 | q.text("bsn_set_pktin_suppression_reply {") |
| 7489 | with q.group(): |
| 7490 | with q.indent(2): |
| 7491 | q.breakable() |
| 7492 | q.text("xid = "); |
| 7493 | if self.xid != None: |
| 7494 | q.text("%#x" % self.xid) |
| 7495 | else: |
| 7496 | q.text('None') |
| 7497 | q.text(","); q.breakable() |
| 7498 | q.text("status = "); |
| 7499 | q.text("%#x" % self.status) |
| 7500 | q.breakable() |
| 7501 | q.text('}') |
| 7502 | |
| 7503 | bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply |
| 7504 | |
| 7505 | class bsn_set_pktin_suppression_request(bsn_header): |
| 7506 | version = 5 |
| 7507 | type = 4 |
| 7508 | experimenter = 6035143 |
| 7509 | subtype = 11 |
| 7510 | |
| 7511 | def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None): |
| 7512 | if xid != None: |
| 7513 | self.xid = xid |
| 7514 | else: |
| 7515 | self.xid = None |
| 7516 | if enabled != None: |
| 7517 | self.enabled = enabled |
| 7518 | else: |
| 7519 | self.enabled = 0 |
| 7520 | if idle_timeout != None: |
| 7521 | self.idle_timeout = idle_timeout |
| 7522 | else: |
| 7523 | self.idle_timeout = 0 |
| 7524 | if hard_timeout != None: |
| 7525 | self.hard_timeout = hard_timeout |
| 7526 | else: |
| 7527 | self.hard_timeout = 0 |
| 7528 | if priority != None: |
| 7529 | self.priority = priority |
| 7530 | else: |
| 7531 | self.priority = 0 |
| 7532 | if cookie != None: |
| 7533 | self.cookie = cookie |
| 7534 | else: |
| 7535 | self.cookie = 0 |
| 7536 | return |
| 7537 | |
| 7538 | def pack(self): |
| 7539 | packed = [] |
| 7540 | packed.append(struct.pack("!B", self.version)) |
| 7541 | packed.append(struct.pack("!B", self.type)) |
| 7542 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7543 | packed.append(struct.pack("!L", self.xid)) |
| 7544 | packed.append(struct.pack("!L", self.experimenter)) |
| 7545 | packed.append(struct.pack("!L", self.subtype)) |
| 7546 | packed.append(struct.pack("!B", self.enabled)) |
| 7547 | packed.append('\x00' * 1) |
| 7548 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 7549 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 7550 | packed.append(struct.pack("!H", self.priority)) |
| 7551 | packed.append(struct.pack("!Q", self.cookie)) |
| 7552 | length = sum([len(x) for x in packed]) |
| 7553 | packed[2] = struct.pack("!H", length) |
| 7554 | return ''.join(packed) |
| 7555 | |
| 7556 | @staticmethod |
| 7557 | def unpack(reader): |
| 7558 | obj = bsn_set_pktin_suppression_request() |
| 7559 | _version = reader.read("!B")[0] |
| 7560 | assert(_version == 5) |
| 7561 | _type = reader.read("!B")[0] |
| 7562 | assert(_type == 4) |
| 7563 | _length = reader.read("!H")[0] |
| 7564 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7565 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7566 | obj.xid = reader.read("!L")[0] |
| 7567 | _experimenter = reader.read("!L")[0] |
| 7568 | assert(_experimenter == 6035143) |
| 7569 | _subtype = reader.read("!L")[0] |
| 7570 | assert(_subtype == 11) |
| 7571 | obj.enabled = reader.read("!B")[0] |
| 7572 | reader.skip(1) |
| 7573 | obj.idle_timeout = reader.read("!H")[0] |
| 7574 | obj.hard_timeout = reader.read("!H")[0] |
| 7575 | obj.priority = reader.read("!H")[0] |
| 7576 | obj.cookie = reader.read("!Q")[0] |
| 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.enabled != other.enabled: return False |
| 7583 | if self.idle_timeout != other.idle_timeout: return False |
| 7584 | if self.hard_timeout != other.hard_timeout: return False |
| 7585 | if self.priority != other.priority: return False |
| 7586 | if self.cookie != other.cookie: return False |
| 7587 | return True |
| 7588 | |
| 7589 | def pretty_print(self, q): |
| 7590 | q.text("bsn_set_pktin_suppression_request {") |
| 7591 | with q.group(): |
| 7592 | with q.indent(2): |
| 7593 | q.breakable() |
| 7594 | q.text("xid = "); |
| 7595 | if self.xid != None: |
| 7596 | q.text("%#x" % self.xid) |
| 7597 | else: |
| 7598 | q.text('None') |
| 7599 | q.text(","); q.breakable() |
| 7600 | q.text("enabled = "); |
| 7601 | q.text("%#x" % self.enabled) |
| 7602 | q.text(","); q.breakable() |
| 7603 | q.text("idle_timeout = "); |
| 7604 | q.text("%#x" % self.idle_timeout) |
| 7605 | q.text(","); q.breakable() |
| 7606 | q.text("hard_timeout = "); |
| 7607 | q.text("%#x" % self.hard_timeout) |
| 7608 | q.text(","); q.breakable() |
| 7609 | q.text("priority = "); |
| 7610 | q.text("%#x" % self.priority) |
| 7611 | q.text(","); q.breakable() |
| 7612 | q.text("cookie = "); |
| 7613 | q.text("%#x" % self.cookie) |
| 7614 | q.breakable() |
| 7615 | q.text('}') |
| 7616 | |
| 7617 | bsn_header.subtypes[11] = bsn_set_pktin_suppression_request |
| 7618 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7619 | class bsn_set_switch_pipeline_reply(bsn_header): |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7620 | version = 5 |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7621 | type = 4 |
| 7622 | experimenter = 6035143 |
| 7623 | subtype = 54 |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7624 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7625 | def __init__(self, xid=None, status=None): |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7626 | if xid != None: |
| 7627 | self.xid = xid |
| 7628 | else: |
| 7629 | self.xid = None |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7630 | if status != None: |
| 7631 | self.status = status |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7632 | else: |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7633 | self.status = 0 |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7634 | return |
| 7635 | |
| 7636 | def pack(self): |
| 7637 | packed = [] |
| 7638 | packed.append(struct.pack("!B", self.version)) |
| 7639 | packed.append(struct.pack("!B", self.type)) |
| 7640 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7641 | packed.append(struct.pack("!L", self.xid)) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7642 | packed.append(struct.pack("!L", self.experimenter)) |
| 7643 | packed.append(struct.pack("!L", self.subtype)) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7644 | packed.append(struct.pack("!L", self.status)) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7645 | length = sum([len(x) for x in packed]) |
| 7646 | packed[2] = struct.pack("!H", length) |
| 7647 | return ''.join(packed) |
| 7648 | |
| 7649 | @staticmethod |
| 7650 | def unpack(reader): |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7651 | obj = bsn_set_switch_pipeline_reply() |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7652 | _version = reader.read("!B")[0] |
| 7653 | assert(_version == 5) |
| 7654 | _type = reader.read("!B")[0] |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7655 | assert(_type == 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7656 | _length = reader.read("!H")[0] |
| 7657 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7658 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7659 | obj.xid = reader.read("!L")[0] |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7660 | _experimenter = reader.read("!L")[0] |
| 7661 | assert(_experimenter == 6035143) |
| 7662 | _subtype = reader.read("!L")[0] |
| 7663 | assert(_subtype == 54) |
| 7664 | obj.status = reader.read("!L")[0] |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7665 | return obj |
| 7666 | |
| 7667 | def __eq__(self, other): |
| 7668 | if type(self) != type(other): return False |
| 7669 | if self.xid != other.xid: return False |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7670 | if self.status != other.status: return False |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7671 | return True |
| 7672 | |
| 7673 | def pretty_print(self, q): |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7674 | q.text("bsn_set_switch_pipeline_reply {") |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7675 | with q.group(): |
| 7676 | with q.indent(2): |
| 7677 | q.breakable() |
| 7678 | q.text("xid = "); |
| 7679 | if self.xid != None: |
| 7680 | q.text("%#x" % self.xid) |
| 7681 | else: |
| 7682 | q.text('None') |
| 7683 | q.text(","); q.breakable() |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7684 | q.text("status = "); |
| 7685 | q.text("%#x" % self.status) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7686 | q.breakable() |
| 7687 | q.text('}') |
| 7688 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7689 | bsn_header.subtypes[54] = bsn_set_switch_pipeline_reply |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7690 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7691 | class bsn_set_switch_pipeline_request(bsn_header): |
| 7692 | version = 5 |
| 7693 | type = 4 |
| 7694 | experimenter = 6035143 |
| 7695 | subtype = 53 |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7696 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7697 | def __init__(self, xid=None, pipeline=None): |
| 7698 | if xid != None: |
| 7699 | self.xid = xid |
| 7700 | else: |
| 7701 | self.xid = None |
| 7702 | if pipeline != None: |
| 7703 | self.pipeline = pipeline |
| 7704 | else: |
| 7705 | self.pipeline = "" |
| 7706 | return |
| 7707 | |
| 7708 | def pack(self): |
| 7709 | packed = [] |
| 7710 | packed.append(struct.pack("!B", self.version)) |
| 7711 | packed.append(struct.pack("!B", self.type)) |
| 7712 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7713 | packed.append(struct.pack("!L", self.xid)) |
| 7714 | packed.append(struct.pack("!L", self.experimenter)) |
| 7715 | packed.append(struct.pack("!L", self.subtype)) |
| 7716 | packed.append(struct.pack("!256s", self.pipeline)) |
| 7717 | length = sum([len(x) for x in packed]) |
| 7718 | packed[2] = struct.pack("!H", length) |
| 7719 | return ''.join(packed) |
| 7720 | |
| 7721 | @staticmethod |
| 7722 | def unpack(reader): |
| 7723 | obj = bsn_set_switch_pipeline_request() |
| 7724 | _version = reader.read("!B")[0] |
| 7725 | assert(_version == 5) |
| 7726 | _type = reader.read("!B")[0] |
| 7727 | assert(_type == 4) |
| 7728 | _length = reader.read("!H")[0] |
| 7729 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7730 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7731 | obj.xid = reader.read("!L")[0] |
| 7732 | _experimenter = reader.read("!L")[0] |
| 7733 | assert(_experimenter == 6035143) |
| 7734 | _subtype = reader.read("!L")[0] |
| 7735 | assert(_subtype == 53) |
| 7736 | obj.pipeline = reader.read("!256s")[0].rstrip("\x00") |
| 7737 | return obj |
| 7738 | |
| 7739 | def __eq__(self, other): |
| 7740 | if type(self) != type(other): return False |
| 7741 | if self.xid != other.xid: return False |
| 7742 | if self.pipeline != other.pipeline: return False |
| 7743 | return True |
| 7744 | |
| 7745 | def pretty_print(self, q): |
| 7746 | q.text("bsn_set_switch_pipeline_request {") |
| 7747 | with q.group(): |
| 7748 | with q.indent(2): |
| 7749 | q.breakable() |
| 7750 | q.text("xid = "); |
| 7751 | if self.xid != None: |
| 7752 | q.text("%#x" % self.xid) |
| 7753 | else: |
| 7754 | q.text('None') |
| 7755 | q.text(","); q.breakable() |
| 7756 | q.text("pipeline = "); |
| 7757 | q.pp(self.pipeline) |
| 7758 | q.breakable() |
| 7759 | q.text('}') |
| 7760 | |
| 7761 | bsn_header.subtypes[53] = bsn_set_switch_pipeline_request |
| 7762 | |
| 7763 | class bsn_switch_pipeline_stats_reply(bsn_stats_reply): |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7764 | version = 5 |
| 7765 | type = 19 |
| 7766 | stats_type = 65535 |
| 7767 | experimenter = 6035143 |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7768 | subtype = 6 |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7769 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7770 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7771 | if xid != None: |
| 7772 | self.xid = xid |
| 7773 | else: |
| 7774 | self.xid = None |
| 7775 | if flags != None: |
| 7776 | self.flags = flags |
| 7777 | else: |
| 7778 | self.flags = 0 |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7779 | if entries != None: |
| 7780 | self.entries = entries |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7781 | else: |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7782 | self.entries = [] |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7783 | return |
| 7784 | |
| 7785 | def pack(self): |
| 7786 | packed = [] |
| 7787 | packed.append(struct.pack("!B", self.version)) |
| 7788 | packed.append(struct.pack("!B", self.type)) |
| 7789 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7790 | packed.append(struct.pack("!L", self.xid)) |
| 7791 | packed.append(struct.pack("!H", self.stats_type)) |
| 7792 | packed.append(struct.pack("!H", self.flags)) |
| 7793 | packed.append('\x00' * 4) |
| 7794 | packed.append(struct.pack("!L", self.experimenter)) |
| 7795 | packed.append(struct.pack("!L", self.subtype)) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7796 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7797 | length = sum([len(x) for x in packed]) |
| 7798 | packed[2] = struct.pack("!H", length) |
| 7799 | return ''.join(packed) |
| 7800 | |
| 7801 | @staticmethod |
| 7802 | def unpack(reader): |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7803 | obj = bsn_switch_pipeline_stats_reply() |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7804 | _version = reader.read("!B")[0] |
| 7805 | assert(_version == 5) |
| 7806 | _type = reader.read("!B")[0] |
| 7807 | assert(_type == 19) |
| 7808 | _length = reader.read("!H")[0] |
| 7809 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7810 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7811 | obj.xid = reader.read("!L")[0] |
| 7812 | _stats_type = reader.read("!H")[0] |
| 7813 | assert(_stats_type == 65535) |
| 7814 | obj.flags = reader.read("!H")[0] |
| 7815 | reader.skip(4) |
| 7816 | _experimenter = reader.read("!L")[0] |
| 7817 | assert(_experimenter == 6035143) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7818 | _subtype = reader.read("!L")[0] |
| 7819 | assert(_subtype == 6) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 7820 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_switch_pipeline_stats_entry.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7821 | return obj |
| 7822 | |
| 7823 | def __eq__(self, other): |
| 7824 | if type(self) != type(other): return False |
| 7825 | if self.xid != other.xid: return False |
| 7826 | if self.flags != other.flags: return False |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7827 | if self.entries != other.entries: return False |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7828 | return True |
| 7829 | |
| 7830 | def pretty_print(self, q): |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7831 | q.text("bsn_switch_pipeline_stats_reply {") |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7832 | with q.group(): |
| 7833 | with q.indent(2): |
| 7834 | q.breakable() |
| 7835 | q.text("xid = "); |
| 7836 | if self.xid != None: |
| 7837 | q.text("%#x" % self.xid) |
| 7838 | else: |
| 7839 | q.text('None') |
| 7840 | q.text(","); q.breakable() |
| 7841 | q.text("flags = "); |
| 7842 | q.text("%#x" % self.flags) |
| 7843 | q.text(","); q.breakable() |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7844 | q.text("entries = "); |
| 7845 | q.pp(self.entries) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7846 | q.breakable() |
| 7847 | q.text('}') |
| 7848 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7849 | bsn_stats_reply.subtypes[6] = bsn_switch_pipeline_stats_reply |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7850 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7851 | class bsn_switch_pipeline_stats_request(bsn_stats_request): |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7852 | version = 5 |
| 7853 | type = 18 |
| 7854 | stats_type = 65535 |
| 7855 | experimenter = 6035143 |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7856 | subtype = 6 |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7857 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7858 | def __init__(self, xid=None, flags=None): |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7859 | if xid != None: |
| 7860 | self.xid = xid |
| 7861 | else: |
| 7862 | self.xid = None |
| 7863 | if flags != None: |
| 7864 | self.flags = flags |
| 7865 | else: |
| 7866 | self.flags = 0 |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7867 | return |
| 7868 | |
| 7869 | def pack(self): |
| 7870 | packed = [] |
| 7871 | packed.append(struct.pack("!B", self.version)) |
| 7872 | packed.append(struct.pack("!B", self.type)) |
| 7873 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7874 | packed.append(struct.pack("!L", self.xid)) |
| 7875 | packed.append(struct.pack("!H", self.stats_type)) |
| 7876 | packed.append(struct.pack("!H", self.flags)) |
| 7877 | packed.append('\x00' * 4) |
| 7878 | packed.append(struct.pack("!L", self.experimenter)) |
| 7879 | packed.append(struct.pack("!L", self.subtype)) |
| 7880 | length = sum([len(x) for x in packed]) |
| 7881 | packed[2] = struct.pack("!H", length) |
| 7882 | return ''.join(packed) |
| 7883 | |
| 7884 | @staticmethod |
| 7885 | def unpack(reader): |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7886 | obj = bsn_switch_pipeline_stats_request() |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7887 | _version = reader.read("!B")[0] |
| 7888 | assert(_version == 5) |
| 7889 | _type = reader.read("!B")[0] |
| 7890 | assert(_type == 18) |
| 7891 | _length = reader.read("!H")[0] |
| 7892 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7893 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7894 | obj.xid = reader.read("!L")[0] |
| 7895 | _stats_type = reader.read("!H")[0] |
| 7896 | assert(_stats_type == 65535) |
| 7897 | obj.flags = reader.read("!H")[0] |
| 7898 | reader.skip(4) |
| 7899 | _experimenter = reader.read("!L")[0] |
| 7900 | assert(_experimenter == 6035143) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7901 | _subtype = reader.read("!L")[0] |
| 7902 | assert(_subtype == 6) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7903 | return obj |
| 7904 | |
| 7905 | def __eq__(self, other): |
| 7906 | if type(self) != type(other): return False |
| 7907 | if self.xid != other.xid: return False |
| 7908 | if self.flags != other.flags: return False |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7909 | return True |
| 7910 | |
| 7911 | def pretty_print(self, q): |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7912 | q.text("bsn_switch_pipeline_stats_request {") |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 7913 | with q.group(): |
| 7914 | with q.indent(2): |
| 7915 | q.breakable() |
| 7916 | q.text("xid = "); |
| 7917 | if self.xid != None: |
| 7918 | q.text("%#x" % self.xid) |
| 7919 | else: |
| 7920 | q.text('None') |
| 7921 | q.text(","); q.breakable() |
| 7922 | q.text("flags = "); |
| 7923 | q.text("%#x" % self.flags) |
| 7924 | q.breakable() |
| 7925 | q.text('}') |
| 7926 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7927 | bsn_stats_request.subtypes[6] = bsn_switch_pipeline_stats_request |
| 7928 | |
| 7929 | class bsn_table_checksum_stats_reply(bsn_stats_reply): |
| 7930 | version = 5 |
| 7931 | type = 19 |
| 7932 | stats_type = 65535 |
| 7933 | experimenter = 6035143 |
| 7934 | subtype = 11 |
| 7935 | |
| 7936 | def __init__(self, xid=None, flags=None, entries=None): |
| 7937 | if xid != None: |
| 7938 | self.xid = xid |
| 7939 | else: |
| 7940 | self.xid = None |
| 7941 | if flags != None: |
| 7942 | self.flags = flags |
| 7943 | else: |
| 7944 | self.flags = 0 |
| 7945 | if entries != None: |
| 7946 | self.entries = entries |
| 7947 | else: |
| 7948 | self.entries = [] |
| 7949 | return |
| 7950 | |
| 7951 | def pack(self): |
| 7952 | packed = [] |
| 7953 | packed.append(struct.pack("!B", self.version)) |
| 7954 | packed.append(struct.pack("!B", self.type)) |
| 7955 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7956 | packed.append(struct.pack("!L", self.xid)) |
| 7957 | packed.append(struct.pack("!H", self.stats_type)) |
| 7958 | packed.append(struct.pack("!H", self.flags)) |
| 7959 | packed.append('\x00' * 4) |
| 7960 | packed.append(struct.pack("!L", self.experimenter)) |
| 7961 | packed.append(struct.pack("!L", self.subtype)) |
| 7962 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 7963 | length = sum([len(x) for x in packed]) |
| 7964 | packed[2] = struct.pack("!H", length) |
| 7965 | return ''.join(packed) |
| 7966 | |
| 7967 | @staticmethod |
| 7968 | def unpack(reader): |
| 7969 | obj = bsn_table_checksum_stats_reply() |
| 7970 | _version = reader.read("!B")[0] |
| 7971 | assert(_version == 5) |
| 7972 | _type = reader.read("!B")[0] |
| 7973 | assert(_type == 19) |
| 7974 | _length = reader.read("!H")[0] |
| 7975 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7976 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7977 | obj.xid = reader.read("!L")[0] |
| 7978 | _stats_type = reader.read("!H")[0] |
| 7979 | assert(_stats_type == 65535) |
| 7980 | obj.flags = reader.read("!H")[0] |
| 7981 | reader.skip(4) |
| 7982 | _experimenter = reader.read("!L")[0] |
| 7983 | assert(_experimenter == 6035143) |
| 7984 | _subtype = reader.read("!L")[0] |
| 7985 | assert(_subtype == 11) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 7986 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_table_checksum_stats_entry.unpack) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 7987 | return obj |
| 7988 | |
| 7989 | def __eq__(self, other): |
| 7990 | if type(self) != type(other): return False |
| 7991 | if self.xid != other.xid: return False |
| 7992 | if self.flags != other.flags: return False |
| 7993 | if self.entries != other.entries: return False |
| 7994 | return True |
| 7995 | |
| 7996 | def pretty_print(self, q): |
| 7997 | q.text("bsn_table_checksum_stats_reply {") |
| 7998 | with q.group(): |
| 7999 | with q.indent(2): |
| 8000 | q.breakable() |
| 8001 | q.text("xid = "); |
| 8002 | if self.xid != None: |
| 8003 | q.text("%#x" % self.xid) |
| 8004 | else: |
| 8005 | q.text('None') |
| 8006 | q.text(","); q.breakable() |
| 8007 | q.text("flags = "); |
| 8008 | q.text("%#x" % self.flags) |
| 8009 | q.text(","); q.breakable() |
| 8010 | q.text("entries = "); |
| 8011 | q.pp(self.entries) |
| 8012 | q.breakable() |
| 8013 | q.text('}') |
| 8014 | |
| 8015 | bsn_stats_reply.subtypes[11] = bsn_table_checksum_stats_reply |
| 8016 | |
| 8017 | class bsn_table_checksum_stats_request(bsn_stats_request): |
| 8018 | version = 5 |
| 8019 | type = 18 |
| 8020 | stats_type = 65535 |
| 8021 | experimenter = 6035143 |
| 8022 | subtype = 11 |
| 8023 | |
| 8024 | def __init__(self, xid=None, flags=None): |
| 8025 | if xid != None: |
| 8026 | self.xid = xid |
| 8027 | else: |
| 8028 | self.xid = None |
| 8029 | if flags != None: |
| 8030 | self.flags = flags |
| 8031 | else: |
| 8032 | self.flags = 0 |
| 8033 | return |
| 8034 | |
| 8035 | def pack(self): |
| 8036 | packed = [] |
| 8037 | packed.append(struct.pack("!B", self.version)) |
| 8038 | packed.append(struct.pack("!B", self.type)) |
| 8039 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8040 | packed.append(struct.pack("!L", self.xid)) |
| 8041 | packed.append(struct.pack("!H", self.stats_type)) |
| 8042 | packed.append(struct.pack("!H", self.flags)) |
| 8043 | packed.append('\x00' * 4) |
| 8044 | packed.append(struct.pack("!L", self.experimenter)) |
| 8045 | packed.append(struct.pack("!L", self.subtype)) |
| 8046 | length = sum([len(x) for x in packed]) |
| 8047 | packed[2] = struct.pack("!H", length) |
| 8048 | return ''.join(packed) |
| 8049 | |
| 8050 | @staticmethod |
| 8051 | def unpack(reader): |
| 8052 | obj = bsn_table_checksum_stats_request() |
| 8053 | _version = reader.read("!B")[0] |
| 8054 | assert(_version == 5) |
| 8055 | _type = reader.read("!B")[0] |
| 8056 | assert(_type == 18) |
| 8057 | _length = reader.read("!H")[0] |
| 8058 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8059 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 8060 | obj.xid = reader.read("!L")[0] |
| 8061 | _stats_type = reader.read("!H")[0] |
| 8062 | assert(_stats_type == 65535) |
| 8063 | obj.flags = reader.read("!H")[0] |
| 8064 | reader.skip(4) |
| 8065 | _experimenter = reader.read("!L")[0] |
| 8066 | assert(_experimenter == 6035143) |
| 8067 | _subtype = reader.read("!L")[0] |
| 8068 | assert(_subtype == 11) |
| 8069 | return obj |
| 8070 | |
| 8071 | def __eq__(self, other): |
| 8072 | if type(self) != type(other): return False |
| 8073 | if self.xid != other.xid: return False |
| 8074 | if self.flags != other.flags: return False |
| 8075 | return True |
| 8076 | |
| 8077 | def pretty_print(self, q): |
| 8078 | q.text("bsn_table_checksum_stats_request {") |
| 8079 | with q.group(): |
| 8080 | with q.indent(2): |
| 8081 | q.breakable() |
| 8082 | q.text("xid = "); |
| 8083 | if self.xid != None: |
| 8084 | q.text("%#x" % self.xid) |
| 8085 | else: |
| 8086 | q.text('None') |
| 8087 | q.text(","); q.breakable() |
| 8088 | q.text("flags = "); |
| 8089 | q.text("%#x" % self.flags) |
| 8090 | q.breakable() |
| 8091 | q.text('}') |
| 8092 | |
| 8093 | bsn_stats_request.subtypes[11] = bsn_table_checksum_stats_request |
| 8094 | |
| 8095 | class bsn_table_set_buckets_size(bsn_header): |
| 8096 | version = 5 |
| 8097 | type = 4 |
| 8098 | experimenter = 6035143 |
| 8099 | subtype = 61 |
| 8100 | |
| 8101 | def __init__(self, xid=None, table_id=None, buckets_size=None): |
| 8102 | if xid != None: |
| 8103 | self.xid = xid |
| 8104 | else: |
| 8105 | self.xid = None |
| 8106 | if table_id != None: |
| 8107 | self.table_id = table_id |
| 8108 | else: |
| 8109 | self.table_id = 0 |
| 8110 | if buckets_size != None: |
| 8111 | self.buckets_size = buckets_size |
| 8112 | else: |
| 8113 | self.buckets_size = 0 |
| 8114 | return |
| 8115 | |
| 8116 | def pack(self): |
| 8117 | packed = [] |
| 8118 | packed.append(struct.pack("!B", self.version)) |
| 8119 | packed.append(struct.pack("!B", self.type)) |
| 8120 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8121 | packed.append(struct.pack("!L", self.xid)) |
| 8122 | packed.append(struct.pack("!L", self.experimenter)) |
| 8123 | packed.append(struct.pack("!L", self.subtype)) |
| 8124 | packed.append('\x00' * 1) |
| 8125 | packed.append(struct.pack("!B", self.table_id)) |
| 8126 | packed.append('\x00' * 2) |
| 8127 | packed.append(struct.pack("!L", self.buckets_size)) |
| 8128 | length = sum([len(x) for x in packed]) |
| 8129 | packed[2] = struct.pack("!H", length) |
| 8130 | return ''.join(packed) |
| 8131 | |
| 8132 | @staticmethod |
| 8133 | def unpack(reader): |
| 8134 | obj = bsn_table_set_buckets_size() |
| 8135 | _version = reader.read("!B")[0] |
| 8136 | assert(_version == 5) |
| 8137 | _type = reader.read("!B")[0] |
| 8138 | assert(_type == 4) |
| 8139 | _length = reader.read("!H")[0] |
| 8140 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8141 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 8142 | obj.xid = reader.read("!L")[0] |
| 8143 | _experimenter = reader.read("!L")[0] |
| 8144 | assert(_experimenter == 6035143) |
| 8145 | _subtype = reader.read("!L")[0] |
| 8146 | assert(_subtype == 61) |
| 8147 | reader.skip(1) |
| 8148 | obj.table_id = reader.read("!B")[0] |
| 8149 | reader.skip(2) |
| 8150 | obj.buckets_size = reader.read("!L")[0] |
| 8151 | return obj |
| 8152 | |
| 8153 | def __eq__(self, other): |
| 8154 | if type(self) != type(other): return False |
| 8155 | if self.xid != other.xid: return False |
| 8156 | if self.table_id != other.table_id: return False |
| 8157 | if self.buckets_size != other.buckets_size: return False |
| 8158 | return True |
| 8159 | |
| 8160 | def pretty_print(self, q): |
| 8161 | q.text("bsn_table_set_buckets_size {") |
| 8162 | with q.group(): |
| 8163 | with q.indent(2): |
| 8164 | q.breakable() |
| 8165 | q.text("xid = "); |
| 8166 | if self.xid != None: |
| 8167 | q.text("%#x" % self.xid) |
| 8168 | else: |
| 8169 | q.text('None') |
| 8170 | q.text(","); q.breakable() |
| 8171 | q.text("table_id = "); |
| 8172 | q.text("%#x" % self.table_id) |
| 8173 | q.text(","); q.breakable() |
| 8174 | q.text("buckets_size = "); |
| 8175 | q.text("%#x" % self.buckets_size) |
| 8176 | q.breakable() |
| 8177 | q.text('}') |
| 8178 | |
| 8179 | bsn_header.subtypes[61] = bsn_table_set_buckets_size |
| 8180 | |
Rich Lane | 5116831 | 2015-06-25 13:13:54 -0700 | [diff] [blame] | 8181 | class bsn_takeover(bsn_header): |
| 8182 | version = 5 |
| 8183 | type = 4 |
| 8184 | experimenter = 6035143 |
| 8185 | subtype = 69 |
| 8186 | |
| 8187 | def __init__(self, xid=None): |
| 8188 | if xid != None: |
| 8189 | self.xid = xid |
| 8190 | else: |
| 8191 | self.xid = None |
| 8192 | return |
| 8193 | |
| 8194 | def pack(self): |
| 8195 | packed = [] |
| 8196 | packed.append(struct.pack("!B", self.version)) |
| 8197 | packed.append(struct.pack("!B", self.type)) |
| 8198 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8199 | packed.append(struct.pack("!L", self.xid)) |
| 8200 | packed.append(struct.pack("!L", self.experimenter)) |
| 8201 | packed.append(struct.pack("!L", self.subtype)) |
| 8202 | length = sum([len(x) for x in packed]) |
| 8203 | packed[2] = struct.pack("!H", length) |
| 8204 | return ''.join(packed) |
| 8205 | |
| 8206 | @staticmethod |
| 8207 | def unpack(reader): |
| 8208 | obj = bsn_takeover() |
| 8209 | _version = reader.read("!B")[0] |
| 8210 | assert(_version == 5) |
| 8211 | _type = reader.read("!B")[0] |
| 8212 | assert(_type == 4) |
| 8213 | _length = reader.read("!H")[0] |
| 8214 | orig_reader = reader |
| 8215 | reader = orig_reader.slice(_length, 4) |
| 8216 | obj.xid = reader.read("!L")[0] |
| 8217 | _experimenter = reader.read("!L")[0] |
| 8218 | assert(_experimenter == 6035143) |
| 8219 | _subtype = reader.read("!L")[0] |
| 8220 | assert(_subtype == 69) |
| 8221 | return obj |
| 8222 | |
| 8223 | def __eq__(self, other): |
| 8224 | if type(self) != type(other): return False |
| 8225 | if self.xid != other.xid: return False |
| 8226 | return True |
| 8227 | |
| 8228 | def pretty_print(self, q): |
| 8229 | q.text("bsn_takeover {") |
| 8230 | with q.group(): |
| 8231 | with q.indent(2): |
| 8232 | q.breakable() |
| 8233 | q.text("xid = "); |
| 8234 | if self.xid != None: |
| 8235 | q.text("%#x" % self.xid) |
| 8236 | else: |
| 8237 | q.text('None') |
| 8238 | q.breakable() |
| 8239 | q.text('}') |
| 8240 | |
| 8241 | bsn_header.subtypes[69] = bsn_takeover |
| 8242 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 8243 | class bsn_time_reply(bsn_header): |
| 8244 | version = 5 |
| 8245 | type = 4 |
| 8246 | experimenter = 6035143 |
| 8247 | subtype = 45 |
| 8248 | |
| 8249 | def __init__(self, xid=None, time_ms=None): |
| 8250 | if xid != None: |
| 8251 | self.xid = xid |
| 8252 | else: |
| 8253 | self.xid = None |
| 8254 | if time_ms != None: |
| 8255 | self.time_ms = time_ms |
| 8256 | else: |
| 8257 | self.time_ms = 0 |
| 8258 | return |
| 8259 | |
| 8260 | def pack(self): |
| 8261 | packed = [] |
| 8262 | packed.append(struct.pack("!B", self.version)) |
| 8263 | packed.append(struct.pack("!B", self.type)) |
| 8264 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8265 | packed.append(struct.pack("!L", self.xid)) |
| 8266 | packed.append(struct.pack("!L", self.experimenter)) |
| 8267 | packed.append(struct.pack("!L", self.subtype)) |
| 8268 | packed.append(struct.pack("!Q", self.time_ms)) |
| 8269 | length = sum([len(x) for x in packed]) |
| 8270 | packed[2] = struct.pack("!H", length) |
| 8271 | return ''.join(packed) |
| 8272 | |
| 8273 | @staticmethod |
| 8274 | def unpack(reader): |
| 8275 | obj = bsn_time_reply() |
| 8276 | _version = reader.read("!B")[0] |
| 8277 | assert(_version == 5) |
| 8278 | _type = reader.read("!B")[0] |
| 8279 | assert(_type == 4) |
| 8280 | _length = reader.read("!H")[0] |
| 8281 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8282 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 8283 | obj.xid = reader.read("!L")[0] |
| 8284 | _experimenter = reader.read("!L")[0] |
| 8285 | assert(_experimenter == 6035143) |
| 8286 | _subtype = reader.read("!L")[0] |
| 8287 | assert(_subtype == 45) |
| 8288 | obj.time_ms = reader.read("!Q")[0] |
| 8289 | return obj |
| 8290 | |
| 8291 | def __eq__(self, other): |
| 8292 | if type(self) != type(other): return False |
| 8293 | if self.xid != other.xid: return False |
| 8294 | if self.time_ms != other.time_ms: return False |
| 8295 | return True |
| 8296 | |
| 8297 | def pretty_print(self, q): |
| 8298 | q.text("bsn_time_reply {") |
| 8299 | with q.group(): |
| 8300 | with q.indent(2): |
| 8301 | q.breakable() |
| 8302 | q.text("xid = "); |
| 8303 | if self.xid != None: |
| 8304 | q.text("%#x" % self.xid) |
| 8305 | else: |
| 8306 | q.text('None') |
| 8307 | q.text(","); q.breakable() |
| 8308 | q.text("time_ms = "); |
| 8309 | q.text("%#x" % self.time_ms) |
| 8310 | q.breakable() |
| 8311 | q.text('}') |
| 8312 | |
| 8313 | bsn_header.subtypes[45] = bsn_time_reply |
| 8314 | |
| 8315 | class bsn_time_request(bsn_header): |
| 8316 | version = 5 |
| 8317 | type = 4 |
| 8318 | experimenter = 6035143 |
| 8319 | subtype = 44 |
| 8320 | |
| 8321 | def __init__(self, xid=None): |
| 8322 | if xid != None: |
| 8323 | self.xid = xid |
| 8324 | else: |
| 8325 | self.xid = None |
| 8326 | return |
| 8327 | |
| 8328 | def pack(self): |
| 8329 | packed = [] |
| 8330 | packed.append(struct.pack("!B", self.version)) |
| 8331 | packed.append(struct.pack("!B", self.type)) |
| 8332 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8333 | packed.append(struct.pack("!L", self.xid)) |
| 8334 | packed.append(struct.pack("!L", self.experimenter)) |
| 8335 | packed.append(struct.pack("!L", self.subtype)) |
| 8336 | length = sum([len(x) for x in packed]) |
| 8337 | packed[2] = struct.pack("!H", length) |
| 8338 | return ''.join(packed) |
| 8339 | |
| 8340 | @staticmethod |
| 8341 | def unpack(reader): |
| 8342 | obj = bsn_time_request() |
| 8343 | _version = reader.read("!B")[0] |
| 8344 | assert(_version == 5) |
| 8345 | _type = reader.read("!B")[0] |
| 8346 | assert(_type == 4) |
| 8347 | _length = reader.read("!H")[0] |
| 8348 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8349 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 8350 | obj.xid = reader.read("!L")[0] |
| 8351 | _experimenter = reader.read("!L")[0] |
| 8352 | assert(_experimenter == 6035143) |
| 8353 | _subtype = reader.read("!L")[0] |
| 8354 | assert(_subtype == 44) |
| 8355 | return obj |
| 8356 | |
| 8357 | def __eq__(self, other): |
| 8358 | if type(self) != type(other): return False |
| 8359 | if self.xid != other.xid: return False |
| 8360 | return True |
| 8361 | |
| 8362 | def pretty_print(self, q): |
| 8363 | q.text("bsn_time_request {") |
| 8364 | with q.group(): |
| 8365 | with q.indent(2): |
| 8366 | q.breakable() |
| 8367 | q.text("xid = "); |
| 8368 | if self.xid != None: |
| 8369 | q.text("%#x" % self.xid) |
| 8370 | else: |
| 8371 | q.text('None') |
| 8372 | q.breakable() |
| 8373 | q.text('}') |
| 8374 | |
| 8375 | bsn_header.subtypes[44] = bsn_time_request |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 8376 | |
| 8377 | class bsn_virtual_port_create_reply(bsn_header): |
| 8378 | version = 5 |
| 8379 | type = 4 |
| 8380 | experimenter = 6035143 |
| 8381 | subtype = 16 |
| 8382 | |
| 8383 | def __init__(self, xid=None, status=None, vport_no=None): |
| 8384 | if xid != None: |
| 8385 | self.xid = xid |
| 8386 | else: |
| 8387 | self.xid = None |
| 8388 | if status != None: |
| 8389 | self.status = status |
| 8390 | else: |
| 8391 | self.status = 0 |
| 8392 | if vport_no != None: |
| 8393 | self.vport_no = vport_no |
| 8394 | else: |
| 8395 | self.vport_no = 0 |
| 8396 | return |
| 8397 | |
| 8398 | def pack(self): |
| 8399 | packed = [] |
| 8400 | packed.append(struct.pack("!B", self.version)) |
| 8401 | packed.append(struct.pack("!B", self.type)) |
| 8402 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8403 | packed.append(struct.pack("!L", self.xid)) |
| 8404 | packed.append(struct.pack("!L", self.experimenter)) |
| 8405 | packed.append(struct.pack("!L", self.subtype)) |
| 8406 | packed.append(struct.pack("!L", self.status)) |
| 8407 | packed.append(struct.pack("!L", self.vport_no)) |
| 8408 | length = sum([len(x) for x in packed]) |
| 8409 | packed[2] = struct.pack("!H", length) |
| 8410 | return ''.join(packed) |
| 8411 | |
| 8412 | @staticmethod |
| 8413 | def unpack(reader): |
| 8414 | obj = bsn_virtual_port_create_reply() |
| 8415 | _version = reader.read("!B")[0] |
| 8416 | assert(_version == 5) |
| 8417 | _type = reader.read("!B")[0] |
| 8418 | assert(_type == 4) |
| 8419 | _length = reader.read("!H")[0] |
| 8420 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8421 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 8422 | obj.xid = reader.read("!L")[0] |
| 8423 | _experimenter = reader.read("!L")[0] |
| 8424 | assert(_experimenter == 6035143) |
| 8425 | _subtype = reader.read("!L")[0] |
| 8426 | assert(_subtype == 16) |
| 8427 | obj.status = reader.read("!L")[0] |
| 8428 | obj.vport_no = reader.read("!L")[0] |
| 8429 | return obj |
| 8430 | |
| 8431 | def __eq__(self, other): |
| 8432 | if type(self) != type(other): return False |
| 8433 | if self.xid != other.xid: return False |
| 8434 | if self.status != other.status: return False |
| 8435 | if self.vport_no != other.vport_no: return False |
| 8436 | return True |
| 8437 | |
| 8438 | def pretty_print(self, q): |
| 8439 | q.text("bsn_virtual_port_create_reply {") |
| 8440 | with q.group(): |
| 8441 | with q.indent(2): |
| 8442 | q.breakable() |
| 8443 | q.text("xid = "); |
| 8444 | if self.xid != None: |
| 8445 | q.text("%#x" % self.xid) |
| 8446 | else: |
| 8447 | q.text('None') |
| 8448 | q.text(","); q.breakable() |
| 8449 | q.text("status = "); |
| 8450 | q.text("%#x" % self.status) |
| 8451 | q.text(","); q.breakable() |
| 8452 | q.text("vport_no = "); |
| 8453 | q.text("%#x" % self.vport_no) |
| 8454 | q.breakable() |
| 8455 | q.text('}') |
| 8456 | |
| 8457 | bsn_header.subtypes[16] = bsn_virtual_port_create_reply |
| 8458 | |
| 8459 | class bsn_virtual_port_create_request(bsn_header): |
| 8460 | version = 5 |
| 8461 | type = 4 |
| 8462 | experimenter = 6035143 |
| 8463 | subtype = 15 |
| 8464 | |
| 8465 | def __init__(self, xid=None, vport=None): |
| 8466 | if xid != None: |
| 8467 | self.xid = xid |
| 8468 | else: |
| 8469 | self.xid = None |
| 8470 | if vport != None: |
| 8471 | self.vport = vport |
| 8472 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 8473 | self.vport = ofp.bsn_vport() |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 8474 | return |
| 8475 | |
| 8476 | def pack(self): |
| 8477 | packed = [] |
| 8478 | packed.append(struct.pack("!B", self.version)) |
| 8479 | packed.append(struct.pack("!B", self.type)) |
| 8480 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8481 | packed.append(struct.pack("!L", self.xid)) |
| 8482 | packed.append(struct.pack("!L", self.experimenter)) |
| 8483 | packed.append(struct.pack("!L", self.subtype)) |
| 8484 | packed.append(self.vport.pack()) |
| 8485 | length = sum([len(x) for x in packed]) |
| 8486 | packed[2] = struct.pack("!H", length) |
| 8487 | return ''.join(packed) |
| 8488 | |
| 8489 | @staticmethod |
| 8490 | def unpack(reader): |
| 8491 | obj = bsn_virtual_port_create_request() |
| 8492 | _version = reader.read("!B")[0] |
| 8493 | assert(_version == 5) |
| 8494 | _type = reader.read("!B")[0] |
| 8495 | assert(_type == 4) |
| 8496 | _length = reader.read("!H")[0] |
| 8497 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8498 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 8499 | obj.xid = reader.read("!L")[0] |
| 8500 | _experimenter = reader.read("!L")[0] |
| 8501 | assert(_experimenter == 6035143) |
| 8502 | _subtype = reader.read("!L")[0] |
| 8503 | assert(_subtype == 15) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 8504 | obj.vport = ofp.bsn_vport.unpack(reader) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 8505 | return obj |
| 8506 | |
| 8507 | def __eq__(self, other): |
| 8508 | if type(self) != type(other): return False |
| 8509 | if self.xid != other.xid: return False |
| 8510 | if self.vport != other.vport: return False |
| 8511 | return True |
| 8512 | |
| 8513 | def pretty_print(self, q): |
| 8514 | q.text("bsn_virtual_port_create_request {") |
| 8515 | with q.group(): |
| 8516 | with q.indent(2): |
| 8517 | q.breakable() |
| 8518 | q.text("xid = "); |
| 8519 | if self.xid != None: |
| 8520 | q.text("%#x" % self.xid) |
| 8521 | else: |
| 8522 | q.text('None') |
| 8523 | q.text(","); q.breakable() |
| 8524 | q.text("vport = "); |
| 8525 | q.pp(self.vport) |
| 8526 | q.breakable() |
| 8527 | q.text('}') |
| 8528 | |
| 8529 | bsn_header.subtypes[15] = bsn_virtual_port_create_request |
| 8530 | |
| 8531 | class bsn_virtual_port_remove_reply(bsn_header): |
| 8532 | version = 5 |
| 8533 | type = 4 |
| 8534 | experimenter = 6035143 |
| 8535 | subtype = 26 |
| 8536 | |
| 8537 | def __init__(self, xid=None, status=None): |
| 8538 | if xid != None: |
| 8539 | self.xid = xid |
| 8540 | else: |
| 8541 | self.xid = None |
| 8542 | if status != None: |
| 8543 | self.status = status |
| 8544 | else: |
| 8545 | self.status = 0 |
| 8546 | return |
| 8547 | |
| 8548 | def pack(self): |
| 8549 | packed = [] |
| 8550 | packed.append(struct.pack("!B", self.version)) |
| 8551 | packed.append(struct.pack("!B", self.type)) |
| 8552 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8553 | packed.append(struct.pack("!L", self.xid)) |
| 8554 | packed.append(struct.pack("!L", self.experimenter)) |
| 8555 | packed.append(struct.pack("!L", self.subtype)) |
| 8556 | packed.append(struct.pack("!L", self.status)) |
| 8557 | length = sum([len(x) for x in packed]) |
| 8558 | packed[2] = struct.pack("!H", length) |
| 8559 | return ''.join(packed) |
| 8560 | |
| 8561 | @staticmethod |
| 8562 | def unpack(reader): |
| 8563 | obj = bsn_virtual_port_remove_reply() |
| 8564 | _version = reader.read("!B")[0] |
| 8565 | assert(_version == 5) |
| 8566 | _type = reader.read("!B")[0] |
| 8567 | assert(_type == 4) |
| 8568 | _length = reader.read("!H")[0] |
| 8569 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8570 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 8571 | obj.xid = reader.read("!L")[0] |
| 8572 | _experimenter = reader.read("!L")[0] |
| 8573 | assert(_experimenter == 6035143) |
| 8574 | _subtype = reader.read("!L")[0] |
| 8575 | assert(_subtype == 26) |
| 8576 | obj.status = reader.read("!L")[0] |
| 8577 | return obj |
| 8578 | |
| 8579 | def __eq__(self, other): |
| 8580 | if type(self) != type(other): return False |
| 8581 | if self.xid != other.xid: return False |
| 8582 | if self.status != other.status: return False |
| 8583 | return True |
| 8584 | |
| 8585 | def pretty_print(self, q): |
| 8586 | q.text("bsn_virtual_port_remove_reply {") |
| 8587 | with q.group(): |
| 8588 | with q.indent(2): |
| 8589 | q.breakable() |
| 8590 | q.text("xid = "); |
| 8591 | if self.xid != None: |
| 8592 | q.text("%#x" % self.xid) |
| 8593 | else: |
| 8594 | q.text('None') |
| 8595 | q.text(","); q.breakable() |
| 8596 | q.text("status = "); |
| 8597 | q.text("%#x" % self.status) |
| 8598 | q.breakable() |
| 8599 | q.text('}') |
| 8600 | |
| 8601 | bsn_header.subtypes[26] = bsn_virtual_port_remove_reply |
| 8602 | |
| 8603 | class bsn_virtual_port_remove_request(bsn_header): |
| 8604 | version = 5 |
| 8605 | type = 4 |
| 8606 | experimenter = 6035143 |
| 8607 | subtype = 17 |
| 8608 | |
| 8609 | def __init__(self, xid=None, vport_no=None): |
| 8610 | if xid != None: |
| 8611 | self.xid = xid |
| 8612 | else: |
| 8613 | self.xid = None |
| 8614 | if vport_no != None: |
| 8615 | self.vport_no = vport_no |
| 8616 | else: |
| 8617 | self.vport_no = 0 |
| 8618 | return |
| 8619 | |
| 8620 | def pack(self): |
| 8621 | packed = [] |
| 8622 | packed.append(struct.pack("!B", self.version)) |
| 8623 | packed.append(struct.pack("!B", self.type)) |
| 8624 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8625 | packed.append(struct.pack("!L", self.xid)) |
| 8626 | packed.append(struct.pack("!L", self.experimenter)) |
| 8627 | packed.append(struct.pack("!L", self.subtype)) |
| 8628 | packed.append(struct.pack("!L", self.vport_no)) |
| 8629 | length = sum([len(x) for x in packed]) |
| 8630 | packed[2] = struct.pack("!H", length) |
| 8631 | return ''.join(packed) |
| 8632 | |
| 8633 | @staticmethod |
| 8634 | def unpack(reader): |
| 8635 | obj = bsn_virtual_port_remove_request() |
| 8636 | _version = reader.read("!B")[0] |
| 8637 | assert(_version == 5) |
| 8638 | _type = reader.read("!B")[0] |
| 8639 | assert(_type == 4) |
| 8640 | _length = reader.read("!H")[0] |
| 8641 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8642 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 8643 | obj.xid = reader.read("!L")[0] |
| 8644 | _experimenter = reader.read("!L")[0] |
| 8645 | assert(_experimenter == 6035143) |
| 8646 | _subtype = reader.read("!L")[0] |
| 8647 | assert(_subtype == 17) |
| 8648 | obj.vport_no = reader.read("!L")[0] |
| 8649 | return obj |
| 8650 | |
| 8651 | def __eq__(self, other): |
| 8652 | if type(self) != type(other): return False |
| 8653 | if self.xid != other.xid: return False |
| 8654 | if self.vport_no != other.vport_no: return False |
| 8655 | return True |
| 8656 | |
| 8657 | def pretty_print(self, q): |
| 8658 | q.text("bsn_virtual_port_remove_request {") |
| 8659 | with q.group(): |
| 8660 | with q.indent(2): |
| 8661 | q.breakable() |
| 8662 | q.text("xid = "); |
| 8663 | if self.xid != None: |
| 8664 | q.text("%#x" % self.xid) |
| 8665 | else: |
| 8666 | q.text('None') |
| 8667 | q.text(","); q.breakable() |
| 8668 | q.text("vport_no = "); |
| 8669 | q.text("%#x" % self.vport_no) |
| 8670 | q.breakable() |
| 8671 | q.text('}') |
| 8672 | |
| 8673 | bsn_header.subtypes[17] = bsn_virtual_port_remove_request |
| 8674 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 8675 | class bsn_vlan_counter_stats_reply(bsn_stats_reply): |
| 8676 | version = 5 |
| 8677 | type = 19 |
| 8678 | stats_type = 65535 |
| 8679 | experimenter = 6035143 |
| 8680 | subtype = 9 |
| 8681 | |
| 8682 | def __init__(self, xid=None, flags=None, entries=None): |
| 8683 | if xid != None: |
| 8684 | self.xid = xid |
| 8685 | else: |
| 8686 | self.xid = None |
| 8687 | if flags != None: |
| 8688 | self.flags = flags |
| 8689 | else: |
| 8690 | self.flags = 0 |
| 8691 | if entries != None: |
| 8692 | self.entries = entries |
| 8693 | else: |
| 8694 | self.entries = [] |
| 8695 | return |
| 8696 | |
| 8697 | def pack(self): |
| 8698 | packed = [] |
| 8699 | packed.append(struct.pack("!B", self.version)) |
| 8700 | packed.append(struct.pack("!B", self.type)) |
| 8701 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8702 | packed.append(struct.pack("!L", self.xid)) |
| 8703 | packed.append(struct.pack("!H", self.stats_type)) |
| 8704 | packed.append(struct.pack("!H", self.flags)) |
| 8705 | packed.append('\x00' * 4) |
| 8706 | packed.append(struct.pack("!L", self.experimenter)) |
| 8707 | packed.append(struct.pack("!L", self.subtype)) |
| 8708 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 8709 | length = sum([len(x) for x in packed]) |
| 8710 | packed[2] = struct.pack("!H", length) |
| 8711 | return ''.join(packed) |
| 8712 | |
| 8713 | @staticmethod |
| 8714 | def unpack(reader): |
| 8715 | obj = bsn_vlan_counter_stats_reply() |
| 8716 | _version = reader.read("!B")[0] |
| 8717 | assert(_version == 5) |
| 8718 | _type = reader.read("!B")[0] |
| 8719 | assert(_type == 19) |
| 8720 | _length = reader.read("!H")[0] |
| 8721 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8722 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 8723 | obj.xid = reader.read("!L")[0] |
| 8724 | _stats_type = reader.read("!H")[0] |
| 8725 | assert(_stats_type == 65535) |
| 8726 | obj.flags = reader.read("!H")[0] |
| 8727 | reader.skip(4) |
| 8728 | _experimenter = reader.read("!L")[0] |
| 8729 | assert(_experimenter == 6035143) |
| 8730 | _subtype = reader.read("!L")[0] |
| 8731 | assert(_subtype == 9) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 8732 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_vlan_counter_stats_entry.unpack) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 8733 | return obj |
| 8734 | |
| 8735 | def __eq__(self, other): |
| 8736 | if type(self) != type(other): return False |
| 8737 | if self.xid != other.xid: return False |
| 8738 | if self.flags != other.flags: return False |
| 8739 | if self.entries != other.entries: return False |
| 8740 | return True |
| 8741 | |
| 8742 | def pretty_print(self, q): |
| 8743 | q.text("bsn_vlan_counter_stats_reply {") |
| 8744 | with q.group(): |
| 8745 | with q.indent(2): |
| 8746 | q.breakable() |
| 8747 | q.text("xid = "); |
| 8748 | if self.xid != None: |
| 8749 | q.text("%#x" % self.xid) |
| 8750 | else: |
| 8751 | q.text('None') |
| 8752 | q.text(","); q.breakable() |
| 8753 | q.text("flags = "); |
| 8754 | q.text("%#x" % self.flags) |
| 8755 | q.text(","); q.breakable() |
| 8756 | q.text("entries = "); |
| 8757 | q.pp(self.entries) |
| 8758 | q.breakable() |
| 8759 | q.text('}') |
| 8760 | |
| 8761 | bsn_stats_reply.subtypes[9] = bsn_vlan_counter_stats_reply |
| 8762 | |
| 8763 | class bsn_vlan_counter_stats_request(bsn_stats_request): |
| 8764 | version = 5 |
| 8765 | type = 18 |
| 8766 | stats_type = 65535 |
| 8767 | experimenter = 6035143 |
| 8768 | subtype = 9 |
| 8769 | |
| 8770 | def __init__(self, xid=None, flags=None, vlan_vid=None): |
| 8771 | if xid != None: |
| 8772 | self.xid = xid |
| 8773 | else: |
| 8774 | self.xid = None |
| 8775 | if flags != None: |
| 8776 | self.flags = flags |
| 8777 | else: |
| 8778 | self.flags = 0 |
| 8779 | if vlan_vid != None: |
| 8780 | self.vlan_vid = vlan_vid |
| 8781 | else: |
| 8782 | self.vlan_vid = 0 |
| 8783 | return |
| 8784 | |
| 8785 | def pack(self): |
| 8786 | packed = [] |
| 8787 | packed.append(struct.pack("!B", self.version)) |
| 8788 | packed.append(struct.pack("!B", self.type)) |
| 8789 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8790 | packed.append(struct.pack("!L", self.xid)) |
| 8791 | packed.append(struct.pack("!H", self.stats_type)) |
| 8792 | packed.append(struct.pack("!H", self.flags)) |
| 8793 | packed.append('\x00' * 4) |
| 8794 | packed.append(struct.pack("!L", self.experimenter)) |
| 8795 | packed.append(struct.pack("!L", self.subtype)) |
| 8796 | packed.append(struct.pack("!H", self.vlan_vid)) |
| 8797 | length = sum([len(x) for x in packed]) |
| 8798 | packed[2] = struct.pack("!H", length) |
| 8799 | return ''.join(packed) |
| 8800 | |
| 8801 | @staticmethod |
| 8802 | def unpack(reader): |
| 8803 | obj = bsn_vlan_counter_stats_request() |
| 8804 | _version = reader.read("!B")[0] |
| 8805 | assert(_version == 5) |
| 8806 | _type = reader.read("!B")[0] |
| 8807 | assert(_type == 18) |
| 8808 | _length = reader.read("!H")[0] |
| 8809 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8810 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 8811 | obj.xid = reader.read("!L")[0] |
| 8812 | _stats_type = reader.read("!H")[0] |
| 8813 | assert(_stats_type == 65535) |
| 8814 | obj.flags = reader.read("!H")[0] |
| 8815 | reader.skip(4) |
| 8816 | _experimenter = reader.read("!L")[0] |
| 8817 | assert(_experimenter == 6035143) |
| 8818 | _subtype = reader.read("!L")[0] |
| 8819 | assert(_subtype == 9) |
| 8820 | obj.vlan_vid = reader.read("!H")[0] |
| 8821 | return obj |
| 8822 | |
| 8823 | def __eq__(self, other): |
| 8824 | if type(self) != type(other): return False |
| 8825 | if self.xid != other.xid: return False |
| 8826 | if self.flags != other.flags: return False |
| 8827 | if self.vlan_vid != other.vlan_vid: return False |
| 8828 | return True |
| 8829 | |
| 8830 | def pretty_print(self, q): |
| 8831 | q.text("bsn_vlan_counter_stats_request {") |
| 8832 | with q.group(): |
| 8833 | with q.indent(2): |
| 8834 | q.breakable() |
| 8835 | q.text("xid = "); |
| 8836 | if self.xid != None: |
| 8837 | q.text("%#x" % self.xid) |
| 8838 | else: |
| 8839 | q.text('None') |
| 8840 | q.text(","); q.breakable() |
| 8841 | q.text("flags = "); |
| 8842 | q.text("%#x" % self.flags) |
| 8843 | q.text(","); q.breakable() |
| 8844 | q.text("vlan_vid = "); |
| 8845 | q.text("%#x" % self.vlan_vid) |
| 8846 | q.breakable() |
| 8847 | q.text('}') |
| 8848 | |
| 8849 | bsn_stats_request.subtypes[9] = bsn_vlan_counter_stats_request |
| 8850 | |
| 8851 | class bsn_vrf_counter_stats_reply(bsn_stats_reply): |
| 8852 | version = 5 |
| 8853 | type = 19 |
| 8854 | stats_type = 65535 |
| 8855 | experimenter = 6035143 |
| 8856 | subtype = 15 |
| 8857 | |
| 8858 | def __init__(self, xid=None, flags=None, entries=None): |
| 8859 | if xid != None: |
| 8860 | self.xid = xid |
| 8861 | else: |
| 8862 | self.xid = None |
| 8863 | if flags != None: |
| 8864 | self.flags = flags |
| 8865 | else: |
| 8866 | self.flags = 0 |
| 8867 | if entries != None: |
| 8868 | self.entries = entries |
| 8869 | else: |
| 8870 | self.entries = [] |
| 8871 | return |
| 8872 | |
| 8873 | def pack(self): |
| 8874 | packed = [] |
| 8875 | packed.append(struct.pack("!B", self.version)) |
| 8876 | packed.append(struct.pack("!B", self.type)) |
| 8877 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8878 | packed.append(struct.pack("!L", self.xid)) |
| 8879 | packed.append(struct.pack("!H", self.stats_type)) |
| 8880 | packed.append(struct.pack("!H", self.flags)) |
| 8881 | packed.append('\x00' * 4) |
| 8882 | packed.append(struct.pack("!L", self.experimenter)) |
| 8883 | packed.append(struct.pack("!L", self.subtype)) |
| 8884 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 8885 | length = sum([len(x) for x in packed]) |
| 8886 | packed[2] = struct.pack("!H", length) |
| 8887 | return ''.join(packed) |
| 8888 | |
| 8889 | @staticmethod |
| 8890 | def unpack(reader): |
| 8891 | obj = bsn_vrf_counter_stats_reply() |
| 8892 | _version = reader.read("!B")[0] |
| 8893 | assert(_version == 5) |
| 8894 | _type = reader.read("!B")[0] |
| 8895 | assert(_type == 19) |
| 8896 | _length = reader.read("!H")[0] |
| 8897 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8898 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 8899 | obj.xid = reader.read("!L")[0] |
| 8900 | _stats_type = reader.read("!H")[0] |
| 8901 | assert(_stats_type == 65535) |
| 8902 | obj.flags = reader.read("!H")[0] |
| 8903 | reader.skip(4) |
| 8904 | _experimenter = reader.read("!L")[0] |
| 8905 | assert(_experimenter == 6035143) |
| 8906 | _subtype = reader.read("!L")[0] |
| 8907 | assert(_subtype == 15) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 8908 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_vrf_counter_stats_entry.unpack) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 8909 | return obj |
| 8910 | |
| 8911 | def __eq__(self, other): |
| 8912 | if type(self) != type(other): return False |
| 8913 | if self.xid != other.xid: return False |
| 8914 | if self.flags != other.flags: return False |
| 8915 | if self.entries != other.entries: return False |
| 8916 | return True |
| 8917 | |
| 8918 | def pretty_print(self, q): |
| 8919 | q.text("bsn_vrf_counter_stats_reply {") |
| 8920 | with q.group(): |
| 8921 | with q.indent(2): |
| 8922 | q.breakable() |
| 8923 | q.text("xid = "); |
| 8924 | if self.xid != None: |
| 8925 | q.text("%#x" % self.xid) |
| 8926 | else: |
| 8927 | q.text('None') |
| 8928 | q.text(","); q.breakable() |
| 8929 | q.text("flags = "); |
| 8930 | q.text("%#x" % self.flags) |
| 8931 | q.text(","); q.breakable() |
| 8932 | q.text("entries = "); |
| 8933 | q.pp(self.entries) |
| 8934 | q.breakable() |
| 8935 | q.text('}') |
| 8936 | |
| 8937 | bsn_stats_reply.subtypes[15] = bsn_vrf_counter_stats_reply |
| 8938 | |
| 8939 | class bsn_vrf_counter_stats_request(bsn_stats_request): |
| 8940 | version = 5 |
| 8941 | type = 18 |
| 8942 | stats_type = 65535 |
| 8943 | experimenter = 6035143 |
| 8944 | subtype = 15 |
| 8945 | |
| 8946 | def __init__(self, xid=None, flags=None, vrf=None): |
| 8947 | if xid != None: |
| 8948 | self.xid = xid |
| 8949 | else: |
| 8950 | self.xid = None |
| 8951 | if flags != None: |
| 8952 | self.flags = flags |
| 8953 | else: |
| 8954 | self.flags = 0 |
| 8955 | if vrf != None: |
| 8956 | self.vrf = vrf |
| 8957 | else: |
| 8958 | self.vrf = 0 |
| 8959 | return |
| 8960 | |
| 8961 | def pack(self): |
| 8962 | packed = [] |
| 8963 | packed.append(struct.pack("!B", self.version)) |
| 8964 | packed.append(struct.pack("!B", self.type)) |
| 8965 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8966 | packed.append(struct.pack("!L", self.xid)) |
| 8967 | packed.append(struct.pack("!H", self.stats_type)) |
| 8968 | packed.append(struct.pack("!H", self.flags)) |
| 8969 | packed.append('\x00' * 4) |
| 8970 | packed.append(struct.pack("!L", self.experimenter)) |
| 8971 | packed.append(struct.pack("!L", self.subtype)) |
| 8972 | packed.append(struct.pack("!L", self.vrf)) |
| 8973 | length = sum([len(x) for x in packed]) |
| 8974 | packed[2] = struct.pack("!H", length) |
| 8975 | return ''.join(packed) |
| 8976 | |
| 8977 | @staticmethod |
| 8978 | def unpack(reader): |
| 8979 | obj = bsn_vrf_counter_stats_request() |
| 8980 | _version = reader.read("!B")[0] |
| 8981 | assert(_version == 5) |
| 8982 | _type = reader.read("!B")[0] |
| 8983 | assert(_type == 18) |
| 8984 | _length = reader.read("!H")[0] |
| 8985 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8986 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 8987 | obj.xid = reader.read("!L")[0] |
| 8988 | _stats_type = reader.read("!H")[0] |
| 8989 | assert(_stats_type == 65535) |
| 8990 | obj.flags = reader.read("!H")[0] |
| 8991 | reader.skip(4) |
| 8992 | _experimenter = reader.read("!L")[0] |
| 8993 | assert(_experimenter == 6035143) |
| 8994 | _subtype = reader.read("!L")[0] |
| 8995 | assert(_subtype == 15) |
| 8996 | obj.vrf = reader.read("!L")[0] |
| 8997 | return obj |
| 8998 | |
| 8999 | def __eq__(self, other): |
| 9000 | if type(self) != type(other): return False |
| 9001 | if self.xid != other.xid: return False |
| 9002 | if self.flags != other.flags: return False |
| 9003 | if self.vrf != other.vrf: return False |
| 9004 | return True |
| 9005 | |
| 9006 | def pretty_print(self, q): |
| 9007 | q.text("bsn_vrf_counter_stats_request {") |
| 9008 | with q.group(): |
| 9009 | with q.indent(2): |
| 9010 | q.breakable() |
| 9011 | q.text("xid = "); |
| 9012 | if self.xid != None: |
| 9013 | q.text("%#x" % self.xid) |
| 9014 | else: |
| 9015 | q.text('None') |
| 9016 | q.text(","); q.breakable() |
| 9017 | q.text("flags = "); |
| 9018 | q.text("%#x" % self.flags) |
| 9019 | q.text(","); q.breakable() |
| 9020 | q.text("vrf = "); |
| 9021 | q.text("%#x" % self.vrf) |
| 9022 | q.breakable() |
| 9023 | q.text('}') |
| 9024 | |
| 9025 | bsn_stats_request.subtypes[15] = bsn_vrf_counter_stats_request |
| 9026 | |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 9027 | class bundle_add_msg(message): |
| 9028 | version = 5 |
| 9029 | type = 34 |
| 9030 | |
| 9031 | def __init__(self, xid=None, bundle_id=None, flags=None, data=None): |
| 9032 | if xid != None: |
| 9033 | self.xid = xid |
| 9034 | else: |
| 9035 | self.xid = None |
| 9036 | if bundle_id != None: |
| 9037 | self.bundle_id = bundle_id |
| 9038 | else: |
| 9039 | self.bundle_id = 0 |
| 9040 | if flags != None: |
| 9041 | self.flags = flags |
| 9042 | else: |
| 9043 | self.flags = 0 |
| 9044 | if data != None: |
| 9045 | self.data = data |
| 9046 | else: |
| 9047 | self.data = '' |
| 9048 | return |
| 9049 | |
| 9050 | def pack(self): |
| 9051 | packed = [] |
| 9052 | packed.append(struct.pack("!B", self.version)) |
| 9053 | packed.append(struct.pack("!B", self.type)) |
| 9054 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9055 | packed.append(struct.pack("!L", self.xid)) |
| 9056 | packed.append(struct.pack("!L", self.bundle_id)) |
| 9057 | packed.append('\x00' * 2) |
| 9058 | packed.append(struct.pack("!H", self.flags)) |
| 9059 | packed.append(self.data) |
| 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 = bundle_add_msg() |
| 9067 | _version = reader.read("!B")[0] |
| 9068 | assert(_version == 5) |
| 9069 | _type = reader.read("!B")[0] |
| 9070 | assert(_type == 34) |
| 9071 | _length = reader.read("!H")[0] |
| 9072 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9073 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 9074 | obj.xid = reader.read("!L")[0] |
| 9075 | obj.bundle_id = reader.read("!L")[0] |
| 9076 | reader.skip(2) |
| 9077 | obj.flags = reader.read("!H")[0] |
| 9078 | obj.data = str(reader.read_all()) |
| 9079 | return obj |
| 9080 | |
| 9081 | def __eq__(self, other): |
| 9082 | if type(self) != type(other): return False |
| 9083 | if self.xid != other.xid: return False |
| 9084 | if self.bundle_id != other.bundle_id: return False |
| 9085 | if self.flags != other.flags: return False |
| 9086 | if self.data != other.data: return False |
| 9087 | return True |
| 9088 | |
| 9089 | def pretty_print(self, q): |
| 9090 | q.text("bundle_add_msg {") |
| 9091 | with q.group(): |
| 9092 | with q.indent(2): |
| 9093 | q.breakable() |
| 9094 | q.text("xid = "); |
| 9095 | if self.xid != None: |
| 9096 | q.text("%#x" % self.xid) |
| 9097 | else: |
| 9098 | q.text('None') |
| 9099 | q.text(","); q.breakable() |
| 9100 | q.text("bundle_id = "); |
| 9101 | q.text("%#x" % self.bundle_id) |
| 9102 | q.text(","); q.breakable() |
| 9103 | q.text("flags = "); |
| 9104 | q.text("%#x" % self.flags) |
| 9105 | q.text(","); q.breakable() |
| 9106 | q.text("data = "); |
| 9107 | q.pp(self.data) |
| 9108 | q.breakable() |
| 9109 | q.text('}') |
| 9110 | |
| 9111 | message.subtypes[34] = bundle_add_msg |
| 9112 | |
| 9113 | class bundle_ctrl_msg(message): |
| 9114 | version = 5 |
| 9115 | type = 33 |
| 9116 | |
| 9117 | def __init__(self, xid=None, bundle_id=None, bundle_ctrl_type=None, flags=None, properties=None): |
| 9118 | if xid != None: |
| 9119 | self.xid = xid |
| 9120 | else: |
| 9121 | self.xid = None |
| 9122 | if bundle_id != None: |
| 9123 | self.bundle_id = bundle_id |
| 9124 | else: |
| 9125 | self.bundle_id = 0 |
| 9126 | if bundle_ctrl_type != None: |
| 9127 | self.bundle_ctrl_type = bundle_ctrl_type |
| 9128 | else: |
| 9129 | self.bundle_ctrl_type = 0 |
| 9130 | if flags != None: |
| 9131 | self.flags = flags |
| 9132 | else: |
| 9133 | self.flags = 0 |
| 9134 | if properties != None: |
| 9135 | self.properties = properties |
| 9136 | else: |
| 9137 | self.properties = [] |
| 9138 | return |
| 9139 | |
| 9140 | def pack(self): |
| 9141 | packed = [] |
| 9142 | packed.append(struct.pack("!B", self.version)) |
| 9143 | packed.append(struct.pack("!B", self.type)) |
| 9144 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9145 | packed.append(struct.pack("!L", self.xid)) |
| 9146 | packed.append(struct.pack("!L", self.bundle_id)) |
| 9147 | packed.append(struct.pack("!H", self.bundle_ctrl_type)) |
| 9148 | packed.append(struct.pack("!H", self.flags)) |
| 9149 | packed.append(loxi.generic_util.pack_list(self.properties)) |
| 9150 | length = sum([len(x) for x in packed]) |
| 9151 | packed[2] = struct.pack("!H", length) |
| 9152 | return ''.join(packed) |
| 9153 | |
| 9154 | @staticmethod |
| 9155 | def unpack(reader): |
| 9156 | obj = bundle_ctrl_msg() |
| 9157 | _version = reader.read("!B")[0] |
| 9158 | assert(_version == 5) |
| 9159 | _type = reader.read("!B")[0] |
| 9160 | assert(_type == 33) |
| 9161 | _length = reader.read("!H")[0] |
| 9162 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9163 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 9164 | obj.xid = reader.read("!L")[0] |
| 9165 | obj.bundle_id = reader.read("!L")[0] |
| 9166 | obj.bundle_ctrl_type = reader.read("!H")[0] |
| 9167 | obj.flags = reader.read("!H")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 9168 | obj.properties = loxi.generic_util.unpack_list(reader, ofp.bundle_prop.bundle_prop.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 9169 | return obj |
| 9170 | |
| 9171 | def __eq__(self, other): |
| 9172 | if type(self) != type(other): return False |
| 9173 | if self.xid != other.xid: return False |
| 9174 | if self.bundle_id != other.bundle_id: return False |
| 9175 | if self.bundle_ctrl_type != other.bundle_ctrl_type: return False |
| 9176 | if self.flags != other.flags: return False |
| 9177 | if self.properties != other.properties: return False |
| 9178 | return True |
| 9179 | |
| 9180 | def pretty_print(self, q): |
| 9181 | q.text("bundle_ctrl_msg {") |
| 9182 | with q.group(): |
| 9183 | with q.indent(2): |
| 9184 | q.breakable() |
| 9185 | q.text("xid = "); |
| 9186 | if self.xid != None: |
| 9187 | q.text("%#x" % self.xid) |
| 9188 | else: |
| 9189 | q.text('None') |
| 9190 | q.text(","); q.breakable() |
| 9191 | q.text("bundle_id = "); |
| 9192 | q.text("%#x" % self.bundle_id) |
| 9193 | q.text(","); q.breakable() |
| 9194 | q.text("bundle_ctrl_type = "); |
| 9195 | q.text("%#x" % self.bundle_ctrl_type) |
| 9196 | q.text(","); q.breakable() |
| 9197 | q.text("flags = "); |
| 9198 | q.text("%#x" % self.flags) |
| 9199 | q.text(","); q.breakable() |
| 9200 | q.text("properties = "); |
| 9201 | q.pp(self.properties) |
| 9202 | q.breakable() |
| 9203 | q.text('}') |
| 9204 | |
| 9205 | message.subtypes[33] = bundle_ctrl_msg |
| 9206 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 9207 | class bundle_failed_error_msg(error_msg): |
| 9208 | version = 5 |
| 9209 | type = 1 |
| 9210 | err_type = 17 |
| 9211 | |
| 9212 | def __init__(self, xid=None, code=None, data=None): |
| 9213 | if xid != None: |
| 9214 | self.xid = xid |
| 9215 | else: |
| 9216 | self.xid = None |
| 9217 | if code != None: |
| 9218 | self.code = code |
| 9219 | else: |
| 9220 | self.code = 0 |
| 9221 | if data != None: |
| 9222 | self.data = data |
| 9223 | else: |
| 9224 | self.data = '' |
| 9225 | return |
| 9226 | |
| 9227 | def pack(self): |
| 9228 | packed = [] |
| 9229 | packed.append(struct.pack("!B", self.version)) |
| 9230 | packed.append(struct.pack("!B", self.type)) |
| 9231 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9232 | packed.append(struct.pack("!L", self.xid)) |
| 9233 | packed.append(struct.pack("!H", self.err_type)) |
| 9234 | packed.append(struct.pack("!H", self.code)) |
| 9235 | packed.append(self.data) |
| 9236 | length = sum([len(x) for x in packed]) |
| 9237 | packed[2] = struct.pack("!H", length) |
| 9238 | return ''.join(packed) |
| 9239 | |
| 9240 | @staticmethod |
| 9241 | def unpack(reader): |
| 9242 | obj = bundle_failed_error_msg() |
| 9243 | _version = reader.read("!B")[0] |
| 9244 | assert(_version == 5) |
| 9245 | _type = reader.read("!B")[0] |
| 9246 | assert(_type == 1) |
| 9247 | _length = reader.read("!H")[0] |
| 9248 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9249 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 9250 | obj.xid = reader.read("!L")[0] |
| 9251 | _err_type = reader.read("!H")[0] |
| 9252 | assert(_err_type == 17) |
| 9253 | obj.code = reader.read("!H")[0] |
| 9254 | obj.data = str(reader.read_all()) |
| 9255 | return obj |
| 9256 | |
| 9257 | def __eq__(self, other): |
| 9258 | if type(self) != type(other): return False |
| 9259 | if self.xid != other.xid: return False |
| 9260 | if self.code != other.code: return False |
| 9261 | if self.data != other.data: return False |
| 9262 | return True |
| 9263 | |
| 9264 | def pretty_print(self, q): |
| 9265 | q.text("bundle_failed_error_msg {") |
| 9266 | with q.group(): |
| 9267 | with q.indent(2): |
| 9268 | q.breakable() |
| 9269 | q.text("xid = "); |
| 9270 | if self.xid != None: |
| 9271 | q.text("%#x" % self.xid) |
| 9272 | else: |
| 9273 | q.text('None') |
| 9274 | q.text(","); q.breakable() |
| 9275 | q.text("code = "); |
| 9276 | q.text("%#x" % self.code) |
| 9277 | q.text(","); q.breakable() |
| 9278 | q.text("data = "); |
| 9279 | q.pp(self.data) |
| 9280 | q.breakable() |
| 9281 | q.text('}') |
| 9282 | |
| 9283 | error_msg.subtypes[17] = bundle_failed_error_msg |
| 9284 | |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 9285 | class desc_stats_reply(stats_reply): |
| 9286 | version = 5 |
| 9287 | type = 19 |
| 9288 | stats_type = 0 |
| 9289 | |
| 9290 | def __init__(self, xid=None, flags=None, mfr_desc=None, hw_desc=None, sw_desc=None, serial_num=None, dp_desc=None): |
| 9291 | if xid != None: |
| 9292 | self.xid = xid |
| 9293 | else: |
| 9294 | self.xid = None |
| 9295 | if flags != None: |
| 9296 | self.flags = flags |
| 9297 | else: |
| 9298 | self.flags = 0 |
| 9299 | if mfr_desc != None: |
| 9300 | self.mfr_desc = mfr_desc |
| 9301 | else: |
| 9302 | self.mfr_desc = "" |
| 9303 | if hw_desc != None: |
| 9304 | self.hw_desc = hw_desc |
| 9305 | else: |
| 9306 | self.hw_desc = "" |
| 9307 | if sw_desc != None: |
| 9308 | self.sw_desc = sw_desc |
| 9309 | else: |
| 9310 | self.sw_desc = "" |
| 9311 | if serial_num != None: |
| 9312 | self.serial_num = serial_num |
| 9313 | else: |
| 9314 | self.serial_num = "" |
| 9315 | if dp_desc != None: |
| 9316 | self.dp_desc = dp_desc |
| 9317 | else: |
| 9318 | self.dp_desc = "" |
| 9319 | return |
| 9320 | |
| 9321 | def pack(self): |
| 9322 | packed = [] |
| 9323 | packed.append(struct.pack("!B", self.version)) |
| 9324 | packed.append(struct.pack("!B", self.type)) |
| 9325 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9326 | packed.append(struct.pack("!L", self.xid)) |
| 9327 | packed.append(struct.pack("!H", self.stats_type)) |
| 9328 | packed.append(struct.pack("!H", self.flags)) |
| 9329 | packed.append('\x00' * 4) |
| 9330 | packed.append(struct.pack("!256s", self.mfr_desc)) |
| 9331 | packed.append(struct.pack("!256s", self.hw_desc)) |
| 9332 | packed.append(struct.pack("!256s", self.sw_desc)) |
| 9333 | packed.append(struct.pack("!32s", self.serial_num)) |
| 9334 | packed.append(struct.pack("!256s", self.dp_desc)) |
| 9335 | length = sum([len(x) for x in packed]) |
| 9336 | packed[2] = struct.pack("!H", length) |
| 9337 | return ''.join(packed) |
| 9338 | |
| 9339 | @staticmethod |
| 9340 | def unpack(reader): |
| 9341 | obj = desc_stats_reply() |
| 9342 | _version = reader.read("!B")[0] |
| 9343 | assert(_version == 5) |
| 9344 | _type = reader.read("!B")[0] |
| 9345 | assert(_type == 19) |
| 9346 | _length = reader.read("!H")[0] |
| 9347 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9348 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 9349 | obj.xid = reader.read("!L")[0] |
| 9350 | _stats_type = reader.read("!H")[0] |
| 9351 | assert(_stats_type == 0) |
| 9352 | obj.flags = reader.read("!H")[0] |
| 9353 | reader.skip(4) |
| 9354 | obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00") |
| 9355 | obj.hw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 9356 | obj.sw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 9357 | obj.serial_num = reader.read("!32s")[0].rstrip("\x00") |
| 9358 | obj.dp_desc = reader.read("!256s")[0].rstrip("\x00") |
| 9359 | return obj |
| 9360 | |
| 9361 | def __eq__(self, other): |
| 9362 | if type(self) != type(other): return False |
| 9363 | if self.xid != other.xid: return False |
| 9364 | if self.flags != other.flags: return False |
| 9365 | if self.mfr_desc != other.mfr_desc: return False |
| 9366 | if self.hw_desc != other.hw_desc: return False |
| 9367 | if self.sw_desc != other.sw_desc: return False |
| 9368 | if self.serial_num != other.serial_num: return False |
| 9369 | if self.dp_desc != other.dp_desc: return False |
| 9370 | return True |
| 9371 | |
| 9372 | def pretty_print(self, q): |
| 9373 | q.text("desc_stats_reply {") |
| 9374 | with q.group(): |
| 9375 | with q.indent(2): |
| 9376 | q.breakable() |
| 9377 | q.text("xid = "); |
| 9378 | if self.xid != None: |
| 9379 | q.text("%#x" % self.xid) |
| 9380 | else: |
| 9381 | q.text('None') |
| 9382 | q.text(","); q.breakable() |
| 9383 | q.text("flags = "); |
| 9384 | q.text("%#x" % self.flags) |
| 9385 | q.text(","); q.breakable() |
| 9386 | q.text("mfr_desc = "); |
| 9387 | q.pp(self.mfr_desc) |
| 9388 | q.text(","); q.breakable() |
| 9389 | q.text("hw_desc = "); |
| 9390 | q.pp(self.hw_desc) |
| 9391 | q.text(","); q.breakable() |
| 9392 | q.text("sw_desc = "); |
| 9393 | q.pp(self.sw_desc) |
| 9394 | q.text(","); q.breakable() |
| 9395 | q.text("serial_num = "); |
| 9396 | q.pp(self.serial_num) |
| 9397 | q.text(","); q.breakable() |
| 9398 | q.text("dp_desc = "); |
| 9399 | q.pp(self.dp_desc) |
| 9400 | q.breakable() |
| 9401 | q.text('}') |
| 9402 | |
| 9403 | stats_reply.subtypes[0] = desc_stats_reply |
| 9404 | |
| 9405 | class desc_stats_request(stats_request): |
| 9406 | version = 5 |
| 9407 | type = 18 |
| 9408 | stats_type = 0 |
| 9409 | |
| 9410 | def __init__(self, xid=None, flags=None): |
| 9411 | if xid != None: |
| 9412 | self.xid = xid |
| 9413 | else: |
| 9414 | self.xid = None |
| 9415 | if flags != None: |
| 9416 | self.flags = flags |
| 9417 | else: |
| 9418 | self.flags = 0 |
| 9419 | return |
| 9420 | |
| 9421 | def pack(self): |
| 9422 | packed = [] |
| 9423 | packed.append(struct.pack("!B", self.version)) |
| 9424 | packed.append(struct.pack("!B", self.type)) |
| 9425 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9426 | packed.append(struct.pack("!L", self.xid)) |
| 9427 | packed.append(struct.pack("!H", self.stats_type)) |
| 9428 | packed.append(struct.pack("!H", self.flags)) |
| 9429 | packed.append('\x00' * 4) |
| 9430 | length = sum([len(x) for x in packed]) |
| 9431 | packed[2] = struct.pack("!H", length) |
| 9432 | return ''.join(packed) |
| 9433 | |
| 9434 | @staticmethod |
| 9435 | def unpack(reader): |
| 9436 | obj = desc_stats_request() |
| 9437 | _version = reader.read("!B")[0] |
| 9438 | assert(_version == 5) |
| 9439 | _type = reader.read("!B")[0] |
| 9440 | assert(_type == 18) |
| 9441 | _length = reader.read("!H")[0] |
| 9442 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9443 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 9444 | obj.xid = reader.read("!L")[0] |
| 9445 | _stats_type = reader.read("!H")[0] |
| 9446 | assert(_stats_type == 0) |
| 9447 | obj.flags = reader.read("!H")[0] |
| 9448 | reader.skip(4) |
| 9449 | return obj |
| 9450 | |
| 9451 | def __eq__(self, other): |
| 9452 | if type(self) != type(other): return False |
| 9453 | if self.xid != other.xid: return False |
| 9454 | if self.flags != other.flags: return False |
| 9455 | return True |
| 9456 | |
| 9457 | def pretty_print(self, q): |
| 9458 | q.text("desc_stats_request {") |
| 9459 | with q.group(): |
| 9460 | with q.indent(2): |
| 9461 | q.breakable() |
| 9462 | q.text("xid = "); |
| 9463 | if self.xid != None: |
| 9464 | q.text("%#x" % self.xid) |
| 9465 | else: |
| 9466 | q.text('None') |
| 9467 | q.text(","); q.breakable() |
| 9468 | q.text("flags = "); |
| 9469 | q.text("%#x" % self.flags) |
| 9470 | q.breakable() |
| 9471 | q.text('}') |
| 9472 | |
| 9473 | stats_request.subtypes[0] = desc_stats_request |
| 9474 | |
| 9475 | class echo_reply(message): |
| 9476 | version = 5 |
| 9477 | type = 3 |
| 9478 | |
| 9479 | def __init__(self, xid=None, data=None): |
| 9480 | if xid != None: |
| 9481 | self.xid = xid |
| 9482 | else: |
| 9483 | self.xid = None |
| 9484 | if data != None: |
| 9485 | self.data = data |
| 9486 | else: |
| 9487 | self.data = '' |
| 9488 | return |
| 9489 | |
| 9490 | def pack(self): |
| 9491 | packed = [] |
| 9492 | packed.append(struct.pack("!B", self.version)) |
| 9493 | packed.append(struct.pack("!B", self.type)) |
| 9494 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9495 | packed.append(struct.pack("!L", self.xid)) |
| 9496 | packed.append(self.data) |
| 9497 | length = sum([len(x) for x in packed]) |
| 9498 | packed[2] = struct.pack("!H", length) |
| 9499 | return ''.join(packed) |
| 9500 | |
| 9501 | @staticmethod |
| 9502 | def unpack(reader): |
| 9503 | obj = echo_reply() |
| 9504 | _version = reader.read("!B")[0] |
| 9505 | assert(_version == 5) |
| 9506 | _type = reader.read("!B")[0] |
| 9507 | assert(_type == 3) |
| 9508 | _length = reader.read("!H")[0] |
| 9509 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9510 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 9511 | obj.xid = reader.read("!L")[0] |
| 9512 | obj.data = str(reader.read_all()) |
| 9513 | return obj |
| 9514 | |
| 9515 | def __eq__(self, other): |
| 9516 | if type(self) != type(other): return False |
| 9517 | if self.xid != other.xid: return False |
| 9518 | if self.data != other.data: return False |
| 9519 | return True |
| 9520 | |
| 9521 | def pretty_print(self, q): |
| 9522 | q.text("echo_reply {") |
| 9523 | with q.group(): |
| 9524 | with q.indent(2): |
| 9525 | q.breakable() |
| 9526 | q.text("xid = "); |
| 9527 | if self.xid != None: |
| 9528 | q.text("%#x" % self.xid) |
| 9529 | else: |
| 9530 | q.text('None') |
| 9531 | q.text(","); q.breakable() |
| 9532 | q.text("data = "); |
| 9533 | q.pp(self.data) |
| 9534 | q.breakable() |
| 9535 | q.text('}') |
| 9536 | |
| 9537 | message.subtypes[3] = echo_reply |
| 9538 | |
| 9539 | class echo_request(message): |
| 9540 | version = 5 |
| 9541 | type = 2 |
| 9542 | |
| 9543 | def __init__(self, xid=None, data=None): |
| 9544 | if xid != None: |
| 9545 | self.xid = xid |
| 9546 | else: |
| 9547 | self.xid = None |
| 9548 | if data != None: |
| 9549 | self.data = data |
| 9550 | else: |
| 9551 | self.data = '' |
| 9552 | return |
| 9553 | |
| 9554 | def pack(self): |
| 9555 | packed = [] |
| 9556 | packed.append(struct.pack("!B", self.version)) |
| 9557 | packed.append(struct.pack("!B", self.type)) |
| 9558 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9559 | packed.append(struct.pack("!L", self.xid)) |
| 9560 | packed.append(self.data) |
| 9561 | length = sum([len(x) for x in packed]) |
| 9562 | packed[2] = struct.pack("!H", length) |
| 9563 | return ''.join(packed) |
| 9564 | |
| 9565 | @staticmethod |
| 9566 | def unpack(reader): |
| 9567 | obj = echo_request() |
| 9568 | _version = reader.read("!B")[0] |
| 9569 | assert(_version == 5) |
| 9570 | _type = reader.read("!B")[0] |
| 9571 | assert(_type == 2) |
| 9572 | _length = reader.read("!H")[0] |
| 9573 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9574 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 9575 | obj.xid = reader.read("!L")[0] |
| 9576 | obj.data = str(reader.read_all()) |
| 9577 | return obj |
| 9578 | |
| 9579 | def __eq__(self, other): |
| 9580 | if type(self) != type(other): return False |
| 9581 | if self.xid != other.xid: return False |
| 9582 | if self.data != other.data: return False |
| 9583 | return True |
| 9584 | |
| 9585 | def pretty_print(self, q): |
| 9586 | q.text("echo_request {") |
| 9587 | with q.group(): |
| 9588 | with q.indent(2): |
| 9589 | q.breakable() |
| 9590 | q.text("xid = "); |
| 9591 | if self.xid != None: |
| 9592 | q.text("%#x" % self.xid) |
| 9593 | else: |
| 9594 | q.text('None') |
| 9595 | q.text(","); q.breakable() |
| 9596 | q.text("data = "); |
| 9597 | q.pp(self.data) |
| 9598 | q.breakable() |
| 9599 | q.text('}') |
| 9600 | |
| 9601 | message.subtypes[2] = echo_request |
| 9602 | |
| 9603 | class experimenter_error_msg(error_msg): |
| 9604 | version = 5 |
| 9605 | type = 1 |
| 9606 | err_type = 65535 |
| 9607 | |
| 9608 | def __init__(self, xid=None, subtype=None, experimenter=None, data=None): |
| 9609 | if xid != None: |
| 9610 | self.xid = xid |
| 9611 | else: |
| 9612 | self.xid = None |
| 9613 | if subtype != None: |
| 9614 | self.subtype = subtype |
| 9615 | else: |
| 9616 | self.subtype = 0 |
| 9617 | if experimenter != None: |
| 9618 | self.experimenter = experimenter |
| 9619 | else: |
| 9620 | self.experimenter = 0 |
| 9621 | if data != None: |
| 9622 | self.data = data |
| 9623 | else: |
| 9624 | self.data = '' |
| 9625 | return |
| 9626 | |
| 9627 | def pack(self): |
| 9628 | packed = [] |
| 9629 | packed.append(struct.pack("!B", self.version)) |
| 9630 | packed.append(struct.pack("!B", self.type)) |
| 9631 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9632 | packed.append(struct.pack("!L", self.xid)) |
| 9633 | packed.append(struct.pack("!H", self.err_type)) |
| 9634 | packed.append(struct.pack("!H", self.subtype)) |
| 9635 | packed.append(struct.pack("!L", self.experimenter)) |
| 9636 | packed.append(self.data) |
| 9637 | length = sum([len(x) for x in packed]) |
| 9638 | packed[2] = struct.pack("!H", length) |
| 9639 | return ''.join(packed) |
| 9640 | |
| 9641 | @staticmethod |
| 9642 | def unpack(reader): |
| 9643 | obj = experimenter_error_msg() |
| 9644 | _version = reader.read("!B")[0] |
| 9645 | assert(_version == 5) |
| 9646 | _type = reader.read("!B")[0] |
| 9647 | assert(_type == 1) |
| 9648 | _length = reader.read("!H")[0] |
| 9649 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9650 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 9651 | obj.xid = reader.read("!L")[0] |
| 9652 | _err_type = reader.read("!H")[0] |
| 9653 | assert(_err_type == 65535) |
| 9654 | obj.subtype = reader.read("!H")[0] |
| 9655 | obj.experimenter = reader.read("!L")[0] |
| 9656 | obj.data = str(reader.read_all()) |
| 9657 | return obj |
| 9658 | |
| 9659 | def __eq__(self, other): |
| 9660 | if type(self) != type(other): return False |
| 9661 | if self.xid != other.xid: return False |
| 9662 | if self.subtype != other.subtype: return False |
| 9663 | if self.experimenter != other.experimenter: return False |
| 9664 | if self.data != other.data: return False |
| 9665 | return True |
| 9666 | |
| 9667 | def pretty_print(self, q): |
| 9668 | q.text("experimenter_error_msg {") |
| 9669 | with q.group(): |
| 9670 | with q.indent(2): |
| 9671 | q.breakable() |
| 9672 | q.text("xid = "); |
| 9673 | if self.xid != None: |
| 9674 | q.text("%#x" % self.xid) |
| 9675 | else: |
| 9676 | q.text('None') |
| 9677 | q.text(","); q.breakable() |
| 9678 | q.text("subtype = "); |
| 9679 | q.text("%#x" % self.subtype) |
| 9680 | q.text(","); q.breakable() |
| 9681 | q.text("experimenter = "); |
| 9682 | q.text("%#x" % self.experimenter) |
| 9683 | q.text(","); q.breakable() |
| 9684 | q.text("data = "); |
| 9685 | q.pp(self.data) |
| 9686 | q.breakable() |
| 9687 | q.text('}') |
| 9688 | |
| 9689 | error_msg.subtypes[65535] = experimenter_error_msg |
| 9690 | |
| 9691 | class features_reply(message): |
| 9692 | version = 5 |
| 9693 | type = 6 |
| 9694 | |
| 9695 | def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, auxiliary_id=None, capabilities=None, reserved=None): |
| 9696 | if xid != None: |
| 9697 | self.xid = xid |
| 9698 | else: |
| 9699 | self.xid = None |
| 9700 | if datapath_id != None: |
| 9701 | self.datapath_id = datapath_id |
| 9702 | else: |
| 9703 | self.datapath_id = 0 |
| 9704 | if n_buffers != None: |
| 9705 | self.n_buffers = n_buffers |
| 9706 | else: |
| 9707 | self.n_buffers = 0 |
| 9708 | if n_tables != None: |
| 9709 | self.n_tables = n_tables |
| 9710 | else: |
| 9711 | self.n_tables = 0 |
| 9712 | if auxiliary_id != None: |
| 9713 | self.auxiliary_id = auxiliary_id |
| 9714 | else: |
| 9715 | self.auxiliary_id = 0 |
| 9716 | if capabilities != None: |
| 9717 | self.capabilities = capabilities |
| 9718 | else: |
| 9719 | self.capabilities = 0 |
| 9720 | if reserved != None: |
| 9721 | self.reserved = reserved |
| 9722 | else: |
| 9723 | self.reserved = 0 |
| 9724 | return |
| 9725 | |
| 9726 | def pack(self): |
| 9727 | packed = [] |
| 9728 | packed.append(struct.pack("!B", self.version)) |
| 9729 | packed.append(struct.pack("!B", self.type)) |
| 9730 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9731 | packed.append(struct.pack("!L", self.xid)) |
| 9732 | packed.append(struct.pack("!Q", self.datapath_id)) |
| 9733 | packed.append(struct.pack("!L", self.n_buffers)) |
| 9734 | packed.append(struct.pack("!B", self.n_tables)) |
| 9735 | packed.append(struct.pack("!B", self.auxiliary_id)) |
| 9736 | packed.append('\x00' * 2) |
| 9737 | packed.append(struct.pack("!L", self.capabilities)) |
| 9738 | packed.append(struct.pack("!L", self.reserved)) |
| 9739 | length = sum([len(x) for x in packed]) |
| 9740 | packed[2] = struct.pack("!H", length) |
| 9741 | return ''.join(packed) |
| 9742 | |
| 9743 | @staticmethod |
| 9744 | def unpack(reader): |
| 9745 | obj = features_reply() |
| 9746 | _version = reader.read("!B")[0] |
| 9747 | assert(_version == 5) |
| 9748 | _type = reader.read("!B")[0] |
| 9749 | assert(_type == 6) |
| 9750 | _length = reader.read("!H")[0] |
| 9751 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9752 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 9753 | obj.xid = reader.read("!L")[0] |
| 9754 | obj.datapath_id = reader.read("!Q")[0] |
| 9755 | obj.n_buffers = reader.read("!L")[0] |
| 9756 | obj.n_tables = reader.read("!B")[0] |
| 9757 | obj.auxiliary_id = reader.read("!B")[0] |
| 9758 | reader.skip(2) |
| 9759 | obj.capabilities = reader.read("!L")[0] |
| 9760 | obj.reserved = reader.read("!L")[0] |
| 9761 | return obj |
| 9762 | |
| 9763 | def __eq__(self, other): |
| 9764 | if type(self) != type(other): return False |
| 9765 | if self.xid != other.xid: return False |
| 9766 | if self.datapath_id != other.datapath_id: return False |
| 9767 | if self.n_buffers != other.n_buffers: return False |
| 9768 | if self.n_tables != other.n_tables: return False |
| 9769 | if self.auxiliary_id != other.auxiliary_id: return False |
| 9770 | if self.capabilities != other.capabilities: return False |
| 9771 | if self.reserved != other.reserved: return False |
| 9772 | return True |
| 9773 | |
| 9774 | def pretty_print(self, q): |
| 9775 | q.text("features_reply {") |
| 9776 | with q.group(): |
| 9777 | with q.indent(2): |
| 9778 | q.breakable() |
| 9779 | q.text("xid = "); |
| 9780 | if self.xid != None: |
| 9781 | q.text("%#x" % self.xid) |
| 9782 | else: |
| 9783 | q.text('None') |
| 9784 | q.text(","); q.breakable() |
| 9785 | q.text("datapath_id = "); |
| 9786 | q.text("%#x" % self.datapath_id) |
| 9787 | q.text(","); q.breakable() |
| 9788 | q.text("n_buffers = "); |
| 9789 | q.text("%#x" % self.n_buffers) |
| 9790 | q.text(","); q.breakable() |
| 9791 | q.text("n_tables = "); |
| 9792 | q.text("%#x" % self.n_tables) |
| 9793 | q.text(","); q.breakable() |
| 9794 | q.text("auxiliary_id = "); |
| 9795 | q.text("%#x" % self.auxiliary_id) |
| 9796 | q.text(","); q.breakable() |
| 9797 | q.text("capabilities = "); |
| 9798 | q.text("%#x" % self.capabilities) |
| 9799 | q.text(","); q.breakable() |
| 9800 | q.text("reserved = "); |
| 9801 | q.text("%#x" % self.reserved) |
| 9802 | q.breakable() |
| 9803 | q.text('}') |
| 9804 | |
| 9805 | message.subtypes[6] = features_reply |
| 9806 | |
| 9807 | class features_request(message): |
| 9808 | version = 5 |
| 9809 | type = 5 |
| 9810 | |
| 9811 | def __init__(self, xid=None): |
| 9812 | if xid != None: |
| 9813 | self.xid = xid |
| 9814 | else: |
| 9815 | self.xid = None |
| 9816 | return |
| 9817 | |
| 9818 | def pack(self): |
| 9819 | packed = [] |
| 9820 | packed.append(struct.pack("!B", self.version)) |
| 9821 | packed.append(struct.pack("!B", self.type)) |
| 9822 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9823 | packed.append(struct.pack("!L", self.xid)) |
| 9824 | length = sum([len(x) for x in packed]) |
| 9825 | packed[2] = struct.pack("!H", length) |
| 9826 | return ''.join(packed) |
| 9827 | |
| 9828 | @staticmethod |
| 9829 | def unpack(reader): |
| 9830 | obj = features_request() |
| 9831 | _version = reader.read("!B")[0] |
| 9832 | assert(_version == 5) |
| 9833 | _type = reader.read("!B")[0] |
| 9834 | assert(_type == 5) |
| 9835 | _length = reader.read("!H")[0] |
| 9836 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9837 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 9838 | obj.xid = reader.read("!L")[0] |
| 9839 | return obj |
| 9840 | |
| 9841 | def __eq__(self, other): |
| 9842 | if type(self) != type(other): return False |
| 9843 | if self.xid != other.xid: return False |
| 9844 | return True |
| 9845 | |
| 9846 | def pretty_print(self, q): |
| 9847 | q.text("features_request {") |
| 9848 | with q.group(): |
| 9849 | with q.indent(2): |
| 9850 | q.breakable() |
| 9851 | q.text("xid = "); |
| 9852 | if self.xid != None: |
| 9853 | q.text("%#x" % self.xid) |
| 9854 | else: |
| 9855 | q.text('None') |
| 9856 | q.breakable() |
| 9857 | q.text('}') |
| 9858 | |
| 9859 | message.subtypes[5] = features_request |
| 9860 | |
| 9861 | class flow_mod(message): |
| 9862 | subtypes = {} |
| 9863 | |
| 9864 | version = 5 |
| 9865 | type = 14 |
| 9866 | |
| 9867 | 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): |
| 9868 | if xid != None: |
| 9869 | self.xid = xid |
| 9870 | else: |
| 9871 | self.xid = None |
| 9872 | if cookie != None: |
| 9873 | self.cookie = cookie |
| 9874 | else: |
| 9875 | self.cookie = 0 |
| 9876 | if cookie_mask != None: |
| 9877 | self.cookie_mask = cookie_mask |
| 9878 | else: |
| 9879 | self.cookie_mask = 0 |
| 9880 | if table_id != None: |
| 9881 | self.table_id = table_id |
| 9882 | else: |
| 9883 | self.table_id = 0 |
| 9884 | if _command != None: |
| 9885 | self._command = _command |
| 9886 | else: |
| 9887 | self._command = 0 |
| 9888 | if idle_timeout != None: |
| 9889 | self.idle_timeout = idle_timeout |
| 9890 | else: |
| 9891 | self.idle_timeout = 0 |
| 9892 | if hard_timeout != None: |
| 9893 | self.hard_timeout = hard_timeout |
| 9894 | else: |
| 9895 | self.hard_timeout = 0 |
| 9896 | if priority != None: |
| 9897 | self.priority = priority |
| 9898 | else: |
| 9899 | self.priority = 0 |
| 9900 | if buffer_id != None: |
| 9901 | self.buffer_id = buffer_id |
| 9902 | else: |
| 9903 | self.buffer_id = 0 |
| 9904 | if out_port != None: |
| 9905 | self.out_port = out_port |
| 9906 | else: |
| 9907 | self.out_port = 0 |
| 9908 | if out_group != None: |
| 9909 | self.out_group = out_group |
| 9910 | else: |
| 9911 | self.out_group = 0 |
| 9912 | if flags != None: |
| 9913 | self.flags = flags |
| 9914 | else: |
| 9915 | self.flags = 0 |
| 9916 | if match != None: |
| 9917 | self.match = match |
| 9918 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 9919 | self.match = ofp.match() |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 9920 | if instructions != None: |
| 9921 | self.instructions = instructions |
| 9922 | else: |
| 9923 | self.instructions = [] |
| 9924 | return |
| 9925 | |
| 9926 | def pack(self): |
| 9927 | packed = [] |
| 9928 | packed.append(struct.pack("!B", self.version)) |
| 9929 | packed.append(struct.pack("!B", self.type)) |
| 9930 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9931 | packed.append(struct.pack("!L", self.xid)) |
| 9932 | packed.append(struct.pack("!Q", self.cookie)) |
| 9933 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 9934 | packed.append(struct.pack("!B", self.table_id)) |
| 9935 | packed.append(util.pack_fm_cmd(self._command)) |
| 9936 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 9937 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 9938 | packed.append(struct.pack("!H", self.priority)) |
| 9939 | packed.append(struct.pack("!L", self.buffer_id)) |
| 9940 | packed.append(util.pack_port_no(self.out_port)) |
| 9941 | packed.append(struct.pack("!L", self.out_group)) |
| 9942 | packed.append(struct.pack("!H", self.flags)) |
| 9943 | packed.append('\x00' * 2) |
| 9944 | packed.append(self.match.pack()) |
| 9945 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
| 9946 | length = sum([len(x) for x in packed]) |
| 9947 | packed[2] = struct.pack("!H", length) |
| 9948 | return ''.join(packed) |
| 9949 | |
| 9950 | @staticmethod |
| 9951 | def unpack(reader): |
| 9952 | subtype, = reader.peek('B', 25) |
| 9953 | subclass = flow_mod.subtypes.get(subtype) |
| 9954 | if subclass: |
| 9955 | return subclass.unpack(reader) |
| 9956 | |
| 9957 | obj = flow_mod() |
| 9958 | _version = reader.read("!B")[0] |
| 9959 | assert(_version == 5) |
| 9960 | _type = reader.read("!B")[0] |
| 9961 | assert(_type == 14) |
| 9962 | _length = reader.read("!H")[0] |
| 9963 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9964 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 9965 | obj.xid = reader.read("!L")[0] |
| 9966 | obj.cookie = reader.read("!Q")[0] |
| 9967 | obj.cookie_mask = reader.read("!Q")[0] |
| 9968 | obj.table_id = reader.read("!B")[0] |
| 9969 | obj._command = util.unpack_fm_cmd(reader) |
| 9970 | obj.idle_timeout = reader.read("!H")[0] |
| 9971 | obj.hard_timeout = reader.read("!H")[0] |
| 9972 | obj.priority = reader.read("!H")[0] |
| 9973 | obj.buffer_id = reader.read("!L")[0] |
| 9974 | obj.out_port = util.unpack_port_no(reader) |
| 9975 | obj.out_group = reader.read("!L")[0] |
| 9976 | obj.flags = reader.read("!H")[0] |
| 9977 | reader.skip(2) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 9978 | obj.match = ofp.match.unpack(reader) |
| 9979 | obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 9980 | return obj |
| 9981 | |
| 9982 | def __eq__(self, other): |
| 9983 | if type(self) != type(other): return False |
| 9984 | if self.xid != other.xid: return False |
| 9985 | if self.cookie != other.cookie: return False |
| 9986 | if self.cookie_mask != other.cookie_mask: return False |
| 9987 | if self.table_id != other.table_id: return False |
| 9988 | if self._command != other._command: return False |
| 9989 | if self.idle_timeout != other.idle_timeout: return False |
| 9990 | if self.hard_timeout != other.hard_timeout: return False |
| 9991 | if self.priority != other.priority: return False |
| 9992 | if self.buffer_id != other.buffer_id: return False |
| 9993 | if self.out_port != other.out_port: return False |
| 9994 | if self.out_group != other.out_group: return False |
| 9995 | if self.flags != other.flags: return False |
| 9996 | if self.match != other.match: return False |
| 9997 | if self.instructions != other.instructions: return False |
| 9998 | return True |
| 9999 | |
| 10000 | def pretty_print(self, q): |
| 10001 | q.text("flow_mod {") |
| 10002 | with q.group(): |
| 10003 | with q.indent(2): |
| 10004 | q.breakable() |
| 10005 | q.text("xid = "); |
| 10006 | if self.xid != None: |
| 10007 | q.text("%#x" % self.xid) |
| 10008 | else: |
| 10009 | q.text('None') |
| 10010 | q.text(","); q.breakable() |
| 10011 | q.text("cookie = "); |
| 10012 | q.text("%#x" % self.cookie) |
| 10013 | q.text(","); q.breakable() |
| 10014 | q.text("cookie_mask = "); |
| 10015 | q.text("%#x" % self.cookie_mask) |
| 10016 | q.text(","); q.breakable() |
| 10017 | q.text("table_id = "); |
| 10018 | q.text("%#x" % self.table_id) |
| 10019 | q.text(","); q.breakable() |
| 10020 | q.text("idle_timeout = "); |
| 10021 | q.text("%#x" % self.idle_timeout) |
| 10022 | q.text(","); q.breakable() |
| 10023 | q.text("hard_timeout = "); |
| 10024 | q.text("%#x" % self.hard_timeout) |
| 10025 | q.text(","); q.breakable() |
| 10026 | q.text("priority = "); |
| 10027 | q.text("%#x" % self.priority) |
| 10028 | q.text(","); q.breakable() |
| 10029 | q.text("buffer_id = "); |
| 10030 | q.text("%#x" % self.buffer_id) |
| 10031 | q.text(","); q.breakable() |
| 10032 | q.text("out_port = "); |
| 10033 | q.text(util.pretty_port(self.out_port)) |
| 10034 | q.text(","); q.breakable() |
| 10035 | q.text("out_group = "); |
| 10036 | q.text("%#x" % self.out_group) |
| 10037 | q.text(","); q.breakable() |
| 10038 | q.text("flags = "); |
| 10039 | q.text("%#x" % self.flags) |
| 10040 | q.text(","); q.breakable() |
| 10041 | q.text("match = "); |
| 10042 | q.pp(self.match) |
| 10043 | q.text(","); q.breakable() |
| 10044 | q.text("instructions = "); |
| 10045 | q.pp(self.instructions) |
| 10046 | q.breakable() |
| 10047 | q.text('}') |
| 10048 | |
| 10049 | message.subtypes[14] = flow_mod |
| 10050 | |
| 10051 | class flow_add(flow_mod): |
| 10052 | version = 5 |
| 10053 | type = 14 |
| 10054 | _command = 0 |
| 10055 | |
| 10056 | 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): |
| 10057 | if xid != None: |
| 10058 | self.xid = xid |
| 10059 | else: |
| 10060 | self.xid = None |
| 10061 | if cookie != None: |
| 10062 | self.cookie = cookie |
| 10063 | else: |
| 10064 | self.cookie = 0 |
| 10065 | if cookie_mask != None: |
| 10066 | self.cookie_mask = cookie_mask |
| 10067 | else: |
| 10068 | self.cookie_mask = 0 |
| 10069 | if table_id != None: |
| 10070 | self.table_id = table_id |
| 10071 | else: |
| 10072 | self.table_id = 0 |
| 10073 | if idle_timeout != None: |
| 10074 | self.idle_timeout = idle_timeout |
| 10075 | else: |
| 10076 | self.idle_timeout = 0 |
| 10077 | if hard_timeout != None: |
| 10078 | self.hard_timeout = hard_timeout |
| 10079 | else: |
| 10080 | self.hard_timeout = 0 |
| 10081 | if priority != None: |
| 10082 | self.priority = priority |
| 10083 | else: |
| 10084 | self.priority = 0 |
| 10085 | if buffer_id != None: |
| 10086 | self.buffer_id = buffer_id |
| 10087 | else: |
| 10088 | self.buffer_id = 0 |
| 10089 | if out_port != None: |
| 10090 | self.out_port = out_port |
| 10091 | else: |
| 10092 | self.out_port = 0 |
| 10093 | if out_group != None: |
| 10094 | self.out_group = out_group |
| 10095 | else: |
| 10096 | self.out_group = 0 |
| 10097 | if flags != None: |
| 10098 | self.flags = flags |
| 10099 | else: |
| 10100 | self.flags = 0 |
| 10101 | if importance != None: |
| 10102 | self.importance = importance |
| 10103 | else: |
| 10104 | self.importance = 0 |
| 10105 | if match != None: |
| 10106 | self.match = match |
| 10107 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 10108 | self.match = ofp.match() |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 10109 | if instructions != None: |
| 10110 | self.instructions = instructions |
| 10111 | else: |
| 10112 | self.instructions = [] |
| 10113 | return |
| 10114 | |
| 10115 | def pack(self): |
| 10116 | packed = [] |
| 10117 | packed.append(struct.pack("!B", self.version)) |
| 10118 | packed.append(struct.pack("!B", self.type)) |
| 10119 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10120 | packed.append(struct.pack("!L", self.xid)) |
| 10121 | packed.append(struct.pack("!Q", self.cookie)) |
| 10122 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 10123 | packed.append(struct.pack("!B", self.table_id)) |
| 10124 | packed.append(util.pack_fm_cmd(self._command)) |
| 10125 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 10126 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 10127 | packed.append(struct.pack("!H", self.priority)) |
| 10128 | packed.append(struct.pack("!L", self.buffer_id)) |
| 10129 | packed.append(util.pack_port_no(self.out_port)) |
| 10130 | packed.append(struct.pack("!L", self.out_group)) |
| 10131 | packed.append(struct.pack("!H", self.flags)) |
| 10132 | packed.append(struct.pack("!H", self.importance)) |
| 10133 | packed.append(self.match.pack()) |
| 10134 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
| 10135 | length = sum([len(x) for x in packed]) |
| 10136 | packed[2] = struct.pack("!H", length) |
| 10137 | return ''.join(packed) |
| 10138 | |
| 10139 | @staticmethod |
| 10140 | def unpack(reader): |
| 10141 | obj = flow_add() |
| 10142 | _version = reader.read("!B")[0] |
| 10143 | assert(_version == 5) |
| 10144 | _type = reader.read("!B")[0] |
| 10145 | assert(_type == 14) |
| 10146 | _length = reader.read("!H")[0] |
| 10147 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 10148 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 10149 | obj.xid = reader.read("!L")[0] |
| 10150 | obj.cookie = reader.read("!Q")[0] |
| 10151 | obj.cookie_mask = reader.read("!Q")[0] |
| 10152 | obj.table_id = reader.read("!B")[0] |
| 10153 | __command = util.unpack_fm_cmd(reader) |
| 10154 | assert(__command == 0) |
| 10155 | obj.idle_timeout = reader.read("!H")[0] |
| 10156 | obj.hard_timeout = reader.read("!H")[0] |
| 10157 | obj.priority = reader.read("!H")[0] |
| 10158 | obj.buffer_id = reader.read("!L")[0] |
| 10159 | obj.out_port = util.unpack_port_no(reader) |
| 10160 | obj.out_group = reader.read("!L")[0] |
| 10161 | obj.flags = reader.read("!H")[0] |
| 10162 | obj.importance = reader.read("!H")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 10163 | obj.match = ofp.match.unpack(reader) |
| 10164 | obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 10165 | return obj |
| 10166 | |
| 10167 | def __eq__(self, other): |
| 10168 | if type(self) != type(other): return False |
| 10169 | if self.xid != other.xid: return False |
| 10170 | if self.cookie != other.cookie: return False |
| 10171 | if self.cookie_mask != other.cookie_mask: return False |
| 10172 | if self.table_id != other.table_id: return False |
| 10173 | if self.idle_timeout != other.idle_timeout: return False |
| 10174 | if self.hard_timeout != other.hard_timeout: return False |
| 10175 | if self.priority != other.priority: return False |
| 10176 | if self.buffer_id != other.buffer_id: return False |
| 10177 | if self.out_port != other.out_port: return False |
| 10178 | if self.out_group != other.out_group: return False |
| 10179 | if self.flags != other.flags: return False |
| 10180 | if self.importance != other.importance: return False |
| 10181 | if self.match != other.match: return False |
| 10182 | if self.instructions != other.instructions: return False |
| 10183 | return True |
| 10184 | |
| 10185 | def pretty_print(self, q): |
| 10186 | q.text("flow_add {") |
| 10187 | with q.group(): |
| 10188 | with q.indent(2): |
| 10189 | q.breakable() |
| 10190 | q.text("xid = "); |
| 10191 | if self.xid != None: |
| 10192 | q.text("%#x" % self.xid) |
| 10193 | else: |
| 10194 | q.text('None') |
| 10195 | q.text(","); q.breakable() |
| 10196 | q.text("cookie = "); |
| 10197 | q.text("%#x" % self.cookie) |
| 10198 | q.text(","); q.breakable() |
| 10199 | q.text("cookie_mask = "); |
| 10200 | q.text("%#x" % self.cookie_mask) |
| 10201 | q.text(","); q.breakable() |
| 10202 | q.text("table_id = "); |
| 10203 | q.text("%#x" % self.table_id) |
| 10204 | q.text(","); q.breakable() |
| 10205 | q.text("idle_timeout = "); |
| 10206 | q.text("%#x" % self.idle_timeout) |
| 10207 | q.text(","); q.breakable() |
| 10208 | q.text("hard_timeout = "); |
| 10209 | q.text("%#x" % self.hard_timeout) |
| 10210 | q.text(","); q.breakable() |
| 10211 | q.text("priority = "); |
| 10212 | q.text("%#x" % self.priority) |
| 10213 | q.text(","); q.breakable() |
| 10214 | q.text("buffer_id = "); |
| 10215 | q.text("%#x" % self.buffer_id) |
| 10216 | q.text(","); q.breakable() |
| 10217 | q.text("out_port = "); |
| 10218 | q.text(util.pretty_port(self.out_port)) |
| 10219 | q.text(","); q.breakable() |
| 10220 | q.text("out_group = "); |
| 10221 | q.text("%#x" % self.out_group) |
| 10222 | q.text(","); q.breakable() |
| 10223 | q.text("flags = "); |
| 10224 | q.text("%#x" % self.flags) |
| 10225 | q.text(","); q.breakable() |
| 10226 | q.text("importance = "); |
| 10227 | q.text("%#x" % self.importance) |
| 10228 | q.text(","); q.breakable() |
| 10229 | q.text("match = "); |
| 10230 | q.pp(self.match) |
| 10231 | q.text(","); q.breakable() |
| 10232 | q.text("instructions = "); |
| 10233 | q.pp(self.instructions) |
| 10234 | q.breakable() |
| 10235 | q.text('}') |
| 10236 | |
| 10237 | flow_mod.subtypes[0] = flow_add |
| 10238 | |
| 10239 | class flow_delete(flow_mod): |
| 10240 | version = 5 |
| 10241 | type = 14 |
| 10242 | _command = 3 |
| 10243 | |
| 10244 | 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): |
| 10245 | if xid != None: |
| 10246 | self.xid = xid |
| 10247 | else: |
| 10248 | self.xid = None |
| 10249 | if cookie != None: |
| 10250 | self.cookie = cookie |
| 10251 | else: |
| 10252 | self.cookie = 0 |
| 10253 | if cookie_mask != None: |
| 10254 | self.cookie_mask = cookie_mask |
| 10255 | else: |
| 10256 | self.cookie_mask = 0 |
| 10257 | if table_id != None: |
| 10258 | self.table_id = table_id |
| 10259 | else: |
| 10260 | self.table_id = 0 |
| 10261 | if idle_timeout != None: |
| 10262 | self.idle_timeout = idle_timeout |
| 10263 | else: |
| 10264 | self.idle_timeout = 0 |
| 10265 | if hard_timeout != None: |
| 10266 | self.hard_timeout = hard_timeout |
| 10267 | else: |
| 10268 | self.hard_timeout = 0 |
| 10269 | if priority != None: |
| 10270 | self.priority = priority |
| 10271 | else: |
| 10272 | self.priority = 0 |
| 10273 | if buffer_id != None: |
| 10274 | self.buffer_id = buffer_id |
| 10275 | else: |
| 10276 | self.buffer_id = 0 |
| 10277 | if out_port != None: |
| 10278 | self.out_port = out_port |
| 10279 | else: |
| 10280 | self.out_port = 0 |
| 10281 | if out_group != None: |
| 10282 | self.out_group = out_group |
| 10283 | else: |
| 10284 | self.out_group = 0 |
| 10285 | if flags != None: |
| 10286 | self.flags = flags |
| 10287 | else: |
| 10288 | self.flags = 0 |
| 10289 | if importance != None: |
| 10290 | self.importance = importance |
| 10291 | else: |
| 10292 | self.importance = 0 |
| 10293 | if match != None: |
| 10294 | self.match = match |
| 10295 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 10296 | self.match = ofp.match() |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 10297 | if instructions != None: |
| 10298 | self.instructions = instructions |
| 10299 | else: |
| 10300 | self.instructions = [] |
| 10301 | return |
| 10302 | |
| 10303 | def pack(self): |
| 10304 | packed = [] |
| 10305 | packed.append(struct.pack("!B", self.version)) |
| 10306 | packed.append(struct.pack("!B", self.type)) |
| 10307 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10308 | packed.append(struct.pack("!L", self.xid)) |
| 10309 | packed.append(struct.pack("!Q", self.cookie)) |
| 10310 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 10311 | packed.append(struct.pack("!B", self.table_id)) |
| 10312 | packed.append(util.pack_fm_cmd(self._command)) |
| 10313 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 10314 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 10315 | packed.append(struct.pack("!H", self.priority)) |
| 10316 | packed.append(struct.pack("!L", self.buffer_id)) |
| 10317 | packed.append(util.pack_port_no(self.out_port)) |
| 10318 | packed.append(struct.pack("!L", self.out_group)) |
| 10319 | packed.append(struct.pack("!H", self.flags)) |
| 10320 | packed.append(struct.pack("!H", self.importance)) |
| 10321 | packed.append(self.match.pack()) |
| 10322 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
| 10323 | length = sum([len(x) for x in packed]) |
| 10324 | packed[2] = struct.pack("!H", length) |
| 10325 | return ''.join(packed) |
| 10326 | |
| 10327 | @staticmethod |
| 10328 | def unpack(reader): |
| 10329 | obj = flow_delete() |
| 10330 | _version = reader.read("!B")[0] |
| 10331 | assert(_version == 5) |
| 10332 | _type = reader.read("!B")[0] |
| 10333 | assert(_type == 14) |
| 10334 | _length = reader.read("!H")[0] |
| 10335 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 10336 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 10337 | obj.xid = reader.read("!L")[0] |
| 10338 | obj.cookie = reader.read("!Q")[0] |
| 10339 | obj.cookie_mask = reader.read("!Q")[0] |
| 10340 | obj.table_id = reader.read("!B")[0] |
| 10341 | __command = util.unpack_fm_cmd(reader) |
| 10342 | assert(__command == 3) |
| 10343 | obj.idle_timeout = reader.read("!H")[0] |
| 10344 | obj.hard_timeout = reader.read("!H")[0] |
| 10345 | obj.priority = reader.read("!H")[0] |
| 10346 | obj.buffer_id = reader.read("!L")[0] |
| 10347 | obj.out_port = util.unpack_port_no(reader) |
| 10348 | obj.out_group = reader.read("!L")[0] |
| 10349 | obj.flags = reader.read("!H")[0] |
| 10350 | obj.importance = reader.read("!H")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 10351 | obj.match = ofp.match.unpack(reader) |
| 10352 | obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 10353 | return obj |
| 10354 | |
| 10355 | def __eq__(self, other): |
| 10356 | if type(self) != type(other): return False |
| 10357 | if self.xid != other.xid: return False |
| 10358 | if self.cookie != other.cookie: return False |
| 10359 | if self.cookie_mask != other.cookie_mask: return False |
| 10360 | if self.table_id != other.table_id: return False |
| 10361 | if self.idle_timeout != other.idle_timeout: return False |
| 10362 | if self.hard_timeout != other.hard_timeout: return False |
| 10363 | if self.priority != other.priority: return False |
| 10364 | if self.buffer_id != other.buffer_id: return False |
| 10365 | if self.out_port != other.out_port: return False |
| 10366 | if self.out_group != other.out_group: return False |
| 10367 | if self.flags != other.flags: return False |
| 10368 | if self.importance != other.importance: return False |
| 10369 | if self.match != other.match: return False |
| 10370 | if self.instructions != other.instructions: return False |
| 10371 | return True |
| 10372 | |
| 10373 | def pretty_print(self, q): |
| 10374 | q.text("flow_delete {") |
| 10375 | with q.group(): |
| 10376 | with q.indent(2): |
| 10377 | q.breakable() |
| 10378 | q.text("xid = "); |
| 10379 | if self.xid != None: |
| 10380 | q.text("%#x" % self.xid) |
| 10381 | else: |
| 10382 | q.text('None') |
| 10383 | q.text(","); q.breakable() |
| 10384 | q.text("cookie = "); |
| 10385 | q.text("%#x" % self.cookie) |
| 10386 | q.text(","); q.breakable() |
| 10387 | q.text("cookie_mask = "); |
| 10388 | q.text("%#x" % self.cookie_mask) |
| 10389 | q.text(","); q.breakable() |
| 10390 | q.text("table_id = "); |
| 10391 | q.text("%#x" % self.table_id) |
| 10392 | q.text(","); q.breakable() |
| 10393 | q.text("idle_timeout = "); |
| 10394 | q.text("%#x" % self.idle_timeout) |
| 10395 | q.text(","); q.breakable() |
| 10396 | q.text("hard_timeout = "); |
| 10397 | q.text("%#x" % self.hard_timeout) |
| 10398 | q.text(","); q.breakable() |
| 10399 | q.text("priority = "); |
| 10400 | q.text("%#x" % self.priority) |
| 10401 | q.text(","); q.breakable() |
| 10402 | q.text("buffer_id = "); |
| 10403 | q.text("%#x" % self.buffer_id) |
| 10404 | q.text(","); q.breakable() |
| 10405 | q.text("out_port = "); |
| 10406 | q.text(util.pretty_port(self.out_port)) |
| 10407 | q.text(","); q.breakable() |
| 10408 | q.text("out_group = "); |
| 10409 | q.text("%#x" % self.out_group) |
| 10410 | q.text(","); q.breakable() |
| 10411 | q.text("flags = "); |
| 10412 | q.text("%#x" % self.flags) |
| 10413 | q.text(","); q.breakable() |
| 10414 | q.text("importance = "); |
| 10415 | q.text("%#x" % self.importance) |
| 10416 | q.text(","); q.breakable() |
| 10417 | q.text("match = "); |
| 10418 | q.pp(self.match) |
| 10419 | q.text(","); q.breakable() |
| 10420 | q.text("instructions = "); |
| 10421 | q.pp(self.instructions) |
| 10422 | q.breakable() |
| 10423 | q.text('}') |
| 10424 | |
| 10425 | flow_mod.subtypes[3] = flow_delete |
| 10426 | |
| 10427 | class flow_delete_strict(flow_mod): |
| 10428 | version = 5 |
| 10429 | type = 14 |
| 10430 | _command = 4 |
| 10431 | |
| 10432 | 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): |
| 10433 | if xid != None: |
| 10434 | self.xid = xid |
| 10435 | else: |
| 10436 | self.xid = None |
| 10437 | if cookie != None: |
| 10438 | self.cookie = cookie |
| 10439 | else: |
| 10440 | self.cookie = 0 |
| 10441 | if cookie_mask != None: |
| 10442 | self.cookie_mask = cookie_mask |
| 10443 | else: |
| 10444 | self.cookie_mask = 0 |
| 10445 | if table_id != None: |
| 10446 | self.table_id = table_id |
| 10447 | else: |
| 10448 | self.table_id = 0 |
| 10449 | if idle_timeout != None: |
| 10450 | self.idle_timeout = idle_timeout |
| 10451 | else: |
| 10452 | self.idle_timeout = 0 |
| 10453 | if hard_timeout != None: |
| 10454 | self.hard_timeout = hard_timeout |
| 10455 | else: |
| 10456 | self.hard_timeout = 0 |
| 10457 | if priority != None: |
| 10458 | self.priority = priority |
| 10459 | else: |
| 10460 | self.priority = 0 |
| 10461 | if buffer_id != None: |
| 10462 | self.buffer_id = buffer_id |
| 10463 | else: |
| 10464 | self.buffer_id = 0 |
| 10465 | if out_port != None: |
| 10466 | self.out_port = out_port |
| 10467 | else: |
| 10468 | self.out_port = 0 |
| 10469 | if out_group != None: |
| 10470 | self.out_group = out_group |
| 10471 | else: |
| 10472 | self.out_group = 0 |
| 10473 | if flags != None: |
| 10474 | self.flags = flags |
| 10475 | else: |
| 10476 | self.flags = 0 |
| 10477 | if importance != None: |
| 10478 | self.importance = importance |
| 10479 | else: |
| 10480 | self.importance = 0 |
| 10481 | if match != None: |
| 10482 | self.match = match |
| 10483 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 10484 | self.match = ofp.match() |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 10485 | if instructions != None: |
| 10486 | self.instructions = instructions |
| 10487 | else: |
| 10488 | self.instructions = [] |
| 10489 | return |
| 10490 | |
| 10491 | def pack(self): |
| 10492 | packed = [] |
| 10493 | packed.append(struct.pack("!B", self.version)) |
| 10494 | packed.append(struct.pack("!B", self.type)) |
| 10495 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10496 | packed.append(struct.pack("!L", self.xid)) |
| 10497 | packed.append(struct.pack("!Q", self.cookie)) |
| 10498 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 10499 | packed.append(struct.pack("!B", self.table_id)) |
| 10500 | packed.append(util.pack_fm_cmd(self._command)) |
| 10501 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 10502 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 10503 | packed.append(struct.pack("!H", self.priority)) |
| 10504 | packed.append(struct.pack("!L", self.buffer_id)) |
| 10505 | packed.append(util.pack_port_no(self.out_port)) |
| 10506 | packed.append(struct.pack("!L", self.out_group)) |
| 10507 | packed.append(struct.pack("!H", self.flags)) |
| 10508 | packed.append(struct.pack("!H", self.importance)) |
| 10509 | packed.append(self.match.pack()) |
| 10510 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
| 10511 | length = sum([len(x) for x in packed]) |
| 10512 | packed[2] = struct.pack("!H", length) |
| 10513 | return ''.join(packed) |
| 10514 | |
| 10515 | @staticmethod |
| 10516 | def unpack(reader): |
| 10517 | obj = flow_delete_strict() |
| 10518 | _version = reader.read("!B")[0] |
| 10519 | assert(_version == 5) |
| 10520 | _type = reader.read("!B")[0] |
| 10521 | assert(_type == 14) |
| 10522 | _length = reader.read("!H")[0] |
| 10523 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 10524 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 10525 | obj.xid = reader.read("!L")[0] |
| 10526 | obj.cookie = reader.read("!Q")[0] |
| 10527 | obj.cookie_mask = reader.read("!Q")[0] |
| 10528 | obj.table_id = reader.read("!B")[0] |
| 10529 | __command = util.unpack_fm_cmd(reader) |
| 10530 | assert(__command == 4) |
| 10531 | obj.idle_timeout = reader.read("!H")[0] |
| 10532 | obj.hard_timeout = reader.read("!H")[0] |
| 10533 | obj.priority = reader.read("!H")[0] |
| 10534 | obj.buffer_id = reader.read("!L")[0] |
| 10535 | obj.out_port = util.unpack_port_no(reader) |
| 10536 | obj.out_group = reader.read("!L")[0] |
| 10537 | obj.flags = reader.read("!H")[0] |
| 10538 | obj.importance = reader.read("!H")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 10539 | obj.match = ofp.match.unpack(reader) |
| 10540 | obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 10541 | return obj |
| 10542 | |
| 10543 | def __eq__(self, other): |
| 10544 | if type(self) != type(other): return False |
| 10545 | if self.xid != other.xid: return False |
| 10546 | if self.cookie != other.cookie: return False |
| 10547 | if self.cookie_mask != other.cookie_mask: return False |
| 10548 | if self.table_id != other.table_id: return False |
| 10549 | if self.idle_timeout != other.idle_timeout: return False |
| 10550 | if self.hard_timeout != other.hard_timeout: return False |
| 10551 | if self.priority != other.priority: return False |
| 10552 | if self.buffer_id != other.buffer_id: return False |
| 10553 | if self.out_port != other.out_port: return False |
| 10554 | if self.out_group != other.out_group: return False |
| 10555 | if self.flags != other.flags: return False |
| 10556 | if self.importance != other.importance: return False |
| 10557 | if self.match != other.match: return False |
| 10558 | if self.instructions != other.instructions: return False |
| 10559 | return True |
| 10560 | |
| 10561 | def pretty_print(self, q): |
| 10562 | q.text("flow_delete_strict {") |
| 10563 | with q.group(): |
| 10564 | with q.indent(2): |
| 10565 | q.breakable() |
| 10566 | q.text("xid = "); |
| 10567 | if self.xid != None: |
| 10568 | q.text("%#x" % self.xid) |
| 10569 | else: |
| 10570 | q.text('None') |
| 10571 | q.text(","); q.breakable() |
| 10572 | q.text("cookie = "); |
| 10573 | q.text("%#x" % self.cookie) |
| 10574 | q.text(","); q.breakable() |
| 10575 | q.text("cookie_mask = "); |
| 10576 | q.text("%#x" % self.cookie_mask) |
| 10577 | q.text(","); q.breakable() |
| 10578 | q.text("table_id = "); |
| 10579 | q.text("%#x" % self.table_id) |
| 10580 | q.text(","); q.breakable() |
| 10581 | q.text("idle_timeout = "); |
| 10582 | q.text("%#x" % self.idle_timeout) |
| 10583 | q.text(","); q.breakable() |
| 10584 | q.text("hard_timeout = "); |
| 10585 | q.text("%#x" % self.hard_timeout) |
| 10586 | q.text(","); q.breakable() |
| 10587 | q.text("priority = "); |
| 10588 | q.text("%#x" % self.priority) |
| 10589 | q.text(","); q.breakable() |
| 10590 | q.text("buffer_id = "); |
| 10591 | q.text("%#x" % self.buffer_id) |
| 10592 | q.text(","); q.breakable() |
| 10593 | q.text("out_port = "); |
| 10594 | q.text(util.pretty_port(self.out_port)) |
| 10595 | q.text(","); q.breakable() |
| 10596 | q.text("out_group = "); |
| 10597 | q.text("%#x" % self.out_group) |
| 10598 | q.text(","); q.breakable() |
| 10599 | q.text("flags = "); |
| 10600 | q.text("%#x" % self.flags) |
| 10601 | q.text(","); q.breakable() |
| 10602 | q.text("importance = "); |
| 10603 | q.text("%#x" % self.importance) |
| 10604 | q.text(","); q.breakable() |
| 10605 | q.text("match = "); |
| 10606 | q.pp(self.match) |
| 10607 | q.text(","); q.breakable() |
| 10608 | q.text("instructions = "); |
| 10609 | q.pp(self.instructions) |
| 10610 | q.breakable() |
| 10611 | q.text('}') |
| 10612 | |
| 10613 | flow_mod.subtypes[4] = flow_delete_strict |
| 10614 | |
| 10615 | class flow_mod_failed_error_msg(error_msg): |
| 10616 | version = 5 |
| 10617 | type = 1 |
| 10618 | err_type = 5 |
| 10619 | |
| 10620 | def __init__(self, xid=None, code=None, data=None): |
| 10621 | if xid != None: |
| 10622 | self.xid = xid |
| 10623 | else: |
| 10624 | self.xid = None |
| 10625 | if code != None: |
| 10626 | self.code = code |
| 10627 | else: |
| 10628 | self.code = 0 |
| 10629 | if data != None: |
| 10630 | self.data = data |
| 10631 | else: |
| 10632 | self.data = '' |
| 10633 | return |
| 10634 | |
| 10635 | def pack(self): |
| 10636 | packed = [] |
| 10637 | packed.append(struct.pack("!B", self.version)) |
| 10638 | packed.append(struct.pack("!B", self.type)) |
| 10639 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10640 | packed.append(struct.pack("!L", self.xid)) |
| 10641 | packed.append(struct.pack("!H", self.err_type)) |
| 10642 | packed.append(struct.pack("!H", self.code)) |
| 10643 | packed.append(self.data) |
| 10644 | length = sum([len(x) for x in packed]) |
| 10645 | packed[2] = struct.pack("!H", length) |
| 10646 | return ''.join(packed) |
| 10647 | |
| 10648 | @staticmethod |
| 10649 | def unpack(reader): |
| 10650 | obj = flow_mod_failed_error_msg() |
| 10651 | _version = reader.read("!B")[0] |
| 10652 | assert(_version == 5) |
| 10653 | _type = reader.read("!B")[0] |
| 10654 | assert(_type == 1) |
| 10655 | _length = reader.read("!H")[0] |
| 10656 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 10657 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 10658 | obj.xid = reader.read("!L")[0] |
| 10659 | _err_type = reader.read("!H")[0] |
| 10660 | assert(_err_type == 5) |
| 10661 | obj.code = reader.read("!H")[0] |
| 10662 | obj.data = str(reader.read_all()) |
| 10663 | return obj |
| 10664 | |
| 10665 | def __eq__(self, other): |
| 10666 | if type(self) != type(other): return False |
| 10667 | if self.xid != other.xid: return False |
| 10668 | if self.code != other.code: return False |
| 10669 | if self.data != other.data: return False |
| 10670 | return True |
| 10671 | |
| 10672 | def pretty_print(self, q): |
| 10673 | q.text("flow_mod_failed_error_msg {") |
| 10674 | with q.group(): |
| 10675 | with q.indent(2): |
| 10676 | q.breakable() |
| 10677 | q.text("xid = "); |
| 10678 | if self.xid != None: |
| 10679 | q.text("%#x" % self.xid) |
| 10680 | else: |
| 10681 | q.text('None') |
| 10682 | q.text(","); q.breakable() |
| 10683 | q.text("code = "); |
| 10684 | q.text("%#x" % self.code) |
| 10685 | q.text(","); q.breakable() |
| 10686 | q.text("data = "); |
| 10687 | q.pp(self.data) |
| 10688 | q.breakable() |
| 10689 | q.text('}') |
| 10690 | |
| 10691 | error_msg.subtypes[5] = flow_mod_failed_error_msg |
| 10692 | |
| 10693 | class flow_modify(flow_mod): |
| 10694 | version = 5 |
| 10695 | type = 14 |
| 10696 | _command = 1 |
| 10697 | |
| 10698 | 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): |
| 10699 | if xid != None: |
| 10700 | self.xid = xid |
| 10701 | else: |
| 10702 | self.xid = None |
| 10703 | if cookie != None: |
| 10704 | self.cookie = cookie |
| 10705 | else: |
| 10706 | self.cookie = 0 |
| 10707 | if cookie_mask != None: |
| 10708 | self.cookie_mask = cookie_mask |
| 10709 | else: |
| 10710 | self.cookie_mask = 0 |
| 10711 | if table_id != None: |
| 10712 | self.table_id = table_id |
| 10713 | else: |
| 10714 | self.table_id = 0 |
| 10715 | if idle_timeout != None: |
| 10716 | self.idle_timeout = idle_timeout |
| 10717 | else: |
| 10718 | self.idle_timeout = 0 |
| 10719 | if hard_timeout != None: |
| 10720 | self.hard_timeout = hard_timeout |
| 10721 | else: |
| 10722 | self.hard_timeout = 0 |
| 10723 | if priority != None: |
| 10724 | self.priority = priority |
| 10725 | else: |
| 10726 | self.priority = 0 |
| 10727 | if buffer_id != None: |
| 10728 | self.buffer_id = buffer_id |
| 10729 | else: |
| 10730 | self.buffer_id = 0 |
| 10731 | if out_port != None: |
| 10732 | self.out_port = out_port |
| 10733 | else: |
| 10734 | self.out_port = 0 |
| 10735 | if out_group != None: |
| 10736 | self.out_group = out_group |
| 10737 | else: |
| 10738 | self.out_group = 0 |
| 10739 | if flags != None: |
| 10740 | self.flags = flags |
| 10741 | else: |
| 10742 | self.flags = 0 |
| 10743 | if importance != None: |
| 10744 | self.importance = importance |
| 10745 | else: |
| 10746 | self.importance = 0 |
| 10747 | if match != None: |
| 10748 | self.match = match |
| 10749 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 10750 | self.match = ofp.match() |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 10751 | if instructions != None: |
| 10752 | self.instructions = instructions |
| 10753 | else: |
| 10754 | self.instructions = [] |
| 10755 | return |
| 10756 | |
| 10757 | def pack(self): |
| 10758 | packed = [] |
| 10759 | packed.append(struct.pack("!B", self.version)) |
| 10760 | packed.append(struct.pack("!B", self.type)) |
| 10761 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10762 | packed.append(struct.pack("!L", self.xid)) |
| 10763 | packed.append(struct.pack("!Q", self.cookie)) |
| 10764 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 10765 | packed.append(struct.pack("!B", self.table_id)) |
| 10766 | packed.append(util.pack_fm_cmd(self._command)) |
| 10767 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 10768 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 10769 | packed.append(struct.pack("!H", self.priority)) |
| 10770 | packed.append(struct.pack("!L", self.buffer_id)) |
| 10771 | packed.append(util.pack_port_no(self.out_port)) |
| 10772 | packed.append(struct.pack("!L", self.out_group)) |
| 10773 | packed.append(struct.pack("!H", self.flags)) |
| 10774 | packed.append(struct.pack("!H", self.importance)) |
| 10775 | packed.append(self.match.pack()) |
| 10776 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
| 10777 | length = sum([len(x) for x in packed]) |
| 10778 | packed[2] = struct.pack("!H", length) |
| 10779 | return ''.join(packed) |
| 10780 | |
| 10781 | @staticmethod |
| 10782 | def unpack(reader): |
| 10783 | obj = flow_modify() |
| 10784 | _version = reader.read("!B")[0] |
| 10785 | assert(_version == 5) |
| 10786 | _type = reader.read("!B")[0] |
| 10787 | assert(_type == 14) |
| 10788 | _length = reader.read("!H")[0] |
| 10789 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 10790 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 10791 | obj.xid = reader.read("!L")[0] |
| 10792 | obj.cookie = reader.read("!Q")[0] |
| 10793 | obj.cookie_mask = reader.read("!Q")[0] |
| 10794 | obj.table_id = reader.read("!B")[0] |
| 10795 | __command = util.unpack_fm_cmd(reader) |
| 10796 | assert(__command == 1) |
| 10797 | obj.idle_timeout = reader.read("!H")[0] |
| 10798 | obj.hard_timeout = reader.read("!H")[0] |
| 10799 | obj.priority = reader.read("!H")[0] |
| 10800 | obj.buffer_id = reader.read("!L")[0] |
| 10801 | obj.out_port = util.unpack_port_no(reader) |
| 10802 | obj.out_group = reader.read("!L")[0] |
| 10803 | obj.flags = reader.read("!H")[0] |
| 10804 | obj.importance = reader.read("!H")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 10805 | obj.match = ofp.match.unpack(reader) |
| 10806 | obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 10807 | return obj |
| 10808 | |
| 10809 | def __eq__(self, other): |
| 10810 | if type(self) != type(other): return False |
| 10811 | if self.xid != other.xid: return False |
| 10812 | if self.cookie != other.cookie: return False |
| 10813 | if self.cookie_mask != other.cookie_mask: return False |
| 10814 | if self.table_id != other.table_id: return False |
| 10815 | if self.idle_timeout != other.idle_timeout: return False |
| 10816 | if self.hard_timeout != other.hard_timeout: return False |
| 10817 | if self.priority != other.priority: return False |
| 10818 | if self.buffer_id != other.buffer_id: return False |
| 10819 | if self.out_port != other.out_port: return False |
| 10820 | if self.out_group != other.out_group: return False |
| 10821 | if self.flags != other.flags: return False |
| 10822 | if self.importance != other.importance: return False |
| 10823 | if self.match != other.match: return False |
| 10824 | if self.instructions != other.instructions: return False |
| 10825 | return True |
| 10826 | |
| 10827 | def pretty_print(self, q): |
| 10828 | q.text("flow_modify {") |
| 10829 | with q.group(): |
| 10830 | with q.indent(2): |
| 10831 | q.breakable() |
| 10832 | q.text("xid = "); |
| 10833 | if self.xid != None: |
| 10834 | q.text("%#x" % self.xid) |
| 10835 | else: |
| 10836 | q.text('None') |
| 10837 | q.text(","); q.breakable() |
| 10838 | q.text("cookie = "); |
| 10839 | q.text("%#x" % self.cookie) |
| 10840 | q.text(","); q.breakable() |
| 10841 | q.text("cookie_mask = "); |
| 10842 | q.text("%#x" % self.cookie_mask) |
| 10843 | q.text(","); q.breakable() |
| 10844 | q.text("table_id = "); |
| 10845 | q.text("%#x" % self.table_id) |
| 10846 | q.text(","); q.breakable() |
| 10847 | q.text("idle_timeout = "); |
| 10848 | q.text("%#x" % self.idle_timeout) |
| 10849 | q.text(","); q.breakable() |
| 10850 | q.text("hard_timeout = "); |
| 10851 | q.text("%#x" % self.hard_timeout) |
| 10852 | q.text(","); q.breakable() |
| 10853 | q.text("priority = "); |
| 10854 | q.text("%#x" % self.priority) |
| 10855 | q.text(","); q.breakable() |
| 10856 | q.text("buffer_id = "); |
| 10857 | q.text("%#x" % self.buffer_id) |
| 10858 | q.text(","); q.breakable() |
| 10859 | q.text("out_port = "); |
| 10860 | q.text(util.pretty_port(self.out_port)) |
| 10861 | q.text(","); q.breakable() |
| 10862 | q.text("out_group = "); |
| 10863 | q.text("%#x" % self.out_group) |
| 10864 | q.text(","); q.breakable() |
| 10865 | q.text("flags = "); |
| 10866 | q.text("%#x" % self.flags) |
| 10867 | q.text(","); q.breakable() |
| 10868 | q.text("importance = "); |
| 10869 | q.text("%#x" % self.importance) |
| 10870 | q.text(","); q.breakable() |
| 10871 | q.text("match = "); |
| 10872 | q.pp(self.match) |
| 10873 | q.text(","); q.breakable() |
| 10874 | q.text("instructions = "); |
| 10875 | q.pp(self.instructions) |
| 10876 | q.breakable() |
| 10877 | q.text('}') |
| 10878 | |
| 10879 | flow_mod.subtypes[1] = flow_modify |
| 10880 | |
| 10881 | class flow_modify_strict(flow_mod): |
| 10882 | version = 5 |
| 10883 | type = 14 |
| 10884 | _command = 2 |
| 10885 | |
| 10886 | 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): |
| 10887 | if xid != None: |
| 10888 | self.xid = xid |
| 10889 | else: |
| 10890 | self.xid = None |
| 10891 | if cookie != None: |
| 10892 | self.cookie = cookie |
| 10893 | else: |
| 10894 | self.cookie = 0 |
| 10895 | if cookie_mask != None: |
| 10896 | self.cookie_mask = cookie_mask |
| 10897 | else: |
| 10898 | self.cookie_mask = 0 |
| 10899 | if table_id != None: |
| 10900 | self.table_id = table_id |
| 10901 | else: |
| 10902 | self.table_id = 0 |
| 10903 | if idle_timeout != None: |
| 10904 | self.idle_timeout = idle_timeout |
| 10905 | else: |
| 10906 | self.idle_timeout = 0 |
| 10907 | if hard_timeout != None: |
| 10908 | self.hard_timeout = hard_timeout |
| 10909 | else: |
| 10910 | self.hard_timeout = 0 |
| 10911 | if priority != None: |
| 10912 | self.priority = priority |
| 10913 | else: |
| 10914 | self.priority = 0 |
| 10915 | if buffer_id != None: |
| 10916 | self.buffer_id = buffer_id |
| 10917 | else: |
| 10918 | self.buffer_id = 0 |
| 10919 | if out_port != None: |
| 10920 | self.out_port = out_port |
| 10921 | else: |
| 10922 | self.out_port = 0 |
| 10923 | if out_group != None: |
| 10924 | self.out_group = out_group |
| 10925 | else: |
| 10926 | self.out_group = 0 |
| 10927 | if flags != None: |
| 10928 | self.flags = flags |
| 10929 | else: |
| 10930 | self.flags = 0 |
| 10931 | if importance != None: |
| 10932 | self.importance = importance |
| 10933 | else: |
| 10934 | self.importance = 0 |
| 10935 | if match != None: |
| 10936 | self.match = match |
| 10937 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 10938 | self.match = ofp.match() |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 10939 | if instructions != None: |
| 10940 | self.instructions = instructions |
| 10941 | else: |
| 10942 | self.instructions = [] |
| 10943 | return |
| 10944 | |
| 10945 | def pack(self): |
| 10946 | packed = [] |
| 10947 | packed.append(struct.pack("!B", self.version)) |
| 10948 | packed.append(struct.pack("!B", self.type)) |
| 10949 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10950 | packed.append(struct.pack("!L", self.xid)) |
| 10951 | packed.append(struct.pack("!Q", self.cookie)) |
| 10952 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 10953 | packed.append(struct.pack("!B", self.table_id)) |
| 10954 | packed.append(util.pack_fm_cmd(self._command)) |
| 10955 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 10956 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 10957 | packed.append(struct.pack("!H", self.priority)) |
| 10958 | packed.append(struct.pack("!L", self.buffer_id)) |
| 10959 | packed.append(util.pack_port_no(self.out_port)) |
| 10960 | packed.append(struct.pack("!L", self.out_group)) |
| 10961 | packed.append(struct.pack("!H", self.flags)) |
| 10962 | packed.append(struct.pack("!H", self.importance)) |
| 10963 | packed.append(self.match.pack()) |
| 10964 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
| 10965 | length = sum([len(x) for x in packed]) |
| 10966 | packed[2] = struct.pack("!H", length) |
| 10967 | return ''.join(packed) |
| 10968 | |
| 10969 | @staticmethod |
| 10970 | def unpack(reader): |
| 10971 | obj = flow_modify_strict() |
| 10972 | _version = reader.read("!B")[0] |
| 10973 | assert(_version == 5) |
| 10974 | _type = reader.read("!B")[0] |
| 10975 | assert(_type == 14) |
| 10976 | _length = reader.read("!H")[0] |
| 10977 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 10978 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 10979 | obj.xid = reader.read("!L")[0] |
| 10980 | obj.cookie = reader.read("!Q")[0] |
| 10981 | obj.cookie_mask = reader.read("!Q")[0] |
| 10982 | obj.table_id = reader.read("!B")[0] |
| 10983 | __command = util.unpack_fm_cmd(reader) |
| 10984 | assert(__command == 2) |
| 10985 | obj.idle_timeout = reader.read("!H")[0] |
| 10986 | obj.hard_timeout = reader.read("!H")[0] |
| 10987 | obj.priority = reader.read("!H")[0] |
| 10988 | obj.buffer_id = reader.read("!L")[0] |
| 10989 | obj.out_port = util.unpack_port_no(reader) |
| 10990 | obj.out_group = reader.read("!L")[0] |
| 10991 | obj.flags = reader.read("!H")[0] |
| 10992 | obj.importance = reader.read("!H")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 10993 | obj.match = ofp.match.unpack(reader) |
| 10994 | obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 10995 | return obj |
| 10996 | |
| 10997 | def __eq__(self, other): |
| 10998 | if type(self) != type(other): return False |
| 10999 | if self.xid != other.xid: return False |
| 11000 | if self.cookie != other.cookie: return False |
| 11001 | if self.cookie_mask != other.cookie_mask: return False |
| 11002 | if self.table_id != other.table_id: return False |
| 11003 | if self.idle_timeout != other.idle_timeout: return False |
| 11004 | if self.hard_timeout != other.hard_timeout: return False |
| 11005 | if self.priority != other.priority: return False |
| 11006 | if self.buffer_id != other.buffer_id: return False |
| 11007 | if self.out_port != other.out_port: return False |
| 11008 | if self.out_group != other.out_group: return False |
| 11009 | if self.flags != other.flags: return False |
| 11010 | if self.importance != other.importance: return False |
| 11011 | if self.match != other.match: return False |
| 11012 | if self.instructions != other.instructions: return False |
| 11013 | return True |
| 11014 | |
| 11015 | def pretty_print(self, q): |
| 11016 | q.text("flow_modify_strict {") |
| 11017 | with q.group(): |
| 11018 | with q.indent(2): |
| 11019 | q.breakable() |
| 11020 | q.text("xid = "); |
| 11021 | if self.xid != None: |
| 11022 | q.text("%#x" % self.xid) |
| 11023 | else: |
| 11024 | q.text('None') |
| 11025 | q.text(","); q.breakable() |
| 11026 | q.text("cookie = "); |
| 11027 | q.text("%#x" % self.cookie) |
| 11028 | q.text(","); q.breakable() |
| 11029 | q.text("cookie_mask = "); |
| 11030 | q.text("%#x" % self.cookie_mask) |
| 11031 | q.text(","); q.breakable() |
| 11032 | q.text("table_id = "); |
| 11033 | q.text("%#x" % self.table_id) |
| 11034 | q.text(","); q.breakable() |
| 11035 | q.text("idle_timeout = "); |
| 11036 | q.text("%#x" % self.idle_timeout) |
| 11037 | q.text(","); q.breakable() |
| 11038 | q.text("hard_timeout = "); |
| 11039 | q.text("%#x" % self.hard_timeout) |
| 11040 | q.text(","); q.breakable() |
| 11041 | q.text("priority = "); |
| 11042 | q.text("%#x" % self.priority) |
| 11043 | q.text(","); q.breakable() |
| 11044 | q.text("buffer_id = "); |
| 11045 | q.text("%#x" % self.buffer_id) |
| 11046 | q.text(","); q.breakable() |
| 11047 | q.text("out_port = "); |
| 11048 | q.text(util.pretty_port(self.out_port)) |
| 11049 | q.text(","); q.breakable() |
| 11050 | q.text("out_group = "); |
| 11051 | q.text("%#x" % self.out_group) |
| 11052 | q.text(","); q.breakable() |
| 11053 | q.text("flags = "); |
| 11054 | q.text("%#x" % self.flags) |
| 11055 | q.text(","); q.breakable() |
| 11056 | q.text("importance = "); |
| 11057 | q.text("%#x" % self.importance) |
| 11058 | q.text(","); q.breakable() |
| 11059 | q.text("match = "); |
| 11060 | q.pp(self.match) |
| 11061 | q.text(","); q.breakable() |
| 11062 | q.text("instructions = "); |
| 11063 | q.pp(self.instructions) |
| 11064 | q.breakable() |
| 11065 | q.text('}') |
| 11066 | |
| 11067 | flow_mod.subtypes[2] = flow_modify_strict |
| 11068 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 11069 | class flow_monitor_failed_error_msg(error_msg): |
| 11070 | version = 5 |
| 11071 | type = 1 |
| 11072 | err_type = 16 |
| 11073 | |
| 11074 | def __init__(self, xid=None, code=None, data=None): |
| 11075 | if xid != None: |
| 11076 | self.xid = xid |
| 11077 | else: |
| 11078 | self.xid = None |
| 11079 | if code != None: |
| 11080 | self.code = code |
| 11081 | else: |
| 11082 | self.code = 0 |
| 11083 | if data != None: |
| 11084 | self.data = data |
| 11085 | else: |
| 11086 | self.data = '' |
| 11087 | return |
| 11088 | |
| 11089 | def pack(self): |
| 11090 | packed = [] |
| 11091 | packed.append(struct.pack("!B", self.version)) |
| 11092 | packed.append(struct.pack("!B", self.type)) |
| 11093 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11094 | packed.append(struct.pack("!L", self.xid)) |
| 11095 | packed.append(struct.pack("!H", self.err_type)) |
| 11096 | packed.append(struct.pack("!H", self.code)) |
| 11097 | packed.append(self.data) |
| 11098 | length = sum([len(x) for x in packed]) |
| 11099 | packed[2] = struct.pack("!H", length) |
| 11100 | return ''.join(packed) |
| 11101 | |
| 11102 | @staticmethod |
| 11103 | def unpack(reader): |
| 11104 | obj = flow_monitor_failed_error_msg() |
| 11105 | _version = reader.read("!B")[0] |
| 11106 | assert(_version == 5) |
| 11107 | _type = reader.read("!B")[0] |
| 11108 | assert(_type == 1) |
| 11109 | _length = reader.read("!H")[0] |
| 11110 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11111 | reader = orig_reader.slice(_length, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 11112 | obj.xid = reader.read("!L")[0] |
| 11113 | _err_type = reader.read("!H")[0] |
| 11114 | assert(_err_type == 16) |
| 11115 | obj.code = reader.read("!H")[0] |
| 11116 | obj.data = str(reader.read_all()) |
| 11117 | return obj |
| 11118 | |
| 11119 | def __eq__(self, other): |
| 11120 | if type(self) != type(other): return False |
| 11121 | if self.xid != other.xid: return False |
| 11122 | if self.code != other.code: return False |
| 11123 | if self.data != other.data: return False |
| 11124 | return True |
| 11125 | |
| 11126 | def pretty_print(self, q): |
| 11127 | q.text("flow_monitor_failed_error_msg {") |
| 11128 | with q.group(): |
| 11129 | with q.indent(2): |
| 11130 | q.breakable() |
| 11131 | q.text("xid = "); |
| 11132 | if self.xid != None: |
| 11133 | q.text("%#x" % self.xid) |
| 11134 | else: |
| 11135 | q.text('None') |
| 11136 | q.text(","); q.breakable() |
| 11137 | q.text("code = "); |
| 11138 | q.text("%#x" % self.code) |
| 11139 | q.text(","); q.breakable() |
| 11140 | q.text("data = "); |
| 11141 | q.pp(self.data) |
| 11142 | q.breakable() |
| 11143 | q.text('}') |
| 11144 | |
| 11145 | error_msg.subtypes[16] = flow_monitor_failed_error_msg |
| 11146 | |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 11147 | class flow_removed(message): |
| 11148 | version = 5 |
| 11149 | type = 11 |
| 11150 | |
| 11151 | 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): |
| 11152 | if xid != None: |
| 11153 | self.xid = xid |
| 11154 | else: |
| 11155 | self.xid = None |
| 11156 | if cookie != None: |
| 11157 | self.cookie = cookie |
| 11158 | else: |
| 11159 | self.cookie = 0 |
| 11160 | if priority != None: |
| 11161 | self.priority = priority |
| 11162 | else: |
| 11163 | self.priority = 0 |
| 11164 | if reason != None: |
| 11165 | self.reason = reason |
| 11166 | else: |
| 11167 | self.reason = 0 |
| 11168 | if table_id != None: |
| 11169 | self.table_id = table_id |
| 11170 | else: |
| 11171 | self.table_id = 0 |
| 11172 | if duration_sec != None: |
| 11173 | self.duration_sec = duration_sec |
| 11174 | else: |
| 11175 | self.duration_sec = 0 |
| 11176 | if duration_nsec != None: |
| 11177 | self.duration_nsec = duration_nsec |
| 11178 | else: |
| 11179 | self.duration_nsec = 0 |
| 11180 | if idle_timeout != None: |
| 11181 | self.idle_timeout = idle_timeout |
| 11182 | else: |
| 11183 | self.idle_timeout = 0 |
| 11184 | if hard_timeout != None: |
| 11185 | self.hard_timeout = hard_timeout |
| 11186 | else: |
| 11187 | self.hard_timeout = 0 |
| 11188 | if packet_count != None: |
| 11189 | self.packet_count = packet_count |
| 11190 | else: |
| 11191 | self.packet_count = 0 |
| 11192 | if byte_count != None: |
| 11193 | self.byte_count = byte_count |
| 11194 | else: |
| 11195 | self.byte_count = 0 |
| 11196 | if match != None: |
| 11197 | self.match = match |
| 11198 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 11199 | self.match = ofp.match() |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 11200 | return |
| 11201 | |
| 11202 | def pack(self): |
| 11203 | packed = [] |
| 11204 | packed.append(struct.pack("!B", self.version)) |
| 11205 | packed.append(struct.pack("!B", self.type)) |
| 11206 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11207 | packed.append(struct.pack("!L", self.xid)) |
| 11208 | packed.append(struct.pack("!Q", self.cookie)) |
| 11209 | packed.append(struct.pack("!H", self.priority)) |
| 11210 | packed.append(struct.pack("!B", self.reason)) |
| 11211 | packed.append(struct.pack("!B", self.table_id)) |
| 11212 | packed.append(struct.pack("!L", self.duration_sec)) |
| 11213 | packed.append(struct.pack("!L", self.duration_nsec)) |
| 11214 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 11215 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 11216 | packed.append(struct.pack("!Q", self.packet_count)) |
| 11217 | packed.append(struct.pack("!Q", self.byte_count)) |
| 11218 | packed.append(self.match.pack()) |
| 11219 | length = sum([len(x) for x in packed]) |
| 11220 | packed[2] = struct.pack("!H", length) |
| 11221 | return ''.join(packed) |
| 11222 | |
| 11223 | @staticmethod |
| 11224 | def unpack(reader): |
| 11225 | obj = flow_removed() |
| 11226 | _version = reader.read("!B")[0] |
| 11227 | assert(_version == 5) |
| 11228 | _type = reader.read("!B")[0] |
| 11229 | assert(_type == 11) |
| 11230 | _length = reader.read("!H")[0] |
| 11231 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11232 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 11233 | obj.xid = reader.read("!L")[0] |
| 11234 | obj.cookie = reader.read("!Q")[0] |
| 11235 | obj.priority = reader.read("!H")[0] |
| 11236 | obj.reason = reader.read("!B")[0] |
| 11237 | obj.table_id = reader.read("!B")[0] |
| 11238 | obj.duration_sec = reader.read("!L")[0] |
| 11239 | obj.duration_nsec = reader.read("!L")[0] |
| 11240 | obj.idle_timeout = reader.read("!H")[0] |
| 11241 | obj.hard_timeout = reader.read("!H")[0] |
| 11242 | obj.packet_count = reader.read("!Q")[0] |
| 11243 | obj.byte_count = reader.read("!Q")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 11244 | obj.match = ofp.match.unpack(reader) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 11245 | return obj |
| 11246 | |
| 11247 | def __eq__(self, other): |
| 11248 | if type(self) != type(other): return False |
| 11249 | if self.xid != other.xid: return False |
| 11250 | if self.cookie != other.cookie: return False |
| 11251 | if self.priority != other.priority: return False |
| 11252 | if self.reason != other.reason: return False |
| 11253 | if self.table_id != other.table_id: return False |
| 11254 | if self.duration_sec != other.duration_sec: return False |
| 11255 | if self.duration_nsec != other.duration_nsec: return False |
| 11256 | if self.idle_timeout != other.idle_timeout: return False |
| 11257 | if self.hard_timeout != other.hard_timeout: return False |
| 11258 | if self.packet_count != other.packet_count: return False |
| 11259 | if self.byte_count != other.byte_count: return False |
| 11260 | if self.match != other.match: return False |
| 11261 | return True |
| 11262 | |
| 11263 | def pretty_print(self, q): |
| 11264 | q.text("flow_removed {") |
| 11265 | with q.group(): |
| 11266 | with q.indent(2): |
| 11267 | q.breakable() |
| 11268 | q.text("xid = "); |
| 11269 | if self.xid != None: |
| 11270 | q.text("%#x" % self.xid) |
| 11271 | else: |
| 11272 | q.text('None') |
| 11273 | q.text(","); q.breakable() |
| 11274 | q.text("cookie = "); |
| 11275 | q.text("%#x" % self.cookie) |
| 11276 | q.text(","); q.breakable() |
| 11277 | q.text("priority = "); |
| 11278 | q.text("%#x" % self.priority) |
| 11279 | q.text(","); q.breakable() |
| 11280 | q.text("reason = "); |
| 11281 | q.text("%#x" % self.reason) |
| 11282 | q.text(","); q.breakable() |
| 11283 | q.text("table_id = "); |
| 11284 | q.text("%#x" % self.table_id) |
| 11285 | q.text(","); q.breakable() |
| 11286 | q.text("duration_sec = "); |
| 11287 | q.text("%#x" % self.duration_sec) |
| 11288 | q.text(","); q.breakable() |
| 11289 | q.text("duration_nsec = "); |
| 11290 | q.text("%#x" % self.duration_nsec) |
| 11291 | q.text(","); q.breakable() |
| 11292 | q.text("idle_timeout = "); |
| 11293 | q.text("%#x" % self.idle_timeout) |
| 11294 | q.text(","); q.breakable() |
| 11295 | q.text("hard_timeout = "); |
| 11296 | q.text("%#x" % self.hard_timeout) |
| 11297 | q.text(","); q.breakable() |
| 11298 | q.text("packet_count = "); |
| 11299 | q.text("%#x" % self.packet_count) |
| 11300 | q.text(","); q.breakable() |
| 11301 | q.text("byte_count = "); |
| 11302 | q.text("%#x" % self.byte_count) |
| 11303 | q.text(","); q.breakable() |
| 11304 | q.text("match = "); |
| 11305 | q.pp(self.match) |
| 11306 | q.breakable() |
| 11307 | q.text('}') |
| 11308 | |
| 11309 | message.subtypes[11] = flow_removed |
| 11310 | |
| 11311 | class flow_stats_reply(stats_reply): |
| 11312 | version = 5 |
| 11313 | type = 19 |
| 11314 | stats_type = 1 |
| 11315 | |
| 11316 | def __init__(self, xid=None, flags=None, entries=None): |
| 11317 | if xid != None: |
| 11318 | self.xid = xid |
| 11319 | else: |
| 11320 | self.xid = None |
| 11321 | if flags != None: |
| 11322 | self.flags = flags |
| 11323 | else: |
| 11324 | self.flags = 0 |
| 11325 | if entries != None: |
| 11326 | self.entries = entries |
| 11327 | else: |
| 11328 | self.entries = [] |
| 11329 | return |
| 11330 | |
| 11331 | def pack(self): |
| 11332 | packed = [] |
| 11333 | packed.append(struct.pack("!B", self.version)) |
| 11334 | packed.append(struct.pack("!B", self.type)) |
| 11335 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11336 | packed.append(struct.pack("!L", self.xid)) |
| 11337 | packed.append(struct.pack("!H", self.stats_type)) |
| 11338 | packed.append(struct.pack("!H", self.flags)) |
| 11339 | packed.append('\x00' * 4) |
| 11340 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 11341 | length = sum([len(x) for x in packed]) |
| 11342 | packed[2] = struct.pack("!H", length) |
| 11343 | return ''.join(packed) |
| 11344 | |
| 11345 | @staticmethod |
| 11346 | def unpack(reader): |
| 11347 | obj = flow_stats_reply() |
| 11348 | _version = reader.read("!B")[0] |
| 11349 | assert(_version == 5) |
| 11350 | _type = reader.read("!B")[0] |
| 11351 | assert(_type == 19) |
| 11352 | _length = reader.read("!H")[0] |
| 11353 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11354 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 11355 | obj.xid = reader.read("!L")[0] |
| 11356 | _stats_type = reader.read("!H")[0] |
| 11357 | assert(_stats_type == 1) |
| 11358 | obj.flags = reader.read("!H")[0] |
| 11359 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 11360 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.flow_stats_entry.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 11361 | return obj |
| 11362 | |
| 11363 | def __eq__(self, other): |
| 11364 | if type(self) != type(other): return False |
| 11365 | if self.xid != other.xid: return False |
| 11366 | if self.flags != other.flags: return False |
| 11367 | if self.entries != other.entries: return False |
| 11368 | return True |
| 11369 | |
| 11370 | def pretty_print(self, q): |
| 11371 | q.text("flow_stats_reply {") |
| 11372 | with q.group(): |
| 11373 | with q.indent(2): |
| 11374 | q.breakable() |
| 11375 | q.text("xid = "); |
| 11376 | if self.xid != None: |
| 11377 | q.text("%#x" % self.xid) |
| 11378 | else: |
| 11379 | q.text('None') |
| 11380 | q.text(","); q.breakable() |
| 11381 | q.text("flags = "); |
| 11382 | q.text("%#x" % self.flags) |
| 11383 | q.text(","); q.breakable() |
| 11384 | q.text("entries = "); |
| 11385 | q.pp(self.entries) |
| 11386 | q.breakable() |
| 11387 | q.text('}') |
| 11388 | |
| 11389 | stats_reply.subtypes[1] = flow_stats_reply |
| 11390 | |
| 11391 | class flow_stats_request(stats_request): |
| 11392 | version = 5 |
| 11393 | type = 18 |
| 11394 | stats_type = 1 |
| 11395 | |
| 11396 | def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None): |
| 11397 | if xid != None: |
| 11398 | self.xid = xid |
| 11399 | else: |
| 11400 | self.xid = None |
| 11401 | if flags != None: |
| 11402 | self.flags = flags |
| 11403 | else: |
| 11404 | self.flags = 0 |
| 11405 | if table_id != None: |
| 11406 | self.table_id = table_id |
| 11407 | else: |
| 11408 | self.table_id = 0 |
| 11409 | if out_port != None: |
| 11410 | self.out_port = out_port |
| 11411 | else: |
| 11412 | self.out_port = 0 |
| 11413 | if out_group != None: |
| 11414 | self.out_group = out_group |
| 11415 | else: |
| 11416 | self.out_group = 0 |
| 11417 | if cookie != None: |
| 11418 | self.cookie = cookie |
| 11419 | else: |
| 11420 | self.cookie = 0 |
| 11421 | if cookie_mask != None: |
| 11422 | self.cookie_mask = cookie_mask |
| 11423 | else: |
| 11424 | self.cookie_mask = 0 |
| 11425 | if match != None: |
| 11426 | self.match = match |
| 11427 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 11428 | self.match = ofp.match() |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 11429 | return |
| 11430 | |
| 11431 | def pack(self): |
| 11432 | packed = [] |
| 11433 | packed.append(struct.pack("!B", self.version)) |
| 11434 | packed.append(struct.pack("!B", self.type)) |
| 11435 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11436 | packed.append(struct.pack("!L", self.xid)) |
| 11437 | packed.append(struct.pack("!H", self.stats_type)) |
| 11438 | packed.append(struct.pack("!H", self.flags)) |
| 11439 | packed.append('\x00' * 4) |
| 11440 | packed.append(struct.pack("!B", self.table_id)) |
| 11441 | packed.append('\x00' * 3) |
| 11442 | packed.append(util.pack_port_no(self.out_port)) |
| 11443 | packed.append(struct.pack("!L", self.out_group)) |
| 11444 | packed.append('\x00' * 4) |
| 11445 | packed.append(struct.pack("!Q", self.cookie)) |
| 11446 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 11447 | packed.append(self.match.pack()) |
| 11448 | length = sum([len(x) for x in packed]) |
| 11449 | packed[2] = struct.pack("!H", length) |
| 11450 | return ''.join(packed) |
| 11451 | |
| 11452 | @staticmethod |
| 11453 | def unpack(reader): |
| 11454 | obj = flow_stats_request() |
| 11455 | _version = reader.read("!B")[0] |
| 11456 | assert(_version == 5) |
| 11457 | _type = reader.read("!B")[0] |
| 11458 | assert(_type == 18) |
| 11459 | _length = reader.read("!H")[0] |
| 11460 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11461 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 11462 | obj.xid = reader.read("!L")[0] |
| 11463 | _stats_type = reader.read("!H")[0] |
| 11464 | assert(_stats_type == 1) |
| 11465 | obj.flags = reader.read("!H")[0] |
| 11466 | reader.skip(4) |
| 11467 | obj.table_id = reader.read("!B")[0] |
| 11468 | reader.skip(3) |
| 11469 | obj.out_port = util.unpack_port_no(reader) |
| 11470 | obj.out_group = reader.read("!L")[0] |
| 11471 | reader.skip(4) |
| 11472 | obj.cookie = reader.read("!Q")[0] |
| 11473 | obj.cookie_mask = reader.read("!Q")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 11474 | obj.match = ofp.match.unpack(reader) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 11475 | return obj |
| 11476 | |
| 11477 | def __eq__(self, other): |
| 11478 | if type(self) != type(other): return False |
| 11479 | if self.xid != other.xid: return False |
| 11480 | if self.flags != other.flags: return False |
| 11481 | if self.table_id != other.table_id: return False |
| 11482 | if self.out_port != other.out_port: return False |
| 11483 | if self.out_group != other.out_group: return False |
| 11484 | if self.cookie != other.cookie: return False |
| 11485 | if self.cookie_mask != other.cookie_mask: return False |
| 11486 | if self.match != other.match: return False |
| 11487 | return True |
| 11488 | |
| 11489 | def pretty_print(self, q): |
| 11490 | q.text("flow_stats_request {") |
| 11491 | with q.group(): |
| 11492 | with q.indent(2): |
| 11493 | q.breakable() |
| 11494 | q.text("xid = "); |
| 11495 | if self.xid != None: |
| 11496 | q.text("%#x" % self.xid) |
| 11497 | else: |
| 11498 | q.text('None') |
| 11499 | q.text(","); q.breakable() |
| 11500 | q.text("flags = "); |
| 11501 | q.text("%#x" % self.flags) |
| 11502 | q.text(","); q.breakable() |
| 11503 | q.text("table_id = "); |
| 11504 | q.text("%#x" % self.table_id) |
| 11505 | q.text(","); q.breakable() |
| 11506 | q.text("out_port = "); |
| 11507 | q.text(util.pretty_port(self.out_port)) |
| 11508 | q.text(","); q.breakable() |
| 11509 | q.text("out_group = "); |
| 11510 | q.text("%#x" % self.out_group) |
| 11511 | q.text(","); q.breakable() |
| 11512 | q.text("cookie = "); |
| 11513 | q.text("%#x" % self.cookie) |
| 11514 | q.text(","); q.breakable() |
| 11515 | q.text("cookie_mask = "); |
| 11516 | q.text("%#x" % self.cookie_mask) |
| 11517 | q.text(","); q.breakable() |
| 11518 | q.text("match = "); |
| 11519 | q.pp(self.match) |
| 11520 | q.breakable() |
| 11521 | q.text('}') |
| 11522 | |
| 11523 | stats_request.subtypes[1] = flow_stats_request |
| 11524 | |
| 11525 | class get_config_reply(message): |
| 11526 | version = 5 |
| 11527 | type = 8 |
| 11528 | |
| 11529 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
| 11530 | if xid != None: |
| 11531 | self.xid = xid |
| 11532 | else: |
| 11533 | self.xid = None |
| 11534 | if flags != None: |
| 11535 | self.flags = flags |
| 11536 | else: |
| 11537 | self.flags = 0 |
| 11538 | if miss_send_len != None: |
| 11539 | self.miss_send_len = miss_send_len |
| 11540 | else: |
| 11541 | self.miss_send_len = 0 |
| 11542 | return |
| 11543 | |
| 11544 | def pack(self): |
| 11545 | packed = [] |
| 11546 | packed.append(struct.pack("!B", self.version)) |
| 11547 | packed.append(struct.pack("!B", self.type)) |
| 11548 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11549 | packed.append(struct.pack("!L", self.xid)) |
| 11550 | packed.append(struct.pack("!H", self.flags)) |
| 11551 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 11552 | length = sum([len(x) for x in packed]) |
| 11553 | packed[2] = struct.pack("!H", length) |
| 11554 | return ''.join(packed) |
| 11555 | |
| 11556 | @staticmethod |
| 11557 | def unpack(reader): |
| 11558 | obj = get_config_reply() |
| 11559 | _version = reader.read("!B")[0] |
| 11560 | assert(_version == 5) |
| 11561 | _type = reader.read("!B")[0] |
| 11562 | assert(_type == 8) |
| 11563 | _length = reader.read("!H")[0] |
| 11564 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11565 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 11566 | obj.xid = reader.read("!L")[0] |
| 11567 | obj.flags = reader.read("!H")[0] |
| 11568 | obj.miss_send_len = reader.read("!H")[0] |
| 11569 | return obj |
| 11570 | |
| 11571 | def __eq__(self, other): |
| 11572 | if type(self) != type(other): return False |
| 11573 | if self.xid != other.xid: return False |
| 11574 | if self.flags != other.flags: return False |
| 11575 | if self.miss_send_len != other.miss_send_len: return False |
| 11576 | return True |
| 11577 | |
| 11578 | def pretty_print(self, q): |
| 11579 | q.text("get_config_reply {") |
| 11580 | with q.group(): |
| 11581 | with q.indent(2): |
| 11582 | q.breakable() |
| 11583 | q.text("xid = "); |
| 11584 | if self.xid != None: |
| 11585 | q.text("%#x" % self.xid) |
| 11586 | else: |
| 11587 | q.text('None') |
| 11588 | q.text(","); q.breakable() |
| 11589 | q.text("flags = "); |
| 11590 | q.text("%#x" % self.flags) |
| 11591 | q.text(","); q.breakable() |
| 11592 | q.text("miss_send_len = "); |
| 11593 | q.text("%#x" % self.miss_send_len) |
| 11594 | q.breakable() |
| 11595 | q.text('}') |
| 11596 | |
| 11597 | message.subtypes[8] = get_config_reply |
| 11598 | |
| 11599 | class get_config_request(message): |
| 11600 | version = 5 |
| 11601 | type = 7 |
| 11602 | |
| 11603 | def __init__(self, xid=None): |
| 11604 | if xid != None: |
| 11605 | self.xid = xid |
| 11606 | else: |
| 11607 | self.xid = None |
| 11608 | return |
| 11609 | |
| 11610 | def pack(self): |
| 11611 | packed = [] |
| 11612 | packed.append(struct.pack("!B", self.version)) |
| 11613 | packed.append(struct.pack("!B", self.type)) |
| 11614 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11615 | packed.append(struct.pack("!L", self.xid)) |
| 11616 | length = sum([len(x) for x in packed]) |
| 11617 | packed[2] = struct.pack("!H", length) |
| 11618 | return ''.join(packed) |
| 11619 | |
| 11620 | @staticmethod |
| 11621 | def unpack(reader): |
| 11622 | obj = get_config_request() |
| 11623 | _version = reader.read("!B")[0] |
| 11624 | assert(_version == 5) |
| 11625 | _type = reader.read("!B")[0] |
| 11626 | assert(_type == 7) |
| 11627 | _length = reader.read("!H")[0] |
| 11628 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11629 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 11630 | obj.xid = reader.read("!L")[0] |
| 11631 | return obj |
| 11632 | |
| 11633 | def __eq__(self, other): |
| 11634 | if type(self) != type(other): return False |
| 11635 | if self.xid != other.xid: return False |
| 11636 | return True |
| 11637 | |
| 11638 | def pretty_print(self, q): |
| 11639 | q.text("get_config_request {") |
| 11640 | with q.group(): |
| 11641 | with q.indent(2): |
| 11642 | q.breakable() |
| 11643 | q.text("xid = "); |
| 11644 | if self.xid != None: |
| 11645 | q.text("%#x" % self.xid) |
| 11646 | else: |
| 11647 | q.text('None') |
| 11648 | q.breakable() |
| 11649 | q.text('}') |
| 11650 | |
| 11651 | message.subtypes[7] = get_config_request |
| 11652 | |
| 11653 | class group_mod(message): |
| 11654 | subtypes = {} |
| 11655 | |
| 11656 | version = 5 |
| 11657 | type = 15 |
| 11658 | |
| 11659 | def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None): |
| 11660 | if xid != None: |
| 11661 | self.xid = xid |
| 11662 | else: |
| 11663 | self.xid = None |
| 11664 | if command != None: |
| 11665 | self.command = command |
| 11666 | else: |
| 11667 | self.command = 0 |
| 11668 | if group_type != None: |
| 11669 | self.group_type = group_type |
| 11670 | else: |
| 11671 | self.group_type = 0 |
| 11672 | if group_id != None: |
| 11673 | self.group_id = group_id |
| 11674 | else: |
| 11675 | self.group_id = 0 |
| 11676 | if buckets != None: |
| 11677 | self.buckets = buckets |
| 11678 | else: |
| 11679 | self.buckets = [] |
| 11680 | return |
| 11681 | |
| 11682 | def pack(self): |
| 11683 | packed = [] |
| 11684 | packed.append(struct.pack("!B", self.version)) |
| 11685 | packed.append(struct.pack("!B", self.type)) |
| 11686 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11687 | packed.append(struct.pack("!L", self.xid)) |
| 11688 | packed.append(struct.pack("!H", self.command)) |
| 11689 | packed.append(struct.pack("!B", self.group_type)) |
| 11690 | packed.append('\x00' * 1) |
| 11691 | packed.append(struct.pack("!L", self.group_id)) |
| 11692 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
| 11693 | length = sum([len(x) for x in packed]) |
| 11694 | packed[2] = struct.pack("!H", length) |
| 11695 | return ''.join(packed) |
| 11696 | |
| 11697 | @staticmethod |
| 11698 | def unpack(reader): |
| 11699 | subtype, = reader.peek('!H', 8) |
| 11700 | subclass = group_mod.subtypes.get(subtype) |
| 11701 | if subclass: |
| 11702 | return subclass.unpack(reader) |
| 11703 | |
| 11704 | obj = group_mod() |
| 11705 | _version = reader.read("!B")[0] |
| 11706 | assert(_version == 5) |
| 11707 | _type = reader.read("!B")[0] |
| 11708 | assert(_type == 15) |
| 11709 | _length = reader.read("!H")[0] |
| 11710 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11711 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 11712 | obj.xid = reader.read("!L")[0] |
| 11713 | obj.command = reader.read("!H")[0] |
| 11714 | obj.group_type = reader.read("!B")[0] |
| 11715 | reader.skip(1) |
| 11716 | obj.group_id = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 11717 | obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 11718 | return obj |
| 11719 | |
| 11720 | def __eq__(self, other): |
| 11721 | if type(self) != type(other): return False |
| 11722 | if self.xid != other.xid: return False |
| 11723 | if self.command != other.command: return False |
| 11724 | if self.group_type != other.group_type: return False |
| 11725 | if self.group_id != other.group_id: return False |
| 11726 | if self.buckets != other.buckets: return False |
| 11727 | return True |
| 11728 | |
| 11729 | def pretty_print(self, q): |
| 11730 | q.text("group_mod {") |
| 11731 | with q.group(): |
| 11732 | with q.indent(2): |
| 11733 | q.breakable() |
| 11734 | q.text("xid = "); |
| 11735 | if self.xid != None: |
| 11736 | q.text("%#x" % self.xid) |
| 11737 | else: |
| 11738 | q.text('None') |
| 11739 | q.text(","); q.breakable() |
| 11740 | q.text("group_type = "); |
| 11741 | q.text("%#x" % self.group_type) |
| 11742 | q.text(","); q.breakable() |
| 11743 | q.text("group_id = "); |
| 11744 | q.text("%#x" % self.group_id) |
| 11745 | q.text(","); q.breakable() |
| 11746 | q.text("buckets = "); |
| 11747 | q.pp(self.buckets) |
| 11748 | q.breakable() |
| 11749 | q.text('}') |
| 11750 | |
| 11751 | message.subtypes[15] = group_mod |
| 11752 | |
| 11753 | class group_add(group_mod): |
| 11754 | version = 5 |
| 11755 | type = 15 |
| 11756 | command = 0 |
| 11757 | |
| 11758 | def __init__(self, xid=None, group_type=None, group_id=None, buckets=None): |
| 11759 | if xid != None: |
| 11760 | self.xid = xid |
| 11761 | else: |
| 11762 | self.xid = None |
| 11763 | if group_type != None: |
| 11764 | self.group_type = group_type |
| 11765 | else: |
| 11766 | self.group_type = 0 |
| 11767 | if group_id != None: |
| 11768 | self.group_id = group_id |
| 11769 | else: |
| 11770 | self.group_id = 0 |
| 11771 | if buckets != None: |
| 11772 | self.buckets = buckets |
| 11773 | else: |
| 11774 | self.buckets = [] |
| 11775 | return |
| 11776 | |
| 11777 | def pack(self): |
| 11778 | packed = [] |
| 11779 | packed.append(struct.pack("!B", self.version)) |
| 11780 | packed.append(struct.pack("!B", self.type)) |
| 11781 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11782 | packed.append(struct.pack("!L", self.xid)) |
| 11783 | packed.append(struct.pack("!H", self.command)) |
| 11784 | packed.append(struct.pack("!B", self.group_type)) |
| 11785 | packed.append('\x00' * 1) |
| 11786 | packed.append(struct.pack("!L", self.group_id)) |
| 11787 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
| 11788 | length = sum([len(x) for x in packed]) |
| 11789 | packed[2] = struct.pack("!H", length) |
| 11790 | return ''.join(packed) |
| 11791 | |
| 11792 | @staticmethod |
| 11793 | def unpack(reader): |
| 11794 | obj = group_add() |
| 11795 | _version = reader.read("!B")[0] |
| 11796 | assert(_version == 5) |
| 11797 | _type = reader.read("!B")[0] |
| 11798 | assert(_type == 15) |
| 11799 | _length = reader.read("!H")[0] |
| 11800 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11801 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 11802 | obj.xid = reader.read("!L")[0] |
| 11803 | _command = reader.read("!H")[0] |
| 11804 | assert(_command == 0) |
| 11805 | obj.group_type = reader.read("!B")[0] |
| 11806 | reader.skip(1) |
| 11807 | obj.group_id = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 11808 | obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 11809 | return obj |
| 11810 | |
| 11811 | def __eq__(self, other): |
| 11812 | if type(self) != type(other): return False |
| 11813 | if self.xid != other.xid: return False |
| 11814 | if self.group_type != other.group_type: return False |
| 11815 | if self.group_id != other.group_id: return False |
| 11816 | if self.buckets != other.buckets: return False |
| 11817 | return True |
| 11818 | |
| 11819 | def pretty_print(self, q): |
| 11820 | q.text("group_add {") |
| 11821 | with q.group(): |
| 11822 | with q.indent(2): |
| 11823 | q.breakable() |
| 11824 | q.text("xid = "); |
| 11825 | if self.xid != None: |
| 11826 | q.text("%#x" % self.xid) |
| 11827 | else: |
| 11828 | q.text('None') |
| 11829 | q.text(","); q.breakable() |
| 11830 | q.text("group_type = "); |
| 11831 | q.text("%#x" % self.group_type) |
| 11832 | q.text(","); q.breakable() |
| 11833 | q.text("group_id = "); |
| 11834 | q.text("%#x" % self.group_id) |
| 11835 | q.text(","); q.breakable() |
| 11836 | q.text("buckets = "); |
| 11837 | q.pp(self.buckets) |
| 11838 | q.breakable() |
| 11839 | q.text('}') |
| 11840 | |
| 11841 | group_mod.subtypes[0] = group_add |
| 11842 | |
| 11843 | class group_delete(group_mod): |
| 11844 | version = 5 |
| 11845 | type = 15 |
| 11846 | command = 2 |
| 11847 | |
| 11848 | def __init__(self, xid=None, group_type=None, group_id=None, buckets=None): |
| 11849 | if xid != None: |
| 11850 | self.xid = xid |
| 11851 | else: |
| 11852 | self.xid = None |
| 11853 | if group_type != None: |
| 11854 | self.group_type = group_type |
| 11855 | else: |
| 11856 | self.group_type = 0 |
| 11857 | if group_id != None: |
| 11858 | self.group_id = group_id |
| 11859 | else: |
| 11860 | self.group_id = 0 |
| 11861 | if buckets != None: |
| 11862 | self.buckets = buckets |
| 11863 | else: |
| 11864 | self.buckets = [] |
| 11865 | return |
| 11866 | |
| 11867 | def pack(self): |
| 11868 | packed = [] |
| 11869 | packed.append(struct.pack("!B", self.version)) |
| 11870 | packed.append(struct.pack("!B", self.type)) |
| 11871 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11872 | packed.append(struct.pack("!L", self.xid)) |
| 11873 | packed.append(struct.pack("!H", self.command)) |
| 11874 | packed.append(struct.pack("!B", self.group_type)) |
| 11875 | packed.append('\x00' * 1) |
| 11876 | packed.append(struct.pack("!L", self.group_id)) |
| 11877 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
| 11878 | length = sum([len(x) for x in packed]) |
| 11879 | packed[2] = struct.pack("!H", length) |
| 11880 | return ''.join(packed) |
| 11881 | |
| 11882 | @staticmethod |
| 11883 | def unpack(reader): |
| 11884 | obj = group_delete() |
| 11885 | _version = reader.read("!B")[0] |
| 11886 | assert(_version == 5) |
| 11887 | _type = reader.read("!B")[0] |
| 11888 | assert(_type == 15) |
| 11889 | _length = reader.read("!H")[0] |
| 11890 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11891 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 11892 | obj.xid = reader.read("!L")[0] |
| 11893 | _command = reader.read("!H")[0] |
| 11894 | assert(_command == 2) |
| 11895 | obj.group_type = reader.read("!B")[0] |
| 11896 | reader.skip(1) |
| 11897 | obj.group_id = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 11898 | obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 11899 | return obj |
| 11900 | |
| 11901 | def __eq__(self, other): |
| 11902 | if type(self) != type(other): return False |
| 11903 | if self.xid != other.xid: return False |
| 11904 | if self.group_type != other.group_type: return False |
| 11905 | if self.group_id != other.group_id: return False |
| 11906 | if self.buckets != other.buckets: return False |
| 11907 | return True |
| 11908 | |
| 11909 | def pretty_print(self, q): |
| 11910 | q.text("group_delete {") |
| 11911 | with q.group(): |
| 11912 | with q.indent(2): |
| 11913 | q.breakable() |
| 11914 | q.text("xid = "); |
| 11915 | if self.xid != None: |
| 11916 | q.text("%#x" % self.xid) |
| 11917 | else: |
| 11918 | q.text('None') |
| 11919 | q.text(","); q.breakable() |
| 11920 | q.text("group_type = "); |
| 11921 | q.text("%#x" % self.group_type) |
| 11922 | q.text(","); q.breakable() |
| 11923 | q.text("group_id = "); |
| 11924 | q.text("%#x" % self.group_id) |
| 11925 | q.text(","); q.breakable() |
| 11926 | q.text("buckets = "); |
| 11927 | q.pp(self.buckets) |
| 11928 | q.breakable() |
| 11929 | q.text('}') |
| 11930 | |
| 11931 | group_mod.subtypes[2] = group_delete |
| 11932 | |
| 11933 | class group_desc_stats_reply(stats_reply): |
| 11934 | version = 5 |
| 11935 | type = 19 |
| 11936 | stats_type = 7 |
| 11937 | |
| 11938 | def __init__(self, xid=None, flags=None, entries=None): |
| 11939 | if xid != None: |
| 11940 | self.xid = xid |
| 11941 | else: |
| 11942 | self.xid = None |
| 11943 | if flags != None: |
| 11944 | self.flags = flags |
| 11945 | else: |
| 11946 | self.flags = 0 |
| 11947 | if entries != None: |
| 11948 | self.entries = entries |
| 11949 | else: |
| 11950 | self.entries = [] |
| 11951 | return |
| 11952 | |
| 11953 | def pack(self): |
| 11954 | packed = [] |
| 11955 | packed.append(struct.pack("!B", self.version)) |
| 11956 | packed.append(struct.pack("!B", self.type)) |
| 11957 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11958 | packed.append(struct.pack("!L", self.xid)) |
| 11959 | packed.append(struct.pack("!H", self.stats_type)) |
| 11960 | packed.append(struct.pack("!H", self.flags)) |
| 11961 | packed.append('\x00' * 4) |
| 11962 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 11963 | length = sum([len(x) for x in packed]) |
| 11964 | packed[2] = struct.pack("!H", length) |
| 11965 | return ''.join(packed) |
| 11966 | |
| 11967 | @staticmethod |
| 11968 | def unpack(reader): |
| 11969 | obj = group_desc_stats_reply() |
| 11970 | _version = reader.read("!B")[0] |
| 11971 | assert(_version == 5) |
| 11972 | _type = reader.read("!B")[0] |
| 11973 | assert(_type == 19) |
| 11974 | _length = reader.read("!H")[0] |
| 11975 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11976 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 11977 | obj.xid = reader.read("!L")[0] |
| 11978 | _stats_type = reader.read("!H")[0] |
| 11979 | assert(_stats_type == 7) |
| 11980 | obj.flags = reader.read("!H")[0] |
| 11981 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 11982 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.group_desc_stats_entry.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 11983 | return obj |
| 11984 | |
| 11985 | def __eq__(self, other): |
| 11986 | if type(self) != type(other): return False |
| 11987 | if self.xid != other.xid: return False |
| 11988 | if self.flags != other.flags: return False |
| 11989 | if self.entries != other.entries: return False |
| 11990 | return True |
| 11991 | |
| 11992 | def pretty_print(self, q): |
| 11993 | q.text("group_desc_stats_reply {") |
| 11994 | with q.group(): |
| 11995 | with q.indent(2): |
| 11996 | q.breakable() |
| 11997 | q.text("xid = "); |
| 11998 | if self.xid != None: |
| 11999 | q.text("%#x" % self.xid) |
| 12000 | else: |
| 12001 | q.text('None') |
| 12002 | q.text(","); q.breakable() |
| 12003 | q.text("flags = "); |
| 12004 | q.text("%#x" % self.flags) |
| 12005 | q.text(","); q.breakable() |
| 12006 | q.text("entries = "); |
| 12007 | q.pp(self.entries) |
| 12008 | q.breakable() |
| 12009 | q.text('}') |
| 12010 | |
| 12011 | stats_reply.subtypes[7] = group_desc_stats_reply |
| 12012 | |
| 12013 | class group_desc_stats_request(stats_request): |
| 12014 | version = 5 |
| 12015 | type = 18 |
| 12016 | stats_type = 7 |
| 12017 | |
| 12018 | def __init__(self, xid=None, flags=None): |
| 12019 | if xid != None: |
| 12020 | self.xid = xid |
| 12021 | else: |
| 12022 | self.xid = None |
| 12023 | if flags != None: |
| 12024 | self.flags = flags |
| 12025 | else: |
| 12026 | self.flags = 0 |
| 12027 | return |
| 12028 | |
| 12029 | def pack(self): |
| 12030 | packed = [] |
| 12031 | packed.append(struct.pack("!B", self.version)) |
| 12032 | packed.append(struct.pack("!B", self.type)) |
| 12033 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12034 | packed.append(struct.pack("!L", self.xid)) |
| 12035 | packed.append(struct.pack("!H", self.stats_type)) |
| 12036 | packed.append(struct.pack("!H", self.flags)) |
| 12037 | packed.append('\x00' * 4) |
| 12038 | length = sum([len(x) for x in packed]) |
| 12039 | packed[2] = struct.pack("!H", length) |
| 12040 | return ''.join(packed) |
| 12041 | |
| 12042 | @staticmethod |
| 12043 | def unpack(reader): |
| 12044 | obj = group_desc_stats_request() |
| 12045 | _version = reader.read("!B")[0] |
| 12046 | assert(_version == 5) |
| 12047 | _type = reader.read("!B")[0] |
| 12048 | assert(_type == 18) |
| 12049 | _length = reader.read("!H")[0] |
| 12050 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12051 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 12052 | obj.xid = reader.read("!L")[0] |
| 12053 | _stats_type = reader.read("!H")[0] |
| 12054 | assert(_stats_type == 7) |
| 12055 | obj.flags = reader.read("!H")[0] |
| 12056 | reader.skip(4) |
| 12057 | return obj |
| 12058 | |
| 12059 | def __eq__(self, other): |
| 12060 | if type(self) != type(other): return False |
| 12061 | if self.xid != other.xid: return False |
| 12062 | if self.flags != other.flags: return False |
| 12063 | return True |
| 12064 | |
| 12065 | def pretty_print(self, q): |
| 12066 | q.text("group_desc_stats_request {") |
| 12067 | with q.group(): |
| 12068 | with q.indent(2): |
| 12069 | q.breakable() |
| 12070 | q.text("xid = "); |
| 12071 | if self.xid != None: |
| 12072 | q.text("%#x" % self.xid) |
| 12073 | else: |
| 12074 | q.text('None') |
| 12075 | q.text(","); q.breakable() |
| 12076 | q.text("flags = "); |
| 12077 | q.text("%#x" % self.flags) |
| 12078 | q.breakable() |
| 12079 | q.text('}') |
| 12080 | |
| 12081 | stats_request.subtypes[7] = group_desc_stats_request |
| 12082 | |
| 12083 | class group_features_stats_reply(stats_reply): |
| 12084 | version = 5 |
| 12085 | type = 19 |
| 12086 | stats_type = 8 |
| 12087 | |
| 12088 | 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): |
| 12089 | if xid != None: |
| 12090 | self.xid = xid |
| 12091 | else: |
| 12092 | self.xid = None |
| 12093 | if flags != None: |
| 12094 | self.flags = flags |
| 12095 | else: |
| 12096 | self.flags = 0 |
| 12097 | if types != None: |
| 12098 | self.types = types |
| 12099 | else: |
| 12100 | self.types = 0 |
| 12101 | if capabilities != None: |
| 12102 | self.capabilities = capabilities |
| 12103 | else: |
| 12104 | self.capabilities = 0 |
| 12105 | if max_groups_all != None: |
| 12106 | self.max_groups_all = max_groups_all |
| 12107 | else: |
| 12108 | self.max_groups_all = 0 |
| 12109 | if max_groups_select != None: |
| 12110 | self.max_groups_select = max_groups_select |
| 12111 | else: |
| 12112 | self.max_groups_select = 0 |
| 12113 | if max_groups_indirect != None: |
| 12114 | self.max_groups_indirect = max_groups_indirect |
| 12115 | else: |
| 12116 | self.max_groups_indirect = 0 |
| 12117 | if max_groups_ff != None: |
| 12118 | self.max_groups_ff = max_groups_ff |
| 12119 | else: |
| 12120 | self.max_groups_ff = 0 |
| 12121 | if actions_all != None: |
| 12122 | self.actions_all = actions_all |
| 12123 | else: |
| 12124 | self.actions_all = 0 |
| 12125 | if actions_select != None: |
| 12126 | self.actions_select = actions_select |
| 12127 | else: |
| 12128 | self.actions_select = 0 |
| 12129 | if actions_indirect != None: |
| 12130 | self.actions_indirect = actions_indirect |
| 12131 | else: |
| 12132 | self.actions_indirect = 0 |
| 12133 | if actions_ff != None: |
| 12134 | self.actions_ff = actions_ff |
| 12135 | else: |
| 12136 | self.actions_ff = 0 |
| 12137 | return |
| 12138 | |
| 12139 | def pack(self): |
| 12140 | packed = [] |
| 12141 | packed.append(struct.pack("!B", self.version)) |
| 12142 | packed.append(struct.pack("!B", self.type)) |
| 12143 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12144 | packed.append(struct.pack("!L", self.xid)) |
| 12145 | packed.append(struct.pack("!H", self.stats_type)) |
| 12146 | packed.append(struct.pack("!H", self.flags)) |
| 12147 | packed.append('\x00' * 4) |
| 12148 | packed.append(struct.pack("!L", self.types)) |
| 12149 | packed.append(struct.pack("!L", self.capabilities)) |
| 12150 | packed.append(struct.pack("!L", self.max_groups_all)) |
| 12151 | packed.append(struct.pack("!L", self.max_groups_select)) |
| 12152 | packed.append(struct.pack("!L", self.max_groups_indirect)) |
| 12153 | packed.append(struct.pack("!L", self.max_groups_ff)) |
| 12154 | packed.append(struct.pack("!L", self.actions_all)) |
| 12155 | packed.append(struct.pack("!L", self.actions_select)) |
| 12156 | packed.append(struct.pack("!L", self.actions_indirect)) |
| 12157 | packed.append(struct.pack("!L", self.actions_ff)) |
| 12158 | length = sum([len(x) for x in packed]) |
| 12159 | packed[2] = struct.pack("!H", length) |
| 12160 | return ''.join(packed) |
| 12161 | |
| 12162 | @staticmethod |
| 12163 | def unpack(reader): |
| 12164 | obj = group_features_stats_reply() |
| 12165 | _version = reader.read("!B")[0] |
| 12166 | assert(_version == 5) |
| 12167 | _type = reader.read("!B")[0] |
| 12168 | assert(_type == 19) |
| 12169 | _length = reader.read("!H")[0] |
| 12170 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12171 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 12172 | obj.xid = reader.read("!L")[0] |
| 12173 | _stats_type = reader.read("!H")[0] |
| 12174 | assert(_stats_type == 8) |
| 12175 | obj.flags = reader.read("!H")[0] |
| 12176 | reader.skip(4) |
| 12177 | obj.types = reader.read("!L")[0] |
| 12178 | obj.capabilities = reader.read("!L")[0] |
| 12179 | obj.max_groups_all = reader.read("!L")[0] |
| 12180 | obj.max_groups_select = reader.read("!L")[0] |
| 12181 | obj.max_groups_indirect = reader.read("!L")[0] |
| 12182 | obj.max_groups_ff = reader.read("!L")[0] |
| 12183 | obj.actions_all = reader.read("!L")[0] |
| 12184 | obj.actions_select = reader.read("!L")[0] |
| 12185 | obj.actions_indirect = reader.read("!L")[0] |
| 12186 | obj.actions_ff = reader.read("!L")[0] |
| 12187 | return obj |
| 12188 | |
| 12189 | def __eq__(self, other): |
| 12190 | if type(self) != type(other): return False |
| 12191 | if self.xid != other.xid: return False |
| 12192 | if self.flags != other.flags: return False |
| 12193 | if self.types != other.types: return False |
| 12194 | if self.capabilities != other.capabilities: return False |
| 12195 | if self.max_groups_all != other.max_groups_all: return False |
| 12196 | if self.max_groups_select != other.max_groups_select: return False |
| 12197 | if self.max_groups_indirect != other.max_groups_indirect: return False |
| 12198 | if self.max_groups_ff != other.max_groups_ff: return False |
| 12199 | if self.actions_all != other.actions_all: return False |
| 12200 | if self.actions_select != other.actions_select: return False |
| 12201 | if self.actions_indirect != other.actions_indirect: return False |
| 12202 | if self.actions_ff != other.actions_ff: return False |
| 12203 | return True |
| 12204 | |
| 12205 | def pretty_print(self, q): |
| 12206 | q.text("group_features_stats_reply {") |
| 12207 | with q.group(): |
| 12208 | with q.indent(2): |
| 12209 | q.breakable() |
| 12210 | q.text("xid = "); |
| 12211 | if self.xid != None: |
| 12212 | q.text("%#x" % self.xid) |
| 12213 | else: |
| 12214 | q.text('None') |
| 12215 | q.text(","); q.breakable() |
| 12216 | q.text("flags = "); |
| 12217 | q.text("%#x" % self.flags) |
| 12218 | q.text(","); q.breakable() |
| 12219 | q.text("types = "); |
| 12220 | q.text("%#x" % self.types) |
| 12221 | q.text(","); q.breakable() |
| 12222 | q.text("capabilities = "); |
| 12223 | q.text("%#x" % self.capabilities) |
| 12224 | q.text(","); q.breakable() |
| 12225 | q.text("max_groups_all = "); |
| 12226 | q.text("%#x" % self.max_groups_all) |
| 12227 | q.text(","); q.breakable() |
| 12228 | q.text("max_groups_select = "); |
| 12229 | q.text("%#x" % self.max_groups_select) |
| 12230 | q.text(","); q.breakable() |
| 12231 | q.text("max_groups_indirect = "); |
| 12232 | q.text("%#x" % self.max_groups_indirect) |
| 12233 | q.text(","); q.breakable() |
| 12234 | q.text("max_groups_ff = "); |
| 12235 | q.text("%#x" % self.max_groups_ff) |
| 12236 | q.text(","); q.breakable() |
| 12237 | q.text("actions_all = "); |
| 12238 | q.text("%#x" % self.actions_all) |
| 12239 | q.text(","); q.breakable() |
| 12240 | q.text("actions_select = "); |
| 12241 | q.text("%#x" % self.actions_select) |
| 12242 | q.text(","); q.breakable() |
| 12243 | q.text("actions_indirect = "); |
| 12244 | q.text("%#x" % self.actions_indirect) |
| 12245 | q.text(","); q.breakable() |
| 12246 | q.text("actions_ff = "); |
| 12247 | q.text("%#x" % self.actions_ff) |
| 12248 | q.breakable() |
| 12249 | q.text('}') |
| 12250 | |
| 12251 | stats_reply.subtypes[8] = group_features_stats_reply |
| 12252 | |
| 12253 | class group_features_stats_request(stats_request): |
| 12254 | version = 5 |
| 12255 | type = 18 |
| 12256 | stats_type = 8 |
| 12257 | |
| 12258 | def __init__(self, xid=None, flags=None): |
| 12259 | if xid != None: |
| 12260 | self.xid = xid |
| 12261 | else: |
| 12262 | self.xid = None |
| 12263 | if flags != None: |
| 12264 | self.flags = flags |
| 12265 | else: |
| 12266 | self.flags = 0 |
| 12267 | return |
| 12268 | |
| 12269 | def pack(self): |
| 12270 | packed = [] |
| 12271 | packed.append(struct.pack("!B", self.version)) |
| 12272 | packed.append(struct.pack("!B", self.type)) |
| 12273 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12274 | packed.append(struct.pack("!L", self.xid)) |
| 12275 | packed.append(struct.pack("!H", self.stats_type)) |
| 12276 | packed.append(struct.pack("!H", self.flags)) |
| 12277 | packed.append('\x00' * 4) |
| 12278 | length = sum([len(x) for x in packed]) |
| 12279 | packed[2] = struct.pack("!H", length) |
| 12280 | return ''.join(packed) |
| 12281 | |
| 12282 | @staticmethod |
| 12283 | def unpack(reader): |
| 12284 | obj = group_features_stats_request() |
| 12285 | _version = reader.read("!B")[0] |
| 12286 | assert(_version == 5) |
| 12287 | _type = reader.read("!B")[0] |
| 12288 | assert(_type == 18) |
| 12289 | _length = reader.read("!H")[0] |
| 12290 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12291 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 12292 | obj.xid = reader.read("!L")[0] |
| 12293 | _stats_type = reader.read("!H")[0] |
| 12294 | assert(_stats_type == 8) |
| 12295 | obj.flags = reader.read("!H")[0] |
| 12296 | reader.skip(4) |
| 12297 | return obj |
| 12298 | |
| 12299 | def __eq__(self, other): |
| 12300 | if type(self) != type(other): return False |
| 12301 | if self.xid != other.xid: return False |
| 12302 | if self.flags != other.flags: return False |
| 12303 | return True |
| 12304 | |
| 12305 | def pretty_print(self, q): |
| 12306 | q.text("group_features_stats_request {") |
| 12307 | with q.group(): |
| 12308 | with q.indent(2): |
| 12309 | q.breakable() |
| 12310 | q.text("xid = "); |
| 12311 | if self.xid != None: |
| 12312 | q.text("%#x" % self.xid) |
| 12313 | else: |
| 12314 | q.text('None') |
| 12315 | q.text(","); q.breakable() |
| 12316 | q.text("flags = "); |
| 12317 | q.text("%#x" % self.flags) |
| 12318 | q.breakable() |
| 12319 | q.text('}') |
| 12320 | |
| 12321 | stats_request.subtypes[8] = group_features_stats_request |
| 12322 | |
| 12323 | class group_mod_failed_error_msg(error_msg): |
| 12324 | version = 5 |
| 12325 | type = 1 |
| 12326 | err_type = 6 |
| 12327 | |
| 12328 | def __init__(self, xid=None, code=None, data=None): |
| 12329 | if xid != None: |
| 12330 | self.xid = xid |
| 12331 | else: |
| 12332 | self.xid = None |
| 12333 | if code != None: |
| 12334 | self.code = code |
| 12335 | else: |
| 12336 | self.code = 0 |
| 12337 | if data != None: |
| 12338 | self.data = data |
| 12339 | else: |
| 12340 | self.data = '' |
| 12341 | return |
| 12342 | |
| 12343 | def pack(self): |
| 12344 | packed = [] |
| 12345 | packed.append(struct.pack("!B", self.version)) |
| 12346 | packed.append(struct.pack("!B", self.type)) |
| 12347 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12348 | packed.append(struct.pack("!L", self.xid)) |
| 12349 | packed.append(struct.pack("!H", self.err_type)) |
| 12350 | packed.append(struct.pack("!H", self.code)) |
| 12351 | packed.append(self.data) |
| 12352 | length = sum([len(x) for x in packed]) |
| 12353 | packed[2] = struct.pack("!H", length) |
| 12354 | return ''.join(packed) |
| 12355 | |
| 12356 | @staticmethod |
| 12357 | def unpack(reader): |
| 12358 | obj = group_mod_failed_error_msg() |
| 12359 | _version = reader.read("!B")[0] |
| 12360 | assert(_version == 5) |
| 12361 | _type = reader.read("!B")[0] |
| 12362 | assert(_type == 1) |
| 12363 | _length = reader.read("!H")[0] |
| 12364 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12365 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 12366 | obj.xid = reader.read("!L")[0] |
| 12367 | _err_type = reader.read("!H")[0] |
| 12368 | assert(_err_type == 6) |
| 12369 | obj.code = reader.read("!H")[0] |
| 12370 | obj.data = str(reader.read_all()) |
| 12371 | return obj |
| 12372 | |
| 12373 | def __eq__(self, other): |
| 12374 | if type(self) != type(other): return False |
| 12375 | if self.xid != other.xid: return False |
| 12376 | if self.code != other.code: return False |
| 12377 | if self.data != other.data: return False |
| 12378 | return True |
| 12379 | |
| 12380 | def pretty_print(self, q): |
| 12381 | q.text("group_mod_failed_error_msg {") |
| 12382 | with q.group(): |
| 12383 | with q.indent(2): |
| 12384 | q.breakable() |
| 12385 | q.text("xid = "); |
| 12386 | if self.xid != None: |
| 12387 | q.text("%#x" % self.xid) |
| 12388 | else: |
| 12389 | q.text('None') |
| 12390 | q.text(","); q.breakable() |
| 12391 | q.text("code = "); |
| 12392 | q.text("%#x" % self.code) |
| 12393 | q.text(","); q.breakable() |
| 12394 | q.text("data = "); |
| 12395 | q.pp(self.data) |
| 12396 | q.breakable() |
| 12397 | q.text('}') |
| 12398 | |
| 12399 | error_msg.subtypes[6] = group_mod_failed_error_msg |
| 12400 | |
| 12401 | class group_modify(group_mod): |
| 12402 | version = 5 |
| 12403 | type = 15 |
| 12404 | command = 1 |
| 12405 | |
| 12406 | def __init__(self, xid=None, group_type=None, group_id=None, buckets=None): |
| 12407 | if xid != None: |
| 12408 | self.xid = xid |
| 12409 | else: |
| 12410 | self.xid = None |
| 12411 | if group_type != None: |
| 12412 | self.group_type = group_type |
| 12413 | else: |
| 12414 | self.group_type = 0 |
| 12415 | if group_id != None: |
| 12416 | self.group_id = group_id |
| 12417 | else: |
| 12418 | self.group_id = 0 |
| 12419 | if buckets != None: |
| 12420 | self.buckets = buckets |
| 12421 | else: |
| 12422 | self.buckets = [] |
| 12423 | return |
| 12424 | |
| 12425 | def pack(self): |
| 12426 | packed = [] |
| 12427 | packed.append(struct.pack("!B", self.version)) |
| 12428 | packed.append(struct.pack("!B", self.type)) |
| 12429 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12430 | packed.append(struct.pack("!L", self.xid)) |
| 12431 | packed.append(struct.pack("!H", self.command)) |
| 12432 | packed.append(struct.pack("!B", self.group_type)) |
| 12433 | packed.append('\x00' * 1) |
| 12434 | packed.append(struct.pack("!L", self.group_id)) |
| 12435 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
| 12436 | length = sum([len(x) for x in packed]) |
| 12437 | packed[2] = struct.pack("!H", length) |
| 12438 | return ''.join(packed) |
| 12439 | |
| 12440 | @staticmethod |
| 12441 | def unpack(reader): |
| 12442 | obj = group_modify() |
| 12443 | _version = reader.read("!B")[0] |
| 12444 | assert(_version == 5) |
| 12445 | _type = reader.read("!B")[0] |
| 12446 | assert(_type == 15) |
| 12447 | _length = reader.read("!H")[0] |
| 12448 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12449 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 12450 | obj.xid = reader.read("!L")[0] |
| 12451 | _command = reader.read("!H")[0] |
| 12452 | assert(_command == 1) |
| 12453 | obj.group_type = reader.read("!B")[0] |
| 12454 | reader.skip(1) |
| 12455 | obj.group_id = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 12456 | obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 12457 | return obj |
| 12458 | |
| 12459 | def __eq__(self, other): |
| 12460 | if type(self) != type(other): return False |
| 12461 | if self.xid != other.xid: return False |
| 12462 | if self.group_type != other.group_type: return False |
| 12463 | if self.group_id != other.group_id: return False |
| 12464 | if self.buckets != other.buckets: return False |
| 12465 | return True |
| 12466 | |
| 12467 | def pretty_print(self, q): |
| 12468 | q.text("group_modify {") |
| 12469 | with q.group(): |
| 12470 | with q.indent(2): |
| 12471 | q.breakable() |
| 12472 | q.text("xid = "); |
| 12473 | if self.xid != None: |
| 12474 | q.text("%#x" % self.xid) |
| 12475 | else: |
| 12476 | q.text('None') |
| 12477 | q.text(","); q.breakable() |
| 12478 | q.text("group_type = "); |
| 12479 | q.text("%#x" % self.group_type) |
| 12480 | q.text(","); q.breakable() |
| 12481 | q.text("group_id = "); |
| 12482 | q.text("%#x" % self.group_id) |
| 12483 | q.text(","); q.breakable() |
| 12484 | q.text("buckets = "); |
| 12485 | q.pp(self.buckets) |
| 12486 | q.breakable() |
| 12487 | q.text('}') |
| 12488 | |
| 12489 | group_mod.subtypes[1] = group_modify |
| 12490 | |
| 12491 | class group_stats_reply(stats_reply): |
| 12492 | version = 5 |
| 12493 | type = 19 |
| 12494 | stats_type = 6 |
| 12495 | |
| 12496 | def __init__(self, xid=None, flags=None, entries=None): |
| 12497 | if xid != None: |
| 12498 | self.xid = xid |
| 12499 | else: |
| 12500 | self.xid = None |
| 12501 | if flags != None: |
| 12502 | self.flags = flags |
| 12503 | else: |
| 12504 | self.flags = 0 |
| 12505 | if entries != None: |
| 12506 | self.entries = entries |
| 12507 | else: |
| 12508 | self.entries = [] |
| 12509 | return |
| 12510 | |
| 12511 | def pack(self): |
| 12512 | packed = [] |
| 12513 | packed.append(struct.pack("!B", self.version)) |
| 12514 | packed.append(struct.pack("!B", self.type)) |
| 12515 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12516 | packed.append(struct.pack("!L", self.xid)) |
| 12517 | packed.append(struct.pack("!H", self.stats_type)) |
| 12518 | packed.append(struct.pack("!H", self.flags)) |
| 12519 | packed.append('\x00' * 4) |
| 12520 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 12521 | length = sum([len(x) for x in packed]) |
| 12522 | packed[2] = struct.pack("!H", length) |
| 12523 | return ''.join(packed) |
| 12524 | |
| 12525 | @staticmethod |
| 12526 | def unpack(reader): |
| 12527 | obj = group_stats_reply() |
| 12528 | _version = reader.read("!B")[0] |
| 12529 | assert(_version == 5) |
| 12530 | _type = reader.read("!B")[0] |
| 12531 | assert(_type == 19) |
| 12532 | _length = reader.read("!H")[0] |
| 12533 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12534 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 12535 | obj.xid = reader.read("!L")[0] |
| 12536 | _stats_type = reader.read("!H")[0] |
| 12537 | assert(_stats_type == 6) |
| 12538 | obj.flags = reader.read("!H")[0] |
| 12539 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 12540 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.group_stats_entry.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 12541 | return obj |
| 12542 | |
| 12543 | def __eq__(self, other): |
| 12544 | if type(self) != type(other): return False |
| 12545 | if self.xid != other.xid: return False |
| 12546 | if self.flags != other.flags: return False |
| 12547 | if self.entries != other.entries: return False |
| 12548 | return True |
| 12549 | |
| 12550 | def pretty_print(self, q): |
| 12551 | q.text("group_stats_reply {") |
| 12552 | with q.group(): |
| 12553 | with q.indent(2): |
| 12554 | q.breakable() |
| 12555 | q.text("xid = "); |
| 12556 | if self.xid != None: |
| 12557 | q.text("%#x" % self.xid) |
| 12558 | else: |
| 12559 | q.text('None') |
| 12560 | q.text(","); q.breakable() |
| 12561 | q.text("flags = "); |
| 12562 | q.text("%#x" % self.flags) |
| 12563 | q.text(","); q.breakable() |
| 12564 | q.text("entries = "); |
| 12565 | q.pp(self.entries) |
| 12566 | q.breakable() |
| 12567 | q.text('}') |
| 12568 | |
| 12569 | stats_reply.subtypes[6] = group_stats_reply |
| 12570 | |
| 12571 | class group_stats_request(stats_request): |
| 12572 | version = 5 |
| 12573 | type = 18 |
| 12574 | stats_type = 6 |
| 12575 | |
| 12576 | def __init__(self, xid=None, flags=None, group_id=None): |
| 12577 | if xid != None: |
| 12578 | self.xid = xid |
| 12579 | else: |
| 12580 | self.xid = None |
| 12581 | if flags != None: |
| 12582 | self.flags = flags |
| 12583 | else: |
| 12584 | self.flags = 0 |
| 12585 | if group_id != None: |
| 12586 | self.group_id = group_id |
| 12587 | else: |
| 12588 | self.group_id = 0 |
| 12589 | return |
| 12590 | |
| 12591 | def pack(self): |
| 12592 | packed = [] |
| 12593 | packed.append(struct.pack("!B", self.version)) |
| 12594 | packed.append(struct.pack("!B", self.type)) |
| 12595 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12596 | packed.append(struct.pack("!L", self.xid)) |
| 12597 | packed.append(struct.pack("!H", self.stats_type)) |
| 12598 | packed.append(struct.pack("!H", self.flags)) |
| 12599 | packed.append('\x00' * 4) |
| 12600 | packed.append(struct.pack("!L", self.group_id)) |
| 12601 | packed.append('\x00' * 4) |
| 12602 | length = sum([len(x) for x in packed]) |
| 12603 | packed[2] = struct.pack("!H", length) |
| 12604 | return ''.join(packed) |
| 12605 | |
| 12606 | @staticmethod |
| 12607 | def unpack(reader): |
| 12608 | obj = group_stats_request() |
| 12609 | _version = reader.read("!B")[0] |
| 12610 | assert(_version == 5) |
| 12611 | _type = reader.read("!B")[0] |
| 12612 | assert(_type == 18) |
| 12613 | _length = reader.read("!H")[0] |
| 12614 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12615 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 12616 | obj.xid = reader.read("!L")[0] |
| 12617 | _stats_type = reader.read("!H")[0] |
| 12618 | assert(_stats_type == 6) |
| 12619 | obj.flags = reader.read("!H")[0] |
| 12620 | reader.skip(4) |
| 12621 | obj.group_id = reader.read("!L")[0] |
| 12622 | reader.skip(4) |
| 12623 | return obj |
| 12624 | |
| 12625 | def __eq__(self, other): |
| 12626 | if type(self) != type(other): return False |
| 12627 | if self.xid != other.xid: return False |
| 12628 | if self.flags != other.flags: return False |
| 12629 | if self.group_id != other.group_id: return False |
| 12630 | return True |
| 12631 | |
| 12632 | def pretty_print(self, q): |
| 12633 | q.text("group_stats_request {") |
| 12634 | with q.group(): |
| 12635 | with q.indent(2): |
| 12636 | q.breakable() |
| 12637 | q.text("xid = "); |
| 12638 | if self.xid != None: |
| 12639 | q.text("%#x" % self.xid) |
| 12640 | else: |
| 12641 | q.text('None') |
| 12642 | q.text(","); q.breakable() |
| 12643 | q.text("flags = "); |
| 12644 | q.text("%#x" % self.flags) |
| 12645 | q.text(","); q.breakable() |
| 12646 | q.text("group_id = "); |
| 12647 | q.text("%#x" % self.group_id) |
| 12648 | q.breakable() |
| 12649 | q.text('}') |
| 12650 | |
| 12651 | stats_request.subtypes[6] = group_stats_request |
| 12652 | |
| 12653 | class hello(message): |
| 12654 | version = 5 |
| 12655 | type = 0 |
| 12656 | |
| 12657 | def __init__(self, xid=None, elements=None): |
| 12658 | if xid != None: |
| 12659 | self.xid = xid |
| 12660 | else: |
| 12661 | self.xid = None |
| 12662 | if elements != None: |
| 12663 | self.elements = elements |
| 12664 | else: |
| 12665 | self.elements = [] |
| 12666 | return |
| 12667 | |
| 12668 | def pack(self): |
| 12669 | packed = [] |
| 12670 | packed.append(struct.pack("!B", self.version)) |
| 12671 | packed.append(struct.pack("!B", self.type)) |
| 12672 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12673 | packed.append(struct.pack("!L", self.xid)) |
| 12674 | packed.append(loxi.generic_util.pack_list(self.elements)) |
| 12675 | length = sum([len(x) for x in packed]) |
| 12676 | packed[2] = struct.pack("!H", length) |
| 12677 | return ''.join(packed) |
| 12678 | |
| 12679 | @staticmethod |
| 12680 | def unpack(reader): |
| 12681 | obj = hello() |
| 12682 | _version = reader.read("!B")[0] |
| 12683 | assert(_version == 5) |
| 12684 | _type = reader.read("!B")[0] |
| 12685 | assert(_type == 0) |
| 12686 | _length = reader.read("!H")[0] |
| 12687 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12688 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 12689 | obj.xid = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 12690 | obj.elements = loxi.generic_util.unpack_list(reader, ofp.common.hello_elem.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 12691 | return obj |
| 12692 | |
| 12693 | def __eq__(self, other): |
| 12694 | if type(self) != type(other): return False |
| 12695 | if self.xid != other.xid: return False |
| 12696 | if self.elements != other.elements: return False |
| 12697 | return True |
| 12698 | |
| 12699 | def pretty_print(self, q): |
| 12700 | q.text("hello {") |
| 12701 | with q.group(): |
| 12702 | with q.indent(2): |
| 12703 | q.breakable() |
| 12704 | q.text("xid = "); |
| 12705 | if self.xid != None: |
| 12706 | q.text("%#x" % self.xid) |
| 12707 | else: |
| 12708 | q.text('None') |
| 12709 | q.text(","); q.breakable() |
| 12710 | q.text("elements = "); |
| 12711 | q.pp(self.elements) |
| 12712 | q.breakable() |
| 12713 | q.text('}') |
| 12714 | |
| 12715 | message.subtypes[0] = hello |
| 12716 | |
| 12717 | class hello_failed_error_msg(error_msg): |
| 12718 | version = 5 |
| 12719 | type = 1 |
| 12720 | err_type = 0 |
| 12721 | |
| 12722 | def __init__(self, xid=None, code=None, data=None): |
| 12723 | if xid != None: |
| 12724 | self.xid = xid |
| 12725 | else: |
| 12726 | self.xid = None |
| 12727 | if code != None: |
| 12728 | self.code = code |
| 12729 | else: |
| 12730 | self.code = 0 |
| 12731 | if data != None: |
| 12732 | self.data = data |
| 12733 | else: |
| 12734 | self.data = '' |
| 12735 | return |
| 12736 | |
| 12737 | def pack(self): |
| 12738 | packed = [] |
| 12739 | packed.append(struct.pack("!B", self.version)) |
| 12740 | packed.append(struct.pack("!B", self.type)) |
| 12741 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12742 | packed.append(struct.pack("!L", self.xid)) |
| 12743 | packed.append(struct.pack("!H", self.err_type)) |
| 12744 | packed.append(struct.pack("!H", self.code)) |
| 12745 | packed.append(self.data) |
| 12746 | length = sum([len(x) for x in packed]) |
| 12747 | packed[2] = struct.pack("!H", length) |
| 12748 | return ''.join(packed) |
| 12749 | |
| 12750 | @staticmethod |
| 12751 | def unpack(reader): |
| 12752 | obj = hello_failed_error_msg() |
| 12753 | _version = reader.read("!B")[0] |
| 12754 | assert(_version == 5) |
| 12755 | _type = reader.read("!B")[0] |
| 12756 | assert(_type == 1) |
| 12757 | _length = reader.read("!H")[0] |
| 12758 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12759 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 12760 | obj.xid = reader.read("!L")[0] |
| 12761 | _err_type = reader.read("!H")[0] |
| 12762 | assert(_err_type == 0) |
| 12763 | obj.code = reader.read("!H")[0] |
| 12764 | obj.data = str(reader.read_all()) |
| 12765 | return obj |
| 12766 | |
| 12767 | def __eq__(self, other): |
| 12768 | if type(self) != type(other): return False |
| 12769 | if self.xid != other.xid: return False |
| 12770 | if self.code != other.code: return False |
| 12771 | if self.data != other.data: return False |
| 12772 | return True |
| 12773 | |
| 12774 | def pretty_print(self, q): |
| 12775 | q.text("hello_failed_error_msg {") |
| 12776 | with q.group(): |
| 12777 | with q.indent(2): |
| 12778 | q.breakable() |
| 12779 | q.text("xid = "); |
| 12780 | if self.xid != None: |
| 12781 | q.text("%#x" % self.xid) |
| 12782 | else: |
| 12783 | q.text('None') |
| 12784 | q.text(","); q.breakable() |
| 12785 | q.text("code = "); |
| 12786 | q.text("%#x" % self.code) |
| 12787 | q.text(","); q.breakable() |
| 12788 | q.text("data = "); |
| 12789 | q.pp(self.data) |
| 12790 | q.breakable() |
| 12791 | q.text('}') |
| 12792 | |
| 12793 | error_msg.subtypes[0] = hello_failed_error_msg |
| 12794 | |
| 12795 | class meter_config_stats_reply(stats_reply): |
| 12796 | version = 5 |
| 12797 | type = 19 |
| 12798 | stats_type = 10 |
| 12799 | |
| 12800 | def __init__(self, xid=None, flags=None, entries=None): |
| 12801 | if xid != None: |
| 12802 | self.xid = xid |
| 12803 | else: |
| 12804 | self.xid = None |
| 12805 | if flags != None: |
| 12806 | self.flags = flags |
| 12807 | else: |
| 12808 | self.flags = 0 |
| 12809 | if entries != None: |
| 12810 | self.entries = entries |
| 12811 | else: |
| 12812 | self.entries = [] |
| 12813 | return |
| 12814 | |
| 12815 | def pack(self): |
| 12816 | packed = [] |
| 12817 | packed.append(struct.pack("!B", self.version)) |
| 12818 | packed.append(struct.pack("!B", self.type)) |
| 12819 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12820 | packed.append(struct.pack("!L", self.xid)) |
| 12821 | packed.append(struct.pack("!H", self.stats_type)) |
| 12822 | packed.append(struct.pack("!H", self.flags)) |
| 12823 | packed.append('\x00' * 4) |
| 12824 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 12825 | length = sum([len(x) for x in packed]) |
| 12826 | packed[2] = struct.pack("!H", length) |
| 12827 | return ''.join(packed) |
| 12828 | |
| 12829 | @staticmethod |
| 12830 | def unpack(reader): |
| 12831 | obj = meter_config_stats_reply() |
| 12832 | _version = reader.read("!B")[0] |
| 12833 | assert(_version == 5) |
| 12834 | _type = reader.read("!B")[0] |
| 12835 | assert(_type == 19) |
| 12836 | _length = reader.read("!H")[0] |
| 12837 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12838 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 12839 | obj.xid = reader.read("!L")[0] |
| 12840 | _stats_type = reader.read("!H")[0] |
| 12841 | assert(_stats_type == 10) |
| 12842 | obj.flags = reader.read("!H")[0] |
| 12843 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 12844 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.meter_band.meter_band.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 12845 | return obj |
| 12846 | |
| 12847 | def __eq__(self, other): |
| 12848 | if type(self) != type(other): return False |
| 12849 | if self.xid != other.xid: return False |
| 12850 | if self.flags != other.flags: return False |
| 12851 | if self.entries != other.entries: return False |
| 12852 | return True |
| 12853 | |
| 12854 | def pretty_print(self, q): |
| 12855 | q.text("meter_config_stats_reply {") |
| 12856 | with q.group(): |
| 12857 | with q.indent(2): |
| 12858 | q.breakable() |
| 12859 | q.text("xid = "); |
| 12860 | if self.xid != None: |
| 12861 | q.text("%#x" % self.xid) |
| 12862 | else: |
| 12863 | q.text('None') |
| 12864 | q.text(","); q.breakable() |
| 12865 | q.text("flags = "); |
| 12866 | q.text("%#x" % self.flags) |
| 12867 | q.text(","); q.breakable() |
| 12868 | q.text("entries = "); |
| 12869 | q.pp(self.entries) |
| 12870 | q.breakable() |
| 12871 | q.text('}') |
| 12872 | |
| 12873 | stats_reply.subtypes[10] = meter_config_stats_reply |
| 12874 | |
| 12875 | class meter_config_stats_request(stats_request): |
| 12876 | version = 5 |
| 12877 | type = 18 |
| 12878 | stats_type = 10 |
| 12879 | |
| 12880 | def __init__(self, xid=None, flags=None, meter_id=None): |
| 12881 | if xid != None: |
| 12882 | self.xid = xid |
| 12883 | else: |
| 12884 | self.xid = None |
| 12885 | if flags != None: |
| 12886 | self.flags = flags |
| 12887 | else: |
| 12888 | self.flags = 0 |
| 12889 | if meter_id != None: |
| 12890 | self.meter_id = meter_id |
| 12891 | else: |
| 12892 | self.meter_id = 0 |
| 12893 | return |
| 12894 | |
| 12895 | def pack(self): |
| 12896 | packed = [] |
| 12897 | packed.append(struct.pack("!B", self.version)) |
| 12898 | packed.append(struct.pack("!B", self.type)) |
| 12899 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12900 | packed.append(struct.pack("!L", self.xid)) |
| 12901 | packed.append(struct.pack("!H", self.stats_type)) |
| 12902 | packed.append(struct.pack("!H", self.flags)) |
| 12903 | packed.append('\x00' * 4) |
| 12904 | packed.append(struct.pack("!L", self.meter_id)) |
| 12905 | packed.append('\x00' * 4) |
| 12906 | length = sum([len(x) for x in packed]) |
| 12907 | packed[2] = struct.pack("!H", length) |
| 12908 | return ''.join(packed) |
| 12909 | |
| 12910 | @staticmethod |
| 12911 | def unpack(reader): |
| 12912 | obj = meter_config_stats_request() |
| 12913 | _version = reader.read("!B")[0] |
| 12914 | assert(_version == 5) |
| 12915 | _type = reader.read("!B")[0] |
| 12916 | assert(_type == 18) |
| 12917 | _length = reader.read("!H")[0] |
| 12918 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12919 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 12920 | obj.xid = reader.read("!L")[0] |
| 12921 | _stats_type = reader.read("!H")[0] |
| 12922 | assert(_stats_type == 10) |
| 12923 | obj.flags = reader.read("!H")[0] |
| 12924 | reader.skip(4) |
| 12925 | obj.meter_id = reader.read("!L")[0] |
| 12926 | reader.skip(4) |
| 12927 | return obj |
| 12928 | |
| 12929 | def __eq__(self, other): |
| 12930 | if type(self) != type(other): return False |
| 12931 | if self.xid != other.xid: return False |
| 12932 | if self.flags != other.flags: return False |
| 12933 | if self.meter_id != other.meter_id: return False |
| 12934 | return True |
| 12935 | |
| 12936 | def pretty_print(self, q): |
| 12937 | q.text("meter_config_stats_request {") |
| 12938 | with q.group(): |
| 12939 | with q.indent(2): |
| 12940 | q.breakable() |
| 12941 | q.text("xid = "); |
| 12942 | if self.xid != None: |
| 12943 | q.text("%#x" % self.xid) |
| 12944 | else: |
| 12945 | q.text('None') |
| 12946 | q.text(","); q.breakable() |
| 12947 | q.text("flags = "); |
| 12948 | q.text("%#x" % self.flags) |
| 12949 | q.text(","); q.breakable() |
| 12950 | q.text("meter_id = "); |
| 12951 | q.text("%#x" % self.meter_id) |
| 12952 | q.breakable() |
| 12953 | q.text('}') |
| 12954 | |
| 12955 | stats_request.subtypes[10] = meter_config_stats_request |
| 12956 | |
| 12957 | class meter_features_stats_reply(stats_reply): |
| 12958 | version = 5 |
| 12959 | type = 19 |
| 12960 | stats_type = 11 |
| 12961 | |
| 12962 | def __init__(self, xid=None, flags=None, features=None): |
| 12963 | if xid != None: |
| 12964 | self.xid = xid |
| 12965 | else: |
| 12966 | self.xid = None |
| 12967 | if flags != None: |
| 12968 | self.flags = flags |
| 12969 | else: |
| 12970 | self.flags = 0 |
| 12971 | if features != None: |
| 12972 | self.features = features |
| 12973 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 12974 | self.features = ofp.meter_features() |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 12975 | return |
| 12976 | |
| 12977 | def pack(self): |
| 12978 | packed = [] |
| 12979 | packed.append(struct.pack("!B", self.version)) |
| 12980 | packed.append(struct.pack("!B", self.type)) |
| 12981 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12982 | packed.append(struct.pack("!L", self.xid)) |
| 12983 | packed.append(struct.pack("!H", self.stats_type)) |
| 12984 | packed.append(struct.pack("!H", self.flags)) |
| 12985 | packed.append('\x00' * 4) |
| 12986 | packed.append(self.features.pack()) |
| 12987 | length = sum([len(x) for x in packed]) |
| 12988 | packed[2] = struct.pack("!H", length) |
| 12989 | return ''.join(packed) |
| 12990 | |
| 12991 | @staticmethod |
| 12992 | def unpack(reader): |
| 12993 | obj = meter_features_stats_reply() |
| 12994 | _version = reader.read("!B")[0] |
| 12995 | assert(_version == 5) |
| 12996 | _type = reader.read("!B")[0] |
| 12997 | assert(_type == 19) |
| 12998 | _length = reader.read("!H")[0] |
| 12999 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13000 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 13001 | obj.xid = reader.read("!L")[0] |
| 13002 | _stats_type = reader.read("!H")[0] |
| 13003 | assert(_stats_type == 11) |
| 13004 | obj.flags = reader.read("!H")[0] |
| 13005 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 13006 | obj.features = ofp.meter_features.unpack(reader) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 13007 | return obj |
| 13008 | |
| 13009 | def __eq__(self, other): |
| 13010 | if type(self) != type(other): return False |
| 13011 | if self.xid != other.xid: return False |
| 13012 | if self.flags != other.flags: return False |
| 13013 | if self.features != other.features: return False |
| 13014 | return True |
| 13015 | |
| 13016 | def pretty_print(self, q): |
| 13017 | q.text("meter_features_stats_reply {") |
| 13018 | with q.group(): |
| 13019 | with q.indent(2): |
| 13020 | q.breakable() |
| 13021 | q.text("xid = "); |
| 13022 | if self.xid != None: |
| 13023 | q.text("%#x" % self.xid) |
| 13024 | else: |
| 13025 | q.text('None') |
| 13026 | q.text(","); q.breakable() |
| 13027 | q.text("flags = "); |
| 13028 | q.text("%#x" % self.flags) |
| 13029 | q.text(","); q.breakable() |
| 13030 | q.text("features = "); |
| 13031 | q.pp(self.features) |
| 13032 | q.breakable() |
| 13033 | q.text('}') |
| 13034 | |
| 13035 | stats_reply.subtypes[11] = meter_features_stats_reply |
| 13036 | |
| 13037 | class meter_features_stats_request(stats_request): |
| 13038 | version = 5 |
| 13039 | type = 18 |
| 13040 | stats_type = 11 |
| 13041 | |
| 13042 | def __init__(self, xid=None, flags=None): |
| 13043 | if xid != None: |
| 13044 | self.xid = xid |
| 13045 | else: |
| 13046 | self.xid = None |
| 13047 | if flags != None: |
| 13048 | self.flags = flags |
| 13049 | else: |
| 13050 | self.flags = 0 |
| 13051 | return |
| 13052 | |
| 13053 | def pack(self): |
| 13054 | packed = [] |
| 13055 | packed.append(struct.pack("!B", self.version)) |
| 13056 | packed.append(struct.pack("!B", self.type)) |
| 13057 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13058 | packed.append(struct.pack("!L", self.xid)) |
| 13059 | packed.append(struct.pack("!H", self.stats_type)) |
| 13060 | packed.append(struct.pack("!H", self.flags)) |
| 13061 | packed.append('\x00' * 4) |
| 13062 | length = sum([len(x) for x in packed]) |
| 13063 | packed[2] = struct.pack("!H", length) |
| 13064 | return ''.join(packed) |
| 13065 | |
| 13066 | @staticmethod |
| 13067 | def unpack(reader): |
| 13068 | obj = meter_features_stats_request() |
| 13069 | _version = reader.read("!B")[0] |
| 13070 | assert(_version == 5) |
| 13071 | _type = reader.read("!B")[0] |
| 13072 | assert(_type == 18) |
| 13073 | _length = reader.read("!H")[0] |
| 13074 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13075 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 13076 | obj.xid = reader.read("!L")[0] |
| 13077 | _stats_type = reader.read("!H")[0] |
| 13078 | assert(_stats_type == 11) |
| 13079 | obj.flags = reader.read("!H")[0] |
| 13080 | reader.skip(4) |
| 13081 | return obj |
| 13082 | |
| 13083 | def __eq__(self, other): |
| 13084 | if type(self) != type(other): return False |
| 13085 | if self.xid != other.xid: return False |
| 13086 | if self.flags != other.flags: return False |
| 13087 | return True |
| 13088 | |
| 13089 | def pretty_print(self, q): |
| 13090 | q.text("meter_features_stats_request {") |
| 13091 | with q.group(): |
| 13092 | with q.indent(2): |
| 13093 | q.breakable() |
| 13094 | q.text("xid = "); |
| 13095 | if self.xid != None: |
| 13096 | q.text("%#x" % self.xid) |
| 13097 | else: |
| 13098 | q.text('None') |
| 13099 | q.text(","); q.breakable() |
| 13100 | q.text("flags = "); |
| 13101 | q.text("%#x" % self.flags) |
| 13102 | q.breakable() |
| 13103 | q.text('}') |
| 13104 | |
| 13105 | stats_request.subtypes[11] = meter_features_stats_request |
| 13106 | |
| 13107 | class meter_mod(message): |
| 13108 | version = 5 |
| 13109 | type = 29 |
| 13110 | |
| 13111 | def __init__(self, xid=None, command=None, flags=None, meter_id=None, bands=None): |
| 13112 | if xid != None: |
| 13113 | self.xid = xid |
| 13114 | else: |
| 13115 | self.xid = None |
| 13116 | if command != None: |
| 13117 | self.command = command |
| 13118 | else: |
| 13119 | self.command = 0 |
| 13120 | if flags != None: |
| 13121 | self.flags = flags |
| 13122 | else: |
| 13123 | self.flags = 0 |
| 13124 | if meter_id != None: |
| 13125 | self.meter_id = meter_id |
| 13126 | else: |
| 13127 | self.meter_id = 0 |
| 13128 | if bands != None: |
| 13129 | self.bands = bands |
| 13130 | else: |
| 13131 | self.bands = [] |
| 13132 | return |
| 13133 | |
| 13134 | def pack(self): |
| 13135 | packed = [] |
| 13136 | packed.append(struct.pack("!B", self.version)) |
| 13137 | packed.append(struct.pack("!B", self.type)) |
| 13138 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13139 | packed.append(struct.pack("!L", self.xid)) |
| 13140 | packed.append(struct.pack("!H", self.command)) |
| 13141 | packed.append(struct.pack("!H", self.flags)) |
| 13142 | packed.append(struct.pack("!L", self.meter_id)) |
| 13143 | packed.append(loxi.generic_util.pack_list(self.bands)) |
| 13144 | length = sum([len(x) for x in packed]) |
| 13145 | packed[2] = struct.pack("!H", length) |
| 13146 | return ''.join(packed) |
| 13147 | |
| 13148 | @staticmethod |
| 13149 | def unpack(reader): |
| 13150 | obj = meter_mod() |
| 13151 | _version = reader.read("!B")[0] |
| 13152 | assert(_version == 5) |
| 13153 | _type = reader.read("!B")[0] |
| 13154 | assert(_type == 29) |
| 13155 | _length = reader.read("!H")[0] |
| 13156 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13157 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 13158 | obj.xid = reader.read("!L")[0] |
| 13159 | obj.command = reader.read("!H")[0] |
| 13160 | obj.flags = reader.read("!H")[0] |
| 13161 | obj.meter_id = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 13162 | obj.bands = loxi.generic_util.unpack_list(reader, ofp.meter_band.meter_band.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 13163 | return obj |
| 13164 | |
| 13165 | def __eq__(self, other): |
| 13166 | if type(self) != type(other): return False |
| 13167 | if self.xid != other.xid: return False |
| 13168 | if self.command != other.command: return False |
| 13169 | if self.flags != other.flags: return False |
| 13170 | if self.meter_id != other.meter_id: return False |
| 13171 | if self.bands != other.bands: return False |
| 13172 | return True |
| 13173 | |
| 13174 | def pretty_print(self, q): |
| 13175 | q.text("meter_mod {") |
| 13176 | with q.group(): |
| 13177 | with q.indent(2): |
| 13178 | q.breakable() |
| 13179 | q.text("xid = "); |
| 13180 | if self.xid != None: |
| 13181 | q.text("%#x" % self.xid) |
| 13182 | else: |
| 13183 | q.text('None') |
| 13184 | q.text(","); q.breakable() |
| 13185 | q.text("command = "); |
| 13186 | q.text("%#x" % self.command) |
| 13187 | q.text(","); q.breakable() |
| 13188 | q.text("flags = "); |
| 13189 | q.text("%#x" % self.flags) |
| 13190 | q.text(","); q.breakable() |
| 13191 | q.text("meter_id = "); |
| 13192 | q.text("%#x" % self.meter_id) |
| 13193 | q.text(","); q.breakable() |
| 13194 | q.text("bands = "); |
| 13195 | q.pp(self.bands) |
| 13196 | q.breakable() |
| 13197 | q.text('}') |
| 13198 | |
| 13199 | message.subtypes[29] = meter_mod |
| 13200 | |
| 13201 | class meter_mod_failed_error_msg(error_msg): |
| 13202 | version = 5 |
| 13203 | type = 1 |
| 13204 | err_type = 12 |
| 13205 | |
| 13206 | def __init__(self, xid=None, code=None, data=None): |
| 13207 | if xid != None: |
| 13208 | self.xid = xid |
| 13209 | else: |
| 13210 | self.xid = None |
| 13211 | if code != None: |
| 13212 | self.code = code |
| 13213 | else: |
| 13214 | self.code = 0 |
| 13215 | if data != None: |
| 13216 | self.data = data |
| 13217 | else: |
| 13218 | self.data = '' |
| 13219 | return |
| 13220 | |
| 13221 | def pack(self): |
| 13222 | packed = [] |
| 13223 | packed.append(struct.pack("!B", self.version)) |
| 13224 | packed.append(struct.pack("!B", self.type)) |
| 13225 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13226 | packed.append(struct.pack("!L", self.xid)) |
| 13227 | packed.append(struct.pack("!H", self.err_type)) |
| 13228 | packed.append(struct.pack("!H", self.code)) |
| 13229 | packed.append(self.data) |
| 13230 | length = sum([len(x) for x in packed]) |
| 13231 | packed[2] = struct.pack("!H", length) |
| 13232 | return ''.join(packed) |
| 13233 | |
| 13234 | @staticmethod |
| 13235 | def unpack(reader): |
| 13236 | obj = meter_mod_failed_error_msg() |
| 13237 | _version = reader.read("!B")[0] |
| 13238 | assert(_version == 5) |
| 13239 | _type = reader.read("!B")[0] |
| 13240 | assert(_type == 1) |
| 13241 | _length = reader.read("!H")[0] |
| 13242 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13243 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 13244 | obj.xid = reader.read("!L")[0] |
| 13245 | _err_type = reader.read("!H")[0] |
| 13246 | assert(_err_type == 12) |
| 13247 | obj.code = reader.read("!H")[0] |
| 13248 | obj.data = str(reader.read_all()) |
| 13249 | return obj |
| 13250 | |
| 13251 | def __eq__(self, other): |
| 13252 | if type(self) != type(other): return False |
| 13253 | if self.xid != other.xid: return False |
| 13254 | if self.code != other.code: return False |
| 13255 | if self.data != other.data: return False |
| 13256 | return True |
| 13257 | |
| 13258 | def pretty_print(self, q): |
| 13259 | q.text("meter_mod_failed_error_msg {") |
| 13260 | with q.group(): |
| 13261 | with q.indent(2): |
| 13262 | q.breakable() |
| 13263 | q.text("xid = "); |
| 13264 | if self.xid != None: |
| 13265 | q.text("%#x" % self.xid) |
| 13266 | else: |
| 13267 | q.text('None') |
| 13268 | q.text(","); q.breakable() |
| 13269 | q.text("code = "); |
| 13270 | q.text("%#x" % self.code) |
| 13271 | q.text(","); q.breakable() |
| 13272 | q.text("data = "); |
| 13273 | q.pp(self.data) |
| 13274 | q.breakable() |
| 13275 | q.text('}') |
| 13276 | |
| 13277 | error_msg.subtypes[12] = meter_mod_failed_error_msg |
| 13278 | |
| 13279 | class meter_stats_reply(stats_reply): |
| 13280 | version = 5 |
| 13281 | type = 19 |
| 13282 | stats_type = 9 |
| 13283 | |
| 13284 | def __init__(self, xid=None, flags=None, entries=None): |
| 13285 | if xid != None: |
| 13286 | self.xid = xid |
| 13287 | else: |
| 13288 | self.xid = None |
| 13289 | if flags != None: |
| 13290 | self.flags = flags |
| 13291 | else: |
| 13292 | self.flags = 0 |
| 13293 | if entries != None: |
| 13294 | self.entries = entries |
| 13295 | else: |
| 13296 | self.entries = [] |
| 13297 | return |
| 13298 | |
| 13299 | def pack(self): |
| 13300 | packed = [] |
| 13301 | packed.append(struct.pack("!B", self.version)) |
| 13302 | packed.append(struct.pack("!B", self.type)) |
| 13303 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13304 | packed.append(struct.pack("!L", self.xid)) |
| 13305 | packed.append(struct.pack("!H", self.stats_type)) |
| 13306 | packed.append(struct.pack("!H", self.flags)) |
| 13307 | packed.append('\x00' * 4) |
| 13308 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 13309 | length = sum([len(x) for x in packed]) |
| 13310 | packed[2] = struct.pack("!H", length) |
| 13311 | return ''.join(packed) |
| 13312 | |
| 13313 | @staticmethod |
| 13314 | def unpack(reader): |
| 13315 | obj = meter_stats_reply() |
| 13316 | _version = reader.read("!B")[0] |
| 13317 | assert(_version == 5) |
| 13318 | _type = reader.read("!B")[0] |
| 13319 | assert(_type == 19) |
| 13320 | _length = reader.read("!H")[0] |
| 13321 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13322 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 13323 | obj.xid = reader.read("!L")[0] |
| 13324 | _stats_type = reader.read("!H")[0] |
| 13325 | assert(_stats_type == 9) |
| 13326 | obj.flags = reader.read("!H")[0] |
| 13327 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 13328 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.meter_stats.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 13329 | return obj |
| 13330 | |
| 13331 | def __eq__(self, other): |
| 13332 | if type(self) != type(other): return False |
| 13333 | if self.xid != other.xid: return False |
| 13334 | if self.flags != other.flags: return False |
| 13335 | if self.entries != other.entries: return False |
| 13336 | return True |
| 13337 | |
| 13338 | def pretty_print(self, q): |
| 13339 | q.text("meter_stats_reply {") |
| 13340 | with q.group(): |
| 13341 | with q.indent(2): |
| 13342 | q.breakable() |
| 13343 | q.text("xid = "); |
| 13344 | if self.xid != None: |
| 13345 | q.text("%#x" % self.xid) |
| 13346 | else: |
| 13347 | q.text('None') |
| 13348 | q.text(","); q.breakable() |
| 13349 | q.text("flags = "); |
| 13350 | q.text("%#x" % self.flags) |
| 13351 | q.text(","); q.breakable() |
| 13352 | q.text("entries = "); |
| 13353 | q.pp(self.entries) |
| 13354 | q.breakable() |
| 13355 | q.text('}') |
| 13356 | |
| 13357 | stats_reply.subtypes[9] = meter_stats_reply |
| 13358 | |
| 13359 | class meter_stats_request(stats_request): |
| 13360 | version = 5 |
| 13361 | type = 18 |
| 13362 | stats_type = 9 |
| 13363 | |
| 13364 | def __init__(self, xid=None, flags=None, meter_id=None): |
| 13365 | if xid != None: |
| 13366 | self.xid = xid |
| 13367 | else: |
| 13368 | self.xid = None |
| 13369 | if flags != None: |
| 13370 | self.flags = flags |
| 13371 | else: |
| 13372 | self.flags = 0 |
| 13373 | if meter_id != None: |
| 13374 | self.meter_id = meter_id |
| 13375 | else: |
| 13376 | self.meter_id = 0 |
| 13377 | return |
| 13378 | |
| 13379 | def pack(self): |
| 13380 | packed = [] |
| 13381 | packed.append(struct.pack("!B", self.version)) |
| 13382 | packed.append(struct.pack("!B", self.type)) |
| 13383 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13384 | packed.append(struct.pack("!L", self.xid)) |
| 13385 | packed.append(struct.pack("!H", self.stats_type)) |
| 13386 | packed.append(struct.pack("!H", self.flags)) |
| 13387 | packed.append('\x00' * 4) |
| 13388 | packed.append(struct.pack("!L", self.meter_id)) |
| 13389 | packed.append('\x00' * 4) |
| 13390 | length = sum([len(x) for x in packed]) |
| 13391 | packed[2] = struct.pack("!H", length) |
| 13392 | return ''.join(packed) |
| 13393 | |
| 13394 | @staticmethod |
| 13395 | def unpack(reader): |
| 13396 | obj = meter_stats_request() |
| 13397 | _version = reader.read("!B")[0] |
| 13398 | assert(_version == 5) |
| 13399 | _type = reader.read("!B")[0] |
| 13400 | assert(_type == 18) |
| 13401 | _length = reader.read("!H")[0] |
| 13402 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13403 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 13404 | obj.xid = reader.read("!L")[0] |
| 13405 | _stats_type = reader.read("!H")[0] |
| 13406 | assert(_stats_type == 9) |
| 13407 | obj.flags = reader.read("!H")[0] |
| 13408 | reader.skip(4) |
| 13409 | obj.meter_id = reader.read("!L")[0] |
| 13410 | reader.skip(4) |
| 13411 | return obj |
| 13412 | |
| 13413 | def __eq__(self, other): |
| 13414 | if type(self) != type(other): return False |
| 13415 | if self.xid != other.xid: return False |
| 13416 | if self.flags != other.flags: return False |
| 13417 | if self.meter_id != other.meter_id: return False |
| 13418 | return True |
| 13419 | |
| 13420 | def pretty_print(self, q): |
| 13421 | q.text("meter_stats_request {") |
| 13422 | with q.group(): |
| 13423 | with q.indent(2): |
| 13424 | q.breakable() |
| 13425 | q.text("xid = "); |
| 13426 | if self.xid != None: |
| 13427 | q.text("%#x" % self.xid) |
| 13428 | else: |
| 13429 | q.text('None') |
| 13430 | q.text(","); q.breakable() |
| 13431 | q.text("flags = "); |
| 13432 | q.text("%#x" % self.flags) |
| 13433 | q.text(","); q.breakable() |
| 13434 | q.text("meter_id = "); |
| 13435 | q.text("%#x" % self.meter_id) |
| 13436 | q.breakable() |
| 13437 | q.text('}') |
| 13438 | |
| 13439 | stats_request.subtypes[9] = meter_stats_request |
| 13440 | |
| 13441 | class nicira_header(experimenter): |
| 13442 | subtypes = {} |
| 13443 | |
| 13444 | version = 5 |
| 13445 | type = 4 |
| 13446 | experimenter = 8992 |
| 13447 | |
| 13448 | def __init__(self, xid=None, subtype=None): |
| 13449 | if xid != None: |
| 13450 | self.xid = xid |
| 13451 | else: |
| 13452 | self.xid = None |
| 13453 | if subtype != None: |
| 13454 | self.subtype = subtype |
| 13455 | else: |
| 13456 | self.subtype = 0 |
| 13457 | return |
| 13458 | |
| 13459 | def pack(self): |
| 13460 | packed = [] |
| 13461 | packed.append(struct.pack("!B", self.version)) |
| 13462 | packed.append(struct.pack("!B", self.type)) |
| 13463 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13464 | packed.append(struct.pack("!L", self.xid)) |
| 13465 | packed.append(struct.pack("!L", self.experimenter)) |
| 13466 | packed.append(struct.pack("!L", self.subtype)) |
| 13467 | length = sum([len(x) for x in packed]) |
| 13468 | packed[2] = struct.pack("!H", length) |
| 13469 | return ''.join(packed) |
| 13470 | |
| 13471 | @staticmethod |
| 13472 | def unpack(reader): |
| 13473 | subtype, = reader.peek('!L', 12) |
| 13474 | subclass = nicira_header.subtypes.get(subtype) |
| 13475 | if subclass: |
| 13476 | return subclass.unpack(reader) |
| 13477 | |
| 13478 | obj = nicira_header() |
| 13479 | _version = reader.read("!B")[0] |
| 13480 | assert(_version == 5) |
| 13481 | _type = reader.read("!B")[0] |
| 13482 | assert(_type == 4) |
| 13483 | _length = reader.read("!H")[0] |
| 13484 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13485 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 13486 | obj.xid = reader.read("!L")[0] |
| 13487 | _experimenter = reader.read("!L")[0] |
| 13488 | assert(_experimenter == 8992) |
| 13489 | obj.subtype = reader.read("!L")[0] |
| 13490 | return obj |
| 13491 | |
| 13492 | def __eq__(self, other): |
| 13493 | if type(self) != type(other): return False |
| 13494 | if self.xid != other.xid: return False |
| 13495 | if self.subtype != other.subtype: return False |
| 13496 | return True |
| 13497 | |
| 13498 | def pretty_print(self, q): |
| 13499 | q.text("nicira_header {") |
| 13500 | with q.group(): |
| 13501 | with q.indent(2): |
| 13502 | q.breakable() |
| 13503 | q.text("xid = "); |
| 13504 | if self.xid != None: |
| 13505 | q.text("%#x" % self.xid) |
| 13506 | else: |
| 13507 | q.text('None') |
| 13508 | q.breakable() |
| 13509 | q.text('}') |
| 13510 | |
| 13511 | experimenter.subtypes[8992] = nicira_header |
| 13512 | |
| 13513 | class packet_in(message): |
| 13514 | version = 5 |
| 13515 | type = 10 |
| 13516 | |
| 13517 | def __init__(self, xid=None, buffer_id=None, total_len=None, reason=None, table_id=None, cookie=None, match=None, data=None): |
| 13518 | if xid != None: |
| 13519 | self.xid = xid |
| 13520 | else: |
| 13521 | self.xid = None |
| 13522 | if buffer_id != None: |
| 13523 | self.buffer_id = buffer_id |
| 13524 | else: |
| 13525 | self.buffer_id = 0 |
| 13526 | if total_len != None: |
| 13527 | self.total_len = total_len |
| 13528 | else: |
| 13529 | self.total_len = 0 |
| 13530 | if reason != None: |
| 13531 | self.reason = reason |
| 13532 | else: |
| 13533 | self.reason = 0 |
| 13534 | if table_id != None: |
| 13535 | self.table_id = table_id |
| 13536 | else: |
| 13537 | self.table_id = 0 |
| 13538 | if cookie != None: |
| 13539 | self.cookie = cookie |
| 13540 | else: |
| 13541 | self.cookie = 0 |
| 13542 | if match != None: |
| 13543 | self.match = match |
| 13544 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 13545 | self.match = ofp.match() |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 13546 | if data != None: |
| 13547 | self.data = data |
| 13548 | else: |
| 13549 | self.data = '' |
| 13550 | return |
| 13551 | |
| 13552 | def pack(self): |
| 13553 | packed = [] |
| 13554 | packed.append(struct.pack("!B", self.version)) |
| 13555 | packed.append(struct.pack("!B", self.type)) |
| 13556 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13557 | packed.append(struct.pack("!L", self.xid)) |
| 13558 | packed.append(struct.pack("!L", self.buffer_id)) |
| 13559 | packed.append(struct.pack("!H", self.total_len)) |
| 13560 | packed.append(struct.pack("!B", self.reason)) |
| 13561 | packed.append(struct.pack("!B", self.table_id)) |
| 13562 | packed.append(struct.pack("!Q", self.cookie)) |
| 13563 | packed.append(self.match.pack()) |
| 13564 | packed.append('\x00' * 2) |
| 13565 | packed.append(self.data) |
| 13566 | length = sum([len(x) for x in packed]) |
| 13567 | packed[2] = struct.pack("!H", length) |
| 13568 | return ''.join(packed) |
| 13569 | |
| 13570 | @staticmethod |
| 13571 | def unpack(reader): |
| 13572 | obj = packet_in() |
| 13573 | _version = reader.read("!B")[0] |
| 13574 | assert(_version == 5) |
| 13575 | _type = reader.read("!B")[0] |
| 13576 | assert(_type == 10) |
| 13577 | _length = reader.read("!H")[0] |
| 13578 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13579 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 13580 | obj.xid = reader.read("!L")[0] |
| 13581 | obj.buffer_id = reader.read("!L")[0] |
| 13582 | obj.total_len = reader.read("!H")[0] |
| 13583 | obj.reason = reader.read("!B")[0] |
| 13584 | obj.table_id = reader.read("!B")[0] |
| 13585 | obj.cookie = reader.read("!Q")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 13586 | obj.match = ofp.match.unpack(reader) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 13587 | reader.skip(2) |
| 13588 | obj.data = str(reader.read_all()) |
| 13589 | return obj |
| 13590 | |
| 13591 | def __eq__(self, other): |
| 13592 | if type(self) != type(other): return False |
| 13593 | if self.xid != other.xid: return False |
| 13594 | if self.buffer_id != other.buffer_id: return False |
| 13595 | if self.total_len != other.total_len: return False |
| 13596 | if self.reason != other.reason: return False |
| 13597 | if self.table_id != other.table_id: return False |
| 13598 | if self.cookie != other.cookie: return False |
| 13599 | if self.match != other.match: return False |
| 13600 | if self.data != other.data: return False |
| 13601 | return True |
| 13602 | |
| 13603 | def pretty_print(self, q): |
| 13604 | q.text("packet_in {") |
| 13605 | with q.group(): |
| 13606 | with q.indent(2): |
| 13607 | q.breakable() |
| 13608 | q.text("xid = "); |
| 13609 | if self.xid != None: |
| 13610 | q.text("%#x" % self.xid) |
| 13611 | else: |
| 13612 | q.text('None') |
| 13613 | q.text(","); q.breakable() |
| 13614 | q.text("buffer_id = "); |
| 13615 | q.text("%#x" % self.buffer_id) |
| 13616 | q.text(","); q.breakable() |
| 13617 | q.text("total_len = "); |
| 13618 | q.text("%#x" % self.total_len) |
| 13619 | q.text(","); q.breakable() |
| 13620 | q.text("reason = "); |
| 13621 | q.text("%#x" % self.reason) |
| 13622 | q.text(","); q.breakable() |
| 13623 | q.text("table_id = "); |
| 13624 | q.text("%#x" % self.table_id) |
| 13625 | q.text(","); q.breakable() |
| 13626 | q.text("cookie = "); |
| 13627 | q.text("%#x" % self.cookie) |
| 13628 | q.text(","); q.breakable() |
| 13629 | q.text("match = "); |
| 13630 | q.pp(self.match) |
| 13631 | q.text(","); q.breakable() |
| 13632 | q.text("data = "); |
| 13633 | q.pp(self.data) |
| 13634 | q.breakable() |
| 13635 | q.text('}') |
| 13636 | |
| 13637 | message.subtypes[10] = packet_in |
| 13638 | |
| 13639 | class packet_out(message): |
| 13640 | version = 5 |
| 13641 | type = 13 |
| 13642 | |
| 13643 | def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None): |
| 13644 | if xid != None: |
| 13645 | self.xid = xid |
| 13646 | else: |
| 13647 | self.xid = None |
| 13648 | if buffer_id != None: |
| 13649 | self.buffer_id = buffer_id |
| 13650 | else: |
| 13651 | self.buffer_id = 0 |
| 13652 | if in_port != None: |
| 13653 | self.in_port = in_port |
| 13654 | else: |
| 13655 | self.in_port = 0 |
| 13656 | if actions != None: |
| 13657 | self.actions = actions |
| 13658 | else: |
| 13659 | self.actions = [] |
| 13660 | if data != None: |
| 13661 | self.data = data |
| 13662 | else: |
| 13663 | self.data = '' |
| 13664 | return |
| 13665 | |
| 13666 | def pack(self): |
| 13667 | packed = [] |
| 13668 | packed.append(struct.pack("!B", self.version)) |
| 13669 | packed.append(struct.pack("!B", self.type)) |
| 13670 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13671 | packed.append(struct.pack("!L", self.xid)) |
| 13672 | packed.append(struct.pack("!L", self.buffer_id)) |
| 13673 | packed.append(util.pack_port_no(self.in_port)) |
| 13674 | packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6 |
| 13675 | packed.append('\x00' * 6) |
| 13676 | packed.append(loxi.generic_util.pack_list(self.actions)) |
| 13677 | packed[6] = struct.pack("!H", len(packed[-1])) |
| 13678 | packed.append(self.data) |
| 13679 | length = sum([len(x) for x in packed]) |
| 13680 | packed[2] = struct.pack("!H", length) |
| 13681 | return ''.join(packed) |
| 13682 | |
| 13683 | @staticmethod |
| 13684 | def unpack(reader): |
| 13685 | obj = packet_out() |
| 13686 | _version = reader.read("!B")[0] |
| 13687 | assert(_version == 5) |
| 13688 | _type = reader.read("!B")[0] |
| 13689 | assert(_type == 13) |
| 13690 | _length = reader.read("!H")[0] |
| 13691 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13692 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 13693 | obj.xid = reader.read("!L")[0] |
| 13694 | obj.buffer_id = reader.read("!L")[0] |
| 13695 | obj.in_port = util.unpack_port_no(reader) |
| 13696 | _actions_len = reader.read("!H")[0] |
| 13697 | reader.skip(6) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 13698 | obj.actions = loxi.generic_util.unpack_list(reader.slice(_actions_len), ofp.action.action.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 13699 | obj.data = str(reader.read_all()) |
| 13700 | return obj |
| 13701 | |
| 13702 | def __eq__(self, other): |
| 13703 | if type(self) != type(other): return False |
| 13704 | if self.xid != other.xid: return False |
| 13705 | if self.buffer_id != other.buffer_id: return False |
| 13706 | if self.in_port != other.in_port: return False |
| 13707 | if self.actions != other.actions: return False |
| 13708 | if self.data != other.data: return False |
| 13709 | return True |
| 13710 | |
| 13711 | def pretty_print(self, q): |
| 13712 | q.text("packet_out {") |
| 13713 | with q.group(): |
| 13714 | with q.indent(2): |
| 13715 | q.breakable() |
| 13716 | q.text("xid = "); |
| 13717 | if self.xid != None: |
| 13718 | q.text("%#x" % self.xid) |
| 13719 | else: |
| 13720 | q.text('None') |
| 13721 | q.text(","); q.breakable() |
| 13722 | q.text("buffer_id = "); |
| 13723 | q.text("%#x" % self.buffer_id) |
| 13724 | q.text(","); q.breakable() |
| 13725 | q.text("in_port = "); |
| 13726 | q.text(util.pretty_port(self.in_port)) |
| 13727 | q.text(","); q.breakable() |
| 13728 | q.text("actions = "); |
| 13729 | q.pp(self.actions) |
| 13730 | q.text(","); q.breakable() |
| 13731 | q.text("data = "); |
| 13732 | q.pp(self.data) |
| 13733 | q.breakable() |
| 13734 | q.text('}') |
| 13735 | |
| 13736 | message.subtypes[13] = packet_out |
| 13737 | |
| 13738 | class port_desc_stats_reply(stats_reply): |
| 13739 | version = 5 |
| 13740 | type = 19 |
| 13741 | stats_type = 13 |
| 13742 | |
| 13743 | def __init__(self, xid=None, flags=None, entries=None): |
| 13744 | if xid != None: |
| 13745 | self.xid = xid |
| 13746 | else: |
| 13747 | self.xid = None |
| 13748 | if flags != None: |
| 13749 | self.flags = flags |
| 13750 | else: |
| 13751 | self.flags = 0 |
| 13752 | if entries != None: |
| 13753 | self.entries = entries |
| 13754 | else: |
| 13755 | self.entries = [] |
| 13756 | return |
| 13757 | |
| 13758 | def pack(self): |
| 13759 | packed = [] |
| 13760 | packed.append(struct.pack("!B", self.version)) |
| 13761 | packed.append(struct.pack("!B", self.type)) |
| 13762 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13763 | packed.append(struct.pack("!L", self.xid)) |
| 13764 | packed.append(struct.pack("!H", self.stats_type)) |
| 13765 | packed.append(struct.pack("!H", self.flags)) |
| 13766 | packed.append('\x00' * 4) |
| 13767 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 13768 | length = sum([len(x) for x in packed]) |
| 13769 | packed[2] = struct.pack("!H", length) |
| 13770 | return ''.join(packed) |
| 13771 | |
| 13772 | @staticmethod |
| 13773 | def unpack(reader): |
| 13774 | obj = port_desc_stats_reply() |
| 13775 | _version = reader.read("!B")[0] |
| 13776 | assert(_version == 5) |
| 13777 | _type = reader.read("!B")[0] |
| 13778 | assert(_type == 19) |
| 13779 | _length = reader.read("!H")[0] |
| 13780 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13781 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 13782 | obj.xid = reader.read("!L")[0] |
| 13783 | _stats_type = reader.read("!H")[0] |
| 13784 | assert(_stats_type == 13) |
| 13785 | obj.flags = reader.read("!H")[0] |
| 13786 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 13787 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.port_desc.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 13788 | return obj |
| 13789 | |
| 13790 | def __eq__(self, other): |
| 13791 | if type(self) != type(other): return False |
| 13792 | if self.xid != other.xid: return False |
| 13793 | if self.flags != other.flags: return False |
| 13794 | if self.entries != other.entries: return False |
| 13795 | return True |
| 13796 | |
| 13797 | def pretty_print(self, q): |
| 13798 | q.text("port_desc_stats_reply {") |
| 13799 | with q.group(): |
| 13800 | with q.indent(2): |
| 13801 | q.breakable() |
| 13802 | q.text("xid = "); |
| 13803 | if self.xid != None: |
| 13804 | q.text("%#x" % self.xid) |
| 13805 | else: |
| 13806 | q.text('None') |
| 13807 | q.text(","); q.breakable() |
| 13808 | q.text("flags = "); |
| 13809 | q.text("%#x" % self.flags) |
| 13810 | q.text(","); q.breakable() |
| 13811 | q.text("entries = "); |
| 13812 | q.pp(self.entries) |
| 13813 | q.breakable() |
| 13814 | q.text('}') |
| 13815 | |
| 13816 | stats_reply.subtypes[13] = port_desc_stats_reply |
| 13817 | |
| 13818 | class port_desc_stats_request(stats_request): |
| 13819 | version = 5 |
| 13820 | type = 18 |
| 13821 | stats_type = 13 |
| 13822 | |
| 13823 | def __init__(self, xid=None, flags=None): |
| 13824 | if xid != None: |
| 13825 | self.xid = xid |
| 13826 | else: |
| 13827 | self.xid = None |
| 13828 | if flags != None: |
| 13829 | self.flags = flags |
| 13830 | else: |
| 13831 | self.flags = 0 |
| 13832 | return |
| 13833 | |
| 13834 | def pack(self): |
| 13835 | packed = [] |
| 13836 | packed.append(struct.pack("!B", self.version)) |
| 13837 | packed.append(struct.pack("!B", self.type)) |
| 13838 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13839 | packed.append(struct.pack("!L", self.xid)) |
| 13840 | packed.append(struct.pack("!H", self.stats_type)) |
| 13841 | packed.append(struct.pack("!H", self.flags)) |
| 13842 | packed.append('\x00' * 4) |
| 13843 | length = sum([len(x) for x in packed]) |
| 13844 | packed[2] = struct.pack("!H", length) |
| 13845 | return ''.join(packed) |
| 13846 | |
| 13847 | @staticmethod |
| 13848 | def unpack(reader): |
| 13849 | obj = port_desc_stats_request() |
| 13850 | _version = reader.read("!B")[0] |
| 13851 | assert(_version == 5) |
| 13852 | _type = reader.read("!B")[0] |
| 13853 | assert(_type == 18) |
| 13854 | _length = reader.read("!H")[0] |
| 13855 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13856 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 13857 | obj.xid = reader.read("!L")[0] |
| 13858 | _stats_type = reader.read("!H")[0] |
| 13859 | assert(_stats_type == 13) |
| 13860 | obj.flags = reader.read("!H")[0] |
| 13861 | reader.skip(4) |
| 13862 | return obj |
| 13863 | |
| 13864 | def __eq__(self, other): |
| 13865 | if type(self) != type(other): return False |
| 13866 | if self.xid != other.xid: return False |
| 13867 | if self.flags != other.flags: return False |
| 13868 | return True |
| 13869 | |
| 13870 | def pretty_print(self, q): |
| 13871 | q.text("port_desc_stats_request {") |
| 13872 | with q.group(): |
| 13873 | with q.indent(2): |
| 13874 | q.breakable() |
| 13875 | q.text("xid = "); |
| 13876 | if self.xid != None: |
| 13877 | q.text("%#x" % self.xid) |
| 13878 | else: |
| 13879 | q.text('None') |
| 13880 | q.text(","); q.breakable() |
| 13881 | q.text("flags = "); |
| 13882 | q.text("%#x" % self.flags) |
| 13883 | q.breakable() |
| 13884 | q.text('}') |
| 13885 | |
| 13886 | stats_request.subtypes[13] = port_desc_stats_request |
| 13887 | |
| 13888 | class port_mod(message): |
| 13889 | version = 5 |
| 13890 | type = 16 |
| 13891 | |
| 13892 | def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, properties=None): |
| 13893 | if xid != None: |
| 13894 | self.xid = xid |
| 13895 | else: |
| 13896 | self.xid = None |
| 13897 | if port_no != None: |
| 13898 | self.port_no = port_no |
| 13899 | else: |
| 13900 | self.port_no = 0 |
| 13901 | if hw_addr != None: |
| 13902 | self.hw_addr = hw_addr |
| 13903 | else: |
| 13904 | self.hw_addr = [0,0,0,0,0,0] |
| 13905 | if config != None: |
| 13906 | self.config = config |
| 13907 | else: |
| 13908 | self.config = 0 |
| 13909 | if mask != None: |
| 13910 | self.mask = mask |
| 13911 | else: |
| 13912 | self.mask = 0 |
| 13913 | if properties != None: |
| 13914 | self.properties = properties |
| 13915 | else: |
| 13916 | self.properties = [] |
| 13917 | return |
| 13918 | |
| 13919 | def pack(self): |
| 13920 | packed = [] |
| 13921 | packed.append(struct.pack("!B", self.version)) |
| 13922 | packed.append(struct.pack("!B", self.type)) |
| 13923 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13924 | packed.append(struct.pack("!L", self.xid)) |
| 13925 | packed.append(util.pack_port_no(self.port_no)) |
| 13926 | packed.append('\x00' * 4) |
| 13927 | packed.append(struct.pack("!6B", *self.hw_addr)) |
| 13928 | packed.append('\x00' * 2) |
| 13929 | packed.append(struct.pack("!L", self.config)) |
| 13930 | packed.append(struct.pack("!L", self.mask)) |
| 13931 | packed.append(loxi.generic_util.pack_list(self.properties)) |
| 13932 | length = sum([len(x) for x in packed]) |
| 13933 | packed[2] = struct.pack("!H", length) |
| 13934 | return ''.join(packed) |
| 13935 | |
| 13936 | @staticmethod |
| 13937 | def unpack(reader): |
| 13938 | obj = port_mod() |
| 13939 | _version = reader.read("!B")[0] |
| 13940 | assert(_version == 5) |
| 13941 | _type = reader.read("!B")[0] |
| 13942 | assert(_type == 16) |
| 13943 | _length = reader.read("!H")[0] |
| 13944 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13945 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 13946 | obj.xid = reader.read("!L")[0] |
| 13947 | obj.port_no = util.unpack_port_no(reader) |
| 13948 | reader.skip(4) |
| 13949 | obj.hw_addr = list(reader.read('!6B')) |
| 13950 | reader.skip(2) |
| 13951 | obj.config = reader.read("!L")[0] |
| 13952 | obj.mask = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 13953 | obj.properties = loxi.generic_util.unpack_list(reader, ofp.port_mod_prop.port_mod_prop.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 13954 | return obj |
| 13955 | |
| 13956 | def __eq__(self, other): |
| 13957 | if type(self) != type(other): return False |
| 13958 | if self.xid != other.xid: return False |
| 13959 | if self.port_no != other.port_no: return False |
| 13960 | if self.hw_addr != other.hw_addr: return False |
| 13961 | if self.config != other.config: return False |
| 13962 | if self.mask != other.mask: return False |
| 13963 | if self.properties != other.properties: return False |
| 13964 | return True |
| 13965 | |
| 13966 | def pretty_print(self, q): |
| 13967 | q.text("port_mod {") |
| 13968 | with q.group(): |
| 13969 | with q.indent(2): |
| 13970 | q.breakable() |
| 13971 | q.text("xid = "); |
| 13972 | if self.xid != None: |
| 13973 | q.text("%#x" % self.xid) |
| 13974 | else: |
| 13975 | q.text('None') |
| 13976 | q.text(","); q.breakable() |
| 13977 | q.text("port_no = "); |
| 13978 | q.text(util.pretty_port(self.port_no)) |
| 13979 | q.text(","); q.breakable() |
| 13980 | q.text("hw_addr = "); |
| 13981 | q.text(util.pretty_mac(self.hw_addr)) |
| 13982 | q.text(","); q.breakable() |
| 13983 | q.text("config = "); |
| 13984 | q.text("%#x" % self.config) |
| 13985 | q.text(","); q.breakable() |
| 13986 | q.text("mask = "); |
| 13987 | q.text("%#x" % self.mask) |
| 13988 | q.text(","); q.breakable() |
| 13989 | q.text("properties = "); |
| 13990 | q.pp(self.properties) |
| 13991 | q.breakable() |
| 13992 | q.text('}') |
| 13993 | |
| 13994 | message.subtypes[16] = port_mod |
| 13995 | |
| 13996 | class port_mod_failed_error_msg(error_msg): |
| 13997 | version = 5 |
| 13998 | type = 1 |
| 13999 | err_type = 7 |
| 14000 | |
| 14001 | def __init__(self, xid=None, code=None, data=None): |
| 14002 | if xid != None: |
| 14003 | self.xid = xid |
| 14004 | else: |
| 14005 | self.xid = None |
| 14006 | if code != None: |
| 14007 | self.code = code |
| 14008 | else: |
| 14009 | self.code = 0 |
| 14010 | if data != None: |
| 14011 | self.data = data |
| 14012 | else: |
| 14013 | self.data = '' |
| 14014 | return |
| 14015 | |
| 14016 | def pack(self): |
| 14017 | packed = [] |
| 14018 | packed.append(struct.pack("!B", self.version)) |
| 14019 | packed.append(struct.pack("!B", self.type)) |
| 14020 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14021 | packed.append(struct.pack("!L", self.xid)) |
| 14022 | packed.append(struct.pack("!H", self.err_type)) |
| 14023 | packed.append(struct.pack("!H", self.code)) |
| 14024 | packed.append(self.data) |
| 14025 | length = sum([len(x) for x in packed]) |
| 14026 | packed[2] = struct.pack("!H", length) |
| 14027 | return ''.join(packed) |
| 14028 | |
| 14029 | @staticmethod |
| 14030 | def unpack(reader): |
| 14031 | obj = port_mod_failed_error_msg() |
| 14032 | _version = reader.read("!B")[0] |
| 14033 | assert(_version == 5) |
| 14034 | _type = reader.read("!B")[0] |
| 14035 | assert(_type == 1) |
| 14036 | _length = reader.read("!H")[0] |
| 14037 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14038 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 14039 | obj.xid = reader.read("!L")[0] |
| 14040 | _err_type = reader.read("!H")[0] |
| 14041 | assert(_err_type == 7) |
| 14042 | obj.code = reader.read("!H")[0] |
| 14043 | obj.data = str(reader.read_all()) |
| 14044 | return obj |
| 14045 | |
| 14046 | def __eq__(self, other): |
| 14047 | if type(self) != type(other): return False |
| 14048 | if self.xid != other.xid: return False |
| 14049 | if self.code != other.code: return False |
| 14050 | if self.data != other.data: return False |
| 14051 | return True |
| 14052 | |
| 14053 | def pretty_print(self, q): |
| 14054 | q.text("port_mod_failed_error_msg {") |
| 14055 | with q.group(): |
| 14056 | with q.indent(2): |
| 14057 | q.breakable() |
| 14058 | q.text("xid = "); |
| 14059 | if self.xid != None: |
| 14060 | q.text("%#x" % self.xid) |
| 14061 | else: |
| 14062 | q.text('None') |
| 14063 | q.text(","); q.breakable() |
| 14064 | q.text("code = "); |
| 14065 | q.text("%#x" % self.code) |
| 14066 | q.text(","); q.breakable() |
| 14067 | q.text("data = "); |
| 14068 | q.pp(self.data) |
| 14069 | q.breakable() |
| 14070 | q.text('}') |
| 14071 | |
| 14072 | error_msg.subtypes[7] = port_mod_failed_error_msg |
| 14073 | |
| 14074 | class port_stats_reply(stats_reply): |
| 14075 | version = 5 |
| 14076 | type = 19 |
| 14077 | stats_type = 4 |
| 14078 | |
| 14079 | def __init__(self, xid=None, flags=None, entries=None): |
| 14080 | if xid != None: |
| 14081 | self.xid = xid |
| 14082 | else: |
| 14083 | self.xid = None |
| 14084 | if flags != None: |
| 14085 | self.flags = flags |
| 14086 | else: |
| 14087 | self.flags = 0 |
| 14088 | if entries != None: |
| 14089 | self.entries = entries |
| 14090 | else: |
| 14091 | self.entries = [] |
| 14092 | return |
| 14093 | |
| 14094 | def pack(self): |
| 14095 | packed = [] |
| 14096 | packed.append(struct.pack("!B", self.version)) |
| 14097 | packed.append(struct.pack("!B", self.type)) |
| 14098 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14099 | packed.append(struct.pack("!L", self.xid)) |
| 14100 | packed.append(struct.pack("!H", self.stats_type)) |
| 14101 | packed.append(struct.pack("!H", self.flags)) |
| 14102 | packed.append('\x00' * 4) |
| 14103 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 14104 | length = sum([len(x) for x in packed]) |
| 14105 | packed[2] = struct.pack("!H", length) |
| 14106 | return ''.join(packed) |
| 14107 | |
| 14108 | @staticmethod |
| 14109 | def unpack(reader): |
| 14110 | obj = port_stats_reply() |
| 14111 | _version = reader.read("!B")[0] |
| 14112 | assert(_version == 5) |
| 14113 | _type = reader.read("!B")[0] |
| 14114 | assert(_type == 19) |
| 14115 | _length = reader.read("!H")[0] |
| 14116 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14117 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 14118 | obj.xid = reader.read("!L")[0] |
| 14119 | _stats_type = reader.read("!H")[0] |
| 14120 | assert(_stats_type == 4) |
| 14121 | obj.flags = reader.read("!H")[0] |
| 14122 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 14123 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.port_stats_entry.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 14124 | return obj |
| 14125 | |
| 14126 | def __eq__(self, other): |
| 14127 | if type(self) != type(other): return False |
| 14128 | if self.xid != other.xid: return False |
| 14129 | if self.flags != other.flags: return False |
| 14130 | if self.entries != other.entries: return False |
| 14131 | return True |
| 14132 | |
| 14133 | def pretty_print(self, q): |
| 14134 | q.text("port_stats_reply {") |
| 14135 | with q.group(): |
| 14136 | with q.indent(2): |
| 14137 | q.breakable() |
| 14138 | q.text("xid = "); |
| 14139 | if self.xid != None: |
| 14140 | q.text("%#x" % self.xid) |
| 14141 | else: |
| 14142 | q.text('None') |
| 14143 | q.text(","); q.breakable() |
| 14144 | q.text("flags = "); |
| 14145 | q.text("%#x" % self.flags) |
| 14146 | q.text(","); q.breakable() |
| 14147 | q.text("entries = "); |
| 14148 | q.pp(self.entries) |
| 14149 | q.breakable() |
| 14150 | q.text('}') |
| 14151 | |
| 14152 | stats_reply.subtypes[4] = port_stats_reply |
| 14153 | |
| 14154 | class port_stats_request(stats_request): |
| 14155 | version = 5 |
| 14156 | type = 18 |
| 14157 | stats_type = 4 |
| 14158 | |
| 14159 | def __init__(self, xid=None, flags=None, port_no=None): |
| 14160 | if xid != None: |
| 14161 | self.xid = xid |
| 14162 | else: |
| 14163 | self.xid = None |
| 14164 | if flags != None: |
| 14165 | self.flags = flags |
| 14166 | else: |
| 14167 | self.flags = 0 |
| 14168 | if port_no != None: |
| 14169 | self.port_no = port_no |
| 14170 | else: |
| 14171 | self.port_no = 0 |
| 14172 | return |
| 14173 | |
| 14174 | def pack(self): |
| 14175 | packed = [] |
| 14176 | packed.append(struct.pack("!B", self.version)) |
| 14177 | packed.append(struct.pack("!B", self.type)) |
| 14178 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14179 | packed.append(struct.pack("!L", self.xid)) |
| 14180 | packed.append(struct.pack("!H", self.stats_type)) |
| 14181 | packed.append(struct.pack("!H", self.flags)) |
| 14182 | packed.append('\x00' * 4) |
| 14183 | packed.append(util.pack_port_no(self.port_no)) |
| 14184 | packed.append('\x00' * 4) |
| 14185 | length = sum([len(x) for x in packed]) |
| 14186 | packed[2] = struct.pack("!H", length) |
| 14187 | return ''.join(packed) |
| 14188 | |
| 14189 | @staticmethod |
| 14190 | def unpack(reader): |
| 14191 | obj = port_stats_request() |
| 14192 | _version = reader.read("!B")[0] |
| 14193 | assert(_version == 5) |
| 14194 | _type = reader.read("!B")[0] |
| 14195 | assert(_type == 18) |
| 14196 | _length = reader.read("!H")[0] |
| 14197 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14198 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 14199 | obj.xid = reader.read("!L")[0] |
| 14200 | _stats_type = reader.read("!H")[0] |
| 14201 | assert(_stats_type == 4) |
| 14202 | obj.flags = reader.read("!H")[0] |
| 14203 | reader.skip(4) |
| 14204 | obj.port_no = util.unpack_port_no(reader) |
| 14205 | reader.skip(4) |
| 14206 | return obj |
| 14207 | |
| 14208 | def __eq__(self, other): |
| 14209 | if type(self) != type(other): return False |
| 14210 | if self.xid != other.xid: return False |
| 14211 | if self.flags != other.flags: return False |
| 14212 | if self.port_no != other.port_no: return False |
| 14213 | return True |
| 14214 | |
| 14215 | def pretty_print(self, q): |
| 14216 | q.text("port_stats_request {") |
| 14217 | with q.group(): |
| 14218 | with q.indent(2): |
| 14219 | q.breakable() |
| 14220 | q.text("xid = "); |
| 14221 | if self.xid != None: |
| 14222 | q.text("%#x" % self.xid) |
| 14223 | else: |
| 14224 | q.text('None') |
| 14225 | q.text(","); q.breakable() |
| 14226 | q.text("flags = "); |
| 14227 | q.text("%#x" % self.flags) |
| 14228 | q.text(","); q.breakable() |
| 14229 | q.text("port_no = "); |
| 14230 | q.text(util.pretty_port(self.port_no)) |
| 14231 | q.breakable() |
| 14232 | q.text('}') |
| 14233 | |
| 14234 | stats_request.subtypes[4] = port_stats_request |
| 14235 | |
| 14236 | class port_status(message): |
| 14237 | version = 5 |
| 14238 | type = 12 |
| 14239 | |
| 14240 | def __init__(self, xid=None, reason=None, desc=None): |
| 14241 | if xid != None: |
| 14242 | self.xid = xid |
| 14243 | else: |
| 14244 | self.xid = None |
| 14245 | if reason != None: |
| 14246 | self.reason = reason |
| 14247 | else: |
| 14248 | self.reason = 0 |
| 14249 | if desc != None: |
| 14250 | self.desc = desc |
| 14251 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 14252 | self.desc = ofp.port_desc() |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 14253 | return |
| 14254 | |
| 14255 | def pack(self): |
| 14256 | packed = [] |
| 14257 | packed.append(struct.pack("!B", self.version)) |
| 14258 | packed.append(struct.pack("!B", self.type)) |
| 14259 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14260 | packed.append(struct.pack("!L", self.xid)) |
| 14261 | packed.append(struct.pack("!B", self.reason)) |
| 14262 | packed.append('\x00' * 7) |
| 14263 | packed.append(self.desc.pack()) |
| 14264 | length = sum([len(x) for x in packed]) |
| 14265 | packed[2] = struct.pack("!H", length) |
| 14266 | return ''.join(packed) |
| 14267 | |
| 14268 | @staticmethod |
| 14269 | def unpack(reader): |
| 14270 | obj = port_status() |
| 14271 | _version = reader.read("!B")[0] |
| 14272 | assert(_version == 5) |
| 14273 | _type = reader.read("!B")[0] |
| 14274 | assert(_type == 12) |
| 14275 | _length = reader.read("!H")[0] |
| 14276 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14277 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 14278 | obj.xid = reader.read("!L")[0] |
| 14279 | obj.reason = reader.read("!B")[0] |
| 14280 | reader.skip(7) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 14281 | obj.desc = ofp.port_desc.unpack(reader) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 14282 | return obj |
| 14283 | |
| 14284 | def __eq__(self, other): |
| 14285 | if type(self) != type(other): return False |
| 14286 | if self.xid != other.xid: return False |
| 14287 | if self.reason != other.reason: return False |
| 14288 | if self.desc != other.desc: return False |
| 14289 | return True |
| 14290 | |
| 14291 | def pretty_print(self, q): |
| 14292 | q.text("port_status {") |
| 14293 | with q.group(): |
| 14294 | with q.indent(2): |
| 14295 | q.breakable() |
| 14296 | q.text("xid = "); |
| 14297 | if self.xid != None: |
| 14298 | q.text("%#x" % self.xid) |
| 14299 | else: |
| 14300 | q.text('None') |
| 14301 | q.text(","); q.breakable() |
| 14302 | q.text("reason = "); |
| 14303 | q.text("%#x" % self.reason) |
| 14304 | q.text(","); q.breakable() |
| 14305 | q.text("desc = "); |
| 14306 | q.pp(self.desc) |
| 14307 | q.breakable() |
| 14308 | q.text('}') |
| 14309 | |
| 14310 | message.subtypes[12] = port_status |
| 14311 | |
| 14312 | class queue_desc_stats_reply(stats_reply): |
| 14313 | version = 5 |
| 14314 | type = 19 |
| 14315 | stats_type = 15 |
| 14316 | |
| 14317 | def __init__(self, xid=None, flags=None, entries=None): |
| 14318 | if xid != None: |
| 14319 | self.xid = xid |
| 14320 | else: |
| 14321 | self.xid = None |
| 14322 | if flags != None: |
| 14323 | self.flags = flags |
| 14324 | else: |
| 14325 | self.flags = 0 |
| 14326 | if entries != None: |
| 14327 | self.entries = entries |
| 14328 | else: |
| 14329 | self.entries = [] |
| 14330 | return |
| 14331 | |
| 14332 | def pack(self): |
| 14333 | packed = [] |
| 14334 | packed.append(struct.pack("!B", self.version)) |
| 14335 | packed.append(struct.pack("!B", self.type)) |
| 14336 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14337 | packed.append(struct.pack("!L", self.xid)) |
| 14338 | packed.append(struct.pack("!H", self.stats_type)) |
| 14339 | packed.append(struct.pack("!H", self.flags)) |
| 14340 | packed.append('\x00' * 4) |
| 14341 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 14342 | length = sum([len(x) for x in packed]) |
| 14343 | packed[2] = struct.pack("!H", length) |
| 14344 | return ''.join(packed) |
| 14345 | |
| 14346 | @staticmethod |
| 14347 | def unpack(reader): |
| 14348 | obj = queue_desc_stats_reply() |
| 14349 | _version = reader.read("!B")[0] |
| 14350 | assert(_version == 5) |
| 14351 | _type = reader.read("!B")[0] |
| 14352 | assert(_type == 19) |
| 14353 | _length = reader.read("!H")[0] |
| 14354 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14355 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 14356 | obj.xid = reader.read("!L")[0] |
| 14357 | _stats_type = reader.read("!H")[0] |
| 14358 | assert(_stats_type == 15) |
| 14359 | obj.flags = reader.read("!H")[0] |
| 14360 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 14361 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.queue_desc.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 14362 | return obj |
| 14363 | |
| 14364 | def __eq__(self, other): |
| 14365 | if type(self) != type(other): return False |
| 14366 | if self.xid != other.xid: return False |
| 14367 | if self.flags != other.flags: return False |
| 14368 | if self.entries != other.entries: return False |
| 14369 | return True |
| 14370 | |
| 14371 | def pretty_print(self, q): |
| 14372 | q.text("queue_desc_stats_reply {") |
| 14373 | with q.group(): |
| 14374 | with q.indent(2): |
| 14375 | q.breakable() |
| 14376 | q.text("xid = "); |
| 14377 | if self.xid != None: |
| 14378 | q.text("%#x" % self.xid) |
| 14379 | else: |
| 14380 | q.text('None') |
| 14381 | q.text(","); q.breakable() |
| 14382 | q.text("flags = "); |
| 14383 | q.text("%#x" % self.flags) |
| 14384 | q.text(","); q.breakable() |
| 14385 | q.text("entries = "); |
| 14386 | q.pp(self.entries) |
| 14387 | q.breakable() |
| 14388 | q.text('}') |
| 14389 | |
| 14390 | stats_reply.subtypes[15] = queue_desc_stats_reply |
| 14391 | |
| 14392 | class queue_desc_stats_request(stats_request): |
| 14393 | version = 5 |
| 14394 | type = 18 |
| 14395 | stats_type = 15 |
| 14396 | |
| 14397 | def __init__(self, xid=None, flags=None): |
| 14398 | if xid != None: |
| 14399 | self.xid = xid |
| 14400 | else: |
| 14401 | self.xid = None |
| 14402 | if flags != None: |
| 14403 | self.flags = flags |
| 14404 | else: |
| 14405 | self.flags = 0 |
| 14406 | return |
| 14407 | |
| 14408 | def pack(self): |
| 14409 | packed = [] |
| 14410 | packed.append(struct.pack("!B", self.version)) |
| 14411 | packed.append(struct.pack("!B", self.type)) |
| 14412 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14413 | packed.append(struct.pack("!L", self.xid)) |
| 14414 | packed.append(struct.pack("!H", self.stats_type)) |
| 14415 | packed.append(struct.pack("!H", self.flags)) |
| 14416 | packed.append('\x00' * 4) |
| 14417 | length = sum([len(x) for x in packed]) |
| 14418 | packed[2] = struct.pack("!H", length) |
| 14419 | return ''.join(packed) |
| 14420 | |
| 14421 | @staticmethod |
| 14422 | def unpack(reader): |
| 14423 | obj = queue_desc_stats_request() |
| 14424 | _version = reader.read("!B")[0] |
| 14425 | assert(_version == 5) |
| 14426 | _type = reader.read("!B")[0] |
| 14427 | assert(_type == 18) |
| 14428 | _length = reader.read("!H")[0] |
| 14429 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14430 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 14431 | obj.xid = reader.read("!L")[0] |
| 14432 | _stats_type = reader.read("!H")[0] |
| 14433 | assert(_stats_type == 15) |
| 14434 | obj.flags = reader.read("!H")[0] |
| 14435 | reader.skip(4) |
| 14436 | return obj |
| 14437 | |
| 14438 | def __eq__(self, other): |
| 14439 | if type(self) != type(other): return False |
| 14440 | if self.xid != other.xid: return False |
| 14441 | if self.flags != other.flags: return False |
| 14442 | return True |
| 14443 | |
| 14444 | def pretty_print(self, q): |
| 14445 | q.text("queue_desc_stats_request {") |
| 14446 | with q.group(): |
| 14447 | with q.indent(2): |
| 14448 | q.breakable() |
| 14449 | q.text("xid = "); |
| 14450 | if self.xid != None: |
| 14451 | q.text("%#x" % self.xid) |
| 14452 | else: |
| 14453 | q.text('None') |
| 14454 | q.text(","); q.breakable() |
| 14455 | q.text("flags = "); |
| 14456 | q.text("%#x" % self.flags) |
| 14457 | q.breakable() |
| 14458 | q.text('}') |
| 14459 | |
| 14460 | stats_request.subtypes[15] = queue_desc_stats_request |
| 14461 | |
| 14462 | class queue_op_failed_error_msg(error_msg): |
| 14463 | version = 5 |
| 14464 | type = 1 |
| 14465 | err_type = 9 |
| 14466 | |
| 14467 | def __init__(self, xid=None, code=None, data=None): |
| 14468 | if xid != None: |
| 14469 | self.xid = xid |
| 14470 | else: |
| 14471 | self.xid = None |
| 14472 | if code != None: |
| 14473 | self.code = code |
| 14474 | else: |
| 14475 | self.code = 0 |
| 14476 | if data != None: |
| 14477 | self.data = data |
| 14478 | else: |
| 14479 | self.data = '' |
| 14480 | return |
| 14481 | |
| 14482 | def pack(self): |
| 14483 | packed = [] |
| 14484 | packed.append(struct.pack("!B", self.version)) |
| 14485 | packed.append(struct.pack("!B", self.type)) |
| 14486 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14487 | packed.append(struct.pack("!L", self.xid)) |
| 14488 | packed.append(struct.pack("!H", self.err_type)) |
| 14489 | packed.append(struct.pack("!H", self.code)) |
| 14490 | packed.append(self.data) |
| 14491 | length = sum([len(x) for x in packed]) |
| 14492 | packed[2] = struct.pack("!H", length) |
| 14493 | return ''.join(packed) |
| 14494 | |
| 14495 | @staticmethod |
| 14496 | def unpack(reader): |
| 14497 | obj = queue_op_failed_error_msg() |
| 14498 | _version = reader.read("!B")[0] |
| 14499 | assert(_version == 5) |
| 14500 | _type = reader.read("!B")[0] |
| 14501 | assert(_type == 1) |
| 14502 | _length = reader.read("!H")[0] |
| 14503 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14504 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 14505 | obj.xid = reader.read("!L")[0] |
| 14506 | _err_type = reader.read("!H")[0] |
| 14507 | assert(_err_type == 9) |
| 14508 | obj.code = reader.read("!H")[0] |
| 14509 | obj.data = str(reader.read_all()) |
| 14510 | return obj |
| 14511 | |
| 14512 | def __eq__(self, other): |
| 14513 | if type(self) != type(other): return False |
| 14514 | if self.xid != other.xid: return False |
| 14515 | if self.code != other.code: return False |
| 14516 | if self.data != other.data: return False |
| 14517 | return True |
| 14518 | |
| 14519 | def pretty_print(self, q): |
| 14520 | q.text("queue_op_failed_error_msg {") |
| 14521 | with q.group(): |
| 14522 | with q.indent(2): |
| 14523 | q.breakable() |
| 14524 | q.text("xid = "); |
| 14525 | if self.xid != None: |
| 14526 | q.text("%#x" % self.xid) |
| 14527 | else: |
| 14528 | q.text('None') |
| 14529 | q.text(","); q.breakable() |
| 14530 | q.text("code = "); |
| 14531 | q.text("%#x" % self.code) |
| 14532 | q.text(","); q.breakable() |
| 14533 | q.text("data = "); |
| 14534 | q.pp(self.data) |
| 14535 | q.breakable() |
| 14536 | q.text('}') |
| 14537 | |
| 14538 | error_msg.subtypes[9] = queue_op_failed_error_msg |
| 14539 | |
| 14540 | class queue_stats_reply(stats_reply): |
| 14541 | version = 5 |
| 14542 | type = 19 |
| 14543 | stats_type = 5 |
| 14544 | |
| 14545 | def __init__(self, xid=None, flags=None, entries=None): |
| 14546 | if xid != None: |
| 14547 | self.xid = xid |
| 14548 | else: |
| 14549 | self.xid = None |
| 14550 | if flags != None: |
| 14551 | self.flags = flags |
| 14552 | else: |
| 14553 | self.flags = 0 |
| 14554 | if entries != None: |
| 14555 | self.entries = entries |
| 14556 | else: |
| 14557 | self.entries = [] |
| 14558 | return |
| 14559 | |
| 14560 | def pack(self): |
| 14561 | packed = [] |
| 14562 | packed.append(struct.pack("!B", self.version)) |
| 14563 | packed.append(struct.pack("!B", self.type)) |
| 14564 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14565 | packed.append(struct.pack("!L", self.xid)) |
| 14566 | packed.append(struct.pack("!H", self.stats_type)) |
| 14567 | packed.append(struct.pack("!H", self.flags)) |
| 14568 | packed.append('\x00' * 4) |
| 14569 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 14570 | length = sum([len(x) for x in packed]) |
| 14571 | packed[2] = struct.pack("!H", length) |
| 14572 | return ''.join(packed) |
| 14573 | |
| 14574 | @staticmethod |
| 14575 | def unpack(reader): |
| 14576 | obj = queue_stats_reply() |
| 14577 | _version = reader.read("!B")[0] |
| 14578 | assert(_version == 5) |
| 14579 | _type = reader.read("!B")[0] |
| 14580 | assert(_type == 19) |
| 14581 | _length = reader.read("!H")[0] |
| 14582 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14583 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 14584 | obj.xid = reader.read("!L")[0] |
| 14585 | _stats_type = reader.read("!H")[0] |
| 14586 | assert(_stats_type == 5) |
| 14587 | obj.flags = reader.read("!H")[0] |
| 14588 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 14589 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.queue_stats_entry.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 14590 | return obj |
| 14591 | |
| 14592 | def __eq__(self, other): |
| 14593 | if type(self) != type(other): return False |
| 14594 | if self.xid != other.xid: return False |
| 14595 | if self.flags != other.flags: return False |
| 14596 | if self.entries != other.entries: return False |
| 14597 | return True |
| 14598 | |
| 14599 | def pretty_print(self, q): |
| 14600 | q.text("queue_stats_reply {") |
| 14601 | with q.group(): |
| 14602 | with q.indent(2): |
| 14603 | q.breakable() |
| 14604 | q.text("xid = "); |
| 14605 | if self.xid != None: |
| 14606 | q.text("%#x" % self.xid) |
| 14607 | else: |
| 14608 | q.text('None') |
| 14609 | q.text(","); q.breakable() |
| 14610 | q.text("flags = "); |
| 14611 | q.text("%#x" % self.flags) |
| 14612 | q.text(","); q.breakable() |
| 14613 | q.text("entries = "); |
| 14614 | q.pp(self.entries) |
| 14615 | q.breakable() |
| 14616 | q.text('}') |
| 14617 | |
| 14618 | stats_reply.subtypes[5] = queue_stats_reply |
| 14619 | |
| 14620 | class queue_stats_request(stats_request): |
| 14621 | version = 5 |
| 14622 | type = 18 |
| 14623 | stats_type = 5 |
| 14624 | |
| 14625 | def __init__(self, xid=None, flags=None, port_no=None, queue_id=None): |
| 14626 | if xid != None: |
| 14627 | self.xid = xid |
| 14628 | else: |
| 14629 | self.xid = None |
| 14630 | if flags != None: |
| 14631 | self.flags = flags |
| 14632 | else: |
| 14633 | self.flags = 0 |
| 14634 | if port_no != None: |
| 14635 | self.port_no = port_no |
| 14636 | else: |
| 14637 | self.port_no = 0 |
| 14638 | if queue_id != None: |
| 14639 | self.queue_id = queue_id |
| 14640 | else: |
| 14641 | self.queue_id = 0 |
| 14642 | return |
| 14643 | |
| 14644 | def pack(self): |
| 14645 | packed = [] |
| 14646 | packed.append(struct.pack("!B", self.version)) |
| 14647 | packed.append(struct.pack("!B", self.type)) |
| 14648 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14649 | packed.append(struct.pack("!L", self.xid)) |
| 14650 | packed.append(struct.pack("!H", self.stats_type)) |
| 14651 | packed.append(struct.pack("!H", self.flags)) |
| 14652 | packed.append('\x00' * 4) |
| 14653 | packed.append(util.pack_port_no(self.port_no)) |
| 14654 | packed.append(struct.pack("!L", self.queue_id)) |
| 14655 | length = sum([len(x) for x in packed]) |
| 14656 | packed[2] = struct.pack("!H", length) |
| 14657 | return ''.join(packed) |
| 14658 | |
| 14659 | @staticmethod |
| 14660 | def unpack(reader): |
| 14661 | obj = queue_stats_request() |
| 14662 | _version = reader.read("!B")[0] |
| 14663 | assert(_version == 5) |
| 14664 | _type = reader.read("!B")[0] |
| 14665 | assert(_type == 18) |
| 14666 | _length = reader.read("!H")[0] |
| 14667 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14668 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 14669 | obj.xid = reader.read("!L")[0] |
| 14670 | _stats_type = reader.read("!H")[0] |
| 14671 | assert(_stats_type == 5) |
| 14672 | obj.flags = reader.read("!H")[0] |
| 14673 | reader.skip(4) |
| 14674 | obj.port_no = util.unpack_port_no(reader) |
| 14675 | obj.queue_id = reader.read("!L")[0] |
| 14676 | return obj |
| 14677 | |
| 14678 | def __eq__(self, other): |
| 14679 | if type(self) != type(other): return False |
| 14680 | if self.xid != other.xid: return False |
| 14681 | if self.flags != other.flags: return False |
| 14682 | if self.port_no != other.port_no: return False |
| 14683 | if self.queue_id != other.queue_id: return False |
| 14684 | return True |
| 14685 | |
| 14686 | def pretty_print(self, q): |
| 14687 | q.text("queue_stats_request {") |
| 14688 | with q.group(): |
| 14689 | with q.indent(2): |
| 14690 | q.breakable() |
| 14691 | q.text("xid = "); |
| 14692 | if self.xid != None: |
| 14693 | q.text("%#x" % self.xid) |
| 14694 | else: |
| 14695 | q.text('None') |
| 14696 | q.text(","); q.breakable() |
| 14697 | q.text("flags = "); |
| 14698 | q.text("%#x" % self.flags) |
| 14699 | q.text(","); q.breakable() |
| 14700 | q.text("port_no = "); |
| 14701 | q.text(util.pretty_port(self.port_no)) |
| 14702 | q.text(","); q.breakable() |
| 14703 | q.text("queue_id = "); |
| 14704 | q.text("%#x" % self.queue_id) |
| 14705 | q.breakable() |
| 14706 | q.text('}') |
| 14707 | |
| 14708 | stats_request.subtypes[5] = queue_stats_request |
| 14709 | |
| 14710 | class requestforward(message): |
| 14711 | version = 5 |
| 14712 | type = 32 |
| 14713 | |
| 14714 | def __init__(self, xid=None, role=None, data=None): |
| 14715 | if xid != None: |
| 14716 | self.xid = xid |
| 14717 | else: |
| 14718 | self.xid = None |
| 14719 | if role != None: |
| 14720 | self.role = role |
| 14721 | else: |
| 14722 | self.role = 0 |
| 14723 | if data != None: |
| 14724 | self.data = data |
| 14725 | else: |
| 14726 | self.data = '' |
| 14727 | return |
| 14728 | |
| 14729 | def pack(self): |
| 14730 | packed = [] |
| 14731 | packed.append(struct.pack("!B", self.version)) |
| 14732 | packed.append(struct.pack("!B", self.type)) |
| 14733 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14734 | packed.append(struct.pack("!L", self.xid)) |
| 14735 | packed.append(struct.pack("!L", self.role)) |
| 14736 | packed.append(self.data) |
| 14737 | length = sum([len(x) for x in packed]) |
| 14738 | packed[2] = struct.pack("!H", length) |
| 14739 | return ''.join(packed) |
| 14740 | |
| 14741 | @staticmethod |
| 14742 | def unpack(reader): |
| 14743 | obj = requestforward() |
| 14744 | _version = reader.read("!B")[0] |
| 14745 | assert(_version == 5) |
| 14746 | _type = reader.read("!B")[0] |
| 14747 | assert(_type == 32) |
| 14748 | _length = reader.read("!H")[0] |
| 14749 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14750 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 14751 | obj.xid = reader.read("!L")[0] |
| 14752 | obj.role = reader.read("!L")[0] |
| 14753 | obj.data = str(reader.read_all()) |
| 14754 | return obj |
| 14755 | |
| 14756 | def __eq__(self, other): |
| 14757 | if type(self) != type(other): return False |
| 14758 | if self.xid != other.xid: return False |
| 14759 | if self.role != other.role: return False |
| 14760 | if self.data != other.data: return False |
| 14761 | return True |
| 14762 | |
| 14763 | def pretty_print(self, q): |
| 14764 | q.text("requestforward {") |
| 14765 | with q.group(): |
| 14766 | with q.indent(2): |
| 14767 | q.breakable() |
| 14768 | q.text("xid = "); |
| 14769 | if self.xid != None: |
| 14770 | q.text("%#x" % self.xid) |
| 14771 | else: |
| 14772 | q.text('None') |
| 14773 | q.text(","); q.breakable() |
| 14774 | q.text("role = "); |
| 14775 | q.text("%#x" % self.role) |
| 14776 | q.text(","); q.breakable() |
| 14777 | q.text("data = "); |
| 14778 | q.pp(self.data) |
| 14779 | q.breakable() |
| 14780 | q.text('}') |
| 14781 | |
| 14782 | message.subtypes[32] = requestforward |
| 14783 | |
| 14784 | class role_reply(message): |
| 14785 | version = 5 |
| 14786 | type = 25 |
| 14787 | |
| 14788 | def __init__(self, xid=None, role=None, generation_id=None): |
| 14789 | if xid != None: |
| 14790 | self.xid = xid |
| 14791 | else: |
| 14792 | self.xid = None |
| 14793 | if role != None: |
| 14794 | self.role = role |
| 14795 | else: |
| 14796 | self.role = 0 |
| 14797 | if generation_id != None: |
| 14798 | self.generation_id = generation_id |
| 14799 | else: |
| 14800 | self.generation_id = 0 |
| 14801 | return |
| 14802 | |
| 14803 | def pack(self): |
| 14804 | packed = [] |
| 14805 | packed.append(struct.pack("!B", self.version)) |
| 14806 | packed.append(struct.pack("!B", self.type)) |
| 14807 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14808 | packed.append(struct.pack("!L", self.xid)) |
| 14809 | packed.append(struct.pack("!L", self.role)) |
| 14810 | packed.append('\x00' * 4) |
| 14811 | packed.append(struct.pack("!Q", self.generation_id)) |
| 14812 | length = sum([len(x) for x in packed]) |
| 14813 | packed[2] = struct.pack("!H", length) |
| 14814 | return ''.join(packed) |
| 14815 | |
| 14816 | @staticmethod |
| 14817 | def unpack(reader): |
| 14818 | obj = role_reply() |
| 14819 | _version = reader.read("!B")[0] |
| 14820 | assert(_version == 5) |
| 14821 | _type = reader.read("!B")[0] |
| 14822 | assert(_type == 25) |
| 14823 | _length = reader.read("!H")[0] |
| 14824 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14825 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 14826 | obj.xid = reader.read("!L")[0] |
| 14827 | obj.role = reader.read("!L")[0] |
| 14828 | reader.skip(4) |
| 14829 | obj.generation_id = reader.read("!Q")[0] |
| 14830 | return obj |
| 14831 | |
| 14832 | def __eq__(self, other): |
| 14833 | if type(self) != type(other): return False |
| 14834 | if self.xid != other.xid: return False |
| 14835 | if self.role != other.role: return False |
| 14836 | if self.generation_id != other.generation_id: return False |
| 14837 | return True |
| 14838 | |
| 14839 | def pretty_print(self, q): |
| 14840 | q.text("role_reply {") |
| 14841 | with q.group(): |
| 14842 | with q.indent(2): |
| 14843 | q.breakable() |
| 14844 | q.text("xid = "); |
| 14845 | if self.xid != None: |
| 14846 | q.text("%#x" % self.xid) |
| 14847 | else: |
| 14848 | q.text('None') |
| 14849 | q.text(","); q.breakable() |
| 14850 | q.text("role = "); |
| 14851 | q.text("%#x" % self.role) |
| 14852 | q.text(","); q.breakable() |
| 14853 | q.text("generation_id = "); |
| 14854 | q.text("%#x" % self.generation_id) |
| 14855 | q.breakable() |
| 14856 | q.text('}') |
| 14857 | |
| 14858 | message.subtypes[25] = role_reply |
| 14859 | |
| 14860 | class role_request(message): |
| 14861 | version = 5 |
| 14862 | type = 24 |
| 14863 | |
| 14864 | def __init__(self, xid=None, role=None, generation_id=None): |
| 14865 | if xid != None: |
| 14866 | self.xid = xid |
| 14867 | else: |
| 14868 | self.xid = None |
| 14869 | if role != None: |
| 14870 | self.role = role |
| 14871 | else: |
| 14872 | self.role = 0 |
| 14873 | if generation_id != None: |
| 14874 | self.generation_id = generation_id |
| 14875 | else: |
| 14876 | self.generation_id = 0 |
| 14877 | return |
| 14878 | |
| 14879 | def pack(self): |
| 14880 | packed = [] |
| 14881 | packed.append(struct.pack("!B", self.version)) |
| 14882 | packed.append(struct.pack("!B", self.type)) |
| 14883 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14884 | packed.append(struct.pack("!L", self.xid)) |
| 14885 | packed.append(struct.pack("!L", self.role)) |
| 14886 | packed.append('\x00' * 4) |
| 14887 | packed.append(struct.pack("!Q", self.generation_id)) |
| 14888 | length = sum([len(x) for x in packed]) |
| 14889 | packed[2] = struct.pack("!H", length) |
| 14890 | return ''.join(packed) |
| 14891 | |
| 14892 | @staticmethod |
| 14893 | def unpack(reader): |
| 14894 | obj = role_request() |
| 14895 | _version = reader.read("!B")[0] |
| 14896 | assert(_version == 5) |
| 14897 | _type = reader.read("!B")[0] |
| 14898 | assert(_type == 24) |
| 14899 | _length = reader.read("!H")[0] |
| 14900 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14901 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 14902 | obj.xid = reader.read("!L")[0] |
| 14903 | obj.role = reader.read("!L")[0] |
| 14904 | reader.skip(4) |
| 14905 | obj.generation_id = reader.read("!Q")[0] |
| 14906 | return obj |
| 14907 | |
| 14908 | def __eq__(self, other): |
| 14909 | if type(self) != type(other): return False |
| 14910 | if self.xid != other.xid: return False |
| 14911 | if self.role != other.role: return False |
| 14912 | if self.generation_id != other.generation_id: return False |
| 14913 | return True |
| 14914 | |
| 14915 | def pretty_print(self, q): |
| 14916 | q.text("role_request {") |
| 14917 | with q.group(): |
| 14918 | with q.indent(2): |
| 14919 | q.breakable() |
| 14920 | q.text("xid = "); |
| 14921 | if self.xid != None: |
| 14922 | q.text("%#x" % self.xid) |
| 14923 | else: |
| 14924 | q.text('None') |
| 14925 | q.text(","); q.breakable() |
| 14926 | q.text("role = "); |
| 14927 | q.text("%#x" % self.role) |
| 14928 | q.text(","); q.breakable() |
| 14929 | q.text("generation_id = "); |
| 14930 | q.text("%#x" % self.generation_id) |
| 14931 | q.breakable() |
| 14932 | q.text('}') |
| 14933 | |
| 14934 | message.subtypes[24] = role_request |
| 14935 | |
| 14936 | class role_request_failed_error_msg(error_msg): |
| 14937 | version = 5 |
| 14938 | type = 1 |
| 14939 | err_type = 11 |
| 14940 | |
| 14941 | def __init__(self, xid=None, code=None, data=None): |
| 14942 | if xid != None: |
| 14943 | self.xid = xid |
| 14944 | else: |
| 14945 | self.xid = None |
| 14946 | if code != None: |
| 14947 | self.code = code |
| 14948 | else: |
| 14949 | self.code = 0 |
| 14950 | if data != None: |
| 14951 | self.data = data |
| 14952 | else: |
| 14953 | self.data = '' |
| 14954 | return |
| 14955 | |
| 14956 | def pack(self): |
| 14957 | packed = [] |
| 14958 | packed.append(struct.pack("!B", self.version)) |
| 14959 | packed.append(struct.pack("!B", self.type)) |
| 14960 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14961 | packed.append(struct.pack("!L", self.xid)) |
| 14962 | packed.append(struct.pack("!H", self.err_type)) |
| 14963 | packed.append(struct.pack("!H", self.code)) |
| 14964 | packed.append(self.data) |
| 14965 | length = sum([len(x) for x in packed]) |
| 14966 | packed[2] = struct.pack("!H", length) |
| 14967 | return ''.join(packed) |
| 14968 | |
| 14969 | @staticmethod |
| 14970 | def unpack(reader): |
| 14971 | obj = role_request_failed_error_msg() |
| 14972 | _version = reader.read("!B")[0] |
| 14973 | assert(_version == 5) |
| 14974 | _type = reader.read("!B")[0] |
| 14975 | assert(_type == 1) |
| 14976 | _length = reader.read("!H")[0] |
| 14977 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14978 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 14979 | obj.xid = reader.read("!L")[0] |
| 14980 | _err_type = reader.read("!H")[0] |
| 14981 | assert(_err_type == 11) |
| 14982 | obj.code = reader.read("!H")[0] |
| 14983 | obj.data = str(reader.read_all()) |
| 14984 | return obj |
| 14985 | |
| 14986 | def __eq__(self, other): |
| 14987 | if type(self) != type(other): return False |
| 14988 | if self.xid != other.xid: return False |
| 14989 | if self.code != other.code: return False |
| 14990 | if self.data != other.data: return False |
| 14991 | return True |
| 14992 | |
| 14993 | def pretty_print(self, q): |
| 14994 | q.text("role_request_failed_error_msg {") |
| 14995 | with q.group(): |
| 14996 | with q.indent(2): |
| 14997 | q.breakable() |
| 14998 | q.text("xid = "); |
| 14999 | if self.xid != None: |
| 15000 | q.text("%#x" % self.xid) |
| 15001 | else: |
| 15002 | q.text('None') |
| 15003 | q.text(","); q.breakable() |
| 15004 | q.text("code = "); |
| 15005 | q.text("%#x" % self.code) |
| 15006 | q.text(","); q.breakable() |
| 15007 | q.text("data = "); |
| 15008 | q.pp(self.data) |
| 15009 | q.breakable() |
| 15010 | q.text('}') |
| 15011 | |
| 15012 | error_msg.subtypes[11] = role_request_failed_error_msg |
| 15013 | |
| 15014 | class role_status(message): |
| 15015 | version = 5 |
| 15016 | type = 30 |
| 15017 | |
| 15018 | def __init__(self, xid=None, role=None, reason=None, generation_id=None, properties=None): |
| 15019 | if xid != None: |
| 15020 | self.xid = xid |
| 15021 | else: |
| 15022 | self.xid = None |
| 15023 | if role != None: |
| 15024 | self.role = role |
| 15025 | else: |
| 15026 | self.role = 0 |
| 15027 | if reason != None: |
| 15028 | self.reason = reason |
| 15029 | else: |
| 15030 | self.reason = 0 |
| 15031 | if generation_id != None: |
| 15032 | self.generation_id = generation_id |
| 15033 | else: |
| 15034 | self.generation_id = 0 |
| 15035 | if properties != None: |
| 15036 | self.properties = properties |
| 15037 | else: |
| 15038 | self.properties = [] |
| 15039 | return |
| 15040 | |
| 15041 | def pack(self): |
| 15042 | packed = [] |
| 15043 | packed.append(struct.pack("!B", self.version)) |
| 15044 | packed.append(struct.pack("!B", self.type)) |
| 15045 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 15046 | packed.append(struct.pack("!L", self.xid)) |
| 15047 | packed.append(struct.pack("!L", self.role)) |
| 15048 | packed.append(struct.pack("!B", self.reason)) |
| 15049 | packed.append('\x00' * 3) |
| 15050 | packed.append(struct.pack("!Q", self.generation_id)) |
| 15051 | packed.append(loxi.generic_util.pack_list(self.properties)) |
| 15052 | length = sum([len(x) for x in packed]) |
| 15053 | packed[2] = struct.pack("!H", length) |
| 15054 | return ''.join(packed) |
| 15055 | |
| 15056 | @staticmethod |
| 15057 | def unpack(reader): |
| 15058 | obj = role_status() |
| 15059 | _version = reader.read("!B")[0] |
| 15060 | assert(_version == 5) |
| 15061 | _type = reader.read("!B")[0] |
| 15062 | assert(_type == 30) |
| 15063 | _length = reader.read("!H")[0] |
| 15064 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 15065 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 15066 | obj.xid = reader.read("!L")[0] |
| 15067 | obj.role = reader.read("!L")[0] |
| 15068 | obj.reason = reader.read("!B")[0] |
| 15069 | reader.skip(3) |
| 15070 | obj.generation_id = reader.read("!Q")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 15071 | obj.properties = loxi.generic_util.unpack_list(reader, ofp.role_prop.role_prop.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 15072 | return obj |
| 15073 | |
| 15074 | def __eq__(self, other): |
| 15075 | if type(self) != type(other): return False |
| 15076 | if self.xid != other.xid: return False |
| 15077 | if self.role != other.role: return False |
| 15078 | if self.reason != other.reason: return False |
| 15079 | if self.generation_id != other.generation_id: return False |
| 15080 | if self.properties != other.properties: return False |
| 15081 | return True |
| 15082 | |
| 15083 | def pretty_print(self, q): |
| 15084 | q.text("role_status {") |
| 15085 | with q.group(): |
| 15086 | with q.indent(2): |
| 15087 | q.breakable() |
| 15088 | q.text("xid = "); |
| 15089 | if self.xid != None: |
| 15090 | q.text("%#x" % self.xid) |
| 15091 | else: |
| 15092 | q.text('None') |
| 15093 | q.text(","); q.breakable() |
| 15094 | q.text("role = "); |
| 15095 | q.text("%#x" % self.role) |
| 15096 | q.text(","); q.breakable() |
| 15097 | q.text("reason = "); |
| 15098 | q.text("%#x" % self.reason) |
| 15099 | q.text(","); q.breakable() |
| 15100 | q.text("generation_id = "); |
| 15101 | q.text("%#x" % self.generation_id) |
| 15102 | q.text(","); q.breakable() |
| 15103 | q.text("properties = "); |
| 15104 | q.pp(self.properties) |
| 15105 | q.breakable() |
| 15106 | q.text('}') |
| 15107 | |
| 15108 | message.subtypes[30] = role_status |
| 15109 | |
| 15110 | class set_config(message): |
| 15111 | version = 5 |
| 15112 | type = 9 |
| 15113 | |
| 15114 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
| 15115 | if xid != None: |
| 15116 | self.xid = xid |
| 15117 | else: |
| 15118 | self.xid = None |
| 15119 | if flags != None: |
| 15120 | self.flags = flags |
| 15121 | else: |
| 15122 | self.flags = 0 |
| 15123 | if miss_send_len != None: |
| 15124 | self.miss_send_len = miss_send_len |
| 15125 | else: |
| 15126 | self.miss_send_len = 0 |
| 15127 | return |
| 15128 | |
| 15129 | def pack(self): |
| 15130 | packed = [] |
| 15131 | packed.append(struct.pack("!B", self.version)) |
| 15132 | packed.append(struct.pack("!B", self.type)) |
| 15133 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 15134 | packed.append(struct.pack("!L", self.xid)) |
| 15135 | packed.append(struct.pack("!H", self.flags)) |
| 15136 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 15137 | length = sum([len(x) for x in packed]) |
| 15138 | packed[2] = struct.pack("!H", length) |
| 15139 | return ''.join(packed) |
| 15140 | |
| 15141 | @staticmethod |
| 15142 | def unpack(reader): |
| 15143 | obj = set_config() |
| 15144 | _version = reader.read("!B")[0] |
| 15145 | assert(_version == 5) |
| 15146 | _type = reader.read("!B")[0] |
| 15147 | assert(_type == 9) |
| 15148 | _length = reader.read("!H")[0] |
| 15149 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 15150 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 15151 | obj.xid = reader.read("!L")[0] |
| 15152 | obj.flags = reader.read("!H")[0] |
| 15153 | obj.miss_send_len = reader.read("!H")[0] |
| 15154 | return obj |
| 15155 | |
| 15156 | def __eq__(self, other): |
| 15157 | if type(self) != type(other): return False |
| 15158 | if self.xid != other.xid: return False |
| 15159 | if self.flags != other.flags: return False |
| 15160 | if self.miss_send_len != other.miss_send_len: return False |
| 15161 | return True |
| 15162 | |
| 15163 | def pretty_print(self, q): |
| 15164 | q.text("set_config {") |
| 15165 | with q.group(): |
| 15166 | with q.indent(2): |
| 15167 | q.breakable() |
| 15168 | q.text("xid = "); |
| 15169 | if self.xid != None: |
| 15170 | q.text("%#x" % self.xid) |
| 15171 | else: |
| 15172 | q.text('None') |
| 15173 | q.text(","); q.breakable() |
| 15174 | q.text("flags = "); |
| 15175 | q.text("%#x" % self.flags) |
| 15176 | q.text(","); q.breakable() |
| 15177 | q.text("miss_send_len = "); |
| 15178 | q.text("%#x" % self.miss_send_len) |
| 15179 | q.breakable() |
| 15180 | q.text('}') |
| 15181 | |
| 15182 | message.subtypes[9] = set_config |
| 15183 | |
| 15184 | class switch_config_failed_error_msg(error_msg): |
| 15185 | version = 5 |
| 15186 | type = 1 |
| 15187 | err_type = 10 |
| 15188 | |
| 15189 | def __init__(self, xid=None, code=None, data=None): |
| 15190 | if xid != None: |
| 15191 | self.xid = xid |
| 15192 | else: |
| 15193 | self.xid = None |
| 15194 | if code != None: |
| 15195 | self.code = code |
| 15196 | else: |
| 15197 | self.code = 0 |
| 15198 | if data != None: |
| 15199 | self.data = data |
| 15200 | else: |
| 15201 | self.data = '' |
| 15202 | return |
| 15203 | |
| 15204 | def pack(self): |
| 15205 | packed = [] |
| 15206 | packed.append(struct.pack("!B", self.version)) |
| 15207 | packed.append(struct.pack("!B", self.type)) |
| 15208 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 15209 | packed.append(struct.pack("!L", self.xid)) |
| 15210 | packed.append(struct.pack("!H", self.err_type)) |
| 15211 | packed.append(struct.pack("!H", self.code)) |
| 15212 | packed.append(self.data) |
| 15213 | length = sum([len(x) for x in packed]) |
| 15214 | packed[2] = struct.pack("!H", length) |
| 15215 | return ''.join(packed) |
| 15216 | |
| 15217 | @staticmethod |
| 15218 | def unpack(reader): |
| 15219 | obj = switch_config_failed_error_msg() |
| 15220 | _version = reader.read("!B")[0] |
| 15221 | assert(_version == 5) |
| 15222 | _type = reader.read("!B")[0] |
| 15223 | assert(_type == 1) |
| 15224 | _length = reader.read("!H")[0] |
| 15225 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 15226 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 15227 | obj.xid = reader.read("!L")[0] |
| 15228 | _err_type = reader.read("!H")[0] |
| 15229 | assert(_err_type == 10) |
| 15230 | obj.code = reader.read("!H")[0] |
| 15231 | obj.data = str(reader.read_all()) |
| 15232 | return obj |
| 15233 | |
| 15234 | def __eq__(self, other): |
| 15235 | if type(self) != type(other): return False |
| 15236 | if self.xid != other.xid: return False |
| 15237 | if self.code != other.code: return False |
| 15238 | if self.data != other.data: return False |
| 15239 | return True |
| 15240 | |
| 15241 | def pretty_print(self, q): |
| 15242 | q.text("switch_config_failed_error_msg {") |
| 15243 | with q.group(): |
| 15244 | with q.indent(2): |
| 15245 | q.breakable() |
| 15246 | q.text("xid = "); |
| 15247 | if self.xid != None: |
| 15248 | q.text("%#x" % self.xid) |
| 15249 | else: |
| 15250 | q.text('None') |
| 15251 | q.text(","); q.breakable() |
| 15252 | q.text("code = "); |
| 15253 | q.text("%#x" % self.code) |
| 15254 | q.text(","); q.breakable() |
| 15255 | q.text("data = "); |
| 15256 | q.pp(self.data) |
| 15257 | q.breakable() |
| 15258 | q.text('}') |
| 15259 | |
| 15260 | error_msg.subtypes[10] = switch_config_failed_error_msg |
| 15261 | |
| 15262 | class table_desc_stats_reply(stats_reply): |
| 15263 | version = 5 |
| 15264 | type = 19 |
| 15265 | stats_type = 14 |
| 15266 | |
| 15267 | def __init__(self, xid=None, flags=None, entries=None): |
| 15268 | if xid != None: |
| 15269 | self.xid = xid |
| 15270 | else: |
| 15271 | self.xid = None |
| 15272 | if flags != None: |
| 15273 | self.flags = flags |
| 15274 | else: |
| 15275 | self.flags = 0 |
| 15276 | if entries != None: |
| 15277 | self.entries = entries |
| 15278 | else: |
| 15279 | self.entries = [] |
| 15280 | return |
| 15281 | |
| 15282 | def pack(self): |
| 15283 | packed = [] |
| 15284 | packed.append(struct.pack("!B", self.version)) |
| 15285 | packed.append(struct.pack("!B", self.type)) |
| 15286 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 15287 | packed.append(struct.pack("!L", self.xid)) |
| 15288 | packed.append(struct.pack("!H", self.stats_type)) |
| 15289 | packed.append(struct.pack("!H", self.flags)) |
| 15290 | packed.append('\x00' * 4) |
| 15291 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 15292 | length = sum([len(x) for x in packed]) |
| 15293 | packed[2] = struct.pack("!H", length) |
| 15294 | return ''.join(packed) |
| 15295 | |
| 15296 | @staticmethod |
| 15297 | def unpack(reader): |
| 15298 | obj = table_desc_stats_reply() |
| 15299 | _version = reader.read("!B")[0] |
| 15300 | assert(_version == 5) |
| 15301 | _type = reader.read("!B")[0] |
| 15302 | assert(_type == 19) |
| 15303 | _length = reader.read("!H")[0] |
| 15304 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 15305 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 15306 | obj.xid = reader.read("!L")[0] |
| 15307 | _stats_type = reader.read("!H")[0] |
| 15308 | assert(_stats_type == 14) |
| 15309 | obj.flags = reader.read("!H")[0] |
| 15310 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 15311 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_desc.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 15312 | return obj |
| 15313 | |
| 15314 | def __eq__(self, other): |
| 15315 | if type(self) != type(other): return False |
| 15316 | if self.xid != other.xid: return False |
| 15317 | if self.flags != other.flags: return False |
| 15318 | if self.entries != other.entries: return False |
| 15319 | return True |
| 15320 | |
| 15321 | def pretty_print(self, q): |
| 15322 | q.text("table_desc_stats_reply {") |
| 15323 | with q.group(): |
| 15324 | with q.indent(2): |
| 15325 | q.breakable() |
| 15326 | q.text("xid = "); |
| 15327 | if self.xid != None: |
| 15328 | q.text("%#x" % self.xid) |
| 15329 | else: |
| 15330 | q.text('None') |
| 15331 | q.text(","); q.breakable() |
| 15332 | q.text("flags = "); |
| 15333 | q.text("%#x" % self.flags) |
| 15334 | q.text(","); q.breakable() |
| 15335 | q.text("entries = "); |
| 15336 | q.pp(self.entries) |
| 15337 | q.breakable() |
| 15338 | q.text('}') |
| 15339 | |
| 15340 | stats_reply.subtypes[14] = table_desc_stats_reply |
| 15341 | |
| 15342 | class table_desc_stats_request(stats_request): |
| 15343 | version = 5 |
| 15344 | type = 18 |
| 15345 | stats_type = 14 |
| 15346 | |
| 15347 | def __init__(self, xid=None, flags=None): |
| 15348 | if xid != None: |
| 15349 | self.xid = xid |
| 15350 | else: |
| 15351 | self.xid = None |
| 15352 | if flags != None: |
| 15353 | self.flags = flags |
| 15354 | else: |
| 15355 | self.flags = 0 |
| 15356 | return |
| 15357 | |
| 15358 | def pack(self): |
| 15359 | packed = [] |
| 15360 | packed.append(struct.pack("!B", self.version)) |
| 15361 | packed.append(struct.pack("!B", self.type)) |
| 15362 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 15363 | packed.append(struct.pack("!L", self.xid)) |
| 15364 | packed.append(struct.pack("!H", self.stats_type)) |
| 15365 | packed.append(struct.pack("!H", self.flags)) |
| 15366 | packed.append('\x00' * 4) |
| 15367 | length = sum([len(x) for x in packed]) |
| 15368 | packed[2] = struct.pack("!H", length) |
| 15369 | return ''.join(packed) |
| 15370 | |
| 15371 | @staticmethod |
| 15372 | def unpack(reader): |
| 15373 | obj = table_desc_stats_request() |
| 15374 | _version = reader.read("!B")[0] |
| 15375 | assert(_version == 5) |
| 15376 | _type = reader.read("!B")[0] |
| 15377 | assert(_type == 18) |
| 15378 | _length = reader.read("!H")[0] |
| 15379 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 15380 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 15381 | obj.xid = reader.read("!L")[0] |
| 15382 | _stats_type = reader.read("!H")[0] |
| 15383 | assert(_stats_type == 14) |
| 15384 | obj.flags = reader.read("!H")[0] |
| 15385 | reader.skip(4) |
| 15386 | return obj |
| 15387 | |
| 15388 | def __eq__(self, other): |
| 15389 | if type(self) != type(other): return False |
| 15390 | if self.xid != other.xid: return False |
| 15391 | if self.flags != other.flags: return False |
| 15392 | return True |
| 15393 | |
| 15394 | def pretty_print(self, q): |
| 15395 | q.text("table_desc_stats_request {") |
| 15396 | with q.group(): |
| 15397 | with q.indent(2): |
| 15398 | q.breakable() |
| 15399 | q.text("xid = "); |
| 15400 | if self.xid != None: |
| 15401 | q.text("%#x" % self.xid) |
| 15402 | else: |
| 15403 | q.text('None') |
| 15404 | q.text(","); q.breakable() |
| 15405 | q.text("flags = "); |
| 15406 | q.text("%#x" % self.flags) |
| 15407 | q.breakable() |
| 15408 | q.text('}') |
| 15409 | |
| 15410 | stats_request.subtypes[14] = table_desc_stats_request |
| 15411 | |
| 15412 | class table_features_failed_error_msg(error_msg): |
| 15413 | version = 5 |
| 15414 | type = 1 |
| 15415 | err_type = 13 |
| 15416 | |
| 15417 | def __init__(self, xid=None, code=None, data=None): |
| 15418 | if xid != None: |
| 15419 | self.xid = xid |
| 15420 | else: |
| 15421 | self.xid = None |
| 15422 | if code != None: |
| 15423 | self.code = code |
| 15424 | else: |
| 15425 | self.code = 0 |
| 15426 | if data != None: |
| 15427 | self.data = data |
| 15428 | else: |
| 15429 | self.data = '' |
| 15430 | return |
| 15431 | |
| 15432 | def pack(self): |
| 15433 | packed = [] |
| 15434 | packed.append(struct.pack("!B", self.version)) |
| 15435 | packed.append(struct.pack("!B", self.type)) |
| 15436 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 15437 | packed.append(struct.pack("!L", self.xid)) |
| 15438 | packed.append(struct.pack("!H", self.err_type)) |
| 15439 | packed.append(struct.pack("!H", self.code)) |
| 15440 | packed.append(self.data) |
| 15441 | length = sum([len(x) for x in packed]) |
| 15442 | packed[2] = struct.pack("!H", length) |
| 15443 | return ''.join(packed) |
| 15444 | |
| 15445 | @staticmethod |
| 15446 | def unpack(reader): |
| 15447 | obj = table_features_failed_error_msg() |
| 15448 | _version = reader.read("!B")[0] |
| 15449 | assert(_version == 5) |
| 15450 | _type = reader.read("!B")[0] |
| 15451 | assert(_type == 1) |
| 15452 | _length = reader.read("!H")[0] |
| 15453 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 15454 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 15455 | obj.xid = reader.read("!L")[0] |
| 15456 | _err_type = reader.read("!H")[0] |
| 15457 | assert(_err_type == 13) |
| 15458 | obj.code = reader.read("!H")[0] |
| 15459 | obj.data = str(reader.read_all()) |
| 15460 | return obj |
| 15461 | |
| 15462 | def __eq__(self, other): |
| 15463 | if type(self) != type(other): return False |
| 15464 | if self.xid != other.xid: return False |
| 15465 | if self.code != other.code: return False |
| 15466 | if self.data != other.data: return False |
| 15467 | return True |
| 15468 | |
| 15469 | def pretty_print(self, q): |
| 15470 | q.text("table_features_failed_error_msg {") |
| 15471 | with q.group(): |
| 15472 | with q.indent(2): |
| 15473 | q.breakable() |
| 15474 | q.text("xid = "); |
| 15475 | if self.xid != None: |
| 15476 | q.text("%#x" % self.xid) |
| 15477 | else: |
| 15478 | q.text('None') |
| 15479 | q.text(","); q.breakable() |
| 15480 | q.text("code = "); |
| 15481 | q.text("%#x" % self.code) |
| 15482 | q.text(","); q.breakable() |
| 15483 | q.text("data = "); |
| 15484 | q.pp(self.data) |
| 15485 | q.breakable() |
| 15486 | q.text('}') |
| 15487 | |
| 15488 | error_msg.subtypes[13] = table_features_failed_error_msg |
| 15489 | |
| 15490 | class table_features_stats_reply(stats_reply): |
| 15491 | version = 5 |
| 15492 | type = 19 |
| 15493 | stats_type = 12 |
| 15494 | |
| 15495 | def __init__(self, xid=None, flags=None, entries=None): |
| 15496 | if xid != None: |
| 15497 | self.xid = xid |
| 15498 | else: |
| 15499 | self.xid = None |
| 15500 | if flags != None: |
| 15501 | self.flags = flags |
| 15502 | else: |
| 15503 | self.flags = 0 |
| 15504 | if entries != None: |
| 15505 | self.entries = entries |
| 15506 | else: |
| 15507 | self.entries = [] |
| 15508 | return |
| 15509 | |
| 15510 | def pack(self): |
| 15511 | packed = [] |
| 15512 | packed.append(struct.pack("!B", self.version)) |
| 15513 | packed.append(struct.pack("!B", self.type)) |
| 15514 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 15515 | packed.append(struct.pack("!L", self.xid)) |
| 15516 | packed.append(struct.pack("!H", self.stats_type)) |
| 15517 | packed.append(struct.pack("!H", self.flags)) |
| 15518 | packed.append('\x00' * 4) |
| 15519 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 15520 | length = sum([len(x) for x in packed]) |
| 15521 | packed[2] = struct.pack("!H", length) |
| 15522 | return ''.join(packed) |
| 15523 | |
| 15524 | @staticmethod |
| 15525 | def unpack(reader): |
| 15526 | obj = table_features_stats_reply() |
| 15527 | _version = reader.read("!B")[0] |
| 15528 | assert(_version == 5) |
| 15529 | _type = reader.read("!B")[0] |
| 15530 | assert(_type == 19) |
| 15531 | _length = reader.read("!H")[0] |
| 15532 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 15533 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 15534 | obj.xid = reader.read("!L")[0] |
| 15535 | _stats_type = reader.read("!H")[0] |
| 15536 | assert(_stats_type == 12) |
| 15537 | obj.flags = reader.read("!H")[0] |
| 15538 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 15539 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_features.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 15540 | return obj |
| 15541 | |
| 15542 | def __eq__(self, other): |
| 15543 | if type(self) != type(other): return False |
| 15544 | if self.xid != other.xid: return False |
| 15545 | if self.flags != other.flags: return False |
| 15546 | if self.entries != other.entries: return False |
| 15547 | return True |
| 15548 | |
| 15549 | def pretty_print(self, q): |
| 15550 | q.text("table_features_stats_reply {") |
| 15551 | with q.group(): |
| 15552 | with q.indent(2): |
| 15553 | q.breakable() |
| 15554 | q.text("xid = "); |
| 15555 | if self.xid != None: |
| 15556 | q.text("%#x" % self.xid) |
| 15557 | else: |
| 15558 | q.text('None') |
| 15559 | q.text(","); q.breakable() |
| 15560 | q.text("flags = "); |
| 15561 | q.text("%#x" % self.flags) |
| 15562 | q.text(","); q.breakable() |
| 15563 | q.text("entries = "); |
| 15564 | q.pp(self.entries) |
| 15565 | q.breakable() |
| 15566 | q.text('}') |
| 15567 | |
| 15568 | stats_reply.subtypes[12] = table_features_stats_reply |
| 15569 | |
| 15570 | class table_features_stats_request(stats_request): |
| 15571 | version = 5 |
| 15572 | type = 18 |
| 15573 | stats_type = 12 |
| 15574 | |
| 15575 | def __init__(self, xid=None, flags=None, entries=None): |
| 15576 | if xid != None: |
| 15577 | self.xid = xid |
| 15578 | else: |
| 15579 | self.xid = None |
| 15580 | if flags != None: |
| 15581 | self.flags = flags |
| 15582 | else: |
| 15583 | self.flags = 0 |
| 15584 | if entries != None: |
| 15585 | self.entries = entries |
| 15586 | else: |
| 15587 | self.entries = [] |
| 15588 | return |
| 15589 | |
| 15590 | def pack(self): |
| 15591 | packed = [] |
| 15592 | packed.append(struct.pack("!B", self.version)) |
| 15593 | packed.append(struct.pack("!B", self.type)) |
| 15594 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 15595 | packed.append(struct.pack("!L", self.xid)) |
| 15596 | packed.append(struct.pack("!H", self.stats_type)) |
| 15597 | packed.append(struct.pack("!H", self.flags)) |
| 15598 | packed.append('\x00' * 4) |
| 15599 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 15600 | length = sum([len(x) for x in packed]) |
| 15601 | packed[2] = struct.pack("!H", length) |
| 15602 | return ''.join(packed) |
| 15603 | |
| 15604 | @staticmethod |
| 15605 | def unpack(reader): |
| 15606 | obj = table_features_stats_request() |
| 15607 | _version = reader.read("!B")[0] |
| 15608 | assert(_version == 5) |
| 15609 | _type = reader.read("!B")[0] |
| 15610 | assert(_type == 18) |
| 15611 | _length = reader.read("!H")[0] |
| 15612 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 15613 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 15614 | obj.xid = reader.read("!L")[0] |
| 15615 | _stats_type = reader.read("!H")[0] |
| 15616 | assert(_stats_type == 12) |
| 15617 | obj.flags = reader.read("!H")[0] |
| 15618 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 15619 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_features.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 15620 | return obj |
| 15621 | |
| 15622 | def __eq__(self, other): |
| 15623 | if type(self) != type(other): return False |
| 15624 | if self.xid != other.xid: return False |
| 15625 | if self.flags != other.flags: return False |
| 15626 | if self.entries != other.entries: return False |
| 15627 | return True |
| 15628 | |
| 15629 | def pretty_print(self, q): |
| 15630 | q.text("table_features_stats_request {") |
| 15631 | with q.group(): |
| 15632 | with q.indent(2): |
| 15633 | q.breakable() |
| 15634 | q.text("xid = "); |
| 15635 | if self.xid != None: |
| 15636 | q.text("%#x" % self.xid) |
| 15637 | else: |
| 15638 | q.text('None') |
| 15639 | q.text(","); q.breakable() |
| 15640 | q.text("flags = "); |
| 15641 | q.text("%#x" % self.flags) |
| 15642 | q.text(","); q.breakable() |
| 15643 | q.text("entries = "); |
| 15644 | q.pp(self.entries) |
| 15645 | q.breakable() |
| 15646 | q.text('}') |
| 15647 | |
| 15648 | stats_request.subtypes[12] = table_features_stats_request |
| 15649 | |
| 15650 | class table_mod(message): |
| 15651 | version = 5 |
| 15652 | type = 17 |
| 15653 | |
| 15654 | def __init__(self, xid=None, table_id=None, config=None, properties=None): |
| 15655 | if xid != None: |
| 15656 | self.xid = xid |
| 15657 | else: |
| 15658 | self.xid = None |
| 15659 | if table_id != None: |
| 15660 | self.table_id = table_id |
| 15661 | else: |
| 15662 | self.table_id = 0 |
| 15663 | if config != None: |
| 15664 | self.config = config |
| 15665 | else: |
| 15666 | self.config = 0 |
| 15667 | if properties != None: |
| 15668 | self.properties = properties |
| 15669 | else: |
| 15670 | self.properties = [] |
| 15671 | return |
| 15672 | |
| 15673 | def pack(self): |
| 15674 | packed = [] |
| 15675 | packed.append(struct.pack("!B", self.version)) |
| 15676 | packed.append(struct.pack("!B", self.type)) |
| 15677 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 15678 | packed.append(struct.pack("!L", self.xid)) |
| 15679 | packed.append(struct.pack("!B", self.table_id)) |
| 15680 | packed.append('\x00' * 3) |
| 15681 | packed.append(struct.pack("!L", self.config)) |
| 15682 | packed.append(loxi.generic_util.pack_list(self.properties)) |
| 15683 | length = sum([len(x) for x in packed]) |
| 15684 | packed[2] = struct.pack("!H", length) |
| 15685 | return ''.join(packed) |
| 15686 | |
| 15687 | @staticmethod |
| 15688 | def unpack(reader): |
| 15689 | obj = table_mod() |
| 15690 | _version = reader.read("!B")[0] |
| 15691 | assert(_version == 5) |
| 15692 | _type = reader.read("!B")[0] |
| 15693 | assert(_type == 17) |
| 15694 | _length = reader.read("!H")[0] |
| 15695 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 15696 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 15697 | obj.xid = reader.read("!L")[0] |
| 15698 | obj.table_id = reader.read("!B")[0] |
| 15699 | reader.skip(3) |
| 15700 | obj.config = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 15701 | obj.properties = loxi.generic_util.unpack_list(reader, ofp.table_mod_prop.table_mod_prop.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 15702 | return obj |
| 15703 | |
| 15704 | def __eq__(self, other): |
| 15705 | if type(self) != type(other): return False |
| 15706 | if self.xid != other.xid: return False |
| 15707 | if self.table_id != other.table_id: return False |
| 15708 | if self.config != other.config: return False |
| 15709 | if self.properties != other.properties: return False |
| 15710 | return True |
| 15711 | |
| 15712 | def pretty_print(self, q): |
| 15713 | q.text("table_mod {") |
| 15714 | with q.group(): |
| 15715 | with q.indent(2): |
| 15716 | q.breakable() |
| 15717 | q.text("xid = "); |
| 15718 | if self.xid != None: |
| 15719 | q.text("%#x" % self.xid) |
| 15720 | else: |
| 15721 | q.text('None') |
| 15722 | q.text(","); q.breakable() |
| 15723 | q.text("table_id = "); |
| 15724 | q.text("%#x" % self.table_id) |
| 15725 | q.text(","); q.breakable() |
| 15726 | q.text("config = "); |
| 15727 | q.text("%#x" % self.config) |
| 15728 | q.text(","); q.breakable() |
| 15729 | q.text("properties = "); |
| 15730 | q.pp(self.properties) |
| 15731 | q.breakable() |
| 15732 | q.text('}') |
| 15733 | |
| 15734 | message.subtypes[17] = table_mod |
| 15735 | |
| 15736 | class table_mod_failed_error_msg(error_msg): |
| 15737 | version = 5 |
| 15738 | type = 1 |
| 15739 | err_type = 8 |
| 15740 | |
| 15741 | def __init__(self, xid=None, code=None, data=None): |
| 15742 | if xid != None: |
| 15743 | self.xid = xid |
| 15744 | else: |
| 15745 | self.xid = None |
| 15746 | if code != None: |
| 15747 | self.code = code |
| 15748 | else: |
| 15749 | self.code = 0 |
| 15750 | if data != None: |
| 15751 | self.data = data |
| 15752 | else: |
| 15753 | self.data = '' |
| 15754 | return |
| 15755 | |
| 15756 | def pack(self): |
| 15757 | packed = [] |
| 15758 | packed.append(struct.pack("!B", self.version)) |
| 15759 | packed.append(struct.pack("!B", self.type)) |
| 15760 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 15761 | packed.append(struct.pack("!L", self.xid)) |
| 15762 | packed.append(struct.pack("!H", self.err_type)) |
| 15763 | packed.append(struct.pack("!H", self.code)) |
| 15764 | packed.append(self.data) |
| 15765 | length = sum([len(x) for x in packed]) |
| 15766 | packed[2] = struct.pack("!H", length) |
| 15767 | return ''.join(packed) |
| 15768 | |
| 15769 | @staticmethod |
| 15770 | def unpack(reader): |
| 15771 | obj = table_mod_failed_error_msg() |
| 15772 | _version = reader.read("!B")[0] |
| 15773 | assert(_version == 5) |
| 15774 | _type = reader.read("!B")[0] |
| 15775 | assert(_type == 1) |
| 15776 | _length = reader.read("!H")[0] |
| 15777 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 15778 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 15779 | obj.xid = reader.read("!L")[0] |
| 15780 | _err_type = reader.read("!H")[0] |
| 15781 | assert(_err_type == 8) |
| 15782 | obj.code = reader.read("!H")[0] |
| 15783 | obj.data = str(reader.read_all()) |
| 15784 | return obj |
| 15785 | |
| 15786 | def __eq__(self, other): |
| 15787 | if type(self) != type(other): return False |
| 15788 | if self.xid != other.xid: return False |
| 15789 | if self.code != other.code: return False |
| 15790 | if self.data != other.data: return False |
| 15791 | return True |
| 15792 | |
| 15793 | def pretty_print(self, q): |
| 15794 | q.text("table_mod_failed_error_msg {") |
| 15795 | with q.group(): |
| 15796 | with q.indent(2): |
| 15797 | q.breakable() |
| 15798 | q.text("xid = "); |
| 15799 | if self.xid != None: |
| 15800 | q.text("%#x" % self.xid) |
| 15801 | else: |
| 15802 | q.text('None') |
| 15803 | q.text(","); q.breakable() |
| 15804 | q.text("code = "); |
| 15805 | q.text("%#x" % self.code) |
| 15806 | q.text(","); q.breakable() |
| 15807 | q.text("data = "); |
| 15808 | q.pp(self.data) |
| 15809 | q.breakable() |
| 15810 | q.text('}') |
| 15811 | |
| 15812 | error_msg.subtypes[8] = table_mod_failed_error_msg |
| 15813 | |
| 15814 | class table_stats_reply(stats_reply): |
| 15815 | version = 5 |
| 15816 | type = 19 |
| 15817 | stats_type = 3 |
| 15818 | |
| 15819 | def __init__(self, xid=None, flags=None, entries=None): |
| 15820 | if xid != None: |
| 15821 | self.xid = xid |
| 15822 | else: |
| 15823 | self.xid = None |
| 15824 | if flags != None: |
| 15825 | self.flags = flags |
| 15826 | else: |
| 15827 | self.flags = 0 |
| 15828 | if entries != None: |
| 15829 | self.entries = entries |
| 15830 | else: |
| 15831 | self.entries = [] |
| 15832 | return |
| 15833 | |
| 15834 | def pack(self): |
| 15835 | packed = [] |
| 15836 | packed.append(struct.pack("!B", self.version)) |
| 15837 | packed.append(struct.pack("!B", self.type)) |
| 15838 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 15839 | packed.append(struct.pack("!L", self.xid)) |
| 15840 | packed.append(struct.pack("!H", self.stats_type)) |
| 15841 | packed.append(struct.pack("!H", self.flags)) |
| 15842 | packed.append('\x00' * 4) |
| 15843 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 15844 | length = sum([len(x) for x in packed]) |
| 15845 | packed[2] = struct.pack("!H", length) |
| 15846 | return ''.join(packed) |
| 15847 | |
| 15848 | @staticmethod |
| 15849 | def unpack(reader): |
| 15850 | obj = table_stats_reply() |
| 15851 | _version = reader.read("!B")[0] |
| 15852 | assert(_version == 5) |
| 15853 | _type = reader.read("!B")[0] |
| 15854 | assert(_type == 19) |
| 15855 | _length = reader.read("!H")[0] |
| 15856 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 15857 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 15858 | obj.xid = reader.read("!L")[0] |
| 15859 | _stats_type = reader.read("!H")[0] |
| 15860 | assert(_stats_type == 3) |
| 15861 | obj.flags = reader.read("!H")[0] |
| 15862 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 15863 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_stats_entry.unpack) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 15864 | return obj |
| 15865 | |
| 15866 | def __eq__(self, other): |
| 15867 | if type(self) != type(other): return False |
| 15868 | if self.xid != other.xid: return False |
| 15869 | if self.flags != other.flags: return False |
| 15870 | if self.entries != other.entries: return False |
| 15871 | return True |
| 15872 | |
| 15873 | def pretty_print(self, q): |
| 15874 | q.text("table_stats_reply {") |
| 15875 | with q.group(): |
| 15876 | with q.indent(2): |
| 15877 | q.breakable() |
| 15878 | q.text("xid = "); |
| 15879 | if self.xid != None: |
| 15880 | q.text("%#x" % self.xid) |
| 15881 | else: |
| 15882 | q.text('None') |
| 15883 | q.text(","); q.breakable() |
| 15884 | q.text("flags = "); |
| 15885 | q.text("%#x" % self.flags) |
| 15886 | q.text(","); q.breakable() |
| 15887 | q.text("entries = "); |
| 15888 | q.pp(self.entries) |
| 15889 | q.breakable() |
| 15890 | q.text('}') |
| 15891 | |
| 15892 | stats_reply.subtypes[3] = table_stats_reply |
| 15893 | |
| 15894 | class table_stats_request(stats_request): |
| 15895 | version = 5 |
| 15896 | type = 18 |
| 15897 | stats_type = 3 |
| 15898 | |
| 15899 | def __init__(self, xid=None, flags=None): |
| 15900 | if xid != None: |
| 15901 | self.xid = xid |
| 15902 | else: |
| 15903 | self.xid = None |
| 15904 | if flags != None: |
| 15905 | self.flags = flags |
| 15906 | else: |
| 15907 | self.flags = 0 |
| 15908 | return |
| 15909 | |
| 15910 | def pack(self): |
| 15911 | packed = [] |
| 15912 | packed.append(struct.pack("!B", self.version)) |
| 15913 | packed.append(struct.pack("!B", self.type)) |
| 15914 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 15915 | packed.append(struct.pack("!L", self.xid)) |
| 15916 | packed.append(struct.pack("!H", self.stats_type)) |
| 15917 | packed.append(struct.pack("!H", self.flags)) |
| 15918 | packed.append('\x00' * 4) |
| 15919 | length = sum([len(x) for x in packed]) |
| 15920 | packed[2] = struct.pack("!H", length) |
| 15921 | return ''.join(packed) |
| 15922 | |
| 15923 | @staticmethod |
| 15924 | def unpack(reader): |
| 15925 | obj = table_stats_request() |
| 15926 | _version = reader.read("!B")[0] |
| 15927 | assert(_version == 5) |
| 15928 | _type = reader.read("!B")[0] |
| 15929 | assert(_type == 18) |
| 15930 | _length = reader.read("!H")[0] |
| 15931 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 15932 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 15933 | obj.xid = reader.read("!L")[0] |
| 15934 | _stats_type = reader.read("!H")[0] |
| 15935 | assert(_stats_type == 3) |
| 15936 | obj.flags = reader.read("!H")[0] |
| 15937 | reader.skip(4) |
| 15938 | return obj |
| 15939 | |
| 15940 | def __eq__(self, other): |
| 15941 | if type(self) != type(other): return False |
| 15942 | if self.xid != other.xid: return False |
| 15943 | if self.flags != other.flags: return False |
| 15944 | return True |
| 15945 | |
| 15946 | def pretty_print(self, q): |
| 15947 | q.text("table_stats_request {") |
| 15948 | with q.group(): |
| 15949 | with q.indent(2): |
| 15950 | q.breakable() |
| 15951 | q.text("xid = "); |
| 15952 | if self.xid != None: |
| 15953 | q.text("%#x" % self.xid) |
| 15954 | else: |
| 15955 | q.text('None') |
| 15956 | q.text(","); q.breakable() |
| 15957 | q.text("flags = "); |
| 15958 | q.text("%#x" % self.flags) |
| 15959 | q.breakable() |
| 15960 | q.text('}') |
| 15961 | |
| 15962 | stats_request.subtypes[3] = table_stats_request |
| 15963 | |
| 15964 | class table_status(message): |
| 15965 | version = 5 |
| 15966 | type = 31 |
| 15967 | |
| 15968 | def __init__(self, xid=None, role=None, reason=None, table=None): |
| 15969 | if xid != None: |
| 15970 | self.xid = xid |
| 15971 | else: |
| 15972 | self.xid = None |
| 15973 | if role != None: |
| 15974 | self.role = role |
| 15975 | else: |
| 15976 | self.role = 0 |
| 15977 | if reason != None: |
| 15978 | self.reason = reason |
| 15979 | else: |
| 15980 | self.reason = 0 |
| 15981 | if table != None: |
| 15982 | self.table = table |
| 15983 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 15984 | self.table = ofp.table_desc() |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 15985 | return |
| 15986 | |
| 15987 | def pack(self): |
| 15988 | packed = [] |
| 15989 | packed.append(struct.pack("!B", self.version)) |
| 15990 | packed.append(struct.pack("!B", self.type)) |
| 15991 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 15992 | packed.append(struct.pack("!L", self.xid)) |
| 15993 | packed.append(struct.pack("!L", self.role)) |
| 15994 | packed.append(struct.pack("!B", self.reason)) |
| 15995 | packed.append('\x00' * 7) |
| 15996 | packed.append(self.table.pack()) |
| 15997 | length = sum([len(x) for x in packed]) |
| 15998 | packed[2] = struct.pack("!H", length) |
| 15999 | return ''.join(packed) |
| 16000 | |
| 16001 | @staticmethod |
| 16002 | def unpack(reader): |
| 16003 | obj = table_status() |
| 16004 | _version = reader.read("!B")[0] |
| 16005 | assert(_version == 5) |
| 16006 | _type = reader.read("!B")[0] |
| 16007 | assert(_type == 31) |
| 16008 | _length = reader.read("!H")[0] |
| 16009 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 16010 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 16011 | obj.xid = reader.read("!L")[0] |
| 16012 | obj.role = reader.read("!L")[0] |
| 16013 | obj.reason = reader.read("!B")[0] |
| 16014 | reader.skip(7) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 16015 | obj.table = ofp.table_desc.unpack(reader) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 16016 | return obj |
| 16017 | |
| 16018 | def __eq__(self, other): |
| 16019 | if type(self) != type(other): return False |
| 16020 | if self.xid != other.xid: return False |
| 16021 | if self.role != other.role: return False |
| 16022 | if self.reason != other.reason: return False |
| 16023 | if self.table != other.table: return False |
| 16024 | return True |
| 16025 | |
| 16026 | def pretty_print(self, q): |
| 16027 | q.text("table_status {") |
| 16028 | with q.group(): |
| 16029 | with q.indent(2): |
| 16030 | q.breakable() |
| 16031 | q.text("xid = "); |
| 16032 | if self.xid != None: |
| 16033 | q.text("%#x" % self.xid) |
| 16034 | else: |
| 16035 | q.text('None') |
| 16036 | q.text(","); q.breakable() |
| 16037 | q.text("role = "); |
| 16038 | q.text("%#x" % self.role) |
| 16039 | q.text(","); q.breakable() |
| 16040 | q.text("reason = "); |
| 16041 | q.text("%#x" % self.reason) |
| 16042 | q.text(","); q.breakable() |
| 16043 | q.text("table = "); |
| 16044 | q.pp(self.table) |
| 16045 | q.breakable() |
| 16046 | q.text('}') |
| 16047 | |
| 16048 | message.subtypes[31] = table_status |
| 16049 | |
| 16050 | |
| 16051 | def parse_header(buf): |
| 16052 | if len(buf) < 8: |
| 16053 | raise loxi.ProtocolError("too short to be an OpenFlow message") |
| 16054 | return struct.unpack_from("!BBHL", buf) |
| 16055 | |
| 16056 | def parse_message(buf): |
| 16057 | msg_ver, msg_type, msg_len, msg_xid = parse_header(buf) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 16058 | if msg_ver != ofp.OFP_VERSION and msg_type != ofp.OFPT_HELLO: |
| 16059 | raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (ofp.OFP_VERSION, msg_ver)) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 16060 | if len(buf) != msg_len: |
| 16061 | raise loxi.ProtocolError("incorrect message size") |
| 16062 | return message.unpack(loxi.generic_util.OFReader(buf)) |