Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1 | # Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University |
| 2 | # Copyright (c) 2011, 2012 Open Networking Foundation |
| 3 | # Copyright (c) 2012, 2013 Big Switch Networks, Inc. |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4 | # See the file LICENSE.pyloxi which should have been included in the source distribution |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6 | # Automatically generated by LOXI from template module.py |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7 | # Do not modify |
| 8 | |
| 9 | import struct |
| 10 | import loxi |
| 11 | import const |
| 12 | import common |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13 | import action |
| 14 | import instruction |
| 15 | import oxm |
| 16 | import action_id |
| 17 | import instruction_id |
| 18 | import meter_band |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 19 | import bsn_tlv |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 20 | import util |
| 21 | import loxi.generic_util |
| 22 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 23 | class message(loxi.OFObject): |
| 24 | subtypes = {} |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 25 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 26 | version = 4 |
| 27 | |
| 28 | def __init__(self, type=None, xid=None): |
| 29 | if type != None: |
| 30 | self.type = type |
| 31 | else: |
| 32 | self.type = 0 |
| 33 | if xid != None: |
| 34 | self.xid = xid |
| 35 | else: |
| 36 | self.xid = None |
| 37 | return |
| 38 | |
| 39 | def pack(self): |
| 40 | packed = [] |
| 41 | packed.append(struct.pack("!B", self.version)) |
| 42 | packed.append(struct.pack("!B", self.type)) |
| 43 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 44 | packed.append(struct.pack("!L", self.xid)) |
| 45 | length = sum([len(x) for x in packed]) |
| 46 | packed[2] = struct.pack("!H", length) |
| 47 | return ''.join(packed) |
| 48 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 49 | @staticmethod |
| 50 | def unpack(reader): |
| 51 | subtype, = reader.peek('B', 1) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 52 | subclass = message.subtypes.get(subtype) |
| 53 | if subclass: |
| 54 | return subclass.unpack(reader) |
| 55 | |
| 56 | obj = message() |
| 57 | _version = reader.read("!B")[0] |
| 58 | assert(_version == 4) |
| 59 | obj.type = reader.read("!B")[0] |
| 60 | _length = reader.read("!H")[0] |
| 61 | orig_reader = reader |
| 62 | reader = orig_reader.slice(_length - (2 + 2)) |
| 63 | obj.xid = reader.read("!L")[0] |
| 64 | return obj |
| 65 | |
| 66 | def __eq__(self, other): |
| 67 | if type(self) != type(other): return False |
| 68 | if self.type != other.type: return False |
| 69 | if self.xid != other.xid: return False |
| 70 | return True |
| 71 | |
| 72 | def pretty_print(self, q): |
| 73 | q.text("message {") |
| 74 | with q.group(): |
| 75 | with q.indent(2): |
| 76 | q.breakable() |
| 77 | q.text("xid = "); |
| 78 | if self.xid != None: |
| 79 | q.text("%#x" % self.xid) |
| 80 | else: |
| 81 | q.text('None') |
| 82 | q.breakable() |
| 83 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 84 | |
| 85 | |
| 86 | class stats_reply(message): |
| 87 | subtypes = {} |
| 88 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 89 | version = 4 |
| 90 | type = 19 |
| 91 | |
| 92 | def __init__(self, xid=None, stats_type=None, flags=None): |
| 93 | if xid != None: |
| 94 | self.xid = xid |
| 95 | else: |
| 96 | self.xid = None |
| 97 | if stats_type != None: |
| 98 | self.stats_type = stats_type |
| 99 | else: |
| 100 | self.stats_type = 0 |
| 101 | if flags != None: |
| 102 | self.flags = flags |
| 103 | else: |
| 104 | self.flags = 0 |
| 105 | return |
| 106 | |
| 107 | def pack(self): |
| 108 | packed = [] |
| 109 | packed.append(struct.pack("!B", self.version)) |
| 110 | packed.append(struct.pack("!B", self.type)) |
| 111 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 112 | packed.append(struct.pack("!L", self.xid)) |
| 113 | packed.append(struct.pack("!H", self.stats_type)) |
| 114 | packed.append(struct.pack("!H", self.flags)) |
| 115 | packed.append('\x00' * 4) |
| 116 | length = sum([len(x) for x in packed]) |
| 117 | packed[2] = struct.pack("!H", length) |
| 118 | return ''.join(packed) |
| 119 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 120 | @staticmethod |
| 121 | def unpack(reader): |
| 122 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 123 | subclass = stats_reply.subtypes.get(subtype) |
| 124 | if subclass: |
| 125 | return subclass.unpack(reader) |
| 126 | |
| 127 | obj = stats_reply() |
| 128 | _version = reader.read("!B")[0] |
| 129 | assert(_version == 4) |
| 130 | _type = reader.read("!B")[0] |
| 131 | assert(_type == 19) |
| 132 | _length = reader.read("!H")[0] |
| 133 | orig_reader = reader |
| 134 | reader = orig_reader.slice(_length - (2 + 2)) |
| 135 | obj.xid = reader.read("!L")[0] |
| 136 | obj.stats_type = reader.read("!H")[0] |
| 137 | obj.flags = reader.read("!H")[0] |
| 138 | reader.skip(4) |
| 139 | return obj |
| 140 | |
| 141 | def __eq__(self, other): |
| 142 | if type(self) != type(other): return False |
| 143 | if self.xid != other.xid: return False |
| 144 | if self.stats_type != other.stats_type: return False |
| 145 | if self.flags != other.flags: return False |
| 146 | return True |
| 147 | |
| 148 | def pretty_print(self, q): |
| 149 | q.text("stats_reply {") |
| 150 | with q.group(): |
| 151 | with q.indent(2): |
| 152 | q.breakable() |
| 153 | q.text("xid = "); |
| 154 | if self.xid != None: |
| 155 | q.text("%#x" % self.xid) |
| 156 | else: |
| 157 | q.text('None') |
| 158 | q.text(","); q.breakable() |
| 159 | q.text("flags = "); |
| 160 | q.text("%#x" % self.flags) |
| 161 | q.breakable() |
| 162 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 163 | |
| 164 | message.subtypes[19] = stats_reply |
| 165 | |
| 166 | class aggregate_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 167 | version = 4 |
| 168 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 169 | stats_type = 2 |
| 170 | |
| 171 | def __init__(self, xid=None, flags=None, packet_count=None, byte_count=None, flow_count=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 172 | if xid != None: |
| 173 | self.xid = xid |
| 174 | else: |
| 175 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 176 | if flags != None: |
| 177 | self.flags = flags |
| 178 | else: |
| 179 | self.flags = 0 |
| 180 | if packet_count != None: |
| 181 | self.packet_count = packet_count |
| 182 | else: |
| 183 | self.packet_count = 0 |
| 184 | if byte_count != None: |
| 185 | self.byte_count = byte_count |
| 186 | else: |
| 187 | self.byte_count = 0 |
| 188 | if flow_count != None: |
| 189 | self.flow_count = flow_count |
| 190 | else: |
| 191 | self.flow_count = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 192 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 193 | |
| 194 | def pack(self): |
| 195 | packed = [] |
| 196 | packed.append(struct.pack("!B", self.version)) |
| 197 | packed.append(struct.pack("!B", self.type)) |
| 198 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 199 | packed.append(struct.pack("!L", self.xid)) |
| 200 | packed.append(struct.pack("!H", self.stats_type)) |
| 201 | packed.append(struct.pack("!H", self.flags)) |
| 202 | packed.append('\x00' * 4) |
| 203 | packed.append(struct.pack("!Q", self.packet_count)) |
| 204 | packed.append(struct.pack("!Q", self.byte_count)) |
| 205 | packed.append(struct.pack("!L", self.flow_count)) |
| 206 | packed.append('\x00' * 4) |
| 207 | length = sum([len(x) for x in packed]) |
| 208 | packed[2] = struct.pack("!H", length) |
| 209 | return ''.join(packed) |
| 210 | |
| 211 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 212 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 213 | obj = aggregate_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 214 | _version = reader.read("!B")[0] |
| 215 | assert(_version == 4) |
| 216 | _type = reader.read("!B")[0] |
| 217 | assert(_type == 19) |
| 218 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 219 | orig_reader = reader |
| 220 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 221 | obj.xid = reader.read("!L")[0] |
| 222 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 223 | assert(_stats_type == 2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 224 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 225 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 226 | obj.packet_count = reader.read("!Q")[0] |
| 227 | obj.byte_count = reader.read("!Q")[0] |
| 228 | obj.flow_count = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 229 | reader.skip(4) |
| 230 | return obj |
| 231 | |
| 232 | def __eq__(self, other): |
| 233 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 234 | if self.xid != other.xid: return False |
| 235 | if self.flags != other.flags: return False |
| 236 | if self.packet_count != other.packet_count: return False |
| 237 | if self.byte_count != other.byte_count: return False |
| 238 | if self.flow_count != other.flow_count: return False |
| 239 | return True |
| 240 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 241 | def pretty_print(self, q): |
| 242 | q.text("aggregate_stats_reply {") |
| 243 | with q.group(): |
| 244 | with q.indent(2): |
| 245 | q.breakable() |
| 246 | q.text("xid = "); |
| 247 | if self.xid != None: |
| 248 | q.text("%#x" % self.xid) |
| 249 | else: |
| 250 | q.text('None') |
| 251 | q.text(","); q.breakable() |
| 252 | q.text("flags = "); |
| 253 | q.text("%#x" % self.flags) |
| 254 | q.text(","); q.breakable() |
| 255 | q.text("packet_count = "); |
| 256 | q.text("%#x" % self.packet_count) |
| 257 | q.text(","); q.breakable() |
| 258 | q.text("byte_count = "); |
| 259 | q.text("%#x" % self.byte_count) |
| 260 | q.text(","); q.breakable() |
| 261 | q.text("flow_count = "); |
| 262 | q.text("%#x" % self.flow_count) |
| 263 | q.breakable() |
| 264 | q.text('}') |
| 265 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 266 | stats_reply.subtypes[2] = aggregate_stats_reply |
| 267 | |
| 268 | class stats_request(message): |
| 269 | subtypes = {} |
| 270 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 271 | version = 4 |
| 272 | type = 18 |
| 273 | |
| 274 | def __init__(self, xid=None, stats_type=None, flags=None): |
| 275 | if xid != None: |
| 276 | self.xid = xid |
| 277 | else: |
| 278 | self.xid = None |
| 279 | if stats_type != None: |
| 280 | self.stats_type = stats_type |
| 281 | else: |
| 282 | self.stats_type = 0 |
| 283 | if flags != None: |
| 284 | self.flags = flags |
| 285 | else: |
| 286 | self.flags = 0 |
| 287 | return |
| 288 | |
| 289 | def pack(self): |
| 290 | packed = [] |
| 291 | packed.append(struct.pack("!B", self.version)) |
| 292 | packed.append(struct.pack("!B", self.type)) |
| 293 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 294 | packed.append(struct.pack("!L", self.xid)) |
| 295 | packed.append(struct.pack("!H", self.stats_type)) |
| 296 | packed.append(struct.pack("!H", self.flags)) |
| 297 | packed.append('\x00' * 4) |
| 298 | length = sum([len(x) for x in packed]) |
| 299 | packed[2] = struct.pack("!H", length) |
| 300 | return ''.join(packed) |
| 301 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 302 | @staticmethod |
| 303 | def unpack(reader): |
| 304 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 305 | subclass = stats_request.subtypes.get(subtype) |
| 306 | if subclass: |
| 307 | return subclass.unpack(reader) |
| 308 | |
| 309 | obj = stats_request() |
| 310 | _version = reader.read("!B")[0] |
| 311 | assert(_version == 4) |
| 312 | _type = reader.read("!B")[0] |
| 313 | assert(_type == 18) |
| 314 | _length = reader.read("!H")[0] |
| 315 | orig_reader = reader |
| 316 | reader = orig_reader.slice(_length - (2 + 2)) |
| 317 | obj.xid = reader.read("!L")[0] |
| 318 | obj.stats_type = reader.read("!H")[0] |
| 319 | obj.flags = reader.read("!H")[0] |
| 320 | reader.skip(4) |
| 321 | return obj |
| 322 | |
| 323 | def __eq__(self, other): |
| 324 | if type(self) != type(other): return False |
| 325 | if self.xid != other.xid: return False |
| 326 | if self.stats_type != other.stats_type: return False |
| 327 | if self.flags != other.flags: return False |
| 328 | return True |
| 329 | |
| 330 | def pretty_print(self, q): |
| 331 | q.text("stats_request {") |
| 332 | with q.group(): |
| 333 | with q.indent(2): |
| 334 | q.breakable() |
| 335 | q.text("xid = "); |
| 336 | if self.xid != None: |
| 337 | q.text("%#x" % self.xid) |
| 338 | else: |
| 339 | q.text('None') |
| 340 | q.text(","); q.breakable() |
| 341 | q.text("flags = "); |
| 342 | q.text("%#x" % self.flags) |
| 343 | q.breakable() |
| 344 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 345 | |
| 346 | message.subtypes[18] = stats_request |
| 347 | |
| 348 | class aggregate_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 349 | version = 4 |
| 350 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 351 | stats_type = 2 |
| 352 | |
| 353 | def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 354 | if xid != None: |
| 355 | self.xid = xid |
| 356 | else: |
| 357 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 358 | if flags != None: |
| 359 | self.flags = flags |
| 360 | else: |
| 361 | self.flags = 0 |
| 362 | if table_id != None: |
| 363 | self.table_id = table_id |
| 364 | else: |
| 365 | self.table_id = 0 |
| 366 | if out_port != None: |
| 367 | self.out_port = out_port |
| 368 | else: |
| 369 | self.out_port = 0 |
| 370 | if out_group != None: |
| 371 | self.out_group = out_group |
| 372 | else: |
| 373 | self.out_group = 0 |
| 374 | if cookie != None: |
| 375 | self.cookie = cookie |
| 376 | else: |
| 377 | self.cookie = 0 |
| 378 | if cookie_mask != None: |
| 379 | self.cookie_mask = cookie_mask |
| 380 | else: |
| 381 | self.cookie_mask = 0 |
| 382 | if match != None: |
| 383 | self.match = match |
| 384 | else: |
| 385 | self.match = common.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 386 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 387 | |
| 388 | def pack(self): |
| 389 | packed = [] |
| 390 | packed.append(struct.pack("!B", self.version)) |
| 391 | packed.append(struct.pack("!B", self.type)) |
| 392 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 393 | packed.append(struct.pack("!L", self.xid)) |
| 394 | packed.append(struct.pack("!H", self.stats_type)) |
| 395 | packed.append(struct.pack("!H", self.flags)) |
| 396 | packed.append('\x00' * 4) |
| 397 | packed.append(struct.pack("!B", self.table_id)) |
| 398 | packed.append('\x00' * 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 399 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 400 | packed.append(struct.pack("!L", self.out_group)) |
| 401 | packed.append('\x00' * 4) |
| 402 | packed.append(struct.pack("!Q", self.cookie)) |
| 403 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 404 | packed.append(self.match.pack()) |
| 405 | length = sum([len(x) for x in packed]) |
| 406 | packed[2] = struct.pack("!H", length) |
| 407 | return ''.join(packed) |
| 408 | |
| 409 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 410 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 411 | obj = aggregate_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 412 | _version = reader.read("!B")[0] |
| 413 | assert(_version == 4) |
| 414 | _type = reader.read("!B")[0] |
| 415 | assert(_type == 18) |
| 416 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 417 | orig_reader = reader |
| 418 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 419 | obj.xid = reader.read("!L")[0] |
| 420 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 421 | assert(_stats_type == 2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 422 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 423 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 424 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 425 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 426 | obj.out_port = util.unpack_port_no(reader) |
| 427 | obj.out_group = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 428 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 429 | obj.cookie = reader.read("!Q")[0] |
| 430 | obj.cookie_mask = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 431 | obj.match = common.match.unpack(reader) |
| 432 | return obj |
| 433 | |
| 434 | def __eq__(self, other): |
| 435 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 436 | if self.xid != other.xid: return False |
| 437 | if self.flags != other.flags: return False |
| 438 | if self.table_id != other.table_id: return False |
| 439 | if self.out_port != other.out_port: return False |
| 440 | if self.out_group != other.out_group: return False |
| 441 | if self.cookie != other.cookie: return False |
| 442 | if self.cookie_mask != other.cookie_mask: return False |
| 443 | if self.match != other.match: return False |
| 444 | return True |
| 445 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 446 | def pretty_print(self, q): |
| 447 | q.text("aggregate_stats_request {") |
| 448 | with q.group(): |
| 449 | with q.indent(2): |
| 450 | q.breakable() |
| 451 | q.text("xid = "); |
| 452 | if self.xid != None: |
| 453 | q.text("%#x" % self.xid) |
| 454 | else: |
| 455 | q.text('None') |
| 456 | q.text(","); q.breakable() |
| 457 | q.text("flags = "); |
| 458 | q.text("%#x" % self.flags) |
| 459 | q.text(","); q.breakable() |
| 460 | q.text("table_id = "); |
| 461 | q.text("%#x" % self.table_id) |
| 462 | q.text(","); q.breakable() |
| 463 | q.text("out_port = "); |
| 464 | q.text(util.pretty_port(self.out_port)) |
| 465 | q.text(","); q.breakable() |
| 466 | q.text("out_group = "); |
| 467 | q.text("%#x" % self.out_group) |
| 468 | q.text(","); q.breakable() |
| 469 | q.text("cookie = "); |
| 470 | q.text("%#x" % self.cookie) |
| 471 | q.text(","); q.breakable() |
| 472 | q.text("cookie_mask = "); |
| 473 | q.text("%#x" % self.cookie_mask) |
| 474 | q.text(","); q.breakable() |
| 475 | q.text("match = "); |
| 476 | q.pp(self.match) |
| 477 | q.breakable() |
| 478 | q.text('}') |
| 479 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 480 | stats_request.subtypes[2] = aggregate_stats_request |
| 481 | |
| 482 | class async_get_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 483 | version = 4 |
| 484 | type = 27 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 485 | |
| 486 | def __init__(self, xid=None, packet_in_mask_equal_master=None, packet_in_mask_slave=None, port_status_mask_equal_master=None, port_status_mask_slave=None, flow_removed_mask_equal_master=None, flow_removed_mask_slave=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 487 | if xid != None: |
| 488 | self.xid = xid |
| 489 | else: |
| 490 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 491 | if packet_in_mask_equal_master != None: |
| 492 | self.packet_in_mask_equal_master = packet_in_mask_equal_master |
| 493 | else: |
| 494 | self.packet_in_mask_equal_master = 0 |
| 495 | if packet_in_mask_slave != None: |
| 496 | self.packet_in_mask_slave = packet_in_mask_slave |
| 497 | else: |
| 498 | self.packet_in_mask_slave = 0 |
| 499 | if port_status_mask_equal_master != None: |
| 500 | self.port_status_mask_equal_master = port_status_mask_equal_master |
| 501 | else: |
| 502 | self.port_status_mask_equal_master = 0 |
| 503 | if port_status_mask_slave != None: |
| 504 | self.port_status_mask_slave = port_status_mask_slave |
| 505 | else: |
| 506 | self.port_status_mask_slave = 0 |
| 507 | if flow_removed_mask_equal_master != None: |
| 508 | self.flow_removed_mask_equal_master = flow_removed_mask_equal_master |
| 509 | else: |
| 510 | self.flow_removed_mask_equal_master = 0 |
| 511 | if flow_removed_mask_slave != None: |
| 512 | self.flow_removed_mask_slave = flow_removed_mask_slave |
| 513 | else: |
| 514 | self.flow_removed_mask_slave = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 515 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 516 | |
| 517 | def pack(self): |
| 518 | packed = [] |
| 519 | packed.append(struct.pack("!B", self.version)) |
| 520 | packed.append(struct.pack("!B", self.type)) |
| 521 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 522 | packed.append(struct.pack("!L", self.xid)) |
| 523 | packed.append(struct.pack("!L", self.packet_in_mask_equal_master)) |
| 524 | packed.append(struct.pack("!L", self.packet_in_mask_slave)) |
| 525 | packed.append(struct.pack("!L", self.port_status_mask_equal_master)) |
| 526 | packed.append(struct.pack("!L", self.port_status_mask_slave)) |
| 527 | packed.append(struct.pack("!L", self.flow_removed_mask_equal_master)) |
| 528 | packed.append(struct.pack("!L", self.flow_removed_mask_slave)) |
| 529 | length = sum([len(x) for x in packed]) |
| 530 | packed[2] = struct.pack("!H", length) |
| 531 | return ''.join(packed) |
| 532 | |
| 533 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 534 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 535 | obj = async_get_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 536 | _version = reader.read("!B")[0] |
| 537 | assert(_version == 4) |
| 538 | _type = reader.read("!B")[0] |
| 539 | assert(_type == 27) |
| 540 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 541 | orig_reader = reader |
| 542 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 543 | obj.xid = reader.read("!L")[0] |
| 544 | obj.packet_in_mask_equal_master = reader.read("!L")[0] |
| 545 | obj.packet_in_mask_slave = reader.read("!L")[0] |
| 546 | obj.port_status_mask_equal_master = reader.read("!L")[0] |
| 547 | obj.port_status_mask_slave = reader.read("!L")[0] |
| 548 | obj.flow_removed_mask_equal_master = reader.read("!L")[0] |
| 549 | obj.flow_removed_mask_slave = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 550 | return obj |
| 551 | |
| 552 | def __eq__(self, other): |
| 553 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 554 | if self.xid != other.xid: return False |
| 555 | if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False |
| 556 | if self.packet_in_mask_slave != other.packet_in_mask_slave: return False |
| 557 | if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False |
| 558 | if self.port_status_mask_slave != other.port_status_mask_slave: return False |
| 559 | if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False |
| 560 | if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False |
| 561 | return True |
| 562 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 563 | def pretty_print(self, q): |
| 564 | q.text("async_get_reply {") |
| 565 | with q.group(): |
| 566 | with q.indent(2): |
| 567 | q.breakable() |
| 568 | q.text("xid = "); |
| 569 | if self.xid != None: |
| 570 | q.text("%#x" % self.xid) |
| 571 | else: |
| 572 | q.text('None') |
| 573 | q.text(","); q.breakable() |
| 574 | q.text("packet_in_mask_equal_master = "); |
| 575 | q.text("%#x" % self.packet_in_mask_equal_master) |
| 576 | q.text(","); q.breakable() |
| 577 | q.text("packet_in_mask_slave = "); |
| 578 | q.text("%#x" % self.packet_in_mask_slave) |
| 579 | q.text(","); q.breakable() |
| 580 | q.text("port_status_mask_equal_master = "); |
| 581 | q.text("%#x" % self.port_status_mask_equal_master) |
| 582 | q.text(","); q.breakable() |
| 583 | q.text("port_status_mask_slave = "); |
| 584 | q.text("%#x" % self.port_status_mask_slave) |
| 585 | q.text(","); q.breakable() |
| 586 | q.text("flow_removed_mask_equal_master = "); |
| 587 | q.text("%#x" % self.flow_removed_mask_equal_master) |
| 588 | q.text(","); q.breakable() |
| 589 | q.text("flow_removed_mask_slave = "); |
| 590 | q.text("%#x" % self.flow_removed_mask_slave) |
| 591 | q.breakable() |
| 592 | q.text('}') |
| 593 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 594 | message.subtypes[27] = async_get_reply |
| 595 | |
| 596 | class async_get_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 597 | version = 4 |
| 598 | type = 26 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 599 | |
| 600 | def __init__(self, xid=None, packet_in_mask_equal_master=None, packet_in_mask_slave=None, port_status_mask_equal_master=None, port_status_mask_slave=None, flow_removed_mask_equal_master=None, flow_removed_mask_slave=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 601 | if xid != None: |
| 602 | self.xid = xid |
| 603 | else: |
| 604 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 605 | if packet_in_mask_equal_master != None: |
| 606 | self.packet_in_mask_equal_master = packet_in_mask_equal_master |
| 607 | else: |
| 608 | self.packet_in_mask_equal_master = 0 |
| 609 | if packet_in_mask_slave != None: |
| 610 | self.packet_in_mask_slave = packet_in_mask_slave |
| 611 | else: |
| 612 | self.packet_in_mask_slave = 0 |
| 613 | if port_status_mask_equal_master != None: |
| 614 | self.port_status_mask_equal_master = port_status_mask_equal_master |
| 615 | else: |
| 616 | self.port_status_mask_equal_master = 0 |
| 617 | if port_status_mask_slave != None: |
| 618 | self.port_status_mask_slave = port_status_mask_slave |
| 619 | else: |
| 620 | self.port_status_mask_slave = 0 |
| 621 | if flow_removed_mask_equal_master != None: |
| 622 | self.flow_removed_mask_equal_master = flow_removed_mask_equal_master |
| 623 | else: |
| 624 | self.flow_removed_mask_equal_master = 0 |
| 625 | if flow_removed_mask_slave != None: |
| 626 | self.flow_removed_mask_slave = flow_removed_mask_slave |
| 627 | else: |
| 628 | self.flow_removed_mask_slave = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 629 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 630 | |
| 631 | def pack(self): |
| 632 | packed = [] |
| 633 | packed.append(struct.pack("!B", self.version)) |
| 634 | packed.append(struct.pack("!B", self.type)) |
| 635 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 636 | packed.append(struct.pack("!L", self.xid)) |
| 637 | packed.append(struct.pack("!L", self.packet_in_mask_equal_master)) |
| 638 | packed.append(struct.pack("!L", self.packet_in_mask_slave)) |
| 639 | packed.append(struct.pack("!L", self.port_status_mask_equal_master)) |
| 640 | packed.append(struct.pack("!L", self.port_status_mask_slave)) |
| 641 | packed.append(struct.pack("!L", self.flow_removed_mask_equal_master)) |
| 642 | packed.append(struct.pack("!L", self.flow_removed_mask_slave)) |
| 643 | length = sum([len(x) for x in packed]) |
| 644 | packed[2] = struct.pack("!H", length) |
| 645 | return ''.join(packed) |
| 646 | |
| 647 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 648 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 649 | obj = async_get_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 650 | _version = reader.read("!B")[0] |
| 651 | assert(_version == 4) |
| 652 | _type = reader.read("!B")[0] |
| 653 | assert(_type == 26) |
| 654 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 655 | orig_reader = reader |
| 656 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 657 | obj.xid = reader.read("!L")[0] |
| 658 | obj.packet_in_mask_equal_master = reader.read("!L")[0] |
| 659 | obj.packet_in_mask_slave = reader.read("!L")[0] |
| 660 | obj.port_status_mask_equal_master = reader.read("!L")[0] |
| 661 | obj.port_status_mask_slave = reader.read("!L")[0] |
| 662 | obj.flow_removed_mask_equal_master = reader.read("!L")[0] |
| 663 | obj.flow_removed_mask_slave = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 664 | return obj |
| 665 | |
| 666 | def __eq__(self, other): |
| 667 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 668 | if self.xid != other.xid: return False |
| 669 | if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False |
| 670 | if self.packet_in_mask_slave != other.packet_in_mask_slave: return False |
| 671 | if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False |
| 672 | if self.port_status_mask_slave != other.port_status_mask_slave: return False |
| 673 | if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False |
| 674 | if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False |
| 675 | return True |
| 676 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 677 | def pretty_print(self, q): |
| 678 | q.text("async_get_request {") |
| 679 | with q.group(): |
| 680 | with q.indent(2): |
| 681 | q.breakable() |
| 682 | q.text("xid = "); |
| 683 | if self.xid != None: |
| 684 | q.text("%#x" % self.xid) |
| 685 | else: |
| 686 | q.text('None') |
| 687 | q.text(","); q.breakable() |
| 688 | q.text("packet_in_mask_equal_master = "); |
| 689 | q.text("%#x" % self.packet_in_mask_equal_master) |
| 690 | q.text(","); q.breakable() |
| 691 | q.text("packet_in_mask_slave = "); |
| 692 | q.text("%#x" % self.packet_in_mask_slave) |
| 693 | q.text(","); q.breakable() |
| 694 | q.text("port_status_mask_equal_master = "); |
| 695 | q.text("%#x" % self.port_status_mask_equal_master) |
| 696 | q.text(","); q.breakable() |
| 697 | q.text("port_status_mask_slave = "); |
| 698 | q.text("%#x" % self.port_status_mask_slave) |
| 699 | q.text(","); q.breakable() |
| 700 | q.text("flow_removed_mask_equal_master = "); |
| 701 | q.text("%#x" % self.flow_removed_mask_equal_master) |
| 702 | q.text(","); q.breakable() |
| 703 | q.text("flow_removed_mask_slave = "); |
| 704 | q.text("%#x" % self.flow_removed_mask_slave) |
| 705 | q.breakable() |
| 706 | q.text('}') |
| 707 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 708 | message.subtypes[26] = async_get_request |
| 709 | |
| 710 | class async_set(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 711 | version = 4 |
| 712 | type = 28 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 713 | |
| 714 | def __init__(self, xid=None, packet_in_mask_equal_master=None, packet_in_mask_slave=None, port_status_mask_equal_master=None, port_status_mask_slave=None, flow_removed_mask_equal_master=None, flow_removed_mask_slave=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 715 | if xid != None: |
| 716 | self.xid = xid |
| 717 | else: |
| 718 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 719 | if packet_in_mask_equal_master != None: |
| 720 | self.packet_in_mask_equal_master = packet_in_mask_equal_master |
| 721 | else: |
| 722 | self.packet_in_mask_equal_master = 0 |
| 723 | if packet_in_mask_slave != None: |
| 724 | self.packet_in_mask_slave = packet_in_mask_slave |
| 725 | else: |
| 726 | self.packet_in_mask_slave = 0 |
| 727 | if port_status_mask_equal_master != None: |
| 728 | self.port_status_mask_equal_master = port_status_mask_equal_master |
| 729 | else: |
| 730 | self.port_status_mask_equal_master = 0 |
| 731 | if port_status_mask_slave != None: |
| 732 | self.port_status_mask_slave = port_status_mask_slave |
| 733 | else: |
| 734 | self.port_status_mask_slave = 0 |
| 735 | if flow_removed_mask_equal_master != None: |
| 736 | self.flow_removed_mask_equal_master = flow_removed_mask_equal_master |
| 737 | else: |
| 738 | self.flow_removed_mask_equal_master = 0 |
| 739 | if flow_removed_mask_slave != None: |
| 740 | self.flow_removed_mask_slave = flow_removed_mask_slave |
| 741 | else: |
| 742 | self.flow_removed_mask_slave = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 743 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 744 | |
| 745 | def pack(self): |
| 746 | packed = [] |
| 747 | packed.append(struct.pack("!B", self.version)) |
| 748 | packed.append(struct.pack("!B", self.type)) |
| 749 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 750 | packed.append(struct.pack("!L", self.xid)) |
| 751 | packed.append(struct.pack("!L", self.packet_in_mask_equal_master)) |
| 752 | packed.append(struct.pack("!L", self.packet_in_mask_slave)) |
| 753 | packed.append(struct.pack("!L", self.port_status_mask_equal_master)) |
| 754 | packed.append(struct.pack("!L", self.port_status_mask_slave)) |
| 755 | packed.append(struct.pack("!L", self.flow_removed_mask_equal_master)) |
| 756 | packed.append(struct.pack("!L", self.flow_removed_mask_slave)) |
| 757 | length = sum([len(x) for x in packed]) |
| 758 | packed[2] = struct.pack("!H", length) |
| 759 | return ''.join(packed) |
| 760 | |
| 761 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 762 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 763 | obj = async_set() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 764 | _version = reader.read("!B")[0] |
| 765 | assert(_version == 4) |
| 766 | _type = reader.read("!B")[0] |
| 767 | assert(_type == 28) |
| 768 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 769 | orig_reader = reader |
| 770 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 771 | obj.xid = reader.read("!L")[0] |
| 772 | obj.packet_in_mask_equal_master = reader.read("!L")[0] |
| 773 | obj.packet_in_mask_slave = reader.read("!L")[0] |
| 774 | obj.port_status_mask_equal_master = reader.read("!L")[0] |
| 775 | obj.port_status_mask_slave = reader.read("!L")[0] |
| 776 | obj.flow_removed_mask_equal_master = reader.read("!L")[0] |
| 777 | obj.flow_removed_mask_slave = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 778 | return obj |
| 779 | |
| 780 | def __eq__(self, other): |
| 781 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 782 | if self.xid != other.xid: return False |
| 783 | if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False |
| 784 | if self.packet_in_mask_slave != other.packet_in_mask_slave: return False |
| 785 | if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False |
| 786 | if self.port_status_mask_slave != other.port_status_mask_slave: return False |
| 787 | if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False |
| 788 | if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False |
| 789 | return True |
| 790 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 791 | def pretty_print(self, q): |
| 792 | q.text("async_set {") |
| 793 | with q.group(): |
| 794 | with q.indent(2): |
| 795 | q.breakable() |
| 796 | q.text("xid = "); |
| 797 | if self.xid != None: |
| 798 | q.text("%#x" % self.xid) |
| 799 | else: |
| 800 | q.text('None') |
| 801 | q.text(","); q.breakable() |
| 802 | q.text("packet_in_mask_equal_master = "); |
| 803 | q.text("%#x" % self.packet_in_mask_equal_master) |
| 804 | q.text(","); q.breakable() |
| 805 | q.text("packet_in_mask_slave = "); |
| 806 | q.text("%#x" % self.packet_in_mask_slave) |
| 807 | q.text(","); q.breakable() |
| 808 | q.text("port_status_mask_equal_master = "); |
| 809 | q.text("%#x" % self.port_status_mask_equal_master) |
| 810 | q.text(","); q.breakable() |
| 811 | q.text("port_status_mask_slave = "); |
| 812 | q.text("%#x" % self.port_status_mask_slave) |
| 813 | q.text(","); q.breakable() |
| 814 | q.text("flow_removed_mask_equal_master = "); |
| 815 | q.text("%#x" % self.flow_removed_mask_equal_master) |
| 816 | q.text(","); q.breakable() |
| 817 | q.text("flow_removed_mask_slave = "); |
| 818 | q.text("%#x" % self.flow_removed_mask_slave) |
| 819 | q.breakable() |
| 820 | q.text('}') |
| 821 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 822 | message.subtypes[28] = async_set |
| 823 | |
| 824 | class error_msg(message): |
| 825 | subtypes = {} |
| 826 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 827 | version = 4 |
| 828 | type = 1 |
| 829 | |
| 830 | def __init__(self, xid=None, err_type=None): |
| 831 | if xid != None: |
| 832 | self.xid = xid |
| 833 | else: |
| 834 | self.xid = None |
| 835 | if err_type != None: |
| 836 | self.err_type = err_type |
| 837 | else: |
| 838 | self.err_type = 0 |
| 839 | return |
| 840 | |
| 841 | def pack(self): |
| 842 | packed = [] |
| 843 | packed.append(struct.pack("!B", self.version)) |
| 844 | packed.append(struct.pack("!B", self.type)) |
| 845 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 846 | packed.append(struct.pack("!L", self.xid)) |
| 847 | packed.append(struct.pack("!H", self.err_type)) |
| 848 | length = sum([len(x) for x in packed]) |
| 849 | packed[2] = struct.pack("!H", length) |
| 850 | return ''.join(packed) |
| 851 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 852 | @staticmethod |
| 853 | def unpack(reader): |
| 854 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 855 | subclass = error_msg.subtypes.get(subtype) |
| 856 | if subclass: |
| 857 | return subclass.unpack(reader) |
| 858 | |
| 859 | obj = error_msg() |
| 860 | _version = reader.read("!B")[0] |
| 861 | assert(_version == 4) |
| 862 | _type = reader.read("!B")[0] |
| 863 | assert(_type == 1) |
| 864 | _length = reader.read("!H")[0] |
| 865 | orig_reader = reader |
| 866 | reader = orig_reader.slice(_length - (2 + 2)) |
| 867 | obj.xid = reader.read("!L")[0] |
| 868 | obj.err_type = reader.read("!H")[0] |
| 869 | return obj |
| 870 | |
| 871 | def __eq__(self, other): |
| 872 | if type(self) != type(other): return False |
| 873 | if self.xid != other.xid: return False |
| 874 | if self.err_type != other.err_type: return False |
| 875 | return True |
| 876 | |
| 877 | def pretty_print(self, q): |
| 878 | q.text("error_msg {") |
| 879 | with q.group(): |
| 880 | with q.indent(2): |
| 881 | q.breakable() |
| 882 | q.text("xid = "); |
| 883 | if self.xid != None: |
| 884 | q.text("%#x" % self.xid) |
| 885 | else: |
| 886 | q.text('None') |
| 887 | q.breakable() |
| 888 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 889 | |
| 890 | message.subtypes[1] = error_msg |
| 891 | |
| 892 | class bad_action_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 893 | version = 4 |
| 894 | type = 1 |
| 895 | err_type = 2 |
| 896 | |
| 897 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 898 | if xid != None: |
| 899 | self.xid = xid |
| 900 | else: |
| 901 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 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 = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 910 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 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 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 926 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 927 | obj = bad_action_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 928 | _version = reader.read("!B")[0] |
| 929 | assert(_version == 4) |
| 930 | _type = reader.read("!B")[0] |
| 931 | assert(_type == 1) |
| 932 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 933 | orig_reader = reader |
| 934 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 935 | obj.xid = reader.read("!L")[0] |
| 936 | _err_type = reader.read("!H")[0] |
| 937 | assert(_err_type == 2) |
| 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 |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 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 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 949 | def pretty_print(self, q): |
| 950 | q.text("bad_action_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 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 968 | error_msg.subtypes[2] = bad_action_error_msg |
| 969 | |
| 970 | class bad_instruction_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 971 | version = 4 |
| 972 | type = 1 |
| 973 | err_type = 3 |
| 974 | |
| 975 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 976 | if xid != None: |
| 977 | self.xid = xid |
| 978 | else: |
| 979 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 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 = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 988 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 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 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1004 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1005 | obj = bad_instruction_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1006 | _version = reader.read("!B")[0] |
| 1007 | assert(_version == 4) |
| 1008 | _type = reader.read("!B")[0] |
| 1009 | assert(_type == 1) |
| 1010 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1011 | orig_reader = reader |
| 1012 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1013 | obj.xid = reader.read("!L")[0] |
| 1014 | _err_type = reader.read("!H")[0] |
| 1015 | assert(_err_type == 3) |
| 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 |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 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 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1027 | def pretty_print(self, q): |
| 1028 | q.text("bad_instruction_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 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1046 | error_msg.subtypes[3] = bad_instruction_error_msg |
| 1047 | |
| 1048 | class bad_match_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1049 | version = 4 |
| 1050 | type = 1 |
| 1051 | err_type = 4 |
| 1052 | |
| 1053 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1054 | if xid != None: |
| 1055 | self.xid = xid |
| 1056 | else: |
| 1057 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 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 = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1066 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 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 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1082 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1083 | obj = bad_match_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1084 | _version = reader.read("!B")[0] |
| 1085 | assert(_version == 4) |
| 1086 | _type = reader.read("!B")[0] |
| 1087 | assert(_type == 1) |
| 1088 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1089 | orig_reader = reader |
| 1090 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1091 | obj.xid = reader.read("!L")[0] |
| 1092 | _err_type = reader.read("!H")[0] |
| 1093 | assert(_err_type == 4) |
| 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 |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 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 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1105 | def pretty_print(self, q): |
| 1106 | q.text("bad_match_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 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1124 | error_msg.subtypes[4] = bad_match_error_msg |
| 1125 | |
| 1126 | class bad_request_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1127 | version = 4 |
| 1128 | type = 1 |
| 1129 | err_type = 1 |
| 1130 | |
| 1131 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1132 | if xid != None: |
| 1133 | self.xid = xid |
| 1134 | else: |
| 1135 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 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 = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1144 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 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 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1160 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1161 | obj = bad_request_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1162 | _version = reader.read("!B")[0] |
| 1163 | assert(_version == 4) |
| 1164 | _type = reader.read("!B")[0] |
| 1165 | assert(_type == 1) |
| 1166 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1167 | orig_reader = reader |
| 1168 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -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 |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 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 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 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 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1202 | error_msg.subtypes[1] = bad_request_error_msg |
| 1203 | |
| 1204 | class barrier_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1205 | version = 4 |
| 1206 | type = 21 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1207 | |
| 1208 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1209 | if xid != None: |
| 1210 | self.xid = xid |
| 1211 | else: |
| 1212 | self.xid = None |
| 1213 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 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 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1226 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1227 | obj = barrier_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1228 | _version = reader.read("!B")[0] |
| 1229 | assert(_version == 4) |
| 1230 | _type = reader.read("!B")[0] |
| 1231 | assert(_type == 21) |
| 1232 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1233 | orig_reader = reader |
| 1234 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1235 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1236 | return obj |
| 1237 | |
| 1238 | def __eq__(self, other): |
| 1239 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1240 | if self.xid != other.xid: return False |
| 1241 | return True |
| 1242 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 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 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1256 | message.subtypes[21] = barrier_reply |
| 1257 | |
| 1258 | class barrier_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1259 | version = 4 |
| 1260 | type = 20 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1261 | |
| 1262 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1263 | if xid != None: |
| 1264 | self.xid = xid |
| 1265 | else: |
| 1266 | self.xid = None |
| 1267 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 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 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1280 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1281 | obj = barrier_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1282 | _version = reader.read("!B")[0] |
| 1283 | assert(_version == 4) |
| 1284 | _type = reader.read("!B")[0] |
| 1285 | assert(_type == 20) |
| 1286 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1287 | orig_reader = reader |
| 1288 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1289 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1290 | return obj |
| 1291 | |
| 1292 | def __eq__(self, other): |
| 1293 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1294 | if self.xid != other.xid: return False |
| 1295 | return True |
| 1296 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 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 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1310 | message.subtypes[20] = barrier_request |
| 1311 | |
| 1312 | class experimenter(message): |
| 1313 | subtypes = {} |
| 1314 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1315 | version = 4 |
| 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 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1350 | @staticmethod |
| 1351 | def unpack(reader): |
| 1352 | subtype, = reader.peek('!L', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 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 == 4) |
| 1360 | _type = reader.read("!B")[0] |
| 1361 | assert(_type == 4) |
| 1362 | _length = reader.read("!H")[0] |
| 1363 | orig_reader = reader |
| 1364 | reader = orig_reader.slice(_length - (2 + 2)) |
| 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('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1397 | |
| 1398 | message.subtypes[4] = experimenter |
| 1399 | |
| 1400 | class bsn_header(experimenter): |
| 1401 | subtypes = {} |
| 1402 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1403 | version = 4 |
| 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 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1430 | @staticmethod |
| 1431 | def unpack(reader): |
| 1432 | subtype, = reader.peek('!L', 12) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 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 == 4) |
| 1440 | _type = reader.read("!B")[0] |
| 1441 | assert(_type == 4) |
| 1442 | _length = reader.read("!H")[0] |
| 1443 | orig_reader = reader |
| 1444 | reader = orig_reader.slice(_length - (2 + 2)) |
| 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('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1469 | |
| 1470 | experimenter.subtypes[6035143] = bsn_header |
| 1471 | |
Rich Lane | a61048f | 2014-01-30 16:14:00 -0800 | [diff] [blame] | 1472 | class bsn_arp_idle(bsn_header): |
| 1473 | version = 4 |
| 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 == 4) |
| 1513 | _type = reader.read("!B")[0] |
| 1514 | assert(_type == 4) |
| 1515 | _length = reader.read("!H")[0] |
| 1516 | orig_reader = reader |
| 1517 | reader = orig_reader.slice(_length - (2 + 2)) |
| 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 | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1556 | class bsn_bw_clear_data_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1557 | version = 4 |
| 1558 | type = 4 |
| 1559 | experimenter = 6035143 |
| 1560 | subtype = 22 |
| 1561 | |
| 1562 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1563 | if xid != None: |
| 1564 | self.xid = xid |
| 1565 | else: |
| 1566 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1567 | if status != None: |
| 1568 | self.status = status |
| 1569 | else: |
| 1570 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1571 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 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 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1587 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1588 | obj = bsn_bw_clear_data_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1589 | _version = reader.read("!B")[0] |
| 1590 | assert(_version == 4) |
| 1591 | _type = reader.read("!B")[0] |
| 1592 | assert(_type == 4) |
| 1593 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1594 | orig_reader = reader |
| 1595 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -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 |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1606 | if self.xid != other.xid: return False |
| 1607 | if self.status != other.status: return False |
| 1608 | return True |
| 1609 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 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 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1626 | bsn_header.subtypes[22] = bsn_bw_clear_data_reply |
| 1627 | |
| 1628 | class bsn_bw_clear_data_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1629 | version = 4 |
| 1630 | type = 4 |
| 1631 | experimenter = 6035143 |
| 1632 | subtype = 21 |
| 1633 | |
| 1634 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1635 | if xid != None: |
| 1636 | self.xid = xid |
| 1637 | else: |
| 1638 | self.xid = None |
| 1639 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 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 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1654 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1655 | obj = bsn_bw_clear_data_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1656 | _version = reader.read("!B")[0] |
| 1657 | assert(_version == 4) |
| 1658 | _type = reader.read("!B")[0] |
| 1659 | assert(_type == 4) |
| 1660 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1661 | orig_reader = reader |
| 1662 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -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 |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1672 | if self.xid != other.xid: return False |
| 1673 | return True |
| 1674 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 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 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1688 | bsn_header.subtypes[21] = bsn_bw_clear_data_request |
| 1689 | |
| 1690 | class bsn_bw_enable_get_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1691 | version = 4 |
| 1692 | type = 4 |
| 1693 | experimenter = 6035143 |
| 1694 | subtype = 20 |
| 1695 | |
| 1696 | def __init__(self, xid=None, enabled=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1697 | if xid != None: |
| 1698 | self.xid = xid |
| 1699 | else: |
| 1700 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1701 | if enabled != None: |
| 1702 | self.enabled = enabled |
| 1703 | else: |
| 1704 | self.enabled = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1705 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 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 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1721 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1722 | obj = bsn_bw_enable_get_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1723 | _version = reader.read("!B")[0] |
| 1724 | assert(_version == 4) |
| 1725 | _type = reader.read("!B")[0] |
| 1726 | assert(_type == 4) |
| 1727 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1728 | orig_reader = reader |
| 1729 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -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 |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1740 | if self.xid != other.xid: return False |
| 1741 | if self.enabled != other.enabled: return False |
| 1742 | return True |
| 1743 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 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 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1760 | bsn_header.subtypes[20] = bsn_bw_enable_get_reply |
| 1761 | |
| 1762 | class bsn_bw_enable_get_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1763 | version = 4 |
| 1764 | type = 4 |
| 1765 | experimenter = 6035143 |
| 1766 | subtype = 19 |
| 1767 | |
| 1768 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1769 | if xid != None: |
| 1770 | self.xid = xid |
| 1771 | else: |
| 1772 | self.xid = None |
| 1773 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 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 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1788 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1789 | obj = bsn_bw_enable_get_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1790 | _version = reader.read("!B")[0] |
| 1791 | assert(_version == 4) |
| 1792 | _type = reader.read("!B")[0] |
| 1793 | assert(_type == 4) |
| 1794 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1795 | orig_reader = reader |
| 1796 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -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 |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1806 | if self.xid != other.xid: return False |
| 1807 | return True |
| 1808 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 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 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1822 | bsn_header.subtypes[19] = bsn_bw_enable_get_request |
| 1823 | |
| 1824 | class bsn_bw_enable_set_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1825 | version = 4 |
| 1826 | type = 4 |
| 1827 | experimenter = 6035143 |
| 1828 | subtype = 23 |
| 1829 | |
| 1830 | def __init__(self, xid=None, enable=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1831 | if xid != None: |
| 1832 | self.xid = xid |
| 1833 | else: |
| 1834 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 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 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1843 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 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 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1860 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1861 | obj = bsn_bw_enable_set_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1862 | _version = reader.read("!B")[0] |
| 1863 | assert(_version == 4) |
| 1864 | _type = reader.read("!B")[0] |
| 1865 | assert(_type == 4) |
| 1866 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1867 | orig_reader = reader |
| 1868 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -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 |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 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 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 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 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1904 | bsn_header.subtypes[23] = bsn_bw_enable_set_reply |
| 1905 | |
| 1906 | class bsn_bw_enable_set_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1907 | version = 4 |
| 1908 | type = 4 |
| 1909 | experimenter = 6035143 |
| 1910 | subtype = 18 |
| 1911 | |
| 1912 | def __init__(self, xid=None, enable=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1913 | if xid != None: |
| 1914 | self.xid = xid |
| 1915 | else: |
| 1916 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1917 | if enable != None: |
| 1918 | self.enable = enable |
| 1919 | else: |
| 1920 | self.enable = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1921 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 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 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1937 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1938 | obj = bsn_bw_enable_set_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1939 | _version = reader.read("!B")[0] |
| 1940 | assert(_version == 4) |
| 1941 | _type = reader.read("!B")[0] |
| 1942 | assert(_type == 4) |
| 1943 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1944 | orig_reader = reader |
| 1945 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -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 |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1956 | if self.xid != other.xid: return False |
| 1957 | if self.enable != other.enable: return False |
| 1958 | return True |
| 1959 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 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 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1976 | bsn_header.subtypes[18] = bsn_bw_enable_set_request |
| 1977 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 1978 | class bsn_controller_connections_reply(bsn_header): |
| 1979 | version = 4 |
| 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 == 4) |
| 2013 | _type = reader.read("!B")[0] |
| 2014 | assert(_type == 4) |
| 2015 | _length = reader.read("!H")[0] |
| 2016 | orig_reader = reader |
| 2017 | reader = orig_reader.slice(_length - (2 + 2)) |
| 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) |
| 2023 | obj.connections = loxi.generic_util.unpack_list(reader, common.bsn_controller_connection.unpack) |
| 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 = 4 |
| 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 == 4) |
| 2080 | _type = reader.read("!B")[0] |
| 2081 | assert(_type == 4) |
| 2082 | _length = reader.read("!H")[0] |
| 2083 | orig_reader = reader |
| 2084 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2085 | obj.xid = reader.read("!L")[0] |
| 2086 | _experimenter = reader.read("!L")[0] |
| 2087 | assert(_experimenter == 6035143) |
| 2088 | _subtype = reader.read("!L")[0] |
| 2089 | assert(_subtype == 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 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2112 | class bsn_flow_idle(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2113 | version = 4 |
| 2114 | type = 4 |
| 2115 | experimenter = 6035143 |
| 2116 | subtype = 40 |
| 2117 | |
| 2118 | def __init__(self, xid=None, cookie=None, priority=None, table_id=None, match=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2119 | if xid != None: |
| 2120 | self.xid = xid |
| 2121 | else: |
| 2122 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2123 | if cookie != None: |
| 2124 | self.cookie = cookie |
| 2125 | else: |
| 2126 | self.cookie = 0 |
| 2127 | if priority != None: |
| 2128 | self.priority = priority |
| 2129 | else: |
| 2130 | self.priority = 0 |
| 2131 | if table_id != None: |
| 2132 | self.table_id = table_id |
| 2133 | else: |
| 2134 | self.table_id = 0 |
| 2135 | if match != None: |
| 2136 | self.match = match |
| 2137 | else: |
| 2138 | self.match = common.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2139 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2140 | |
| 2141 | def pack(self): |
| 2142 | packed = [] |
| 2143 | packed.append(struct.pack("!B", self.version)) |
| 2144 | packed.append(struct.pack("!B", self.type)) |
| 2145 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2146 | packed.append(struct.pack("!L", self.xid)) |
| 2147 | packed.append(struct.pack("!L", self.experimenter)) |
| 2148 | packed.append(struct.pack("!L", self.subtype)) |
| 2149 | packed.append(struct.pack("!Q", self.cookie)) |
| 2150 | packed.append(struct.pack("!H", self.priority)) |
| 2151 | packed.append(struct.pack("!B", self.table_id)) |
| 2152 | packed.append('\x00' * 5) |
| 2153 | packed.append(self.match.pack()) |
| 2154 | length = sum([len(x) for x in packed]) |
| 2155 | packed[2] = struct.pack("!H", length) |
| 2156 | return ''.join(packed) |
| 2157 | |
| 2158 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2159 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2160 | obj = bsn_flow_idle() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2161 | _version = reader.read("!B")[0] |
| 2162 | assert(_version == 4) |
| 2163 | _type = reader.read("!B")[0] |
| 2164 | assert(_type == 4) |
| 2165 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2166 | orig_reader = reader |
| 2167 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2168 | obj.xid = reader.read("!L")[0] |
| 2169 | _experimenter = reader.read("!L")[0] |
| 2170 | assert(_experimenter == 6035143) |
| 2171 | _subtype = reader.read("!L")[0] |
| 2172 | assert(_subtype == 40) |
| 2173 | obj.cookie = reader.read("!Q")[0] |
| 2174 | obj.priority = reader.read("!H")[0] |
| 2175 | obj.table_id = reader.read("!B")[0] |
| 2176 | reader.skip(5) |
| 2177 | obj.match = common.match.unpack(reader) |
| 2178 | return obj |
| 2179 | |
| 2180 | def __eq__(self, other): |
| 2181 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2182 | if self.xid != other.xid: return False |
| 2183 | if self.cookie != other.cookie: return False |
| 2184 | if self.priority != other.priority: return False |
| 2185 | if self.table_id != other.table_id: return False |
| 2186 | if self.match != other.match: return False |
| 2187 | return True |
| 2188 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2189 | def pretty_print(self, q): |
| 2190 | q.text("bsn_flow_idle {") |
| 2191 | with q.group(): |
| 2192 | with q.indent(2): |
| 2193 | q.breakable() |
| 2194 | q.text("xid = "); |
| 2195 | if self.xid != None: |
| 2196 | q.text("%#x" % self.xid) |
| 2197 | else: |
| 2198 | q.text('None') |
| 2199 | q.text(","); q.breakable() |
| 2200 | q.text("cookie = "); |
| 2201 | q.text("%#x" % self.cookie) |
| 2202 | q.text(","); q.breakable() |
| 2203 | q.text("priority = "); |
| 2204 | q.text("%#x" % self.priority) |
| 2205 | q.text(","); q.breakable() |
| 2206 | q.text("table_id = "); |
| 2207 | q.text("%#x" % self.table_id) |
| 2208 | q.text(","); q.breakable() |
| 2209 | q.text("match = "); |
| 2210 | q.pp(self.match) |
| 2211 | q.breakable() |
| 2212 | q.text('}') |
| 2213 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2214 | bsn_header.subtypes[40] = bsn_flow_idle |
| 2215 | |
| 2216 | class bsn_flow_idle_enable_get_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2217 | version = 4 |
| 2218 | type = 4 |
| 2219 | experimenter = 6035143 |
| 2220 | subtype = 39 |
| 2221 | |
| 2222 | def __init__(self, xid=None, enabled=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2223 | if xid != None: |
| 2224 | self.xid = xid |
| 2225 | else: |
| 2226 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2227 | if enabled != None: |
| 2228 | self.enabled = enabled |
| 2229 | else: |
| 2230 | self.enabled = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2231 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2232 | |
| 2233 | def pack(self): |
| 2234 | packed = [] |
| 2235 | packed.append(struct.pack("!B", self.version)) |
| 2236 | packed.append(struct.pack("!B", self.type)) |
| 2237 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2238 | packed.append(struct.pack("!L", self.xid)) |
| 2239 | packed.append(struct.pack("!L", self.experimenter)) |
| 2240 | packed.append(struct.pack("!L", self.subtype)) |
| 2241 | packed.append(struct.pack("!L", self.enabled)) |
| 2242 | length = sum([len(x) for x in packed]) |
| 2243 | packed[2] = struct.pack("!H", length) |
| 2244 | return ''.join(packed) |
| 2245 | |
| 2246 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2247 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2248 | obj = bsn_flow_idle_enable_get_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2249 | _version = reader.read("!B")[0] |
| 2250 | assert(_version == 4) |
| 2251 | _type = reader.read("!B")[0] |
| 2252 | assert(_type == 4) |
| 2253 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2254 | orig_reader = reader |
| 2255 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2256 | obj.xid = reader.read("!L")[0] |
| 2257 | _experimenter = reader.read("!L")[0] |
| 2258 | assert(_experimenter == 6035143) |
| 2259 | _subtype = reader.read("!L")[0] |
| 2260 | assert(_subtype == 39) |
| 2261 | obj.enabled = reader.read("!L")[0] |
| 2262 | return obj |
| 2263 | |
| 2264 | def __eq__(self, other): |
| 2265 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2266 | if self.xid != other.xid: return False |
| 2267 | if self.enabled != other.enabled: return False |
| 2268 | return True |
| 2269 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2270 | def pretty_print(self, q): |
| 2271 | q.text("bsn_flow_idle_enable_get_reply {") |
| 2272 | with q.group(): |
| 2273 | with q.indent(2): |
| 2274 | q.breakable() |
| 2275 | q.text("xid = "); |
| 2276 | if self.xid != None: |
| 2277 | q.text("%#x" % self.xid) |
| 2278 | else: |
| 2279 | q.text('None') |
| 2280 | q.text(","); q.breakable() |
| 2281 | q.text("enabled = "); |
| 2282 | q.text("%#x" % self.enabled) |
| 2283 | q.breakable() |
| 2284 | q.text('}') |
| 2285 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2286 | bsn_header.subtypes[39] = bsn_flow_idle_enable_get_reply |
| 2287 | |
| 2288 | class bsn_flow_idle_enable_get_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2289 | version = 4 |
| 2290 | type = 4 |
| 2291 | experimenter = 6035143 |
| 2292 | subtype = 38 |
| 2293 | |
| 2294 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2295 | if xid != None: |
| 2296 | self.xid = xid |
| 2297 | else: |
| 2298 | self.xid = None |
| 2299 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2300 | |
| 2301 | def pack(self): |
| 2302 | packed = [] |
| 2303 | packed.append(struct.pack("!B", self.version)) |
| 2304 | packed.append(struct.pack("!B", self.type)) |
| 2305 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2306 | packed.append(struct.pack("!L", self.xid)) |
| 2307 | packed.append(struct.pack("!L", self.experimenter)) |
| 2308 | packed.append(struct.pack("!L", self.subtype)) |
| 2309 | length = sum([len(x) for x in packed]) |
| 2310 | packed[2] = struct.pack("!H", length) |
| 2311 | return ''.join(packed) |
| 2312 | |
| 2313 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2314 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2315 | obj = bsn_flow_idle_enable_get_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2316 | _version = reader.read("!B")[0] |
| 2317 | assert(_version == 4) |
| 2318 | _type = reader.read("!B")[0] |
| 2319 | assert(_type == 4) |
| 2320 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2321 | orig_reader = reader |
| 2322 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2323 | obj.xid = reader.read("!L")[0] |
| 2324 | _experimenter = reader.read("!L")[0] |
| 2325 | assert(_experimenter == 6035143) |
| 2326 | _subtype = reader.read("!L")[0] |
| 2327 | assert(_subtype == 38) |
| 2328 | return obj |
| 2329 | |
| 2330 | def __eq__(self, other): |
| 2331 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2332 | if self.xid != other.xid: return False |
| 2333 | return True |
| 2334 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2335 | def pretty_print(self, q): |
| 2336 | q.text("bsn_flow_idle_enable_get_request {") |
| 2337 | with q.group(): |
| 2338 | with q.indent(2): |
| 2339 | q.breakable() |
| 2340 | q.text("xid = "); |
| 2341 | if self.xid != None: |
| 2342 | q.text("%#x" % self.xid) |
| 2343 | else: |
| 2344 | q.text('None') |
| 2345 | q.breakable() |
| 2346 | q.text('}') |
| 2347 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2348 | bsn_header.subtypes[38] = bsn_flow_idle_enable_get_request |
| 2349 | |
| 2350 | class bsn_flow_idle_enable_set_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2351 | version = 4 |
| 2352 | type = 4 |
| 2353 | experimenter = 6035143 |
| 2354 | subtype = 37 |
| 2355 | |
| 2356 | def __init__(self, xid=None, enable=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2357 | if xid != None: |
| 2358 | self.xid = xid |
| 2359 | else: |
| 2360 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2361 | if enable != None: |
| 2362 | self.enable = enable |
| 2363 | else: |
| 2364 | self.enable = 0 |
| 2365 | if status != None: |
| 2366 | self.status = status |
| 2367 | else: |
| 2368 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2369 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2370 | |
| 2371 | def pack(self): |
| 2372 | packed = [] |
| 2373 | packed.append(struct.pack("!B", self.version)) |
| 2374 | packed.append(struct.pack("!B", self.type)) |
| 2375 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2376 | packed.append(struct.pack("!L", self.xid)) |
| 2377 | packed.append(struct.pack("!L", self.experimenter)) |
| 2378 | packed.append(struct.pack("!L", self.subtype)) |
| 2379 | packed.append(struct.pack("!L", self.enable)) |
| 2380 | packed.append(struct.pack("!L", self.status)) |
| 2381 | length = sum([len(x) for x in packed]) |
| 2382 | packed[2] = struct.pack("!H", length) |
| 2383 | return ''.join(packed) |
| 2384 | |
| 2385 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2386 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2387 | obj = bsn_flow_idle_enable_set_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2388 | _version = reader.read("!B")[0] |
| 2389 | assert(_version == 4) |
| 2390 | _type = reader.read("!B")[0] |
| 2391 | assert(_type == 4) |
| 2392 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2393 | orig_reader = reader |
| 2394 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2395 | obj.xid = reader.read("!L")[0] |
| 2396 | _experimenter = reader.read("!L")[0] |
| 2397 | assert(_experimenter == 6035143) |
| 2398 | _subtype = reader.read("!L")[0] |
| 2399 | assert(_subtype == 37) |
| 2400 | obj.enable = reader.read("!L")[0] |
| 2401 | obj.status = reader.read("!L")[0] |
| 2402 | return obj |
| 2403 | |
| 2404 | def __eq__(self, other): |
| 2405 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2406 | if self.xid != other.xid: return False |
| 2407 | if self.enable != other.enable: return False |
| 2408 | if self.status != other.status: return False |
| 2409 | return True |
| 2410 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2411 | def pretty_print(self, q): |
| 2412 | q.text("bsn_flow_idle_enable_set_reply {") |
| 2413 | with q.group(): |
| 2414 | with q.indent(2): |
| 2415 | q.breakable() |
| 2416 | q.text("xid = "); |
| 2417 | if self.xid != None: |
| 2418 | q.text("%#x" % self.xid) |
| 2419 | else: |
| 2420 | q.text('None') |
| 2421 | q.text(","); q.breakable() |
| 2422 | q.text("enable = "); |
| 2423 | q.text("%#x" % self.enable) |
| 2424 | q.text(","); q.breakable() |
| 2425 | q.text("status = "); |
| 2426 | q.text("%#x" % self.status) |
| 2427 | q.breakable() |
| 2428 | q.text('}') |
| 2429 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2430 | bsn_header.subtypes[37] = bsn_flow_idle_enable_set_reply |
| 2431 | |
| 2432 | class bsn_flow_idle_enable_set_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2433 | version = 4 |
| 2434 | type = 4 |
| 2435 | experimenter = 6035143 |
| 2436 | subtype = 36 |
| 2437 | |
| 2438 | def __init__(self, xid=None, enable=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2439 | if xid != None: |
| 2440 | self.xid = xid |
| 2441 | else: |
| 2442 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2443 | if enable != None: |
| 2444 | self.enable = enable |
| 2445 | else: |
| 2446 | self.enable = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2447 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2448 | |
| 2449 | def pack(self): |
| 2450 | packed = [] |
| 2451 | packed.append(struct.pack("!B", self.version)) |
| 2452 | packed.append(struct.pack("!B", self.type)) |
| 2453 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2454 | packed.append(struct.pack("!L", self.xid)) |
| 2455 | packed.append(struct.pack("!L", self.experimenter)) |
| 2456 | packed.append(struct.pack("!L", self.subtype)) |
| 2457 | packed.append(struct.pack("!L", self.enable)) |
| 2458 | length = sum([len(x) for x in packed]) |
| 2459 | packed[2] = struct.pack("!H", length) |
| 2460 | return ''.join(packed) |
| 2461 | |
| 2462 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2463 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2464 | obj = bsn_flow_idle_enable_set_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2465 | _version = reader.read("!B")[0] |
| 2466 | assert(_version == 4) |
| 2467 | _type = reader.read("!B")[0] |
| 2468 | assert(_type == 4) |
| 2469 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2470 | orig_reader = reader |
| 2471 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2472 | obj.xid = reader.read("!L")[0] |
| 2473 | _experimenter = reader.read("!L")[0] |
| 2474 | assert(_experimenter == 6035143) |
| 2475 | _subtype = reader.read("!L")[0] |
| 2476 | assert(_subtype == 36) |
| 2477 | obj.enable = reader.read("!L")[0] |
| 2478 | return obj |
| 2479 | |
| 2480 | def __eq__(self, other): |
| 2481 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2482 | if self.xid != other.xid: return False |
| 2483 | if self.enable != other.enable: return False |
| 2484 | return True |
| 2485 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2486 | def pretty_print(self, q): |
| 2487 | q.text("bsn_flow_idle_enable_set_request {") |
| 2488 | with q.group(): |
| 2489 | with q.indent(2): |
| 2490 | q.breakable() |
| 2491 | q.text("xid = "); |
| 2492 | if self.xid != None: |
| 2493 | q.text("%#x" % self.xid) |
| 2494 | else: |
| 2495 | q.text('None') |
| 2496 | q.text(","); q.breakable() |
| 2497 | q.text("enable = "); |
| 2498 | q.text("%#x" % self.enable) |
| 2499 | q.breakable() |
| 2500 | q.text('}') |
| 2501 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2502 | bsn_header.subtypes[36] = bsn_flow_idle_enable_set_request |
| 2503 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 2504 | class experimenter_stats_reply(stats_reply): |
| 2505 | subtypes = {} |
| 2506 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2507 | version = 4 |
| 2508 | type = 19 |
| 2509 | stats_type = 65535 |
| 2510 | |
| 2511 | def __init__(self, xid=None, flags=None, experimenter=None, subtype=None): |
| 2512 | if xid != None: |
| 2513 | self.xid = xid |
| 2514 | else: |
| 2515 | self.xid = None |
| 2516 | if flags != None: |
| 2517 | self.flags = flags |
| 2518 | else: |
| 2519 | self.flags = 0 |
| 2520 | if experimenter != None: |
| 2521 | self.experimenter = experimenter |
| 2522 | else: |
| 2523 | self.experimenter = 0 |
| 2524 | if subtype != None: |
| 2525 | self.subtype = subtype |
| 2526 | else: |
| 2527 | self.subtype = 0 |
| 2528 | return |
| 2529 | |
| 2530 | def pack(self): |
| 2531 | packed = [] |
| 2532 | packed.append(struct.pack("!B", self.version)) |
| 2533 | packed.append(struct.pack("!B", self.type)) |
| 2534 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2535 | packed.append(struct.pack("!L", self.xid)) |
| 2536 | packed.append(struct.pack("!H", self.stats_type)) |
| 2537 | packed.append(struct.pack("!H", self.flags)) |
| 2538 | packed.append('\x00' * 4) |
| 2539 | packed.append(struct.pack("!L", self.experimenter)) |
| 2540 | packed.append(struct.pack("!L", self.subtype)) |
| 2541 | length = sum([len(x) for x in packed]) |
| 2542 | packed[2] = struct.pack("!H", length) |
| 2543 | return ''.join(packed) |
| 2544 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 2545 | @staticmethod |
| 2546 | def unpack(reader): |
| 2547 | subtype, = reader.peek('!L', 16) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2548 | subclass = experimenter_stats_reply.subtypes.get(subtype) |
| 2549 | if subclass: |
| 2550 | return subclass.unpack(reader) |
| 2551 | |
| 2552 | obj = experimenter_stats_reply() |
| 2553 | _version = reader.read("!B")[0] |
| 2554 | assert(_version == 4) |
| 2555 | _type = reader.read("!B")[0] |
| 2556 | assert(_type == 19) |
| 2557 | _length = reader.read("!H")[0] |
| 2558 | orig_reader = reader |
| 2559 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2560 | obj.xid = reader.read("!L")[0] |
| 2561 | _stats_type = reader.read("!H")[0] |
| 2562 | assert(_stats_type == 65535) |
| 2563 | obj.flags = reader.read("!H")[0] |
| 2564 | reader.skip(4) |
| 2565 | obj.experimenter = reader.read("!L")[0] |
| 2566 | obj.subtype = reader.read("!L")[0] |
| 2567 | return obj |
| 2568 | |
| 2569 | def __eq__(self, other): |
| 2570 | if type(self) != type(other): return False |
| 2571 | if self.xid != other.xid: return False |
| 2572 | if self.flags != other.flags: return False |
| 2573 | if self.experimenter != other.experimenter: return False |
| 2574 | if self.subtype != other.subtype: return False |
| 2575 | return True |
| 2576 | |
| 2577 | def pretty_print(self, q): |
| 2578 | q.text("experimenter_stats_reply {") |
| 2579 | with q.group(): |
| 2580 | with q.indent(2): |
| 2581 | q.breakable() |
| 2582 | q.text("xid = "); |
| 2583 | if self.xid != None: |
| 2584 | q.text("%#x" % self.xid) |
| 2585 | else: |
| 2586 | q.text('None') |
| 2587 | q.text(","); q.breakable() |
| 2588 | q.text("flags = "); |
| 2589 | q.text("%#x" % self.flags) |
| 2590 | q.text(","); q.breakable() |
| 2591 | q.text("subtype = "); |
| 2592 | q.text("%#x" % self.subtype) |
| 2593 | q.breakable() |
| 2594 | q.text('}') |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 2595 | |
| 2596 | stats_reply.subtypes[65535] = experimenter_stats_reply |
| 2597 | |
| 2598 | class bsn_stats_reply(experimenter_stats_reply): |
| 2599 | subtypes = {} |
| 2600 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2601 | version = 4 |
| 2602 | type = 19 |
| 2603 | stats_type = 65535 |
| 2604 | experimenter = 6035143 |
| 2605 | |
| 2606 | def __init__(self, xid=None, flags=None, subtype=None): |
| 2607 | if xid != None: |
| 2608 | self.xid = xid |
| 2609 | else: |
| 2610 | self.xid = None |
| 2611 | if flags != None: |
| 2612 | self.flags = flags |
| 2613 | else: |
| 2614 | self.flags = 0 |
| 2615 | if subtype != None: |
| 2616 | self.subtype = subtype |
| 2617 | else: |
| 2618 | self.subtype = 0 |
| 2619 | return |
| 2620 | |
| 2621 | def pack(self): |
| 2622 | packed = [] |
| 2623 | packed.append(struct.pack("!B", self.version)) |
| 2624 | packed.append(struct.pack("!B", self.type)) |
| 2625 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2626 | packed.append(struct.pack("!L", self.xid)) |
| 2627 | packed.append(struct.pack("!H", self.stats_type)) |
| 2628 | packed.append(struct.pack("!H", self.flags)) |
| 2629 | packed.append('\x00' * 4) |
| 2630 | packed.append(struct.pack("!L", self.experimenter)) |
| 2631 | packed.append(struct.pack("!L", self.subtype)) |
| 2632 | length = sum([len(x) for x in packed]) |
| 2633 | packed[2] = struct.pack("!H", length) |
| 2634 | return ''.join(packed) |
| 2635 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 2636 | @staticmethod |
| 2637 | def unpack(reader): |
| 2638 | subtype, = reader.peek('!L', 20) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2639 | subclass = bsn_stats_reply.subtypes.get(subtype) |
| 2640 | if subclass: |
| 2641 | return subclass.unpack(reader) |
| 2642 | |
| 2643 | obj = bsn_stats_reply() |
| 2644 | _version = reader.read("!B")[0] |
| 2645 | assert(_version == 4) |
| 2646 | _type = reader.read("!B")[0] |
| 2647 | assert(_type == 19) |
| 2648 | _length = reader.read("!H")[0] |
| 2649 | orig_reader = reader |
| 2650 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2651 | obj.xid = reader.read("!L")[0] |
| 2652 | _stats_type = reader.read("!H")[0] |
| 2653 | assert(_stats_type == 65535) |
| 2654 | obj.flags = reader.read("!H")[0] |
| 2655 | reader.skip(4) |
| 2656 | _experimenter = reader.read("!L")[0] |
| 2657 | assert(_experimenter == 6035143) |
| 2658 | obj.subtype = reader.read("!L")[0] |
| 2659 | return obj |
| 2660 | |
| 2661 | def __eq__(self, other): |
| 2662 | if type(self) != type(other): return False |
| 2663 | if self.xid != other.xid: return False |
| 2664 | if self.flags != other.flags: return False |
| 2665 | if self.subtype != other.subtype: return False |
| 2666 | return True |
| 2667 | |
| 2668 | def pretty_print(self, q): |
| 2669 | q.text("bsn_stats_reply {") |
| 2670 | with q.group(): |
| 2671 | with q.indent(2): |
| 2672 | q.breakable() |
| 2673 | q.text("xid = "); |
| 2674 | if self.xid != None: |
| 2675 | q.text("%#x" % self.xid) |
| 2676 | else: |
| 2677 | q.text('None') |
| 2678 | q.text(","); q.breakable() |
| 2679 | q.text("flags = "); |
| 2680 | q.text("%#x" % self.flags) |
| 2681 | q.breakable() |
| 2682 | q.text('}') |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 2683 | |
| 2684 | experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply |
| 2685 | |
| 2686 | class bsn_gentable_bucket_stats_reply(bsn_stats_reply): |
| 2687 | version = 4 |
| 2688 | type = 19 |
| 2689 | stats_type = 65535 |
| 2690 | experimenter = 6035143 |
| 2691 | subtype = 5 |
| 2692 | |
| 2693 | def __init__(self, xid=None, flags=None, entries=None): |
| 2694 | if xid != None: |
| 2695 | self.xid = xid |
| 2696 | else: |
| 2697 | self.xid = None |
| 2698 | if flags != None: |
| 2699 | self.flags = flags |
| 2700 | else: |
| 2701 | self.flags = 0 |
| 2702 | if entries != None: |
| 2703 | self.entries = entries |
| 2704 | else: |
| 2705 | self.entries = [] |
| 2706 | return |
| 2707 | |
| 2708 | def pack(self): |
| 2709 | packed = [] |
| 2710 | packed.append(struct.pack("!B", self.version)) |
| 2711 | packed.append(struct.pack("!B", self.type)) |
| 2712 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2713 | packed.append(struct.pack("!L", self.xid)) |
| 2714 | packed.append(struct.pack("!H", self.stats_type)) |
| 2715 | packed.append(struct.pack("!H", self.flags)) |
| 2716 | packed.append('\x00' * 4) |
| 2717 | packed.append(struct.pack("!L", self.experimenter)) |
| 2718 | packed.append(struct.pack("!L", self.subtype)) |
| 2719 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 2720 | length = sum([len(x) for x in packed]) |
| 2721 | packed[2] = struct.pack("!H", length) |
| 2722 | return ''.join(packed) |
| 2723 | |
| 2724 | @staticmethod |
| 2725 | def unpack(reader): |
| 2726 | obj = bsn_gentable_bucket_stats_reply() |
| 2727 | _version = reader.read("!B")[0] |
| 2728 | assert(_version == 4) |
| 2729 | _type = reader.read("!B")[0] |
| 2730 | assert(_type == 19) |
| 2731 | _length = reader.read("!H")[0] |
| 2732 | orig_reader = reader |
| 2733 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2734 | obj.xid = reader.read("!L")[0] |
| 2735 | _stats_type = reader.read("!H")[0] |
| 2736 | assert(_stats_type == 65535) |
| 2737 | obj.flags = reader.read("!H")[0] |
| 2738 | reader.skip(4) |
| 2739 | _experimenter = reader.read("!L")[0] |
| 2740 | assert(_experimenter == 6035143) |
| 2741 | _subtype = reader.read("!L")[0] |
| 2742 | assert(_subtype == 5) |
| 2743 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_bucket_stats_entry.unpack) |
| 2744 | return obj |
| 2745 | |
| 2746 | def __eq__(self, other): |
| 2747 | if type(self) != type(other): return False |
| 2748 | if self.xid != other.xid: return False |
| 2749 | if self.flags != other.flags: return False |
| 2750 | if self.entries != other.entries: return False |
| 2751 | return True |
| 2752 | |
| 2753 | def pretty_print(self, q): |
| 2754 | q.text("bsn_gentable_bucket_stats_reply {") |
| 2755 | with q.group(): |
| 2756 | with q.indent(2): |
| 2757 | q.breakable() |
| 2758 | q.text("xid = "); |
| 2759 | if self.xid != None: |
| 2760 | q.text("%#x" % self.xid) |
| 2761 | else: |
| 2762 | q.text('None') |
| 2763 | q.text(","); q.breakable() |
| 2764 | q.text("flags = "); |
| 2765 | q.text("%#x" % self.flags) |
| 2766 | q.text(","); q.breakable() |
| 2767 | q.text("entries = "); |
| 2768 | q.pp(self.entries) |
| 2769 | q.breakable() |
| 2770 | q.text('}') |
| 2771 | |
| 2772 | bsn_stats_reply.subtypes[5] = bsn_gentable_bucket_stats_reply |
| 2773 | |
| 2774 | class experimenter_stats_request(stats_request): |
| 2775 | subtypes = {} |
| 2776 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2777 | version = 4 |
| 2778 | type = 18 |
| 2779 | stats_type = 65535 |
| 2780 | |
| 2781 | def __init__(self, xid=None, flags=None, experimenter=None, subtype=None): |
| 2782 | if xid != None: |
| 2783 | self.xid = xid |
| 2784 | else: |
| 2785 | self.xid = None |
| 2786 | if flags != None: |
| 2787 | self.flags = flags |
| 2788 | else: |
| 2789 | self.flags = 0 |
| 2790 | if experimenter != None: |
| 2791 | self.experimenter = experimenter |
| 2792 | else: |
| 2793 | self.experimenter = 0 |
| 2794 | if subtype != None: |
| 2795 | self.subtype = subtype |
| 2796 | else: |
| 2797 | self.subtype = 0 |
| 2798 | return |
| 2799 | |
| 2800 | def pack(self): |
| 2801 | packed = [] |
| 2802 | packed.append(struct.pack("!B", self.version)) |
| 2803 | packed.append(struct.pack("!B", self.type)) |
| 2804 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2805 | packed.append(struct.pack("!L", self.xid)) |
| 2806 | packed.append(struct.pack("!H", self.stats_type)) |
| 2807 | packed.append(struct.pack("!H", self.flags)) |
| 2808 | packed.append('\x00' * 4) |
| 2809 | packed.append(struct.pack("!L", self.experimenter)) |
| 2810 | packed.append(struct.pack("!L", self.subtype)) |
| 2811 | length = sum([len(x) for x in packed]) |
| 2812 | packed[2] = struct.pack("!H", length) |
| 2813 | return ''.join(packed) |
| 2814 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 2815 | @staticmethod |
| 2816 | def unpack(reader): |
| 2817 | subtype, = reader.peek('!L', 16) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2818 | subclass = experimenter_stats_request.subtypes.get(subtype) |
| 2819 | if subclass: |
| 2820 | return subclass.unpack(reader) |
| 2821 | |
| 2822 | obj = experimenter_stats_request() |
| 2823 | _version = reader.read("!B")[0] |
| 2824 | assert(_version == 4) |
| 2825 | _type = reader.read("!B")[0] |
| 2826 | assert(_type == 18) |
| 2827 | _length = reader.read("!H")[0] |
| 2828 | orig_reader = reader |
| 2829 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2830 | obj.xid = reader.read("!L")[0] |
| 2831 | _stats_type = reader.read("!H")[0] |
| 2832 | assert(_stats_type == 65535) |
| 2833 | obj.flags = reader.read("!H")[0] |
| 2834 | reader.skip(4) |
| 2835 | obj.experimenter = reader.read("!L")[0] |
| 2836 | obj.subtype = reader.read("!L")[0] |
| 2837 | return obj |
| 2838 | |
| 2839 | def __eq__(self, other): |
| 2840 | if type(self) != type(other): return False |
| 2841 | if self.xid != other.xid: return False |
| 2842 | if self.flags != other.flags: return False |
| 2843 | if self.experimenter != other.experimenter: return False |
| 2844 | if self.subtype != other.subtype: return False |
| 2845 | return True |
| 2846 | |
| 2847 | def pretty_print(self, q): |
| 2848 | q.text("experimenter_stats_request {") |
| 2849 | with q.group(): |
| 2850 | with q.indent(2): |
| 2851 | q.breakable() |
| 2852 | q.text("xid = "); |
| 2853 | if self.xid != None: |
| 2854 | q.text("%#x" % self.xid) |
| 2855 | else: |
| 2856 | q.text('None') |
| 2857 | q.text(","); q.breakable() |
| 2858 | q.text("flags = "); |
| 2859 | q.text("%#x" % self.flags) |
| 2860 | q.text(","); q.breakable() |
| 2861 | q.text("subtype = "); |
| 2862 | q.text("%#x" % self.subtype) |
| 2863 | q.breakable() |
| 2864 | q.text('}') |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 2865 | |
| 2866 | stats_request.subtypes[65535] = experimenter_stats_request |
| 2867 | |
| 2868 | class bsn_stats_request(experimenter_stats_request): |
| 2869 | subtypes = {} |
| 2870 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2871 | version = 4 |
| 2872 | type = 18 |
| 2873 | stats_type = 65535 |
| 2874 | experimenter = 6035143 |
| 2875 | |
| 2876 | def __init__(self, xid=None, flags=None, subtype=None): |
| 2877 | if xid != None: |
| 2878 | self.xid = xid |
| 2879 | else: |
| 2880 | self.xid = None |
| 2881 | if flags != None: |
| 2882 | self.flags = flags |
| 2883 | else: |
| 2884 | self.flags = 0 |
| 2885 | if subtype != None: |
| 2886 | self.subtype = subtype |
| 2887 | else: |
| 2888 | self.subtype = 0 |
| 2889 | return |
| 2890 | |
| 2891 | def pack(self): |
| 2892 | packed = [] |
| 2893 | packed.append(struct.pack("!B", self.version)) |
| 2894 | packed.append(struct.pack("!B", self.type)) |
| 2895 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2896 | packed.append(struct.pack("!L", self.xid)) |
| 2897 | packed.append(struct.pack("!H", self.stats_type)) |
| 2898 | packed.append(struct.pack("!H", self.flags)) |
| 2899 | packed.append('\x00' * 4) |
| 2900 | packed.append(struct.pack("!L", self.experimenter)) |
| 2901 | packed.append(struct.pack("!L", self.subtype)) |
| 2902 | length = sum([len(x) for x in packed]) |
| 2903 | packed[2] = struct.pack("!H", length) |
| 2904 | return ''.join(packed) |
| 2905 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 2906 | @staticmethod |
| 2907 | def unpack(reader): |
| 2908 | subtype, = reader.peek('!L', 20) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2909 | subclass = bsn_stats_request.subtypes.get(subtype) |
| 2910 | if subclass: |
| 2911 | return subclass.unpack(reader) |
| 2912 | |
| 2913 | obj = bsn_stats_request() |
| 2914 | _version = reader.read("!B")[0] |
| 2915 | assert(_version == 4) |
| 2916 | _type = reader.read("!B")[0] |
| 2917 | assert(_type == 18) |
| 2918 | _length = reader.read("!H")[0] |
| 2919 | orig_reader = reader |
| 2920 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2921 | obj.xid = reader.read("!L")[0] |
| 2922 | _stats_type = reader.read("!H")[0] |
| 2923 | assert(_stats_type == 65535) |
| 2924 | obj.flags = reader.read("!H")[0] |
| 2925 | reader.skip(4) |
| 2926 | _experimenter = reader.read("!L")[0] |
| 2927 | assert(_experimenter == 6035143) |
| 2928 | obj.subtype = reader.read("!L")[0] |
| 2929 | return obj |
| 2930 | |
| 2931 | def __eq__(self, other): |
| 2932 | if type(self) != type(other): return False |
| 2933 | if self.xid != other.xid: return False |
| 2934 | if self.flags != other.flags: return False |
| 2935 | if self.subtype != other.subtype: return False |
| 2936 | return True |
| 2937 | |
| 2938 | def pretty_print(self, q): |
| 2939 | q.text("bsn_stats_request {") |
| 2940 | with q.group(): |
| 2941 | with q.indent(2): |
| 2942 | q.breakable() |
| 2943 | q.text("xid = "); |
| 2944 | if self.xid != None: |
| 2945 | q.text("%#x" % self.xid) |
| 2946 | else: |
| 2947 | q.text('None') |
| 2948 | q.text(","); q.breakable() |
| 2949 | q.text("flags = "); |
| 2950 | q.text("%#x" % self.flags) |
| 2951 | q.breakable() |
| 2952 | q.text('}') |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 2953 | |
| 2954 | experimenter_stats_request.subtypes[6035143] = bsn_stats_request |
| 2955 | |
| 2956 | class bsn_gentable_bucket_stats_request(bsn_stats_request): |
| 2957 | version = 4 |
| 2958 | type = 18 |
| 2959 | stats_type = 65535 |
| 2960 | experimenter = 6035143 |
| 2961 | subtype = 5 |
| 2962 | |
| 2963 | def __init__(self, xid=None, flags=None, table_id=None): |
| 2964 | if xid != None: |
| 2965 | self.xid = xid |
| 2966 | else: |
| 2967 | self.xid = None |
| 2968 | if flags != None: |
| 2969 | self.flags = flags |
| 2970 | else: |
| 2971 | self.flags = 0 |
| 2972 | if table_id != None: |
| 2973 | self.table_id = table_id |
| 2974 | else: |
| 2975 | self.table_id = 0 |
| 2976 | return |
| 2977 | |
| 2978 | def pack(self): |
| 2979 | packed = [] |
| 2980 | packed.append(struct.pack("!B", self.version)) |
| 2981 | packed.append(struct.pack("!B", self.type)) |
| 2982 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2983 | packed.append(struct.pack("!L", self.xid)) |
| 2984 | packed.append(struct.pack("!H", self.stats_type)) |
| 2985 | packed.append(struct.pack("!H", self.flags)) |
| 2986 | packed.append('\x00' * 4) |
| 2987 | packed.append(struct.pack("!L", self.experimenter)) |
| 2988 | packed.append(struct.pack("!L", self.subtype)) |
| 2989 | packed.append(struct.pack("!H", self.table_id)) |
| 2990 | length = sum([len(x) for x in packed]) |
| 2991 | packed[2] = struct.pack("!H", length) |
| 2992 | return ''.join(packed) |
| 2993 | |
| 2994 | @staticmethod |
| 2995 | def unpack(reader): |
| 2996 | obj = bsn_gentable_bucket_stats_request() |
| 2997 | _version = reader.read("!B")[0] |
| 2998 | assert(_version == 4) |
| 2999 | _type = reader.read("!B")[0] |
| 3000 | assert(_type == 18) |
| 3001 | _length = reader.read("!H")[0] |
| 3002 | orig_reader = reader |
| 3003 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3004 | obj.xid = reader.read("!L")[0] |
| 3005 | _stats_type = reader.read("!H")[0] |
| 3006 | assert(_stats_type == 65535) |
| 3007 | obj.flags = reader.read("!H")[0] |
| 3008 | reader.skip(4) |
| 3009 | _experimenter = reader.read("!L")[0] |
| 3010 | assert(_experimenter == 6035143) |
| 3011 | _subtype = reader.read("!L")[0] |
| 3012 | assert(_subtype == 5) |
| 3013 | obj.table_id = reader.read("!H")[0] |
| 3014 | return obj |
| 3015 | |
| 3016 | def __eq__(self, other): |
| 3017 | if type(self) != type(other): return False |
| 3018 | if self.xid != other.xid: return False |
| 3019 | if self.flags != other.flags: return False |
| 3020 | if self.table_id != other.table_id: return False |
| 3021 | return True |
| 3022 | |
| 3023 | def pretty_print(self, q): |
| 3024 | q.text("bsn_gentable_bucket_stats_request {") |
| 3025 | with q.group(): |
| 3026 | with q.indent(2): |
| 3027 | q.breakable() |
| 3028 | q.text("xid = "); |
| 3029 | if self.xid != None: |
| 3030 | q.text("%#x" % self.xid) |
| 3031 | else: |
| 3032 | q.text('None') |
| 3033 | q.text(","); q.breakable() |
| 3034 | q.text("flags = "); |
| 3035 | q.text("%#x" % self.flags) |
| 3036 | q.text(","); q.breakable() |
| 3037 | q.text("table_id = "); |
| 3038 | q.text("%#x" % self.table_id) |
| 3039 | q.breakable() |
| 3040 | q.text('}') |
| 3041 | |
| 3042 | bsn_stats_request.subtypes[5] = bsn_gentable_bucket_stats_request |
| 3043 | |
| 3044 | class bsn_gentable_clear_reply(bsn_header): |
| 3045 | version = 4 |
| 3046 | type = 4 |
| 3047 | experimenter = 6035143 |
| 3048 | subtype = 49 |
| 3049 | |
| 3050 | def __init__(self, xid=None, table_id=None, deleted_count=None, error_count=None): |
| 3051 | if xid != None: |
| 3052 | self.xid = xid |
| 3053 | else: |
| 3054 | self.xid = None |
| 3055 | if table_id != None: |
| 3056 | self.table_id = table_id |
| 3057 | else: |
| 3058 | self.table_id = 0 |
| 3059 | if deleted_count != None: |
| 3060 | self.deleted_count = deleted_count |
| 3061 | else: |
| 3062 | self.deleted_count = 0 |
| 3063 | if error_count != None: |
| 3064 | self.error_count = error_count |
| 3065 | else: |
| 3066 | self.error_count = 0 |
| 3067 | return |
| 3068 | |
| 3069 | def pack(self): |
| 3070 | packed = [] |
| 3071 | packed.append(struct.pack("!B", self.version)) |
| 3072 | packed.append(struct.pack("!B", self.type)) |
| 3073 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3074 | packed.append(struct.pack("!L", self.xid)) |
| 3075 | packed.append(struct.pack("!L", self.experimenter)) |
| 3076 | packed.append(struct.pack("!L", self.subtype)) |
| 3077 | packed.append(struct.pack("!H", self.table_id)) |
| 3078 | packed.append('\x00' * 2) |
| 3079 | packed.append(struct.pack("!L", self.deleted_count)) |
| 3080 | packed.append(struct.pack("!L", self.error_count)) |
| 3081 | length = sum([len(x) for x in packed]) |
| 3082 | packed[2] = struct.pack("!H", length) |
| 3083 | return ''.join(packed) |
| 3084 | |
| 3085 | @staticmethod |
| 3086 | def unpack(reader): |
| 3087 | obj = bsn_gentable_clear_reply() |
| 3088 | _version = reader.read("!B")[0] |
| 3089 | assert(_version == 4) |
| 3090 | _type = reader.read("!B")[0] |
| 3091 | assert(_type == 4) |
| 3092 | _length = reader.read("!H")[0] |
| 3093 | orig_reader = reader |
| 3094 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3095 | obj.xid = reader.read("!L")[0] |
| 3096 | _experimenter = reader.read("!L")[0] |
| 3097 | assert(_experimenter == 6035143) |
| 3098 | _subtype = reader.read("!L")[0] |
| 3099 | assert(_subtype == 49) |
| 3100 | obj.table_id = reader.read("!H")[0] |
| 3101 | reader.skip(2) |
| 3102 | obj.deleted_count = reader.read("!L")[0] |
| 3103 | obj.error_count = reader.read("!L")[0] |
| 3104 | return obj |
| 3105 | |
| 3106 | def __eq__(self, other): |
| 3107 | if type(self) != type(other): return False |
| 3108 | if self.xid != other.xid: return False |
| 3109 | if self.table_id != other.table_id: return False |
| 3110 | if self.deleted_count != other.deleted_count: return False |
| 3111 | if self.error_count != other.error_count: return False |
| 3112 | return True |
| 3113 | |
| 3114 | def pretty_print(self, q): |
| 3115 | q.text("bsn_gentable_clear_reply {") |
| 3116 | with q.group(): |
| 3117 | with q.indent(2): |
| 3118 | q.breakable() |
| 3119 | q.text("xid = "); |
| 3120 | if self.xid != None: |
| 3121 | q.text("%#x" % self.xid) |
| 3122 | else: |
| 3123 | q.text('None') |
| 3124 | q.text(","); q.breakable() |
| 3125 | q.text("table_id = "); |
| 3126 | q.text("%#x" % self.table_id) |
| 3127 | q.text(","); q.breakable() |
| 3128 | q.text("deleted_count = "); |
| 3129 | q.text("%#x" % self.deleted_count) |
| 3130 | q.text(","); q.breakable() |
| 3131 | q.text("error_count = "); |
| 3132 | q.text("%#x" % self.error_count) |
| 3133 | q.breakable() |
| 3134 | q.text('}') |
| 3135 | |
| 3136 | bsn_header.subtypes[49] = bsn_gentable_clear_reply |
| 3137 | |
| 3138 | class bsn_gentable_clear_request(bsn_header): |
| 3139 | version = 4 |
| 3140 | type = 4 |
| 3141 | experimenter = 6035143 |
| 3142 | subtype = 48 |
| 3143 | |
| 3144 | def __init__(self, xid=None, table_id=None, checksum=None, checksum_mask=None): |
| 3145 | if xid != None: |
| 3146 | self.xid = xid |
| 3147 | else: |
| 3148 | self.xid = None |
| 3149 | if table_id != None: |
| 3150 | self.table_id = table_id |
| 3151 | else: |
| 3152 | self.table_id = 0 |
| 3153 | if checksum != None: |
| 3154 | self.checksum = checksum |
| 3155 | else: |
| 3156 | self.checksum = 0 |
| 3157 | if checksum_mask != None: |
| 3158 | self.checksum_mask = checksum_mask |
| 3159 | else: |
| 3160 | self.checksum_mask = 0 |
| 3161 | return |
| 3162 | |
| 3163 | def pack(self): |
| 3164 | packed = [] |
| 3165 | packed.append(struct.pack("!B", self.version)) |
| 3166 | packed.append(struct.pack("!B", self.type)) |
| 3167 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3168 | packed.append(struct.pack("!L", self.xid)) |
| 3169 | packed.append(struct.pack("!L", self.experimenter)) |
| 3170 | packed.append(struct.pack("!L", self.subtype)) |
| 3171 | packed.append(struct.pack("!H", self.table_id)) |
| 3172 | packed.append('\x00' * 2) |
| 3173 | packed.append(util.pack_checksum_128(self.checksum)) |
| 3174 | packed.append(util.pack_checksum_128(self.checksum_mask)) |
| 3175 | length = sum([len(x) for x in packed]) |
| 3176 | packed[2] = struct.pack("!H", length) |
| 3177 | return ''.join(packed) |
| 3178 | |
| 3179 | @staticmethod |
| 3180 | def unpack(reader): |
| 3181 | obj = bsn_gentable_clear_request() |
| 3182 | _version = reader.read("!B")[0] |
| 3183 | assert(_version == 4) |
| 3184 | _type = reader.read("!B")[0] |
| 3185 | assert(_type == 4) |
| 3186 | _length = reader.read("!H")[0] |
| 3187 | orig_reader = reader |
| 3188 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3189 | obj.xid = reader.read("!L")[0] |
| 3190 | _experimenter = reader.read("!L")[0] |
| 3191 | assert(_experimenter == 6035143) |
| 3192 | _subtype = reader.read("!L")[0] |
| 3193 | assert(_subtype == 48) |
| 3194 | obj.table_id = reader.read("!H")[0] |
| 3195 | reader.skip(2) |
| 3196 | obj.checksum = util.unpack_checksum_128(reader) |
| 3197 | obj.checksum_mask = util.unpack_checksum_128(reader) |
| 3198 | return obj |
| 3199 | |
| 3200 | def __eq__(self, other): |
| 3201 | if type(self) != type(other): return False |
| 3202 | if self.xid != other.xid: return False |
| 3203 | if self.table_id != other.table_id: return False |
| 3204 | if self.checksum != other.checksum: return False |
| 3205 | if self.checksum_mask != other.checksum_mask: return False |
| 3206 | return True |
| 3207 | |
| 3208 | def pretty_print(self, q): |
| 3209 | q.text("bsn_gentable_clear_request {") |
| 3210 | with q.group(): |
| 3211 | with q.indent(2): |
| 3212 | q.breakable() |
| 3213 | q.text("xid = "); |
| 3214 | if self.xid != None: |
| 3215 | q.text("%#x" % self.xid) |
| 3216 | else: |
| 3217 | q.text('None') |
| 3218 | q.text(","); q.breakable() |
| 3219 | q.text("table_id = "); |
| 3220 | q.text("%#x" % self.table_id) |
| 3221 | q.text(","); q.breakable() |
| 3222 | q.text("checksum = "); |
| 3223 | q.pp(self.checksum) |
| 3224 | q.text(","); q.breakable() |
| 3225 | q.text("checksum_mask = "); |
| 3226 | q.pp(self.checksum_mask) |
| 3227 | q.breakable() |
| 3228 | q.text('}') |
| 3229 | |
| 3230 | bsn_header.subtypes[48] = bsn_gentable_clear_request |
| 3231 | |
| 3232 | class bsn_gentable_desc_stats_reply(bsn_stats_reply): |
| 3233 | version = 4 |
| 3234 | type = 19 |
| 3235 | stats_type = 65535 |
| 3236 | experimenter = 6035143 |
| 3237 | subtype = 4 |
| 3238 | |
| 3239 | def __init__(self, xid=None, flags=None, entries=None): |
| 3240 | if xid != None: |
| 3241 | self.xid = xid |
| 3242 | else: |
| 3243 | self.xid = None |
| 3244 | if flags != None: |
| 3245 | self.flags = flags |
| 3246 | else: |
| 3247 | self.flags = 0 |
| 3248 | if entries != None: |
| 3249 | self.entries = entries |
| 3250 | else: |
| 3251 | self.entries = [] |
| 3252 | return |
| 3253 | |
| 3254 | def pack(self): |
| 3255 | packed = [] |
| 3256 | packed.append(struct.pack("!B", self.version)) |
| 3257 | packed.append(struct.pack("!B", self.type)) |
| 3258 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3259 | packed.append(struct.pack("!L", self.xid)) |
| 3260 | packed.append(struct.pack("!H", self.stats_type)) |
| 3261 | packed.append(struct.pack("!H", self.flags)) |
| 3262 | packed.append('\x00' * 4) |
| 3263 | packed.append(struct.pack("!L", self.experimenter)) |
| 3264 | packed.append(struct.pack("!L", self.subtype)) |
| 3265 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 3266 | length = sum([len(x) for x in packed]) |
| 3267 | packed[2] = struct.pack("!H", length) |
| 3268 | return ''.join(packed) |
| 3269 | |
| 3270 | @staticmethod |
| 3271 | def unpack(reader): |
| 3272 | obj = bsn_gentable_desc_stats_reply() |
| 3273 | _version = reader.read("!B")[0] |
| 3274 | assert(_version == 4) |
| 3275 | _type = reader.read("!B")[0] |
| 3276 | assert(_type == 19) |
| 3277 | _length = reader.read("!H")[0] |
| 3278 | orig_reader = reader |
| 3279 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3280 | obj.xid = reader.read("!L")[0] |
| 3281 | _stats_type = reader.read("!H")[0] |
| 3282 | assert(_stats_type == 65535) |
| 3283 | obj.flags = reader.read("!H")[0] |
| 3284 | reader.skip(4) |
| 3285 | _experimenter = reader.read("!L")[0] |
| 3286 | assert(_experimenter == 6035143) |
| 3287 | _subtype = reader.read("!L")[0] |
| 3288 | assert(_subtype == 4) |
| 3289 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_desc_stats_entry.unpack) |
| 3290 | return obj |
| 3291 | |
| 3292 | def __eq__(self, other): |
| 3293 | if type(self) != type(other): return False |
| 3294 | if self.xid != other.xid: return False |
| 3295 | if self.flags != other.flags: return False |
| 3296 | if self.entries != other.entries: return False |
| 3297 | return True |
| 3298 | |
| 3299 | def pretty_print(self, q): |
| 3300 | q.text("bsn_gentable_desc_stats_reply {") |
| 3301 | with q.group(): |
| 3302 | with q.indent(2): |
| 3303 | q.breakable() |
| 3304 | q.text("xid = "); |
| 3305 | if self.xid != None: |
| 3306 | q.text("%#x" % self.xid) |
| 3307 | else: |
| 3308 | q.text('None') |
| 3309 | q.text(","); q.breakable() |
| 3310 | q.text("flags = "); |
| 3311 | q.text("%#x" % self.flags) |
| 3312 | q.text(","); q.breakable() |
| 3313 | q.text("entries = "); |
| 3314 | q.pp(self.entries) |
| 3315 | q.breakable() |
| 3316 | q.text('}') |
| 3317 | |
| 3318 | bsn_stats_reply.subtypes[4] = bsn_gentable_desc_stats_reply |
| 3319 | |
| 3320 | class bsn_gentable_desc_stats_request(bsn_stats_request): |
| 3321 | version = 4 |
| 3322 | type = 18 |
| 3323 | stats_type = 65535 |
| 3324 | experimenter = 6035143 |
| 3325 | subtype = 4 |
| 3326 | |
| 3327 | def __init__(self, xid=None, flags=None): |
| 3328 | if xid != None: |
| 3329 | self.xid = xid |
| 3330 | else: |
| 3331 | self.xid = None |
| 3332 | if flags != None: |
| 3333 | self.flags = flags |
| 3334 | else: |
| 3335 | self.flags = 0 |
| 3336 | return |
| 3337 | |
| 3338 | def pack(self): |
| 3339 | packed = [] |
| 3340 | packed.append(struct.pack("!B", self.version)) |
| 3341 | packed.append(struct.pack("!B", self.type)) |
| 3342 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3343 | packed.append(struct.pack("!L", self.xid)) |
| 3344 | packed.append(struct.pack("!H", self.stats_type)) |
| 3345 | packed.append(struct.pack("!H", self.flags)) |
| 3346 | packed.append('\x00' * 4) |
| 3347 | packed.append(struct.pack("!L", self.experimenter)) |
| 3348 | packed.append(struct.pack("!L", self.subtype)) |
| 3349 | length = sum([len(x) for x in packed]) |
| 3350 | packed[2] = struct.pack("!H", length) |
| 3351 | return ''.join(packed) |
| 3352 | |
| 3353 | @staticmethod |
| 3354 | def unpack(reader): |
| 3355 | obj = bsn_gentable_desc_stats_request() |
| 3356 | _version = reader.read("!B")[0] |
| 3357 | assert(_version == 4) |
| 3358 | _type = reader.read("!B")[0] |
| 3359 | assert(_type == 18) |
| 3360 | _length = reader.read("!H")[0] |
| 3361 | orig_reader = reader |
| 3362 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3363 | obj.xid = reader.read("!L")[0] |
| 3364 | _stats_type = reader.read("!H")[0] |
| 3365 | assert(_stats_type == 65535) |
| 3366 | obj.flags = reader.read("!H")[0] |
| 3367 | reader.skip(4) |
| 3368 | _experimenter = reader.read("!L")[0] |
| 3369 | assert(_experimenter == 6035143) |
| 3370 | _subtype = reader.read("!L")[0] |
| 3371 | assert(_subtype == 4) |
| 3372 | return obj |
| 3373 | |
| 3374 | def __eq__(self, other): |
| 3375 | if type(self) != type(other): return False |
| 3376 | if self.xid != other.xid: return False |
| 3377 | if self.flags != other.flags: return False |
| 3378 | return True |
| 3379 | |
| 3380 | def pretty_print(self, q): |
| 3381 | q.text("bsn_gentable_desc_stats_request {") |
| 3382 | with q.group(): |
| 3383 | with q.indent(2): |
| 3384 | q.breakable() |
| 3385 | q.text("xid = "); |
| 3386 | if self.xid != None: |
| 3387 | q.text("%#x" % self.xid) |
| 3388 | else: |
| 3389 | q.text('None') |
| 3390 | q.text(","); q.breakable() |
| 3391 | q.text("flags = "); |
| 3392 | q.text("%#x" % self.flags) |
| 3393 | q.breakable() |
| 3394 | q.text('}') |
| 3395 | |
| 3396 | bsn_stats_request.subtypes[4] = bsn_gentable_desc_stats_request |
| 3397 | |
| 3398 | class bsn_gentable_entry_add(bsn_header): |
| 3399 | version = 4 |
| 3400 | type = 4 |
| 3401 | experimenter = 6035143 |
| 3402 | subtype = 46 |
| 3403 | |
| 3404 | def __init__(self, xid=None, table_id=None, checksum=None, key=None, value=None): |
| 3405 | if xid != None: |
| 3406 | self.xid = xid |
| 3407 | else: |
| 3408 | self.xid = None |
| 3409 | if table_id != None: |
| 3410 | self.table_id = table_id |
| 3411 | else: |
| 3412 | self.table_id = 0 |
| 3413 | if checksum != None: |
| 3414 | self.checksum = checksum |
| 3415 | else: |
| 3416 | self.checksum = 0 |
| 3417 | if key != None: |
| 3418 | self.key = key |
| 3419 | else: |
| 3420 | self.key = [] |
| 3421 | if value != None: |
| 3422 | self.value = value |
| 3423 | else: |
| 3424 | self.value = [] |
| 3425 | return |
| 3426 | |
| 3427 | def pack(self): |
| 3428 | packed = [] |
| 3429 | packed.append(struct.pack("!B", self.version)) |
| 3430 | packed.append(struct.pack("!B", self.type)) |
| 3431 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3432 | packed.append(struct.pack("!L", self.xid)) |
| 3433 | packed.append(struct.pack("!L", self.experimenter)) |
| 3434 | packed.append(struct.pack("!L", self.subtype)) |
| 3435 | packed.append(struct.pack("!H", self.table_id)) |
| 3436 | packed.append(struct.pack("!H", 0)) # placeholder for key_length at index 7 |
| 3437 | packed.append(util.pack_checksum_128(self.checksum)) |
| 3438 | packed.append(loxi.generic_util.pack_list(self.key)) |
| 3439 | packed[7] = struct.pack("!H", len(packed[-1])) |
| 3440 | packed.append(loxi.generic_util.pack_list(self.value)) |
| 3441 | length = sum([len(x) for x in packed]) |
| 3442 | packed[2] = struct.pack("!H", length) |
| 3443 | return ''.join(packed) |
| 3444 | |
| 3445 | @staticmethod |
| 3446 | def unpack(reader): |
| 3447 | obj = bsn_gentable_entry_add() |
| 3448 | _version = reader.read("!B")[0] |
| 3449 | assert(_version == 4) |
| 3450 | _type = reader.read("!B")[0] |
| 3451 | assert(_type == 4) |
| 3452 | _length = reader.read("!H")[0] |
| 3453 | orig_reader = reader |
| 3454 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3455 | obj.xid = reader.read("!L")[0] |
| 3456 | _experimenter = reader.read("!L")[0] |
| 3457 | assert(_experimenter == 6035143) |
| 3458 | _subtype = reader.read("!L")[0] |
| 3459 | assert(_subtype == 46) |
| 3460 | obj.table_id = reader.read("!H")[0] |
| 3461 | _key_length = reader.read("!H")[0] |
| 3462 | obj.checksum = util.unpack_checksum_128(reader) |
| 3463 | obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), bsn_tlv.bsn_tlv.unpack) |
| 3464 | obj.value = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack) |
| 3465 | return obj |
| 3466 | |
| 3467 | def __eq__(self, other): |
| 3468 | if type(self) != type(other): return False |
| 3469 | if self.xid != other.xid: return False |
| 3470 | if self.table_id != other.table_id: return False |
| 3471 | if self.checksum != other.checksum: return False |
| 3472 | if self.key != other.key: return False |
| 3473 | if self.value != other.value: return False |
| 3474 | return True |
| 3475 | |
| 3476 | def pretty_print(self, q): |
| 3477 | q.text("bsn_gentable_entry_add {") |
| 3478 | with q.group(): |
| 3479 | with q.indent(2): |
| 3480 | q.breakable() |
| 3481 | q.text("xid = "); |
| 3482 | if self.xid != None: |
| 3483 | q.text("%#x" % self.xid) |
| 3484 | else: |
| 3485 | q.text('None') |
| 3486 | q.text(","); q.breakable() |
| 3487 | q.text("table_id = "); |
| 3488 | q.text("%#x" % self.table_id) |
| 3489 | q.text(","); q.breakable() |
| 3490 | q.text("checksum = "); |
| 3491 | q.pp(self.checksum) |
| 3492 | q.text(","); q.breakable() |
| 3493 | q.text("key = "); |
| 3494 | q.pp(self.key) |
| 3495 | q.text(","); q.breakable() |
| 3496 | q.text("value = "); |
| 3497 | q.pp(self.value) |
| 3498 | q.breakable() |
| 3499 | q.text('}') |
| 3500 | |
| 3501 | bsn_header.subtypes[46] = bsn_gentable_entry_add |
| 3502 | |
| 3503 | class bsn_gentable_entry_delete(bsn_header): |
| 3504 | version = 4 |
| 3505 | type = 4 |
| 3506 | experimenter = 6035143 |
| 3507 | subtype = 47 |
| 3508 | |
| 3509 | def __init__(self, xid=None, table_id=None, key=None): |
| 3510 | if xid != None: |
| 3511 | self.xid = xid |
| 3512 | else: |
| 3513 | self.xid = None |
| 3514 | if table_id != None: |
| 3515 | self.table_id = table_id |
| 3516 | else: |
| 3517 | self.table_id = 0 |
| 3518 | if key != None: |
| 3519 | self.key = key |
| 3520 | else: |
| 3521 | self.key = [] |
| 3522 | return |
| 3523 | |
| 3524 | def pack(self): |
| 3525 | packed = [] |
| 3526 | packed.append(struct.pack("!B", self.version)) |
| 3527 | packed.append(struct.pack("!B", self.type)) |
| 3528 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3529 | packed.append(struct.pack("!L", self.xid)) |
| 3530 | packed.append(struct.pack("!L", self.experimenter)) |
| 3531 | packed.append(struct.pack("!L", self.subtype)) |
| 3532 | packed.append(struct.pack("!H", self.table_id)) |
| 3533 | packed.append(loxi.generic_util.pack_list(self.key)) |
| 3534 | length = sum([len(x) for x in packed]) |
| 3535 | packed[2] = struct.pack("!H", length) |
| 3536 | return ''.join(packed) |
| 3537 | |
| 3538 | @staticmethod |
| 3539 | def unpack(reader): |
| 3540 | obj = bsn_gentable_entry_delete() |
| 3541 | _version = reader.read("!B")[0] |
| 3542 | assert(_version == 4) |
| 3543 | _type = reader.read("!B")[0] |
| 3544 | assert(_type == 4) |
| 3545 | _length = reader.read("!H")[0] |
| 3546 | orig_reader = reader |
| 3547 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3548 | obj.xid = reader.read("!L")[0] |
| 3549 | _experimenter = reader.read("!L")[0] |
| 3550 | assert(_experimenter == 6035143) |
| 3551 | _subtype = reader.read("!L")[0] |
| 3552 | assert(_subtype == 47) |
| 3553 | obj.table_id = reader.read("!H")[0] |
| 3554 | obj.key = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack) |
| 3555 | return obj |
| 3556 | |
| 3557 | def __eq__(self, other): |
| 3558 | if type(self) != type(other): return False |
| 3559 | if self.xid != other.xid: return False |
| 3560 | if self.table_id != other.table_id: return False |
| 3561 | if self.key != other.key: return False |
| 3562 | return True |
| 3563 | |
| 3564 | def pretty_print(self, q): |
| 3565 | q.text("bsn_gentable_entry_delete {") |
| 3566 | with q.group(): |
| 3567 | with q.indent(2): |
| 3568 | q.breakable() |
| 3569 | q.text("xid = "); |
| 3570 | if self.xid != None: |
| 3571 | q.text("%#x" % self.xid) |
| 3572 | else: |
| 3573 | q.text('None') |
| 3574 | q.text(","); q.breakable() |
| 3575 | q.text("table_id = "); |
| 3576 | q.text("%#x" % self.table_id) |
| 3577 | q.text(","); q.breakable() |
| 3578 | q.text("key = "); |
| 3579 | q.pp(self.key) |
| 3580 | q.breakable() |
| 3581 | q.text('}') |
| 3582 | |
| 3583 | bsn_header.subtypes[47] = bsn_gentable_entry_delete |
| 3584 | |
| 3585 | class bsn_gentable_entry_desc_stats_reply(bsn_stats_reply): |
| 3586 | version = 4 |
| 3587 | type = 19 |
| 3588 | stats_type = 65535 |
| 3589 | experimenter = 6035143 |
| 3590 | subtype = 2 |
| 3591 | |
| 3592 | def __init__(self, xid=None, flags=None, entries=None): |
| 3593 | if xid != None: |
| 3594 | self.xid = xid |
| 3595 | else: |
| 3596 | self.xid = None |
| 3597 | if flags != None: |
| 3598 | self.flags = flags |
| 3599 | else: |
| 3600 | self.flags = 0 |
| 3601 | if entries != None: |
| 3602 | self.entries = entries |
| 3603 | else: |
| 3604 | self.entries = [] |
| 3605 | return |
| 3606 | |
| 3607 | def pack(self): |
| 3608 | packed = [] |
| 3609 | packed.append(struct.pack("!B", self.version)) |
| 3610 | packed.append(struct.pack("!B", self.type)) |
| 3611 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3612 | packed.append(struct.pack("!L", self.xid)) |
| 3613 | packed.append(struct.pack("!H", self.stats_type)) |
| 3614 | packed.append(struct.pack("!H", self.flags)) |
| 3615 | packed.append('\x00' * 4) |
| 3616 | packed.append(struct.pack("!L", self.experimenter)) |
| 3617 | packed.append(struct.pack("!L", self.subtype)) |
| 3618 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 3619 | length = sum([len(x) for x in packed]) |
| 3620 | packed[2] = struct.pack("!H", length) |
| 3621 | return ''.join(packed) |
| 3622 | |
| 3623 | @staticmethod |
| 3624 | def unpack(reader): |
| 3625 | obj = bsn_gentable_entry_desc_stats_reply() |
| 3626 | _version = reader.read("!B")[0] |
| 3627 | assert(_version == 4) |
| 3628 | _type = reader.read("!B")[0] |
| 3629 | assert(_type == 19) |
| 3630 | _length = reader.read("!H")[0] |
| 3631 | orig_reader = reader |
| 3632 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3633 | obj.xid = reader.read("!L")[0] |
| 3634 | _stats_type = reader.read("!H")[0] |
| 3635 | assert(_stats_type == 65535) |
| 3636 | obj.flags = reader.read("!H")[0] |
| 3637 | reader.skip(4) |
| 3638 | _experimenter = reader.read("!L")[0] |
| 3639 | assert(_experimenter == 6035143) |
| 3640 | _subtype = reader.read("!L")[0] |
| 3641 | assert(_subtype == 2) |
| 3642 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_entry_desc_stats_entry.unpack) |
| 3643 | return obj |
| 3644 | |
| 3645 | def __eq__(self, other): |
| 3646 | if type(self) != type(other): return False |
| 3647 | if self.xid != other.xid: return False |
| 3648 | if self.flags != other.flags: return False |
| 3649 | if self.entries != other.entries: return False |
| 3650 | return True |
| 3651 | |
| 3652 | def pretty_print(self, q): |
| 3653 | q.text("bsn_gentable_entry_desc_stats_reply {") |
| 3654 | with q.group(): |
| 3655 | with q.indent(2): |
| 3656 | q.breakable() |
| 3657 | q.text("xid = "); |
| 3658 | if self.xid != None: |
| 3659 | q.text("%#x" % self.xid) |
| 3660 | else: |
| 3661 | q.text('None') |
| 3662 | q.text(","); q.breakable() |
| 3663 | q.text("flags = "); |
| 3664 | q.text("%#x" % self.flags) |
| 3665 | q.text(","); q.breakable() |
| 3666 | q.text("entries = "); |
| 3667 | q.pp(self.entries) |
| 3668 | q.breakable() |
| 3669 | q.text('}') |
| 3670 | |
| 3671 | bsn_stats_reply.subtypes[2] = bsn_gentable_entry_desc_stats_reply |
| 3672 | |
| 3673 | class bsn_gentable_entry_desc_stats_request(bsn_stats_request): |
| 3674 | version = 4 |
| 3675 | type = 18 |
| 3676 | stats_type = 65535 |
| 3677 | experimenter = 6035143 |
| 3678 | subtype = 2 |
| 3679 | |
| 3680 | def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None): |
| 3681 | if xid != None: |
| 3682 | self.xid = xid |
| 3683 | else: |
| 3684 | self.xid = None |
| 3685 | if flags != None: |
| 3686 | self.flags = flags |
| 3687 | else: |
| 3688 | self.flags = 0 |
| 3689 | if table_id != None: |
| 3690 | self.table_id = table_id |
| 3691 | else: |
| 3692 | self.table_id = 0 |
| 3693 | if checksum != None: |
| 3694 | self.checksum = checksum |
| 3695 | else: |
| 3696 | self.checksum = 0 |
| 3697 | if checksum_mask != None: |
| 3698 | self.checksum_mask = checksum_mask |
| 3699 | else: |
| 3700 | self.checksum_mask = 0 |
| 3701 | return |
| 3702 | |
| 3703 | def pack(self): |
| 3704 | packed = [] |
| 3705 | packed.append(struct.pack("!B", self.version)) |
| 3706 | packed.append(struct.pack("!B", self.type)) |
| 3707 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3708 | packed.append(struct.pack("!L", self.xid)) |
| 3709 | packed.append(struct.pack("!H", self.stats_type)) |
| 3710 | packed.append(struct.pack("!H", self.flags)) |
| 3711 | packed.append('\x00' * 4) |
| 3712 | packed.append(struct.pack("!L", self.experimenter)) |
| 3713 | packed.append(struct.pack("!L", self.subtype)) |
| 3714 | packed.append(struct.pack("!H", self.table_id)) |
| 3715 | packed.append('\x00' * 2) |
| 3716 | packed.append(util.pack_checksum_128(self.checksum)) |
| 3717 | packed.append(util.pack_checksum_128(self.checksum_mask)) |
| 3718 | length = sum([len(x) for x in packed]) |
| 3719 | packed[2] = struct.pack("!H", length) |
| 3720 | return ''.join(packed) |
| 3721 | |
| 3722 | @staticmethod |
| 3723 | def unpack(reader): |
| 3724 | obj = bsn_gentable_entry_desc_stats_request() |
| 3725 | _version = reader.read("!B")[0] |
| 3726 | assert(_version == 4) |
| 3727 | _type = reader.read("!B")[0] |
| 3728 | assert(_type == 18) |
| 3729 | _length = reader.read("!H")[0] |
| 3730 | orig_reader = reader |
| 3731 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3732 | obj.xid = reader.read("!L")[0] |
| 3733 | _stats_type = reader.read("!H")[0] |
| 3734 | assert(_stats_type == 65535) |
| 3735 | obj.flags = reader.read("!H")[0] |
| 3736 | reader.skip(4) |
| 3737 | _experimenter = reader.read("!L")[0] |
| 3738 | assert(_experimenter == 6035143) |
| 3739 | _subtype = reader.read("!L")[0] |
| 3740 | assert(_subtype == 2) |
| 3741 | obj.table_id = reader.read("!H")[0] |
| 3742 | reader.skip(2) |
| 3743 | obj.checksum = util.unpack_checksum_128(reader) |
| 3744 | obj.checksum_mask = util.unpack_checksum_128(reader) |
| 3745 | return obj |
| 3746 | |
| 3747 | def __eq__(self, other): |
| 3748 | if type(self) != type(other): return False |
| 3749 | if self.xid != other.xid: return False |
| 3750 | if self.flags != other.flags: return False |
| 3751 | if self.table_id != other.table_id: return False |
| 3752 | if self.checksum != other.checksum: return False |
| 3753 | if self.checksum_mask != other.checksum_mask: return False |
| 3754 | return True |
| 3755 | |
| 3756 | def pretty_print(self, q): |
| 3757 | q.text("bsn_gentable_entry_desc_stats_request {") |
| 3758 | with q.group(): |
| 3759 | with q.indent(2): |
| 3760 | q.breakable() |
| 3761 | q.text("xid = "); |
| 3762 | if self.xid != None: |
| 3763 | q.text("%#x" % self.xid) |
| 3764 | else: |
| 3765 | q.text('None') |
| 3766 | q.text(","); q.breakable() |
| 3767 | q.text("flags = "); |
| 3768 | q.text("%#x" % self.flags) |
| 3769 | q.text(","); q.breakable() |
| 3770 | q.text("table_id = "); |
| 3771 | q.text("%#x" % self.table_id) |
| 3772 | q.text(","); q.breakable() |
| 3773 | q.text("checksum = "); |
| 3774 | q.pp(self.checksum) |
| 3775 | q.text(","); q.breakable() |
| 3776 | q.text("checksum_mask = "); |
| 3777 | q.pp(self.checksum_mask) |
| 3778 | q.breakable() |
| 3779 | q.text('}') |
| 3780 | |
| 3781 | bsn_stats_request.subtypes[2] = bsn_gentable_entry_desc_stats_request |
| 3782 | |
| 3783 | class bsn_gentable_entry_stats_reply(bsn_stats_reply): |
| 3784 | version = 4 |
| 3785 | type = 19 |
| 3786 | stats_type = 65535 |
| 3787 | experimenter = 6035143 |
| 3788 | subtype = 3 |
| 3789 | |
| 3790 | def __init__(self, xid=None, flags=None, entries=None): |
| 3791 | if xid != None: |
| 3792 | self.xid = xid |
| 3793 | else: |
| 3794 | self.xid = None |
| 3795 | if flags != None: |
| 3796 | self.flags = flags |
| 3797 | else: |
| 3798 | self.flags = 0 |
| 3799 | if entries != None: |
| 3800 | self.entries = entries |
| 3801 | else: |
| 3802 | self.entries = [] |
| 3803 | return |
| 3804 | |
| 3805 | def pack(self): |
| 3806 | packed = [] |
| 3807 | packed.append(struct.pack("!B", self.version)) |
| 3808 | packed.append(struct.pack("!B", self.type)) |
| 3809 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3810 | packed.append(struct.pack("!L", self.xid)) |
| 3811 | packed.append(struct.pack("!H", self.stats_type)) |
| 3812 | packed.append(struct.pack("!H", self.flags)) |
| 3813 | packed.append('\x00' * 4) |
| 3814 | packed.append(struct.pack("!L", self.experimenter)) |
| 3815 | packed.append(struct.pack("!L", self.subtype)) |
| 3816 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 3817 | length = sum([len(x) for x in packed]) |
| 3818 | packed[2] = struct.pack("!H", length) |
| 3819 | return ''.join(packed) |
| 3820 | |
| 3821 | @staticmethod |
| 3822 | def unpack(reader): |
| 3823 | obj = bsn_gentable_entry_stats_reply() |
| 3824 | _version = reader.read("!B")[0] |
| 3825 | assert(_version == 4) |
| 3826 | _type = reader.read("!B")[0] |
| 3827 | assert(_type == 19) |
| 3828 | _length = reader.read("!H")[0] |
| 3829 | orig_reader = reader |
| 3830 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3831 | obj.xid = reader.read("!L")[0] |
| 3832 | _stats_type = reader.read("!H")[0] |
| 3833 | assert(_stats_type == 65535) |
| 3834 | obj.flags = reader.read("!H")[0] |
| 3835 | reader.skip(4) |
| 3836 | _experimenter = reader.read("!L")[0] |
| 3837 | assert(_experimenter == 6035143) |
| 3838 | _subtype = reader.read("!L")[0] |
| 3839 | assert(_subtype == 3) |
| 3840 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_entry_stats_entry.unpack) |
| 3841 | return obj |
| 3842 | |
| 3843 | def __eq__(self, other): |
| 3844 | if type(self) != type(other): return False |
| 3845 | if self.xid != other.xid: return False |
| 3846 | if self.flags != other.flags: return False |
| 3847 | if self.entries != other.entries: return False |
| 3848 | return True |
| 3849 | |
| 3850 | def pretty_print(self, q): |
| 3851 | q.text("bsn_gentable_entry_stats_reply {") |
| 3852 | with q.group(): |
| 3853 | with q.indent(2): |
| 3854 | q.breakable() |
| 3855 | q.text("xid = "); |
| 3856 | if self.xid != None: |
| 3857 | q.text("%#x" % self.xid) |
| 3858 | else: |
| 3859 | q.text('None') |
| 3860 | q.text(","); q.breakable() |
| 3861 | q.text("flags = "); |
| 3862 | q.text("%#x" % self.flags) |
| 3863 | q.text(","); q.breakable() |
| 3864 | q.text("entries = "); |
| 3865 | q.pp(self.entries) |
| 3866 | q.breakable() |
| 3867 | q.text('}') |
| 3868 | |
| 3869 | bsn_stats_reply.subtypes[3] = bsn_gentable_entry_stats_reply |
| 3870 | |
| 3871 | class bsn_gentable_entry_stats_request(bsn_stats_request): |
| 3872 | version = 4 |
| 3873 | type = 18 |
| 3874 | stats_type = 65535 |
| 3875 | experimenter = 6035143 |
| 3876 | subtype = 3 |
| 3877 | |
| 3878 | def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None): |
| 3879 | if xid != None: |
| 3880 | self.xid = xid |
| 3881 | else: |
| 3882 | self.xid = None |
| 3883 | if flags != None: |
| 3884 | self.flags = flags |
| 3885 | else: |
| 3886 | self.flags = 0 |
| 3887 | if table_id != None: |
| 3888 | self.table_id = table_id |
| 3889 | else: |
| 3890 | self.table_id = 0 |
| 3891 | if checksum != None: |
| 3892 | self.checksum = checksum |
| 3893 | else: |
| 3894 | self.checksum = 0 |
| 3895 | if checksum_mask != None: |
| 3896 | self.checksum_mask = checksum_mask |
| 3897 | else: |
| 3898 | self.checksum_mask = 0 |
| 3899 | return |
| 3900 | |
| 3901 | def pack(self): |
| 3902 | packed = [] |
| 3903 | packed.append(struct.pack("!B", self.version)) |
| 3904 | packed.append(struct.pack("!B", self.type)) |
| 3905 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3906 | packed.append(struct.pack("!L", self.xid)) |
| 3907 | packed.append(struct.pack("!H", self.stats_type)) |
| 3908 | packed.append(struct.pack("!H", self.flags)) |
| 3909 | packed.append('\x00' * 4) |
| 3910 | packed.append(struct.pack("!L", self.experimenter)) |
| 3911 | packed.append(struct.pack("!L", self.subtype)) |
| 3912 | packed.append(struct.pack("!H", self.table_id)) |
| 3913 | packed.append('\x00' * 2) |
| 3914 | packed.append(util.pack_checksum_128(self.checksum)) |
| 3915 | packed.append(util.pack_checksum_128(self.checksum_mask)) |
| 3916 | length = sum([len(x) for x in packed]) |
| 3917 | packed[2] = struct.pack("!H", length) |
| 3918 | return ''.join(packed) |
| 3919 | |
| 3920 | @staticmethod |
| 3921 | def unpack(reader): |
| 3922 | obj = bsn_gentable_entry_stats_request() |
| 3923 | _version = reader.read("!B")[0] |
| 3924 | assert(_version == 4) |
| 3925 | _type = reader.read("!B")[0] |
| 3926 | assert(_type == 18) |
| 3927 | _length = reader.read("!H")[0] |
| 3928 | orig_reader = reader |
| 3929 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3930 | obj.xid = reader.read("!L")[0] |
| 3931 | _stats_type = reader.read("!H")[0] |
| 3932 | assert(_stats_type == 65535) |
| 3933 | obj.flags = reader.read("!H")[0] |
| 3934 | reader.skip(4) |
| 3935 | _experimenter = reader.read("!L")[0] |
| 3936 | assert(_experimenter == 6035143) |
| 3937 | _subtype = reader.read("!L")[0] |
| 3938 | assert(_subtype == 3) |
| 3939 | obj.table_id = reader.read("!H")[0] |
| 3940 | reader.skip(2) |
| 3941 | obj.checksum = util.unpack_checksum_128(reader) |
| 3942 | obj.checksum_mask = util.unpack_checksum_128(reader) |
| 3943 | return obj |
| 3944 | |
| 3945 | def __eq__(self, other): |
| 3946 | if type(self) != type(other): return False |
| 3947 | if self.xid != other.xid: return False |
| 3948 | if self.flags != other.flags: return False |
| 3949 | if self.table_id != other.table_id: return False |
| 3950 | if self.checksum != other.checksum: return False |
| 3951 | if self.checksum_mask != other.checksum_mask: return False |
| 3952 | return True |
| 3953 | |
| 3954 | def pretty_print(self, q): |
| 3955 | q.text("bsn_gentable_entry_stats_request {") |
| 3956 | with q.group(): |
| 3957 | with q.indent(2): |
| 3958 | q.breakable() |
| 3959 | q.text("xid = "); |
| 3960 | if self.xid != None: |
| 3961 | q.text("%#x" % self.xid) |
| 3962 | else: |
| 3963 | q.text('None') |
| 3964 | q.text(","); q.breakable() |
| 3965 | q.text("flags = "); |
| 3966 | q.text("%#x" % self.flags) |
| 3967 | q.text(","); q.breakable() |
| 3968 | q.text("table_id = "); |
| 3969 | q.text("%#x" % self.table_id) |
| 3970 | q.text(","); q.breakable() |
| 3971 | q.text("checksum = "); |
| 3972 | q.pp(self.checksum) |
| 3973 | q.text(","); q.breakable() |
| 3974 | q.text("checksum_mask = "); |
| 3975 | q.pp(self.checksum_mask) |
| 3976 | q.breakable() |
| 3977 | q.text('}') |
| 3978 | |
| 3979 | bsn_stats_request.subtypes[3] = bsn_gentable_entry_stats_request |
| 3980 | |
| 3981 | class bsn_gentable_set_buckets_size(bsn_header): |
| 3982 | version = 4 |
| 3983 | type = 4 |
| 3984 | experimenter = 6035143 |
| 3985 | subtype = 50 |
| 3986 | |
| 3987 | def __init__(self, xid=None, table_id=None, buckets_size=None): |
| 3988 | if xid != None: |
| 3989 | self.xid = xid |
| 3990 | else: |
| 3991 | self.xid = None |
| 3992 | if table_id != None: |
| 3993 | self.table_id = table_id |
| 3994 | else: |
| 3995 | self.table_id = 0 |
| 3996 | if buckets_size != None: |
| 3997 | self.buckets_size = buckets_size |
| 3998 | else: |
| 3999 | self.buckets_size = 0 |
| 4000 | return |
| 4001 | |
| 4002 | def pack(self): |
| 4003 | packed = [] |
| 4004 | packed.append(struct.pack("!B", self.version)) |
| 4005 | packed.append(struct.pack("!B", self.type)) |
| 4006 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4007 | packed.append(struct.pack("!L", self.xid)) |
| 4008 | packed.append(struct.pack("!L", self.experimenter)) |
| 4009 | packed.append(struct.pack("!L", self.subtype)) |
| 4010 | packed.append(struct.pack("!H", self.table_id)) |
| 4011 | packed.append('\x00' * 2) |
| 4012 | packed.append(struct.pack("!L", self.buckets_size)) |
| 4013 | length = sum([len(x) for x in packed]) |
| 4014 | packed[2] = struct.pack("!H", length) |
| 4015 | return ''.join(packed) |
| 4016 | |
| 4017 | @staticmethod |
| 4018 | def unpack(reader): |
| 4019 | obj = bsn_gentable_set_buckets_size() |
| 4020 | _version = reader.read("!B")[0] |
| 4021 | assert(_version == 4) |
| 4022 | _type = reader.read("!B")[0] |
| 4023 | assert(_type == 4) |
| 4024 | _length = reader.read("!H")[0] |
| 4025 | orig_reader = reader |
| 4026 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4027 | obj.xid = reader.read("!L")[0] |
| 4028 | _experimenter = reader.read("!L")[0] |
| 4029 | assert(_experimenter == 6035143) |
| 4030 | _subtype = reader.read("!L")[0] |
| 4031 | assert(_subtype == 50) |
| 4032 | obj.table_id = reader.read("!H")[0] |
| 4033 | reader.skip(2) |
| 4034 | obj.buckets_size = reader.read("!L")[0] |
| 4035 | return obj |
| 4036 | |
| 4037 | def __eq__(self, other): |
| 4038 | if type(self) != type(other): return False |
| 4039 | if self.xid != other.xid: return False |
| 4040 | if self.table_id != other.table_id: return False |
| 4041 | if self.buckets_size != other.buckets_size: return False |
| 4042 | return True |
| 4043 | |
| 4044 | def pretty_print(self, q): |
| 4045 | q.text("bsn_gentable_set_buckets_size {") |
| 4046 | with q.group(): |
| 4047 | with q.indent(2): |
| 4048 | q.breakable() |
| 4049 | q.text("xid = "); |
| 4050 | if self.xid != None: |
| 4051 | q.text("%#x" % self.xid) |
| 4052 | else: |
| 4053 | q.text('None') |
| 4054 | q.text(","); q.breakable() |
| 4055 | q.text("table_id = "); |
| 4056 | q.text("%#x" % self.table_id) |
| 4057 | q.text(","); q.breakable() |
| 4058 | q.text("buckets_size = "); |
| 4059 | q.text("%#x" % self.buckets_size) |
| 4060 | q.breakable() |
| 4061 | q.text('}') |
| 4062 | |
| 4063 | bsn_header.subtypes[50] = bsn_gentable_set_buckets_size |
| 4064 | |
| 4065 | class bsn_gentable_stats_reply(bsn_stats_reply): |
| 4066 | version = 4 |
| 4067 | type = 19 |
| 4068 | stats_type = 65535 |
| 4069 | experimenter = 6035143 |
| 4070 | subtype = 7 |
| 4071 | |
| 4072 | def __init__(self, xid=None, flags=None, entries=None): |
| 4073 | if xid != None: |
| 4074 | self.xid = xid |
| 4075 | else: |
| 4076 | self.xid = None |
| 4077 | if flags != None: |
| 4078 | self.flags = flags |
| 4079 | else: |
| 4080 | self.flags = 0 |
| 4081 | if entries != None: |
| 4082 | self.entries = entries |
| 4083 | else: |
| 4084 | self.entries = [] |
| 4085 | return |
| 4086 | |
| 4087 | def pack(self): |
| 4088 | packed = [] |
| 4089 | packed.append(struct.pack("!B", self.version)) |
| 4090 | packed.append(struct.pack("!B", self.type)) |
| 4091 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4092 | packed.append(struct.pack("!L", self.xid)) |
| 4093 | packed.append(struct.pack("!H", self.stats_type)) |
| 4094 | packed.append(struct.pack("!H", self.flags)) |
| 4095 | packed.append('\x00' * 4) |
| 4096 | packed.append(struct.pack("!L", self.experimenter)) |
| 4097 | packed.append(struct.pack("!L", self.subtype)) |
| 4098 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 4099 | length = sum([len(x) for x in packed]) |
| 4100 | packed[2] = struct.pack("!H", length) |
| 4101 | return ''.join(packed) |
| 4102 | |
| 4103 | @staticmethod |
| 4104 | def unpack(reader): |
| 4105 | obj = bsn_gentable_stats_reply() |
| 4106 | _version = reader.read("!B")[0] |
| 4107 | assert(_version == 4) |
| 4108 | _type = reader.read("!B")[0] |
| 4109 | assert(_type == 19) |
| 4110 | _length = reader.read("!H")[0] |
| 4111 | orig_reader = reader |
| 4112 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4113 | obj.xid = reader.read("!L")[0] |
| 4114 | _stats_type = reader.read("!H")[0] |
| 4115 | assert(_stats_type == 65535) |
| 4116 | obj.flags = reader.read("!H")[0] |
| 4117 | reader.skip(4) |
| 4118 | _experimenter = reader.read("!L")[0] |
| 4119 | assert(_experimenter == 6035143) |
| 4120 | _subtype = reader.read("!L")[0] |
| 4121 | assert(_subtype == 7) |
| 4122 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_stats_entry.unpack) |
| 4123 | return obj |
| 4124 | |
| 4125 | def __eq__(self, other): |
| 4126 | if type(self) != type(other): return False |
| 4127 | if self.xid != other.xid: return False |
| 4128 | if self.flags != other.flags: return False |
| 4129 | if self.entries != other.entries: return False |
| 4130 | return True |
| 4131 | |
| 4132 | def pretty_print(self, q): |
| 4133 | q.text("bsn_gentable_stats_reply {") |
| 4134 | with q.group(): |
| 4135 | with q.indent(2): |
| 4136 | q.breakable() |
| 4137 | q.text("xid = "); |
| 4138 | if self.xid != None: |
| 4139 | q.text("%#x" % self.xid) |
| 4140 | else: |
| 4141 | q.text('None') |
| 4142 | q.text(","); q.breakable() |
| 4143 | q.text("flags = "); |
| 4144 | q.text("%#x" % self.flags) |
| 4145 | q.text(","); q.breakable() |
| 4146 | q.text("entries = "); |
| 4147 | q.pp(self.entries) |
| 4148 | q.breakable() |
| 4149 | q.text('}') |
| 4150 | |
| 4151 | bsn_stats_reply.subtypes[7] = bsn_gentable_stats_reply |
| 4152 | |
| 4153 | class bsn_gentable_stats_request(bsn_stats_request): |
| 4154 | version = 4 |
| 4155 | type = 18 |
| 4156 | stats_type = 65535 |
| 4157 | experimenter = 6035143 |
| 4158 | subtype = 7 |
| 4159 | |
| 4160 | def __init__(self, xid=None, flags=None): |
| 4161 | if xid != None: |
| 4162 | self.xid = xid |
| 4163 | else: |
| 4164 | self.xid = None |
| 4165 | if flags != None: |
| 4166 | self.flags = flags |
| 4167 | else: |
| 4168 | self.flags = 0 |
| 4169 | return |
| 4170 | |
| 4171 | def pack(self): |
| 4172 | packed = [] |
| 4173 | packed.append(struct.pack("!B", self.version)) |
| 4174 | packed.append(struct.pack("!B", self.type)) |
| 4175 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4176 | packed.append(struct.pack("!L", self.xid)) |
| 4177 | packed.append(struct.pack("!H", self.stats_type)) |
| 4178 | packed.append(struct.pack("!H", self.flags)) |
| 4179 | packed.append('\x00' * 4) |
| 4180 | packed.append(struct.pack("!L", self.experimenter)) |
| 4181 | packed.append(struct.pack("!L", self.subtype)) |
| 4182 | length = sum([len(x) for x in packed]) |
| 4183 | packed[2] = struct.pack("!H", length) |
| 4184 | return ''.join(packed) |
| 4185 | |
| 4186 | @staticmethod |
| 4187 | def unpack(reader): |
| 4188 | obj = bsn_gentable_stats_request() |
| 4189 | _version = reader.read("!B")[0] |
| 4190 | assert(_version == 4) |
| 4191 | _type = reader.read("!B")[0] |
| 4192 | assert(_type == 18) |
| 4193 | _length = reader.read("!H")[0] |
| 4194 | orig_reader = reader |
| 4195 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4196 | obj.xid = reader.read("!L")[0] |
| 4197 | _stats_type = reader.read("!H")[0] |
| 4198 | assert(_stats_type == 65535) |
| 4199 | obj.flags = reader.read("!H")[0] |
| 4200 | reader.skip(4) |
| 4201 | _experimenter = reader.read("!L")[0] |
| 4202 | assert(_experimenter == 6035143) |
| 4203 | _subtype = reader.read("!L")[0] |
| 4204 | assert(_subtype == 7) |
| 4205 | return obj |
| 4206 | |
| 4207 | def __eq__(self, other): |
| 4208 | if type(self) != type(other): return False |
| 4209 | if self.xid != other.xid: return False |
| 4210 | if self.flags != other.flags: return False |
| 4211 | return True |
| 4212 | |
| 4213 | def pretty_print(self, q): |
| 4214 | q.text("bsn_gentable_stats_request {") |
| 4215 | with q.group(): |
| 4216 | with q.indent(2): |
| 4217 | q.breakable() |
| 4218 | q.text("xid = "); |
| 4219 | if self.xid != None: |
| 4220 | q.text("%#x" % self.xid) |
| 4221 | else: |
| 4222 | q.text('None') |
| 4223 | q.text(","); q.breakable() |
| 4224 | q.text("flags = "); |
| 4225 | q.text("%#x" % self.flags) |
| 4226 | q.breakable() |
| 4227 | q.text('}') |
| 4228 | |
| 4229 | bsn_stats_request.subtypes[7] = bsn_gentable_stats_request |
| 4230 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4231 | class bsn_get_interfaces_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4232 | version = 4 |
| 4233 | type = 4 |
| 4234 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4235 | subtype = 10 |
| 4236 | |
| 4237 | def __init__(self, xid=None, interfaces=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4238 | if xid != None: |
| 4239 | self.xid = xid |
| 4240 | else: |
| 4241 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4242 | if interfaces != None: |
| 4243 | self.interfaces = interfaces |
| 4244 | else: |
| 4245 | self.interfaces = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4246 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4247 | |
| 4248 | def pack(self): |
| 4249 | packed = [] |
| 4250 | packed.append(struct.pack("!B", self.version)) |
| 4251 | packed.append(struct.pack("!B", self.type)) |
| 4252 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4253 | packed.append(struct.pack("!L", self.xid)) |
| 4254 | packed.append(struct.pack("!L", self.experimenter)) |
| 4255 | packed.append(struct.pack("!L", self.subtype)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4256 | packed.append(loxi.generic_util.pack_list(self.interfaces)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4257 | length = sum([len(x) for x in packed]) |
| 4258 | packed[2] = struct.pack("!H", length) |
| 4259 | return ''.join(packed) |
| 4260 | |
| 4261 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4262 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4263 | obj = bsn_get_interfaces_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4264 | _version = reader.read("!B")[0] |
| 4265 | assert(_version == 4) |
| 4266 | _type = reader.read("!B")[0] |
| 4267 | assert(_type == 4) |
| 4268 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4269 | orig_reader = reader |
| 4270 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4271 | obj.xid = reader.read("!L")[0] |
| 4272 | _experimenter = reader.read("!L")[0] |
| 4273 | assert(_experimenter == 6035143) |
| 4274 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4275 | assert(_subtype == 10) |
| 4276 | obj.interfaces = loxi.generic_util.unpack_list(reader, common.bsn_interface.unpack) |
| 4277 | return obj |
| 4278 | |
| 4279 | def __eq__(self, other): |
| 4280 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4281 | if self.xid != other.xid: return False |
| 4282 | if self.interfaces != other.interfaces: return False |
| 4283 | return True |
| 4284 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4285 | def pretty_print(self, q): |
| 4286 | q.text("bsn_get_interfaces_reply {") |
| 4287 | with q.group(): |
| 4288 | with q.indent(2): |
| 4289 | q.breakable() |
| 4290 | q.text("xid = "); |
| 4291 | if self.xid != None: |
| 4292 | q.text("%#x" % self.xid) |
| 4293 | else: |
| 4294 | q.text('None') |
| 4295 | q.text(","); q.breakable() |
| 4296 | q.text("interfaces = "); |
| 4297 | q.pp(self.interfaces) |
| 4298 | q.breakable() |
| 4299 | q.text('}') |
| 4300 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4301 | bsn_header.subtypes[10] = bsn_get_interfaces_reply |
| 4302 | |
| 4303 | class bsn_get_interfaces_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4304 | version = 4 |
| 4305 | type = 4 |
| 4306 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4307 | subtype = 9 |
| 4308 | |
| 4309 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4310 | if xid != None: |
| 4311 | self.xid = xid |
| 4312 | else: |
| 4313 | self.xid = None |
| 4314 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4315 | |
| 4316 | def pack(self): |
| 4317 | packed = [] |
| 4318 | packed.append(struct.pack("!B", self.version)) |
| 4319 | packed.append(struct.pack("!B", self.type)) |
| 4320 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4321 | packed.append(struct.pack("!L", self.xid)) |
| 4322 | packed.append(struct.pack("!L", self.experimenter)) |
| 4323 | packed.append(struct.pack("!L", self.subtype)) |
| 4324 | length = sum([len(x) for x in packed]) |
| 4325 | packed[2] = struct.pack("!H", length) |
| 4326 | return ''.join(packed) |
| 4327 | |
| 4328 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4329 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4330 | obj = bsn_get_interfaces_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4331 | _version = reader.read("!B")[0] |
| 4332 | assert(_version == 4) |
| 4333 | _type = reader.read("!B")[0] |
| 4334 | assert(_type == 4) |
| 4335 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4336 | orig_reader = reader |
| 4337 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4338 | obj.xid = reader.read("!L")[0] |
| 4339 | _experimenter = reader.read("!L")[0] |
| 4340 | assert(_experimenter == 6035143) |
| 4341 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4342 | assert(_subtype == 9) |
| 4343 | return obj |
| 4344 | |
| 4345 | def __eq__(self, other): |
| 4346 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4347 | if self.xid != other.xid: return False |
| 4348 | return True |
| 4349 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4350 | def pretty_print(self, q): |
| 4351 | q.text("bsn_get_interfaces_request {") |
| 4352 | with q.group(): |
| 4353 | with q.indent(2): |
| 4354 | q.breakable() |
| 4355 | q.text("xid = "); |
| 4356 | if self.xid != None: |
| 4357 | q.text("%#x" % self.xid) |
| 4358 | else: |
| 4359 | q.text('None') |
| 4360 | q.breakable() |
| 4361 | q.text('}') |
| 4362 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4363 | bsn_header.subtypes[9] = bsn_get_interfaces_request |
| 4364 | |
| 4365 | class bsn_get_mirroring_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4366 | version = 4 |
| 4367 | type = 4 |
| 4368 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4369 | subtype = 5 |
| 4370 | |
| 4371 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4372 | if xid != None: |
| 4373 | self.xid = xid |
| 4374 | else: |
| 4375 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4376 | if report_mirror_ports != None: |
| 4377 | self.report_mirror_ports = report_mirror_ports |
| 4378 | else: |
| 4379 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4380 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4381 | |
| 4382 | def pack(self): |
| 4383 | packed = [] |
| 4384 | packed.append(struct.pack("!B", self.version)) |
| 4385 | packed.append(struct.pack("!B", self.type)) |
| 4386 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4387 | packed.append(struct.pack("!L", self.xid)) |
| 4388 | packed.append(struct.pack("!L", self.experimenter)) |
| 4389 | packed.append(struct.pack("!L", self.subtype)) |
| 4390 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 4391 | packed.append('\x00' * 3) |
| 4392 | length = sum([len(x) for x in packed]) |
| 4393 | packed[2] = struct.pack("!H", length) |
| 4394 | return ''.join(packed) |
| 4395 | |
| 4396 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4397 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4398 | obj = bsn_get_mirroring_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4399 | _version = reader.read("!B")[0] |
| 4400 | assert(_version == 4) |
| 4401 | _type = reader.read("!B")[0] |
| 4402 | assert(_type == 4) |
| 4403 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4404 | orig_reader = reader |
| 4405 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4406 | obj.xid = reader.read("!L")[0] |
| 4407 | _experimenter = reader.read("!L")[0] |
| 4408 | assert(_experimenter == 6035143) |
| 4409 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4410 | assert(_subtype == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4411 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4412 | reader.skip(3) |
| 4413 | return obj |
| 4414 | |
| 4415 | def __eq__(self, other): |
| 4416 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4417 | if self.xid != other.xid: return False |
| 4418 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 4419 | return True |
| 4420 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4421 | def pretty_print(self, q): |
| 4422 | q.text("bsn_get_mirroring_reply {") |
| 4423 | with q.group(): |
| 4424 | with q.indent(2): |
| 4425 | q.breakable() |
| 4426 | q.text("xid = "); |
| 4427 | if self.xid != None: |
| 4428 | q.text("%#x" % self.xid) |
| 4429 | else: |
| 4430 | q.text('None') |
| 4431 | q.text(","); q.breakable() |
| 4432 | q.text("report_mirror_ports = "); |
| 4433 | q.text("%#x" % self.report_mirror_ports) |
| 4434 | q.breakable() |
| 4435 | q.text('}') |
| 4436 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4437 | bsn_header.subtypes[5] = bsn_get_mirroring_reply |
| 4438 | |
| 4439 | class bsn_get_mirroring_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4440 | version = 4 |
| 4441 | type = 4 |
| 4442 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4443 | subtype = 4 |
| 4444 | |
| 4445 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4446 | if xid != None: |
| 4447 | self.xid = xid |
| 4448 | else: |
| 4449 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4450 | if report_mirror_ports != None: |
| 4451 | self.report_mirror_ports = report_mirror_ports |
| 4452 | else: |
| 4453 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4454 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4455 | |
| 4456 | def pack(self): |
| 4457 | packed = [] |
| 4458 | packed.append(struct.pack("!B", self.version)) |
| 4459 | packed.append(struct.pack("!B", self.type)) |
| 4460 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4461 | packed.append(struct.pack("!L", self.xid)) |
| 4462 | packed.append(struct.pack("!L", self.experimenter)) |
| 4463 | packed.append(struct.pack("!L", self.subtype)) |
| 4464 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 4465 | packed.append('\x00' * 3) |
| 4466 | length = sum([len(x) for x in packed]) |
| 4467 | packed[2] = struct.pack("!H", length) |
| 4468 | return ''.join(packed) |
| 4469 | |
| 4470 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4471 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4472 | obj = bsn_get_mirroring_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4473 | _version = reader.read("!B")[0] |
| 4474 | assert(_version == 4) |
| 4475 | _type = reader.read("!B")[0] |
| 4476 | assert(_type == 4) |
| 4477 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4478 | orig_reader = reader |
| 4479 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4480 | obj.xid = reader.read("!L")[0] |
| 4481 | _experimenter = reader.read("!L")[0] |
| 4482 | assert(_experimenter == 6035143) |
| 4483 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4484 | assert(_subtype == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4485 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4486 | reader.skip(3) |
| 4487 | return obj |
| 4488 | |
| 4489 | def __eq__(self, other): |
| 4490 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4491 | if self.xid != other.xid: return False |
| 4492 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 4493 | return True |
| 4494 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4495 | def pretty_print(self, q): |
| 4496 | q.text("bsn_get_mirroring_request {") |
| 4497 | with q.group(): |
| 4498 | with q.indent(2): |
| 4499 | q.breakable() |
| 4500 | q.text("xid = "); |
| 4501 | if self.xid != None: |
| 4502 | q.text("%#x" % self.xid) |
| 4503 | else: |
| 4504 | q.text('None') |
| 4505 | q.text(","); q.breakable() |
| 4506 | q.text("report_mirror_ports = "); |
| 4507 | q.text("%#x" % self.report_mirror_ports) |
| 4508 | q.breakable() |
| 4509 | q.text('}') |
| 4510 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4511 | bsn_header.subtypes[4] = bsn_get_mirroring_request |
| 4512 | |
| 4513 | class bsn_get_switch_pipeline_reply(bsn_header): |
| 4514 | version = 4 |
| 4515 | type = 4 |
| 4516 | experimenter = 6035143 |
| 4517 | subtype = 52 |
| 4518 | |
| 4519 | def __init__(self, xid=None, pipeline=None): |
| 4520 | if xid != None: |
| 4521 | self.xid = xid |
| 4522 | else: |
| 4523 | self.xid = None |
| 4524 | if pipeline != None: |
| 4525 | self.pipeline = pipeline |
| 4526 | else: |
| 4527 | self.pipeline = "" |
| 4528 | return |
| 4529 | |
| 4530 | def pack(self): |
| 4531 | packed = [] |
| 4532 | packed.append(struct.pack("!B", self.version)) |
| 4533 | packed.append(struct.pack("!B", self.type)) |
| 4534 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4535 | packed.append(struct.pack("!L", self.xid)) |
| 4536 | packed.append(struct.pack("!L", self.experimenter)) |
| 4537 | packed.append(struct.pack("!L", self.subtype)) |
| 4538 | packed.append(struct.pack("!256s", self.pipeline)) |
| 4539 | length = sum([len(x) for x in packed]) |
| 4540 | packed[2] = struct.pack("!H", length) |
| 4541 | return ''.join(packed) |
| 4542 | |
| 4543 | @staticmethod |
| 4544 | def unpack(reader): |
| 4545 | obj = bsn_get_switch_pipeline_reply() |
| 4546 | _version = reader.read("!B")[0] |
| 4547 | assert(_version == 4) |
| 4548 | _type = reader.read("!B")[0] |
| 4549 | assert(_type == 4) |
| 4550 | _length = reader.read("!H")[0] |
| 4551 | orig_reader = reader |
| 4552 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4553 | obj.xid = reader.read("!L")[0] |
| 4554 | _experimenter = reader.read("!L")[0] |
| 4555 | assert(_experimenter == 6035143) |
| 4556 | _subtype = reader.read("!L")[0] |
| 4557 | assert(_subtype == 52) |
| 4558 | obj.pipeline = reader.read("!256s")[0].rstrip("\x00") |
| 4559 | return obj |
| 4560 | |
| 4561 | def __eq__(self, other): |
| 4562 | if type(self) != type(other): return False |
| 4563 | if self.xid != other.xid: return False |
| 4564 | if self.pipeline != other.pipeline: return False |
| 4565 | return True |
| 4566 | |
| 4567 | def pretty_print(self, q): |
| 4568 | q.text("bsn_get_switch_pipeline_reply {") |
| 4569 | with q.group(): |
| 4570 | with q.indent(2): |
| 4571 | q.breakable() |
| 4572 | q.text("xid = "); |
| 4573 | if self.xid != None: |
| 4574 | q.text("%#x" % self.xid) |
| 4575 | else: |
| 4576 | q.text('None') |
| 4577 | q.text(","); q.breakable() |
| 4578 | q.text("pipeline = "); |
| 4579 | q.pp(self.pipeline) |
| 4580 | q.breakable() |
| 4581 | q.text('}') |
| 4582 | |
| 4583 | bsn_header.subtypes[52] = bsn_get_switch_pipeline_reply |
| 4584 | |
| 4585 | class bsn_get_switch_pipeline_request(bsn_header): |
| 4586 | version = 4 |
| 4587 | type = 4 |
| 4588 | experimenter = 6035143 |
| 4589 | subtype = 51 |
| 4590 | |
| 4591 | def __init__(self, xid=None): |
| 4592 | if xid != None: |
| 4593 | self.xid = xid |
| 4594 | else: |
| 4595 | self.xid = None |
| 4596 | return |
| 4597 | |
| 4598 | def pack(self): |
| 4599 | packed = [] |
| 4600 | packed.append(struct.pack("!B", self.version)) |
| 4601 | packed.append(struct.pack("!B", self.type)) |
| 4602 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4603 | packed.append(struct.pack("!L", self.xid)) |
| 4604 | packed.append(struct.pack("!L", self.experimenter)) |
| 4605 | packed.append(struct.pack("!L", self.subtype)) |
| 4606 | length = sum([len(x) for x in packed]) |
| 4607 | packed[2] = struct.pack("!H", length) |
| 4608 | return ''.join(packed) |
| 4609 | |
| 4610 | @staticmethod |
| 4611 | def unpack(reader): |
| 4612 | obj = bsn_get_switch_pipeline_request() |
| 4613 | _version = reader.read("!B")[0] |
| 4614 | assert(_version == 4) |
| 4615 | _type = reader.read("!B")[0] |
| 4616 | assert(_type == 4) |
| 4617 | _length = reader.read("!H")[0] |
| 4618 | orig_reader = reader |
| 4619 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4620 | obj.xid = reader.read("!L")[0] |
| 4621 | _experimenter = reader.read("!L")[0] |
| 4622 | assert(_experimenter == 6035143) |
| 4623 | _subtype = reader.read("!L")[0] |
| 4624 | assert(_subtype == 51) |
| 4625 | return obj |
| 4626 | |
| 4627 | def __eq__(self, other): |
| 4628 | if type(self) != type(other): return False |
| 4629 | if self.xid != other.xid: return False |
| 4630 | return True |
| 4631 | |
| 4632 | def pretty_print(self, q): |
| 4633 | q.text("bsn_get_switch_pipeline_request {") |
| 4634 | with q.group(): |
| 4635 | with q.indent(2): |
| 4636 | q.breakable() |
| 4637 | q.text("xid = "); |
| 4638 | if self.xid != None: |
| 4639 | q.text("%#x" % self.xid) |
| 4640 | else: |
| 4641 | q.text('None') |
| 4642 | q.breakable() |
| 4643 | q.text('}') |
| 4644 | |
| 4645 | bsn_header.subtypes[51] = bsn_get_switch_pipeline_request |
| 4646 | |
| 4647 | class bsn_lacp_convergence_notif(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4648 | version = 4 |
| 4649 | type = 4 |
| 4650 | experimenter = 6035143 |
| 4651 | subtype = 43 |
| 4652 | |
| 4653 | 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): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4654 | if xid != None: |
| 4655 | self.xid = xid |
| 4656 | else: |
| 4657 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4658 | if convergence_status != None: |
| 4659 | self.convergence_status = convergence_status |
| 4660 | else: |
| 4661 | self.convergence_status = 0 |
| 4662 | if port_no != None: |
| 4663 | self.port_no = port_no |
| 4664 | else: |
| 4665 | self.port_no = 0 |
| 4666 | if actor_sys_priority != None: |
| 4667 | self.actor_sys_priority = actor_sys_priority |
| 4668 | else: |
| 4669 | self.actor_sys_priority = 0 |
| 4670 | if actor_sys_mac != None: |
| 4671 | self.actor_sys_mac = actor_sys_mac |
| 4672 | else: |
| 4673 | self.actor_sys_mac = [0,0,0,0,0,0] |
| 4674 | if actor_port_priority != None: |
| 4675 | self.actor_port_priority = actor_port_priority |
| 4676 | else: |
| 4677 | self.actor_port_priority = 0 |
| 4678 | if actor_port_num != None: |
| 4679 | self.actor_port_num = actor_port_num |
| 4680 | else: |
| 4681 | self.actor_port_num = 0 |
| 4682 | if actor_key != None: |
| 4683 | self.actor_key = actor_key |
| 4684 | else: |
| 4685 | self.actor_key = 0 |
| 4686 | if partner_sys_priority != None: |
| 4687 | self.partner_sys_priority = partner_sys_priority |
| 4688 | else: |
| 4689 | self.partner_sys_priority = 0 |
| 4690 | if partner_sys_mac != None: |
| 4691 | self.partner_sys_mac = partner_sys_mac |
| 4692 | else: |
| 4693 | self.partner_sys_mac = [0,0,0,0,0,0] |
| 4694 | if partner_port_priority != None: |
| 4695 | self.partner_port_priority = partner_port_priority |
| 4696 | else: |
| 4697 | self.partner_port_priority = 0 |
| 4698 | if partner_port_num != None: |
| 4699 | self.partner_port_num = partner_port_num |
| 4700 | else: |
| 4701 | self.partner_port_num = 0 |
| 4702 | if partner_key != None: |
| 4703 | self.partner_key = partner_key |
| 4704 | else: |
| 4705 | self.partner_key = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4706 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4707 | |
| 4708 | def pack(self): |
| 4709 | packed = [] |
| 4710 | packed.append(struct.pack("!B", self.version)) |
| 4711 | packed.append(struct.pack("!B", self.type)) |
| 4712 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4713 | packed.append(struct.pack("!L", self.xid)) |
| 4714 | packed.append(struct.pack("!L", self.experimenter)) |
| 4715 | packed.append(struct.pack("!L", self.subtype)) |
| 4716 | packed.append(struct.pack("!B", self.convergence_status)) |
| 4717 | packed.append('\x00' * 3) |
| 4718 | packed.append(util.pack_port_no(self.port_no)) |
| 4719 | packed.append(struct.pack("!H", self.actor_sys_priority)) |
| 4720 | packed.append(struct.pack("!6B", *self.actor_sys_mac)) |
| 4721 | packed.append(struct.pack("!H", self.actor_port_priority)) |
| 4722 | packed.append(struct.pack("!H", self.actor_port_num)) |
| 4723 | packed.append(struct.pack("!H", self.actor_key)) |
| 4724 | packed.append(struct.pack("!H", self.partner_sys_priority)) |
| 4725 | packed.append(struct.pack("!6B", *self.partner_sys_mac)) |
| 4726 | packed.append(struct.pack("!H", self.partner_port_priority)) |
| 4727 | packed.append(struct.pack("!H", self.partner_port_num)) |
| 4728 | packed.append(struct.pack("!H", self.partner_key)) |
| 4729 | length = sum([len(x) for x in packed]) |
| 4730 | packed[2] = struct.pack("!H", length) |
| 4731 | return ''.join(packed) |
| 4732 | |
| 4733 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4734 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4735 | obj = bsn_lacp_convergence_notif() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4736 | _version = reader.read("!B")[0] |
| 4737 | assert(_version == 4) |
| 4738 | _type = reader.read("!B")[0] |
| 4739 | assert(_type == 4) |
| 4740 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4741 | orig_reader = reader |
| 4742 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4743 | obj.xid = reader.read("!L")[0] |
| 4744 | _experimenter = reader.read("!L")[0] |
| 4745 | assert(_experimenter == 6035143) |
| 4746 | _subtype = reader.read("!L")[0] |
| 4747 | assert(_subtype == 43) |
| 4748 | obj.convergence_status = reader.read("!B")[0] |
| 4749 | reader.skip(3) |
| 4750 | obj.port_no = util.unpack_port_no(reader) |
| 4751 | obj.actor_sys_priority = reader.read("!H")[0] |
| 4752 | obj.actor_sys_mac = list(reader.read('!6B')) |
| 4753 | obj.actor_port_priority = reader.read("!H")[0] |
| 4754 | obj.actor_port_num = reader.read("!H")[0] |
| 4755 | obj.actor_key = reader.read("!H")[0] |
| 4756 | obj.partner_sys_priority = reader.read("!H")[0] |
| 4757 | obj.partner_sys_mac = list(reader.read('!6B')) |
| 4758 | obj.partner_port_priority = reader.read("!H")[0] |
| 4759 | obj.partner_port_num = reader.read("!H")[0] |
| 4760 | obj.partner_key = reader.read("!H")[0] |
| 4761 | return obj |
| 4762 | |
| 4763 | def __eq__(self, other): |
| 4764 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4765 | if self.xid != other.xid: return False |
| 4766 | if self.convergence_status != other.convergence_status: return False |
| 4767 | if self.port_no != other.port_no: return False |
| 4768 | if self.actor_sys_priority != other.actor_sys_priority: return False |
| 4769 | if self.actor_sys_mac != other.actor_sys_mac: return False |
| 4770 | if self.actor_port_priority != other.actor_port_priority: return False |
| 4771 | if self.actor_port_num != other.actor_port_num: return False |
| 4772 | if self.actor_key != other.actor_key: return False |
| 4773 | if self.partner_sys_priority != other.partner_sys_priority: return False |
| 4774 | if self.partner_sys_mac != other.partner_sys_mac: return False |
| 4775 | if self.partner_port_priority != other.partner_port_priority: return False |
| 4776 | if self.partner_port_num != other.partner_port_num: return False |
| 4777 | if self.partner_key != other.partner_key: return False |
| 4778 | return True |
| 4779 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4780 | def pretty_print(self, q): |
| 4781 | q.text("bsn_lacp_convergence_notif {") |
| 4782 | with q.group(): |
| 4783 | with q.indent(2): |
| 4784 | q.breakable() |
| 4785 | q.text("xid = "); |
| 4786 | if self.xid != None: |
| 4787 | q.text("%#x" % self.xid) |
| 4788 | else: |
| 4789 | q.text('None') |
| 4790 | q.text(","); q.breakable() |
| 4791 | q.text("convergence_status = "); |
| 4792 | q.text("%#x" % self.convergence_status) |
| 4793 | q.text(","); q.breakable() |
| 4794 | q.text("port_no = "); |
| 4795 | q.text(util.pretty_port(self.port_no)) |
| 4796 | q.text(","); q.breakable() |
| 4797 | q.text("actor_sys_priority = "); |
| 4798 | q.text("%#x" % self.actor_sys_priority) |
| 4799 | q.text(","); q.breakable() |
| 4800 | q.text("actor_sys_mac = "); |
| 4801 | q.text(util.pretty_mac(self.actor_sys_mac)) |
| 4802 | q.text(","); q.breakable() |
| 4803 | q.text("actor_port_priority = "); |
| 4804 | q.text("%#x" % self.actor_port_priority) |
| 4805 | q.text(","); q.breakable() |
| 4806 | q.text("actor_port_num = "); |
| 4807 | q.text("%#x" % self.actor_port_num) |
| 4808 | q.text(","); q.breakable() |
| 4809 | q.text("actor_key = "); |
| 4810 | q.text("%#x" % self.actor_key) |
| 4811 | q.text(","); q.breakable() |
| 4812 | q.text("partner_sys_priority = "); |
| 4813 | q.text("%#x" % self.partner_sys_priority) |
| 4814 | q.text(","); q.breakable() |
| 4815 | q.text("partner_sys_mac = "); |
| 4816 | q.text(util.pretty_mac(self.partner_sys_mac)) |
| 4817 | q.text(","); q.breakable() |
| 4818 | q.text("partner_port_priority = "); |
| 4819 | q.text("%#x" % self.partner_port_priority) |
| 4820 | q.text(","); q.breakable() |
| 4821 | q.text("partner_port_num = "); |
| 4822 | q.text("%#x" % self.partner_port_num) |
| 4823 | q.text(","); q.breakable() |
| 4824 | q.text("partner_key = "); |
| 4825 | q.text("%#x" % self.partner_key) |
| 4826 | q.breakable() |
| 4827 | q.text('}') |
| 4828 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4829 | bsn_header.subtypes[43] = bsn_lacp_convergence_notif |
| 4830 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4831 | class bsn_lacp_stats_reply(bsn_stats_reply): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4832 | version = 4 |
| 4833 | type = 19 |
| 4834 | stats_type = 65535 |
| 4835 | experimenter = 6035143 |
| 4836 | subtype = 1 |
| 4837 | |
| 4838 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4839 | if xid != None: |
| 4840 | self.xid = xid |
| 4841 | else: |
| 4842 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4843 | if flags != None: |
| 4844 | self.flags = flags |
| 4845 | else: |
| 4846 | self.flags = 0 |
| 4847 | if entries != None: |
| 4848 | self.entries = entries |
| 4849 | else: |
| 4850 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4851 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4852 | |
| 4853 | def pack(self): |
| 4854 | packed = [] |
| 4855 | packed.append(struct.pack("!B", self.version)) |
| 4856 | packed.append(struct.pack("!B", self.type)) |
| 4857 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4858 | packed.append(struct.pack("!L", self.xid)) |
| 4859 | packed.append(struct.pack("!H", self.stats_type)) |
| 4860 | packed.append(struct.pack("!H", self.flags)) |
| 4861 | packed.append('\x00' * 4) |
| 4862 | packed.append(struct.pack("!L", self.experimenter)) |
| 4863 | packed.append(struct.pack("!L", self.subtype)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4864 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4865 | length = sum([len(x) for x in packed]) |
| 4866 | packed[2] = struct.pack("!H", length) |
| 4867 | return ''.join(packed) |
| 4868 | |
| 4869 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4870 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4871 | obj = bsn_lacp_stats_reply() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4872 | _version = reader.read("!B")[0] |
| 4873 | assert(_version == 4) |
| 4874 | _type = reader.read("!B")[0] |
| 4875 | assert(_type == 19) |
| 4876 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4877 | orig_reader = reader |
| 4878 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4879 | obj.xid = reader.read("!L")[0] |
| 4880 | _stats_type = reader.read("!H")[0] |
| 4881 | assert(_stats_type == 65535) |
| 4882 | obj.flags = reader.read("!H")[0] |
| 4883 | reader.skip(4) |
| 4884 | _experimenter = reader.read("!L")[0] |
| 4885 | assert(_experimenter == 6035143) |
| 4886 | _subtype = reader.read("!L")[0] |
| 4887 | assert(_subtype == 1) |
| 4888 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_lacp_stats_entry.unpack) |
| 4889 | return obj |
| 4890 | |
| 4891 | def __eq__(self, other): |
| 4892 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4893 | if self.xid != other.xid: return False |
| 4894 | if self.flags != other.flags: return False |
| 4895 | if self.entries != other.entries: return False |
| 4896 | return True |
| 4897 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4898 | def pretty_print(self, q): |
| 4899 | q.text("bsn_lacp_stats_reply {") |
| 4900 | with q.group(): |
| 4901 | with q.indent(2): |
| 4902 | q.breakable() |
| 4903 | q.text("xid = "); |
| 4904 | if self.xid != None: |
| 4905 | q.text("%#x" % self.xid) |
| 4906 | else: |
| 4907 | q.text('None') |
| 4908 | q.text(","); q.breakable() |
| 4909 | q.text("flags = "); |
| 4910 | q.text("%#x" % self.flags) |
| 4911 | q.text(","); q.breakable() |
| 4912 | q.text("entries = "); |
| 4913 | q.pp(self.entries) |
| 4914 | q.breakable() |
| 4915 | q.text('}') |
| 4916 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4917 | bsn_stats_reply.subtypes[1] = bsn_lacp_stats_reply |
| 4918 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4919 | class bsn_lacp_stats_request(bsn_stats_request): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4920 | version = 4 |
| 4921 | type = 18 |
| 4922 | stats_type = 65535 |
| 4923 | experimenter = 6035143 |
| 4924 | subtype = 1 |
| 4925 | |
| 4926 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4927 | if xid != None: |
| 4928 | self.xid = xid |
| 4929 | else: |
| 4930 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4931 | if flags != None: |
| 4932 | self.flags = flags |
| 4933 | else: |
| 4934 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4935 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4936 | |
| 4937 | def pack(self): |
| 4938 | packed = [] |
| 4939 | packed.append(struct.pack("!B", self.version)) |
| 4940 | packed.append(struct.pack("!B", self.type)) |
| 4941 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4942 | packed.append(struct.pack("!L", self.xid)) |
| 4943 | packed.append(struct.pack("!H", self.stats_type)) |
| 4944 | packed.append(struct.pack("!H", self.flags)) |
| 4945 | packed.append('\x00' * 4) |
| 4946 | packed.append(struct.pack("!L", self.experimenter)) |
| 4947 | packed.append(struct.pack("!L", self.subtype)) |
| 4948 | length = sum([len(x) for x in packed]) |
| 4949 | packed[2] = struct.pack("!H", length) |
| 4950 | return ''.join(packed) |
| 4951 | |
| 4952 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4953 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4954 | obj = bsn_lacp_stats_request() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4955 | _version = reader.read("!B")[0] |
| 4956 | assert(_version == 4) |
| 4957 | _type = reader.read("!B")[0] |
| 4958 | assert(_type == 18) |
| 4959 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4960 | orig_reader = reader |
| 4961 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4962 | obj.xid = reader.read("!L")[0] |
| 4963 | _stats_type = reader.read("!H")[0] |
| 4964 | assert(_stats_type == 65535) |
| 4965 | obj.flags = reader.read("!H")[0] |
| 4966 | reader.skip(4) |
| 4967 | _experimenter = reader.read("!L")[0] |
| 4968 | assert(_experimenter == 6035143) |
| 4969 | _subtype = reader.read("!L")[0] |
| 4970 | assert(_subtype == 1) |
| 4971 | return obj |
| 4972 | |
| 4973 | def __eq__(self, other): |
| 4974 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4975 | if self.xid != other.xid: return False |
| 4976 | if self.flags != other.flags: return False |
| 4977 | return True |
| 4978 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4979 | def pretty_print(self, q): |
| 4980 | q.text("bsn_lacp_stats_request {") |
| 4981 | with q.group(): |
| 4982 | with q.indent(2): |
| 4983 | q.breakable() |
| 4984 | q.text("xid = "); |
| 4985 | if self.xid != None: |
| 4986 | q.text("%#x" % self.xid) |
| 4987 | else: |
| 4988 | q.text('None') |
| 4989 | q.text(","); q.breakable() |
| 4990 | q.text("flags = "); |
| 4991 | q.text("%#x" % self.flags) |
| 4992 | q.breakable() |
| 4993 | q.text('}') |
| 4994 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4995 | bsn_stats_request.subtypes[1] = bsn_lacp_stats_request |
| 4996 | |
| 4997 | class bsn_pdu_rx_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4998 | version = 4 |
| 4999 | type = 4 |
| 5000 | experimenter = 6035143 |
| 5001 | subtype = 34 |
| 5002 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5003 | def __init__(self, xid=None, status=None, port_no=None, slot_num=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5004 | if xid != None: |
| 5005 | self.xid = xid |
| 5006 | else: |
| 5007 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5008 | if status != None: |
| 5009 | self.status = status |
| 5010 | else: |
| 5011 | self.status = 0 |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5012 | if port_no != None: |
| 5013 | self.port_no = port_no |
| 5014 | else: |
| 5015 | self.port_no = 0 |
| 5016 | if slot_num != None: |
| 5017 | self.slot_num = slot_num |
| 5018 | else: |
| 5019 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5020 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5021 | |
| 5022 | def pack(self): |
| 5023 | packed = [] |
| 5024 | packed.append(struct.pack("!B", self.version)) |
| 5025 | packed.append(struct.pack("!B", self.type)) |
| 5026 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5027 | packed.append(struct.pack("!L", self.xid)) |
| 5028 | packed.append(struct.pack("!L", self.experimenter)) |
| 5029 | packed.append(struct.pack("!L", self.subtype)) |
| 5030 | packed.append(struct.pack("!L", self.status)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5031 | packed.append(util.pack_port_no(self.port_no)) |
| 5032 | packed.append(struct.pack("!B", self.slot_num)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5033 | length = sum([len(x) for x in packed]) |
| 5034 | packed[2] = struct.pack("!H", length) |
| 5035 | return ''.join(packed) |
| 5036 | |
| 5037 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5038 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5039 | obj = bsn_pdu_rx_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5040 | _version = reader.read("!B")[0] |
| 5041 | assert(_version == 4) |
| 5042 | _type = reader.read("!B")[0] |
| 5043 | assert(_type == 4) |
| 5044 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5045 | orig_reader = reader |
| 5046 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -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 == 34) |
| 5052 | obj.status = reader.read("!L")[0] |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5053 | obj.port_no = util.unpack_port_no(reader) |
| 5054 | obj.slot_num = reader.read("!B")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5055 | return obj |
| 5056 | |
| 5057 | def __eq__(self, other): |
| 5058 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5059 | if self.xid != other.xid: return False |
| 5060 | if self.status != other.status: return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5061 | if self.port_no != other.port_no: return False |
| 5062 | if self.slot_num != other.slot_num: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5063 | return True |
| 5064 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5065 | def pretty_print(self, q): |
| 5066 | q.text("bsn_pdu_rx_reply {") |
| 5067 | with q.group(): |
| 5068 | with q.indent(2): |
| 5069 | q.breakable() |
| 5070 | q.text("xid = "); |
| 5071 | if self.xid != None: |
| 5072 | q.text("%#x" % self.xid) |
| 5073 | else: |
| 5074 | q.text('None') |
| 5075 | q.text(","); q.breakable() |
| 5076 | q.text("status = "); |
| 5077 | q.text("%#x" % self.status) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5078 | q.text(","); q.breakable() |
| 5079 | q.text("port_no = "); |
| 5080 | q.text(util.pretty_port(self.port_no)) |
| 5081 | q.text(","); q.breakable() |
| 5082 | q.text("slot_num = "); |
| 5083 | q.text("%#x" % self.slot_num) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5084 | q.breakable() |
| 5085 | q.text('}') |
| 5086 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5087 | bsn_header.subtypes[34] = bsn_pdu_rx_reply |
| 5088 | |
| 5089 | class bsn_pdu_rx_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5090 | version = 4 |
| 5091 | type = 4 |
| 5092 | experimenter = 6035143 |
| 5093 | subtype = 33 |
| 5094 | |
| 5095 | def __init__(self, xid=None, timeout_ms=None, port_no=None, slot_num=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5096 | if xid != None: |
| 5097 | self.xid = xid |
| 5098 | else: |
| 5099 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5100 | if timeout_ms != None: |
| 5101 | self.timeout_ms = timeout_ms |
| 5102 | else: |
| 5103 | self.timeout_ms = 0 |
| 5104 | if port_no != None: |
| 5105 | self.port_no = port_no |
| 5106 | else: |
| 5107 | self.port_no = 0 |
| 5108 | if slot_num != None: |
| 5109 | self.slot_num = slot_num |
| 5110 | else: |
| 5111 | self.slot_num = 0 |
| 5112 | if data != None: |
| 5113 | self.data = data |
| 5114 | else: |
| 5115 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5116 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5117 | |
| 5118 | def pack(self): |
| 5119 | packed = [] |
| 5120 | packed.append(struct.pack("!B", self.version)) |
| 5121 | packed.append(struct.pack("!B", self.type)) |
| 5122 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5123 | packed.append(struct.pack("!L", self.xid)) |
| 5124 | packed.append(struct.pack("!L", self.experimenter)) |
| 5125 | packed.append(struct.pack("!L", self.subtype)) |
| 5126 | packed.append(struct.pack("!L", self.timeout_ms)) |
| 5127 | packed.append(util.pack_port_no(self.port_no)) |
| 5128 | packed.append(struct.pack("!B", self.slot_num)) |
| 5129 | packed.append('\x00' * 3) |
| 5130 | packed.append(self.data) |
| 5131 | length = sum([len(x) for x in packed]) |
| 5132 | packed[2] = struct.pack("!H", length) |
| 5133 | return ''.join(packed) |
| 5134 | |
| 5135 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5136 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5137 | obj = bsn_pdu_rx_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5138 | _version = reader.read("!B")[0] |
| 5139 | assert(_version == 4) |
| 5140 | _type = reader.read("!B")[0] |
| 5141 | assert(_type == 4) |
| 5142 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5143 | orig_reader = reader |
| 5144 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5145 | obj.xid = reader.read("!L")[0] |
| 5146 | _experimenter = reader.read("!L")[0] |
| 5147 | assert(_experimenter == 6035143) |
| 5148 | _subtype = reader.read("!L")[0] |
| 5149 | assert(_subtype == 33) |
| 5150 | obj.timeout_ms = reader.read("!L")[0] |
| 5151 | obj.port_no = util.unpack_port_no(reader) |
| 5152 | obj.slot_num = reader.read("!B")[0] |
| 5153 | reader.skip(3) |
| 5154 | obj.data = str(reader.read_all()) |
| 5155 | return obj |
| 5156 | |
| 5157 | def __eq__(self, other): |
| 5158 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5159 | if self.xid != other.xid: return False |
| 5160 | if self.timeout_ms != other.timeout_ms: return False |
| 5161 | if self.port_no != other.port_no: return False |
| 5162 | if self.slot_num != other.slot_num: return False |
| 5163 | if self.data != other.data: return False |
| 5164 | return True |
| 5165 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5166 | def pretty_print(self, q): |
| 5167 | q.text("bsn_pdu_rx_request {") |
| 5168 | with q.group(): |
| 5169 | with q.indent(2): |
| 5170 | q.breakable() |
| 5171 | q.text("xid = "); |
| 5172 | if self.xid != None: |
| 5173 | q.text("%#x" % self.xid) |
| 5174 | else: |
| 5175 | q.text('None') |
| 5176 | q.text(","); q.breakable() |
| 5177 | q.text("timeout_ms = "); |
| 5178 | q.text("%#x" % self.timeout_ms) |
| 5179 | q.text(","); q.breakable() |
| 5180 | q.text("port_no = "); |
| 5181 | q.text(util.pretty_port(self.port_no)) |
| 5182 | q.text(","); q.breakable() |
| 5183 | q.text("slot_num = "); |
| 5184 | q.text("%#x" % self.slot_num) |
| 5185 | q.text(","); q.breakable() |
| 5186 | q.text("data = "); |
| 5187 | q.pp(self.data) |
| 5188 | q.breakable() |
| 5189 | q.text('}') |
| 5190 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5191 | bsn_header.subtypes[33] = bsn_pdu_rx_request |
| 5192 | |
| 5193 | class bsn_pdu_rx_timeout(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5194 | version = 4 |
| 5195 | type = 4 |
| 5196 | experimenter = 6035143 |
| 5197 | subtype = 35 |
| 5198 | |
| 5199 | def __init__(self, xid=None, port_no=None, slot_num=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5200 | if xid != None: |
| 5201 | self.xid = xid |
| 5202 | else: |
| 5203 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5204 | if port_no != None: |
| 5205 | self.port_no = port_no |
| 5206 | else: |
| 5207 | self.port_no = 0 |
| 5208 | if slot_num != None: |
| 5209 | self.slot_num = slot_num |
| 5210 | else: |
| 5211 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5212 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5213 | |
| 5214 | def pack(self): |
| 5215 | packed = [] |
| 5216 | packed.append(struct.pack("!B", self.version)) |
| 5217 | packed.append(struct.pack("!B", self.type)) |
| 5218 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5219 | packed.append(struct.pack("!L", self.xid)) |
| 5220 | packed.append(struct.pack("!L", self.experimenter)) |
| 5221 | packed.append(struct.pack("!L", self.subtype)) |
| 5222 | packed.append(util.pack_port_no(self.port_no)) |
| 5223 | packed.append(struct.pack("!B", self.slot_num)) |
| 5224 | length = sum([len(x) for x in packed]) |
| 5225 | packed[2] = struct.pack("!H", length) |
| 5226 | return ''.join(packed) |
| 5227 | |
| 5228 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5229 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5230 | obj = bsn_pdu_rx_timeout() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5231 | _version = reader.read("!B")[0] |
| 5232 | assert(_version == 4) |
| 5233 | _type = reader.read("!B")[0] |
| 5234 | assert(_type == 4) |
| 5235 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5236 | orig_reader = reader |
| 5237 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5238 | obj.xid = reader.read("!L")[0] |
| 5239 | _experimenter = reader.read("!L")[0] |
| 5240 | assert(_experimenter == 6035143) |
| 5241 | _subtype = reader.read("!L")[0] |
| 5242 | assert(_subtype == 35) |
| 5243 | obj.port_no = util.unpack_port_no(reader) |
| 5244 | obj.slot_num = reader.read("!B")[0] |
| 5245 | return obj |
| 5246 | |
| 5247 | def __eq__(self, other): |
| 5248 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5249 | if self.xid != other.xid: return False |
| 5250 | if self.port_no != other.port_no: return False |
| 5251 | if self.slot_num != other.slot_num: return False |
| 5252 | return True |
| 5253 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5254 | def pretty_print(self, q): |
| 5255 | q.text("bsn_pdu_rx_timeout {") |
| 5256 | with q.group(): |
| 5257 | with q.indent(2): |
| 5258 | q.breakable() |
| 5259 | q.text("xid = "); |
| 5260 | if self.xid != None: |
| 5261 | q.text("%#x" % self.xid) |
| 5262 | else: |
| 5263 | q.text('None') |
| 5264 | q.text(","); q.breakable() |
| 5265 | q.text("port_no = "); |
| 5266 | q.text(util.pretty_port(self.port_no)) |
| 5267 | q.text(","); q.breakable() |
| 5268 | q.text("slot_num = "); |
| 5269 | q.text("%#x" % self.slot_num) |
| 5270 | q.breakable() |
| 5271 | q.text('}') |
| 5272 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5273 | bsn_header.subtypes[35] = bsn_pdu_rx_timeout |
| 5274 | |
| 5275 | class bsn_pdu_tx_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5276 | version = 4 |
| 5277 | type = 4 |
| 5278 | experimenter = 6035143 |
| 5279 | subtype = 32 |
| 5280 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5281 | def __init__(self, xid=None, status=None, port_no=None, slot_num=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5282 | if xid != None: |
| 5283 | self.xid = xid |
| 5284 | else: |
| 5285 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5286 | if status != None: |
| 5287 | self.status = status |
| 5288 | else: |
| 5289 | self.status = 0 |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5290 | if port_no != None: |
| 5291 | self.port_no = port_no |
| 5292 | else: |
| 5293 | self.port_no = 0 |
| 5294 | if slot_num != None: |
| 5295 | self.slot_num = slot_num |
| 5296 | else: |
| 5297 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5298 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5299 | |
| 5300 | def pack(self): |
| 5301 | packed = [] |
| 5302 | packed.append(struct.pack("!B", self.version)) |
| 5303 | packed.append(struct.pack("!B", self.type)) |
| 5304 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5305 | packed.append(struct.pack("!L", self.xid)) |
| 5306 | packed.append(struct.pack("!L", self.experimenter)) |
| 5307 | packed.append(struct.pack("!L", self.subtype)) |
| 5308 | packed.append(struct.pack("!L", self.status)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5309 | packed.append(util.pack_port_no(self.port_no)) |
| 5310 | packed.append(struct.pack("!B", self.slot_num)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5311 | length = sum([len(x) for x in packed]) |
| 5312 | packed[2] = struct.pack("!H", length) |
| 5313 | return ''.join(packed) |
| 5314 | |
| 5315 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5316 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5317 | obj = bsn_pdu_tx_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5318 | _version = reader.read("!B")[0] |
| 5319 | assert(_version == 4) |
| 5320 | _type = reader.read("!B")[0] |
| 5321 | assert(_type == 4) |
| 5322 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5323 | orig_reader = reader |
| 5324 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5325 | obj.xid = reader.read("!L")[0] |
| 5326 | _experimenter = reader.read("!L")[0] |
| 5327 | assert(_experimenter == 6035143) |
| 5328 | _subtype = reader.read("!L")[0] |
| 5329 | assert(_subtype == 32) |
| 5330 | obj.status = reader.read("!L")[0] |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5331 | obj.port_no = util.unpack_port_no(reader) |
| 5332 | obj.slot_num = reader.read("!B")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5333 | return obj |
| 5334 | |
| 5335 | def __eq__(self, other): |
| 5336 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5337 | if self.xid != other.xid: return False |
| 5338 | if self.status != other.status: return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5339 | if self.port_no != other.port_no: return False |
| 5340 | if self.slot_num != other.slot_num: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5341 | return True |
| 5342 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5343 | def pretty_print(self, q): |
| 5344 | q.text("bsn_pdu_tx_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("status = "); |
| 5355 | q.text("%#x" % self.status) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5356 | q.text(","); q.breakable() |
| 5357 | q.text("port_no = "); |
| 5358 | q.text(util.pretty_port(self.port_no)) |
| 5359 | q.text(","); q.breakable() |
| 5360 | q.text("slot_num = "); |
| 5361 | q.text("%#x" % self.slot_num) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5362 | q.breakable() |
| 5363 | q.text('}') |
| 5364 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5365 | bsn_header.subtypes[32] = bsn_pdu_tx_reply |
| 5366 | |
| 5367 | class bsn_pdu_tx_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5368 | version = 4 |
| 5369 | type = 4 |
| 5370 | experimenter = 6035143 |
| 5371 | subtype = 31 |
| 5372 | |
| 5373 | def __init__(self, xid=None, tx_interval_ms=None, port_no=None, slot_num=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5374 | if xid != None: |
| 5375 | self.xid = xid |
| 5376 | else: |
| 5377 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5378 | if tx_interval_ms != None: |
| 5379 | self.tx_interval_ms = tx_interval_ms |
| 5380 | else: |
| 5381 | self.tx_interval_ms = 0 |
| 5382 | if port_no != None: |
| 5383 | self.port_no = port_no |
| 5384 | else: |
| 5385 | self.port_no = 0 |
| 5386 | if slot_num != None: |
| 5387 | self.slot_num = slot_num |
| 5388 | else: |
| 5389 | self.slot_num = 0 |
| 5390 | if data != None: |
| 5391 | self.data = data |
| 5392 | else: |
| 5393 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5394 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5395 | |
| 5396 | def pack(self): |
| 5397 | packed = [] |
| 5398 | packed.append(struct.pack("!B", self.version)) |
| 5399 | packed.append(struct.pack("!B", self.type)) |
| 5400 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5401 | packed.append(struct.pack("!L", self.xid)) |
| 5402 | packed.append(struct.pack("!L", self.experimenter)) |
| 5403 | packed.append(struct.pack("!L", self.subtype)) |
| 5404 | packed.append(struct.pack("!L", self.tx_interval_ms)) |
| 5405 | packed.append(util.pack_port_no(self.port_no)) |
| 5406 | packed.append(struct.pack("!B", self.slot_num)) |
| 5407 | packed.append('\x00' * 3) |
| 5408 | packed.append(self.data) |
| 5409 | length = sum([len(x) for x in packed]) |
| 5410 | packed[2] = struct.pack("!H", length) |
| 5411 | return ''.join(packed) |
| 5412 | |
| 5413 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5414 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5415 | obj = bsn_pdu_tx_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5416 | _version = reader.read("!B")[0] |
| 5417 | assert(_version == 4) |
| 5418 | _type = reader.read("!B")[0] |
| 5419 | assert(_type == 4) |
| 5420 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5421 | orig_reader = reader |
| 5422 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5423 | obj.xid = reader.read("!L")[0] |
| 5424 | _experimenter = reader.read("!L")[0] |
| 5425 | assert(_experimenter == 6035143) |
| 5426 | _subtype = reader.read("!L")[0] |
| 5427 | assert(_subtype == 31) |
| 5428 | obj.tx_interval_ms = reader.read("!L")[0] |
| 5429 | obj.port_no = util.unpack_port_no(reader) |
| 5430 | obj.slot_num = reader.read("!B")[0] |
| 5431 | reader.skip(3) |
| 5432 | obj.data = str(reader.read_all()) |
| 5433 | return obj |
| 5434 | |
| 5435 | def __eq__(self, other): |
| 5436 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5437 | if self.xid != other.xid: return False |
| 5438 | if self.tx_interval_ms != other.tx_interval_ms: return False |
| 5439 | if self.port_no != other.port_no: return False |
| 5440 | if self.slot_num != other.slot_num: return False |
| 5441 | if self.data != other.data: return False |
| 5442 | return True |
| 5443 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5444 | def pretty_print(self, q): |
| 5445 | q.text("bsn_pdu_tx_request {") |
| 5446 | with q.group(): |
| 5447 | with q.indent(2): |
| 5448 | q.breakable() |
| 5449 | q.text("xid = "); |
| 5450 | if self.xid != None: |
| 5451 | q.text("%#x" % self.xid) |
| 5452 | else: |
| 5453 | q.text('None') |
| 5454 | q.text(","); q.breakable() |
| 5455 | q.text("tx_interval_ms = "); |
| 5456 | q.text("%#x" % self.tx_interval_ms) |
| 5457 | q.text(","); q.breakable() |
| 5458 | q.text("port_no = "); |
| 5459 | q.text(util.pretty_port(self.port_no)) |
| 5460 | q.text(","); q.breakable() |
| 5461 | q.text("slot_num = "); |
| 5462 | q.text("%#x" % self.slot_num) |
| 5463 | q.text(","); q.breakable() |
| 5464 | q.text("data = "); |
| 5465 | q.pp(self.data) |
| 5466 | q.breakable() |
| 5467 | q.text('}') |
| 5468 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5469 | bsn_header.subtypes[31] = bsn_pdu_tx_request |
| 5470 | |
| 5471 | class bsn_port_counter_stats_reply(bsn_stats_reply): |
| 5472 | version = 4 |
| 5473 | type = 19 |
| 5474 | stats_type = 65535 |
| 5475 | experimenter = 6035143 |
| 5476 | subtype = 8 |
| 5477 | |
| 5478 | def __init__(self, xid=None, flags=None, entries=None): |
| 5479 | if xid != None: |
| 5480 | self.xid = xid |
| 5481 | else: |
| 5482 | self.xid = None |
| 5483 | if flags != None: |
| 5484 | self.flags = flags |
| 5485 | else: |
| 5486 | self.flags = 0 |
| 5487 | if entries != None: |
| 5488 | self.entries = entries |
| 5489 | else: |
| 5490 | self.entries = [] |
| 5491 | return |
| 5492 | |
| 5493 | def pack(self): |
| 5494 | packed = [] |
| 5495 | packed.append(struct.pack("!B", self.version)) |
| 5496 | packed.append(struct.pack("!B", self.type)) |
| 5497 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5498 | packed.append(struct.pack("!L", self.xid)) |
| 5499 | packed.append(struct.pack("!H", self.stats_type)) |
| 5500 | packed.append(struct.pack("!H", self.flags)) |
| 5501 | packed.append('\x00' * 4) |
| 5502 | packed.append(struct.pack("!L", self.experimenter)) |
| 5503 | packed.append(struct.pack("!L", self.subtype)) |
| 5504 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 5505 | length = sum([len(x) for x in packed]) |
| 5506 | packed[2] = struct.pack("!H", length) |
| 5507 | return ''.join(packed) |
| 5508 | |
| 5509 | @staticmethod |
| 5510 | def unpack(reader): |
| 5511 | obj = bsn_port_counter_stats_reply() |
| 5512 | _version = reader.read("!B")[0] |
| 5513 | assert(_version == 4) |
| 5514 | _type = reader.read("!B")[0] |
| 5515 | assert(_type == 19) |
| 5516 | _length = reader.read("!H")[0] |
| 5517 | orig_reader = reader |
| 5518 | reader = orig_reader.slice(_length - (2 + 2)) |
| 5519 | obj.xid = reader.read("!L")[0] |
| 5520 | _stats_type = reader.read("!H")[0] |
| 5521 | assert(_stats_type == 65535) |
| 5522 | obj.flags = reader.read("!H")[0] |
| 5523 | reader.skip(4) |
| 5524 | _experimenter = reader.read("!L")[0] |
| 5525 | assert(_experimenter == 6035143) |
| 5526 | _subtype = reader.read("!L")[0] |
| 5527 | assert(_subtype == 8) |
| 5528 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_port_counter_stats_entry.unpack) |
| 5529 | return obj |
| 5530 | |
| 5531 | def __eq__(self, other): |
| 5532 | if type(self) != type(other): return False |
| 5533 | if self.xid != other.xid: return False |
| 5534 | if self.flags != other.flags: return False |
| 5535 | if self.entries != other.entries: return False |
| 5536 | return True |
| 5537 | |
| 5538 | def pretty_print(self, q): |
| 5539 | q.text("bsn_port_counter_stats_reply {") |
| 5540 | with q.group(): |
| 5541 | with q.indent(2): |
| 5542 | q.breakable() |
| 5543 | q.text("xid = "); |
| 5544 | if self.xid != None: |
| 5545 | q.text("%#x" % self.xid) |
| 5546 | else: |
| 5547 | q.text('None') |
| 5548 | q.text(","); q.breakable() |
| 5549 | q.text("flags = "); |
| 5550 | q.text("%#x" % self.flags) |
| 5551 | q.text(","); q.breakable() |
| 5552 | q.text("entries = "); |
| 5553 | q.pp(self.entries) |
| 5554 | q.breakable() |
| 5555 | q.text('}') |
| 5556 | |
| 5557 | bsn_stats_reply.subtypes[8] = bsn_port_counter_stats_reply |
| 5558 | |
| 5559 | class bsn_port_counter_stats_request(bsn_stats_request): |
| 5560 | version = 4 |
| 5561 | type = 18 |
| 5562 | stats_type = 65535 |
| 5563 | experimenter = 6035143 |
| 5564 | subtype = 8 |
| 5565 | |
| 5566 | def __init__(self, xid=None, flags=None, port_no=None): |
| 5567 | if xid != None: |
| 5568 | self.xid = xid |
| 5569 | else: |
| 5570 | self.xid = None |
| 5571 | if flags != None: |
| 5572 | self.flags = flags |
| 5573 | else: |
| 5574 | self.flags = 0 |
| 5575 | if port_no != None: |
| 5576 | self.port_no = port_no |
| 5577 | else: |
| 5578 | self.port_no = 0 |
| 5579 | return |
| 5580 | |
| 5581 | def pack(self): |
| 5582 | packed = [] |
| 5583 | packed.append(struct.pack("!B", self.version)) |
| 5584 | packed.append(struct.pack("!B", self.type)) |
| 5585 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5586 | packed.append(struct.pack("!L", self.xid)) |
| 5587 | packed.append(struct.pack("!H", self.stats_type)) |
| 5588 | packed.append(struct.pack("!H", self.flags)) |
| 5589 | packed.append('\x00' * 4) |
| 5590 | packed.append(struct.pack("!L", self.experimenter)) |
| 5591 | packed.append(struct.pack("!L", self.subtype)) |
| 5592 | packed.append(util.pack_port_no(self.port_no)) |
| 5593 | length = sum([len(x) for x in packed]) |
| 5594 | packed[2] = struct.pack("!H", length) |
| 5595 | return ''.join(packed) |
| 5596 | |
| 5597 | @staticmethod |
| 5598 | def unpack(reader): |
| 5599 | obj = bsn_port_counter_stats_request() |
| 5600 | _version = reader.read("!B")[0] |
| 5601 | assert(_version == 4) |
| 5602 | _type = reader.read("!B")[0] |
| 5603 | assert(_type == 18) |
| 5604 | _length = reader.read("!H")[0] |
| 5605 | orig_reader = reader |
| 5606 | reader = orig_reader.slice(_length - (2 + 2)) |
| 5607 | obj.xid = reader.read("!L")[0] |
| 5608 | _stats_type = reader.read("!H")[0] |
| 5609 | assert(_stats_type == 65535) |
| 5610 | obj.flags = reader.read("!H")[0] |
| 5611 | reader.skip(4) |
| 5612 | _experimenter = reader.read("!L")[0] |
| 5613 | assert(_experimenter == 6035143) |
| 5614 | _subtype = reader.read("!L")[0] |
| 5615 | assert(_subtype == 8) |
| 5616 | obj.port_no = util.unpack_port_no(reader) |
| 5617 | return obj |
| 5618 | |
| 5619 | def __eq__(self, other): |
| 5620 | if type(self) != type(other): return False |
| 5621 | if self.xid != other.xid: return False |
| 5622 | if self.flags != other.flags: return False |
| 5623 | if self.port_no != other.port_no: return False |
| 5624 | return True |
| 5625 | |
| 5626 | def pretty_print(self, q): |
| 5627 | q.text("bsn_port_counter_stats_request {") |
| 5628 | with q.group(): |
| 5629 | with q.indent(2): |
| 5630 | q.breakable() |
| 5631 | q.text("xid = "); |
| 5632 | if self.xid != None: |
| 5633 | q.text("%#x" % self.xid) |
| 5634 | else: |
| 5635 | q.text('None') |
| 5636 | q.text(","); q.breakable() |
| 5637 | q.text("flags = "); |
| 5638 | q.text("%#x" % self.flags) |
| 5639 | q.text(","); q.breakable() |
| 5640 | q.text("port_no = "); |
| 5641 | q.text(util.pretty_port(self.port_no)) |
| 5642 | q.breakable() |
| 5643 | q.text('}') |
| 5644 | |
| 5645 | bsn_stats_request.subtypes[8] = bsn_port_counter_stats_request |
| 5646 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 5647 | class bsn_role_status(bsn_header): |
| 5648 | version = 4 |
| 5649 | type = 4 |
| 5650 | experimenter = 6035143 |
| 5651 | subtype = 55 |
| 5652 | |
| 5653 | def __init__(self, xid=None, role=None, reason=None, generation_id=None): |
| 5654 | if xid != None: |
| 5655 | self.xid = xid |
| 5656 | else: |
| 5657 | self.xid = None |
| 5658 | if role != None: |
| 5659 | self.role = role |
| 5660 | else: |
| 5661 | self.role = 0 |
| 5662 | if reason != None: |
| 5663 | self.reason = reason |
| 5664 | else: |
| 5665 | self.reason = 0 |
| 5666 | if generation_id != None: |
| 5667 | self.generation_id = generation_id |
| 5668 | else: |
| 5669 | self.generation_id = 0 |
| 5670 | return |
| 5671 | |
| 5672 | def pack(self): |
| 5673 | packed = [] |
| 5674 | packed.append(struct.pack("!B", self.version)) |
| 5675 | packed.append(struct.pack("!B", self.type)) |
| 5676 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5677 | packed.append(struct.pack("!L", self.xid)) |
| 5678 | packed.append(struct.pack("!L", self.experimenter)) |
| 5679 | packed.append(struct.pack("!L", self.subtype)) |
| 5680 | packed.append(struct.pack("!L", self.role)) |
| 5681 | packed.append(struct.pack("!B", self.reason)) |
| 5682 | packed.append('\x00' * 3) |
| 5683 | packed.append(struct.pack("!Q", self.generation_id)) |
| 5684 | length = sum([len(x) for x in packed]) |
| 5685 | packed[2] = struct.pack("!H", length) |
| 5686 | return ''.join(packed) |
| 5687 | |
| 5688 | @staticmethod |
| 5689 | def unpack(reader): |
| 5690 | obj = bsn_role_status() |
| 5691 | _version = reader.read("!B")[0] |
| 5692 | assert(_version == 4) |
| 5693 | _type = reader.read("!B")[0] |
| 5694 | assert(_type == 4) |
| 5695 | _length = reader.read("!H")[0] |
| 5696 | orig_reader = reader |
| 5697 | reader = orig_reader.slice(_length - (2 + 2)) |
| 5698 | obj.xid = reader.read("!L")[0] |
| 5699 | _experimenter = reader.read("!L")[0] |
| 5700 | assert(_experimenter == 6035143) |
| 5701 | _subtype = reader.read("!L")[0] |
| 5702 | assert(_subtype == 55) |
| 5703 | obj.role = reader.read("!L")[0] |
| 5704 | obj.reason = reader.read("!B")[0] |
| 5705 | reader.skip(3) |
| 5706 | obj.generation_id = reader.read("!Q")[0] |
| 5707 | return obj |
| 5708 | |
| 5709 | def __eq__(self, other): |
| 5710 | if type(self) != type(other): return False |
| 5711 | if self.xid != other.xid: return False |
| 5712 | if self.role != other.role: return False |
| 5713 | if self.reason != other.reason: return False |
| 5714 | if self.generation_id != other.generation_id: return False |
| 5715 | return True |
| 5716 | |
| 5717 | def pretty_print(self, q): |
| 5718 | q.text("bsn_role_status {") |
| 5719 | with q.group(): |
| 5720 | with q.indent(2): |
| 5721 | q.breakable() |
| 5722 | q.text("xid = "); |
| 5723 | if self.xid != None: |
| 5724 | q.text("%#x" % self.xid) |
| 5725 | else: |
| 5726 | q.text('None') |
| 5727 | q.text(","); q.breakable() |
| 5728 | q.text("role = "); |
| 5729 | q.text("%#x" % self.role) |
| 5730 | q.text(","); q.breakable() |
| 5731 | q.text("reason = "); |
| 5732 | q.text("%#x" % self.reason) |
| 5733 | q.text(","); q.breakable() |
| 5734 | q.text("generation_id = "); |
| 5735 | q.text("%#x" % self.generation_id) |
| 5736 | q.breakable() |
| 5737 | q.text('}') |
| 5738 | |
| 5739 | bsn_header.subtypes[55] = bsn_role_status |
| 5740 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 5741 | class bsn_set_aux_cxns_reply(bsn_header): |
| 5742 | version = 4 |
| 5743 | type = 4 |
| 5744 | experimenter = 6035143 |
| 5745 | subtype = 59 |
| 5746 | |
| 5747 | def __init__(self, xid=None, num_aux=None, status=None): |
| 5748 | if xid != None: |
| 5749 | self.xid = xid |
| 5750 | else: |
| 5751 | self.xid = None |
| 5752 | if num_aux != None: |
| 5753 | self.num_aux = num_aux |
| 5754 | else: |
| 5755 | self.num_aux = 0 |
| 5756 | if status != None: |
| 5757 | self.status = status |
| 5758 | else: |
| 5759 | self.status = 0 |
| 5760 | return |
| 5761 | |
| 5762 | def pack(self): |
| 5763 | packed = [] |
| 5764 | packed.append(struct.pack("!B", self.version)) |
| 5765 | packed.append(struct.pack("!B", self.type)) |
| 5766 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5767 | packed.append(struct.pack("!L", self.xid)) |
| 5768 | packed.append(struct.pack("!L", self.experimenter)) |
| 5769 | packed.append(struct.pack("!L", self.subtype)) |
| 5770 | packed.append(struct.pack("!L", self.num_aux)) |
| 5771 | packed.append(struct.pack("!L", self.status)) |
| 5772 | length = sum([len(x) for x in packed]) |
| 5773 | packed[2] = struct.pack("!H", length) |
| 5774 | return ''.join(packed) |
| 5775 | |
| 5776 | @staticmethod |
| 5777 | def unpack(reader): |
| 5778 | obj = bsn_set_aux_cxns_reply() |
| 5779 | _version = reader.read("!B")[0] |
| 5780 | assert(_version == 4) |
| 5781 | _type = reader.read("!B")[0] |
| 5782 | assert(_type == 4) |
| 5783 | _length = reader.read("!H")[0] |
| 5784 | orig_reader = reader |
| 5785 | reader = orig_reader.slice(_length - (2 + 2)) |
| 5786 | obj.xid = reader.read("!L")[0] |
| 5787 | _experimenter = reader.read("!L")[0] |
| 5788 | assert(_experimenter == 6035143) |
| 5789 | _subtype = reader.read("!L")[0] |
| 5790 | assert(_subtype == 59) |
| 5791 | obj.num_aux = reader.read("!L")[0] |
| 5792 | obj.status = reader.read("!L")[0] |
| 5793 | return obj |
| 5794 | |
| 5795 | def __eq__(self, other): |
| 5796 | if type(self) != type(other): return False |
| 5797 | if self.xid != other.xid: return False |
| 5798 | if self.num_aux != other.num_aux: return False |
| 5799 | if self.status != other.status: return False |
| 5800 | return True |
| 5801 | |
| 5802 | def pretty_print(self, q): |
| 5803 | q.text("bsn_set_aux_cxns_reply {") |
| 5804 | with q.group(): |
| 5805 | with q.indent(2): |
| 5806 | q.breakable() |
| 5807 | q.text("xid = "); |
| 5808 | if self.xid != None: |
| 5809 | q.text("%#x" % self.xid) |
| 5810 | else: |
| 5811 | q.text('None') |
| 5812 | q.text(","); q.breakable() |
| 5813 | q.text("num_aux = "); |
| 5814 | q.text("%#x" % self.num_aux) |
| 5815 | q.text(","); q.breakable() |
| 5816 | q.text("status = "); |
| 5817 | q.text("%#x" % self.status) |
| 5818 | q.breakable() |
| 5819 | q.text('}') |
| 5820 | |
| 5821 | bsn_header.subtypes[59] = bsn_set_aux_cxns_reply |
| 5822 | |
| 5823 | class bsn_set_aux_cxns_request(bsn_header): |
| 5824 | version = 4 |
| 5825 | type = 4 |
| 5826 | experimenter = 6035143 |
| 5827 | subtype = 58 |
| 5828 | |
| 5829 | def __init__(self, xid=None, num_aux=None): |
| 5830 | if xid != None: |
| 5831 | self.xid = xid |
| 5832 | else: |
| 5833 | self.xid = None |
| 5834 | if num_aux != None: |
| 5835 | self.num_aux = num_aux |
| 5836 | else: |
| 5837 | self.num_aux = 0 |
| 5838 | return |
| 5839 | |
| 5840 | def pack(self): |
| 5841 | packed = [] |
| 5842 | packed.append(struct.pack("!B", self.version)) |
| 5843 | packed.append(struct.pack("!B", self.type)) |
| 5844 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5845 | packed.append(struct.pack("!L", self.xid)) |
| 5846 | packed.append(struct.pack("!L", self.experimenter)) |
| 5847 | packed.append(struct.pack("!L", self.subtype)) |
| 5848 | packed.append(struct.pack("!L", self.num_aux)) |
| 5849 | length = sum([len(x) for x in packed]) |
| 5850 | packed[2] = struct.pack("!H", length) |
| 5851 | return ''.join(packed) |
| 5852 | |
| 5853 | @staticmethod |
| 5854 | def unpack(reader): |
| 5855 | obj = bsn_set_aux_cxns_request() |
| 5856 | _version = reader.read("!B")[0] |
| 5857 | assert(_version == 4) |
| 5858 | _type = reader.read("!B")[0] |
| 5859 | assert(_type == 4) |
| 5860 | _length = reader.read("!H")[0] |
| 5861 | orig_reader = reader |
| 5862 | reader = orig_reader.slice(_length - (2 + 2)) |
| 5863 | obj.xid = reader.read("!L")[0] |
| 5864 | _experimenter = reader.read("!L")[0] |
| 5865 | assert(_experimenter == 6035143) |
| 5866 | _subtype = reader.read("!L")[0] |
| 5867 | assert(_subtype == 58) |
| 5868 | obj.num_aux = reader.read("!L")[0] |
| 5869 | return obj |
| 5870 | |
| 5871 | def __eq__(self, other): |
| 5872 | if type(self) != type(other): return False |
| 5873 | if self.xid != other.xid: return False |
| 5874 | if self.num_aux != other.num_aux: return False |
| 5875 | return True |
| 5876 | |
| 5877 | def pretty_print(self, q): |
| 5878 | q.text("bsn_set_aux_cxns_request {") |
| 5879 | with q.group(): |
| 5880 | with q.indent(2): |
| 5881 | q.breakable() |
| 5882 | q.text("xid = "); |
| 5883 | if self.xid != None: |
| 5884 | q.text("%#x" % self.xid) |
| 5885 | else: |
| 5886 | q.text('None') |
| 5887 | q.text(","); q.breakable() |
| 5888 | q.text("num_aux = "); |
| 5889 | q.text("%#x" % self.num_aux) |
| 5890 | q.breakable() |
| 5891 | q.text('}') |
| 5892 | |
| 5893 | bsn_header.subtypes[58] = bsn_set_aux_cxns_request |
| 5894 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5895 | class bsn_set_lacp_reply(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5896 | version = 4 |
| 5897 | type = 4 |
| 5898 | experimenter = 6035143 |
| 5899 | subtype = 42 |
| 5900 | |
| 5901 | def __init__(self, xid=None, status=None, port_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5902 | if xid != None: |
| 5903 | self.xid = xid |
| 5904 | else: |
| 5905 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5906 | if status != None: |
| 5907 | self.status = status |
| 5908 | else: |
| 5909 | self.status = 0 |
| 5910 | if port_no != None: |
| 5911 | self.port_no = port_no |
| 5912 | else: |
| 5913 | self.port_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5914 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5915 | |
| 5916 | def pack(self): |
| 5917 | packed = [] |
| 5918 | packed.append(struct.pack("!B", self.version)) |
| 5919 | packed.append(struct.pack("!B", self.type)) |
| 5920 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5921 | packed.append(struct.pack("!L", self.xid)) |
| 5922 | packed.append(struct.pack("!L", self.experimenter)) |
| 5923 | packed.append(struct.pack("!L", self.subtype)) |
| 5924 | packed.append(struct.pack("!L", self.status)) |
| 5925 | packed.append(util.pack_port_no(self.port_no)) |
| 5926 | length = sum([len(x) for x in packed]) |
| 5927 | packed[2] = struct.pack("!H", length) |
| 5928 | return ''.join(packed) |
| 5929 | |
| 5930 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5931 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5932 | obj = bsn_set_lacp_reply() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5933 | _version = reader.read("!B")[0] |
| 5934 | assert(_version == 4) |
| 5935 | _type = reader.read("!B")[0] |
| 5936 | assert(_type == 4) |
| 5937 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5938 | orig_reader = reader |
| 5939 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5940 | obj.xid = reader.read("!L")[0] |
| 5941 | _experimenter = reader.read("!L")[0] |
| 5942 | assert(_experimenter == 6035143) |
| 5943 | _subtype = reader.read("!L")[0] |
| 5944 | assert(_subtype == 42) |
| 5945 | obj.status = reader.read("!L")[0] |
| 5946 | obj.port_no = util.unpack_port_no(reader) |
| 5947 | return obj |
| 5948 | |
| 5949 | def __eq__(self, other): |
| 5950 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5951 | if self.xid != other.xid: return False |
| 5952 | if self.status != other.status: return False |
| 5953 | if self.port_no != other.port_no: return False |
| 5954 | return True |
| 5955 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5956 | def pretty_print(self, q): |
| 5957 | q.text("bsn_set_lacp_reply {") |
| 5958 | with q.group(): |
| 5959 | with q.indent(2): |
| 5960 | q.breakable() |
| 5961 | q.text("xid = "); |
| 5962 | if self.xid != None: |
| 5963 | q.text("%#x" % self.xid) |
| 5964 | else: |
| 5965 | q.text('None') |
| 5966 | q.text(","); q.breakable() |
| 5967 | q.text("status = "); |
| 5968 | q.text("%#x" % self.status) |
| 5969 | q.text(","); q.breakable() |
| 5970 | q.text("port_no = "); |
| 5971 | q.text(util.pretty_port(self.port_no)) |
| 5972 | q.breakable() |
| 5973 | q.text('}') |
| 5974 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5975 | bsn_header.subtypes[42] = bsn_set_lacp_reply |
| 5976 | |
| 5977 | class bsn_set_lacp_request(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5978 | version = 4 |
| 5979 | type = 4 |
| 5980 | experimenter = 6035143 |
| 5981 | subtype = 41 |
| 5982 | |
| 5983 | 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): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5984 | if xid != None: |
| 5985 | self.xid = xid |
| 5986 | else: |
| 5987 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5988 | if enabled != None: |
| 5989 | self.enabled = enabled |
| 5990 | else: |
| 5991 | self.enabled = 0 |
| 5992 | if port_no != None: |
| 5993 | self.port_no = port_no |
| 5994 | else: |
| 5995 | self.port_no = 0 |
| 5996 | if actor_sys_priority != None: |
| 5997 | self.actor_sys_priority = actor_sys_priority |
| 5998 | else: |
| 5999 | self.actor_sys_priority = 0 |
| 6000 | if actor_sys_mac != None: |
| 6001 | self.actor_sys_mac = actor_sys_mac |
| 6002 | else: |
| 6003 | self.actor_sys_mac = [0,0,0,0,0,0] |
| 6004 | if actor_port_priority != None: |
| 6005 | self.actor_port_priority = actor_port_priority |
| 6006 | else: |
| 6007 | self.actor_port_priority = 0 |
| 6008 | if actor_port_num != None: |
| 6009 | self.actor_port_num = actor_port_num |
| 6010 | else: |
| 6011 | self.actor_port_num = 0 |
| 6012 | if actor_key != None: |
| 6013 | self.actor_key = actor_key |
| 6014 | else: |
| 6015 | self.actor_key = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6016 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6017 | |
| 6018 | def pack(self): |
| 6019 | packed = [] |
| 6020 | packed.append(struct.pack("!B", self.version)) |
| 6021 | packed.append(struct.pack("!B", self.type)) |
| 6022 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6023 | packed.append(struct.pack("!L", self.xid)) |
| 6024 | packed.append(struct.pack("!L", self.experimenter)) |
| 6025 | packed.append(struct.pack("!L", self.subtype)) |
| 6026 | packed.append(struct.pack("!B", self.enabled)) |
| 6027 | packed.append('\x00' * 3) |
| 6028 | packed.append(util.pack_port_no(self.port_no)) |
| 6029 | packed.append(struct.pack("!H", self.actor_sys_priority)) |
| 6030 | packed.append(struct.pack("!6B", *self.actor_sys_mac)) |
| 6031 | packed.append(struct.pack("!H", self.actor_port_priority)) |
| 6032 | packed.append(struct.pack("!H", self.actor_port_num)) |
| 6033 | packed.append(struct.pack("!H", self.actor_key)) |
| 6034 | length = sum([len(x) for x in packed]) |
| 6035 | packed[2] = struct.pack("!H", length) |
| 6036 | return ''.join(packed) |
| 6037 | |
| 6038 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6039 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6040 | obj = bsn_set_lacp_request() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6041 | _version = reader.read("!B")[0] |
| 6042 | assert(_version == 4) |
| 6043 | _type = reader.read("!B")[0] |
| 6044 | assert(_type == 4) |
| 6045 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6046 | orig_reader = reader |
| 6047 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6048 | obj.xid = reader.read("!L")[0] |
| 6049 | _experimenter = reader.read("!L")[0] |
| 6050 | assert(_experimenter == 6035143) |
| 6051 | _subtype = reader.read("!L")[0] |
| 6052 | assert(_subtype == 41) |
| 6053 | obj.enabled = reader.read("!B")[0] |
| 6054 | reader.skip(3) |
| 6055 | obj.port_no = util.unpack_port_no(reader) |
| 6056 | obj.actor_sys_priority = reader.read("!H")[0] |
| 6057 | obj.actor_sys_mac = list(reader.read('!6B')) |
| 6058 | obj.actor_port_priority = reader.read("!H")[0] |
| 6059 | obj.actor_port_num = reader.read("!H")[0] |
| 6060 | obj.actor_key = reader.read("!H")[0] |
| 6061 | return obj |
| 6062 | |
| 6063 | def __eq__(self, other): |
| 6064 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6065 | if self.xid != other.xid: return False |
| 6066 | if self.enabled != other.enabled: return False |
| 6067 | if self.port_no != other.port_no: return False |
| 6068 | if self.actor_sys_priority != other.actor_sys_priority: return False |
| 6069 | if self.actor_sys_mac != other.actor_sys_mac: return False |
| 6070 | if self.actor_port_priority != other.actor_port_priority: return False |
| 6071 | if self.actor_port_num != other.actor_port_num: return False |
| 6072 | if self.actor_key != other.actor_key: return False |
| 6073 | return True |
| 6074 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6075 | def pretty_print(self, q): |
| 6076 | q.text("bsn_set_lacp_request {") |
| 6077 | with q.group(): |
| 6078 | with q.indent(2): |
| 6079 | q.breakable() |
| 6080 | q.text("xid = "); |
| 6081 | if self.xid != None: |
| 6082 | q.text("%#x" % self.xid) |
| 6083 | else: |
| 6084 | q.text('None') |
| 6085 | q.text(","); q.breakable() |
| 6086 | q.text("enabled = "); |
| 6087 | q.text("%#x" % self.enabled) |
| 6088 | q.text(","); q.breakable() |
| 6089 | q.text("port_no = "); |
| 6090 | q.text(util.pretty_port(self.port_no)) |
| 6091 | q.text(","); q.breakable() |
| 6092 | q.text("actor_sys_priority = "); |
| 6093 | q.text("%#x" % self.actor_sys_priority) |
| 6094 | q.text(","); q.breakable() |
| 6095 | q.text("actor_sys_mac = "); |
| 6096 | q.text(util.pretty_mac(self.actor_sys_mac)) |
| 6097 | q.text(","); q.breakable() |
| 6098 | q.text("actor_port_priority = "); |
| 6099 | q.text("%#x" % self.actor_port_priority) |
| 6100 | q.text(","); q.breakable() |
| 6101 | q.text("actor_port_num = "); |
| 6102 | q.text("%#x" % self.actor_port_num) |
| 6103 | q.text(","); q.breakable() |
| 6104 | q.text("actor_key = "); |
| 6105 | q.text("%#x" % self.actor_key) |
| 6106 | q.breakable() |
| 6107 | q.text('}') |
| 6108 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6109 | bsn_header.subtypes[41] = bsn_set_lacp_request |
| 6110 | |
| 6111 | class bsn_set_mirroring(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6112 | version = 4 |
| 6113 | type = 4 |
| 6114 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6115 | subtype = 3 |
| 6116 | |
| 6117 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6118 | if xid != None: |
| 6119 | self.xid = xid |
| 6120 | else: |
| 6121 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6122 | if report_mirror_ports != None: |
| 6123 | self.report_mirror_ports = report_mirror_ports |
| 6124 | else: |
| 6125 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6126 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6127 | |
| 6128 | def pack(self): |
| 6129 | packed = [] |
| 6130 | packed.append(struct.pack("!B", self.version)) |
| 6131 | packed.append(struct.pack("!B", self.type)) |
| 6132 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6133 | packed.append(struct.pack("!L", self.xid)) |
| 6134 | packed.append(struct.pack("!L", self.experimenter)) |
| 6135 | packed.append(struct.pack("!L", self.subtype)) |
| 6136 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 6137 | packed.append('\x00' * 3) |
| 6138 | length = sum([len(x) for x in packed]) |
| 6139 | packed[2] = struct.pack("!H", length) |
| 6140 | return ''.join(packed) |
| 6141 | |
| 6142 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6143 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6144 | obj = bsn_set_mirroring() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6145 | _version = reader.read("!B")[0] |
| 6146 | assert(_version == 4) |
| 6147 | _type = reader.read("!B")[0] |
| 6148 | assert(_type == 4) |
| 6149 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6150 | orig_reader = reader |
| 6151 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6152 | obj.xid = reader.read("!L")[0] |
| 6153 | _experimenter = reader.read("!L")[0] |
| 6154 | assert(_experimenter == 6035143) |
| 6155 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6156 | assert(_subtype == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6157 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6158 | reader.skip(3) |
| 6159 | return obj |
| 6160 | |
| 6161 | def __eq__(self, other): |
| 6162 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6163 | if self.xid != other.xid: return False |
| 6164 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 6165 | return True |
| 6166 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6167 | def pretty_print(self, q): |
| 6168 | q.text("bsn_set_mirroring {") |
| 6169 | with q.group(): |
| 6170 | with q.indent(2): |
| 6171 | q.breakable() |
| 6172 | q.text("xid = "); |
| 6173 | if self.xid != None: |
| 6174 | q.text("%#x" % self.xid) |
| 6175 | else: |
| 6176 | q.text('None') |
| 6177 | q.text(","); q.breakable() |
| 6178 | q.text("report_mirror_ports = "); |
| 6179 | q.text("%#x" % self.report_mirror_ports) |
| 6180 | q.breakable() |
| 6181 | q.text('}') |
| 6182 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6183 | bsn_header.subtypes[3] = bsn_set_mirroring |
| 6184 | |
| 6185 | class bsn_set_pktin_suppression_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6186 | version = 4 |
| 6187 | type = 4 |
| 6188 | experimenter = 6035143 |
| 6189 | subtype = 25 |
| 6190 | |
| 6191 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6192 | if xid != None: |
| 6193 | self.xid = xid |
| 6194 | else: |
| 6195 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6196 | if status != None: |
| 6197 | self.status = status |
| 6198 | else: |
| 6199 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6200 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6201 | |
| 6202 | def pack(self): |
| 6203 | packed = [] |
| 6204 | packed.append(struct.pack("!B", self.version)) |
| 6205 | packed.append(struct.pack("!B", self.type)) |
| 6206 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6207 | packed.append(struct.pack("!L", self.xid)) |
| 6208 | packed.append(struct.pack("!L", self.experimenter)) |
| 6209 | packed.append(struct.pack("!L", self.subtype)) |
| 6210 | packed.append(struct.pack("!L", self.status)) |
| 6211 | length = sum([len(x) for x in packed]) |
| 6212 | packed[2] = struct.pack("!H", length) |
| 6213 | return ''.join(packed) |
| 6214 | |
| 6215 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6216 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6217 | obj = bsn_set_pktin_suppression_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6218 | _version = reader.read("!B")[0] |
| 6219 | assert(_version == 4) |
| 6220 | _type = reader.read("!B")[0] |
| 6221 | assert(_type == 4) |
| 6222 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6223 | orig_reader = reader |
| 6224 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6225 | obj.xid = reader.read("!L")[0] |
| 6226 | _experimenter = reader.read("!L")[0] |
| 6227 | assert(_experimenter == 6035143) |
| 6228 | _subtype = reader.read("!L")[0] |
| 6229 | assert(_subtype == 25) |
| 6230 | obj.status = reader.read("!L")[0] |
| 6231 | return obj |
| 6232 | |
| 6233 | def __eq__(self, other): |
| 6234 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6235 | if self.xid != other.xid: return False |
| 6236 | if self.status != other.status: return False |
| 6237 | return True |
| 6238 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6239 | def pretty_print(self, q): |
| 6240 | q.text("bsn_set_pktin_suppression_reply {") |
| 6241 | with q.group(): |
| 6242 | with q.indent(2): |
| 6243 | q.breakable() |
| 6244 | q.text("xid = "); |
| 6245 | if self.xid != None: |
| 6246 | q.text("%#x" % self.xid) |
| 6247 | else: |
| 6248 | q.text('None') |
| 6249 | q.text(","); q.breakable() |
| 6250 | q.text("status = "); |
| 6251 | q.text("%#x" % self.status) |
| 6252 | q.breakable() |
| 6253 | q.text('}') |
| 6254 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6255 | bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply |
| 6256 | |
| 6257 | class bsn_set_pktin_suppression_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6258 | version = 4 |
| 6259 | type = 4 |
| 6260 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6261 | subtype = 11 |
| 6262 | |
| 6263 | def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6264 | if xid != None: |
| 6265 | self.xid = xid |
| 6266 | else: |
| 6267 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6268 | if enabled != None: |
| 6269 | self.enabled = enabled |
| 6270 | else: |
| 6271 | self.enabled = 0 |
| 6272 | if idle_timeout != None: |
| 6273 | self.idle_timeout = idle_timeout |
| 6274 | else: |
| 6275 | self.idle_timeout = 0 |
| 6276 | if hard_timeout != None: |
| 6277 | self.hard_timeout = hard_timeout |
| 6278 | else: |
| 6279 | self.hard_timeout = 0 |
| 6280 | if priority != None: |
| 6281 | self.priority = priority |
| 6282 | else: |
| 6283 | self.priority = 0 |
| 6284 | if cookie != None: |
| 6285 | self.cookie = cookie |
| 6286 | else: |
| 6287 | self.cookie = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6288 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6289 | |
| 6290 | def pack(self): |
| 6291 | packed = [] |
| 6292 | packed.append(struct.pack("!B", self.version)) |
| 6293 | packed.append(struct.pack("!B", self.type)) |
| 6294 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6295 | packed.append(struct.pack("!L", self.xid)) |
| 6296 | packed.append(struct.pack("!L", self.experimenter)) |
| 6297 | packed.append(struct.pack("!L", self.subtype)) |
| 6298 | packed.append(struct.pack("!B", self.enabled)) |
| 6299 | packed.append('\x00' * 1) |
| 6300 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 6301 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 6302 | packed.append(struct.pack("!H", self.priority)) |
| 6303 | packed.append(struct.pack("!Q", self.cookie)) |
| 6304 | length = sum([len(x) for x in packed]) |
| 6305 | packed[2] = struct.pack("!H", length) |
| 6306 | return ''.join(packed) |
| 6307 | |
| 6308 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6309 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6310 | obj = bsn_set_pktin_suppression_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6311 | _version = reader.read("!B")[0] |
| 6312 | assert(_version == 4) |
| 6313 | _type = reader.read("!B")[0] |
| 6314 | assert(_type == 4) |
| 6315 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6316 | orig_reader = reader |
| 6317 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6318 | obj.xid = reader.read("!L")[0] |
| 6319 | _experimenter = reader.read("!L")[0] |
| 6320 | assert(_experimenter == 6035143) |
| 6321 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6322 | assert(_subtype == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6323 | obj.enabled = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6324 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6325 | obj.idle_timeout = reader.read("!H")[0] |
| 6326 | obj.hard_timeout = reader.read("!H")[0] |
| 6327 | obj.priority = reader.read("!H")[0] |
| 6328 | obj.cookie = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6329 | return obj |
| 6330 | |
| 6331 | def __eq__(self, other): |
| 6332 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6333 | if self.xid != other.xid: return False |
| 6334 | if self.enabled != other.enabled: return False |
| 6335 | if self.idle_timeout != other.idle_timeout: return False |
| 6336 | if self.hard_timeout != other.hard_timeout: return False |
| 6337 | if self.priority != other.priority: return False |
| 6338 | if self.cookie != other.cookie: return False |
| 6339 | return True |
| 6340 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6341 | def pretty_print(self, q): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6342 | q.text("bsn_set_pktin_suppression_request {") |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6343 | with q.group(): |
| 6344 | with q.indent(2): |
| 6345 | q.breakable() |
| 6346 | q.text("xid = "); |
| 6347 | if self.xid != None: |
| 6348 | q.text("%#x" % self.xid) |
| 6349 | else: |
| 6350 | q.text('None') |
| 6351 | q.text(","); q.breakable() |
| 6352 | q.text("enabled = "); |
| 6353 | q.text("%#x" % self.enabled) |
| 6354 | q.text(","); q.breakable() |
| 6355 | q.text("idle_timeout = "); |
| 6356 | q.text("%#x" % self.idle_timeout) |
| 6357 | q.text(","); q.breakable() |
| 6358 | q.text("hard_timeout = "); |
| 6359 | q.text("%#x" % self.hard_timeout) |
| 6360 | q.text(","); q.breakable() |
| 6361 | q.text("priority = "); |
| 6362 | q.text("%#x" % self.priority) |
| 6363 | q.text(","); q.breakable() |
| 6364 | q.text("cookie = "); |
| 6365 | q.text("%#x" % self.cookie) |
| 6366 | q.breakable() |
| 6367 | q.text('}') |
| 6368 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6369 | bsn_header.subtypes[11] = bsn_set_pktin_suppression_request |
| 6370 | |
| 6371 | class bsn_set_switch_pipeline_reply(bsn_header): |
| 6372 | version = 4 |
| 6373 | type = 4 |
| 6374 | experimenter = 6035143 |
| 6375 | subtype = 54 |
| 6376 | |
| 6377 | def __init__(self, xid=None, status=None): |
| 6378 | if xid != None: |
| 6379 | self.xid = xid |
| 6380 | else: |
| 6381 | self.xid = None |
| 6382 | if status != None: |
| 6383 | self.status = status |
| 6384 | else: |
| 6385 | self.status = 0 |
| 6386 | return |
| 6387 | |
| 6388 | def pack(self): |
| 6389 | packed = [] |
| 6390 | packed.append(struct.pack("!B", self.version)) |
| 6391 | packed.append(struct.pack("!B", self.type)) |
| 6392 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6393 | packed.append(struct.pack("!L", self.xid)) |
| 6394 | packed.append(struct.pack("!L", self.experimenter)) |
| 6395 | packed.append(struct.pack("!L", self.subtype)) |
| 6396 | packed.append(struct.pack("!L", self.status)) |
| 6397 | length = sum([len(x) for x in packed]) |
| 6398 | packed[2] = struct.pack("!H", length) |
| 6399 | return ''.join(packed) |
| 6400 | |
| 6401 | @staticmethod |
| 6402 | def unpack(reader): |
| 6403 | obj = bsn_set_switch_pipeline_reply() |
| 6404 | _version = reader.read("!B")[0] |
| 6405 | assert(_version == 4) |
| 6406 | _type = reader.read("!B")[0] |
| 6407 | assert(_type == 4) |
| 6408 | _length = reader.read("!H")[0] |
| 6409 | orig_reader = reader |
| 6410 | reader = orig_reader.slice(_length - (2 + 2)) |
| 6411 | obj.xid = reader.read("!L")[0] |
| 6412 | _experimenter = reader.read("!L")[0] |
| 6413 | assert(_experimenter == 6035143) |
| 6414 | _subtype = reader.read("!L")[0] |
| 6415 | assert(_subtype == 54) |
| 6416 | obj.status = reader.read("!L")[0] |
| 6417 | return obj |
| 6418 | |
| 6419 | def __eq__(self, other): |
| 6420 | if type(self) != type(other): return False |
| 6421 | if self.xid != other.xid: return False |
| 6422 | if self.status != other.status: return False |
| 6423 | return True |
| 6424 | |
| 6425 | def pretty_print(self, q): |
| 6426 | q.text("bsn_set_switch_pipeline_reply {") |
| 6427 | with q.group(): |
| 6428 | with q.indent(2): |
| 6429 | q.breakable() |
| 6430 | q.text("xid = "); |
| 6431 | if self.xid != None: |
| 6432 | q.text("%#x" % self.xid) |
| 6433 | else: |
| 6434 | q.text('None') |
| 6435 | q.text(","); q.breakable() |
| 6436 | q.text("status = "); |
| 6437 | q.text("%#x" % self.status) |
| 6438 | q.breakable() |
| 6439 | q.text('}') |
| 6440 | |
| 6441 | bsn_header.subtypes[54] = bsn_set_switch_pipeline_reply |
| 6442 | |
| 6443 | class bsn_set_switch_pipeline_request(bsn_header): |
| 6444 | version = 4 |
| 6445 | type = 4 |
| 6446 | experimenter = 6035143 |
| 6447 | subtype = 53 |
| 6448 | |
| 6449 | def __init__(self, xid=None, pipeline=None): |
| 6450 | if xid != None: |
| 6451 | self.xid = xid |
| 6452 | else: |
| 6453 | self.xid = None |
| 6454 | if pipeline != None: |
| 6455 | self.pipeline = pipeline |
| 6456 | else: |
| 6457 | self.pipeline = "" |
| 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("!256s", self.pipeline)) |
| 6469 | length = sum([len(x) for x in packed]) |
| 6470 | packed[2] = struct.pack("!H", length) |
| 6471 | return ''.join(packed) |
| 6472 | |
| 6473 | @staticmethod |
| 6474 | def unpack(reader): |
| 6475 | obj = bsn_set_switch_pipeline_request() |
| 6476 | _version = reader.read("!B")[0] |
| 6477 | assert(_version == 4) |
| 6478 | _type = reader.read("!B")[0] |
| 6479 | assert(_type == 4) |
| 6480 | _length = reader.read("!H")[0] |
| 6481 | orig_reader = reader |
| 6482 | reader = orig_reader.slice(_length - (2 + 2)) |
| 6483 | obj.xid = reader.read("!L")[0] |
| 6484 | _experimenter = reader.read("!L")[0] |
| 6485 | assert(_experimenter == 6035143) |
| 6486 | _subtype = reader.read("!L")[0] |
| 6487 | assert(_subtype == 53) |
| 6488 | obj.pipeline = reader.read("!256s")[0].rstrip("\x00") |
| 6489 | return obj |
| 6490 | |
| 6491 | def __eq__(self, other): |
| 6492 | if type(self) != type(other): return False |
| 6493 | if self.xid != other.xid: return False |
| 6494 | if self.pipeline != other.pipeline: return False |
| 6495 | return True |
| 6496 | |
| 6497 | def pretty_print(self, q): |
| 6498 | q.text("bsn_set_switch_pipeline_request {") |
| 6499 | with q.group(): |
| 6500 | with q.indent(2): |
| 6501 | q.breakable() |
| 6502 | q.text("xid = "); |
| 6503 | if self.xid != None: |
| 6504 | q.text("%#x" % self.xid) |
| 6505 | else: |
| 6506 | q.text('None') |
| 6507 | q.text(","); q.breakable() |
| 6508 | q.text("pipeline = "); |
| 6509 | q.pp(self.pipeline) |
| 6510 | q.breakable() |
| 6511 | q.text('}') |
| 6512 | |
| 6513 | bsn_header.subtypes[53] = bsn_set_switch_pipeline_request |
| 6514 | |
| 6515 | class bsn_switch_pipeline_stats_reply(bsn_stats_reply): |
| 6516 | version = 4 |
| 6517 | type = 19 |
| 6518 | stats_type = 65535 |
| 6519 | experimenter = 6035143 |
| 6520 | subtype = 6 |
| 6521 | |
| 6522 | def __init__(self, xid=None, flags=None, entries=None): |
| 6523 | if xid != None: |
| 6524 | self.xid = xid |
| 6525 | else: |
| 6526 | self.xid = None |
| 6527 | if flags != None: |
| 6528 | self.flags = flags |
| 6529 | else: |
| 6530 | self.flags = 0 |
| 6531 | if entries != None: |
| 6532 | self.entries = entries |
| 6533 | else: |
| 6534 | self.entries = [] |
| 6535 | return |
| 6536 | |
| 6537 | def pack(self): |
| 6538 | packed = [] |
| 6539 | packed.append(struct.pack("!B", self.version)) |
| 6540 | packed.append(struct.pack("!B", self.type)) |
| 6541 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6542 | packed.append(struct.pack("!L", self.xid)) |
| 6543 | packed.append(struct.pack("!H", self.stats_type)) |
| 6544 | packed.append(struct.pack("!H", self.flags)) |
| 6545 | packed.append('\x00' * 4) |
| 6546 | packed.append(struct.pack("!L", self.experimenter)) |
| 6547 | packed.append(struct.pack("!L", self.subtype)) |
| 6548 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 6549 | length = sum([len(x) for x in packed]) |
| 6550 | packed[2] = struct.pack("!H", length) |
| 6551 | return ''.join(packed) |
| 6552 | |
| 6553 | @staticmethod |
| 6554 | def unpack(reader): |
| 6555 | obj = bsn_switch_pipeline_stats_reply() |
| 6556 | _version = reader.read("!B")[0] |
| 6557 | assert(_version == 4) |
| 6558 | _type = reader.read("!B")[0] |
| 6559 | assert(_type == 19) |
| 6560 | _length = reader.read("!H")[0] |
| 6561 | orig_reader = reader |
| 6562 | reader = orig_reader.slice(_length - (2 + 2)) |
| 6563 | obj.xid = reader.read("!L")[0] |
| 6564 | _stats_type = reader.read("!H")[0] |
| 6565 | assert(_stats_type == 65535) |
| 6566 | obj.flags = reader.read("!H")[0] |
| 6567 | reader.skip(4) |
| 6568 | _experimenter = reader.read("!L")[0] |
| 6569 | assert(_experimenter == 6035143) |
| 6570 | _subtype = reader.read("!L")[0] |
| 6571 | assert(_subtype == 6) |
| 6572 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_switch_pipeline_stats_entry.unpack) |
| 6573 | return obj |
| 6574 | |
| 6575 | def __eq__(self, other): |
| 6576 | if type(self) != type(other): return False |
| 6577 | if self.xid != other.xid: return False |
| 6578 | if self.flags != other.flags: return False |
| 6579 | if self.entries != other.entries: return False |
| 6580 | return True |
| 6581 | |
| 6582 | def pretty_print(self, q): |
| 6583 | q.text("bsn_switch_pipeline_stats_reply {") |
| 6584 | with q.group(): |
| 6585 | with q.indent(2): |
| 6586 | q.breakable() |
| 6587 | q.text("xid = "); |
| 6588 | if self.xid != None: |
| 6589 | q.text("%#x" % self.xid) |
| 6590 | else: |
| 6591 | q.text('None') |
| 6592 | q.text(","); q.breakable() |
| 6593 | q.text("flags = "); |
| 6594 | q.text("%#x" % self.flags) |
| 6595 | q.text(","); q.breakable() |
| 6596 | q.text("entries = "); |
| 6597 | q.pp(self.entries) |
| 6598 | q.breakable() |
| 6599 | q.text('}') |
| 6600 | |
| 6601 | bsn_stats_reply.subtypes[6] = bsn_switch_pipeline_stats_reply |
| 6602 | |
| 6603 | class bsn_switch_pipeline_stats_request(bsn_stats_request): |
| 6604 | version = 4 |
| 6605 | type = 18 |
| 6606 | stats_type = 65535 |
| 6607 | experimenter = 6035143 |
| 6608 | subtype = 6 |
| 6609 | |
| 6610 | def __init__(self, xid=None, flags=None): |
| 6611 | if xid != None: |
| 6612 | self.xid = xid |
| 6613 | else: |
| 6614 | self.xid = None |
| 6615 | if flags != None: |
| 6616 | self.flags = flags |
| 6617 | else: |
| 6618 | self.flags = 0 |
| 6619 | return |
| 6620 | |
| 6621 | def pack(self): |
| 6622 | packed = [] |
| 6623 | packed.append(struct.pack("!B", self.version)) |
| 6624 | packed.append(struct.pack("!B", self.type)) |
| 6625 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6626 | packed.append(struct.pack("!L", self.xid)) |
| 6627 | packed.append(struct.pack("!H", self.stats_type)) |
| 6628 | packed.append(struct.pack("!H", self.flags)) |
| 6629 | packed.append('\x00' * 4) |
| 6630 | packed.append(struct.pack("!L", self.experimenter)) |
| 6631 | packed.append(struct.pack("!L", self.subtype)) |
| 6632 | length = sum([len(x) for x in packed]) |
| 6633 | packed[2] = struct.pack("!H", length) |
| 6634 | return ''.join(packed) |
| 6635 | |
| 6636 | @staticmethod |
| 6637 | def unpack(reader): |
| 6638 | obj = bsn_switch_pipeline_stats_request() |
| 6639 | _version = reader.read("!B")[0] |
| 6640 | assert(_version == 4) |
| 6641 | _type = reader.read("!B")[0] |
| 6642 | assert(_type == 18) |
| 6643 | _length = reader.read("!H")[0] |
| 6644 | orig_reader = reader |
| 6645 | reader = orig_reader.slice(_length - (2 + 2)) |
| 6646 | obj.xid = reader.read("!L")[0] |
| 6647 | _stats_type = reader.read("!H")[0] |
| 6648 | assert(_stats_type == 65535) |
| 6649 | obj.flags = reader.read("!H")[0] |
| 6650 | reader.skip(4) |
| 6651 | _experimenter = reader.read("!L")[0] |
| 6652 | assert(_experimenter == 6035143) |
| 6653 | _subtype = reader.read("!L")[0] |
| 6654 | assert(_subtype == 6) |
| 6655 | return obj |
| 6656 | |
| 6657 | def __eq__(self, other): |
| 6658 | if type(self) != type(other): return False |
| 6659 | if self.xid != other.xid: return False |
| 6660 | if self.flags != other.flags: return False |
| 6661 | return True |
| 6662 | |
| 6663 | def pretty_print(self, q): |
| 6664 | q.text("bsn_switch_pipeline_stats_request {") |
| 6665 | with q.group(): |
| 6666 | with q.indent(2): |
| 6667 | q.breakable() |
| 6668 | q.text("xid = "); |
| 6669 | if self.xid != None: |
| 6670 | q.text("%#x" % self.xid) |
| 6671 | else: |
| 6672 | q.text('None') |
| 6673 | q.text(","); q.breakable() |
| 6674 | q.text("flags = "); |
| 6675 | q.text("%#x" % self.flags) |
| 6676 | q.breakable() |
| 6677 | q.text('}') |
| 6678 | |
| 6679 | bsn_stats_request.subtypes[6] = bsn_switch_pipeline_stats_request |
| 6680 | |
| 6681 | class bsn_time_reply(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6682 | version = 4 |
| 6683 | type = 4 |
| 6684 | experimenter = 6035143 |
| 6685 | subtype = 45 |
| 6686 | |
| 6687 | def __init__(self, xid=None, time_ms=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6688 | if xid != None: |
| 6689 | self.xid = xid |
| 6690 | else: |
| 6691 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6692 | if time_ms != None: |
| 6693 | self.time_ms = time_ms |
| 6694 | else: |
| 6695 | self.time_ms = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6696 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6697 | |
| 6698 | def pack(self): |
| 6699 | packed = [] |
| 6700 | packed.append(struct.pack("!B", self.version)) |
| 6701 | packed.append(struct.pack("!B", self.type)) |
| 6702 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6703 | packed.append(struct.pack("!L", self.xid)) |
| 6704 | packed.append(struct.pack("!L", self.experimenter)) |
| 6705 | packed.append(struct.pack("!L", self.subtype)) |
| 6706 | packed.append(struct.pack("!Q", self.time_ms)) |
| 6707 | length = sum([len(x) for x in packed]) |
| 6708 | packed[2] = struct.pack("!H", length) |
| 6709 | return ''.join(packed) |
| 6710 | |
| 6711 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6712 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6713 | obj = bsn_time_reply() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6714 | _version = reader.read("!B")[0] |
| 6715 | assert(_version == 4) |
| 6716 | _type = reader.read("!B")[0] |
| 6717 | assert(_type == 4) |
| 6718 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6719 | orig_reader = reader |
| 6720 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6721 | obj.xid = reader.read("!L")[0] |
| 6722 | _experimenter = reader.read("!L")[0] |
| 6723 | assert(_experimenter == 6035143) |
| 6724 | _subtype = reader.read("!L")[0] |
| 6725 | assert(_subtype == 45) |
| 6726 | obj.time_ms = reader.read("!Q")[0] |
| 6727 | return obj |
| 6728 | |
| 6729 | def __eq__(self, other): |
| 6730 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6731 | if self.xid != other.xid: return False |
| 6732 | if self.time_ms != other.time_ms: return False |
| 6733 | return True |
| 6734 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6735 | def pretty_print(self, q): |
| 6736 | q.text("bsn_time_reply {") |
| 6737 | with q.group(): |
| 6738 | with q.indent(2): |
| 6739 | q.breakable() |
| 6740 | q.text("xid = "); |
| 6741 | if self.xid != None: |
| 6742 | q.text("%#x" % self.xid) |
| 6743 | else: |
| 6744 | q.text('None') |
| 6745 | q.text(","); q.breakable() |
| 6746 | q.text("time_ms = "); |
| 6747 | q.text("%#x" % self.time_ms) |
| 6748 | q.breakable() |
| 6749 | q.text('}') |
| 6750 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6751 | bsn_header.subtypes[45] = bsn_time_reply |
| 6752 | |
| 6753 | class bsn_time_request(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6754 | version = 4 |
| 6755 | type = 4 |
| 6756 | experimenter = 6035143 |
| 6757 | subtype = 44 |
| 6758 | |
| 6759 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6760 | if xid != None: |
| 6761 | self.xid = xid |
| 6762 | else: |
| 6763 | self.xid = None |
| 6764 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6765 | |
| 6766 | def pack(self): |
| 6767 | packed = [] |
| 6768 | packed.append(struct.pack("!B", self.version)) |
| 6769 | packed.append(struct.pack("!B", self.type)) |
| 6770 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6771 | packed.append(struct.pack("!L", self.xid)) |
| 6772 | packed.append(struct.pack("!L", self.experimenter)) |
| 6773 | packed.append(struct.pack("!L", self.subtype)) |
| 6774 | length = sum([len(x) for x in packed]) |
| 6775 | packed[2] = struct.pack("!H", length) |
| 6776 | return ''.join(packed) |
| 6777 | |
| 6778 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6779 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6780 | obj = bsn_time_request() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6781 | _version = reader.read("!B")[0] |
| 6782 | assert(_version == 4) |
| 6783 | _type = reader.read("!B")[0] |
| 6784 | assert(_type == 4) |
| 6785 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6786 | orig_reader = reader |
| 6787 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6788 | obj.xid = reader.read("!L")[0] |
| 6789 | _experimenter = reader.read("!L")[0] |
| 6790 | assert(_experimenter == 6035143) |
| 6791 | _subtype = reader.read("!L")[0] |
| 6792 | assert(_subtype == 44) |
| 6793 | return obj |
| 6794 | |
| 6795 | def __eq__(self, other): |
| 6796 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6797 | if self.xid != other.xid: return False |
| 6798 | return True |
| 6799 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6800 | def pretty_print(self, q): |
| 6801 | q.text("bsn_time_request {") |
| 6802 | with q.group(): |
| 6803 | with q.indent(2): |
| 6804 | q.breakable() |
| 6805 | q.text("xid = "); |
| 6806 | if self.xid != None: |
| 6807 | q.text("%#x" % self.xid) |
| 6808 | else: |
| 6809 | q.text('None') |
| 6810 | q.breakable() |
| 6811 | q.text('}') |
| 6812 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6813 | bsn_header.subtypes[44] = bsn_time_request |
| 6814 | |
| 6815 | class bsn_virtual_port_create_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6816 | version = 4 |
| 6817 | type = 4 |
| 6818 | experimenter = 6035143 |
| 6819 | subtype = 16 |
| 6820 | |
| 6821 | def __init__(self, xid=None, status=None, vport_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6822 | if xid != None: |
| 6823 | self.xid = xid |
| 6824 | else: |
| 6825 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6826 | if status != None: |
| 6827 | self.status = status |
| 6828 | else: |
| 6829 | self.status = 0 |
| 6830 | if vport_no != None: |
| 6831 | self.vport_no = vport_no |
| 6832 | else: |
| 6833 | self.vport_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6834 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6835 | |
| 6836 | def pack(self): |
| 6837 | packed = [] |
| 6838 | packed.append(struct.pack("!B", self.version)) |
| 6839 | packed.append(struct.pack("!B", self.type)) |
| 6840 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6841 | packed.append(struct.pack("!L", self.xid)) |
| 6842 | packed.append(struct.pack("!L", self.experimenter)) |
| 6843 | packed.append(struct.pack("!L", self.subtype)) |
| 6844 | packed.append(struct.pack("!L", self.status)) |
| 6845 | packed.append(struct.pack("!L", self.vport_no)) |
| 6846 | length = sum([len(x) for x in packed]) |
| 6847 | packed[2] = struct.pack("!H", length) |
| 6848 | return ''.join(packed) |
| 6849 | |
| 6850 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6851 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6852 | obj = bsn_virtual_port_create_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6853 | _version = reader.read("!B")[0] |
| 6854 | assert(_version == 4) |
| 6855 | _type = reader.read("!B")[0] |
| 6856 | assert(_type == 4) |
| 6857 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6858 | orig_reader = reader |
| 6859 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6860 | obj.xid = reader.read("!L")[0] |
| 6861 | _experimenter = reader.read("!L")[0] |
| 6862 | assert(_experimenter == 6035143) |
| 6863 | _subtype = reader.read("!L")[0] |
| 6864 | assert(_subtype == 16) |
| 6865 | obj.status = reader.read("!L")[0] |
| 6866 | obj.vport_no = reader.read("!L")[0] |
| 6867 | return obj |
| 6868 | |
| 6869 | def __eq__(self, other): |
| 6870 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6871 | if self.xid != other.xid: return False |
| 6872 | if self.status != other.status: return False |
| 6873 | if self.vport_no != other.vport_no: return False |
| 6874 | return True |
| 6875 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6876 | def pretty_print(self, q): |
| 6877 | q.text("bsn_virtual_port_create_reply {") |
| 6878 | with q.group(): |
| 6879 | with q.indent(2): |
| 6880 | q.breakable() |
| 6881 | q.text("xid = "); |
| 6882 | if self.xid != None: |
| 6883 | q.text("%#x" % self.xid) |
| 6884 | else: |
| 6885 | q.text('None') |
| 6886 | q.text(","); q.breakable() |
| 6887 | q.text("status = "); |
| 6888 | q.text("%#x" % self.status) |
| 6889 | q.text(","); q.breakable() |
| 6890 | q.text("vport_no = "); |
| 6891 | q.text("%#x" % self.vport_no) |
| 6892 | q.breakable() |
| 6893 | q.text('}') |
| 6894 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6895 | bsn_header.subtypes[16] = bsn_virtual_port_create_reply |
| 6896 | |
| 6897 | class bsn_virtual_port_create_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6898 | version = 4 |
| 6899 | type = 4 |
| 6900 | experimenter = 6035143 |
| 6901 | subtype = 15 |
| 6902 | |
| 6903 | def __init__(self, xid=None, vport=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6904 | if xid != None: |
| 6905 | self.xid = xid |
| 6906 | else: |
| 6907 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6908 | if vport != None: |
| 6909 | self.vport = vport |
| 6910 | else: |
| 6911 | self.vport = common.bsn_vport_q_in_q() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6912 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6913 | |
| 6914 | def pack(self): |
| 6915 | packed = [] |
| 6916 | packed.append(struct.pack("!B", self.version)) |
| 6917 | packed.append(struct.pack("!B", self.type)) |
| 6918 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6919 | packed.append(struct.pack("!L", self.xid)) |
| 6920 | packed.append(struct.pack("!L", self.experimenter)) |
| 6921 | packed.append(struct.pack("!L", self.subtype)) |
| 6922 | packed.append(self.vport.pack()) |
| 6923 | length = sum([len(x) for x in packed]) |
| 6924 | packed[2] = struct.pack("!H", length) |
| 6925 | return ''.join(packed) |
| 6926 | |
| 6927 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6928 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6929 | obj = bsn_virtual_port_create_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6930 | _version = reader.read("!B")[0] |
| 6931 | assert(_version == 4) |
| 6932 | _type = reader.read("!B")[0] |
| 6933 | assert(_type == 4) |
| 6934 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6935 | orig_reader = reader |
| 6936 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6937 | obj.xid = reader.read("!L")[0] |
| 6938 | _experimenter = reader.read("!L")[0] |
| 6939 | assert(_experimenter == 6035143) |
| 6940 | _subtype = reader.read("!L")[0] |
| 6941 | assert(_subtype == 15) |
| 6942 | obj.vport = common.bsn_vport_q_in_q.unpack(reader) |
| 6943 | return obj |
| 6944 | |
| 6945 | def __eq__(self, other): |
| 6946 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6947 | if self.xid != other.xid: return False |
| 6948 | if self.vport != other.vport: return False |
| 6949 | return True |
| 6950 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6951 | def pretty_print(self, q): |
| 6952 | q.text("bsn_virtual_port_create_request {") |
| 6953 | with q.group(): |
| 6954 | with q.indent(2): |
| 6955 | q.breakable() |
| 6956 | q.text("xid = "); |
| 6957 | if self.xid != None: |
| 6958 | q.text("%#x" % self.xid) |
| 6959 | else: |
| 6960 | q.text('None') |
| 6961 | q.text(","); q.breakable() |
| 6962 | q.text("vport = "); |
| 6963 | q.pp(self.vport) |
| 6964 | q.breakable() |
| 6965 | q.text('}') |
| 6966 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6967 | bsn_header.subtypes[15] = bsn_virtual_port_create_request |
| 6968 | |
| 6969 | class bsn_virtual_port_remove_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6970 | version = 4 |
| 6971 | type = 4 |
| 6972 | experimenter = 6035143 |
| 6973 | subtype = 26 |
| 6974 | |
| 6975 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6976 | if xid != None: |
| 6977 | self.xid = xid |
| 6978 | else: |
| 6979 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6980 | if status != None: |
| 6981 | self.status = status |
| 6982 | else: |
| 6983 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6984 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6985 | |
| 6986 | def pack(self): |
| 6987 | packed = [] |
| 6988 | packed.append(struct.pack("!B", self.version)) |
| 6989 | packed.append(struct.pack("!B", self.type)) |
| 6990 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6991 | packed.append(struct.pack("!L", self.xid)) |
| 6992 | packed.append(struct.pack("!L", self.experimenter)) |
| 6993 | packed.append(struct.pack("!L", self.subtype)) |
| 6994 | packed.append(struct.pack("!L", self.status)) |
| 6995 | length = sum([len(x) for x in packed]) |
| 6996 | packed[2] = struct.pack("!H", length) |
| 6997 | return ''.join(packed) |
| 6998 | |
| 6999 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7000 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7001 | obj = bsn_virtual_port_remove_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7002 | _version = reader.read("!B")[0] |
| 7003 | assert(_version == 4) |
| 7004 | _type = reader.read("!B")[0] |
| 7005 | assert(_type == 4) |
| 7006 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7007 | orig_reader = reader |
| 7008 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7009 | obj.xid = reader.read("!L")[0] |
| 7010 | _experimenter = reader.read("!L")[0] |
| 7011 | assert(_experimenter == 6035143) |
| 7012 | _subtype = reader.read("!L")[0] |
| 7013 | assert(_subtype == 26) |
| 7014 | obj.status = reader.read("!L")[0] |
| 7015 | return obj |
| 7016 | |
| 7017 | def __eq__(self, other): |
| 7018 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7019 | if self.xid != other.xid: return False |
| 7020 | if self.status != other.status: return False |
| 7021 | return True |
| 7022 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7023 | def pretty_print(self, q): |
| 7024 | q.text("bsn_virtual_port_remove_reply {") |
| 7025 | with q.group(): |
| 7026 | with q.indent(2): |
| 7027 | q.breakable() |
| 7028 | q.text("xid = "); |
| 7029 | if self.xid != None: |
| 7030 | q.text("%#x" % self.xid) |
| 7031 | else: |
| 7032 | q.text('None') |
| 7033 | q.text(","); q.breakable() |
| 7034 | q.text("status = "); |
| 7035 | q.text("%#x" % self.status) |
| 7036 | q.breakable() |
| 7037 | q.text('}') |
| 7038 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7039 | bsn_header.subtypes[26] = bsn_virtual_port_remove_reply |
| 7040 | |
| 7041 | class bsn_virtual_port_remove_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7042 | version = 4 |
| 7043 | type = 4 |
| 7044 | experimenter = 6035143 |
| 7045 | subtype = 17 |
| 7046 | |
| 7047 | def __init__(self, xid=None, vport_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7048 | if xid != None: |
| 7049 | self.xid = xid |
| 7050 | else: |
| 7051 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7052 | if vport_no != None: |
| 7053 | self.vport_no = vport_no |
| 7054 | else: |
| 7055 | self.vport_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7056 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7057 | |
| 7058 | def pack(self): |
| 7059 | packed = [] |
| 7060 | packed.append(struct.pack("!B", self.version)) |
| 7061 | packed.append(struct.pack("!B", self.type)) |
| 7062 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7063 | packed.append(struct.pack("!L", self.xid)) |
| 7064 | packed.append(struct.pack("!L", self.experimenter)) |
| 7065 | packed.append(struct.pack("!L", self.subtype)) |
| 7066 | packed.append(struct.pack("!L", self.vport_no)) |
| 7067 | length = sum([len(x) for x in packed]) |
| 7068 | packed[2] = struct.pack("!H", length) |
| 7069 | return ''.join(packed) |
| 7070 | |
| 7071 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7072 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7073 | obj = bsn_virtual_port_remove_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7074 | _version = reader.read("!B")[0] |
| 7075 | assert(_version == 4) |
| 7076 | _type = reader.read("!B")[0] |
| 7077 | assert(_type == 4) |
| 7078 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7079 | orig_reader = reader |
| 7080 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7081 | obj.xid = reader.read("!L")[0] |
| 7082 | _experimenter = reader.read("!L")[0] |
| 7083 | assert(_experimenter == 6035143) |
| 7084 | _subtype = reader.read("!L")[0] |
| 7085 | assert(_subtype == 17) |
| 7086 | obj.vport_no = reader.read("!L")[0] |
| 7087 | return obj |
| 7088 | |
| 7089 | def __eq__(self, other): |
| 7090 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7091 | if self.xid != other.xid: return False |
| 7092 | if self.vport_no != other.vport_no: return False |
| 7093 | return True |
| 7094 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7095 | def pretty_print(self, q): |
| 7096 | q.text("bsn_virtual_port_remove_request {") |
| 7097 | with q.group(): |
| 7098 | with q.indent(2): |
| 7099 | q.breakable() |
| 7100 | q.text("xid = "); |
| 7101 | if self.xid != None: |
| 7102 | q.text("%#x" % self.xid) |
| 7103 | else: |
| 7104 | q.text('None') |
| 7105 | q.text(","); q.breakable() |
| 7106 | q.text("vport_no = "); |
| 7107 | q.text("%#x" % self.vport_no) |
| 7108 | q.breakable() |
| 7109 | q.text('}') |
| 7110 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7111 | bsn_header.subtypes[17] = bsn_virtual_port_remove_request |
| 7112 | |
| 7113 | class bsn_vlan_counter_stats_reply(bsn_stats_reply): |
| 7114 | version = 4 |
| 7115 | type = 19 |
| 7116 | stats_type = 65535 |
| 7117 | experimenter = 6035143 |
| 7118 | subtype = 9 |
| 7119 | |
| 7120 | def __init__(self, xid=None, flags=None, entries=None): |
| 7121 | if xid != None: |
| 7122 | self.xid = xid |
| 7123 | else: |
| 7124 | self.xid = None |
| 7125 | if flags != None: |
| 7126 | self.flags = flags |
| 7127 | else: |
| 7128 | self.flags = 0 |
| 7129 | if entries != None: |
| 7130 | self.entries = entries |
| 7131 | else: |
| 7132 | self.entries = [] |
| 7133 | return |
| 7134 | |
| 7135 | def pack(self): |
| 7136 | packed = [] |
| 7137 | packed.append(struct.pack("!B", self.version)) |
| 7138 | packed.append(struct.pack("!B", self.type)) |
| 7139 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7140 | packed.append(struct.pack("!L", self.xid)) |
| 7141 | packed.append(struct.pack("!H", self.stats_type)) |
| 7142 | packed.append(struct.pack("!H", self.flags)) |
| 7143 | packed.append('\x00' * 4) |
| 7144 | packed.append(struct.pack("!L", self.experimenter)) |
| 7145 | packed.append(struct.pack("!L", self.subtype)) |
| 7146 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 7147 | length = sum([len(x) for x in packed]) |
| 7148 | packed[2] = struct.pack("!H", length) |
| 7149 | return ''.join(packed) |
| 7150 | |
| 7151 | @staticmethod |
| 7152 | def unpack(reader): |
| 7153 | obj = bsn_vlan_counter_stats_reply() |
| 7154 | _version = reader.read("!B")[0] |
| 7155 | assert(_version == 4) |
| 7156 | _type = reader.read("!B")[0] |
| 7157 | assert(_type == 19) |
| 7158 | _length = reader.read("!H")[0] |
| 7159 | orig_reader = reader |
| 7160 | reader = orig_reader.slice(_length - (2 + 2)) |
| 7161 | obj.xid = reader.read("!L")[0] |
| 7162 | _stats_type = reader.read("!H")[0] |
| 7163 | assert(_stats_type == 65535) |
| 7164 | obj.flags = reader.read("!H")[0] |
| 7165 | reader.skip(4) |
| 7166 | _experimenter = reader.read("!L")[0] |
| 7167 | assert(_experimenter == 6035143) |
| 7168 | _subtype = reader.read("!L")[0] |
| 7169 | assert(_subtype == 9) |
| 7170 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_vlan_counter_stats_entry.unpack) |
| 7171 | return obj |
| 7172 | |
| 7173 | def __eq__(self, other): |
| 7174 | if type(self) != type(other): return False |
| 7175 | if self.xid != other.xid: return False |
| 7176 | if self.flags != other.flags: return False |
| 7177 | if self.entries != other.entries: return False |
| 7178 | return True |
| 7179 | |
| 7180 | def pretty_print(self, q): |
| 7181 | q.text("bsn_vlan_counter_stats_reply {") |
| 7182 | with q.group(): |
| 7183 | with q.indent(2): |
| 7184 | q.breakable() |
| 7185 | q.text("xid = "); |
| 7186 | if self.xid != None: |
| 7187 | q.text("%#x" % self.xid) |
| 7188 | else: |
| 7189 | q.text('None') |
| 7190 | q.text(","); q.breakable() |
| 7191 | q.text("flags = "); |
| 7192 | q.text("%#x" % self.flags) |
| 7193 | q.text(","); q.breakable() |
| 7194 | q.text("entries = "); |
| 7195 | q.pp(self.entries) |
| 7196 | q.breakable() |
| 7197 | q.text('}') |
| 7198 | |
| 7199 | bsn_stats_reply.subtypes[9] = bsn_vlan_counter_stats_reply |
| 7200 | |
| 7201 | class bsn_vlan_counter_stats_request(bsn_stats_request): |
| 7202 | version = 4 |
| 7203 | type = 18 |
| 7204 | stats_type = 65535 |
| 7205 | experimenter = 6035143 |
| 7206 | subtype = 9 |
| 7207 | |
| 7208 | def __init__(self, xid=None, flags=None, vlan_vid=None): |
| 7209 | if xid != None: |
| 7210 | self.xid = xid |
| 7211 | else: |
| 7212 | self.xid = None |
| 7213 | if flags != None: |
| 7214 | self.flags = flags |
| 7215 | else: |
| 7216 | self.flags = 0 |
| 7217 | if vlan_vid != None: |
| 7218 | self.vlan_vid = vlan_vid |
| 7219 | else: |
| 7220 | self.vlan_vid = 0 |
| 7221 | return |
| 7222 | |
| 7223 | def pack(self): |
| 7224 | packed = [] |
| 7225 | packed.append(struct.pack("!B", self.version)) |
| 7226 | packed.append(struct.pack("!B", self.type)) |
| 7227 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7228 | packed.append(struct.pack("!L", self.xid)) |
| 7229 | packed.append(struct.pack("!H", self.stats_type)) |
| 7230 | packed.append(struct.pack("!H", self.flags)) |
| 7231 | packed.append('\x00' * 4) |
| 7232 | packed.append(struct.pack("!L", self.experimenter)) |
| 7233 | packed.append(struct.pack("!L", self.subtype)) |
| 7234 | packed.append(struct.pack("!H", self.vlan_vid)) |
| 7235 | length = sum([len(x) for x in packed]) |
| 7236 | packed[2] = struct.pack("!H", length) |
| 7237 | return ''.join(packed) |
| 7238 | |
| 7239 | @staticmethod |
| 7240 | def unpack(reader): |
| 7241 | obj = bsn_vlan_counter_stats_request() |
| 7242 | _version = reader.read("!B")[0] |
| 7243 | assert(_version == 4) |
| 7244 | _type = reader.read("!B")[0] |
| 7245 | assert(_type == 18) |
| 7246 | _length = reader.read("!H")[0] |
| 7247 | orig_reader = reader |
| 7248 | reader = orig_reader.slice(_length - (2 + 2)) |
| 7249 | obj.xid = reader.read("!L")[0] |
| 7250 | _stats_type = reader.read("!H")[0] |
| 7251 | assert(_stats_type == 65535) |
| 7252 | obj.flags = reader.read("!H")[0] |
| 7253 | reader.skip(4) |
| 7254 | _experimenter = reader.read("!L")[0] |
| 7255 | assert(_experimenter == 6035143) |
| 7256 | _subtype = reader.read("!L")[0] |
| 7257 | assert(_subtype == 9) |
| 7258 | obj.vlan_vid = reader.read("!H")[0] |
| 7259 | return obj |
| 7260 | |
| 7261 | def __eq__(self, other): |
| 7262 | if type(self) != type(other): return False |
| 7263 | if self.xid != other.xid: return False |
| 7264 | if self.flags != other.flags: return False |
| 7265 | if self.vlan_vid != other.vlan_vid: return False |
| 7266 | return True |
| 7267 | |
| 7268 | def pretty_print(self, q): |
| 7269 | q.text("bsn_vlan_counter_stats_request {") |
| 7270 | with q.group(): |
| 7271 | with q.indent(2): |
| 7272 | q.breakable() |
| 7273 | q.text("xid = "); |
| 7274 | if self.xid != None: |
| 7275 | q.text("%#x" % self.xid) |
| 7276 | else: |
| 7277 | q.text('None') |
| 7278 | q.text(","); q.breakable() |
| 7279 | q.text("flags = "); |
| 7280 | q.text("%#x" % self.flags) |
| 7281 | q.text(","); q.breakable() |
| 7282 | q.text("vlan_vid = "); |
| 7283 | q.text("%#x" % self.vlan_vid) |
| 7284 | q.breakable() |
| 7285 | q.text('}') |
| 7286 | |
| 7287 | bsn_stats_request.subtypes[9] = bsn_vlan_counter_stats_request |
| 7288 | |
| 7289 | class desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7290 | version = 4 |
| 7291 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7292 | stats_type = 0 |
| 7293 | |
| 7294 | def __init__(self, xid=None, flags=None, mfr_desc=None, hw_desc=None, sw_desc=None, serial_num=None, dp_desc=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7295 | if xid != None: |
| 7296 | self.xid = xid |
| 7297 | else: |
| 7298 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7299 | if flags != None: |
| 7300 | self.flags = flags |
| 7301 | else: |
| 7302 | self.flags = 0 |
| 7303 | if mfr_desc != None: |
| 7304 | self.mfr_desc = mfr_desc |
| 7305 | else: |
| 7306 | self.mfr_desc = "" |
| 7307 | if hw_desc != None: |
| 7308 | self.hw_desc = hw_desc |
| 7309 | else: |
| 7310 | self.hw_desc = "" |
| 7311 | if sw_desc != None: |
| 7312 | self.sw_desc = sw_desc |
| 7313 | else: |
| 7314 | self.sw_desc = "" |
| 7315 | if serial_num != None: |
| 7316 | self.serial_num = serial_num |
| 7317 | else: |
| 7318 | self.serial_num = "" |
| 7319 | if dp_desc != None: |
| 7320 | self.dp_desc = dp_desc |
| 7321 | else: |
| 7322 | self.dp_desc = "" |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7323 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7324 | |
| 7325 | def pack(self): |
| 7326 | packed = [] |
| 7327 | packed.append(struct.pack("!B", self.version)) |
| 7328 | packed.append(struct.pack("!B", self.type)) |
| 7329 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7330 | packed.append(struct.pack("!L", self.xid)) |
| 7331 | packed.append(struct.pack("!H", self.stats_type)) |
| 7332 | packed.append(struct.pack("!H", self.flags)) |
| 7333 | packed.append('\x00' * 4) |
| 7334 | packed.append(struct.pack("!256s", self.mfr_desc)) |
| 7335 | packed.append(struct.pack("!256s", self.hw_desc)) |
| 7336 | packed.append(struct.pack("!256s", self.sw_desc)) |
| 7337 | packed.append(struct.pack("!32s", self.serial_num)) |
| 7338 | packed.append(struct.pack("!256s", self.dp_desc)) |
| 7339 | length = sum([len(x) for x in packed]) |
| 7340 | packed[2] = struct.pack("!H", length) |
| 7341 | return ''.join(packed) |
| 7342 | |
| 7343 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7344 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7345 | obj = desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7346 | _version = reader.read("!B")[0] |
| 7347 | assert(_version == 4) |
| 7348 | _type = reader.read("!B")[0] |
| 7349 | assert(_type == 19) |
| 7350 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7351 | orig_reader = reader |
| 7352 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7353 | obj.xid = reader.read("!L")[0] |
| 7354 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7355 | assert(_stats_type == 0) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7356 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7357 | reader.skip(4) |
| 7358 | obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00") |
| 7359 | obj.hw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 7360 | obj.sw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 7361 | obj.serial_num = reader.read("!32s")[0].rstrip("\x00") |
| 7362 | obj.dp_desc = reader.read("!256s")[0].rstrip("\x00") |
| 7363 | return obj |
| 7364 | |
| 7365 | def __eq__(self, other): |
| 7366 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7367 | if self.xid != other.xid: return False |
| 7368 | if self.flags != other.flags: return False |
| 7369 | if self.mfr_desc != other.mfr_desc: return False |
| 7370 | if self.hw_desc != other.hw_desc: return False |
| 7371 | if self.sw_desc != other.sw_desc: return False |
| 7372 | if self.serial_num != other.serial_num: return False |
| 7373 | if self.dp_desc != other.dp_desc: return False |
| 7374 | return True |
| 7375 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7376 | def pretty_print(self, q): |
| 7377 | q.text("desc_stats_reply {") |
| 7378 | with q.group(): |
| 7379 | with q.indent(2): |
| 7380 | q.breakable() |
| 7381 | q.text("xid = "); |
| 7382 | if self.xid != None: |
| 7383 | q.text("%#x" % self.xid) |
| 7384 | else: |
| 7385 | q.text('None') |
| 7386 | q.text(","); q.breakable() |
| 7387 | q.text("flags = "); |
| 7388 | q.text("%#x" % self.flags) |
| 7389 | q.text(","); q.breakable() |
| 7390 | q.text("mfr_desc = "); |
| 7391 | q.pp(self.mfr_desc) |
| 7392 | q.text(","); q.breakable() |
| 7393 | q.text("hw_desc = "); |
| 7394 | q.pp(self.hw_desc) |
| 7395 | q.text(","); q.breakable() |
| 7396 | q.text("sw_desc = "); |
| 7397 | q.pp(self.sw_desc) |
| 7398 | q.text(","); q.breakable() |
| 7399 | q.text("serial_num = "); |
| 7400 | q.pp(self.serial_num) |
| 7401 | q.text(","); q.breakable() |
| 7402 | q.text("dp_desc = "); |
| 7403 | q.pp(self.dp_desc) |
| 7404 | q.breakable() |
| 7405 | q.text('}') |
| 7406 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7407 | stats_reply.subtypes[0] = desc_stats_reply |
| 7408 | |
| 7409 | class desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7410 | version = 4 |
| 7411 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7412 | stats_type = 0 |
| 7413 | |
| 7414 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7415 | if xid != None: |
| 7416 | self.xid = xid |
| 7417 | else: |
| 7418 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7419 | if flags != None: |
| 7420 | self.flags = flags |
| 7421 | else: |
| 7422 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7423 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7424 | |
| 7425 | def pack(self): |
| 7426 | packed = [] |
| 7427 | packed.append(struct.pack("!B", self.version)) |
| 7428 | packed.append(struct.pack("!B", self.type)) |
| 7429 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7430 | packed.append(struct.pack("!L", self.xid)) |
| 7431 | packed.append(struct.pack("!H", self.stats_type)) |
| 7432 | packed.append(struct.pack("!H", self.flags)) |
| 7433 | packed.append('\x00' * 4) |
| 7434 | length = sum([len(x) for x in packed]) |
| 7435 | packed[2] = struct.pack("!H", length) |
| 7436 | return ''.join(packed) |
| 7437 | |
| 7438 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7439 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7440 | obj = desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7441 | _version = reader.read("!B")[0] |
| 7442 | assert(_version == 4) |
| 7443 | _type = reader.read("!B")[0] |
| 7444 | assert(_type == 18) |
| 7445 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7446 | orig_reader = reader |
| 7447 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7448 | obj.xid = reader.read("!L")[0] |
| 7449 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7450 | assert(_stats_type == 0) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7451 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7452 | reader.skip(4) |
| 7453 | return obj |
| 7454 | |
| 7455 | def __eq__(self, other): |
| 7456 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7457 | if self.xid != other.xid: return False |
| 7458 | if self.flags != other.flags: return False |
| 7459 | return True |
| 7460 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7461 | def pretty_print(self, q): |
| 7462 | q.text("desc_stats_request {") |
| 7463 | with q.group(): |
| 7464 | with q.indent(2): |
| 7465 | q.breakable() |
| 7466 | q.text("xid = "); |
| 7467 | if self.xid != None: |
| 7468 | q.text("%#x" % self.xid) |
| 7469 | else: |
| 7470 | q.text('None') |
| 7471 | q.text(","); q.breakable() |
| 7472 | q.text("flags = "); |
| 7473 | q.text("%#x" % self.flags) |
| 7474 | q.breakable() |
| 7475 | q.text('}') |
| 7476 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7477 | stats_request.subtypes[0] = desc_stats_request |
| 7478 | |
| 7479 | class echo_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7480 | version = 4 |
| 7481 | type = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7482 | |
| 7483 | def __init__(self, xid=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7484 | if xid != None: |
| 7485 | self.xid = xid |
| 7486 | else: |
| 7487 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7488 | if data != None: |
| 7489 | self.data = data |
| 7490 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7491 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7492 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7493 | |
| 7494 | def pack(self): |
| 7495 | packed = [] |
| 7496 | packed.append(struct.pack("!B", self.version)) |
| 7497 | packed.append(struct.pack("!B", self.type)) |
| 7498 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7499 | packed.append(struct.pack("!L", self.xid)) |
| 7500 | packed.append(self.data) |
| 7501 | length = sum([len(x) for x in packed]) |
| 7502 | packed[2] = struct.pack("!H", length) |
| 7503 | return ''.join(packed) |
| 7504 | |
| 7505 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7506 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7507 | obj = echo_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7508 | _version = reader.read("!B")[0] |
| 7509 | assert(_version == 4) |
| 7510 | _type = reader.read("!B")[0] |
| 7511 | assert(_type == 3) |
| 7512 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7513 | orig_reader = reader |
| 7514 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7515 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7516 | obj.data = str(reader.read_all()) |
| 7517 | return obj |
| 7518 | |
| 7519 | def __eq__(self, other): |
| 7520 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7521 | if self.xid != other.xid: return False |
| 7522 | if self.data != other.data: return False |
| 7523 | return True |
| 7524 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7525 | def pretty_print(self, q): |
| 7526 | q.text("echo_reply {") |
| 7527 | with q.group(): |
| 7528 | with q.indent(2): |
| 7529 | q.breakable() |
| 7530 | q.text("xid = "); |
| 7531 | if self.xid != None: |
| 7532 | q.text("%#x" % self.xid) |
| 7533 | else: |
| 7534 | q.text('None') |
| 7535 | q.text(","); q.breakable() |
| 7536 | q.text("data = "); |
| 7537 | q.pp(self.data) |
| 7538 | q.breakable() |
| 7539 | q.text('}') |
| 7540 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7541 | message.subtypes[3] = echo_reply |
| 7542 | |
| 7543 | class echo_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7544 | version = 4 |
| 7545 | type = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7546 | |
| 7547 | def __init__(self, xid=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7548 | if xid != None: |
| 7549 | self.xid = xid |
| 7550 | else: |
| 7551 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7552 | if data != None: |
| 7553 | self.data = data |
| 7554 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7555 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7556 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7557 | |
| 7558 | def pack(self): |
| 7559 | packed = [] |
| 7560 | packed.append(struct.pack("!B", self.version)) |
| 7561 | packed.append(struct.pack("!B", self.type)) |
| 7562 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7563 | packed.append(struct.pack("!L", self.xid)) |
| 7564 | packed.append(self.data) |
| 7565 | length = sum([len(x) for x in packed]) |
| 7566 | packed[2] = struct.pack("!H", length) |
| 7567 | return ''.join(packed) |
| 7568 | |
| 7569 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7570 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7571 | obj = echo_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7572 | _version = reader.read("!B")[0] |
| 7573 | assert(_version == 4) |
| 7574 | _type = reader.read("!B")[0] |
| 7575 | assert(_type == 2) |
| 7576 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7577 | orig_reader = reader |
| 7578 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7579 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7580 | obj.data = str(reader.read_all()) |
| 7581 | return obj |
| 7582 | |
| 7583 | def __eq__(self, other): |
| 7584 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7585 | if self.xid != other.xid: return False |
| 7586 | if self.data != other.data: return False |
| 7587 | return True |
| 7588 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7589 | def pretty_print(self, q): |
| 7590 | q.text("echo_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("data = "); |
| 7601 | q.pp(self.data) |
| 7602 | q.breakable() |
| 7603 | q.text('}') |
| 7604 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7605 | message.subtypes[2] = echo_request |
| 7606 | |
| 7607 | class experimenter_error_msg(error_msg): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7608 | version = 4 |
| 7609 | type = 1 |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7610 | err_type = 65535 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7611 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7612 | def __init__(self, xid=None, subtype=None, experimenter=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7613 | if xid != None: |
| 7614 | self.xid = xid |
| 7615 | else: |
| 7616 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7617 | if subtype != None: |
| 7618 | self.subtype = subtype |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7619 | else: |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7620 | self.subtype = 0 |
| 7621 | if experimenter != None: |
| 7622 | self.experimenter = experimenter |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7623 | else: |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7624 | self.experimenter = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7625 | if data != None: |
| 7626 | self.data = data |
| 7627 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7628 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7629 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7630 | |
| 7631 | def pack(self): |
| 7632 | packed = [] |
| 7633 | packed.append(struct.pack("!B", self.version)) |
| 7634 | packed.append(struct.pack("!B", self.type)) |
| 7635 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7636 | packed.append(struct.pack("!L", self.xid)) |
| 7637 | packed.append(struct.pack("!H", self.err_type)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7638 | packed.append(struct.pack("!H", self.subtype)) |
| 7639 | packed.append(struct.pack("!L", self.experimenter)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7640 | packed.append(self.data) |
| 7641 | length = sum([len(x) for x in packed]) |
| 7642 | packed[2] = struct.pack("!H", length) |
| 7643 | return ''.join(packed) |
| 7644 | |
| 7645 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7646 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7647 | obj = experimenter_error_msg() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7648 | _version = reader.read("!B")[0] |
| 7649 | assert(_version == 4) |
| 7650 | _type = reader.read("!B")[0] |
| 7651 | assert(_type == 1) |
| 7652 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7653 | orig_reader = reader |
| 7654 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7655 | obj.xid = reader.read("!L")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7656 | _err_type = reader.read("!H")[0] |
| 7657 | assert(_err_type == 65535) |
| 7658 | obj.subtype = reader.read("!H")[0] |
| 7659 | obj.experimenter = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7660 | obj.data = str(reader.read_all()) |
| 7661 | return obj |
| 7662 | |
| 7663 | def __eq__(self, other): |
| 7664 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7665 | if self.xid != other.xid: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7666 | if self.subtype != other.subtype: return False |
| 7667 | if self.experimenter != other.experimenter: return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7668 | if self.data != other.data: return False |
| 7669 | return True |
| 7670 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7671 | def pretty_print(self, q): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7672 | q.text("experimenter_error_msg {") |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7673 | with q.group(): |
| 7674 | with q.indent(2): |
| 7675 | q.breakable() |
| 7676 | q.text("xid = "); |
| 7677 | if self.xid != None: |
| 7678 | q.text("%#x" % self.xid) |
| 7679 | else: |
| 7680 | q.text('None') |
| 7681 | q.text(","); q.breakable() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7682 | q.text("subtype = "); |
| 7683 | q.text("%#x" % self.subtype) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7684 | q.text(","); q.breakable() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7685 | q.text("experimenter = "); |
| 7686 | q.text("%#x" % self.experimenter) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7687 | q.text(","); q.breakable() |
| 7688 | q.text("data = "); |
| 7689 | q.pp(self.data) |
| 7690 | q.breakable() |
| 7691 | q.text('}') |
| 7692 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7693 | error_msg.subtypes[65535] = experimenter_error_msg |
| 7694 | |
| 7695 | class features_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7696 | version = 4 |
| 7697 | type = 6 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7698 | |
| 7699 | def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, auxiliary_id=None, capabilities=None, reserved=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7700 | if xid != None: |
| 7701 | self.xid = xid |
| 7702 | else: |
| 7703 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7704 | if datapath_id != None: |
| 7705 | self.datapath_id = datapath_id |
| 7706 | else: |
| 7707 | self.datapath_id = 0 |
| 7708 | if n_buffers != None: |
| 7709 | self.n_buffers = n_buffers |
| 7710 | else: |
| 7711 | self.n_buffers = 0 |
| 7712 | if n_tables != None: |
| 7713 | self.n_tables = n_tables |
| 7714 | else: |
| 7715 | self.n_tables = 0 |
| 7716 | if auxiliary_id != None: |
| 7717 | self.auxiliary_id = auxiliary_id |
| 7718 | else: |
| 7719 | self.auxiliary_id = 0 |
| 7720 | if capabilities != None: |
| 7721 | self.capabilities = capabilities |
| 7722 | else: |
| 7723 | self.capabilities = 0 |
| 7724 | if reserved != None: |
| 7725 | self.reserved = reserved |
| 7726 | else: |
| 7727 | self.reserved = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7728 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7729 | |
| 7730 | def pack(self): |
| 7731 | packed = [] |
| 7732 | packed.append(struct.pack("!B", self.version)) |
| 7733 | packed.append(struct.pack("!B", self.type)) |
| 7734 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7735 | packed.append(struct.pack("!L", self.xid)) |
| 7736 | packed.append(struct.pack("!Q", self.datapath_id)) |
| 7737 | packed.append(struct.pack("!L", self.n_buffers)) |
| 7738 | packed.append(struct.pack("!B", self.n_tables)) |
| 7739 | packed.append(struct.pack("!B", self.auxiliary_id)) |
| 7740 | packed.append('\x00' * 2) |
| 7741 | packed.append(struct.pack("!L", self.capabilities)) |
| 7742 | packed.append(struct.pack("!L", self.reserved)) |
| 7743 | length = sum([len(x) for x in packed]) |
| 7744 | packed[2] = struct.pack("!H", length) |
| 7745 | return ''.join(packed) |
| 7746 | |
| 7747 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7748 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7749 | obj = features_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7750 | _version = reader.read("!B")[0] |
| 7751 | assert(_version == 4) |
| 7752 | _type = reader.read("!B")[0] |
| 7753 | assert(_type == 6) |
| 7754 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7755 | orig_reader = reader |
| 7756 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7757 | obj.xid = reader.read("!L")[0] |
| 7758 | obj.datapath_id = reader.read("!Q")[0] |
| 7759 | obj.n_buffers = reader.read("!L")[0] |
| 7760 | obj.n_tables = reader.read("!B")[0] |
| 7761 | obj.auxiliary_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7762 | reader.skip(2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7763 | obj.capabilities = reader.read("!L")[0] |
| 7764 | obj.reserved = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7765 | return obj |
| 7766 | |
| 7767 | def __eq__(self, other): |
| 7768 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7769 | if self.xid != other.xid: return False |
| 7770 | if self.datapath_id != other.datapath_id: return False |
| 7771 | if self.n_buffers != other.n_buffers: return False |
| 7772 | if self.n_tables != other.n_tables: return False |
| 7773 | if self.auxiliary_id != other.auxiliary_id: return False |
| 7774 | if self.capabilities != other.capabilities: return False |
| 7775 | if self.reserved != other.reserved: return False |
| 7776 | return True |
| 7777 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7778 | def pretty_print(self, q): |
| 7779 | q.text("features_reply {") |
| 7780 | with q.group(): |
| 7781 | with q.indent(2): |
| 7782 | q.breakable() |
| 7783 | q.text("xid = "); |
| 7784 | if self.xid != None: |
| 7785 | q.text("%#x" % self.xid) |
| 7786 | else: |
| 7787 | q.text('None') |
| 7788 | q.text(","); q.breakable() |
| 7789 | q.text("datapath_id = "); |
| 7790 | q.text("%#x" % self.datapath_id) |
| 7791 | q.text(","); q.breakable() |
| 7792 | q.text("n_buffers = "); |
| 7793 | q.text("%#x" % self.n_buffers) |
| 7794 | q.text(","); q.breakable() |
| 7795 | q.text("n_tables = "); |
| 7796 | q.text("%#x" % self.n_tables) |
| 7797 | q.text(","); q.breakable() |
| 7798 | q.text("auxiliary_id = "); |
| 7799 | q.text("%#x" % self.auxiliary_id) |
| 7800 | q.text(","); q.breakable() |
| 7801 | q.text("capabilities = "); |
| 7802 | q.text("%#x" % self.capabilities) |
| 7803 | q.text(","); q.breakable() |
| 7804 | q.text("reserved = "); |
| 7805 | q.text("%#x" % self.reserved) |
| 7806 | q.breakable() |
| 7807 | q.text('}') |
| 7808 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7809 | message.subtypes[6] = features_reply |
| 7810 | |
| 7811 | class features_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7812 | version = 4 |
| 7813 | type = 5 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7814 | |
| 7815 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7816 | if xid != None: |
| 7817 | self.xid = xid |
| 7818 | else: |
| 7819 | self.xid = None |
| 7820 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7821 | |
| 7822 | def pack(self): |
| 7823 | packed = [] |
| 7824 | packed.append(struct.pack("!B", self.version)) |
| 7825 | packed.append(struct.pack("!B", self.type)) |
| 7826 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7827 | packed.append(struct.pack("!L", self.xid)) |
| 7828 | length = sum([len(x) for x in packed]) |
| 7829 | packed[2] = struct.pack("!H", length) |
| 7830 | return ''.join(packed) |
| 7831 | |
| 7832 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7833 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7834 | obj = features_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7835 | _version = reader.read("!B")[0] |
| 7836 | assert(_version == 4) |
| 7837 | _type = reader.read("!B")[0] |
| 7838 | assert(_type == 5) |
| 7839 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7840 | orig_reader = reader |
| 7841 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7842 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7843 | return obj |
| 7844 | |
| 7845 | def __eq__(self, other): |
| 7846 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7847 | if self.xid != other.xid: return False |
| 7848 | return True |
| 7849 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7850 | def pretty_print(self, q): |
| 7851 | q.text("features_request {") |
| 7852 | with q.group(): |
| 7853 | with q.indent(2): |
| 7854 | q.breakable() |
| 7855 | q.text("xid = "); |
| 7856 | if self.xid != None: |
| 7857 | q.text("%#x" % self.xid) |
| 7858 | else: |
| 7859 | q.text('None') |
| 7860 | q.breakable() |
| 7861 | q.text('}') |
| 7862 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7863 | message.subtypes[5] = features_request |
| 7864 | |
| 7865 | class flow_mod(message): |
| 7866 | subtypes = {} |
| 7867 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 7868 | version = 4 |
| 7869 | type = 14 |
| 7870 | |
| 7871 | 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): |
| 7872 | if xid != None: |
| 7873 | self.xid = xid |
| 7874 | else: |
| 7875 | self.xid = None |
| 7876 | if cookie != None: |
| 7877 | self.cookie = cookie |
| 7878 | else: |
| 7879 | self.cookie = 0 |
| 7880 | if cookie_mask != None: |
| 7881 | self.cookie_mask = cookie_mask |
| 7882 | else: |
| 7883 | self.cookie_mask = 0 |
| 7884 | if table_id != None: |
| 7885 | self.table_id = table_id |
| 7886 | else: |
| 7887 | self.table_id = 0 |
| 7888 | if _command != None: |
| 7889 | self._command = _command |
| 7890 | else: |
| 7891 | self._command = 0 |
| 7892 | if idle_timeout != None: |
| 7893 | self.idle_timeout = idle_timeout |
| 7894 | else: |
| 7895 | self.idle_timeout = 0 |
| 7896 | if hard_timeout != None: |
| 7897 | self.hard_timeout = hard_timeout |
| 7898 | else: |
| 7899 | self.hard_timeout = 0 |
| 7900 | if priority != None: |
| 7901 | self.priority = priority |
| 7902 | else: |
| 7903 | self.priority = 0 |
| 7904 | if buffer_id != None: |
| 7905 | self.buffer_id = buffer_id |
| 7906 | else: |
| 7907 | self.buffer_id = 0 |
| 7908 | if out_port != None: |
| 7909 | self.out_port = out_port |
| 7910 | else: |
| 7911 | self.out_port = 0 |
| 7912 | if out_group != None: |
| 7913 | self.out_group = out_group |
| 7914 | else: |
| 7915 | self.out_group = 0 |
| 7916 | if flags != None: |
| 7917 | self.flags = flags |
| 7918 | else: |
| 7919 | self.flags = 0 |
| 7920 | if match != None: |
| 7921 | self.match = match |
| 7922 | else: |
| 7923 | self.match = common.match() |
| 7924 | if instructions != None: |
| 7925 | self.instructions = instructions |
| 7926 | else: |
| 7927 | self.instructions = [] |
| 7928 | return |
| 7929 | |
| 7930 | def pack(self): |
| 7931 | packed = [] |
| 7932 | packed.append(struct.pack("!B", self.version)) |
| 7933 | packed.append(struct.pack("!B", self.type)) |
| 7934 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7935 | packed.append(struct.pack("!L", self.xid)) |
| 7936 | packed.append(struct.pack("!Q", self.cookie)) |
| 7937 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 7938 | packed.append(struct.pack("!B", self.table_id)) |
| 7939 | packed.append(util.pack_fm_cmd(self._command)) |
| 7940 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 7941 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 7942 | packed.append(struct.pack("!H", self.priority)) |
| 7943 | packed.append(struct.pack("!L", self.buffer_id)) |
| 7944 | packed.append(util.pack_port_no(self.out_port)) |
| 7945 | packed.append(struct.pack("!L", self.out_group)) |
| 7946 | packed.append(struct.pack("!H", self.flags)) |
| 7947 | packed.append('\x00' * 2) |
| 7948 | packed.append(self.match.pack()) |
| 7949 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
| 7950 | length = sum([len(x) for x in packed]) |
| 7951 | packed[2] = struct.pack("!H", length) |
| 7952 | return ''.join(packed) |
| 7953 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7954 | @staticmethod |
| 7955 | def unpack(reader): |
| 7956 | subtype, = reader.peek('B', 25) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 7957 | subclass = flow_mod.subtypes.get(subtype) |
| 7958 | if subclass: |
| 7959 | return subclass.unpack(reader) |
| 7960 | |
| 7961 | obj = flow_mod() |
| 7962 | _version = reader.read("!B")[0] |
| 7963 | assert(_version == 4) |
| 7964 | _type = reader.read("!B")[0] |
| 7965 | assert(_type == 14) |
| 7966 | _length = reader.read("!H")[0] |
| 7967 | orig_reader = reader |
| 7968 | reader = orig_reader.slice(_length - (2 + 2)) |
| 7969 | obj.xid = reader.read("!L")[0] |
| 7970 | obj.cookie = reader.read("!Q")[0] |
| 7971 | obj.cookie_mask = reader.read("!Q")[0] |
| 7972 | obj.table_id = reader.read("!B")[0] |
| 7973 | obj._command = util.unpack_fm_cmd(reader) |
| 7974 | obj.idle_timeout = reader.read("!H")[0] |
| 7975 | obj.hard_timeout = reader.read("!H")[0] |
| 7976 | obj.priority = reader.read("!H")[0] |
| 7977 | obj.buffer_id = reader.read("!L")[0] |
| 7978 | obj.out_port = util.unpack_port_no(reader) |
| 7979 | obj.out_group = reader.read("!L")[0] |
| 7980 | obj.flags = reader.read("!H")[0] |
| 7981 | reader.skip(2) |
| 7982 | obj.match = common.match.unpack(reader) |
| 7983 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
| 7984 | return obj |
| 7985 | |
| 7986 | def __eq__(self, other): |
| 7987 | if type(self) != type(other): return False |
| 7988 | if self.xid != other.xid: return False |
| 7989 | if self.cookie != other.cookie: return False |
| 7990 | if self.cookie_mask != other.cookie_mask: return False |
| 7991 | if self.table_id != other.table_id: return False |
| 7992 | if self._command != other._command: return False |
| 7993 | if self.idle_timeout != other.idle_timeout: return False |
| 7994 | if self.hard_timeout != other.hard_timeout: return False |
| 7995 | if self.priority != other.priority: return False |
| 7996 | if self.buffer_id != other.buffer_id: return False |
| 7997 | if self.out_port != other.out_port: return False |
| 7998 | if self.out_group != other.out_group: return False |
| 7999 | if self.flags != other.flags: return False |
| 8000 | if self.match != other.match: return False |
| 8001 | if self.instructions != other.instructions: return False |
| 8002 | return True |
| 8003 | |
| 8004 | def pretty_print(self, q): |
| 8005 | q.text("flow_mod {") |
| 8006 | with q.group(): |
| 8007 | with q.indent(2): |
| 8008 | q.breakable() |
| 8009 | q.text("xid = "); |
| 8010 | if self.xid != None: |
| 8011 | q.text("%#x" % self.xid) |
| 8012 | else: |
| 8013 | q.text('None') |
| 8014 | q.text(","); q.breakable() |
| 8015 | q.text("cookie = "); |
| 8016 | q.text("%#x" % self.cookie) |
| 8017 | q.text(","); q.breakable() |
| 8018 | q.text("cookie_mask = "); |
| 8019 | q.text("%#x" % self.cookie_mask) |
| 8020 | q.text(","); q.breakable() |
| 8021 | q.text("table_id = "); |
| 8022 | q.text("%#x" % self.table_id) |
| 8023 | q.text(","); q.breakable() |
| 8024 | q.text("idle_timeout = "); |
| 8025 | q.text("%#x" % self.idle_timeout) |
| 8026 | q.text(","); q.breakable() |
| 8027 | q.text("hard_timeout = "); |
| 8028 | q.text("%#x" % self.hard_timeout) |
| 8029 | q.text(","); q.breakable() |
| 8030 | q.text("priority = "); |
| 8031 | q.text("%#x" % self.priority) |
| 8032 | q.text(","); q.breakable() |
| 8033 | q.text("buffer_id = "); |
| 8034 | q.text("%#x" % self.buffer_id) |
| 8035 | q.text(","); q.breakable() |
| 8036 | q.text("out_port = "); |
| 8037 | q.text(util.pretty_port(self.out_port)) |
| 8038 | q.text(","); q.breakable() |
| 8039 | q.text("out_group = "); |
| 8040 | q.text("%#x" % self.out_group) |
| 8041 | q.text(","); q.breakable() |
| 8042 | q.text("flags = "); |
| 8043 | q.text("%#x" % self.flags) |
| 8044 | q.text(","); q.breakable() |
| 8045 | q.text("match = "); |
| 8046 | q.pp(self.match) |
| 8047 | q.text(","); q.breakable() |
| 8048 | q.text("instructions = "); |
| 8049 | q.pp(self.instructions) |
| 8050 | q.breakable() |
| 8051 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8052 | |
| 8053 | message.subtypes[14] = flow_mod |
| 8054 | |
| 8055 | class flow_add(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8056 | version = 4 |
| 8057 | type = 14 |
| 8058 | _command = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8059 | |
| 8060 | def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8061 | if xid != None: |
| 8062 | self.xid = xid |
| 8063 | else: |
| 8064 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8065 | if cookie != None: |
| 8066 | self.cookie = cookie |
| 8067 | else: |
| 8068 | self.cookie = 0 |
| 8069 | if cookie_mask != None: |
| 8070 | self.cookie_mask = cookie_mask |
| 8071 | else: |
| 8072 | self.cookie_mask = 0 |
| 8073 | if table_id != None: |
| 8074 | self.table_id = table_id |
| 8075 | else: |
| 8076 | self.table_id = 0 |
| 8077 | if idle_timeout != None: |
| 8078 | self.idle_timeout = idle_timeout |
| 8079 | else: |
| 8080 | self.idle_timeout = 0 |
| 8081 | if hard_timeout != None: |
| 8082 | self.hard_timeout = hard_timeout |
| 8083 | else: |
| 8084 | self.hard_timeout = 0 |
| 8085 | if priority != None: |
| 8086 | self.priority = priority |
| 8087 | else: |
| 8088 | self.priority = 0 |
| 8089 | if buffer_id != None: |
| 8090 | self.buffer_id = buffer_id |
| 8091 | else: |
| 8092 | self.buffer_id = 0 |
| 8093 | if out_port != None: |
| 8094 | self.out_port = out_port |
| 8095 | else: |
| 8096 | self.out_port = 0 |
| 8097 | if out_group != None: |
| 8098 | self.out_group = out_group |
| 8099 | else: |
| 8100 | self.out_group = 0 |
| 8101 | if flags != None: |
| 8102 | self.flags = flags |
| 8103 | else: |
| 8104 | self.flags = 0 |
| 8105 | if match != None: |
| 8106 | self.match = match |
| 8107 | else: |
| 8108 | self.match = common.match() |
| 8109 | if instructions != None: |
| 8110 | self.instructions = instructions |
| 8111 | else: |
| 8112 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8113 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8114 | |
| 8115 | def pack(self): |
| 8116 | packed = [] |
| 8117 | packed.append(struct.pack("!B", self.version)) |
| 8118 | packed.append(struct.pack("!B", self.type)) |
| 8119 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8120 | packed.append(struct.pack("!L", self.xid)) |
| 8121 | packed.append(struct.pack("!Q", self.cookie)) |
| 8122 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 8123 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8124 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8125 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 8126 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 8127 | packed.append(struct.pack("!H", self.priority)) |
| 8128 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8129 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8130 | packed.append(struct.pack("!L", self.out_group)) |
| 8131 | packed.append(struct.pack("!H", self.flags)) |
| 8132 | packed.append('\x00' * 2) |
| 8133 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8134 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8135 | length = sum([len(x) for x in packed]) |
| 8136 | packed[2] = struct.pack("!H", length) |
| 8137 | return ''.join(packed) |
| 8138 | |
| 8139 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8140 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8141 | obj = flow_add() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8142 | _version = reader.read("!B")[0] |
| 8143 | assert(_version == 4) |
| 8144 | _type = reader.read("!B")[0] |
| 8145 | assert(_type == 14) |
| 8146 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8147 | orig_reader = reader |
| 8148 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8149 | obj.xid = reader.read("!L")[0] |
| 8150 | obj.cookie = reader.read("!Q")[0] |
| 8151 | obj.cookie_mask = reader.read("!Q")[0] |
| 8152 | obj.table_id = reader.read("!B")[0] |
| 8153 | __command = util.unpack_fm_cmd(reader) |
| 8154 | assert(__command == 0) |
| 8155 | obj.idle_timeout = reader.read("!H")[0] |
| 8156 | obj.hard_timeout = reader.read("!H")[0] |
| 8157 | obj.priority = reader.read("!H")[0] |
| 8158 | obj.buffer_id = reader.read("!L")[0] |
| 8159 | obj.out_port = util.unpack_port_no(reader) |
| 8160 | obj.out_group = reader.read("!L")[0] |
| 8161 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8162 | reader.skip(2) |
| 8163 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8164 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8165 | return obj |
| 8166 | |
| 8167 | def __eq__(self, other): |
| 8168 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8169 | if self.xid != other.xid: return False |
| 8170 | if self.cookie != other.cookie: return False |
| 8171 | if self.cookie_mask != other.cookie_mask: return False |
| 8172 | if self.table_id != other.table_id: return False |
| 8173 | if self.idle_timeout != other.idle_timeout: return False |
| 8174 | if self.hard_timeout != other.hard_timeout: return False |
| 8175 | if self.priority != other.priority: return False |
| 8176 | if self.buffer_id != other.buffer_id: return False |
| 8177 | if self.out_port != other.out_port: return False |
| 8178 | if self.out_group != other.out_group: return False |
| 8179 | if self.flags != other.flags: return False |
| 8180 | if self.match != other.match: return False |
| 8181 | if self.instructions != other.instructions: return False |
| 8182 | return True |
| 8183 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8184 | def pretty_print(self, q): |
| 8185 | q.text("flow_add {") |
| 8186 | with q.group(): |
| 8187 | with q.indent(2): |
| 8188 | q.breakable() |
| 8189 | q.text("xid = "); |
| 8190 | if self.xid != None: |
| 8191 | q.text("%#x" % self.xid) |
| 8192 | else: |
| 8193 | q.text('None') |
| 8194 | q.text(","); q.breakable() |
| 8195 | q.text("cookie = "); |
| 8196 | q.text("%#x" % self.cookie) |
| 8197 | q.text(","); q.breakable() |
| 8198 | q.text("cookie_mask = "); |
| 8199 | q.text("%#x" % self.cookie_mask) |
| 8200 | q.text(","); q.breakable() |
| 8201 | q.text("table_id = "); |
| 8202 | q.text("%#x" % self.table_id) |
| 8203 | q.text(","); q.breakable() |
| 8204 | q.text("idle_timeout = "); |
| 8205 | q.text("%#x" % self.idle_timeout) |
| 8206 | q.text(","); q.breakable() |
| 8207 | q.text("hard_timeout = "); |
| 8208 | q.text("%#x" % self.hard_timeout) |
| 8209 | q.text(","); q.breakable() |
| 8210 | q.text("priority = "); |
| 8211 | q.text("%#x" % self.priority) |
| 8212 | q.text(","); q.breakable() |
| 8213 | q.text("buffer_id = "); |
| 8214 | q.text("%#x" % self.buffer_id) |
| 8215 | q.text(","); q.breakable() |
| 8216 | q.text("out_port = "); |
| 8217 | q.text(util.pretty_port(self.out_port)) |
| 8218 | q.text(","); q.breakable() |
| 8219 | q.text("out_group = "); |
| 8220 | q.text("%#x" % self.out_group) |
| 8221 | q.text(","); q.breakable() |
| 8222 | q.text("flags = "); |
| 8223 | q.text("%#x" % self.flags) |
| 8224 | q.text(","); q.breakable() |
| 8225 | q.text("match = "); |
| 8226 | q.pp(self.match) |
| 8227 | q.text(","); q.breakable() |
| 8228 | q.text("instructions = "); |
| 8229 | q.pp(self.instructions) |
| 8230 | q.breakable() |
| 8231 | q.text('}') |
| 8232 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8233 | flow_mod.subtypes[0] = flow_add |
| 8234 | |
| 8235 | class flow_delete(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8236 | version = 4 |
| 8237 | type = 14 |
| 8238 | _command = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8239 | |
| 8240 | def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8241 | if xid != None: |
| 8242 | self.xid = xid |
| 8243 | else: |
| 8244 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8245 | if cookie != None: |
| 8246 | self.cookie = cookie |
| 8247 | else: |
| 8248 | self.cookie = 0 |
| 8249 | if cookie_mask != None: |
| 8250 | self.cookie_mask = cookie_mask |
| 8251 | else: |
| 8252 | self.cookie_mask = 0 |
| 8253 | if table_id != None: |
| 8254 | self.table_id = table_id |
| 8255 | else: |
| 8256 | self.table_id = 0 |
| 8257 | if idle_timeout != None: |
| 8258 | self.idle_timeout = idle_timeout |
| 8259 | else: |
| 8260 | self.idle_timeout = 0 |
| 8261 | if hard_timeout != None: |
| 8262 | self.hard_timeout = hard_timeout |
| 8263 | else: |
| 8264 | self.hard_timeout = 0 |
| 8265 | if priority != None: |
| 8266 | self.priority = priority |
| 8267 | else: |
| 8268 | self.priority = 0 |
| 8269 | if buffer_id != None: |
| 8270 | self.buffer_id = buffer_id |
| 8271 | else: |
| 8272 | self.buffer_id = 0 |
| 8273 | if out_port != None: |
| 8274 | self.out_port = out_port |
| 8275 | else: |
| 8276 | self.out_port = 0 |
| 8277 | if out_group != None: |
| 8278 | self.out_group = out_group |
| 8279 | else: |
| 8280 | self.out_group = 0 |
| 8281 | if flags != None: |
| 8282 | self.flags = flags |
| 8283 | else: |
| 8284 | self.flags = 0 |
| 8285 | if match != None: |
| 8286 | self.match = match |
| 8287 | else: |
| 8288 | self.match = common.match() |
| 8289 | if instructions != None: |
| 8290 | self.instructions = instructions |
| 8291 | else: |
| 8292 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8293 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8294 | |
| 8295 | def pack(self): |
| 8296 | packed = [] |
| 8297 | packed.append(struct.pack("!B", self.version)) |
| 8298 | packed.append(struct.pack("!B", self.type)) |
| 8299 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8300 | packed.append(struct.pack("!L", self.xid)) |
| 8301 | packed.append(struct.pack("!Q", self.cookie)) |
| 8302 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 8303 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8304 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8305 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 8306 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 8307 | packed.append(struct.pack("!H", self.priority)) |
| 8308 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8309 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8310 | packed.append(struct.pack("!L", self.out_group)) |
| 8311 | packed.append(struct.pack("!H", self.flags)) |
| 8312 | packed.append('\x00' * 2) |
| 8313 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8314 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8315 | length = sum([len(x) for x in packed]) |
| 8316 | packed[2] = struct.pack("!H", length) |
| 8317 | return ''.join(packed) |
| 8318 | |
| 8319 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8320 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8321 | obj = flow_delete() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8322 | _version = reader.read("!B")[0] |
| 8323 | assert(_version == 4) |
| 8324 | _type = reader.read("!B")[0] |
| 8325 | assert(_type == 14) |
| 8326 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8327 | orig_reader = reader |
| 8328 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8329 | obj.xid = reader.read("!L")[0] |
| 8330 | obj.cookie = reader.read("!Q")[0] |
| 8331 | obj.cookie_mask = reader.read("!Q")[0] |
| 8332 | obj.table_id = reader.read("!B")[0] |
| 8333 | __command = util.unpack_fm_cmd(reader) |
| 8334 | assert(__command == 3) |
| 8335 | obj.idle_timeout = reader.read("!H")[0] |
| 8336 | obj.hard_timeout = reader.read("!H")[0] |
| 8337 | obj.priority = reader.read("!H")[0] |
| 8338 | obj.buffer_id = reader.read("!L")[0] |
| 8339 | obj.out_port = util.unpack_port_no(reader) |
| 8340 | obj.out_group = reader.read("!L")[0] |
| 8341 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8342 | reader.skip(2) |
| 8343 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8344 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8345 | return obj |
| 8346 | |
| 8347 | def __eq__(self, other): |
| 8348 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8349 | if self.xid != other.xid: return False |
| 8350 | if self.cookie != other.cookie: return False |
| 8351 | if self.cookie_mask != other.cookie_mask: return False |
| 8352 | if self.table_id != other.table_id: return False |
| 8353 | if self.idle_timeout != other.idle_timeout: return False |
| 8354 | if self.hard_timeout != other.hard_timeout: return False |
| 8355 | if self.priority != other.priority: return False |
| 8356 | if self.buffer_id != other.buffer_id: return False |
| 8357 | if self.out_port != other.out_port: return False |
| 8358 | if self.out_group != other.out_group: return False |
| 8359 | if self.flags != other.flags: return False |
| 8360 | if self.match != other.match: return False |
| 8361 | if self.instructions != other.instructions: return False |
| 8362 | return True |
| 8363 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8364 | def pretty_print(self, q): |
| 8365 | q.text("flow_delete {") |
| 8366 | with q.group(): |
| 8367 | with q.indent(2): |
| 8368 | q.breakable() |
| 8369 | q.text("xid = "); |
| 8370 | if self.xid != None: |
| 8371 | q.text("%#x" % self.xid) |
| 8372 | else: |
| 8373 | q.text('None') |
| 8374 | q.text(","); q.breakable() |
| 8375 | q.text("cookie = "); |
| 8376 | q.text("%#x" % self.cookie) |
| 8377 | q.text(","); q.breakable() |
| 8378 | q.text("cookie_mask = "); |
| 8379 | q.text("%#x" % self.cookie_mask) |
| 8380 | q.text(","); q.breakable() |
| 8381 | q.text("table_id = "); |
| 8382 | q.text("%#x" % self.table_id) |
| 8383 | q.text(","); q.breakable() |
| 8384 | q.text("idle_timeout = "); |
| 8385 | q.text("%#x" % self.idle_timeout) |
| 8386 | q.text(","); q.breakable() |
| 8387 | q.text("hard_timeout = "); |
| 8388 | q.text("%#x" % self.hard_timeout) |
| 8389 | q.text(","); q.breakable() |
| 8390 | q.text("priority = "); |
| 8391 | q.text("%#x" % self.priority) |
| 8392 | q.text(","); q.breakable() |
| 8393 | q.text("buffer_id = "); |
| 8394 | q.text("%#x" % self.buffer_id) |
| 8395 | q.text(","); q.breakable() |
| 8396 | q.text("out_port = "); |
| 8397 | q.text(util.pretty_port(self.out_port)) |
| 8398 | q.text(","); q.breakable() |
| 8399 | q.text("out_group = "); |
| 8400 | q.text("%#x" % self.out_group) |
| 8401 | q.text(","); q.breakable() |
| 8402 | q.text("flags = "); |
| 8403 | q.text("%#x" % self.flags) |
| 8404 | q.text(","); q.breakable() |
| 8405 | q.text("match = "); |
| 8406 | q.pp(self.match) |
| 8407 | q.text(","); q.breakable() |
| 8408 | q.text("instructions = "); |
| 8409 | q.pp(self.instructions) |
| 8410 | q.breakable() |
| 8411 | q.text('}') |
| 8412 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8413 | flow_mod.subtypes[3] = flow_delete |
| 8414 | |
| 8415 | class flow_delete_strict(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8416 | version = 4 |
| 8417 | type = 14 |
| 8418 | _command = 4 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8419 | |
| 8420 | def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8421 | if xid != None: |
| 8422 | self.xid = xid |
| 8423 | else: |
| 8424 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8425 | if cookie != None: |
| 8426 | self.cookie = cookie |
| 8427 | else: |
| 8428 | self.cookie = 0 |
| 8429 | if cookie_mask != None: |
| 8430 | self.cookie_mask = cookie_mask |
| 8431 | else: |
| 8432 | self.cookie_mask = 0 |
| 8433 | if table_id != None: |
| 8434 | self.table_id = table_id |
| 8435 | else: |
| 8436 | self.table_id = 0 |
| 8437 | if idle_timeout != None: |
| 8438 | self.idle_timeout = idle_timeout |
| 8439 | else: |
| 8440 | self.idle_timeout = 0 |
| 8441 | if hard_timeout != None: |
| 8442 | self.hard_timeout = hard_timeout |
| 8443 | else: |
| 8444 | self.hard_timeout = 0 |
| 8445 | if priority != None: |
| 8446 | self.priority = priority |
| 8447 | else: |
| 8448 | self.priority = 0 |
| 8449 | if buffer_id != None: |
| 8450 | self.buffer_id = buffer_id |
| 8451 | else: |
| 8452 | self.buffer_id = 0 |
| 8453 | if out_port != None: |
| 8454 | self.out_port = out_port |
| 8455 | else: |
| 8456 | self.out_port = 0 |
| 8457 | if out_group != None: |
| 8458 | self.out_group = out_group |
| 8459 | else: |
| 8460 | self.out_group = 0 |
| 8461 | if flags != None: |
| 8462 | self.flags = flags |
| 8463 | else: |
| 8464 | self.flags = 0 |
| 8465 | if match != None: |
| 8466 | self.match = match |
| 8467 | else: |
| 8468 | self.match = common.match() |
| 8469 | if instructions != None: |
| 8470 | self.instructions = instructions |
| 8471 | else: |
| 8472 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8473 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8474 | |
| 8475 | def pack(self): |
| 8476 | packed = [] |
| 8477 | packed.append(struct.pack("!B", self.version)) |
| 8478 | packed.append(struct.pack("!B", self.type)) |
| 8479 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8480 | packed.append(struct.pack("!L", self.xid)) |
| 8481 | packed.append(struct.pack("!Q", self.cookie)) |
| 8482 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 8483 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8484 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8485 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 8486 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 8487 | packed.append(struct.pack("!H", self.priority)) |
| 8488 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8489 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8490 | packed.append(struct.pack("!L", self.out_group)) |
| 8491 | packed.append(struct.pack("!H", self.flags)) |
| 8492 | packed.append('\x00' * 2) |
| 8493 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8494 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8495 | length = sum([len(x) for x in packed]) |
| 8496 | packed[2] = struct.pack("!H", length) |
| 8497 | return ''.join(packed) |
| 8498 | |
| 8499 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8500 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8501 | obj = flow_delete_strict() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8502 | _version = reader.read("!B")[0] |
| 8503 | assert(_version == 4) |
| 8504 | _type = reader.read("!B")[0] |
| 8505 | assert(_type == 14) |
| 8506 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8507 | orig_reader = reader |
| 8508 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8509 | obj.xid = reader.read("!L")[0] |
| 8510 | obj.cookie = reader.read("!Q")[0] |
| 8511 | obj.cookie_mask = reader.read("!Q")[0] |
| 8512 | obj.table_id = reader.read("!B")[0] |
| 8513 | __command = util.unpack_fm_cmd(reader) |
| 8514 | assert(__command == 4) |
| 8515 | obj.idle_timeout = reader.read("!H")[0] |
| 8516 | obj.hard_timeout = reader.read("!H")[0] |
| 8517 | obj.priority = reader.read("!H")[0] |
| 8518 | obj.buffer_id = reader.read("!L")[0] |
| 8519 | obj.out_port = util.unpack_port_no(reader) |
| 8520 | obj.out_group = reader.read("!L")[0] |
| 8521 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8522 | reader.skip(2) |
| 8523 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8524 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8525 | return obj |
| 8526 | |
| 8527 | def __eq__(self, other): |
| 8528 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8529 | if self.xid != other.xid: return False |
| 8530 | if self.cookie != other.cookie: return False |
| 8531 | if self.cookie_mask != other.cookie_mask: return False |
| 8532 | if self.table_id != other.table_id: return False |
| 8533 | if self.idle_timeout != other.idle_timeout: return False |
| 8534 | if self.hard_timeout != other.hard_timeout: return False |
| 8535 | if self.priority != other.priority: return False |
| 8536 | if self.buffer_id != other.buffer_id: return False |
| 8537 | if self.out_port != other.out_port: return False |
| 8538 | if self.out_group != other.out_group: return False |
| 8539 | if self.flags != other.flags: return False |
| 8540 | if self.match != other.match: return False |
| 8541 | if self.instructions != other.instructions: return False |
| 8542 | return True |
| 8543 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8544 | def pretty_print(self, q): |
| 8545 | q.text("flow_delete_strict {") |
| 8546 | with q.group(): |
| 8547 | with q.indent(2): |
| 8548 | q.breakable() |
| 8549 | q.text("xid = "); |
| 8550 | if self.xid != None: |
| 8551 | q.text("%#x" % self.xid) |
| 8552 | else: |
| 8553 | q.text('None') |
| 8554 | q.text(","); q.breakable() |
| 8555 | q.text("cookie = "); |
| 8556 | q.text("%#x" % self.cookie) |
| 8557 | q.text(","); q.breakable() |
| 8558 | q.text("cookie_mask = "); |
| 8559 | q.text("%#x" % self.cookie_mask) |
| 8560 | q.text(","); q.breakable() |
| 8561 | q.text("table_id = "); |
| 8562 | q.text("%#x" % self.table_id) |
| 8563 | q.text(","); q.breakable() |
| 8564 | q.text("idle_timeout = "); |
| 8565 | q.text("%#x" % self.idle_timeout) |
| 8566 | q.text(","); q.breakable() |
| 8567 | q.text("hard_timeout = "); |
| 8568 | q.text("%#x" % self.hard_timeout) |
| 8569 | q.text(","); q.breakable() |
| 8570 | q.text("priority = "); |
| 8571 | q.text("%#x" % self.priority) |
| 8572 | q.text(","); q.breakable() |
| 8573 | q.text("buffer_id = "); |
| 8574 | q.text("%#x" % self.buffer_id) |
| 8575 | q.text(","); q.breakable() |
| 8576 | q.text("out_port = "); |
| 8577 | q.text(util.pretty_port(self.out_port)) |
| 8578 | q.text(","); q.breakable() |
| 8579 | q.text("out_group = "); |
| 8580 | q.text("%#x" % self.out_group) |
| 8581 | q.text(","); q.breakable() |
| 8582 | q.text("flags = "); |
| 8583 | q.text("%#x" % self.flags) |
| 8584 | q.text(","); q.breakable() |
| 8585 | q.text("match = "); |
| 8586 | q.pp(self.match) |
| 8587 | q.text(","); q.breakable() |
| 8588 | q.text("instructions = "); |
| 8589 | q.pp(self.instructions) |
| 8590 | q.breakable() |
| 8591 | q.text('}') |
| 8592 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8593 | flow_mod.subtypes[4] = flow_delete_strict |
| 8594 | |
| 8595 | class flow_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8596 | version = 4 |
| 8597 | type = 1 |
| 8598 | err_type = 5 |
| 8599 | |
| 8600 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8601 | if xid != None: |
| 8602 | self.xid = xid |
| 8603 | else: |
| 8604 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8605 | if code != None: |
| 8606 | self.code = code |
| 8607 | else: |
| 8608 | self.code = 0 |
| 8609 | if data != None: |
| 8610 | self.data = data |
| 8611 | else: |
| 8612 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8613 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8614 | |
| 8615 | def pack(self): |
| 8616 | packed = [] |
| 8617 | packed.append(struct.pack("!B", self.version)) |
| 8618 | packed.append(struct.pack("!B", self.type)) |
| 8619 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8620 | packed.append(struct.pack("!L", self.xid)) |
| 8621 | packed.append(struct.pack("!H", self.err_type)) |
| 8622 | packed.append(struct.pack("!H", self.code)) |
| 8623 | packed.append(self.data) |
| 8624 | length = sum([len(x) for x in packed]) |
| 8625 | packed[2] = struct.pack("!H", length) |
| 8626 | return ''.join(packed) |
| 8627 | |
| 8628 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8629 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8630 | obj = flow_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8631 | _version = reader.read("!B")[0] |
| 8632 | assert(_version == 4) |
| 8633 | _type = reader.read("!B")[0] |
| 8634 | assert(_type == 1) |
| 8635 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8636 | orig_reader = reader |
| 8637 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8638 | obj.xid = reader.read("!L")[0] |
| 8639 | _err_type = reader.read("!H")[0] |
| 8640 | assert(_err_type == 5) |
| 8641 | obj.code = reader.read("!H")[0] |
| 8642 | obj.data = str(reader.read_all()) |
| 8643 | return obj |
| 8644 | |
| 8645 | def __eq__(self, other): |
| 8646 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8647 | if self.xid != other.xid: return False |
| 8648 | if self.code != other.code: return False |
| 8649 | if self.data != other.data: return False |
| 8650 | return True |
| 8651 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8652 | def pretty_print(self, q): |
| 8653 | q.text("flow_mod_failed_error_msg {") |
| 8654 | with q.group(): |
| 8655 | with q.indent(2): |
| 8656 | q.breakable() |
| 8657 | q.text("xid = "); |
| 8658 | if self.xid != None: |
| 8659 | q.text("%#x" % self.xid) |
| 8660 | else: |
| 8661 | q.text('None') |
| 8662 | q.text(","); q.breakable() |
| 8663 | q.text("code = "); |
| 8664 | q.text("%#x" % self.code) |
| 8665 | q.text(","); q.breakable() |
| 8666 | q.text("data = "); |
| 8667 | q.pp(self.data) |
| 8668 | q.breakable() |
| 8669 | q.text('}') |
| 8670 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8671 | error_msg.subtypes[5] = flow_mod_failed_error_msg |
| 8672 | |
| 8673 | class flow_modify(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8674 | version = 4 |
| 8675 | type = 14 |
| 8676 | _command = 1 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8677 | |
| 8678 | def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8679 | if xid != None: |
| 8680 | self.xid = xid |
| 8681 | else: |
| 8682 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8683 | if cookie != None: |
| 8684 | self.cookie = cookie |
| 8685 | else: |
| 8686 | self.cookie = 0 |
| 8687 | if cookie_mask != None: |
| 8688 | self.cookie_mask = cookie_mask |
| 8689 | else: |
| 8690 | self.cookie_mask = 0 |
| 8691 | if table_id != None: |
| 8692 | self.table_id = table_id |
| 8693 | else: |
| 8694 | self.table_id = 0 |
| 8695 | if idle_timeout != None: |
| 8696 | self.idle_timeout = idle_timeout |
| 8697 | else: |
| 8698 | self.idle_timeout = 0 |
| 8699 | if hard_timeout != None: |
| 8700 | self.hard_timeout = hard_timeout |
| 8701 | else: |
| 8702 | self.hard_timeout = 0 |
| 8703 | if priority != None: |
| 8704 | self.priority = priority |
| 8705 | else: |
| 8706 | self.priority = 0 |
| 8707 | if buffer_id != None: |
| 8708 | self.buffer_id = buffer_id |
| 8709 | else: |
| 8710 | self.buffer_id = 0 |
| 8711 | if out_port != None: |
| 8712 | self.out_port = out_port |
| 8713 | else: |
| 8714 | self.out_port = 0 |
| 8715 | if out_group != None: |
| 8716 | self.out_group = out_group |
| 8717 | else: |
| 8718 | self.out_group = 0 |
| 8719 | if flags != None: |
| 8720 | self.flags = flags |
| 8721 | else: |
| 8722 | self.flags = 0 |
| 8723 | if match != None: |
| 8724 | self.match = match |
| 8725 | else: |
| 8726 | self.match = common.match() |
| 8727 | if instructions != None: |
| 8728 | self.instructions = instructions |
| 8729 | else: |
| 8730 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8731 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8732 | |
| 8733 | def pack(self): |
| 8734 | packed = [] |
| 8735 | packed.append(struct.pack("!B", self.version)) |
| 8736 | packed.append(struct.pack("!B", self.type)) |
| 8737 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8738 | packed.append(struct.pack("!L", self.xid)) |
| 8739 | packed.append(struct.pack("!Q", self.cookie)) |
| 8740 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 8741 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8742 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8743 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 8744 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 8745 | packed.append(struct.pack("!H", self.priority)) |
| 8746 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8747 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8748 | packed.append(struct.pack("!L", self.out_group)) |
| 8749 | packed.append(struct.pack("!H", self.flags)) |
| 8750 | packed.append('\x00' * 2) |
| 8751 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8752 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8753 | length = sum([len(x) for x in packed]) |
| 8754 | packed[2] = struct.pack("!H", length) |
| 8755 | return ''.join(packed) |
| 8756 | |
| 8757 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8758 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8759 | obj = flow_modify() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8760 | _version = reader.read("!B")[0] |
| 8761 | assert(_version == 4) |
| 8762 | _type = reader.read("!B")[0] |
| 8763 | assert(_type == 14) |
| 8764 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8765 | orig_reader = reader |
| 8766 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8767 | obj.xid = reader.read("!L")[0] |
| 8768 | obj.cookie = reader.read("!Q")[0] |
| 8769 | obj.cookie_mask = reader.read("!Q")[0] |
| 8770 | obj.table_id = reader.read("!B")[0] |
| 8771 | __command = util.unpack_fm_cmd(reader) |
| 8772 | assert(__command == 1) |
| 8773 | obj.idle_timeout = reader.read("!H")[0] |
| 8774 | obj.hard_timeout = reader.read("!H")[0] |
| 8775 | obj.priority = reader.read("!H")[0] |
| 8776 | obj.buffer_id = reader.read("!L")[0] |
| 8777 | obj.out_port = util.unpack_port_no(reader) |
| 8778 | obj.out_group = reader.read("!L")[0] |
| 8779 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8780 | reader.skip(2) |
| 8781 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8782 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8783 | return obj |
| 8784 | |
| 8785 | def __eq__(self, other): |
| 8786 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8787 | if self.xid != other.xid: return False |
| 8788 | if self.cookie != other.cookie: return False |
| 8789 | if self.cookie_mask != other.cookie_mask: return False |
| 8790 | if self.table_id != other.table_id: return False |
| 8791 | if self.idle_timeout != other.idle_timeout: return False |
| 8792 | if self.hard_timeout != other.hard_timeout: return False |
| 8793 | if self.priority != other.priority: return False |
| 8794 | if self.buffer_id != other.buffer_id: return False |
| 8795 | if self.out_port != other.out_port: return False |
| 8796 | if self.out_group != other.out_group: return False |
| 8797 | if self.flags != other.flags: return False |
| 8798 | if self.match != other.match: return False |
| 8799 | if self.instructions != other.instructions: return False |
| 8800 | return True |
| 8801 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8802 | def pretty_print(self, q): |
| 8803 | q.text("flow_modify {") |
| 8804 | with q.group(): |
| 8805 | with q.indent(2): |
| 8806 | q.breakable() |
| 8807 | q.text("xid = "); |
| 8808 | if self.xid != None: |
| 8809 | q.text("%#x" % self.xid) |
| 8810 | else: |
| 8811 | q.text('None') |
| 8812 | q.text(","); q.breakable() |
| 8813 | q.text("cookie = "); |
| 8814 | q.text("%#x" % self.cookie) |
| 8815 | q.text(","); q.breakable() |
| 8816 | q.text("cookie_mask = "); |
| 8817 | q.text("%#x" % self.cookie_mask) |
| 8818 | q.text(","); q.breakable() |
| 8819 | q.text("table_id = "); |
| 8820 | q.text("%#x" % self.table_id) |
| 8821 | q.text(","); q.breakable() |
| 8822 | q.text("idle_timeout = "); |
| 8823 | q.text("%#x" % self.idle_timeout) |
| 8824 | q.text(","); q.breakable() |
| 8825 | q.text("hard_timeout = "); |
| 8826 | q.text("%#x" % self.hard_timeout) |
| 8827 | q.text(","); q.breakable() |
| 8828 | q.text("priority = "); |
| 8829 | q.text("%#x" % self.priority) |
| 8830 | q.text(","); q.breakable() |
| 8831 | q.text("buffer_id = "); |
| 8832 | q.text("%#x" % self.buffer_id) |
| 8833 | q.text(","); q.breakable() |
| 8834 | q.text("out_port = "); |
| 8835 | q.text(util.pretty_port(self.out_port)) |
| 8836 | q.text(","); q.breakable() |
| 8837 | q.text("out_group = "); |
| 8838 | q.text("%#x" % self.out_group) |
| 8839 | q.text(","); q.breakable() |
| 8840 | q.text("flags = "); |
| 8841 | q.text("%#x" % self.flags) |
| 8842 | q.text(","); q.breakable() |
| 8843 | q.text("match = "); |
| 8844 | q.pp(self.match) |
| 8845 | q.text(","); q.breakable() |
| 8846 | q.text("instructions = "); |
| 8847 | q.pp(self.instructions) |
| 8848 | q.breakable() |
| 8849 | q.text('}') |
| 8850 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8851 | flow_mod.subtypes[1] = flow_modify |
| 8852 | |
| 8853 | class flow_modify_strict(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8854 | version = 4 |
| 8855 | type = 14 |
| 8856 | _command = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8857 | |
| 8858 | def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8859 | if xid != None: |
| 8860 | self.xid = xid |
| 8861 | else: |
| 8862 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8863 | if cookie != None: |
| 8864 | self.cookie = cookie |
| 8865 | else: |
| 8866 | self.cookie = 0 |
| 8867 | if cookie_mask != None: |
| 8868 | self.cookie_mask = cookie_mask |
| 8869 | else: |
| 8870 | self.cookie_mask = 0 |
| 8871 | if table_id != None: |
| 8872 | self.table_id = table_id |
| 8873 | else: |
| 8874 | self.table_id = 0 |
| 8875 | if idle_timeout != None: |
| 8876 | self.idle_timeout = idle_timeout |
| 8877 | else: |
| 8878 | self.idle_timeout = 0 |
| 8879 | if hard_timeout != None: |
| 8880 | self.hard_timeout = hard_timeout |
| 8881 | else: |
| 8882 | self.hard_timeout = 0 |
| 8883 | if priority != None: |
| 8884 | self.priority = priority |
| 8885 | else: |
| 8886 | self.priority = 0 |
| 8887 | if buffer_id != None: |
| 8888 | self.buffer_id = buffer_id |
| 8889 | else: |
| 8890 | self.buffer_id = 0 |
| 8891 | if out_port != None: |
| 8892 | self.out_port = out_port |
| 8893 | else: |
| 8894 | self.out_port = 0 |
| 8895 | if out_group != None: |
| 8896 | self.out_group = out_group |
| 8897 | else: |
| 8898 | self.out_group = 0 |
| 8899 | if flags != None: |
| 8900 | self.flags = flags |
| 8901 | else: |
| 8902 | self.flags = 0 |
| 8903 | if match != None: |
| 8904 | self.match = match |
| 8905 | else: |
| 8906 | self.match = common.match() |
| 8907 | if instructions != None: |
| 8908 | self.instructions = instructions |
| 8909 | else: |
| 8910 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8911 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8912 | |
| 8913 | def pack(self): |
| 8914 | packed = [] |
| 8915 | packed.append(struct.pack("!B", self.version)) |
| 8916 | packed.append(struct.pack("!B", self.type)) |
| 8917 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8918 | packed.append(struct.pack("!L", self.xid)) |
| 8919 | packed.append(struct.pack("!Q", self.cookie)) |
| 8920 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 8921 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8922 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8923 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 8924 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 8925 | packed.append(struct.pack("!H", self.priority)) |
| 8926 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8927 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8928 | packed.append(struct.pack("!L", self.out_group)) |
| 8929 | packed.append(struct.pack("!H", self.flags)) |
| 8930 | packed.append('\x00' * 2) |
| 8931 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8932 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8933 | length = sum([len(x) for x in packed]) |
| 8934 | packed[2] = struct.pack("!H", length) |
| 8935 | return ''.join(packed) |
| 8936 | |
| 8937 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8938 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8939 | obj = flow_modify_strict() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8940 | _version = reader.read("!B")[0] |
| 8941 | assert(_version == 4) |
| 8942 | _type = reader.read("!B")[0] |
| 8943 | assert(_type == 14) |
| 8944 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8945 | orig_reader = reader |
| 8946 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8947 | obj.xid = reader.read("!L")[0] |
| 8948 | obj.cookie = reader.read("!Q")[0] |
| 8949 | obj.cookie_mask = reader.read("!Q")[0] |
| 8950 | obj.table_id = reader.read("!B")[0] |
| 8951 | __command = util.unpack_fm_cmd(reader) |
| 8952 | assert(__command == 2) |
| 8953 | obj.idle_timeout = reader.read("!H")[0] |
| 8954 | obj.hard_timeout = reader.read("!H")[0] |
| 8955 | obj.priority = reader.read("!H")[0] |
| 8956 | obj.buffer_id = reader.read("!L")[0] |
| 8957 | obj.out_port = util.unpack_port_no(reader) |
| 8958 | obj.out_group = reader.read("!L")[0] |
| 8959 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8960 | reader.skip(2) |
| 8961 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8962 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8963 | return obj |
| 8964 | |
| 8965 | def __eq__(self, other): |
| 8966 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8967 | if self.xid != other.xid: return False |
| 8968 | if self.cookie != other.cookie: return False |
| 8969 | if self.cookie_mask != other.cookie_mask: return False |
| 8970 | if self.table_id != other.table_id: return False |
| 8971 | if self.idle_timeout != other.idle_timeout: return False |
| 8972 | if self.hard_timeout != other.hard_timeout: return False |
| 8973 | if self.priority != other.priority: return False |
| 8974 | if self.buffer_id != other.buffer_id: return False |
| 8975 | if self.out_port != other.out_port: return False |
| 8976 | if self.out_group != other.out_group: return False |
| 8977 | if self.flags != other.flags: return False |
| 8978 | if self.match != other.match: return False |
| 8979 | if self.instructions != other.instructions: return False |
| 8980 | return True |
| 8981 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8982 | def pretty_print(self, q): |
| 8983 | q.text("flow_modify_strict {") |
| 8984 | with q.group(): |
| 8985 | with q.indent(2): |
| 8986 | q.breakable() |
| 8987 | q.text("xid = "); |
| 8988 | if self.xid != None: |
| 8989 | q.text("%#x" % self.xid) |
| 8990 | else: |
| 8991 | q.text('None') |
| 8992 | q.text(","); q.breakable() |
| 8993 | q.text("cookie = "); |
| 8994 | q.text("%#x" % self.cookie) |
| 8995 | q.text(","); q.breakable() |
| 8996 | q.text("cookie_mask = "); |
| 8997 | q.text("%#x" % self.cookie_mask) |
| 8998 | q.text(","); q.breakable() |
| 8999 | q.text("table_id = "); |
| 9000 | q.text("%#x" % self.table_id) |
| 9001 | q.text(","); q.breakable() |
| 9002 | q.text("idle_timeout = "); |
| 9003 | q.text("%#x" % self.idle_timeout) |
| 9004 | q.text(","); q.breakable() |
| 9005 | q.text("hard_timeout = "); |
| 9006 | q.text("%#x" % self.hard_timeout) |
| 9007 | q.text(","); q.breakable() |
| 9008 | q.text("priority = "); |
| 9009 | q.text("%#x" % self.priority) |
| 9010 | q.text(","); q.breakable() |
| 9011 | q.text("buffer_id = "); |
| 9012 | q.text("%#x" % self.buffer_id) |
| 9013 | q.text(","); q.breakable() |
| 9014 | q.text("out_port = "); |
| 9015 | q.text(util.pretty_port(self.out_port)) |
| 9016 | q.text(","); q.breakable() |
| 9017 | q.text("out_group = "); |
| 9018 | q.text("%#x" % self.out_group) |
| 9019 | q.text(","); q.breakable() |
| 9020 | q.text("flags = "); |
| 9021 | q.text("%#x" % self.flags) |
| 9022 | q.text(","); q.breakable() |
| 9023 | q.text("match = "); |
| 9024 | q.pp(self.match) |
| 9025 | q.text(","); q.breakable() |
| 9026 | q.text("instructions = "); |
| 9027 | q.pp(self.instructions) |
| 9028 | q.breakable() |
| 9029 | q.text('}') |
| 9030 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9031 | flow_mod.subtypes[2] = flow_modify_strict |
| 9032 | |
| 9033 | class flow_removed(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9034 | version = 4 |
| 9035 | type = 11 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9036 | |
| 9037 | 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): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9038 | if xid != None: |
| 9039 | self.xid = xid |
| 9040 | else: |
| 9041 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9042 | if cookie != None: |
| 9043 | self.cookie = cookie |
| 9044 | else: |
| 9045 | self.cookie = 0 |
| 9046 | if priority != None: |
| 9047 | self.priority = priority |
| 9048 | else: |
| 9049 | self.priority = 0 |
| 9050 | if reason != None: |
| 9051 | self.reason = reason |
| 9052 | else: |
| 9053 | self.reason = 0 |
| 9054 | if table_id != None: |
| 9055 | self.table_id = table_id |
| 9056 | else: |
| 9057 | self.table_id = 0 |
| 9058 | if duration_sec != None: |
| 9059 | self.duration_sec = duration_sec |
| 9060 | else: |
| 9061 | self.duration_sec = 0 |
| 9062 | if duration_nsec != None: |
| 9063 | self.duration_nsec = duration_nsec |
| 9064 | else: |
| 9065 | self.duration_nsec = 0 |
| 9066 | if idle_timeout != None: |
| 9067 | self.idle_timeout = idle_timeout |
| 9068 | else: |
| 9069 | self.idle_timeout = 0 |
| 9070 | if hard_timeout != None: |
| 9071 | self.hard_timeout = hard_timeout |
| 9072 | else: |
| 9073 | self.hard_timeout = 0 |
| 9074 | if packet_count != None: |
| 9075 | self.packet_count = packet_count |
| 9076 | else: |
| 9077 | self.packet_count = 0 |
| 9078 | if byte_count != None: |
| 9079 | self.byte_count = byte_count |
| 9080 | else: |
| 9081 | self.byte_count = 0 |
| 9082 | if match != None: |
| 9083 | self.match = match |
| 9084 | else: |
| 9085 | self.match = common.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9086 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9087 | |
| 9088 | def pack(self): |
| 9089 | packed = [] |
| 9090 | packed.append(struct.pack("!B", self.version)) |
| 9091 | packed.append(struct.pack("!B", self.type)) |
| 9092 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9093 | packed.append(struct.pack("!L", self.xid)) |
| 9094 | packed.append(struct.pack("!Q", self.cookie)) |
| 9095 | packed.append(struct.pack("!H", self.priority)) |
| 9096 | packed.append(struct.pack("!B", self.reason)) |
| 9097 | packed.append(struct.pack("!B", self.table_id)) |
| 9098 | packed.append(struct.pack("!L", self.duration_sec)) |
| 9099 | packed.append(struct.pack("!L", self.duration_nsec)) |
| 9100 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 9101 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 9102 | packed.append(struct.pack("!Q", self.packet_count)) |
| 9103 | packed.append(struct.pack("!Q", self.byte_count)) |
| 9104 | packed.append(self.match.pack()) |
| 9105 | length = sum([len(x) for x in packed]) |
| 9106 | packed[2] = struct.pack("!H", length) |
| 9107 | return ''.join(packed) |
| 9108 | |
| 9109 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9110 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9111 | obj = flow_removed() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9112 | _version = reader.read("!B")[0] |
| 9113 | assert(_version == 4) |
| 9114 | _type = reader.read("!B")[0] |
| 9115 | assert(_type == 11) |
| 9116 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9117 | orig_reader = reader |
| 9118 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9119 | obj.xid = reader.read("!L")[0] |
| 9120 | obj.cookie = reader.read("!Q")[0] |
| 9121 | obj.priority = reader.read("!H")[0] |
| 9122 | obj.reason = reader.read("!B")[0] |
| 9123 | obj.table_id = reader.read("!B")[0] |
| 9124 | obj.duration_sec = reader.read("!L")[0] |
| 9125 | obj.duration_nsec = reader.read("!L")[0] |
| 9126 | obj.idle_timeout = reader.read("!H")[0] |
| 9127 | obj.hard_timeout = reader.read("!H")[0] |
| 9128 | obj.packet_count = reader.read("!Q")[0] |
| 9129 | obj.byte_count = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9130 | obj.match = common.match.unpack(reader) |
| 9131 | return obj |
| 9132 | |
| 9133 | def __eq__(self, other): |
| 9134 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9135 | if self.xid != other.xid: return False |
| 9136 | if self.cookie != other.cookie: return False |
| 9137 | if self.priority != other.priority: return False |
| 9138 | if self.reason != other.reason: return False |
| 9139 | if self.table_id != other.table_id: return False |
| 9140 | if self.duration_sec != other.duration_sec: return False |
| 9141 | if self.duration_nsec != other.duration_nsec: return False |
| 9142 | if self.idle_timeout != other.idle_timeout: return False |
| 9143 | if self.hard_timeout != other.hard_timeout: return False |
| 9144 | if self.packet_count != other.packet_count: return False |
| 9145 | if self.byte_count != other.byte_count: return False |
| 9146 | if self.match != other.match: return False |
| 9147 | return True |
| 9148 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9149 | def pretty_print(self, q): |
| 9150 | q.text("flow_removed {") |
| 9151 | with q.group(): |
| 9152 | with q.indent(2): |
| 9153 | q.breakable() |
| 9154 | q.text("xid = "); |
| 9155 | if self.xid != None: |
| 9156 | q.text("%#x" % self.xid) |
| 9157 | else: |
| 9158 | q.text('None') |
| 9159 | q.text(","); q.breakable() |
| 9160 | q.text("cookie = "); |
| 9161 | q.text("%#x" % self.cookie) |
| 9162 | q.text(","); q.breakable() |
| 9163 | q.text("priority = "); |
| 9164 | q.text("%#x" % self.priority) |
| 9165 | q.text(","); q.breakable() |
| 9166 | q.text("reason = "); |
| 9167 | q.text("%#x" % self.reason) |
| 9168 | q.text(","); q.breakable() |
| 9169 | q.text("table_id = "); |
| 9170 | q.text("%#x" % self.table_id) |
| 9171 | q.text(","); q.breakable() |
| 9172 | q.text("duration_sec = "); |
| 9173 | q.text("%#x" % self.duration_sec) |
| 9174 | q.text(","); q.breakable() |
| 9175 | q.text("duration_nsec = "); |
| 9176 | q.text("%#x" % self.duration_nsec) |
| 9177 | q.text(","); q.breakable() |
| 9178 | q.text("idle_timeout = "); |
| 9179 | q.text("%#x" % self.idle_timeout) |
| 9180 | q.text(","); q.breakable() |
| 9181 | q.text("hard_timeout = "); |
| 9182 | q.text("%#x" % self.hard_timeout) |
| 9183 | q.text(","); q.breakable() |
| 9184 | q.text("packet_count = "); |
| 9185 | q.text("%#x" % self.packet_count) |
| 9186 | q.text(","); q.breakable() |
| 9187 | q.text("byte_count = "); |
| 9188 | q.text("%#x" % self.byte_count) |
| 9189 | q.text(","); q.breakable() |
| 9190 | q.text("match = "); |
| 9191 | q.pp(self.match) |
| 9192 | q.breakable() |
| 9193 | q.text('}') |
| 9194 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9195 | message.subtypes[11] = flow_removed |
| 9196 | |
| 9197 | class flow_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9198 | version = 4 |
| 9199 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9200 | stats_type = 1 |
| 9201 | |
| 9202 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9203 | if xid != None: |
| 9204 | self.xid = xid |
| 9205 | else: |
| 9206 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9207 | if flags != None: |
| 9208 | self.flags = flags |
| 9209 | else: |
| 9210 | self.flags = 0 |
| 9211 | if entries != None: |
| 9212 | self.entries = entries |
| 9213 | else: |
| 9214 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9215 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9216 | |
| 9217 | def pack(self): |
| 9218 | packed = [] |
| 9219 | packed.append(struct.pack("!B", self.version)) |
| 9220 | packed.append(struct.pack("!B", self.type)) |
| 9221 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9222 | packed.append(struct.pack("!L", self.xid)) |
| 9223 | packed.append(struct.pack("!H", self.stats_type)) |
| 9224 | packed.append(struct.pack("!H", self.flags)) |
| 9225 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9226 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9227 | length = sum([len(x) for x in packed]) |
| 9228 | packed[2] = struct.pack("!H", length) |
| 9229 | return ''.join(packed) |
| 9230 | |
| 9231 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9232 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9233 | obj = flow_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9234 | _version = reader.read("!B")[0] |
| 9235 | assert(_version == 4) |
| 9236 | _type = reader.read("!B")[0] |
| 9237 | assert(_type == 19) |
| 9238 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9239 | orig_reader = reader |
| 9240 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9241 | obj.xid = reader.read("!L")[0] |
| 9242 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9243 | assert(_stats_type == 1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9244 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9245 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9246 | obj.entries = loxi.generic_util.unpack_list(reader, common.flow_stats_entry.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9247 | return obj |
| 9248 | |
| 9249 | def __eq__(self, other): |
| 9250 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9251 | if self.xid != other.xid: return False |
| 9252 | if self.flags != other.flags: return False |
| 9253 | if self.entries != other.entries: return False |
| 9254 | return True |
| 9255 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9256 | def pretty_print(self, q): |
| 9257 | q.text("flow_stats_reply {") |
| 9258 | with q.group(): |
| 9259 | with q.indent(2): |
| 9260 | q.breakable() |
| 9261 | q.text("xid = "); |
| 9262 | if self.xid != None: |
| 9263 | q.text("%#x" % self.xid) |
| 9264 | else: |
| 9265 | q.text('None') |
| 9266 | q.text(","); q.breakable() |
| 9267 | q.text("flags = "); |
| 9268 | q.text("%#x" % self.flags) |
| 9269 | q.text(","); q.breakable() |
| 9270 | q.text("entries = "); |
| 9271 | q.pp(self.entries) |
| 9272 | q.breakable() |
| 9273 | q.text('}') |
| 9274 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9275 | stats_reply.subtypes[1] = flow_stats_reply |
| 9276 | |
| 9277 | class flow_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9278 | version = 4 |
| 9279 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9280 | stats_type = 1 |
| 9281 | |
| 9282 | def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9283 | if xid != None: |
| 9284 | self.xid = xid |
| 9285 | else: |
| 9286 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9287 | if flags != None: |
| 9288 | self.flags = flags |
| 9289 | else: |
| 9290 | self.flags = 0 |
| 9291 | if table_id != None: |
| 9292 | self.table_id = table_id |
| 9293 | else: |
| 9294 | self.table_id = 0 |
| 9295 | if out_port != None: |
| 9296 | self.out_port = out_port |
| 9297 | else: |
| 9298 | self.out_port = 0 |
| 9299 | if out_group != None: |
| 9300 | self.out_group = out_group |
| 9301 | else: |
| 9302 | self.out_group = 0 |
| 9303 | if cookie != None: |
| 9304 | self.cookie = cookie |
| 9305 | else: |
| 9306 | self.cookie = 0 |
| 9307 | if cookie_mask != None: |
| 9308 | self.cookie_mask = cookie_mask |
| 9309 | else: |
| 9310 | self.cookie_mask = 0 |
| 9311 | if match != None: |
| 9312 | self.match = match |
| 9313 | else: |
| 9314 | self.match = common.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9315 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9316 | |
| 9317 | def pack(self): |
| 9318 | packed = [] |
| 9319 | packed.append(struct.pack("!B", self.version)) |
| 9320 | packed.append(struct.pack("!B", self.type)) |
| 9321 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9322 | packed.append(struct.pack("!L", self.xid)) |
| 9323 | packed.append(struct.pack("!H", self.stats_type)) |
| 9324 | packed.append(struct.pack("!H", self.flags)) |
| 9325 | packed.append('\x00' * 4) |
| 9326 | packed.append(struct.pack("!B", self.table_id)) |
| 9327 | packed.append('\x00' * 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9328 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9329 | packed.append(struct.pack("!L", self.out_group)) |
| 9330 | packed.append('\x00' * 4) |
| 9331 | packed.append(struct.pack("!Q", self.cookie)) |
| 9332 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 9333 | packed.append(self.match.pack()) |
| 9334 | length = sum([len(x) for x in packed]) |
| 9335 | packed[2] = struct.pack("!H", length) |
| 9336 | return ''.join(packed) |
| 9337 | |
| 9338 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9339 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9340 | obj = flow_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9341 | _version = reader.read("!B")[0] |
| 9342 | assert(_version == 4) |
| 9343 | _type = reader.read("!B")[0] |
| 9344 | assert(_type == 18) |
| 9345 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9346 | orig_reader = reader |
| 9347 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9348 | obj.xid = reader.read("!L")[0] |
| 9349 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9350 | assert(_stats_type == 1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9351 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9352 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9353 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9354 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9355 | obj.out_port = util.unpack_port_no(reader) |
| 9356 | obj.out_group = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9357 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9358 | obj.cookie = reader.read("!Q")[0] |
| 9359 | obj.cookie_mask = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9360 | obj.match = common.match.unpack(reader) |
| 9361 | return obj |
| 9362 | |
| 9363 | def __eq__(self, other): |
| 9364 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9365 | if self.xid != other.xid: return False |
| 9366 | if self.flags != other.flags: return False |
| 9367 | if self.table_id != other.table_id: return False |
| 9368 | if self.out_port != other.out_port: return False |
| 9369 | if self.out_group != other.out_group: return False |
| 9370 | if self.cookie != other.cookie: return False |
| 9371 | if self.cookie_mask != other.cookie_mask: return False |
| 9372 | if self.match != other.match: return False |
| 9373 | return True |
| 9374 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9375 | def pretty_print(self, q): |
| 9376 | q.text("flow_stats_request {") |
| 9377 | with q.group(): |
| 9378 | with q.indent(2): |
| 9379 | q.breakable() |
| 9380 | q.text("xid = "); |
| 9381 | if self.xid != None: |
| 9382 | q.text("%#x" % self.xid) |
| 9383 | else: |
| 9384 | q.text('None') |
| 9385 | q.text(","); q.breakable() |
| 9386 | q.text("flags = "); |
| 9387 | q.text("%#x" % self.flags) |
| 9388 | q.text(","); q.breakable() |
| 9389 | q.text("table_id = "); |
| 9390 | q.text("%#x" % self.table_id) |
| 9391 | q.text(","); q.breakable() |
| 9392 | q.text("out_port = "); |
| 9393 | q.text(util.pretty_port(self.out_port)) |
| 9394 | q.text(","); q.breakable() |
| 9395 | q.text("out_group = "); |
| 9396 | q.text("%#x" % self.out_group) |
| 9397 | q.text(","); q.breakable() |
| 9398 | q.text("cookie = "); |
| 9399 | q.text("%#x" % self.cookie) |
| 9400 | q.text(","); q.breakable() |
| 9401 | q.text("cookie_mask = "); |
| 9402 | q.text("%#x" % self.cookie_mask) |
| 9403 | q.text(","); q.breakable() |
| 9404 | q.text("match = "); |
| 9405 | q.pp(self.match) |
| 9406 | q.breakable() |
| 9407 | q.text('}') |
| 9408 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9409 | stats_request.subtypes[1] = flow_stats_request |
| 9410 | |
| 9411 | class get_config_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9412 | version = 4 |
| 9413 | type = 8 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9414 | |
| 9415 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9416 | if xid != None: |
| 9417 | self.xid = xid |
| 9418 | else: |
| 9419 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9420 | if flags != None: |
| 9421 | self.flags = flags |
| 9422 | else: |
| 9423 | self.flags = 0 |
| 9424 | if miss_send_len != None: |
| 9425 | self.miss_send_len = miss_send_len |
| 9426 | else: |
| 9427 | self.miss_send_len = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9428 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9429 | |
| 9430 | def pack(self): |
| 9431 | packed = [] |
| 9432 | packed.append(struct.pack("!B", self.version)) |
| 9433 | packed.append(struct.pack("!B", self.type)) |
| 9434 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9435 | packed.append(struct.pack("!L", self.xid)) |
| 9436 | packed.append(struct.pack("!H", self.flags)) |
| 9437 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 9438 | length = sum([len(x) for x in packed]) |
| 9439 | packed[2] = struct.pack("!H", length) |
| 9440 | return ''.join(packed) |
| 9441 | |
| 9442 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9443 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9444 | obj = get_config_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9445 | _version = reader.read("!B")[0] |
| 9446 | assert(_version == 4) |
| 9447 | _type = reader.read("!B")[0] |
| 9448 | assert(_type == 8) |
| 9449 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9450 | orig_reader = reader |
| 9451 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9452 | obj.xid = reader.read("!L")[0] |
| 9453 | obj.flags = reader.read("!H")[0] |
| 9454 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9455 | return obj |
| 9456 | |
| 9457 | def __eq__(self, other): |
| 9458 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9459 | if self.xid != other.xid: return False |
| 9460 | if self.flags != other.flags: return False |
| 9461 | if self.miss_send_len != other.miss_send_len: return False |
| 9462 | return True |
| 9463 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9464 | def pretty_print(self, q): |
| 9465 | q.text("get_config_reply {") |
| 9466 | with q.group(): |
| 9467 | with q.indent(2): |
| 9468 | q.breakable() |
| 9469 | q.text("xid = "); |
| 9470 | if self.xid != None: |
| 9471 | q.text("%#x" % self.xid) |
| 9472 | else: |
| 9473 | q.text('None') |
| 9474 | q.text(","); q.breakable() |
| 9475 | q.text("flags = "); |
| 9476 | q.text("%#x" % self.flags) |
| 9477 | q.text(","); q.breakable() |
| 9478 | q.text("miss_send_len = "); |
| 9479 | q.text("%#x" % self.miss_send_len) |
| 9480 | q.breakable() |
| 9481 | q.text('}') |
| 9482 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9483 | message.subtypes[8] = get_config_reply |
| 9484 | |
| 9485 | class get_config_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9486 | version = 4 |
| 9487 | type = 7 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9488 | |
| 9489 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9490 | if xid != None: |
| 9491 | self.xid = xid |
| 9492 | else: |
| 9493 | self.xid = None |
| 9494 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9495 | |
| 9496 | def pack(self): |
| 9497 | packed = [] |
| 9498 | packed.append(struct.pack("!B", self.version)) |
| 9499 | packed.append(struct.pack("!B", self.type)) |
| 9500 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9501 | packed.append(struct.pack("!L", self.xid)) |
| 9502 | length = sum([len(x) for x in packed]) |
| 9503 | packed[2] = struct.pack("!H", length) |
| 9504 | return ''.join(packed) |
| 9505 | |
| 9506 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9507 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9508 | obj = get_config_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9509 | _version = reader.read("!B")[0] |
| 9510 | assert(_version == 4) |
| 9511 | _type = reader.read("!B")[0] |
| 9512 | assert(_type == 7) |
| 9513 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9514 | orig_reader = reader |
| 9515 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9516 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9517 | return obj |
| 9518 | |
| 9519 | def __eq__(self, other): |
| 9520 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9521 | if self.xid != other.xid: return False |
| 9522 | return True |
| 9523 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9524 | def pretty_print(self, q): |
| 9525 | q.text("get_config_request {") |
| 9526 | with q.group(): |
| 9527 | with q.indent(2): |
| 9528 | q.breakable() |
| 9529 | q.text("xid = "); |
| 9530 | if self.xid != None: |
| 9531 | q.text("%#x" % self.xid) |
| 9532 | else: |
| 9533 | q.text('None') |
| 9534 | q.breakable() |
| 9535 | q.text('}') |
| 9536 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9537 | message.subtypes[7] = get_config_request |
| 9538 | |
| 9539 | class group_mod(message): |
| 9540 | subtypes = {} |
| 9541 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 9542 | version = 4 |
| 9543 | type = 15 |
| 9544 | |
| 9545 | def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None): |
| 9546 | if xid != None: |
| 9547 | self.xid = xid |
| 9548 | else: |
| 9549 | self.xid = None |
| 9550 | if command != None: |
| 9551 | self.command = command |
| 9552 | else: |
| 9553 | self.command = 0 |
| 9554 | if group_type != None: |
| 9555 | self.group_type = group_type |
| 9556 | else: |
| 9557 | self.group_type = 0 |
| 9558 | if group_id != None: |
| 9559 | self.group_id = group_id |
| 9560 | else: |
| 9561 | self.group_id = 0 |
| 9562 | if buckets != None: |
| 9563 | self.buckets = buckets |
| 9564 | else: |
| 9565 | self.buckets = [] |
| 9566 | return |
| 9567 | |
| 9568 | def pack(self): |
| 9569 | packed = [] |
| 9570 | packed.append(struct.pack("!B", self.version)) |
| 9571 | packed.append(struct.pack("!B", self.type)) |
| 9572 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9573 | packed.append(struct.pack("!L", self.xid)) |
| 9574 | packed.append(struct.pack("!H", self.command)) |
| 9575 | packed.append(struct.pack("!B", self.group_type)) |
| 9576 | packed.append('\x00' * 1) |
| 9577 | packed.append(struct.pack("!L", self.group_id)) |
| 9578 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
| 9579 | length = sum([len(x) for x in packed]) |
| 9580 | packed[2] = struct.pack("!H", length) |
| 9581 | return ''.join(packed) |
| 9582 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9583 | @staticmethod |
| 9584 | def unpack(reader): |
| 9585 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 9586 | subclass = group_mod.subtypes.get(subtype) |
| 9587 | if subclass: |
| 9588 | return subclass.unpack(reader) |
| 9589 | |
| 9590 | obj = group_mod() |
| 9591 | _version = reader.read("!B")[0] |
| 9592 | assert(_version == 4) |
| 9593 | _type = reader.read("!B")[0] |
| 9594 | assert(_type == 15) |
| 9595 | _length = reader.read("!H")[0] |
| 9596 | orig_reader = reader |
| 9597 | reader = orig_reader.slice(_length - (2 + 2)) |
| 9598 | obj.xid = reader.read("!L")[0] |
| 9599 | obj.command = reader.read("!H")[0] |
| 9600 | obj.group_type = reader.read("!B")[0] |
| 9601 | reader.skip(1) |
| 9602 | obj.group_id = reader.read("!L")[0] |
| 9603 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
| 9604 | return obj |
| 9605 | |
| 9606 | def __eq__(self, other): |
| 9607 | if type(self) != type(other): return False |
| 9608 | if self.xid != other.xid: return False |
| 9609 | if self.command != other.command: return False |
| 9610 | if self.group_type != other.group_type: return False |
| 9611 | if self.group_id != other.group_id: return False |
| 9612 | if self.buckets != other.buckets: return False |
| 9613 | return True |
| 9614 | |
| 9615 | def pretty_print(self, q): |
| 9616 | q.text("group_mod {") |
| 9617 | with q.group(): |
| 9618 | with q.indent(2): |
| 9619 | q.breakable() |
| 9620 | q.text("xid = "); |
| 9621 | if self.xid != None: |
| 9622 | q.text("%#x" % self.xid) |
| 9623 | else: |
| 9624 | q.text('None') |
| 9625 | q.text(","); q.breakable() |
| 9626 | q.text("group_type = "); |
| 9627 | q.text("%#x" % self.group_type) |
| 9628 | q.text(","); q.breakable() |
| 9629 | q.text("group_id = "); |
| 9630 | q.text("%#x" % self.group_id) |
| 9631 | q.text(","); q.breakable() |
| 9632 | q.text("buckets = "); |
| 9633 | q.pp(self.buckets) |
| 9634 | q.breakable() |
| 9635 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9636 | |
| 9637 | message.subtypes[15] = group_mod |
| 9638 | |
| 9639 | class group_add(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9640 | version = 4 |
| 9641 | type = 15 |
| 9642 | command = 0 |
| 9643 | |
| 9644 | def __init__(self, xid=None, group_type=None, group_id=None, buckets=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9645 | if xid != None: |
| 9646 | self.xid = xid |
| 9647 | else: |
| 9648 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9649 | if group_type != None: |
| 9650 | self.group_type = group_type |
| 9651 | else: |
| 9652 | self.group_type = 0 |
| 9653 | if group_id != None: |
| 9654 | self.group_id = group_id |
| 9655 | else: |
| 9656 | self.group_id = 0 |
| 9657 | if buckets != None: |
| 9658 | self.buckets = buckets |
| 9659 | else: |
| 9660 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9661 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9662 | |
| 9663 | def pack(self): |
| 9664 | packed = [] |
| 9665 | packed.append(struct.pack("!B", self.version)) |
| 9666 | packed.append(struct.pack("!B", self.type)) |
| 9667 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9668 | packed.append(struct.pack("!L", self.xid)) |
| 9669 | packed.append(struct.pack("!H", self.command)) |
| 9670 | packed.append(struct.pack("!B", self.group_type)) |
| 9671 | packed.append('\x00' * 1) |
| 9672 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9673 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9674 | length = sum([len(x) for x in packed]) |
| 9675 | packed[2] = struct.pack("!H", length) |
| 9676 | return ''.join(packed) |
| 9677 | |
| 9678 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9679 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9680 | obj = group_add() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9681 | _version = reader.read("!B")[0] |
| 9682 | assert(_version == 4) |
| 9683 | _type = reader.read("!B")[0] |
| 9684 | assert(_type == 15) |
| 9685 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9686 | orig_reader = reader |
| 9687 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9688 | obj.xid = reader.read("!L")[0] |
| 9689 | _command = reader.read("!H")[0] |
| 9690 | assert(_command == 0) |
| 9691 | obj.group_type = reader.read("!B")[0] |
| 9692 | reader.skip(1) |
| 9693 | obj.group_id = reader.read("!L")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9694 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9695 | return obj |
| 9696 | |
| 9697 | def __eq__(self, other): |
| 9698 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9699 | if self.xid != other.xid: return False |
| 9700 | if self.group_type != other.group_type: return False |
| 9701 | if self.group_id != other.group_id: return False |
| 9702 | if self.buckets != other.buckets: return False |
| 9703 | return True |
| 9704 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9705 | def pretty_print(self, q): |
| 9706 | q.text("group_add {") |
| 9707 | with q.group(): |
| 9708 | with q.indent(2): |
| 9709 | q.breakable() |
| 9710 | q.text("xid = "); |
| 9711 | if self.xid != None: |
| 9712 | q.text("%#x" % self.xid) |
| 9713 | else: |
| 9714 | q.text('None') |
| 9715 | q.text(","); q.breakable() |
| 9716 | q.text("group_type = "); |
| 9717 | q.text("%#x" % self.group_type) |
| 9718 | q.text(","); q.breakable() |
| 9719 | q.text("group_id = "); |
| 9720 | q.text("%#x" % self.group_id) |
| 9721 | q.text(","); q.breakable() |
| 9722 | q.text("buckets = "); |
| 9723 | q.pp(self.buckets) |
| 9724 | q.breakable() |
| 9725 | q.text('}') |
| 9726 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9727 | group_mod.subtypes[0] = group_add |
| 9728 | |
| 9729 | class group_delete(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9730 | version = 4 |
| 9731 | type = 15 |
| 9732 | command = 2 |
| 9733 | |
| 9734 | def __init__(self, xid=None, group_type=None, group_id=None, buckets=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9735 | if xid != None: |
| 9736 | self.xid = xid |
| 9737 | else: |
| 9738 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9739 | if group_type != None: |
| 9740 | self.group_type = group_type |
| 9741 | else: |
| 9742 | self.group_type = 0 |
| 9743 | if group_id != None: |
| 9744 | self.group_id = group_id |
| 9745 | else: |
| 9746 | self.group_id = 0 |
| 9747 | if buckets != None: |
| 9748 | self.buckets = buckets |
| 9749 | else: |
| 9750 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9751 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9752 | |
| 9753 | def pack(self): |
| 9754 | packed = [] |
| 9755 | packed.append(struct.pack("!B", self.version)) |
| 9756 | packed.append(struct.pack("!B", self.type)) |
| 9757 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9758 | packed.append(struct.pack("!L", self.xid)) |
| 9759 | packed.append(struct.pack("!H", self.command)) |
| 9760 | packed.append(struct.pack("!B", self.group_type)) |
| 9761 | packed.append('\x00' * 1) |
| 9762 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9763 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9764 | length = sum([len(x) for x in packed]) |
| 9765 | packed[2] = struct.pack("!H", length) |
| 9766 | return ''.join(packed) |
| 9767 | |
| 9768 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9769 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9770 | obj = group_delete() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9771 | _version = reader.read("!B")[0] |
| 9772 | assert(_version == 4) |
| 9773 | _type = reader.read("!B")[0] |
| 9774 | assert(_type == 15) |
| 9775 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9776 | orig_reader = reader |
| 9777 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9778 | obj.xid = reader.read("!L")[0] |
| 9779 | _command = reader.read("!H")[0] |
| 9780 | assert(_command == 2) |
| 9781 | obj.group_type = reader.read("!B")[0] |
| 9782 | reader.skip(1) |
| 9783 | obj.group_id = reader.read("!L")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9784 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9785 | return obj |
| 9786 | |
| 9787 | def __eq__(self, other): |
| 9788 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9789 | if self.xid != other.xid: return False |
| 9790 | if self.group_type != other.group_type: return False |
| 9791 | if self.group_id != other.group_id: return False |
| 9792 | if self.buckets != other.buckets: return False |
| 9793 | return True |
| 9794 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9795 | def pretty_print(self, q): |
| 9796 | q.text("group_delete {") |
| 9797 | with q.group(): |
| 9798 | with q.indent(2): |
| 9799 | q.breakable() |
| 9800 | q.text("xid = "); |
| 9801 | if self.xid != None: |
| 9802 | q.text("%#x" % self.xid) |
| 9803 | else: |
| 9804 | q.text('None') |
| 9805 | q.text(","); q.breakable() |
| 9806 | q.text("group_type = "); |
| 9807 | q.text("%#x" % self.group_type) |
| 9808 | q.text(","); q.breakable() |
| 9809 | q.text("group_id = "); |
| 9810 | q.text("%#x" % self.group_id) |
| 9811 | q.text(","); q.breakable() |
| 9812 | q.text("buckets = "); |
| 9813 | q.pp(self.buckets) |
| 9814 | q.breakable() |
| 9815 | q.text('}') |
| 9816 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9817 | group_mod.subtypes[2] = group_delete |
| 9818 | |
| 9819 | class group_desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9820 | version = 4 |
| 9821 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9822 | stats_type = 7 |
| 9823 | |
| 9824 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9825 | if xid != None: |
| 9826 | self.xid = xid |
| 9827 | else: |
| 9828 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9829 | if flags != None: |
| 9830 | self.flags = flags |
| 9831 | else: |
| 9832 | self.flags = 0 |
| 9833 | if entries != None: |
| 9834 | self.entries = entries |
| 9835 | else: |
| 9836 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9837 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9838 | |
| 9839 | def pack(self): |
| 9840 | packed = [] |
| 9841 | packed.append(struct.pack("!B", self.version)) |
| 9842 | packed.append(struct.pack("!B", self.type)) |
| 9843 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9844 | packed.append(struct.pack("!L", self.xid)) |
| 9845 | packed.append(struct.pack("!H", self.stats_type)) |
| 9846 | packed.append(struct.pack("!H", self.flags)) |
| 9847 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9848 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9849 | length = sum([len(x) for x in packed]) |
| 9850 | packed[2] = struct.pack("!H", length) |
| 9851 | return ''.join(packed) |
| 9852 | |
| 9853 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9854 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9855 | obj = group_desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9856 | _version = reader.read("!B")[0] |
| 9857 | assert(_version == 4) |
| 9858 | _type = reader.read("!B")[0] |
| 9859 | assert(_type == 19) |
| 9860 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9861 | orig_reader = reader |
| 9862 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9863 | obj.xid = reader.read("!L")[0] |
| 9864 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9865 | assert(_stats_type == 7) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9866 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9867 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9868 | obj.entries = loxi.generic_util.unpack_list(reader, common.group_desc_stats_entry.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9869 | return obj |
| 9870 | |
| 9871 | def __eq__(self, other): |
| 9872 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9873 | if self.xid != other.xid: return False |
| 9874 | if self.flags != other.flags: return False |
| 9875 | if self.entries != other.entries: return False |
| 9876 | return True |
| 9877 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9878 | def pretty_print(self, q): |
| 9879 | q.text("group_desc_stats_reply {") |
| 9880 | with q.group(): |
| 9881 | with q.indent(2): |
| 9882 | q.breakable() |
| 9883 | q.text("xid = "); |
| 9884 | if self.xid != None: |
| 9885 | q.text("%#x" % self.xid) |
| 9886 | else: |
| 9887 | q.text('None') |
| 9888 | q.text(","); q.breakable() |
| 9889 | q.text("flags = "); |
| 9890 | q.text("%#x" % self.flags) |
| 9891 | q.text(","); q.breakable() |
| 9892 | q.text("entries = "); |
| 9893 | q.pp(self.entries) |
| 9894 | q.breakable() |
| 9895 | q.text('}') |
| 9896 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9897 | stats_reply.subtypes[7] = group_desc_stats_reply |
| 9898 | |
| 9899 | class group_desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9900 | version = 4 |
| 9901 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9902 | stats_type = 7 |
| 9903 | |
| 9904 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9905 | if xid != None: |
| 9906 | self.xid = xid |
| 9907 | else: |
| 9908 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9909 | if flags != None: |
| 9910 | self.flags = flags |
| 9911 | else: |
| 9912 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9913 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9914 | |
| 9915 | def pack(self): |
| 9916 | packed = [] |
| 9917 | packed.append(struct.pack("!B", self.version)) |
| 9918 | packed.append(struct.pack("!B", self.type)) |
| 9919 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9920 | packed.append(struct.pack("!L", self.xid)) |
| 9921 | packed.append(struct.pack("!H", self.stats_type)) |
| 9922 | packed.append(struct.pack("!H", self.flags)) |
| 9923 | packed.append('\x00' * 4) |
| 9924 | length = sum([len(x) for x in packed]) |
| 9925 | packed[2] = struct.pack("!H", length) |
| 9926 | return ''.join(packed) |
| 9927 | |
| 9928 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9929 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9930 | obj = group_desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9931 | _version = reader.read("!B")[0] |
| 9932 | assert(_version == 4) |
| 9933 | _type = reader.read("!B")[0] |
| 9934 | assert(_type == 18) |
| 9935 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9936 | orig_reader = reader |
| 9937 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9938 | obj.xid = reader.read("!L")[0] |
| 9939 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9940 | assert(_stats_type == 7) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9941 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9942 | reader.skip(4) |
| 9943 | return obj |
| 9944 | |
| 9945 | def __eq__(self, other): |
| 9946 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9947 | if self.xid != other.xid: return False |
| 9948 | if self.flags != other.flags: return False |
| 9949 | return True |
| 9950 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9951 | def pretty_print(self, q): |
| 9952 | q.text("group_desc_stats_request {") |
| 9953 | with q.group(): |
| 9954 | with q.indent(2): |
| 9955 | q.breakable() |
| 9956 | q.text("xid = "); |
| 9957 | if self.xid != None: |
| 9958 | q.text("%#x" % self.xid) |
| 9959 | else: |
| 9960 | q.text('None') |
| 9961 | q.text(","); q.breakable() |
| 9962 | q.text("flags = "); |
| 9963 | q.text("%#x" % self.flags) |
| 9964 | q.breakable() |
| 9965 | q.text('}') |
| 9966 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9967 | stats_request.subtypes[7] = group_desc_stats_request |
| 9968 | |
| 9969 | class group_features_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9970 | version = 4 |
| 9971 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9972 | stats_type = 8 |
| 9973 | |
| 9974 | 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): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9975 | if xid != None: |
| 9976 | self.xid = xid |
| 9977 | else: |
| 9978 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9979 | if flags != None: |
| 9980 | self.flags = flags |
| 9981 | else: |
| 9982 | self.flags = 0 |
| 9983 | if types != None: |
| 9984 | self.types = types |
| 9985 | else: |
| 9986 | self.types = 0 |
| 9987 | if capabilities != None: |
| 9988 | self.capabilities = capabilities |
| 9989 | else: |
| 9990 | self.capabilities = 0 |
| 9991 | if max_groups_all != None: |
| 9992 | self.max_groups_all = max_groups_all |
| 9993 | else: |
| 9994 | self.max_groups_all = 0 |
| 9995 | if max_groups_select != None: |
| 9996 | self.max_groups_select = max_groups_select |
| 9997 | else: |
| 9998 | self.max_groups_select = 0 |
| 9999 | if max_groups_indirect != None: |
| 10000 | self.max_groups_indirect = max_groups_indirect |
| 10001 | else: |
| 10002 | self.max_groups_indirect = 0 |
| 10003 | if max_groups_ff != None: |
| 10004 | self.max_groups_ff = max_groups_ff |
| 10005 | else: |
| 10006 | self.max_groups_ff = 0 |
| 10007 | if actions_all != None: |
| 10008 | self.actions_all = actions_all |
| 10009 | else: |
| 10010 | self.actions_all = 0 |
| 10011 | if actions_select != None: |
| 10012 | self.actions_select = actions_select |
| 10013 | else: |
| 10014 | self.actions_select = 0 |
| 10015 | if actions_indirect != None: |
| 10016 | self.actions_indirect = actions_indirect |
| 10017 | else: |
| 10018 | self.actions_indirect = 0 |
| 10019 | if actions_ff != None: |
| 10020 | self.actions_ff = actions_ff |
| 10021 | else: |
| 10022 | self.actions_ff = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10023 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10024 | |
| 10025 | def pack(self): |
| 10026 | packed = [] |
| 10027 | packed.append(struct.pack("!B", self.version)) |
| 10028 | packed.append(struct.pack("!B", self.type)) |
| 10029 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10030 | packed.append(struct.pack("!L", self.xid)) |
| 10031 | packed.append(struct.pack("!H", self.stats_type)) |
| 10032 | packed.append(struct.pack("!H", self.flags)) |
| 10033 | packed.append('\x00' * 4) |
| 10034 | packed.append(struct.pack("!L", self.types)) |
| 10035 | packed.append(struct.pack("!L", self.capabilities)) |
| 10036 | packed.append(struct.pack("!L", self.max_groups_all)) |
| 10037 | packed.append(struct.pack("!L", self.max_groups_select)) |
| 10038 | packed.append(struct.pack("!L", self.max_groups_indirect)) |
| 10039 | packed.append(struct.pack("!L", self.max_groups_ff)) |
| 10040 | packed.append(struct.pack("!L", self.actions_all)) |
| 10041 | packed.append(struct.pack("!L", self.actions_select)) |
| 10042 | packed.append(struct.pack("!L", self.actions_indirect)) |
| 10043 | packed.append(struct.pack("!L", self.actions_ff)) |
| 10044 | length = sum([len(x) for x in packed]) |
| 10045 | packed[2] = struct.pack("!H", length) |
| 10046 | return ''.join(packed) |
| 10047 | |
| 10048 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10049 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10050 | obj = group_features_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10051 | _version = reader.read("!B")[0] |
| 10052 | assert(_version == 4) |
| 10053 | _type = reader.read("!B")[0] |
| 10054 | assert(_type == 19) |
| 10055 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10056 | orig_reader = reader |
| 10057 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10058 | obj.xid = reader.read("!L")[0] |
| 10059 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10060 | assert(_stats_type == 8) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10061 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10062 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10063 | obj.types = reader.read("!L")[0] |
| 10064 | obj.capabilities = reader.read("!L")[0] |
| 10065 | obj.max_groups_all = reader.read("!L")[0] |
| 10066 | obj.max_groups_select = reader.read("!L")[0] |
| 10067 | obj.max_groups_indirect = reader.read("!L")[0] |
| 10068 | obj.max_groups_ff = reader.read("!L")[0] |
| 10069 | obj.actions_all = reader.read("!L")[0] |
| 10070 | obj.actions_select = reader.read("!L")[0] |
| 10071 | obj.actions_indirect = reader.read("!L")[0] |
| 10072 | obj.actions_ff = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10073 | return obj |
| 10074 | |
| 10075 | def __eq__(self, other): |
| 10076 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10077 | if self.xid != other.xid: return False |
| 10078 | if self.flags != other.flags: return False |
| 10079 | if self.types != other.types: return False |
| 10080 | if self.capabilities != other.capabilities: return False |
| 10081 | if self.max_groups_all != other.max_groups_all: return False |
| 10082 | if self.max_groups_select != other.max_groups_select: return False |
| 10083 | if self.max_groups_indirect != other.max_groups_indirect: return False |
| 10084 | if self.max_groups_ff != other.max_groups_ff: return False |
| 10085 | if self.actions_all != other.actions_all: return False |
| 10086 | if self.actions_select != other.actions_select: return False |
| 10087 | if self.actions_indirect != other.actions_indirect: return False |
| 10088 | if self.actions_ff != other.actions_ff: return False |
| 10089 | return True |
| 10090 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10091 | def pretty_print(self, q): |
| 10092 | q.text("group_features_stats_reply {") |
| 10093 | with q.group(): |
| 10094 | with q.indent(2): |
| 10095 | q.breakable() |
| 10096 | q.text("xid = "); |
| 10097 | if self.xid != None: |
| 10098 | q.text("%#x" % self.xid) |
| 10099 | else: |
| 10100 | q.text('None') |
| 10101 | q.text(","); q.breakable() |
| 10102 | q.text("flags = "); |
| 10103 | q.text("%#x" % self.flags) |
| 10104 | q.text(","); q.breakable() |
| 10105 | q.text("types = "); |
| 10106 | q.text("%#x" % self.types) |
| 10107 | q.text(","); q.breakable() |
| 10108 | q.text("capabilities = "); |
| 10109 | q.text("%#x" % self.capabilities) |
| 10110 | q.text(","); q.breakable() |
| 10111 | q.text("max_groups_all = "); |
| 10112 | q.text("%#x" % self.max_groups_all) |
| 10113 | q.text(","); q.breakable() |
| 10114 | q.text("max_groups_select = "); |
| 10115 | q.text("%#x" % self.max_groups_select) |
| 10116 | q.text(","); q.breakable() |
| 10117 | q.text("max_groups_indirect = "); |
| 10118 | q.text("%#x" % self.max_groups_indirect) |
| 10119 | q.text(","); q.breakable() |
| 10120 | q.text("max_groups_ff = "); |
| 10121 | q.text("%#x" % self.max_groups_ff) |
| 10122 | q.text(","); q.breakable() |
| 10123 | q.text("actions_all = "); |
| 10124 | q.text("%#x" % self.actions_all) |
| 10125 | q.text(","); q.breakable() |
| 10126 | q.text("actions_select = "); |
| 10127 | q.text("%#x" % self.actions_select) |
| 10128 | q.text(","); q.breakable() |
| 10129 | q.text("actions_indirect = "); |
| 10130 | q.text("%#x" % self.actions_indirect) |
| 10131 | q.text(","); q.breakable() |
| 10132 | q.text("actions_ff = "); |
| 10133 | q.text("%#x" % self.actions_ff) |
| 10134 | q.breakable() |
| 10135 | q.text('}') |
| 10136 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10137 | stats_reply.subtypes[8] = group_features_stats_reply |
| 10138 | |
| 10139 | class group_features_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10140 | version = 4 |
| 10141 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10142 | stats_type = 8 |
| 10143 | |
| 10144 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10145 | if xid != None: |
| 10146 | self.xid = xid |
| 10147 | else: |
| 10148 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10149 | if flags != None: |
| 10150 | self.flags = flags |
| 10151 | else: |
| 10152 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10153 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10154 | |
| 10155 | def pack(self): |
| 10156 | packed = [] |
| 10157 | packed.append(struct.pack("!B", self.version)) |
| 10158 | packed.append(struct.pack("!B", self.type)) |
| 10159 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10160 | packed.append(struct.pack("!L", self.xid)) |
| 10161 | packed.append(struct.pack("!H", self.stats_type)) |
| 10162 | packed.append(struct.pack("!H", self.flags)) |
| 10163 | packed.append('\x00' * 4) |
| 10164 | length = sum([len(x) for x in packed]) |
| 10165 | packed[2] = struct.pack("!H", length) |
| 10166 | return ''.join(packed) |
| 10167 | |
| 10168 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10169 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10170 | obj = group_features_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10171 | _version = reader.read("!B")[0] |
| 10172 | assert(_version == 4) |
| 10173 | _type = reader.read("!B")[0] |
| 10174 | assert(_type == 18) |
| 10175 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10176 | orig_reader = reader |
| 10177 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10178 | obj.xid = reader.read("!L")[0] |
| 10179 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10180 | assert(_stats_type == 8) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10181 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10182 | reader.skip(4) |
| 10183 | return obj |
| 10184 | |
| 10185 | def __eq__(self, other): |
| 10186 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10187 | if self.xid != other.xid: return False |
| 10188 | if self.flags != other.flags: return False |
| 10189 | return True |
| 10190 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10191 | def pretty_print(self, q): |
| 10192 | q.text("group_features_stats_request {") |
| 10193 | with q.group(): |
| 10194 | with q.indent(2): |
| 10195 | q.breakable() |
| 10196 | q.text("xid = "); |
| 10197 | if self.xid != None: |
| 10198 | q.text("%#x" % self.xid) |
| 10199 | else: |
| 10200 | q.text('None') |
| 10201 | q.text(","); q.breakable() |
| 10202 | q.text("flags = "); |
| 10203 | q.text("%#x" % self.flags) |
| 10204 | q.breakable() |
| 10205 | q.text('}') |
| 10206 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10207 | stats_request.subtypes[8] = group_features_stats_request |
| 10208 | |
| 10209 | class group_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10210 | version = 4 |
| 10211 | type = 1 |
| 10212 | err_type = 6 |
| 10213 | |
| 10214 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10215 | if xid != None: |
| 10216 | self.xid = xid |
| 10217 | else: |
| 10218 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10219 | if code != None: |
| 10220 | self.code = code |
| 10221 | else: |
| 10222 | self.code = 0 |
| 10223 | if data != None: |
| 10224 | self.data = data |
| 10225 | else: |
| 10226 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10227 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10228 | |
| 10229 | def pack(self): |
| 10230 | packed = [] |
| 10231 | packed.append(struct.pack("!B", self.version)) |
| 10232 | packed.append(struct.pack("!B", self.type)) |
| 10233 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10234 | packed.append(struct.pack("!L", self.xid)) |
| 10235 | packed.append(struct.pack("!H", self.err_type)) |
| 10236 | packed.append(struct.pack("!H", self.code)) |
| 10237 | packed.append(self.data) |
| 10238 | length = sum([len(x) for x in packed]) |
| 10239 | packed[2] = struct.pack("!H", length) |
| 10240 | return ''.join(packed) |
| 10241 | |
| 10242 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10243 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10244 | obj = group_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10245 | _version = reader.read("!B")[0] |
| 10246 | assert(_version == 4) |
| 10247 | _type = reader.read("!B")[0] |
| 10248 | assert(_type == 1) |
| 10249 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10250 | orig_reader = reader |
| 10251 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10252 | obj.xid = reader.read("!L")[0] |
| 10253 | _err_type = reader.read("!H")[0] |
| 10254 | assert(_err_type == 6) |
| 10255 | obj.code = reader.read("!H")[0] |
| 10256 | obj.data = str(reader.read_all()) |
| 10257 | return obj |
| 10258 | |
| 10259 | def __eq__(self, other): |
| 10260 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10261 | if self.xid != other.xid: return False |
| 10262 | if self.code != other.code: return False |
| 10263 | if self.data != other.data: return False |
| 10264 | return True |
| 10265 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10266 | def pretty_print(self, q): |
| 10267 | q.text("group_mod_failed_error_msg {") |
| 10268 | with q.group(): |
| 10269 | with q.indent(2): |
| 10270 | q.breakable() |
| 10271 | q.text("xid = "); |
| 10272 | if self.xid != None: |
| 10273 | q.text("%#x" % self.xid) |
| 10274 | else: |
| 10275 | q.text('None') |
| 10276 | q.text(","); q.breakable() |
| 10277 | q.text("code = "); |
| 10278 | q.text("%#x" % self.code) |
| 10279 | q.text(","); q.breakable() |
| 10280 | q.text("data = "); |
| 10281 | q.pp(self.data) |
| 10282 | q.breakable() |
| 10283 | q.text('}') |
| 10284 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10285 | error_msg.subtypes[6] = group_mod_failed_error_msg |
| 10286 | |
| 10287 | class group_modify(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10288 | version = 4 |
| 10289 | type = 15 |
| 10290 | command = 1 |
| 10291 | |
| 10292 | def __init__(self, xid=None, group_type=None, group_id=None, buckets=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10293 | if xid != None: |
| 10294 | self.xid = xid |
| 10295 | else: |
| 10296 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10297 | if group_type != None: |
| 10298 | self.group_type = group_type |
| 10299 | else: |
| 10300 | self.group_type = 0 |
| 10301 | if group_id != None: |
| 10302 | self.group_id = group_id |
| 10303 | else: |
| 10304 | self.group_id = 0 |
| 10305 | if buckets != None: |
| 10306 | self.buckets = buckets |
| 10307 | else: |
| 10308 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10309 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10310 | |
| 10311 | def pack(self): |
| 10312 | packed = [] |
| 10313 | packed.append(struct.pack("!B", self.version)) |
| 10314 | packed.append(struct.pack("!B", self.type)) |
| 10315 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10316 | packed.append(struct.pack("!L", self.xid)) |
| 10317 | packed.append(struct.pack("!H", self.command)) |
| 10318 | packed.append(struct.pack("!B", self.group_type)) |
| 10319 | packed.append('\x00' * 1) |
| 10320 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10321 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10322 | length = sum([len(x) for x in packed]) |
| 10323 | packed[2] = struct.pack("!H", length) |
| 10324 | return ''.join(packed) |
| 10325 | |
| 10326 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10327 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10328 | obj = group_modify() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10329 | _version = reader.read("!B")[0] |
| 10330 | assert(_version == 4) |
| 10331 | _type = reader.read("!B")[0] |
| 10332 | assert(_type == 15) |
| 10333 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10334 | orig_reader = reader |
| 10335 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10336 | obj.xid = reader.read("!L")[0] |
| 10337 | _command = reader.read("!H")[0] |
| 10338 | assert(_command == 1) |
| 10339 | obj.group_type = reader.read("!B")[0] |
| 10340 | reader.skip(1) |
| 10341 | obj.group_id = reader.read("!L")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10342 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10343 | return obj |
| 10344 | |
| 10345 | def __eq__(self, other): |
| 10346 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10347 | if self.xid != other.xid: return False |
| 10348 | if self.group_type != other.group_type: return False |
| 10349 | if self.group_id != other.group_id: return False |
| 10350 | if self.buckets != other.buckets: return False |
| 10351 | return True |
| 10352 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10353 | def pretty_print(self, q): |
| 10354 | q.text("group_modify {") |
| 10355 | with q.group(): |
| 10356 | with q.indent(2): |
| 10357 | q.breakable() |
| 10358 | q.text("xid = "); |
| 10359 | if self.xid != None: |
| 10360 | q.text("%#x" % self.xid) |
| 10361 | else: |
| 10362 | q.text('None') |
| 10363 | q.text(","); q.breakable() |
| 10364 | q.text("group_type = "); |
| 10365 | q.text("%#x" % self.group_type) |
| 10366 | q.text(","); q.breakable() |
| 10367 | q.text("group_id = "); |
| 10368 | q.text("%#x" % self.group_id) |
| 10369 | q.text(","); q.breakable() |
| 10370 | q.text("buckets = "); |
| 10371 | q.pp(self.buckets) |
| 10372 | q.breakable() |
| 10373 | q.text('}') |
| 10374 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10375 | group_mod.subtypes[1] = group_modify |
| 10376 | |
| 10377 | class group_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10378 | version = 4 |
| 10379 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10380 | stats_type = 6 |
| 10381 | |
| 10382 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10383 | if xid != None: |
| 10384 | self.xid = xid |
| 10385 | else: |
| 10386 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10387 | if flags != None: |
| 10388 | self.flags = flags |
| 10389 | else: |
| 10390 | self.flags = 0 |
| 10391 | if entries != None: |
| 10392 | self.entries = entries |
| 10393 | else: |
| 10394 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10395 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10396 | |
| 10397 | def pack(self): |
| 10398 | packed = [] |
| 10399 | packed.append(struct.pack("!B", self.version)) |
| 10400 | packed.append(struct.pack("!B", self.type)) |
| 10401 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10402 | packed.append(struct.pack("!L", self.xid)) |
| 10403 | packed.append(struct.pack("!H", self.stats_type)) |
| 10404 | packed.append(struct.pack("!H", self.flags)) |
| 10405 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10406 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10407 | length = sum([len(x) for x in packed]) |
| 10408 | packed[2] = struct.pack("!H", length) |
| 10409 | return ''.join(packed) |
| 10410 | |
| 10411 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10412 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10413 | obj = group_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10414 | _version = reader.read("!B")[0] |
| 10415 | assert(_version == 4) |
| 10416 | _type = reader.read("!B")[0] |
| 10417 | assert(_type == 19) |
| 10418 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10419 | orig_reader = reader |
| 10420 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10421 | obj.xid = reader.read("!L")[0] |
| 10422 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10423 | assert(_stats_type == 6) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10424 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10425 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10426 | obj.entries = loxi.generic_util.unpack_list(reader, common.group_stats_entry.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10427 | return obj |
| 10428 | |
| 10429 | def __eq__(self, other): |
| 10430 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10431 | if self.xid != other.xid: return False |
| 10432 | if self.flags != other.flags: return False |
| 10433 | if self.entries != other.entries: return False |
| 10434 | return True |
| 10435 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10436 | def pretty_print(self, q): |
| 10437 | q.text("group_stats_reply {") |
| 10438 | with q.group(): |
| 10439 | with q.indent(2): |
| 10440 | q.breakable() |
| 10441 | q.text("xid = "); |
| 10442 | if self.xid != None: |
| 10443 | q.text("%#x" % self.xid) |
| 10444 | else: |
| 10445 | q.text('None') |
| 10446 | q.text(","); q.breakable() |
| 10447 | q.text("flags = "); |
| 10448 | q.text("%#x" % self.flags) |
| 10449 | q.text(","); q.breakable() |
| 10450 | q.text("entries = "); |
| 10451 | q.pp(self.entries) |
| 10452 | q.breakable() |
| 10453 | q.text('}') |
| 10454 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10455 | stats_reply.subtypes[6] = group_stats_reply |
| 10456 | |
| 10457 | class group_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10458 | version = 4 |
| 10459 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10460 | stats_type = 6 |
| 10461 | |
| 10462 | def __init__(self, xid=None, flags=None, group_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10463 | if xid != None: |
| 10464 | self.xid = xid |
| 10465 | else: |
| 10466 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10467 | if flags != None: |
| 10468 | self.flags = flags |
| 10469 | else: |
| 10470 | self.flags = 0 |
| 10471 | if group_id != None: |
| 10472 | self.group_id = group_id |
| 10473 | else: |
| 10474 | self.group_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10475 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10476 | |
| 10477 | def pack(self): |
| 10478 | packed = [] |
| 10479 | packed.append(struct.pack("!B", self.version)) |
| 10480 | packed.append(struct.pack("!B", self.type)) |
| 10481 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10482 | packed.append(struct.pack("!L", self.xid)) |
| 10483 | packed.append(struct.pack("!H", self.stats_type)) |
| 10484 | packed.append(struct.pack("!H", self.flags)) |
| 10485 | packed.append('\x00' * 4) |
| 10486 | packed.append(struct.pack("!L", self.group_id)) |
| 10487 | packed.append('\x00' * 4) |
| 10488 | length = sum([len(x) for x in packed]) |
| 10489 | packed[2] = struct.pack("!H", length) |
| 10490 | return ''.join(packed) |
| 10491 | |
| 10492 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10493 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10494 | obj = group_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10495 | _version = reader.read("!B")[0] |
| 10496 | assert(_version == 4) |
| 10497 | _type = reader.read("!B")[0] |
| 10498 | assert(_type == 18) |
| 10499 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10500 | orig_reader = reader |
| 10501 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10502 | obj.xid = reader.read("!L")[0] |
| 10503 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10504 | assert(_stats_type == 6) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10505 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10506 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10507 | obj.group_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10508 | reader.skip(4) |
| 10509 | return obj |
| 10510 | |
| 10511 | def __eq__(self, other): |
| 10512 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10513 | if self.xid != other.xid: return False |
| 10514 | if self.flags != other.flags: return False |
| 10515 | if self.group_id != other.group_id: return False |
| 10516 | return True |
| 10517 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10518 | def pretty_print(self, q): |
| 10519 | q.text("group_stats_request {") |
| 10520 | with q.group(): |
| 10521 | with q.indent(2): |
| 10522 | q.breakable() |
| 10523 | q.text("xid = "); |
| 10524 | if self.xid != None: |
| 10525 | q.text("%#x" % self.xid) |
| 10526 | else: |
| 10527 | q.text('None') |
| 10528 | q.text(","); q.breakable() |
| 10529 | q.text("flags = "); |
| 10530 | q.text("%#x" % self.flags) |
| 10531 | q.text(","); q.breakable() |
| 10532 | q.text("group_id = "); |
| 10533 | q.text("%#x" % self.group_id) |
| 10534 | q.breakable() |
| 10535 | q.text('}') |
| 10536 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10537 | stats_request.subtypes[6] = group_stats_request |
| 10538 | |
| 10539 | class hello(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10540 | version = 4 |
| 10541 | type = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10542 | |
| 10543 | def __init__(self, xid=None, elements=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10544 | if xid != None: |
| 10545 | self.xid = xid |
| 10546 | else: |
| 10547 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10548 | if elements != None: |
| 10549 | self.elements = elements |
| 10550 | else: |
| 10551 | self.elements = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10552 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10553 | |
| 10554 | def pack(self): |
| 10555 | packed = [] |
| 10556 | packed.append(struct.pack("!B", self.version)) |
| 10557 | packed.append(struct.pack("!B", self.type)) |
| 10558 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10559 | packed.append(struct.pack("!L", self.xid)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10560 | packed.append(loxi.generic_util.pack_list(self.elements)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10561 | length = sum([len(x) for x in packed]) |
| 10562 | packed[2] = struct.pack("!H", length) |
| 10563 | return ''.join(packed) |
| 10564 | |
| 10565 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10566 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10567 | obj = hello() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10568 | _version = reader.read("!B")[0] |
| 10569 | assert(_version == 4) |
| 10570 | _type = reader.read("!B")[0] |
| 10571 | assert(_type == 0) |
| 10572 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10573 | orig_reader = reader |
| 10574 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10575 | obj.xid = reader.read("!L")[0] |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 10576 | obj.elements = loxi.generic_util.unpack_list(reader, common.hello_elem.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10577 | return obj |
| 10578 | |
| 10579 | def __eq__(self, other): |
| 10580 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10581 | if self.xid != other.xid: return False |
| 10582 | if self.elements != other.elements: return False |
| 10583 | return True |
| 10584 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10585 | def pretty_print(self, q): |
| 10586 | q.text("hello {") |
| 10587 | with q.group(): |
| 10588 | with q.indent(2): |
| 10589 | q.breakable() |
| 10590 | q.text("xid = "); |
| 10591 | if self.xid != None: |
| 10592 | q.text("%#x" % self.xid) |
| 10593 | else: |
| 10594 | q.text('None') |
| 10595 | q.text(","); q.breakable() |
| 10596 | q.text("elements = "); |
| 10597 | q.pp(self.elements) |
| 10598 | q.breakable() |
| 10599 | q.text('}') |
| 10600 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10601 | message.subtypes[0] = hello |
| 10602 | |
| 10603 | class hello_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10604 | version = 4 |
| 10605 | type = 1 |
| 10606 | err_type = 0 |
| 10607 | |
| 10608 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10609 | if xid != None: |
| 10610 | self.xid = xid |
| 10611 | else: |
| 10612 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10613 | if code != None: |
| 10614 | self.code = code |
| 10615 | else: |
| 10616 | self.code = 0 |
| 10617 | if data != None: |
| 10618 | self.data = data |
| 10619 | else: |
| 10620 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10621 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10622 | |
| 10623 | def pack(self): |
| 10624 | packed = [] |
| 10625 | packed.append(struct.pack("!B", self.version)) |
| 10626 | packed.append(struct.pack("!B", self.type)) |
| 10627 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10628 | packed.append(struct.pack("!L", self.xid)) |
| 10629 | packed.append(struct.pack("!H", self.err_type)) |
| 10630 | packed.append(struct.pack("!H", self.code)) |
| 10631 | packed.append(self.data) |
| 10632 | length = sum([len(x) for x in packed]) |
| 10633 | packed[2] = struct.pack("!H", length) |
| 10634 | return ''.join(packed) |
| 10635 | |
| 10636 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10637 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10638 | obj = hello_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10639 | _version = reader.read("!B")[0] |
| 10640 | assert(_version == 4) |
| 10641 | _type = reader.read("!B")[0] |
| 10642 | assert(_type == 1) |
| 10643 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10644 | orig_reader = reader |
| 10645 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10646 | obj.xid = reader.read("!L")[0] |
| 10647 | _err_type = reader.read("!H")[0] |
| 10648 | assert(_err_type == 0) |
| 10649 | obj.code = reader.read("!H")[0] |
| 10650 | obj.data = str(reader.read_all()) |
| 10651 | return obj |
| 10652 | |
| 10653 | def __eq__(self, other): |
| 10654 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10655 | if self.xid != other.xid: return False |
| 10656 | if self.code != other.code: return False |
| 10657 | if self.data != other.data: return False |
| 10658 | return True |
| 10659 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10660 | def pretty_print(self, q): |
| 10661 | q.text("hello_failed_error_msg {") |
| 10662 | with q.group(): |
| 10663 | with q.indent(2): |
| 10664 | q.breakable() |
| 10665 | q.text("xid = "); |
| 10666 | if self.xid != None: |
| 10667 | q.text("%#x" % self.xid) |
| 10668 | else: |
| 10669 | q.text('None') |
| 10670 | q.text(","); q.breakable() |
| 10671 | q.text("code = "); |
| 10672 | q.text("%#x" % self.code) |
| 10673 | q.text(","); q.breakable() |
| 10674 | q.text("data = "); |
| 10675 | q.pp(self.data) |
| 10676 | q.breakable() |
| 10677 | q.text('}') |
| 10678 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10679 | error_msg.subtypes[0] = hello_failed_error_msg |
| 10680 | |
| 10681 | class meter_config_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10682 | version = 4 |
| 10683 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10684 | stats_type = 10 |
| 10685 | |
| 10686 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10687 | if xid != None: |
| 10688 | self.xid = xid |
| 10689 | else: |
| 10690 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10691 | if flags != None: |
| 10692 | self.flags = flags |
| 10693 | else: |
| 10694 | self.flags = 0 |
| 10695 | if entries != None: |
| 10696 | self.entries = entries |
| 10697 | else: |
| 10698 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10699 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10700 | |
| 10701 | def pack(self): |
| 10702 | packed = [] |
| 10703 | packed.append(struct.pack("!B", self.version)) |
| 10704 | packed.append(struct.pack("!B", self.type)) |
| 10705 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10706 | packed.append(struct.pack("!L", self.xid)) |
| 10707 | packed.append(struct.pack("!H", self.stats_type)) |
| 10708 | packed.append(struct.pack("!H", self.flags)) |
| 10709 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10710 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10711 | length = sum([len(x) for x in packed]) |
| 10712 | packed[2] = struct.pack("!H", length) |
| 10713 | return ''.join(packed) |
| 10714 | |
| 10715 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10716 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10717 | obj = meter_config_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10718 | _version = reader.read("!B")[0] |
| 10719 | assert(_version == 4) |
| 10720 | _type = reader.read("!B")[0] |
| 10721 | assert(_type == 19) |
| 10722 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10723 | orig_reader = reader |
| 10724 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10725 | obj.xid = reader.read("!L")[0] |
| 10726 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10727 | assert(_stats_type == 10) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10728 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10729 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10730 | obj.entries = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10731 | return obj |
| 10732 | |
| 10733 | def __eq__(self, other): |
| 10734 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10735 | if self.xid != other.xid: return False |
| 10736 | if self.flags != other.flags: return False |
| 10737 | if self.entries != other.entries: return False |
| 10738 | return True |
| 10739 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10740 | def pretty_print(self, q): |
| 10741 | q.text("meter_config_stats_reply {") |
| 10742 | with q.group(): |
| 10743 | with q.indent(2): |
| 10744 | q.breakable() |
| 10745 | q.text("xid = "); |
| 10746 | if self.xid != None: |
| 10747 | q.text("%#x" % self.xid) |
| 10748 | else: |
| 10749 | q.text('None') |
| 10750 | q.text(","); q.breakable() |
| 10751 | q.text("flags = "); |
| 10752 | q.text("%#x" % self.flags) |
| 10753 | q.text(","); q.breakable() |
| 10754 | q.text("entries = "); |
| 10755 | q.pp(self.entries) |
| 10756 | q.breakable() |
| 10757 | q.text('}') |
| 10758 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10759 | stats_reply.subtypes[10] = meter_config_stats_reply |
| 10760 | |
| 10761 | class meter_config_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10762 | version = 4 |
| 10763 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10764 | stats_type = 10 |
| 10765 | |
| 10766 | def __init__(self, xid=None, flags=None, meter_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10767 | if xid != None: |
| 10768 | self.xid = xid |
| 10769 | else: |
| 10770 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10771 | if flags != None: |
| 10772 | self.flags = flags |
| 10773 | else: |
| 10774 | self.flags = 0 |
| 10775 | if meter_id != None: |
| 10776 | self.meter_id = meter_id |
| 10777 | else: |
| 10778 | self.meter_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10779 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10780 | |
| 10781 | def pack(self): |
| 10782 | packed = [] |
| 10783 | packed.append(struct.pack("!B", self.version)) |
| 10784 | packed.append(struct.pack("!B", self.type)) |
| 10785 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10786 | packed.append(struct.pack("!L", self.xid)) |
| 10787 | packed.append(struct.pack("!H", self.stats_type)) |
| 10788 | packed.append(struct.pack("!H", self.flags)) |
| 10789 | packed.append('\x00' * 4) |
| 10790 | packed.append(struct.pack("!L", self.meter_id)) |
| 10791 | packed.append('\x00' * 4) |
| 10792 | length = sum([len(x) for x in packed]) |
| 10793 | packed[2] = struct.pack("!H", length) |
| 10794 | return ''.join(packed) |
| 10795 | |
| 10796 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10797 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10798 | obj = meter_config_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10799 | _version = reader.read("!B")[0] |
| 10800 | assert(_version == 4) |
| 10801 | _type = reader.read("!B")[0] |
| 10802 | assert(_type == 18) |
| 10803 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10804 | orig_reader = reader |
| 10805 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10806 | obj.xid = reader.read("!L")[0] |
| 10807 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10808 | assert(_stats_type == 10) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10809 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10810 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10811 | obj.meter_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10812 | reader.skip(4) |
| 10813 | return obj |
| 10814 | |
| 10815 | def __eq__(self, other): |
| 10816 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10817 | if self.xid != other.xid: return False |
| 10818 | if self.flags != other.flags: return False |
| 10819 | if self.meter_id != other.meter_id: return False |
| 10820 | return True |
| 10821 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10822 | def pretty_print(self, q): |
| 10823 | q.text("meter_config_stats_request {") |
| 10824 | with q.group(): |
| 10825 | with q.indent(2): |
| 10826 | q.breakable() |
| 10827 | q.text("xid = "); |
| 10828 | if self.xid != None: |
| 10829 | q.text("%#x" % self.xid) |
| 10830 | else: |
| 10831 | q.text('None') |
| 10832 | q.text(","); q.breakable() |
| 10833 | q.text("flags = "); |
| 10834 | q.text("%#x" % self.flags) |
| 10835 | q.text(","); q.breakable() |
| 10836 | q.text("meter_id = "); |
| 10837 | q.text("%#x" % self.meter_id) |
| 10838 | q.breakable() |
| 10839 | q.text('}') |
| 10840 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10841 | stats_request.subtypes[10] = meter_config_stats_request |
| 10842 | |
| 10843 | class meter_features_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10844 | version = 4 |
| 10845 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10846 | stats_type = 11 |
| 10847 | |
| 10848 | def __init__(self, xid=None, flags=None, features=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10849 | if xid != None: |
| 10850 | self.xid = xid |
| 10851 | else: |
| 10852 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10853 | if flags != None: |
| 10854 | self.flags = flags |
| 10855 | else: |
| 10856 | self.flags = 0 |
| 10857 | if features != None: |
| 10858 | self.features = features |
| 10859 | else: |
| 10860 | self.features = common.meter_features() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10861 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10862 | |
| 10863 | def pack(self): |
| 10864 | packed = [] |
| 10865 | packed.append(struct.pack("!B", self.version)) |
| 10866 | packed.append(struct.pack("!B", self.type)) |
| 10867 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10868 | packed.append(struct.pack("!L", self.xid)) |
| 10869 | packed.append(struct.pack("!H", self.stats_type)) |
| 10870 | packed.append(struct.pack("!H", self.flags)) |
| 10871 | packed.append('\x00' * 4) |
| 10872 | packed.append(self.features.pack()) |
| 10873 | length = sum([len(x) for x in packed]) |
| 10874 | packed[2] = struct.pack("!H", length) |
| 10875 | return ''.join(packed) |
| 10876 | |
| 10877 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10878 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10879 | obj = meter_features_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10880 | _version = reader.read("!B")[0] |
| 10881 | assert(_version == 4) |
| 10882 | _type = reader.read("!B")[0] |
| 10883 | assert(_type == 19) |
| 10884 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10885 | orig_reader = reader |
| 10886 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10887 | obj.xid = reader.read("!L")[0] |
| 10888 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10889 | assert(_stats_type == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10890 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10891 | reader.skip(4) |
| 10892 | obj.features = common.meter_features.unpack(reader) |
| 10893 | return obj |
| 10894 | |
| 10895 | def __eq__(self, other): |
| 10896 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10897 | if self.xid != other.xid: return False |
| 10898 | if self.flags != other.flags: return False |
| 10899 | if self.features != other.features: return False |
| 10900 | return True |
| 10901 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10902 | def pretty_print(self, q): |
| 10903 | q.text("meter_features_stats_reply {") |
| 10904 | with q.group(): |
| 10905 | with q.indent(2): |
| 10906 | q.breakable() |
| 10907 | q.text("xid = "); |
| 10908 | if self.xid != None: |
| 10909 | q.text("%#x" % self.xid) |
| 10910 | else: |
| 10911 | q.text('None') |
| 10912 | q.text(","); q.breakable() |
| 10913 | q.text("flags = "); |
| 10914 | q.text("%#x" % self.flags) |
| 10915 | q.text(","); q.breakable() |
| 10916 | q.text("features = "); |
| 10917 | q.pp(self.features) |
| 10918 | q.breakable() |
| 10919 | q.text('}') |
| 10920 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10921 | stats_reply.subtypes[11] = meter_features_stats_reply |
| 10922 | |
| 10923 | class meter_features_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10924 | version = 4 |
| 10925 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10926 | stats_type = 11 |
| 10927 | |
| 10928 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10929 | if xid != None: |
| 10930 | self.xid = xid |
| 10931 | else: |
| 10932 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10933 | if flags != None: |
| 10934 | self.flags = flags |
| 10935 | else: |
| 10936 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10937 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10938 | |
| 10939 | def pack(self): |
| 10940 | packed = [] |
| 10941 | packed.append(struct.pack("!B", self.version)) |
| 10942 | packed.append(struct.pack("!B", self.type)) |
| 10943 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10944 | packed.append(struct.pack("!L", self.xid)) |
| 10945 | packed.append(struct.pack("!H", self.stats_type)) |
| 10946 | packed.append(struct.pack("!H", self.flags)) |
| 10947 | packed.append('\x00' * 4) |
| 10948 | length = sum([len(x) for x in packed]) |
| 10949 | packed[2] = struct.pack("!H", length) |
| 10950 | return ''.join(packed) |
| 10951 | |
| 10952 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10953 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10954 | obj = meter_features_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10955 | _version = reader.read("!B")[0] |
| 10956 | assert(_version == 4) |
| 10957 | _type = reader.read("!B")[0] |
| 10958 | assert(_type == 18) |
| 10959 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10960 | orig_reader = reader |
| 10961 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10962 | obj.xid = reader.read("!L")[0] |
| 10963 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10964 | assert(_stats_type == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10965 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10966 | reader.skip(4) |
| 10967 | return obj |
| 10968 | |
| 10969 | def __eq__(self, other): |
| 10970 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10971 | if self.xid != other.xid: return False |
| 10972 | if self.flags != other.flags: return False |
| 10973 | return True |
| 10974 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10975 | def pretty_print(self, q): |
| 10976 | q.text("meter_features_stats_request {") |
| 10977 | with q.group(): |
| 10978 | with q.indent(2): |
| 10979 | q.breakable() |
| 10980 | q.text("xid = "); |
| 10981 | if self.xid != None: |
| 10982 | q.text("%#x" % self.xid) |
| 10983 | else: |
| 10984 | q.text('None') |
| 10985 | q.text(","); q.breakable() |
| 10986 | q.text("flags = "); |
| 10987 | q.text("%#x" % self.flags) |
| 10988 | q.breakable() |
| 10989 | q.text('}') |
| 10990 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10991 | stats_request.subtypes[11] = meter_features_stats_request |
| 10992 | |
| 10993 | class meter_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10994 | version = 4 |
| 10995 | type = 29 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10996 | |
| 10997 | def __init__(self, xid=None, command=None, flags=None, meter_id=None, meters=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10998 | if xid != None: |
| 10999 | self.xid = xid |
| 11000 | else: |
| 11001 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11002 | if command != None: |
| 11003 | self.command = command |
| 11004 | else: |
| 11005 | self.command = 0 |
| 11006 | if flags != None: |
| 11007 | self.flags = flags |
| 11008 | else: |
| 11009 | self.flags = 0 |
| 11010 | if meter_id != None: |
| 11011 | self.meter_id = meter_id |
| 11012 | else: |
| 11013 | self.meter_id = 0 |
| 11014 | if meters != None: |
| 11015 | self.meters = meters |
| 11016 | else: |
| 11017 | self.meters = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11018 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11019 | |
| 11020 | def pack(self): |
| 11021 | packed = [] |
| 11022 | packed.append(struct.pack("!B", self.version)) |
| 11023 | packed.append(struct.pack("!B", self.type)) |
| 11024 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11025 | packed.append(struct.pack("!L", self.xid)) |
| 11026 | packed.append(struct.pack("!H", self.command)) |
| 11027 | packed.append(struct.pack("!H", self.flags)) |
| 11028 | packed.append(struct.pack("!L", self.meter_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11029 | packed.append(loxi.generic_util.pack_list(self.meters)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11030 | length = sum([len(x) for x in packed]) |
| 11031 | packed[2] = struct.pack("!H", length) |
| 11032 | return ''.join(packed) |
| 11033 | |
| 11034 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11035 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11036 | obj = meter_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11037 | _version = reader.read("!B")[0] |
| 11038 | assert(_version == 4) |
| 11039 | _type = reader.read("!B")[0] |
| 11040 | assert(_type == 29) |
| 11041 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11042 | orig_reader = reader |
| 11043 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11044 | obj.xid = reader.read("!L")[0] |
| 11045 | obj.command = reader.read("!H")[0] |
| 11046 | obj.flags = reader.read("!H")[0] |
| 11047 | obj.meter_id = reader.read("!L")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11048 | obj.meters = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11049 | return obj |
| 11050 | |
| 11051 | def __eq__(self, other): |
| 11052 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11053 | if self.xid != other.xid: return False |
| 11054 | if self.command != other.command: return False |
| 11055 | if self.flags != other.flags: return False |
| 11056 | if self.meter_id != other.meter_id: return False |
| 11057 | if self.meters != other.meters: return False |
| 11058 | return True |
| 11059 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11060 | def pretty_print(self, q): |
| 11061 | q.text("meter_mod {") |
| 11062 | with q.group(): |
| 11063 | with q.indent(2): |
| 11064 | q.breakable() |
| 11065 | q.text("xid = "); |
| 11066 | if self.xid != None: |
| 11067 | q.text("%#x" % self.xid) |
| 11068 | else: |
| 11069 | q.text('None') |
| 11070 | q.text(","); q.breakable() |
| 11071 | q.text("command = "); |
| 11072 | q.text("%#x" % self.command) |
| 11073 | q.text(","); q.breakable() |
| 11074 | q.text("flags = "); |
| 11075 | q.text("%#x" % self.flags) |
| 11076 | q.text(","); q.breakable() |
| 11077 | q.text("meter_id = "); |
| 11078 | q.text("%#x" % self.meter_id) |
| 11079 | q.text(","); q.breakable() |
| 11080 | q.text("meters = "); |
| 11081 | q.pp(self.meters) |
| 11082 | q.breakable() |
| 11083 | q.text('}') |
| 11084 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11085 | message.subtypes[29] = meter_mod |
| 11086 | |
| 11087 | class meter_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11088 | version = 4 |
| 11089 | type = 1 |
| 11090 | err_type = 12 |
| 11091 | |
| 11092 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11093 | if xid != None: |
| 11094 | self.xid = xid |
| 11095 | else: |
| 11096 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11097 | if code != None: |
| 11098 | self.code = code |
| 11099 | else: |
| 11100 | self.code = 0 |
| 11101 | if data != None: |
| 11102 | self.data = data |
| 11103 | else: |
| 11104 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11105 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11106 | |
| 11107 | def pack(self): |
| 11108 | packed = [] |
| 11109 | packed.append(struct.pack("!B", self.version)) |
| 11110 | packed.append(struct.pack("!B", self.type)) |
| 11111 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11112 | packed.append(struct.pack("!L", self.xid)) |
| 11113 | packed.append(struct.pack("!H", self.err_type)) |
| 11114 | packed.append(struct.pack("!H", self.code)) |
| 11115 | packed.append(self.data) |
| 11116 | length = sum([len(x) for x in packed]) |
| 11117 | packed[2] = struct.pack("!H", length) |
| 11118 | return ''.join(packed) |
| 11119 | |
| 11120 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11121 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11122 | obj = meter_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11123 | _version = reader.read("!B")[0] |
| 11124 | assert(_version == 4) |
| 11125 | _type = reader.read("!B")[0] |
| 11126 | assert(_type == 1) |
| 11127 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11128 | orig_reader = reader |
| 11129 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11130 | obj.xid = reader.read("!L")[0] |
| 11131 | _err_type = reader.read("!H")[0] |
| 11132 | assert(_err_type == 12) |
| 11133 | obj.code = reader.read("!H")[0] |
| 11134 | obj.data = str(reader.read_all()) |
| 11135 | return obj |
| 11136 | |
| 11137 | def __eq__(self, other): |
| 11138 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11139 | if self.xid != other.xid: return False |
| 11140 | if self.code != other.code: return False |
| 11141 | if self.data != other.data: return False |
| 11142 | return True |
| 11143 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11144 | def pretty_print(self, q): |
| 11145 | q.text("meter_mod_failed_error_msg {") |
| 11146 | with q.group(): |
| 11147 | with q.indent(2): |
| 11148 | q.breakable() |
| 11149 | q.text("xid = "); |
| 11150 | if self.xid != None: |
| 11151 | q.text("%#x" % self.xid) |
| 11152 | else: |
| 11153 | q.text('None') |
| 11154 | q.text(","); q.breakable() |
| 11155 | q.text("code = "); |
| 11156 | q.text("%#x" % self.code) |
| 11157 | q.text(","); q.breakable() |
| 11158 | q.text("data = "); |
| 11159 | q.pp(self.data) |
| 11160 | q.breakable() |
| 11161 | q.text('}') |
| 11162 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11163 | error_msg.subtypes[12] = meter_mod_failed_error_msg |
| 11164 | |
| 11165 | class meter_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11166 | version = 4 |
| 11167 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11168 | stats_type = 9 |
| 11169 | |
| 11170 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11171 | if xid != None: |
| 11172 | self.xid = xid |
| 11173 | else: |
| 11174 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11175 | if flags != None: |
| 11176 | self.flags = flags |
| 11177 | else: |
| 11178 | self.flags = 0 |
| 11179 | if entries != None: |
| 11180 | self.entries = entries |
| 11181 | else: |
| 11182 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11183 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11184 | |
| 11185 | def pack(self): |
| 11186 | packed = [] |
| 11187 | packed.append(struct.pack("!B", self.version)) |
| 11188 | packed.append(struct.pack("!B", self.type)) |
| 11189 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11190 | packed.append(struct.pack("!L", self.xid)) |
| 11191 | packed.append(struct.pack("!H", self.stats_type)) |
| 11192 | packed.append(struct.pack("!H", self.flags)) |
| 11193 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11194 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11195 | length = sum([len(x) for x in packed]) |
| 11196 | packed[2] = struct.pack("!H", length) |
| 11197 | return ''.join(packed) |
| 11198 | |
| 11199 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11200 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11201 | obj = meter_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11202 | _version = reader.read("!B")[0] |
| 11203 | assert(_version == 4) |
| 11204 | _type = reader.read("!B")[0] |
| 11205 | assert(_type == 19) |
| 11206 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11207 | orig_reader = reader |
| 11208 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11209 | obj.xid = reader.read("!L")[0] |
| 11210 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11211 | assert(_stats_type == 9) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11212 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11213 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11214 | obj.entries = loxi.generic_util.unpack_list(reader, common.meter_stats.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11215 | return obj |
| 11216 | |
| 11217 | def __eq__(self, other): |
| 11218 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11219 | if self.xid != other.xid: return False |
| 11220 | if self.flags != other.flags: return False |
| 11221 | if self.entries != other.entries: return False |
| 11222 | return True |
| 11223 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11224 | def pretty_print(self, q): |
| 11225 | q.text("meter_stats_reply {") |
| 11226 | with q.group(): |
| 11227 | with q.indent(2): |
| 11228 | q.breakable() |
| 11229 | q.text("xid = "); |
| 11230 | if self.xid != None: |
| 11231 | q.text("%#x" % self.xid) |
| 11232 | else: |
| 11233 | q.text('None') |
| 11234 | q.text(","); q.breakable() |
| 11235 | q.text("flags = "); |
| 11236 | q.text("%#x" % self.flags) |
| 11237 | q.text(","); q.breakable() |
| 11238 | q.text("entries = "); |
| 11239 | q.pp(self.entries) |
| 11240 | q.breakable() |
| 11241 | q.text('}') |
| 11242 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11243 | stats_reply.subtypes[9] = meter_stats_reply |
| 11244 | |
| 11245 | class meter_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11246 | version = 4 |
| 11247 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11248 | stats_type = 9 |
| 11249 | |
| 11250 | def __init__(self, xid=None, flags=None, meter_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11251 | if xid != None: |
| 11252 | self.xid = xid |
| 11253 | else: |
| 11254 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11255 | if flags != None: |
| 11256 | self.flags = flags |
| 11257 | else: |
| 11258 | self.flags = 0 |
| 11259 | if meter_id != None: |
| 11260 | self.meter_id = meter_id |
| 11261 | else: |
| 11262 | self.meter_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11263 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11264 | |
| 11265 | def pack(self): |
| 11266 | packed = [] |
| 11267 | packed.append(struct.pack("!B", self.version)) |
| 11268 | packed.append(struct.pack("!B", self.type)) |
| 11269 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11270 | packed.append(struct.pack("!L", self.xid)) |
| 11271 | packed.append(struct.pack("!H", self.stats_type)) |
| 11272 | packed.append(struct.pack("!H", self.flags)) |
| 11273 | packed.append('\x00' * 4) |
| 11274 | packed.append(struct.pack("!L", self.meter_id)) |
| 11275 | packed.append('\x00' * 4) |
| 11276 | length = sum([len(x) for x in packed]) |
| 11277 | packed[2] = struct.pack("!H", length) |
| 11278 | return ''.join(packed) |
| 11279 | |
| 11280 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11281 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11282 | obj = meter_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11283 | _version = reader.read("!B")[0] |
| 11284 | assert(_version == 4) |
| 11285 | _type = reader.read("!B")[0] |
| 11286 | assert(_type == 18) |
| 11287 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11288 | orig_reader = reader |
| 11289 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11290 | obj.xid = reader.read("!L")[0] |
| 11291 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11292 | assert(_stats_type == 9) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11293 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11294 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11295 | obj.meter_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11296 | reader.skip(4) |
| 11297 | return obj |
| 11298 | |
| 11299 | def __eq__(self, other): |
| 11300 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11301 | if self.xid != other.xid: return False |
| 11302 | if self.flags != other.flags: return False |
| 11303 | if self.meter_id != other.meter_id: return False |
| 11304 | return True |
| 11305 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11306 | def pretty_print(self, q): |
| 11307 | q.text("meter_stats_request {") |
| 11308 | with q.group(): |
| 11309 | with q.indent(2): |
| 11310 | q.breakable() |
| 11311 | q.text("xid = "); |
| 11312 | if self.xid != None: |
| 11313 | q.text("%#x" % self.xid) |
| 11314 | else: |
| 11315 | q.text('None') |
| 11316 | q.text(","); q.breakable() |
| 11317 | q.text("flags = "); |
| 11318 | q.text("%#x" % self.flags) |
| 11319 | q.text(","); q.breakable() |
| 11320 | q.text("meter_id = "); |
| 11321 | q.text("%#x" % self.meter_id) |
| 11322 | q.breakable() |
| 11323 | q.text('}') |
| 11324 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11325 | stats_request.subtypes[9] = meter_stats_request |
| 11326 | |
| 11327 | class nicira_header(experimenter): |
| 11328 | subtypes = {} |
| 11329 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 11330 | version = 4 |
| 11331 | type = 4 |
| 11332 | experimenter = 8992 |
| 11333 | |
| 11334 | def __init__(self, xid=None, subtype=None): |
| 11335 | if xid != None: |
| 11336 | self.xid = xid |
| 11337 | else: |
| 11338 | self.xid = None |
| 11339 | if subtype != None: |
| 11340 | self.subtype = subtype |
| 11341 | else: |
| 11342 | self.subtype = 0 |
| 11343 | return |
| 11344 | |
| 11345 | def pack(self): |
| 11346 | packed = [] |
| 11347 | packed.append(struct.pack("!B", self.version)) |
| 11348 | packed.append(struct.pack("!B", self.type)) |
| 11349 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11350 | packed.append(struct.pack("!L", self.xid)) |
| 11351 | packed.append(struct.pack("!L", self.experimenter)) |
| 11352 | packed.append(struct.pack("!L", self.subtype)) |
| 11353 | length = sum([len(x) for x in packed]) |
| 11354 | packed[2] = struct.pack("!H", length) |
| 11355 | return ''.join(packed) |
| 11356 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11357 | @staticmethod |
| 11358 | def unpack(reader): |
| 11359 | subtype, = reader.peek('!L', 12) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 11360 | subclass = nicira_header.subtypes.get(subtype) |
| 11361 | if subclass: |
| 11362 | return subclass.unpack(reader) |
| 11363 | |
| 11364 | obj = nicira_header() |
| 11365 | _version = reader.read("!B")[0] |
| 11366 | assert(_version == 4) |
| 11367 | _type = reader.read("!B")[0] |
| 11368 | assert(_type == 4) |
| 11369 | _length = reader.read("!H")[0] |
| 11370 | orig_reader = reader |
| 11371 | reader = orig_reader.slice(_length - (2 + 2)) |
| 11372 | obj.xid = reader.read("!L")[0] |
| 11373 | _experimenter = reader.read("!L")[0] |
| 11374 | assert(_experimenter == 8992) |
| 11375 | obj.subtype = reader.read("!L")[0] |
| 11376 | return obj |
| 11377 | |
| 11378 | def __eq__(self, other): |
| 11379 | if type(self) != type(other): return False |
| 11380 | if self.xid != other.xid: return False |
| 11381 | if self.subtype != other.subtype: return False |
| 11382 | return True |
| 11383 | |
| 11384 | def pretty_print(self, q): |
| 11385 | q.text("nicira_header {") |
| 11386 | with q.group(): |
| 11387 | with q.indent(2): |
| 11388 | q.breakable() |
| 11389 | q.text("xid = "); |
| 11390 | if self.xid != None: |
| 11391 | q.text("%#x" % self.xid) |
| 11392 | else: |
| 11393 | q.text('None') |
| 11394 | q.breakable() |
| 11395 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11396 | |
| 11397 | experimenter.subtypes[8992] = nicira_header |
| 11398 | |
| 11399 | class packet_in(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11400 | version = 4 |
| 11401 | type = 10 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11402 | |
| 11403 | def __init__(self, xid=None, buffer_id=None, total_len=None, reason=None, table_id=None, cookie=None, match=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11404 | if xid != None: |
| 11405 | self.xid = xid |
| 11406 | else: |
| 11407 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11408 | if buffer_id != None: |
| 11409 | self.buffer_id = buffer_id |
| 11410 | else: |
| 11411 | self.buffer_id = 0 |
| 11412 | if total_len != None: |
| 11413 | self.total_len = total_len |
| 11414 | else: |
| 11415 | self.total_len = 0 |
| 11416 | if reason != None: |
| 11417 | self.reason = reason |
| 11418 | else: |
| 11419 | self.reason = 0 |
| 11420 | if table_id != None: |
| 11421 | self.table_id = table_id |
| 11422 | else: |
| 11423 | self.table_id = 0 |
| 11424 | if cookie != None: |
| 11425 | self.cookie = cookie |
| 11426 | else: |
| 11427 | self.cookie = 0 |
| 11428 | if match != None: |
| 11429 | self.match = match |
| 11430 | else: |
| 11431 | self.match = common.match() |
| 11432 | if data != None: |
| 11433 | self.data = data |
| 11434 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11435 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11436 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11437 | |
| 11438 | def pack(self): |
| 11439 | packed = [] |
| 11440 | packed.append(struct.pack("!B", self.version)) |
| 11441 | packed.append(struct.pack("!B", self.type)) |
| 11442 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11443 | packed.append(struct.pack("!L", self.xid)) |
| 11444 | packed.append(struct.pack("!L", self.buffer_id)) |
| 11445 | packed.append(struct.pack("!H", self.total_len)) |
| 11446 | packed.append(struct.pack("!B", self.reason)) |
| 11447 | packed.append(struct.pack("!B", self.table_id)) |
| 11448 | packed.append(struct.pack("!Q", self.cookie)) |
| 11449 | packed.append(self.match.pack()) |
| 11450 | packed.append('\x00' * 2) |
| 11451 | packed.append(self.data) |
| 11452 | length = sum([len(x) for x in packed]) |
| 11453 | packed[2] = struct.pack("!H", length) |
| 11454 | return ''.join(packed) |
| 11455 | |
| 11456 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11457 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11458 | obj = packet_in() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11459 | _version = reader.read("!B")[0] |
| 11460 | assert(_version == 4) |
| 11461 | _type = reader.read("!B")[0] |
| 11462 | assert(_type == 10) |
| 11463 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11464 | orig_reader = reader |
| 11465 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11466 | obj.xid = reader.read("!L")[0] |
| 11467 | obj.buffer_id = reader.read("!L")[0] |
| 11468 | obj.total_len = reader.read("!H")[0] |
| 11469 | obj.reason = reader.read("!B")[0] |
| 11470 | obj.table_id = reader.read("!B")[0] |
| 11471 | obj.cookie = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11472 | obj.match = common.match.unpack(reader) |
| 11473 | reader.skip(2) |
| 11474 | obj.data = str(reader.read_all()) |
| 11475 | return obj |
| 11476 | |
| 11477 | def __eq__(self, other): |
| 11478 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11479 | if self.xid != other.xid: return False |
| 11480 | if self.buffer_id != other.buffer_id: return False |
| 11481 | if self.total_len != other.total_len: return False |
| 11482 | if self.reason != other.reason: return False |
| 11483 | if self.table_id != other.table_id: return False |
| 11484 | if self.cookie != other.cookie: return False |
| 11485 | if self.match != other.match: return False |
| 11486 | if self.data != other.data: return False |
| 11487 | return True |
| 11488 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11489 | def pretty_print(self, q): |
| 11490 | q.text("packet_in {") |
| 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("buffer_id = "); |
| 11501 | q.text("%#x" % self.buffer_id) |
| 11502 | q.text(","); q.breakable() |
| 11503 | q.text("total_len = "); |
| 11504 | q.text("%#x" % self.total_len) |
| 11505 | q.text(","); q.breakable() |
| 11506 | q.text("reason = "); |
| 11507 | q.text("%#x" % self.reason) |
| 11508 | q.text(","); q.breakable() |
| 11509 | q.text("table_id = "); |
| 11510 | q.text("%#x" % self.table_id) |
| 11511 | q.text(","); q.breakable() |
| 11512 | q.text("cookie = "); |
| 11513 | q.text("%#x" % self.cookie) |
| 11514 | q.text(","); q.breakable() |
| 11515 | q.text("match = "); |
| 11516 | q.pp(self.match) |
| 11517 | q.text(","); q.breakable() |
| 11518 | q.text("data = "); |
| 11519 | q.pp(self.data) |
| 11520 | q.breakable() |
| 11521 | q.text('}') |
| 11522 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11523 | message.subtypes[10] = packet_in |
| 11524 | |
| 11525 | class packet_out(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11526 | version = 4 |
| 11527 | type = 13 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11528 | |
| 11529 | def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11530 | if xid != None: |
| 11531 | self.xid = xid |
| 11532 | else: |
| 11533 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11534 | if buffer_id != None: |
| 11535 | self.buffer_id = buffer_id |
| 11536 | else: |
| 11537 | self.buffer_id = 0 |
| 11538 | if in_port != None: |
| 11539 | self.in_port = in_port |
| 11540 | else: |
| 11541 | self.in_port = 0 |
| 11542 | if actions != None: |
| 11543 | self.actions = actions |
| 11544 | else: |
| 11545 | self.actions = [] |
| 11546 | if data != None: |
| 11547 | self.data = data |
| 11548 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11549 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11550 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11551 | |
| 11552 | def pack(self): |
| 11553 | packed = [] |
| 11554 | packed.append(struct.pack("!B", self.version)) |
| 11555 | packed.append(struct.pack("!B", self.type)) |
| 11556 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11557 | packed.append(struct.pack("!L", self.xid)) |
| 11558 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11559 | packed.append(util.pack_port_no(self.in_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11560 | packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6 |
| 11561 | packed.append('\x00' * 6) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11562 | packed.append(loxi.generic_util.pack_list(self.actions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11563 | packed[6] = struct.pack("!H", len(packed[-1])) |
| 11564 | packed.append(self.data) |
| 11565 | length = sum([len(x) for x in packed]) |
| 11566 | packed[2] = struct.pack("!H", length) |
| 11567 | return ''.join(packed) |
| 11568 | |
| 11569 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11570 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11571 | obj = packet_out() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11572 | _version = reader.read("!B")[0] |
| 11573 | assert(_version == 4) |
| 11574 | _type = reader.read("!B")[0] |
| 11575 | assert(_type == 13) |
| 11576 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11577 | orig_reader = reader |
| 11578 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11579 | obj.xid = reader.read("!L")[0] |
| 11580 | obj.buffer_id = reader.read("!L")[0] |
| 11581 | obj.in_port = util.unpack_port_no(reader) |
| 11582 | _actions_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11583 | reader.skip(6) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11584 | obj.actions = loxi.generic_util.unpack_list(reader.slice(_actions_len), action.action.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11585 | obj.data = str(reader.read_all()) |
| 11586 | return obj |
| 11587 | |
| 11588 | def __eq__(self, other): |
| 11589 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11590 | if self.xid != other.xid: return False |
| 11591 | if self.buffer_id != other.buffer_id: return False |
| 11592 | if self.in_port != other.in_port: return False |
| 11593 | if self.actions != other.actions: return False |
| 11594 | if self.data != other.data: return False |
| 11595 | return True |
| 11596 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11597 | def pretty_print(self, q): |
| 11598 | q.text("packet_out {") |
| 11599 | with q.group(): |
| 11600 | with q.indent(2): |
| 11601 | q.breakable() |
| 11602 | q.text("xid = "); |
| 11603 | if self.xid != None: |
| 11604 | q.text("%#x" % self.xid) |
| 11605 | else: |
| 11606 | q.text('None') |
| 11607 | q.text(","); q.breakable() |
| 11608 | q.text("buffer_id = "); |
| 11609 | q.text("%#x" % self.buffer_id) |
| 11610 | q.text(","); q.breakable() |
| 11611 | q.text("in_port = "); |
| 11612 | q.text(util.pretty_port(self.in_port)) |
| 11613 | q.text(","); q.breakable() |
| 11614 | q.text("actions = "); |
| 11615 | q.pp(self.actions) |
| 11616 | q.text(","); q.breakable() |
| 11617 | q.text("data = "); |
| 11618 | q.pp(self.data) |
| 11619 | q.breakable() |
| 11620 | q.text('}') |
| 11621 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11622 | message.subtypes[13] = packet_out |
| 11623 | |
| 11624 | class port_desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11625 | version = 4 |
| 11626 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11627 | stats_type = 13 |
| 11628 | |
| 11629 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11630 | if xid != None: |
| 11631 | self.xid = xid |
| 11632 | else: |
| 11633 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11634 | if flags != None: |
| 11635 | self.flags = flags |
| 11636 | else: |
| 11637 | self.flags = 0 |
| 11638 | if entries != None: |
| 11639 | self.entries = entries |
| 11640 | else: |
| 11641 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11642 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11643 | |
| 11644 | def pack(self): |
| 11645 | packed = [] |
| 11646 | packed.append(struct.pack("!B", self.version)) |
| 11647 | packed.append(struct.pack("!B", self.type)) |
| 11648 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11649 | packed.append(struct.pack("!L", self.xid)) |
| 11650 | packed.append(struct.pack("!H", self.stats_type)) |
| 11651 | packed.append(struct.pack("!H", self.flags)) |
| 11652 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11653 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11654 | length = sum([len(x) for x in packed]) |
| 11655 | packed[2] = struct.pack("!H", length) |
| 11656 | return ''.join(packed) |
| 11657 | |
| 11658 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11659 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11660 | obj = port_desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11661 | _version = reader.read("!B")[0] |
| 11662 | assert(_version == 4) |
| 11663 | _type = reader.read("!B")[0] |
| 11664 | assert(_type == 19) |
| 11665 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11666 | orig_reader = reader |
| 11667 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11668 | obj.xid = reader.read("!L")[0] |
| 11669 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11670 | assert(_stats_type == 13) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11671 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11672 | reader.skip(4) |
| 11673 | obj.entries = loxi.generic_util.unpack_list(reader, common.port_desc.unpack) |
| 11674 | return obj |
| 11675 | |
| 11676 | def __eq__(self, other): |
| 11677 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11678 | if self.xid != other.xid: return False |
| 11679 | if self.flags != other.flags: return False |
| 11680 | if self.entries != other.entries: return False |
| 11681 | return True |
| 11682 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11683 | def pretty_print(self, q): |
| 11684 | q.text("port_desc_stats_reply {") |
| 11685 | with q.group(): |
| 11686 | with q.indent(2): |
| 11687 | q.breakable() |
| 11688 | q.text("xid = "); |
| 11689 | if self.xid != None: |
| 11690 | q.text("%#x" % self.xid) |
| 11691 | else: |
| 11692 | q.text('None') |
| 11693 | q.text(","); q.breakable() |
| 11694 | q.text("flags = "); |
| 11695 | q.text("%#x" % self.flags) |
| 11696 | q.text(","); q.breakable() |
| 11697 | q.text("entries = "); |
| 11698 | q.pp(self.entries) |
| 11699 | q.breakable() |
| 11700 | q.text('}') |
| 11701 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11702 | stats_reply.subtypes[13] = port_desc_stats_reply |
| 11703 | |
| 11704 | class port_desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11705 | version = 4 |
| 11706 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11707 | stats_type = 13 |
| 11708 | |
| 11709 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11710 | if xid != None: |
| 11711 | self.xid = xid |
| 11712 | else: |
| 11713 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11714 | if flags != None: |
| 11715 | self.flags = flags |
| 11716 | else: |
| 11717 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11718 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11719 | |
| 11720 | def pack(self): |
| 11721 | packed = [] |
| 11722 | packed.append(struct.pack("!B", self.version)) |
| 11723 | packed.append(struct.pack("!B", self.type)) |
| 11724 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11725 | packed.append(struct.pack("!L", self.xid)) |
| 11726 | packed.append(struct.pack("!H", self.stats_type)) |
| 11727 | packed.append(struct.pack("!H", self.flags)) |
| 11728 | packed.append('\x00' * 4) |
| 11729 | length = sum([len(x) for x in packed]) |
| 11730 | packed[2] = struct.pack("!H", length) |
| 11731 | return ''.join(packed) |
| 11732 | |
| 11733 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11734 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11735 | obj = port_desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11736 | _version = reader.read("!B")[0] |
| 11737 | assert(_version == 4) |
| 11738 | _type = reader.read("!B")[0] |
| 11739 | assert(_type == 18) |
| 11740 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11741 | orig_reader = reader |
| 11742 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11743 | obj.xid = reader.read("!L")[0] |
| 11744 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11745 | assert(_stats_type == 13) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11746 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11747 | reader.skip(4) |
| 11748 | return obj |
| 11749 | |
| 11750 | def __eq__(self, other): |
| 11751 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11752 | if self.xid != other.xid: return False |
| 11753 | if self.flags != other.flags: return False |
| 11754 | return True |
| 11755 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11756 | def pretty_print(self, q): |
| 11757 | q.text("port_desc_stats_request {") |
| 11758 | with q.group(): |
| 11759 | with q.indent(2): |
| 11760 | q.breakable() |
| 11761 | q.text("xid = "); |
| 11762 | if self.xid != None: |
| 11763 | q.text("%#x" % self.xid) |
| 11764 | else: |
| 11765 | q.text('None') |
| 11766 | q.text(","); q.breakable() |
| 11767 | q.text("flags = "); |
| 11768 | q.text("%#x" % self.flags) |
| 11769 | q.breakable() |
| 11770 | q.text('}') |
| 11771 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11772 | stats_request.subtypes[13] = port_desc_stats_request |
| 11773 | |
| 11774 | class port_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11775 | version = 4 |
| 11776 | type = 16 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11777 | |
| 11778 | def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, advertise=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11779 | if xid != None: |
| 11780 | self.xid = xid |
| 11781 | else: |
| 11782 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11783 | if port_no != None: |
| 11784 | self.port_no = port_no |
| 11785 | else: |
| 11786 | self.port_no = 0 |
| 11787 | if hw_addr != None: |
| 11788 | self.hw_addr = hw_addr |
| 11789 | else: |
| 11790 | self.hw_addr = [0,0,0,0,0,0] |
| 11791 | if config != None: |
| 11792 | self.config = config |
| 11793 | else: |
| 11794 | self.config = 0 |
| 11795 | if mask != None: |
| 11796 | self.mask = mask |
| 11797 | else: |
| 11798 | self.mask = 0 |
| 11799 | if advertise != None: |
| 11800 | self.advertise = advertise |
| 11801 | else: |
| 11802 | self.advertise = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11803 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11804 | |
| 11805 | def pack(self): |
| 11806 | packed = [] |
| 11807 | packed.append(struct.pack("!B", self.version)) |
| 11808 | packed.append(struct.pack("!B", self.type)) |
| 11809 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11810 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11811 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11812 | packed.append('\x00' * 4) |
| 11813 | packed.append(struct.pack("!6B", *self.hw_addr)) |
| 11814 | packed.append('\x00' * 2) |
| 11815 | packed.append(struct.pack("!L", self.config)) |
| 11816 | packed.append(struct.pack("!L", self.mask)) |
| 11817 | packed.append(struct.pack("!L", self.advertise)) |
| 11818 | packed.append('\x00' * 4) |
| 11819 | length = sum([len(x) for x in packed]) |
| 11820 | packed[2] = struct.pack("!H", length) |
| 11821 | return ''.join(packed) |
| 11822 | |
| 11823 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11824 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11825 | obj = port_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11826 | _version = reader.read("!B")[0] |
| 11827 | assert(_version == 4) |
| 11828 | _type = reader.read("!B")[0] |
| 11829 | assert(_type == 16) |
| 11830 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11831 | orig_reader = reader |
| 11832 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11833 | obj.xid = reader.read("!L")[0] |
| 11834 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11835 | reader.skip(4) |
| 11836 | obj.hw_addr = list(reader.read('!6B')) |
| 11837 | reader.skip(2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11838 | obj.config = reader.read("!L")[0] |
| 11839 | obj.mask = reader.read("!L")[0] |
| 11840 | obj.advertise = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11841 | reader.skip(4) |
| 11842 | return obj |
| 11843 | |
| 11844 | def __eq__(self, other): |
| 11845 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11846 | if self.xid != other.xid: return False |
| 11847 | if self.port_no != other.port_no: return False |
| 11848 | if self.hw_addr != other.hw_addr: return False |
| 11849 | if self.config != other.config: return False |
| 11850 | if self.mask != other.mask: return False |
| 11851 | if self.advertise != other.advertise: return False |
| 11852 | return True |
| 11853 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11854 | def pretty_print(self, q): |
| 11855 | q.text("port_mod {") |
| 11856 | with q.group(): |
| 11857 | with q.indent(2): |
| 11858 | q.breakable() |
| 11859 | q.text("xid = "); |
| 11860 | if self.xid != None: |
| 11861 | q.text("%#x" % self.xid) |
| 11862 | else: |
| 11863 | q.text('None') |
| 11864 | q.text(","); q.breakable() |
| 11865 | q.text("port_no = "); |
| 11866 | q.text(util.pretty_port(self.port_no)) |
| 11867 | q.text(","); q.breakable() |
| 11868 | q.text("hw_addr = "); |
| 11869 | q.text(util.pretty_mac(self.hw_addr)) |
| 11870 | q.text(","); q.breakable() |
| 11871 | q.text("config = "); |
| 11872 | q.text("%#x" % self.config) |
| 11873 | q.text(","); q.breakable() |
| 11874 | q.text("mask = "); |
| 11875 | q.text("%#x" % self.mask) |
| 11876 | q.text(","); q.breakable() |
| 11877 | q.text("advertise = "); |
| 11878 | q.text("%#x" % self.advertise) |
| 11879 | q.breakable() |
| 11880 | q.text('}') |
| 11881 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11882 | message.subtypes[16] = port_mod |
| 11883 | |
| 11884 | class port_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11885 | version = 4 |
| 11886 | type = 1 |
| 11887 | err_type = 7 |
| 11888 | |
| 11889 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11890 | if xid != None: |
| 11891 | self.xid = xid |
| 11892 | else: |
| 11893 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11894 | if code != None: |
| 11895 | self.code = code |
| 11896 | else: |
| 11897 | self.code = 0 |
| 11898 | if data != None: |
| 11899 | self.data = data |
| 11900 | else: |
| 11901 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11902 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11903 | |
| 11904 | def pack(self): |
| 11905 | packed = [] |
| 11906 | packed.append(struct.pack("!B", self.version)) |
| 11907 | packed.append(struct.pack("!B", self.type)) |
| 11908 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11909 | packed.append(struct.pack("!L", self.xid)) |
| 11910 | packed.append(struct.pack("!H", self.err_type)) |
| 11911 | packed.append(struct.pack("!H", self.code)) |
| 11912 | packed.append(self.data) |
| 11913 | length = sum([len(x) for x in packed]) |
| 11914 | packed[2] = struct.pack("!H", length) |
| 11915 | return ''.join(packed) |
| 11916 | |
| 11917 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11918 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11919 | obj = port_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11920 | _version = reader.read("!B")[0] |
| 11921 | assert(_version == 4) |
| 11922 | _type = reader.read("!B")[0] |
| 11923 | assert(_type == 1) |
| 11924 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11925 | orig_reader = reader |
| 11926 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11927 | obj.xid = reader.read("!L")[0] |
| 11928 | _err_type = reader.read("!H")[0] |
| 11929 | assert(_err_type == 7) |
| 11930 | obj.code = reader.read("!H")[0] |
| 11931 | obj.data = str(reader.read_all()) |
| 11932 | return obj |
| 11933 | |
| 11934 | def __eq__(self, other): |
| 11935 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11936 | if self.xid != other.xid: return False |
| 11937 | if self.code != other.code: return False |
| 11938 | if self.data != other.data: return False |
| 11939 | return True |
| 11940 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11941 | def pretty_print(self, q): |
| 11942 | q.text("port_mod_failed_error_msg {") |
| 11943 | with q.group(): |
| 11944 | with q.indent(2): |
| 11945 | q.breakable() |
| 11946 | q.text("xid = "); |
| 11947 | if self.xid != None: |
| 11948 | q.text("%#x" % self.xid) |
| 11949 | else: |
| 11950 | q.text('None') |
| 11951 | q.text(","); q.breakable() |
| 11952 | q.text("code = "); |
| 11953 | q.text("%#x" % self.code) |
| 11954 | q.text(","); q.breakable() |
| 11955 | q.text("data = "); |
| 11956 | q.pp(self.data) |
| 11957 | q.breakable() |
| 11958 | q.text('}') |
| 11959 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11960 | error_msg.subtypes[7] = port_mod_failed_error_msg |
| 11961 | |
| 11962 | class port_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11963 | version = 4 |
| 11964 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11965 | stats_type = 4 |
| 11966 | |
| 11967 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11968 | if xid != None: |
| 11969 | self.xid = xid |
| 11970 | else: |
| 11971 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11972 | if flags != None: |
| 11973 | self.flags = flags |
| 11974 | else: |
| 11975 | self.flags = 0 |
| 11976 | if entries != None: |
| 11977 | self.entries = entries |
| 11978 | else: |
| 11979 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11980 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11981 | |
| 11982 | def pack(self): |
| 11983 | packed = [] |
| 11984 | packed.append(struct.pack("!B", self.version)) |
| 11985 | packed.append(struct.pack("!B", self.type)) |
| 11986 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11987 | packed.append(struct.pack("!L", self.xid)) |
| 11988 | packed.append(struct.pack("!H", self.stats_type)) |
| 11989 | packed.append(struct.pack("!H", self.flags)) |
| 11990 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11991 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11992 | length = sum([len(x) for x in packed]) |
| 11993 | packed[2] = struct.pack("!H", length) |
| 11994 | return ''.join(packed) |
| 11995 | |
| 11996 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11997 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11998 | obj = port_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11999 | _version = reader.read("!B")[0] |
| 12000 | assert(_version == 4) |
| 12001 | _type = reader.read("!B")[0] |
| 12002 | assert(_type == 19) |
| 12003 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12004 | orig_reader = reader |
| 12005 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12006 | obj.xid = reader.read("!L")[0] |
| 12007 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12008 | assert(_stats_type == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12009 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12010 | reader.skip(4) |
| 12011 | obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack) |
| 12012 | return obj |
| 12013 | |
| 12014 | def __eq__(self, other): |
| 12015 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12016 | if self.xid != other.xid: return False |
| 12017 | if self.flags != other.flags: return False |
| 12018 | if self.entries != other.entries: return False |
| 12019 | return True |
| 12020 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12021 | def pretty_print(self, q): |
| 12022 | q.text("port_stats_reply {") |
| 12023 | with q.group(): |
| 12024 | with q.indent(2): |
| 12025 | q.breakable() |
| 12026 | q.text("xid = "); |
| 12027 | if self.xid != None: |
| 12028 | q.text("%#x" % self.xid) |
| 12029 | else: |
| 12030 | q.text('None') |
| 12031 | q.text(","); q.breakable() |
| 12032 | q.text("flags = "); |
| 12033 | q.text("%#x" % self.flags) |
| 12034 | q.text(","); q.breakable() |
| 12035 | q.text("entries = "); |
| 12036 | q.pp(self.entries) |
| 12037 | q.breakable() |
| 12038 | q.text('}') |
| 12039 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12040 | stats_reply.subtypes[4] = port_stats_reply |
| 12041 | |
| 12042 | class port_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12043 | version = 4 |
| 12044 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12045 | stats_type = 4 |
| 12046 | |
| 12047 | def __init__(self, xid=None, flags=None, port_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12048 | if xid != None: |
| 12049 | self.xid = xid |
| 12050 | else: |
| 12051 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12052 | if flags != None: |
| 12053 | self.flags = flags |
| 12054 | else: |
| 12055 | self.flags = 0 |
| 12056 | if port_no != None: |
| 12057 | self.port_no = port_no |
| 12058 | else: |
| 12059 | self.port_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12060 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12061 | |
| 12062 | def pack(self): |
| 12063 | packed = [] |
| 12064 | packed.append(struct.pack("!B", self.version)) |
| 12065 | packed.append(struct.pack("!B", self.type)) |
| 12066 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12067 | packed.append(struct.pack("!L", self.xid)) |
| 12068 | packed.append(struct.pack("!H", self.stats_type)) |
| 12069 | packed.append(struct.pack("!H", self.flags)) |
| 12070 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12071 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12072 | packed.append('\x00' * 4) |
| 12073 | length = sum([len(x) for x in packed]) |
| 12074 | packed[2] = struct.pack("!H", length) |
| 12075 | return ''.join(packed) |
| 12076 | |
| 12077 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12078 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12079 | obj = port_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12080 | _version = reader.read("!B")[0] |
| 12081 | assert(_version == 4) |
| 12082 | _type = reader.read("!B")[0] |
| 12083 | assert(_type == 18) |
| 12084 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12085 | orig_reader = reader |
| 12086 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12087 | obj.xid = reader.read("!L")[0] |
| 12088 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12089 | assert(_stats_type == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12090 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12091 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12092 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12093 | reader.skip(4) |
| 12094 | return obj |
| 12095 | |
| 12096 | def __eq__(self, other): |
| 12097 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12098 | if self.xid != other.xid: return False |
| 12099 | if self.flags != other.flags: return False |
| 12100 | if self.port_no != other.port_no: return False |
| 12101 | return True |
| 12102 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12103 | def pretty_print(self, q): |
| 12104 | q.text("port_stats_request {") |
| 12105 | with q.group(): |
| 12106 | with q.indent(2): |
| 12107 | q.breakable() |
| 12108 | q.text("xid = "); |
| 12109 | if self.xid != None: |
| 12110 | q.text("%#x" % self.xid) |
| 12111 | else: |
| 12112 | q.text('None') |
| 12113 | q.text(","); q.breakable() |
| 12114 | q.text("flags = "); |
| 12115 | q.text("%#x" % self.flags) |
| 12116 | q.text(","); q.breakable() |
| 12117 | q.text("port_no = "); |
| 12118 | q.text(util.pretty_port(self.port_no)) |
| 12119 | q.breakable() |
| 12120 | q.text('}') |
| 12121 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12122 | stats_request.subtypes[4] = port_stats_request |
| 12123 | |
| 12124 | class port_status(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12125 | version = 4 |
| 12126 | type = 12 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12127 | |
| 12128 | def __init__(self, xid=None, reason=None, desc=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12129 | if xid != None: |
| 12130 | self.xid = xid |
| 12131 | else: |
| 12132 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12133 | if reason != None: |
| 12134 | self.reason = reason |
| 12135 | else: |
| 12136 | self.reason = 0 |
| 12137 | if desc != None: |
| 12138 | self.desc = desc |
| 12139 | else: |
| 12140 | self.desc = common.port_desc() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12141 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12142 | |
| 12143 | def pack(self): |
| 12144 | packed = [] |
| 12145 | packed.append(struct.pack("!B", self.version)) |
| 12146 | packed.append(struct.pack("!B", self.type)) |
| 12147 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12148 | packed.append(struct.pack("!L", self.xid)) |
| 12149 | packed.append(struct.pack("!B", self.reason)) |
| 12150 | packed.append('\x00' * 7) |
| 12151 | packed.append(self.desc.pack()) |
| 12152 | length = sum([len(x) for x in packed]) |
| 12153 | packed[2] = struct.pack("!H", length) |
| 12154 | return ''.join(packed) |
| 12155 | |
| 12156 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12157 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12158 | obj = port_status() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12159 | _version = reader.read("!B")[0] |
| 12160 | assert(_version == 4) |
| 12161 | _type = reader.read("!B")[0] |
| 12162 | assert(_type == 12) |
| 12163 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12164 | orig_reader = reader |
| 12165 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12166 | obj.xid = reader.read("!L")[0] |
| 12167 | obj.reason = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12168 | reader.skip(7) |
| 12169 | obj.desc = common.port_desc.unpack(reader) |
| 12170 | return obj |
| 12171 | |
| 12172 | def __eq__(self, other): |
| 12173 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12174 | if self.xid != other.xid: return False |
| 12175 | if self.reason != other.reason: return False |
| 12176 | if self.desc != other.desc: return False |
| 12177 | return True |
| 12178 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12179 | def pretty_print(self, q): |
| 12180 | q.text("port_status {") |
| 12181 | with q.group(): |
| 12182 | with q.indent(2): |
| 12183 | q.breakable() |
| 12184 | q.text("xid = "); |
| 12185 | if self.xid != None: |
| 12186 | q.text("%#x" % self.xid) |
| 12187 | else: |
| 12188 | q.text('None') |
| 12189 | q.text(","); q.breakable() |
| 12190 | q.text("reason = "); |
| 12191 | q.text("%#x" % self.reason) |
| 12192 | q.text(","); q.breakable() |
| 12193 | q.text("desc = "); |
| 12194 | q.pp(self.desc) |
| 12195 | q.breakable() |
| 12196 | q.text('}') |
| 12197 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12198 | message.subtypes[12] = port_status |
| 12199 | |
| 12200 | class queue_get_config_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12201 | version = 4 |
| 12202 | type = 23 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12203 | |
| 12204 | def __init__(self, xid=None, port=None, queues=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12205 | if xid != None: |
| 12206 | self.xid = xid |
| 12207 | else: |
| 12208 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12209 | if port != None: |
| 12210 | self.port = port |
| 12211 | else: |
| 12212 | self.port = 0 |
| 12213 | if queues != None: |
| 12214 | self.queues = queues |
| 12215 | else: |
| 12216 | self.queues = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12217 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12218 | |
| 12219 | def pack(self): |
| 12220 | packed = [] |
| 12221 | packed.append(struct.pack("!B", self.version)) |
| 12222 | packed.append(struct.pack("!B", self.type)) |
| 12223 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12224 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12225 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12226 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12227 | packed.append(loxi.generic_util.pack_list(self.queues)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12228 | length = sum([len(x) for x in packed]) |
| 12229 | packed[2] = struct.pack("!H", length) |
| 12230 | return ''.join(packed) |
| 12231 | |
| 12232 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12233 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12234 | obj = queue_get_config_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12235 | _version = reader.read("!B")[0] |
| 12236 | assert(_version == 4) |
| 12237 | _type = reader.read("!B")[0] |
| 12238 | assert(_type == 23) |
| 12239 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12240 | orig_reader = reader |
| 12241 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12242 | obj.xid = reader.read("!L")[0] |
| 12243 | obj.port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12244 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12245 | obj.queues = loxi.generic_util.unpack_list(reader, common.packet_queue.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12246 | return obj |
| 12247 | |
| 12248 | def __eq__(self, other): |
| 12249 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12250 | if self.xid != other.xid: return False |
| 12251 | if self.port != other.port: return False |
| 12252 | if self.queues != other.queues: return False |
| 12253 | return True |
| 12254 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12255 | def pretty_print(self, q): |
| 12256 | q.text("queue_get_config_reply {") |
| 12257 | with q.group(): |
| 12258 | with q.indent(2): |
| 12259 | q.breakable() |
| 12260 | q.text("xid = "); |
| 12261 | if self.xid != None: |
| 12262 | q.text("%#x" % self.xid) |
| 12263 | else: |
| 12264 | q.text('None') |
| 12265 | q.text(","); q.breakable() |
| 12266 | q.text("port = "); |
| 12267 | q.text(util.pretty_port(self.port)) |
| 12268 | q.text(","); q.breakable() |
| 12269 | q.text("queues = "); |
| 12270 | q.pp(self.queues) |
| 12271 | q.breakable() |
| 12272 | q.text('}') |
| 12273 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12274 | message.subtypes[23] = queue_get_config_reply |
| 12275 | |
| 12276 | class queue_get_config_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12277 | version = 4 |
| 12278 | type = 22 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12279 | |
| 12280 | def __init__(self, xid=None, port=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12281 | if xid != None: |
| 12282 | self.xid = xid |
| 12283 | else: |
| 12284 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12285 | if port != None: |
| 12286 | self.port = port |
| 12287 | else: |
| 12288 | self.port = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12289 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12290 | |
| 12291 | def pack(self): |
| 12292 | packed = [] |
| 12293 | packed.append(struct.pack("!B", self.version)) |
| 12294 | packed.append(struct.pack("!B", self.type)) |
| 12295 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12296 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12297 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12298 | packed.append('\x00' * 4) |
| 12299 | length = sum([len(x) for x in packed]) |
| 12300 | packed[2] = struct.pack("!H", length) |
| 12301 | return ''.join(packed) |
| 12302 | |
| 12303 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12304 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12305 | obj = queue_get_config_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12306 | _version = reader.read("!B")[0] |
| 12307 | assert(_version == 4) |
| 12308 | _type = reader.read("!B")[0] |
| 12309 | assert(_type == 22) |
| 12310 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12311 | orig_reader = reader |
| 12312 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12313 | obj.xid = reader.read("!L")[0] |
| 12314 | obj.port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12315 | reader.skip(4) |
| 12316 | return obj |
| 12317 | |
| 12318 | def __eq__(self, other): |
| 12319 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12320 | if self.xid != other.xid: return False |
| 12321 | if self.port != other.port: return False |
| 12322 | return True |
| 12323 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12324 | def pretty_print(self, q): |
| 12325 | q.text("queue_get_config_request {") |
| 12326 | with q.group(): |
| 12327 | with q.indent(2): |
| 12328 | q.breakable() |
| 12329 | q.text("xid = "); |
| 12330 | if self.xid != None: |
| 12331 | q.text("%#x" % self.xid) |
| 12332 | else: |
| 12333 | q.text('None') |
| 12334 | q.text(","); q.breakable() |
| 12335 | q.text("port = "); |
| 12336 | q.text(util.pretty_port(self.port)) |
| 12337 | q.breakable() |
| 12338 | q.text('}') |
| 12339 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12340 | message.subtypes[22] = queue_get_config_request |
| 12341 | |
| 12342 | class queue_op_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12343 | version = 4 |
| 12344 | type = 1 |
| 12345 | err_type = 9 |
| 12346 | |
| 12347 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12348 | if xid != None: |
| 12349 | self.xid = xid |
| 12350 | else: |
| 12351 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12352 | if code != None: |
| 12353 | self.code = code |
| 12354 | else: |
| 12355 | self.code = 0 |
| 12356 | if data != None: |
| 12357 | self.data = data |
| 12358 | else: |
| 12359 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12360 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12361 | |
| 12362 | def pack(self): |
| 12363 | packed = [] |
| 12364 | packed.append(struct.pack("!B", self.version)) |
| 12365 | packed.append(struct.pack("!B", self.type)) |
| 12366 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12367 | packed.append(struct.pack("!L", self.xid)) |
| 12368 | packed.append(struct.pack("!H", self.err_type)) |
| 12369 | packed.append(struct.pack("!H", self.code)) |
| 12370 | packed.append(self.data) |
| 12371 | length = sum([len(x) for x in packed]) |
| 12372 | packed[2] = struct.pack("!H", length) |
| 12373 | return ''.join(packed) |
| 12374 | |
| 12375 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12376 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12377 | obj = queue_op_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12378 | _version = reader.read("!B")[0] |
| 12379 | assert(_version == 4) |
| 12380 | _type = reader.read("!B")[0] |
| 12381 | assert(_type == 1) |
| 12382 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12383 | orig_reader = reader |
| 12384 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12385 | obj.xid = reader.read("!L")[0] |
| 12386 | _err_type = reader.read("!H")[0] |
| 12387 | assert(_err_type == 9) |
| 12388 | obj.code = reader.read("!H")[0] |
| 12389 | obj.data = str(reader.read_all()) |
| 12390 | return obj |
| 12391 | |
| 12392 | def __eq__(self, other): |
| 12393 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12394 | if self.xid != other.xid: return False |
| 12395 | if self.code != other.code: return False |
| 12396 | if self.data != other.data: return False |
| 12397 | return True |
| 12398 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12399 | def pretty_print(self, q): |
| 12400 | q.text("queue_op_failed_error_msg {") |
| 12401 | with q.group(): |
| 12402 | with q.indent(2): |
| 12403 | q.breakable() |
| 12404 | q.text("xid = "); |
| 12405 | if self.xid != None: |
| 12406 | q.text("%#x" % self.xid) |
| 12407 | else: |
| 12408 | q.text('None') |
| 12409 | q.text(","); q.breakable() |
| 12410 | q.text("code = "); |
| 12411 | q.text("%#x" % self.code) |
| 12412 | q.text(","); q.breakable() |
| 12413 | q.text("data = "); |
| 12414 | q.pp(self.data) |
| 12415 | q.breakable() |
| 12416 | q.text('}') |
| 12417 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12418 | error_msg.subtypes[9] = queue_op_failed_error_msg |
| 12419 | |
| 12420 | class queue_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12421 | version = 4 |
| 12422 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12423 | stats_type = 5 |
| 12424 | |
| 12425 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12426 | if xid != None: |
| 12427 | self.xid = xid |
| 12428 | else: |
| 12429 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12430 | if flags != None: |
| 12431 | self.flags = flags |
| 12432 | else: |
| 12433 | self.flags = 0 |
| 12434 | if entries != None: |
| 12435 | self.entries = entries |
| 12436 | else: |
| 12437 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12438 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12439 | |
| 12440 | def pack(self): |
| 12441 | packed = [] |
| 12442 | packed.append(struct.pack("!B", self.version)) |
| 12443 | packed.append(struct.pack("!B", self.type)) |
| 12444 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12445 | packed.append(struct.pack("!L", self.xid)) |
| 12446 | packed.append(struct.pack("!H", self.stats_type)) |
| 12447 | packed.append(struct.pack("!H", self.flags)) |
| 12448 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12449 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12450 | length = sum([len(x) for x in packed]) |
| 12451 | packed[2] = struct.pack("!H", length) |
| 12452 | return ''.join(packed) |
| 12453 | |
| 12454 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12455 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12456 | obj = queue_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12457 | _version = reader.read("!B")[0] |
| 12458 | assert(_version == 4) |
| 12459 | _type = reader.read("!B")[0] |
| 12460 | assert(_type == 19) |
| 12461 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12462 | orig_reader = reader |
| 12463 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12464 | obj.xid = reader.read("!L")[0] |
| 12465 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12466 | assert(_stats_type == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12467 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12468 | reader.skip(4) |
| 12469 | obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack) |
| 12470 | return obj |
| 12471 | |
| 12472 | def __eq__(self, other): |
| 12473 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12474 | if self.xid != other.xid: return False |
| 12475 | if self.flags != other.flags: return False |
| 12476 | if self.entries != other.entries: return False |
| 12477 | return True |
| 12478 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12479 | def pretty_print(self, q): |
| 12480 | q.text("queue_stats_reply {") |
| 12481 | with q.group(): |
| 12482 | with q.indent(2): |
| 12483 | q.breakable() |
| 12484 | q.text("xid = "); |
| 12485 | if self.xid != None: |
| 12486 | q.text("%#x" % self.xid) |
| 12487 | else: |
| 12488 | q.text('None') |
| 12489 | q.text(","); q.breakable() |
| 12490 | q.text("flags = "); |
| 12491 | q.text("%#x" % self.flags) |
| 12492 | q.text(","); q.breakable() |
| 12493 | q.text("entries = "); |
| 12494 | q.pp(self.entries) |
| 12495 | q.breakable() |
| 12496 | q.text('}') |
| 12497 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12498 | stats_reply.subtypes[5] = queue_stats_reply |
| 12499 | |
| 12500 | class queue_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12501 | version = 4 |
| 12502 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12503 | stats_type = 5 |
| 12504 | |
| 12505 | def __init__(self, xid=None, flags=None, port_no=None, queue_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12506 | if xid != None: |
| 12507 | self.xid = xid |
| 12508 | else: |
| 12509 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12510 | if flags != None: |
| 12511 | self.flags = flags |
| 12512 | else: |
| 12513 | self.flags = 0 |
| 12514 | if port_no != None: |
| 12515 | self.port_no = port_no |
| 12516 | else: |
| 12517 | self.port_no = 0 |
| 12518 | if queue_id != None: |
| 12519 | self.queue_id = queue_id |
| 12520 | else: |
| 12521 | self.queue_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12522 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12523 | |
| 12524 | def pack(self): |
| 12525 | packed = [] |
| 12526 | packed.append(struct.pack("!B", self.version)) |
| 12527 | packed.append(struct.pack("!B", self.type)) |
| 12528 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12529 | packed.append(struct.pack("!L", self.xid)) |
| 12530 | packed.append(struct.pack("!H", self.stats_type)) |
| 12531 | packed.append(struct.pack("!H", self.flags)) |
| 12532 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12533 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12534 | packed.append(struct.pack("!L", self.queue_id)) |
| 12535 | length = sum([len(x) for x in packed]) |
| 12536 | packed[2] = struct.pack("!H", length) |
| 12537 | return ''.join(packed) |
| 12538 | |
| 12539 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12540 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12541 | obj = queue_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12542 | _version = reader.read("!B")[0] |
| 12543 | assert(_version == 4) |
| 12544 | _type = reader.read("!B")[0] |
| 12545 | assert(_type == 18) |
| 12546 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12547 | orig_reader = reader |
| 12548 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12549 | obj.xid = reader.read("!L")[0] |
| 12550 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12551 | assert(_stats_type == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12552 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12553 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12554 | obj.port_no = util.unpack_port_no(reader) |
| 12555 | obj.queue_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12556 | return obj |
| 12557 | |
| 12558 | def __eq__(self, other): |
| 12559 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12560 | if self.xid != other.xid: return False |
| 12561 | if self.flags != other.flags: return False |
| 12562 | if self.port_no != other.port_no: return False |
| 12563 | if self.queue_id != other.queue_id: return False |
| 12564 | return True |
| 12565 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12566 | def pretty_print(self, q): |
| 12567 | q.text("queue_stats_request {") |
| 12568 | with q.group(): |
| 12569 | with q.indent(2): |
| 12570 | q.breakable() |
| 12571 | q.text("xid = "); |
| 12572 | if self.xid != None: |
| 12573 | q.text("%#x" % self.xid) |
| 12574 | else: |
| 12575 | q.text('None') |
| 12576 | q.text(","); q.breakable() |
| 12577 | q.text("flags = "); |
| 12578 | q.text("%#x" % self.flags) |
| 12579 | q.text(","); q.breakable() |
| 12580 | q.text("port_no = "); |
| 12581 | q.text(util.pretty_port(self.port_no)) |
| 12582 | q.text(","); q.breakable() |
| 12583 | q.text("queue_id = "); |
| 12584 | q.text("%#x" % self.queue_id) |
| 12585 | q.breakable() |
| 12586 | q.text('}') |
| 12587 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12588 | stats_request.subtypes[5] = queue_stats_request |
| 12589 | |
| 12590 | class role_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12591 | version = 4 |
| 12592 | type = 25 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12593 | |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 12594 | def __init__(self, xid=None, role=None, generation_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12595 | if xid != None: |
| 12596 | self.xid = xid |
| 12597 | else: |
| 12598 | self.xid = None |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 12599 | if role != None: |
| 12600 | self.role = role |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12601 | else: |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 12602 | self.role = 0 |
| 12603 | if generation_id != None: |
| 12604 | self.generation_id = generation_id |
| 12605 | else: |
| 12606 | self.generation_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12607 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12608 | |
| 12609 | def pack(self): |
| 12610 | packed = [] |
| 12611 | packed.append(struct.pack("!B", self.version)) |
| 12612 | packed.append(struct.pack("!B", self.type)) |
| 12613 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12614 | packed.append(struct.pack("!L", self.xid)) |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 12615 | packed.append(struct.pack("!L", self.role)) |
| 12616 | packed.append('\x00' * 4) |
| 12617 | packed.append(struct.pack("!Q", self.generation_id)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12618 | length = sum([len(x) for x in packed]) |
| 12619 | packed[2] = struct.pack("!H", length) |
| 12620 | return ''.join(packed) |
| 12621 | |
| 12622 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12623 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12624 | obj = role_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12625 | _version = reader.read("!B")[0] |
| 12626 | assert(_version == 4) |
| 12627 | _type = reader.read("!B")[0] |
| 12628 | assert(_type == 25) |
| 12629 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12630 | orig_reader = reader |
| 12631 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12632 | obj.xid = reader.read("!L")[0] |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 12633 | obj.role = reader.read("!L")[0] |
| 12634 | reader.skip(4) |
| 12635 | obj.generation_id = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12636 | return obj |
| 12637 | |
| 12638 | def __eq__(self, other): |
| 12639 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12640 | if self.xid != other.xid: return False |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 12641 | if self.role != other.role: return False |
| 12642 | if self.generation_id != other.generation_id: return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12643 | return True |
| 12644 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12645 | def pretty_print(self, q): |
| 12646 | q.text("role_reply {") |
| 12647 | with q.group(): |
| 12648 | with q.indent(2): |
| 12649 | q.breakable() |
| 12650 | q.text("xid = "); |
| 12651 | if self.xid != None: |
| 12652 | q.text("%#x" % self.xid) |
| 12653 | else: |
| 12654 | q.text('None') |
| 12655 | q.text(","); q.breakable() |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 12656 | q.text("role = "); |
| 12657 | q.text("%#x" % self.role) |
| 12658 | q.text(","); q.breakable() |
| 12659 | q.text("generation_id = "); |
| 12660 | q.text("%#x" % self.generation_id) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12661 | q.breakable() |
| 12662 | q.text('}') |
| 12663 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12664 | message.subtypes[25] = role_reply |
| 12665 | |
| 12666 | class role_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12667 | version = 4 |
| 12668 | type = 24 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12669 | |
| 12670 | def __init__(self, xid=None, role=None, generation_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12671 | if xid != None: |
| 12672 | self.xid = xid |
| 12673 | else: |
| 12674 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12675 | if role != None: |
| 12676 | self.role = role |
| 12677 | else: |
| 12678 | self.role = 0 |
| 12679 | if generation_id != None: |
| 12680 | self.generation_id = generation_id |
| 12681 | else: |
| 12682 | self.generation_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12683 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12684 | |
| 12685 | def pack(self): |
| 12686 | packed = [] |
| 12687 | packed.append(struct.pack("!B", self.version)) |
| 12688 | packed.append(struct.pack("!B", self.type)) |
| 12689 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12690 | packed.append(struct.pack("!L", self.xid)) |
| 12691 | packed.append(struct.pack("!L", self.role)) |
| 12692 | packed.append('\x00' * 4) |
| 12693 | packed.append(struct.pack("!Q", self.generation_id)) |
| 12694 | length = sum([len(x) for x in packed]) |
| 12695 | packed[2] = struct.pack("!H", length) |
| 12696 | return ''.join(packed) |
| 12697 | |
| 12698 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12699 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12700 | obj = role_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12701 | _version = reader.read("!B")[0] |
| 12702 | assert(_version == 4) |
| 12703 | _type = reader.read("!B")[0] |
| 12704 | assert(_type == 24) |
| 12705 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12706 | orig_reader = reader |
| 12707 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12708 | obj.xid = reader.read("!L")[0] |
| 12709 | obj.role = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12710 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12711 | obj.generation_id = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12712 | return obj |
| 12713 | |
| 12714 | def __eq__(self, other): |
| 12715 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12716 | if self.xid != other.xid: return False |
| 12717 | if self.role != other.role: return False |
| 12718 | if self.generation_id != other.generation_id: return False |
| 12719 | return True |
| 12720 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12721 | def pretty_print(self, q): |
| 12722 | q.text("role_request {") |
| 12723 | with q.group(): |
| 12724 | with q.indent(2): |
| 12725 | q.breakable() |
| 12726 | q.text("xid = "); |
| 12727 | if self.xid != None: |
| 12728 | q.text("%#x" % self.xid) |
| 12729 | else: |
| 12730 | q.text('None') |
| 12731 | q.text(","); q.breakable() |
| 12732 | q.text("role = "); |
| 12733 | q.text("%#x" % self.role) |
| 12734 | q.text(","); q.breakable() |
| 12735 | q.text("generation_id = "); |
| 12736 | q.text("%#x" % self.generation_id) |
| 12737 | q.breakable() |
| 12738 | q.text('}') |
| 12739 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12740 | message.subtypes[24] = role_request |
| 12741 | |
| 12742 | class role_request_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12743 | version = 4 |
| 12744 | type = 1 |
| 12745 | err_type = 11 |
| 12746 | |
| 12747 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12748 | if xid != None: |
| 12749 | self.xid = xid |
| 12750 | else: |
| 12751 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12752 | if code != None: |
| 12753 | self.code = code |
| 12754 | else: |
| 12755 | self.code = 0 |
| 12756 | if data != None: |
| 12757 | self.data = data |
| 12758 | else: |
| 12759 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12760 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12761 | |
| 12762 | def pack(self): |
| 12763 | packed = [] |
| 12764 | packed.append(struct.pack("!B", self.version)) |
| 12765 | packed.append(struct.pack("!B", self.type)) |
| 12766 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12767 | packed.append(struct.pack("!L", self.xid)) |
| 12768 | packed.append(struct.pack("!H", self.err_type)) |
| 12769 | packed.append(struct.pack("!H", self.code)) |
| 12770 | packed.append(self.data) |
| 12771 | length = sum([len(x) for x in packed]) |
| 12772 | packed[2] = struct.pack("!H", length) |
| 12773 | return ''.join(packed) |
| 12774 | |
| 12775 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12776 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12777 | obj = role_request_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12778 | _version = reader.read("!B")[0] |
| 12779 | assert(_version == 4) |
| 12780 | _type = reader.read("!B")[0] |
| 12781 | assert(_type == 1) |
| 12782 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12783 | orig_reader = reader |
| 12784 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12785 | obj.xid = reader.read("!L")[0] |
| 12786 | _err_type = reader.read("!H")[0] |
| 12787 | assert(_err_type == 11) |
| 12788 | obj.code = reader.read("!H")[0] |
| 12789 | obj.data = str(reader.read_all()) |
| 12790 | return obj |
| 12791 | |
| 12792 | def __eq__(self, other): |
| 12793 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12794 | if self.xid != other.xid: return False |
| 12795 | if self.code != other.code: return False |
| 12796 | if self.data != other.data: return False |
| 12797 | return True |
| 12798 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12799 | def pretty_print(self, q): |
| 12800 | q.text("role_request_failed_error_msg {") |
| 12801 | with q.group(): |
| 12802 | with q.indent(2): |
| 12803 | q.breakable() |
| 12804 | q.text("xid = "); |
| 12805 | if self.xid != None: |
| 12806 | q.text("%#x" % self.xid) |
| 12807 | else: |
| 12808 | q.text('None') |
| 12809 | q.text(","); q.breakable() |
| 12810 | q.text("code = "); |
| 12811 | q.text("%#x" % self.code) |
| 12812 | q.text(","); q.breakable() |
| 12813 | q.text("data = "); |
| 12814 | q.pp(self.data) |
| 12815 | q.breakable() |
| 12816 | q.text('}') |
| 12817 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12818 | error_msg.subtypes[11] = role_request_failed_error_msg |
| 12819 | |
| 12820 | class set_config(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12821 | version = 4 |
| 12822 | type = 9 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12823 | |
| 12824 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12825 | if xid != None: |
| 12826 | self.xid = xid |
| 12827 | else: |
| 12828 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12829 | if flags != None: |
| 12830 | self.flags = flags |
| 12831 | else: |
| 12832 | self.flags = 0 |
| 12833 | if miss_send_len != None: |
| 12834 | self.miss_send_len = miss_send_len |
| 12835 | else: |
| 12836 | self.miss_send_len = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12837 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12838 | |
| 12839 | def pack(self): |
| 12840 | packed = [] |
| 12841 | packed.append(struct.pack("!B", self.version)) |
| 12842 | packed.append(struct.pack("!B", self.type)) |
| 12843 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12844 | packed.append(struct.pack("!L", self.xid)) |
| 12845 | packed.append(struct.pack("!H", self.flags)) |
| 12846 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 12847 | length = sum([len(x) for x in packed]) |
| 12848 | packed[2] = struct.pack("!H", length) |
| 12849 | return ''.join(packed) |
| 12850 | |
| 12851 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12852 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12853 | obj = set_config() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12854 | _version = reader.read("!B")[0] |
| 12855 | assert(_version == 4) |
| 12856 | _type = reader.read("!B")[0] |
| 12857 | assert(_type == 9) |
| 12858 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12859 | orig_reader = reader |
| 12860 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12861 | obj.xid = reader.read("!L")[0] |
| 12862 | obj.flags = reader.read("!H")[0] |
| 12863 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12864 | return obj |
| 12865 | |
| 12866 | def __eq__(self, other): |
| 12867 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12868 | if self.xid != other.xid: return False |
| 12869 | if self.flags != other.flags: return False |
| 12870 | if self.miss_send_len != other.miss_send_len: return False |
| 12871 | return True |
| 12872 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12873 | def pretty_print(self, q): |
| 12874 | q.text("set_config {") |
| 12875 | with q.group(): |
| 12876 | with q.indent(2): |
| 12877 | q.breakable() |
| 12878 | q.text("xid = "); |
| 12879 | if self.xid != None: |
| 12880 | q.text("%#x" % self.xid) |
| 12881 | else: |
| 12882 | q.text('None') |
| 12883 | q.text(","); q.breakable() |
| 12884 | q.text("flags = "); |
| 12885 | q.text("%#x" % self.flags) |
| 12886 | q.text(","); q.breakable() |
| 12887 | q.text("miss_send_len = "); |
| 12888 | q.text("%#x" % self.miss_send_len) |
| 12889 | q.breakable() |
| 12890 | q.text('}') |
| 12891 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12892 | message.subtypes[9] = set_config |
| 12893 | |
| 12894 | class switch_config_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12895 | version = 4 |
| 12896 | type = 1 |
| 12897 | err_type = 10 |
| 12898 | |
| 12899 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12900 | if xid != None: |
| 12901 | self.xid = xid |
| 12902 | else: |
| 12903 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12904 | if code != None: |
| 12905 | self.code = code |
| 12906 | else: |
| 12907 | self.code = 0 |
| 12908 | if data != None: |
| 12909 | self.data = data |
| 12910 | else: |
| 12911 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12912 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12913 | |
| 12914 | def pack(self): |
| 12915 | packed = [] |
| 12916 | packed.append(struct.pack("!B", self.version)) |
| 12917 | packed.append(struct.pack("!B", self.type)) |
| 12918 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12919 | packed.append(struct.pack("!L", self.xid)) |
| 12920 | packed.append(struct.pack("!H", self.err_type)) |
| 12921 | packed.append(struct.pack("!H", self.code)) |
| 12922 | packed.append(self.data) |
| 12923 | length = sum([len(x) for x in packed]) |
| 12924 | packed[2] = struct.pack("!H", length) |
| 12925 | return ''.join(packed) |
| 12926 | |
| 12927 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12928 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12929 | obj = switch_config_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12930 | _version = reader.read("!B")[0] |
| 12931 | assert(_version == 4) |
| 12932 | _type = reader.read("!B")[0] |
| 12933 | assert(_type == 1) |
| 12934 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12935 | orig_reader = reader |
| 12936 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12937 | obj.xid = reader.read("!L")[0] |
| 12938 | _err_type = reader.read("!H")[0] |
| 12939 | assert(_err_type == 10) |
| 12940 | obj.code = reader.read("!H")[0] |
| 12941 | obj.data = str(reader.read_all()) |
| 12942 | return obj |
| 12943 | |
| 12944 | def __eq__(self, other): |
| 12945 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12946 | if self.xid != other.xid: return False |
| 12947 | if self.code != other.code: return False |
| 12948 | if self.data != other.data: return False |
| 12949 | return True |
| 12950 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12951 | def pretty_print(self, q): |
| 12952 | q.text("switch_config_failed_error_msg {") |
| 12953 | with q.group(): |
| 12954 | with q.indent(2): |
| 12955 | q.breakable() |
| 12956 | q.text("xid = "); |
| 12957 | if self.xid != None: |
| 12958 | q.text("%#x" % self.xid) |
| 12959 | else: |
| 12960 | q.text('None') |
| 12961 | q.text(","); q.breakable() |
| 12962 | q.text("code = "); |
| 12963 | q.text("%#x" % self.code) |
| 12964 | q.text(","); q.breakable() |
| 12965 | q.text("data = "); |
| 12966 | q.pp(self.data) |
| 12967 | q.breakable() |
| 12968 | q.text('}') |
| 12969 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12970 | error_msg.subtypes[10] = switch_config_failed_error_msg |
| 12971 | |
| 12972 | class table_features_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12973 | version = 4 |
| 12974 | type = 1 |
| 12975 | err_type = 13 |
| 12976 | |
| 12977 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12978 | if xid != None: |
| 12979 | self.xid = xid |
| 12980 | else: |
| 12981 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12982 | if code != None: |
| 12983 | self.code = code |
| 12984 | else: |
| 12985 | self.code = 0 |
| 12986 | if data != None: |
| 12987 | self.data = data |
| 12988 | else: |
| 12989 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12990 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12991 | |
| 12992 | def pack(self): |
| 12993 | packed = [] |
| 12994 | packed.append(struct.pack("!B", self.version)) |
| 12995 | packed.append(struct.pack("!B", self.type)) |
| 12996 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12997 | packed.append(struct.pack("!L", self.xid)) |
| 12998 | packed.append(struct.pack("!H", self.err_type)) |
| 12999 | packed.append(struct.pack("!H", self.code)) |
| 13000 | packed.append(self.data) |
| 13001 | length = sum([len(x) for x in packed]) |
| 13002 | packed[2] = struct.pack("!H", length) |
| 13003 | return ''.join(packed) |
| 13004 | |
| 13005 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13006 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13007 | obj = table_features_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13008 | _version = reader.read("!B")[0] |
| 13009 | assert(_version == 4) |
| 13010 | _type = reader.read("!B")[0] |
| 13011 | assert(_type == 1) |
| 13012 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13013 | orig_reader = reader |
| 13014 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13015 | obj.xid = reader.read("!L")[0] |
| 13016 | _err_type = reader.read("!H")[0] |
| 13017 | assert(_err_type == 13) |
| 13018 | obj.code = reader.read("!H")[0] |
| 13019 | obj.data = str(reader.read_all()) |
| 13020 | return obj |
| 13021 | |
| 13022 | def __eq__(self, other): |
| 13023 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13024 | if self.xid != other.xid: return False |
| 13025 | if self.code != other.code: return False |
| 13026 | if self.data != other.data: return False |
| 13027 | return True |
| 13028 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13029 | def pretty_print(self, q): |
| 13030 | q.text("table_features_failed_error_msg {") |
| 13031 | with q.group(): |
| 13032 | with q.indent(2): |
| 13033 | q.breakable() |
| 13034 | q.text("xid = "); |
| 13035 | if self.xid != None: |
| 13036 | q.text("%#x" % self.xid) |
| 13037 | else: |
| 13038 | q.text('None') |
| 13039 | q.text(","); q.breakable() |
| 13040 | q.text("code = "); |
| 13041 | q.text("%#x" % self.code) |
| 13042 | q.text(","); q.breakable() |
| 13043 | q.text("data = "); |
| 13044 | q.pp(self.data) |
| 13045 | q.breakable() |
| 13046 | q.text('}') |
| 13047 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13048 | error_msg.subtypes[13] = table_features_failed_error_msg |
| 13049 | |
| 13050 | class table_features_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13051 | version = 4 |
| 13052 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13053 | stats_type = 12 |
| 13054 | |
| 13055 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13056 | if xid != None: |
| 13057 | self.xid = xid |
| 13058 | else: |
| 13059 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13060 | if flags != None: |
| 13061 | self.flags = flags |
| 13062 | else: |
| 13063 | self.flags = 0 |
| 13064 | if entries != None: |
| 13065 | self.entries = entries |
| 13066 | else: |
| 13067 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13068 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13069 | |
| 13070 | def pack(self): |
| 13071 | packed = [] |
| 13072 | packed.append(struct.pack("!B", self.version)) |
| 13073 | packed.append(struct.pack("!B", self.type)) |
| 13074 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13075 | packed.append(struct.pack("!L", self.xid)) |
| 13076 | packed.append(struct.pack("!H", self.stats_type)) |
| 13077 | packed.append(struct.pack("!H", self.flags)) |
| 13078 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13079 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13080 | length = sum([len(x) for x in packed]) |
| 13081 | packed[2] = struct.pack("!H", length) |
| 13082 | return ''.join(packed) |
| 13083 | |
| 13084 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13085 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13086 | obj = table_features_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13087 | _version = reader.read("!B")[0] |
| 13088 | assert(_version == 4) |
| 13089 | _type = reader.read("!B")[0] |
| 13090 | assert(_type == 19) |
| 13091 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13092 | orig_reader = reader |
| 13093 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13094 | obj.xid = reader.read("!L")[0] |
| 13095 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13096 | assert(_stats_type == 12) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13097 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13098 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13099 | obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13100 | return obj |
| 13101 | |
| 13102 | def __eq__(self, other): |
| 13103 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13104 | if self.xid != other.xid: return False |
| 13105 | if self.flags != other.flags: return False |
| 13106 | if self.entries != other.entries: return False |
| 13107 | return True |
| 13108 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13109 | def pretty_print(self, q): |
| 13110 | q.text("table_features_stats_reply {") |
| 13111 | with q.group(): |
| 13112 | with q.indent(2): |
| 13113 | q.breakable() |
| 13114 | q.text("xid = "); |
| 13115 | if self.xid != None: |
| 13116 | q.text("%#x" % self.xid) |
| 13117 | else: |
| 13118 | q.text('None') |
| 13119 | q.text(","); q.breakable() |
| 13120 | q.text("flags = "); |
| 13121 | q.text("%#x" % self.flags) |
| 13122 | q.text(","); q.breakable() |
| 13123 | q.text("entries = "); |
| 13124 | q.pp(self.entries) |
| 13125 | q.breakable() |
| 13126 | q.text('}') |
| 13127 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13128 | stats_reply.subtypes[12] = table_features_stats_reply |
| 13129 | |
| 13130 | class table_features_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13131 | version = 4 |
| 13132 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13133 | stats_type = 12 |
| 13134 | |
| 13135 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13136 | if xid != None: |
| 13137 | self.xid = xid |
| 13138 | else: |
| 13139 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13140 | if flags != None: |
| 13141 | self.flags = flags |
| 13142 | else: |
| 13143 | self.flags = 0 |
| 13144 | if entries != None: |
| 13145 | self.entries = entries |
| 13146 | else: |
| 13147 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13148 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13149 | |
| 13150 | def pack(self): |
| 13151 | packed = [] |
| 13152 | packed.append(struct.pack("!B", self.version)) |
| 13153 | packed.append(struct.pack("!B", self.type)) |
| 13154 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13155 | packed.append(struct.pack("!L", self.xid)) |
| 13156 | packed.append(struct.pack("!H", self.stats_type)) |
| 13157 | packed.append(struct.pack("!H", self.flags)) |
| 13158 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13159 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13160 | length = sum([len(x) for x in packed]) |
| 13161 | packed[2] = struct.pack("!H", length) |
| 13162 | return ''.join(packed) |
| 13163 | |
| 13164 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13165 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13166 | obj = table_features_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13167 | _version = reader.read("!B")[0] |
| 13168 | assert(_version == 4) |
| 13169 | _type = reader.read("!B")[0] |
| 13170 | assert(_type == 18) |
| 13171 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13172 | orig_reader = reader |
| 13173 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13174 | obj.xid = reader.read("!L")[0] |
| 13175 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13176 | assert(_stats_type == 12) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13177 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13178 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13179 | obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13180 | return obj |
| 13181 | |
| 13182 | def __eq__(self, other): |
| 13183 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13184 | if self.xid != other.xid: return False |
| 13185 | if self.flags != other.flags: return False |
| 13186 | if self.entries != other.entries: return False |
| 13187 | return True |
| 13188 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13189 | def pretty_print(self, q): |
| 13190 | q.text("table_features_stats_request {") |
| 13191 | with q.group(): |
| 13192 | with q.indent(2): |
| 13193 | q.breakable() |
| 13194 | q.text("xid = "); |
| 13195 | if self.xid != None: |
| 13196 | q.text("%#x" % self.xid) |
| 13197 | else: |
| 13198 | q.text('None') |
| 13199 | q.text(","); q.breakable() |
| 13200 | q.text("flags = "); |
| 13201 | q.text("%#x" % self.flags) |
| 13202 | q.text(","); q.breakable() |
| 13203 | q.text("entries = "); |
| 13204 | q.pp(self.entries) |
| 13205 | q.breakable() |
| 13206 | q.text('}') |
| 13207 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13208 | stats_request.subtypes[12] = table_features_stats_request |
| 13209 | |
| 13210 | class table_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13211 | version = 4 |
| 13212 | type = 17 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13213 | |
| 13214 | def __init__(self, xid=None, table_id=None, config=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13215 | if xid != None: |
| 13216 | self.xid = xid |
| 13217 | else: |
| 13218 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13219 | if table_id != None: |
| 13220 | self.table_id = table_id |
| 13221 | else: |
| 13222 | self.table_id = 0 |
| 13223 | if config != None: |
| 13224 | self.config = config |
| 13225 | else: |
| 13226 | self.config = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13227 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13228 | |
| 13229 | def pack(self): |
| 13230 | packed = [] |
| 13231 | packed.append(struct.pack("!B", self.version)) |
| 13232 | packed.append(struct.pack("!B", self.type)) |
| 13233 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13234 | packed.append(struct.pack("!L", self.xid)) |
| 13235 | packed.append(struct.pack("!B", self.table_id)) |
| 13236 | packed.append('\x00' * 3) |
| 13237 | packed.append(struct.pack("!L", self.config)) |
| 13238 | length = sum([len(x) for x in packed]) |
| 13239 | packed[2] = struct.pack("!H", length) |
| 13240 | return ''.join(packed) |
| 13241 | |
| 13242 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13243 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13244 | obj = table_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13245 | _version = reader.read("!B")[0] |
| 13246 | assert(_version == 4) |
| 13247 | _type = reader.read("!B")[0] |
| 13248 | assert(_type == 17) |
| 13249 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13250 | orig_reader = reader |
| 13251 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13252 | obj.xid = reader.read("!L")[0] |
| 13253 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13254 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13255 | obj.config = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13256 | return obj |
| 13257 | |
| 13258 | def __eq__(self, other): |
| 13259 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13260 | if self.xid != other.xid: return False |
| 13261 | if self.table_id != other.table_id: return False |
| 13262 | if self.config != other.config: return False |
| 13263 | return True |
| 13264 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13265 | def pretty_print(self, q): |
| 13266 | q.text("table_mod {") |
| 13267 | with q.group(): |
| 13268 | with q.indent(2): |
| 13269 | q.breakable() |
| 13270 | q.text("xid = "); |
| 13271 | if self.xid != None: |
| 13272 | q.text("%#x" % self.xid) |
| 13273 | else: |
| 13274 | q.text('None') |
| 13275 | q.text(","); q.breakable() |
| 13276 | q.text("table_id = "); |
| 13277 | q.text("%#x" % self.table_id) |
| 13278 | q.text(","); q.breakable() |
| 13279 | q.text("config = "); |
| 13280 | q.text("%#x" % self.config) |
| 13281 | q.breakable() |
| 13282 | q.text('}') |
| 13283 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13284 | message.subtypes[17] = table_mod |
| 13285 | |
| 13286 | class table_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13287 | version = 4 |
| 13288 | type = 1 |
| 13289 | err_type = 8 |
| 13290 | |
| 13291 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13292 | if xid != None: |
| 13293 | self.xid = xid |
| 13294 | else: |
| 13295 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13296 | if code != None: |
| 13297 | self.code = code |
| 13298 | else: |
| 13299 | self.code = 0 |
| 13300 | if data != None: |
| 13301 | self.data = data |
| 13302 | else: |
| 13303 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13304 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13305 | |
| 13306 | def pack(self): |
| 13307 | packed = [] |
| 13308 | packed.append(struct.pack("!B", self.version)) |
| 13309 | packed.append(struct.pack("!B", self.type)) |
| 13310 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13311 | packed.append(struct.pack("!L", self.xid)) |
| 13312 | packed.append(struct.pack("!H", self.err_type)) |
| 13313 | packed.append(struct.pack("!H", self.code)) |
| 13314 | packed.append(self.data) |
| 13315 | length = sum([len(x) for x in packed]) |
| 13316 | packed[2] = struct.pack("!H", length) |
| 13317 | return ''.join(packed) |
| 13318 | |
| 13319 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13320 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13321 | obj = table_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13322 | _version = reader.read("!B")[0] |
| 13323 | assert(_version == 4) |
| 13324 | _type = reader.read("!B")[0] |
| 13325 | assert(_type == 1) |
| 13326 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13327 | orig_reader = reader |
| 13328 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13329 | obj.xid = reader.read("!L")[0] |
| 13330 | _err_type = reader.read("!H")[0] |
| 13331 | assert(_err_type == 8) |
| 13332 | obj.code = reader.read("!H")[0] |
| 13333 | obj.data = str(reader.read_all()) |
| 13334 | return obj |
| 13335 | |
| 13336 | def __eq__(self, other): |
| 13337 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13338 | if self.xid != other.xid: return False |
| 13339 | if self.code != other.code: return False |
| 13340 | if self.data != other.data: return False |
| 13341 | return True |
| 13342 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13343 | def pretty_print(self, q): |
| 13344 | q.text("table_mod_failed_error_msg {") |
| 13345 | with q.group(): |
| 13346 | with q.indent(2): |
| 13347 | q.breakable() |
| 13348 | q.text("xid = "); |
| 13349 | if self.xid != None: |
| 13350 | q.text("%#x" % self.xid) |
| 13351 | else: |
| 13352 | q.text('None') |
| 13353 | q.text(","); q.breakable() |
| 13354 | q.text("code = "); |
| 13355 | q.text("%#x" % self.code) |
| 13356 | q.text(","); q.breakable() |
| 13357 | q.text("data = "); |
| 13358 | q.pp(self.data) |
| 13359 | q.breakable() |
| 13360 | q.text('}') |
| 13361 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13362 | error_msg.subtypes[8] = table_mod_failed_error_msg |
| 13363 | |
| 13364 | class table_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13365 | version = 4 |
| 13366 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13367 | stats_type = 3 |
| 13368 | |
| 13369 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13370 | if xid != None: |
| 13371 | self.xid = xid |
| 13372 | else: |
| 13373 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13374 | if flags != None: |
| 13375 | self.flags = flags |
| 13376 | else: |
| 13377 | self.flags = 0 |
| 13378 | if entries != None: |
| 13379 | self.entries = entries |
| 13380 | else: |
| 13381 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13382 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13383 | |
| 13384 | def pack(self): |
| 13385 | packed = [] |
| 13386 | packed.append(struct.pack("!B", self.version)) |
| 13387 | packed.append(struct.pack("!B", self.type)) |
| 13388 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13389 | packed.append(struct.pack("!L", self.xid)) |
| 13390 | packed.append(struct.pack("!H", self.stats_type)) |
| 13391 | packed.append(struct.pack("!H", self.flags)) |
| 13392 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13393 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13394 | length = sum([len(x) for x in packed]) |
| 13395 | packed[2] = struct.pack("!H", length) |
| 13396 | return ''.join(packed) |
| 13397 | |
| 13398 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13399 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13400 | obj = table_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13401 | _version = reader.read("!B")[0] |
| 13402 | assert(_version == 4) |
| 13403 | _type = reader.read("!B")[0] |
| 13404 | assert(_type == 19) |
| 13405 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13406 | orig_reader = reader |
| 13407 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13408 | obj.xid = reader.read("!L")[0] |
| 13409 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13410 | assert(_stats_type == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13411 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13412 | reader.skip(4) |
| 13413 | obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack) |
| 13414 | return obj |
| 13415 | |
| 13416 | def __eq__(self, other): |
| 13417 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13418 | if self.xid != other.xid: return False |
| 13419 | if self.flags != other.flags: return False |
| 13420 | if self.entries != other.entries: return False |
| 13421 | return True |
| 13422 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13423 | def pretty_print(self, q): |
| 13424 | q.text("table_stats_reply {") |
| 13425 | with q.group(): |
| 13426 | with q.indent(2): |
| 13427 | q.breakable() |
| 13428 | q.text("xid = "); |
| 13429 | if self.xid != None: |
| 13430 | q.text("%#x" % self.xid) |
| 13431 | else: |
| 13432 | q.text('None') |
| 13433 | q.text(","); q.breakable() |
| 13434 | q.text("flags = "); |
| 13435 | q.text("%#x" % self.flags) |
| 13436 | q.text(","); q.breakable() |
| 13437 | q.text("entries = "); |
| 13438 | q.pp(self.entries) |
| 13439 | q.breakable() |
| 13440 | q.text('}') |
| 13441 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13442 | stats_reply.subtypes[3] = table_stats_reply |
| 13443 | |
| 13444 | class table_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13445 | version = 4 |
| 13446 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13447 | stats_type = 3 |
| 13448 | |
| 13449 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13450 | if xid != None: |
| 13451 | self.xid = xid |
| 13452 | else: |
| 13453 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13454 | if flags != None: |
| 13455 | self.flags = flags |
| 13456 | else: |
| 13457 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13458 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13459 | |
| 13460 | def pack(self): |
| 13461 | packed = [] |
| 13462 | packed.append(struct.pack("!B", self.version)) |
| 13463 | packed.append(struct.pack("!B", self.type)) |
| 13464 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13465 | packed.append(struct.pack("!L", self.xid)) |
| 13466 | packed.append(struct.pack("!H", self.stats_type)) |
| 13467 | packed.append(struct.pack("!H", self.flags)) |
| 13468 | packed.append('\x00' * 4) |
| 13469 | length = sum([len(x) for x in packed]) |
| 13470 | packed[2] = struct.pack("!H", length) |
| 13471 | return ''.join(packed) |
| 13472 | |
| 13473 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13474 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13475 | obj = table_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13476 | _version = reader.read("!B")[0] |
| 13477 | assert(_version == 4) |
| 13478 | _type = reader.read("!B")[0] |
| 13479 | assert(_type == 18) |
| 13480 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13481 | orig_reader = reader |
| 13482 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13483 | obj.xid = reader.read("!L")[0] |
| 13484 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13485 | assert(_stats_type == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13486 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13487 | reader.skip(4) |
| 13488 | return obj |
| 13489 | |
| 13490 | def __eq__(self, other): |
| 13491 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13492 | if self.xid != other.xid: return False |
| 13493 | if self.flags != other.flags: return False |
| 13494 | return True |
| 13495 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13496 | def pretty_print(self, q): |
| 13497 | q.text("table_stats_request {") |
| 13498 | with q.group(): |
| 13499 | with q.indent(2): |
| 13500 | q.breakable() |
| 13501 | q.text("xid = "); |
| 13502 | if self.xid != None: |
| 13503 | q.text("%#x" % self.xid) |
| 13504 | else: |
| 13505 | q.text('None') |
| 13506 | q.text(","); q.breakable() |
| 13507 | q.text("flags = "); |
| 13508 | q.text("%#x" % self.flags) |
| 13509 | q.breakable() |
| 13510 | q.text('}') |
| 13511 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13512 | stats_request.subtypes[3] = table_stats_request |
| 13513 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13514 | |
| 13515 | def parse_header(buf): |
| 13516 | if len(buf) < 8: |
| 13517 | raise loxi.ProtocolError("too short to be an OpenFlow message") |
| 13518 | return struct.unpack_from("!BBHL", buf) |
| 13519 | |
| 13520 | def parse_message(buf): |
| 13521 | msg_ver, msg_type, msg_len, msg_xid = parse_header(buf) |
Rich Lane | fe600f5 | 2013-07-09 13:22:32 -0700 | [diff] [blame] | 13522 | if msg_ver != const.OFP_VERSION and msg_type != const.OFPT_HELLO: |
| 13523 | raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (const.OFP_VERSION, msg_ver)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13524 | if len(buf) != msg_len: |
| 13525 | raise loxi.ProtocolError("incorrect message size") |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13526 | return message.unpack(loxi.generic_util.OFReader(buf)) |