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 | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2112 | class experimenter_stats_reply(stats_reply): |
| 2113 | subtypes = {} |
| 2114 | |
| 2115 | version = 4 |
| 2116 | type = 19 |
| 2117 | stats_type = 65535 |
| 2118 | |
| 2119 | def __init__(self, xid=None, flags=None, experimenter=None, subtype=None): |
| 2120 | if xid != None: |
| 2121 | self.xid = xid |
| 2122 | else: |
| 2123 | self.xid = None |
| 2124 | if flags != None: |
| 2125 | self.flags = flags |
| 2126 | else: |
| 2127 | self.flags = 0 |
| 2128 | if experimenter != None: |
| 2129 | self.experimenter = experimenter |
| 2130 | else: |
| 2131 | self.experimenter = 0 |
| 2132 | if subtype != None: |
| 2133 | self.subtype = subtype |
| 2134 | else: |
| 2135 | self.subtype = 0 |
| 2136 | return |
| 2137 | |
| 2138 | def pack(self): |
| 2139 | packed = [] |
| 2140 | packed.append(struct.pack("!B", self.version)) |
| 2141 | packed.append(struct.pack("!B", self.type)) |
| 2142 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2143 | packed.append(struct.pack("!L", self.xid)) |
| 2144 | packed.append(struct.pack("!H", self.stats_type)) |
| 2145 | packed.append(struct.pack("!H", self.flags)) |
| 2146 | packed.append('\x00' * 4) |
| 2147 | packed.append(struct.pack("!L", self.experimenter)) |
| 2148 | packed.append(struct.pack("!L", self.subtype)) |
| 2149 | length = sum([len(x) for x in packed]) |
| 2150 | packed[2] = struct.pack("!H", length) |
| 2151 | return ''.join(packed) |
| 2152 | |
| 2153 | @staticmethod |
| 2154 | def unpack(reader): |
| 2155 | subtype, = reader.peek('!L', 16) |
| 2156 | subclass = experimenter_stats_reply.subtypes.get(subtype) |
| 2157 | if subclass: |
| 2158 | return subclass.unpack(reader) |
| 2159 | |
| 2160 | obj = experimenter_stats_reply() |
| 2161 | _version = reader.read("!B")[0] |
| 2162 | assert(_version == 4) |
| 2163 | _type = reader.read("!B")[0] |
| 2164 | assert(_type == 19) |
| 2165 | _length = reader.read("!H")[0] |
| 2166 | orig_reader = reader |
| 2167 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2168 | obj.xid = reader.read("!L")[0] |
| 2169 | _stats_type = reader.read("!H")[0] |
| 2170 | assert(_stats_type == 65535) |
| 2171 | obj.flags = reader.read("!H")[0] |
| 2172 | reader.skip(4) |
| 2173 | obj.experimenter = reader.read("!L")[0] |
| 2174 | obj.subtype = reader.read("!L")[0] |
| 2175 | return obj |
| 2176 | |
| 2177 | def __eq__(self, other): |
| 2178 | if type(self) != type(other): return False |
| 2179 | if self.xid != other.xid: return False |
| 2180 | if self.flags != other.flags: return False |
| 2181 | if self.experimenter != other.experimenter: return False |
| 2182 | if self.subtype != other.subtype: return False |
| 2183 | return True |
| 2184 | |
| 2185 | def pretty_print(self, q): |
| 2186 | q.text("experimenter_stats_reply {") |
| 2187 | with q.group(): |
| 2188 | with q.indent(2): |
| 2189 | q.breakable() |
| 2190 | q.text("xid = "); |
| 2191 | if self.xid != None: |
| 2192 | q.text("%#x" % self.xid) |
| 2193 | else: |
| 2194 | q.text('None') |
| 2195 | q.text(","); q.breakable() |
| 2196 | q.text("flags = "); |
| 2197 | q.text("%#x" % self.flags) |
| 2198 | q.text(","); q.breakable() |
| 2199 | q.text("subtype = "); |
| 2200 | q.text("%#x" % self.subtype) |
| 2201 | q.breakable() |
| 2202 | q.text('}') |
| 2203 | |
| 2204 | stats_reply.subtypes[65535] = experimenter_stats_reply |
| 2205 | |
| 2206 | class bsn_stats_reply(experimenter_stats_reply): |
| 2207 | subtypes = {} |
| 2208 | |
| 2209 | version = 4 |
| 2210 | type = 19 |
| 2211 | stats_type = 65535 |
| 2212 | experimenter = 6035143 |
| 2213 | |
| 2214 | def __init__(self, xid=None, flags=None, subtype=None): |
| 2215 | if xid != None: |
| 2216 | self.xid = xid |
| 2217 | else: |
| 2218 | self.xid = None |
| 2219 | if flags != None: |
| 2220 | self.flags = flags |
| 2221 | else: |
| 2222 | self.flags = 0 |
| 2223 | if subtype != None: |
| 2224 | self.subtype = subtype |
| 2225 | else: |
| 2226 | self.subtype = 0 |
| 2227 | return |
| 2228 | |
| 2229 | def pack(self): |
| 2230 | packed = [] |
| 2231 | packed.append(struct.pack("!B", self.version)) |
| 2232 | packed.append(struct.pack("!B", self.type)) |
| 2233 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2234 | packed.append(struct.pack("!L", self.xid)) |
| 2235 | packed.append(struct.pack("!H", self.stats_type)) |
| 2236 | packed.append(struct.pack("!H", self.flags)) |
| 2237 | packed.append('\x00' * 4) |
| 2238 | packed.append(struct.pack("!L", self.experimenter)) |
| 2239 | packed.append(struct.pack("!L", self.subtype)) |
| 2240 | length = sum([len(x) for x in packed]) |
| 2241 | packed[2] = struct.pack("!H", length) |
| 2242 | return ''.join(packed) |
| 2243 | |
| 2244 | @staticmethod |
| 2245 | def unpack(reader): |
| 2246 | subtype, = reader.peek('!L', 20) |
| 2247 | subclass = bsn_stats_reply.subtypes.get(subtype) |
| 2248 | if subclass: |
| 2249 | return subclass.unpack(reader) |
| 2250 | |
| 2251 | obj = bsn_stats_reply() |
| 2252 | _version = reader.read("!B")[0] |
| 2253 | assert(_version == 4) |
| 2254 | _type = reader.read("!B")[0] |
| 2255 | assert(_type == 19) |
| 2256 | _length = reader.read("!H")[0] |
| 2257 | orig_reader = reader |
| 2258 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2259 | obj.xid = reader.read("!L")[0] |
| 2260 | _stats_type = reader.read("!H")[0] |
| 2261 | assert(_stats_type == 65535) |
| 2262 | obj.flags = reader.read("!H")[0] |
| 2263 | reader.skip(4) |
| 2264 | _experimenter = reader.read("!L")[0] |
| 2265 | assert(_experimenter == 6035143) |
| 2266 | obj.subtype = reader.read("!L")[0] |
| 2267 | return obj |
| 2268 | |
| 2269 | def __eq__(self, other): |
| 2270 | if type(self) != type(other): return False |
| 2271 | if self.xid != other.xid: return False |
| 2272 | if self.flags != other.flags: return False |
| 2273 | if self.subtype != other.subtype: return False |
| 2274 | return True |
| 2275 | |
| 2276 | def pretty_print(self, q): |
| 2277 | q.text("bsn_stats_reply {") |
| 2278 | with q.group(): |
| 2279 | with q.indent(2): |
| 2280 | q.breakable() |
| 2281 | q.text("xid = "); |
| 2282 | if self.xid != None: |
| 2283 | q.text("%#x" % self.xid) |
| 2284 | else: |
| 2285 | q.text('None') |
| 2286 | q.text(","); q.breakable() |
| 2287 | q.text("flags = "); |
| 2288 | q.text("%#x" % self.flags) |
| 2289 | q.breakable() |
| 2290 | q.text('}') |
| 2291 | |
| 2292 | experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply |
| 2293 | |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2294 | class bsn_debug_counter_desc_stats_reply(bsn_stats_reply): |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2295 | version = 4 |
| 2296 | type = 19 |
| 2297 | stats_type = 65535 |
| 2298 | experimenter = 6035143 |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2299 | subtype = 13 |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2300 | |
| 2301 | def __init__(self, xid=None, flags=None, entries=None): |
| 2302 | if xid != None: |
| 2303 | self.xid = xid |
| 2304 | else: |
| 2305 | self.xid = None |
| 2306 | if flags != None: |
| 2307 | self.flags = flags |
| 2308 | else: |
| 2309 | self.flags = 0 |
| 2310 | if entries != None: |
| 2311 | self.entries = entries |
| 2312 | else: |
| 2313 | self.entries = [] |
| 2314 | return |
| 2315 | |
| 2316 | def pack(self): |
| 2317 | packed = [] |
| 2318 | packed.append(struct.pack("!B", self.version)) |
| 2319 | packed.append(struct.pack("!B", self.type)) |
| 2320 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2321 | packed.append(struct.pack("!L", self.xid)) |
| 2322 | packed.append(struct.pack("!H", self.stats_type)) |
| 2323 | packed.append(struct.pack("!H", self.flags)) |
| 2324 | packed.append('\x00' * 4) |
| 2325 | packed.append(struct.pack("!L", self.experimenter)) |
| 2326 | packed.append(struct.pack("!L", self.subtype)) |
| 2327 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 2328 | length = sum([len(x) for x in packed]) |
| 2329 | packed[2] = struct.pack("!H", length) |
| 2330 | return ''.join(packed) |
| 2331 | |
| 2332 | @staticmethod |
| 2333 | def unpack(reader): |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2334 | obj = bsn_debug_counter_desc_stats_reply() |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2335 | _version = reader.read("!B")[0] |
| 2336 | assert(_version == 4) |
| 2337 | _type = reader.read("!B")[0] |
| 2338 | assert(_type == 19) |
| 2339 | _length = reader.read("!H")[0] |
| 2340 | orig_reader = reader |
| 2341 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2342 | obj.xid = reader.read("!L")[0] |
| 2343 | _stats_type = reader.read("!H")[0] |
| 2344 | assert(_stats_type == 65535) |
| 2345 | obj.flags = reader.read("!H")[0] |
| 2346 | reader.skip(4) |
| 2347 | _experimenter = reader.read("!L")[0] |
| 2348 | assert(_experimenter == 6035143) |
| 2349 | _subtype = reader.read("!L")[0] |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2350 | assert(_subtype == 13) |
| 2351 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_debug_counter_desc_stats_entry.unpack) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2352 | return obj |
| 2353 | |
| 2354 | def __eq__(self, other): |
| 2355 | if type(self) != type(other): return False |
| 2356 | if self.xid != other.xid: return False |
| 2357 | if self.flags != other.flags: return False |
| 2358 | if self.entries != other.entries: return False |
| 2359 | return True |
| 2360 | |
| 2361 | def pretty_print(self, q): |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2362 | q.text("bsn_debug_counter_desc_stats_reply {") |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2363 | with q.group(): |
| 2364 | with q.indent(2): |
| 2365 | q.breakable() |
| 2366 | q.text("xid = "); |
| 2367 | if self.xid != None: |
| 2368 | q.text("%#x" % self.xid) |
| 2369 | else: |
| 2370 | q.text('None') |
| 2371 | q.text(","); q.breakable() |
| 2372 | q.text("flags = "); |
| 2373 | q.text("%#x" % self.flags) |
| 2374 | q.text(","); q.breakable() |
| 2375 | q.text("entries = "); |
| 2376 | q.pp(self.entries) |
| 2377 | q.breakable() |
| 2378 | q.text('}') |
| 2379 | |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2380 | bsn_stats_reply.subtypes[13] = bsn_debug_counter_desc_stats_reply |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2381 | |
| 2382 | class experimenter_stats_request(stats_request): |
| 2383 | subtypes = {} |
| 2384 | |
| 2385 | version = 4 |
| 2386 | type = 18 |
| 2387 | stats_type = 65535 |
| 2388 | |
| 2389 | def __init__(self, xid=None, flags=None, experimenter=None, subtype=None): |
| 2390 | if xid != None: |
| 2391 | self.xid = xid |
| 2392 | else: |
| 2393 | self.xid = None |
| 2394 | if flags != None: |
| 2395 | self.flags = flags |
| 2396 | else: |
| 2397 | self.flags = 0 |
| 2398 | if experimenter != None: |
| 2399 | self.experimenter = experimenter |
| 2400 | else: |
| 2401 | self.experimenter = 0 |
| 2402 | if subtype != None: |
| 2403 | self.subtype = subtype |
| 2404 | else: |
| 2405 | self.subtype = 0 |
| 2406 | return |
| 2407 | |
| 2408 | def pack(self): |
| 2409 | packed = [] |
| 2410 | packed.append(struct.pack("!B", self.version)) |
| 2411 | packed.append(struct.pack("!B", self.type)) |
| 2412 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2413 | packed.append(struct.pack("!L", self.xid)) |
| 2414 | packed.append(struct.pack("!H", self.stats_type)) |
| 2415 | packed.append(struct.pack("!H", self.flags)) |
| 2416 | packed.append('\x00' * 4) |
| 2417 | packed.append(struct.pack("!L", self.experimenter)) |
| 2418 | packed.append(struct.pack("!L", self.subtype)) |
| 2419 | length = sum([len(x) for x in packed]) |
| 2420 | packed[2] = struct.pack("!H", length) |
| 2421 | return ''.join(packed) |
| 2422 | |
| 2423 | @staticmethod |
| 2424 | def unpack(reader): |
| 2425 | subtype, = reader.peek('!L', 16) |
| 2426 | subclass = experimenter_stats_request.subtypes.get(subtype) |
| 2427 | if subclass: |
| 2428 | return subclass.unpack(reader) |
| 2429 | |
| 2430 | obj = experimenter_stats_request() |
| 2431 | _version = reader.read("!B")[0] |
| 2432 | assert(_version == 4) |
| 2433 | _type = reader.read("!B")[0] |
| 2434 | assert(_type == 18) |
| 2435 | _length = reader.read("!H")[0] |
| 2436 | orig_reader = reader |
| 2437 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2438 | obj.xid = reader.read("!L")[0] |
| 2439 | _stats_type = reader.read("!H")[0] |
| 2440 | assert(_stats_type == 65535) |
| 2441 | obj.flags = reader.read("!H")[0] |
| 2442 | reader.skip(4) |
| 2443 | obj.experimenter = reader.read("!L")[0] |
| 2444 | obj.subtype = reader.read("!L")[0] |
| 2445 | return obj |
| 2446 | |
| 2447 | def __eq__(self, other): |
| 2448 | if type(self) != type(other): return False |
| 2449 | if self.xid != other.xid: return False |
| 2450 | if self.flags != other.flags: return False |
| 2451 | if self.experimenter != other.experimenter: return False |
| 2452 | if self.subtype != other.subtype: return False |
| 2453 | return True |
| 2454 | |
| 2455 | def pretty_print(self, q): |
| 2456 | q.text("experimenter_stats_request {") |
| 2457 | with q.group(): |
| 2458 | with q.indent(2): |
| 2459 | q.breakable() |
| 2460 | q.text("xid = "); |
| 2461 | if self.xid != None: |
| 2462 | q.text("%#x" % self.xid) |
| 2463 | else: |
| 2464 | q.text('None') |
| 2465 | q.text(","); q.breakable() |
| 2466 | q.text("flags = "); |
| 2467 | q.text("%#x" % self.flags) |
| 2468 | q.text(","); q.breakable() |
| 2469 | q.text("subtype = "); |
| 2470 | q.text("%#x" % self.subtype) |
| 2471 | q.breakable() |
| 2472 | q.text('}') |
| 2473 | |
| 2474 | stats_request.subtypes[65535] = experimenter_stats_request |
| 2475 | |
| 2476 | class bsn_stats_request(experimenter_stats_request): |
| 2477 | subtypes = {} |
| 2478 | |
| 2479 | version = 4 |
| 2480 | type = 18 |
| 2481 | stats_type = 65535 |
| 2482 | experimenter = 6035143 |
| 2483 | |
| 2484 | def __init__(self, xid=None, flags=None, subtype=None): |
| 2485 | if xid != None: |
| 2486 | self.xid = xid |
| 2487 | else: |
| 2488 | self.xid = None |
| 2489 | if flags != None: |
| 2490 | self.flags = flags |
| 2491 | else: |
| 2492 | self.flags = 0 |
| 2493 | if subtype != None: |
| 2494 | self.subtype = subtype |
| 2495 | else: |
| 2496 | self.subtype = 0 |
| 2497 | return |
| 2498 | |
| 2499 | def pack(self): |
| 2500 | packed = [] |
| 2501 | packed.append(struct.pack("!B", self.version)) |
| 2502 | packed.append(struct.pack("!B", self.type)) |
| 2503 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2504 | packed.append(struct.pack("!L", self.xid)) |
| 2505 | packed.append(struct.pack("!H", self.stats_type)) |
| 2506 | packed.append(struct.pack("!H", self.flags)) |
| 2507 | packed.append('\x00' * 4) |
| 2508 | packed.append(struct.pack("!L", self.experimenter)) |
| 2509 | packed.append(struct.pack("!L", self.subtype)) |
| 2510 | length = sum([len(x) for x in packed]) |
| 2511 | packed[2] = struct.pack("!H", length) |
| 2512 | return ''.join(packed) |
| 2513 | |
| 2514 | @staticmethod |
| 2515 | def unpack(reader): |
| 2516 | subtype, = reader.peek('!L', 20) |
| 2517 | subclass = bsn_stats_request.subtypes.get(subtype) |
| 2518 | if subclass: |
| 2519 | return subclass.unpack(reader) |
| 2520 | |
| 2521 | obj = bsn_stats_request() |
| 2522 | _version = reader.read("!B")[0] |
| 2523 | assert(_version == 4) |
| 2524 | _type = reader.read("!B")[0] |
| 2525 | assert(_type == 18) |
| 2526 | _length = reader.read("!H")[0] |
| 2527 | orig_reader = reader |
| 2528 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2529 | obj.xid = reader.read("!L")[0] |
| 2530 | _stats_type = reader.read("!H")[0] |
| 2531 | assert(_stats_type == 65535) |
| 2532 | obj.flags = reader.read("!H")[0] |
| 2533 | reader.skip(4) |
| 2534 | _experimenter = reader.read("!L")[0] |
| 2535 | assert(_experimenter == 6035143) |
| 2536 | obj.subtype = reader.read("!L")[0] |
| 2537 | return obj |
| 2538 | |
| 2539 | def __eq__(self, other): |
| 2540 | if type(self) != type(other): return False |
| 2541 | if self.xid != other.xid: return False |
| 2542 | if self.flags != other.flags: return False |
| 2543 | if self.subtype != other.subtype: return False |
| 2544 | return True |
| 2545 | |
| 2546 | def pretty_print(self, q): |
| 2547 | q.text("bsn_stats_request {") |
| 2548 | with q.group(): |
| 2549 | with q.indent(2): |
| 2550 | q.breakable() |
| 2551 | q.text("xid = "); |
| 2552 | if self.xid != None: |
| 2553 | q.text("%#x" % self.xid) |
| 2554 | else: |
| 2555 | q.text('None') |
| 2556 | q.text(","); q.breakable() |
| 2557 | q.text("flags = "); |
| 2558 | q.text("%#x" % self.flags) |
| 2559 | q.breakable() |
| 2560 | q.text('}') |
| 2561 | |
| 2562 | experimenter_stats_request.subtypes[6035143] = bsn_stats_request |
| 2563 | |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2564 | class bsn_debug_counter_desc_stats_request(bsn_stats_request): |
| 2565 | version = 4 |
| 2566 | type = 18 |
| 2567 | stats_type = 65535 |
| 2568 | experimenter = 6035143 |
| 2569 | subtype = 13 |
| 2570 | |
| 2571 | def __init__(self, xid=None, flags=None): |
| 2572 | if xid != None: |
| 2573 | self.xid = xid |
| 2574 | else: |
| 2575 | self.xid = None |
| 2576 | if flags != None: |
| 2577 | self.flags = flags |
| 2578 | else: |
| 2579 | self.flags = 0 |
| 2580 | return |
| 2581 | |
| 2582 | def pack(self): |
| 2583 | packed = [] |
| 2584 | packed.append(struct.pack("!B", self.version)) |
| 2585 | packed.append(struct.pack("!B", self.type)) |
| 2586 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2587 | packed.append(struct.pack("!L", self.xid)) |
| 2588 | packed.append(struct.pack("!H", self.stats_type)) |
| 2589 | packed.append(struct.pack("!H", self.flags)) |
| 2590 | packed.append('\x00' * 4) |
| 2591 | packed.append(struct.pack("!L", self.experimenter)) |
| 2592 | packed.append(struct.pack("!L", self.subtype)) |
| 2593 | length = sum([len(x) for x in packed]) |
| 2594 | packed[2] = struct.pack("!H", length) |
| 2595 | return ''.join(packed) |
| 2596 | |
| 2597 | @staticmethod |
| 2598 | def unpack(reader): |
| 2599 | obj = bsn_debug_counter_desc_stats_request() |
| 2600 | _version = reader.read("!B")[0] |
| 2601 | assert(_version == 4) |
| 2602 | _type = reader.read("!B")[0] |
| 2603 | assert(_type == 18) |
| 2604 | _length = reader.read("!H")[0] |
| 2605 | orig_reader = reader |
| 2606 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2607 | obj.xid = reader.read("!L")[0] |
| 2608 | _stats_type = reader.read("!H")[0] |
| 2609 | assert(_stats_type == 65535) |
| 2610 | obj.flags = reader.read("!H")[0] |
| 2611 | reader.skip(4) |
| 2612 | _experimenter = reader.read("!L")[0] |
| 2613 | assert(_experimenter == 6035143) |
| 2614 | _subtype = reader.read("!L")[0] |
| 2615 | assert(_subtype == 13) |
| 2616 | return obj |
| 2617 | |
| 2618 | def __eq__(self, other): |
| 2619 | if type(self) != type(other): return False |
| 2620 | if self.xid != other.xid: return False |
| 2621 | if self.flags != other.flags: return False |
| 2622 | return True |
| 2623 | |
| 2624 | def pretty_print(self, q): |
| 2625 | q.text("bsn_debug_counter_desc_stats_request {") |
| 2626 | with q.group(): |
| 2627 | with q.indent(2): |
| 2628 | q.breakable() |
| 2629 | q.text("xid = "); |
| 2630 | if self.xid != None: |
| 2631 | q.text("%#x" % self.xid) |
| 2632 | else: |
| 2633 | q.text('None') |
| 2634 | q.text(","); q.breakable() |
| 2635 | q.text("flags = "); |
| 2636 | q.text("%#x" % self.flags) |
| 2637 | q.breakable() |
| 2638 | q.text('}') |
| 2639 | |
| 2640 | bsn_stats_request.subtypes[13] = bsn_debug_counter_desc_stats_request |
| 2641 | |
| 2642 | class bsn_debug_counter_stats_reply(bsn_stats_reply): |
| 2643 | version = 4 |
| 2644 | type = 19 |
| 2645 | stats_type = 65535 |
| 2646 | experimenter = 6035143 |
| 2647 | subtype = 12 |
| 2648 | |
| 2649 | def __init__(self, xid=None, flags=None, entries=None): |
| 2650 | if xid != None: |
| 2651 | self.xid = xid |
| 2652 | else: |
| 2653 | self.xid = None |
| 2654 | if flags != None: |
| 2655 | self.flags = flags |
| 2656 | else: |
| 2657 | self.flags = 0 |
| 2658 | if entries != None: |
| 2659 | self.entries = entries |
| 2660 | else: |
| 2661 | self.entries = [] |
| 2662 | return |
| 2663 | |
| 2664 | def pack(self): |
| 2665 | packed = [] |
| 2666 | packed.append(struct.pack("!B", self.version)) |
| 2667 | packed.append(struct.pack("!B", self.type)) |
| 2668 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2669 | packed.append(struct.pack("!L", self.xid)) |
| 2670 | packed.append(struct.pack("!H", self.stats_type)) |
| 2671 | packed.append(struct.pack("!H", self.flags)) |
| 2672 | packed.append('\x00' * 4) |
| 2673 | packed.append(struct.pack("!L", self.experimenter)) |
| 2674 | packed.append(struct.pack("!L", self.subtype)) |
| 2675 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 2676 | length = sum([len(x) for x in packed]) |
| 2677 | packed[2] = struct.pack("!H", length) |
| 2678 | return ''.join(packed) |
| 2679 | |
| 2680 | @staticmethod |
| 2681 | def unpack(reader): |
| 2682 | obj = bsn_debug_counter_stats_reply() |
| 2683 | _version = reader.read("!B")[0] |
| 2684 | assert(_version == 4) |
| 2685 | _type = reader.read("!B")[0] |
| 2686 | assert(_type == 19) |
| 2687 | _length = reader.read("!H")[0] |
| 2688 | orig_reader = reader |
| 2689 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2690 | obj.xid = reader.read("!L")[0] |
| 2691 | _stats_type = reader.read("!H")[0] |
| 2692 | assert(_stats_type == 65535) |
| 2693 | obj.flags = reader.read("!H")[0] |
| 2694 | reader.skip(4) |
| 2695 | _experimenter = reader.read("!L")[0] |
| 2696 | assert(_experimenter == 6035143) |
| 2697 | _subtype = reader.read("!L")[0] |
| 2698 | assert(_subtype == 12) |
| 2699 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_debug_counter_stats_entry.unpack) |
| 2700 | return obj |
| 2701 | |
| 2702 | def __eq__(self, other): |
| 2703 | if type(self) != type(other): return False |
| 2704 | if self.xid != other.xid: return False |
| 2705 | if self.flags != other.flags: return False |
| 2706 | if self.entries != other.entries: return False |
| 2707 | return True |
| 2708 | |
| 2709 | def pretty_print(self, q): |
| 2710 | q.text("bsn_debug_counter_stats_reply {") |
| 2711 | with q.group(): |
| 2712 | with q.indent(2): |
| 2713 | q.breakable() |
| 2714 | q.text("xid = "); |
| 2715 | if self.xid != None: |
| 2716 | q.text("%#x" % self.xid) |
| 2717 | else: |
| 2718 | q.text('None') |
| 2719 | q.text(","); q.breakable() |
| 2720 | q.text("flags = "); |
| 2721 | q.text("%#x" % self.flags) |
| 2722 | q.text(","); q.breakable() |
| 2723 | q.text("entries = "); |
| 2724 | q.pp(self.entries) |
| 2725 | q.breakable() |
| 2726 | q.text('}') |
| 2727 | |
| 2728 | bsn_stats_reply.subtypes[12] = bsn_debug_counter_stats_reply |
| 2729 | |
| 2730 | class bsn_debug_counter_stats_request(bsn_stats_request): |
| 2731 | version = 4 |
| 2732 | type = 18 |
| 2733 | stats_type = 65535 |
| 2734 | experimenter = 6035143 |
| 2735 | subtype = 12 |
| 2736 | |
| 2737 | def __init__(self, xid=None, flags=None): |
| 2738 | if xid != None: |
| 2739 | self.xid = xid |
| 2740 | else: |
| 2741 | self.xid = None |
| 2742 | if flags != None: |
| 2743 | self.flags = flags |
| 2744 | else: |
| 2745 | self.flags = 0 |
| 2746 | return |
| 2747 | |
| 2748 | def pack(self): |
| 2749 | packed = [] |
| 2750 | packed.append(struct.pack("!B", self.version)) |
| 2751 | packed.append(struct.pack("!B", self.type)) |
| 2752 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2753 | packed.append(struct.pack("!L", self.xid)) |
| 2754 | packed.append(struct.pack("!H", self.stats_type)) |
| 2755 | packed.append(struct.pack("!H", self.flags)) |
| 2756 | packed.append('\x00' * 4) |
| 2757 | packed.append(struct.pack("!L", self.experimenter)) |
| 2758 | packed.append(struct.pack("!L", self.subtype)) |
| 2759 | length = sum([len(x) for x in packed]) |
| 2760 | packed[2] = struct.pack("!H", length) |
| 2761 | return ''.join(packed) |
| 2762 | |
| 2763 | @staticmethod |
| 2764 | def unpack(reader): |
| 2765 | obj = bsn_debug_counter_stats_request() |
| 2766 | _version = reader.read("!B")[0] |
| 2767 | assert(_version == 4) |
| 2768 | _type = reader.read("!B")[0] |
| 2769 | assert(_type == 18) |
| 2770 | _length = reader.read("!H")[0] |
| 2771 | orig_reader = reader |
| 2772 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2773 | obj.xid = reader.read("!L")[0] |
| 2774 | _stats_type = reader.read("!H")[0] |
| 2775 | assert(_stats_type == 65535) |
| 2776 | obj.flags = reader.read("!H")[0] |
| 2777 | reader.skip(4) |
| 2778 | _experimenter = reader.read("!L")[0] |
| 2779 | assert(_experimenter == 6035143) |
| 2780 | _subtype = reader.read("!L")[0] |
| 2781 | assert(_subtype == 12) |
| 2782 | return obj |
| 2783 | |
| 2784 | def __eq__(self, other): |
| 2785 | if type(self) != type(other): return False |
| 2786 | if self.xid != other.xid: return False |
| 2787 | if self.flags != other.flags: return False |
| 2788 | return True |
| 2789 | |
| 2790 | def pretty_print(self, q): |
| 2791 | q.text("bsn_debug_counter_stats_request {") |
| 2792 | with q.group(): |
| 2793 | with q.indent(2): |
| 2794 | q.breakable() |
| 2795 | q.text("xid = "); |
| 2796 | if self.xid != None: |
| 2797 | q.text("%#x" % self.xid) |
| 2798 | else: |
| 2799 | q.text('None') |
| 2800 | q.text(","); q.breakable() |
| 2801 | q.text("flags = "); |
| 2802 | q.text("%#x" % self.flags) |
| 2803 | q.breakable() |
| 2804 | q.text('}') |
| 2805 | |
| 2806 | bsn_stats_request.subtypes[12] = bsn_debug_counter_stats_request |
| 2807 | |
| 2808 | class bsn_flow_checksum_bucket_stats_reply(bsn_stats_reply): |
| 2809 | version = 4 |
| 2810 | type = 19 |
| 2811 | stats_type = 65535 |
| 2812 | experimenter = 6035143 |
| 2813 | subtype = 10 |
| 2814 | |
| 2815 | def __init__(self, xid=None, flags=None, entries=None): |
| 2816 | if xid != None: |
| 2817 | self.xid = xid |
| 2818 | else: |
| 2819 | self.xid = None |
| 2820 | if flags != None: |
| 2821 | self.flags = flags |
| 2822 | else: |
| 2823 | self.flags = 0 |
| 2824 | if entries != None: |
| 2825 | self.entries = entries |
| 2826 | else: |
| 2827 | self.entries = [] |
| 2828 | return |
| 2829 | |
| 2830 | def pack(self): |
| 2831 | packed = [] |
| 2832 | packed.append(struct.pack("!B", self.version)) |
| 2833 | packed.append(struct.pack("!B", self.type)) |
| 2834 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2835 | packed.append(struct.pack("!L", self.xid)) |
| 2836 | packed.append(struct.pack("!H", self.stats_type)) |
| 2837 | packed.append(struct.pack("!H", self.flags)) |
| 2838 | packed.append('\x00' * 4) |
| 2839 | packed.append(struct.pack("!L", self.experimenter)) |
| 2840 | packed.append(struct.pack("!L", self.subtype)) |
| 2841 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 2842 | length = sum([len(x) for x in packed]) |
| 2843 | packed[2] = struct.pack("!H", length) |
| 2844 | return ''.join(packed) |
| 2845 | |
| 2846 | @staticmethod |
| 2847 | def unpack(reader): |
| 2848 | obj = bsn_flow_checksum_bucket_stats_reply() |
| 2849 | _version = reader.read("!B")[0] |
| 2850 | assert(_version == 4) |
| 2851 | _type = reader.read("!B")[0] |
| 2852 | assert(_type == 19) |
| 2853 | _length = reader.read("!H")[0] |
| 2854 | orig_reader = reader |
| 2855 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2856 | obj.xid = reader.read("!L")[0] |
| 2857 | _stats_type = reader.read("!H")[0] |
| 2858 | assert(_stats_type == 65535) |
| 2859 | obj.flags = reader.read("!H")[0] |
| 2860 | reader.skip(4) |
| 2861 | _experimenter = reader.read("!L")[0] |
| 2862 | assert(_experimenter == 6035143) |
| 2863 | _subtype = reader.read("!L")[0] |
| 2864 | assert(_subtype == 10) |
| 2865 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_flow_checksum_bucket_stats_entry.unpack) |
| 2866 | return obj |
| 2867 | |
| 2868 | def __eq__(self, other): |
| 2869 | if type(self) != type(other): return False |
| 2870 | if self.xid != other.xid: return False |
| 2871 | if self.flags != other.flags: return False |
| 2872 | if self.entries != other.entries: return False |
| 2873 | return True |
| 2874 | |
| 2875 | def pretty_print(self, q): |
| 2876 | q.text("bsn_flow_checksum_bucket_stats_reply {") |
| 2877 | with q.group(): |
| 2878 | with q.indent(2): |
| 2879 | q.breakable() |
| 2880 | q.text("xid = "); |
| 2881 | if self.xid != None: |
| 2882 | q.text("%#x" % self.xid) |
| 2883 | else: |
| 2884 | q.text('None') |
| 2885 | q.text(","); q.breakable() |
| 2886 | q.text("flags = "); |
| 2887 | q.text("%#x" % self.flags) |
| 2888 | q.text(","); q.breakable() |
| 2889 | q.text("entries = "); |
| 2890 | q.pp(self.entries) |
| 2891 | q.breakable() |
| 2892 | q.text('}') |
| 2893 | |
| 2894 | bsn_stats_reply.subtypes[10] = bsn_flow_checksum_bucket_stats_reply |
| 2895 | |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2896 | class bsn_flow_checksum_bucket_stats_request(bsn_stats_request): |
| 2897 | version = 4 |
| 2898 | type = 18 |
| 2899 | stats_type = 65535 |
| 2900 | experimenter = 6035143 |
| 2901 | subtype = 10 |
| 2902 | |
| 2903 | def __init__(self, xid=None, flags=None, table_id=None): |
| 2904 | if xid != None: |
| 2905 | self.xid = xid |
| 2906 | else: |
| 2907 | self.xid = None |
| 2908 | if flags != None: |
| 2909 | self.flags = flags |
| 2910 | else: |
| 2911 | self.flags = 0 |
| 2912 | if table_id != None: |
| 2913 | self.table_id = table_id |
| 2914 | else: |
| 2915 | self.table_id = 0 |
| 2916 | return |
| 2917 | |
| 2918 | def pack(self): |
| 2919 | packed = [] |
| 2920 | packed.append(struct.pack("!B", self.version)) |
| 2921 | packed.append(struct.pack("!B", self.type)) |
| 2922 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2923 | packed.append(struct.pack("!L", self.xid)) |
| 2924 | packed.append(struct.pack("!H", self.stats_type)) |
| 2925 | packed.append(struct.pack("!H", self.flags)) |
| 2926 | packed.append('\x00' * 4) |
| 2927 | packed.append(struct.pack("!L", self.experimenter)) |
| 2928 | packed.append(struct.pack("!L", self.subtype)) |
| 2929 | packed.append(struct.pack("!B", self.table_id)) |
| 2930 | length = sum([len(x) for x in packed]) |
| 2931 | packed[2] = struct.pack("!H", length) |
| 2932 | return ''.join(packed) |
| 2933 | |
| 2934 | @staticmethod |
| 2935 | def unpack(reader): |
| 2936 | obj = bsn_flow_checksum_bucket_stats_request() |
| 2937 | _version = reader.read("!B")[0] |
| 2938 | assert(_version == 4) |
| 2939 | _type = reader.read("!B")[0] |
| 2940 | assert(_type == 18) |
| 2941 | _length = reader.read("!H")[0] |
| 2942 | orig_reader = reader |
| 2943 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2944 | obj.xid = reader.read("!L")[0] |
| 2945 | _stats_type = reader.read("!H")[0] |
| 2946 | assert(_stats_type == 65535) |
| 2947 | obj.flags = reader.read("!H")[0] |
| 2948 | reader.skip(4) |
| 2949 | _experimenter = reader.read("!L")[0] |
| 2950 | assert(_experimenter == 6035143) |
| 2951 | _subtype = reader.read("!L")[0] |
| 2952 | assert(_subtype == 10) |
| 2953 | obj.table_id = reader.read("!B")[0] |
| 2954 | return obj |
| 2955 | |
| 2956 | def __eq__(self, other): |
| 2957 | if type(self) != type(other): return False |
| 2958 | if self.xid != other.xid: return False |
| 2959 | if self.flags != other.flags: return False |
| 2960 | if self.table_id != other.table_id: return False |
| 2961 | return True |
| 2962 | |
| 2963 | def pretty_print(self, q): |
| 2964 | q.text("bsn_flow_checksum_bucket_stats_request {") |
| 2965 | with q.group(): |
| 2966 | with q.indent(2): |
| 2967 | q.breakable() |
| 2968 | q.text("xid = "); |
| 2969 | if self.xid != None: |
| 2970 | q.text("%#x" % self.xid) |
| 2971 | else: |
| 2972 | q.text('None') |
| 2973 | q.text(","); q.breakable() |
| 2974 | q.text("flags = "); |
| 2975 | q.text("%#x" % self.flags) |
| 2976 | q.text(","); q.breakable() |
| 2977 | q.text("table_id = "); |
| 2978 | q.text("%#x" % self.table_id) |
| 2979 | q.breakable() |
| 2980 | q.text('}') |
| 2981 | |
| 2982 | bsn_stats_request.subtypes[10] = bsn_flow_checksum_bucket_stats_request |
| 2983 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2984 | class bsn_flow_idle(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2985 | version = 4 |
| 2986 | type = 4 |
| 2987 | experimenter = 6035143 |
| 2988 | subtype = 40 |
| 2989 | |
| 2990 | def __init__(self, xid=None, cookie=None, priority=None, table_id=None, match=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2991 | if xid != None: |
| 2992 | self.xid = xid |
| 2993 | else: |
| 2994 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2995 | if cookie != None: |
| 2996 | self.cookie = cookie |
| 2997 | else: |
| 2998 | self.cookie = 0 |
| 2999 | if priority != None: |
| 3000 | self.priority = priority |
| 3001 | else: |
| 3002 | self.priority = 0 |
| 3003 | if table_id != None: |
| 3004 | self.table_id = table_id |
| 3005 | else: |
| 3006 | self.table_id = 0 |
| 3007 | if match != None: |
| 3008 | self.match = match |
| 3009 | else: |
| 3010 | self.match = common.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3011 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3012 | |
| 3013 | def pack(self): |
| 3014 | packed = [] |
| 3015 | packed.append(struct.pack("!B", self.version)) |
| 3016 | packed.append(struct.pack("!B", self.type)) |
| 3017 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3018 | packed.append(struct.pack("!L", self.xid)) |
| 3019 | packed.append(struct.pack("!L", self.experimenter)) |
| 3020 | packed.append(struct.pack("!L", self.subtype)) |
| 3021 | packed.append(struct.pack("!Q", self.cookie)) |
| 3022 | packed.append(struct.pack("!H", self.priority)) |
| 3023 | packed.append(struct.pack("!B", self.table_id)) |
| 3024 | packed.append('\x00' * 5) |
| 3025 | packed.append(self.match.pack()) |
| 3026 | length = sum([len(x) for x in packed]) |
| 3027 | packed[2] = struct.pack("!H", length) |
| 3028 | return ''.join(packed) |
| 3029 | |
| 3030 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3031 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3032 | obj = bsn_flow_idle() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3033 | _version = reader.read("!B")[0] |
| 3034 | assert(_version == 4) |
| 3035 | _type = reader.read("!B")[0] |
| 3036 | assert(_type == 4) |
| 3037 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3038 | orig_reader = reader |
| 3039 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3040 | obj.xid = reader.read("!L")[0] |
| 3041 | _experimenter = reader.read("!L")[0] |
| 3042 | assert(_experimenter == 6035143) |
| 3043 | _subtype = reader.read("!L")[0] |
| 3044 | assert(_subtype == 40) |
| 3045 | obj.cookie = reader.read("!Q")[0] |
| 3046 | obj.priority = reader.read("!H")[0] |
| 3047 | obj.table_id = reader.read("!B")[0] |
| 3048 | reader.skip(5) |
| 3049 | obj.match = common.match.unpack(reader) |
| 3050 | return obj |
| 3051 | |
| 3052 | def __eq__(self, other): |
| 3053 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3054 | if self.xid != other.xid: return False |
| 3055 | if self.cookie != other.cookie: return False |
| 3056 | if self.priority != other.priority: return False |
| 3057 | if self.table_id != other.table_id: return False |
| 3058 | if self.match != other.match: return False |
| 3059 | return True |
| 3060 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3061 | def pretty_print(self, q): |
| 3062 | q.text("bsn_flow_idle {") |
| 3063 | with q.group(): |
| 3064 | with q.indent(2): |
| 3065 | q.breakable() |
| 3066 | q.text("xid = "); |
| 3067 | if self.xid != None: |
| 3068 | q.text("%#x" % self.xid) |
| 3069 | else: |
| 3070 | q.text('None') |
| 3071 | q.text(","); q.breakable() |
| 3072 | q.text("cookie = "); |
| 3073 | q.text("%#x" % self.cookie) |
| 3074 | q.text(","); q.breakable() |
| 3075 | q.text("priority = "); |
| 3076 | q.text("%#x" % self.priority) |
| 3077 | q.text(","); q.breakable() |
| 3078 | q.text("table_id = "); |
| 3079 | q.text("%#x" % self.table_id) |
| 3080 | q.text(","); q.breakable() |
| 3081 | q.text("match = "); |
| 3082 | q.pp(self.match) |
| 3083 | q.breakable() |
| 3084 | q.text('}') |
| 3085 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3086 | bsn_header.subtypes[40] = bsn_flow_idle |
| 3087 | |
| 3088 | class bsn_flow_idle_enable_get_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3089 | version = 4 |
| 3090 | type = 4 |
| 3091 | experimenter = 6035143 |
| 3092 | subtype = 39 |
| 3093 | |
| 3094 | def __init__(self, xid=None, enabled=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3095 | if xid != None: |
| 3096 | self.xid = xid |
| 3097 | else: |
| 3098 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3099 | if enabled != None: |
| 3100 | self.enabled = enabled |
| 3101 | else: |
| 3102 | self.enabled = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3103 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3104 | |
| 3105 | def pack(self): |
| 3106 | packed = [] |
| 3107 | packed.append(struct.pack("!B", self.version)) |
| 3108 | packed.append(struct.pack("!B", self.type)) |
| 3109 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3110 | packed.append(struct.pack("!L", self.xid)) |
| 3111 | packed.append(struct.pack("!L", self.experimenter)) |
| 3112 | packed.append(struct.pack("!L", self.subtype)) |
| 3113 | packed.append(struct.pack("!L", self.enabled)) |
| 3114 | length = sum([len(x) for x in packed]) |
| 3115 | packed[2] = struct.pack("!H", length) |
| 3116 | return ''.join(packed) |
| 3117 | |
| 3118 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3119 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3120 | obj = bsn_flow_idle_enable_get_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3121 | _version = reader.read("!B")[0] |
| 3122 | assert(_version == 4) |
| 3123 | _type = reader.read("!B")[0] |
| 3124 | assert(_type == 4) |
| 3125 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3126 | orig_reader = reader |
| 3127 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3128 | obj.xid = reader.read("!L")[0] |
| 3129 | _experimenter = reader.read("!L")[0] |
| 3130 | assert(_experimenter == 6035143) |
| 3131 | _subtype = reader.read("!L")[0] |
| 3132 | assert(_subtype == 39) |
| 3133 | obj.enabled = reader.read("!L")[0] |
| 3134 | return obj |
| 3135 | |
| 3136 | def __eq__(self, other): |
| 3137 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3138 | if self.xid != other.xid: return False |
| 3139 | if self.enabled != other.enabled: return False |
| 3140 | return True |
| 3141 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3142 | def pretty_print(self, q): |
| 3143 | q.text("bsn_flow_idle_enable_get_reply {") |
| 3144 | with q.group(): |
| 3145 | with q.indent(2): |
| 3146 | q.breakable() |
| 3147 | q.text("xid = "); |
| 3148 | if self.xid != None: |
| 3149 | q.text("%#x" % self.xid) |
| 3150 | else: |
| 3151 | q.text('None') |
| 3152 | q.text(","); q.breakable() |
| 3153 | q.text("enabled = "); |
| 3154 | q.text("%#x" % self.enabled) |
| 3155 | q.breakable() |
| 3156 | q.text('}') |
| 3157 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3158 | bsn_header.subtypes[39] = bsn_flow_idle_enable_get_reply |
| 3159 | |
| 3160 | class bsn_flow_idle_enable_get_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3161 | version = 4 |
| 3162 | type = 4 |
| 3163 | experimenter = 6035143 |
| 3164 | subtype = 38 |
| 3165 | |
| 3166 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3167 | if xid != None: |
| 3168 | self.xid = xid |
| 3169 | else: |
| 3170 | self.xid = None |
| 3171 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3172 | |
| 3173 | def pack(self): |
| 3174 | packed = [] |
| 3175 | packed.append(struct.pack("!B", self.version)) |
| 3176 | packed.append(struct.pack("!B", self.type)) |
| 3177 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3178 | packed.append(struct.pack("!L", self.xid)) |
| 3179 | packed.append(struct.pack("!L", self.experimenter)) |
| 3180 | packed.append(struct.pack("!L", self.subtype)) |
| 3181 | length = sum([len(x) for x in packed]) |
| 3182 | packed[2] = struct.pack("!H", length) |
| 3183 | return ''.join(packed) |
| 3184 | |
| 3185 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3186 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3187 | obj = bsn_flow_idle_enable_get_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3188 | _version = reader.read("!B")[0] |
| 3189 | assert(_version == 4) |
| 3190 | _type = reader.read("!B")[0] |
| 3191 | assert(_type == 4) |
| 3192 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3193 | orig_reader = reader |
| 3194 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3195 | obj.xid = reader.read("!L")[0] |
| 3196 | _experimenter = reader.read("!L")[0] |
| 3197 | assert(_experimenter == 6035143) |
| 3198 | _subtype = reader.read("!L")[0] |
| 3199 | assert(_subtype == 38) |
| 3200 | return obj |
| 3201 | |
| 3202 | def __eq__(self, other): |
| 3203 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3204 | if self.xid != other.xid: return False |
| 3205 | return True |
| 3206 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3207 | def pretty_print(self, q): |
| 3208 | q.text("bsn_flow_idle_enable_get_request {") |
| 3209 | with q.group(): |
| 3210 | with q.indent(2): |
| 3211 | q.breakable() |
| 3212 | q.text("xid = "); |
| 3213 | if self.xid != None: |
| 3214 | q.text("%#x" % self.xid) |
| 3215 | else: |
| 3216 | q.text('None') |
| 3217 | q.breakable() |
| 3218 | q.text('}') |
| 3219 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3220 | bsn_header.subtypes[38] = bsn_flow_idle_enable_get_request |
| 3221 | |
| 3222 | class bsn_flow_idle_enable_set_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3223 | version = 4 |
| 3224 | type = 4 |
| 3225 | experimenter = 6035143 |
| 3226 | subtype = 37 |
| 3227 | |
| 3228 | def __init__(self, xid=None, enable=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3229 | if xid != None: |
| 3230 | self.xid = xid |
| 3231 | else: |
| 3232 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3233 | if enable != None: |
| 3234 | self.enable = enable |
| 3235 | else: |
| 3236 | self.enable = 0 |
| 3237 | if status != None: |
| 3238 | self.status = status |
| 3239 | else: |
| 3240 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3241 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3242 | |
| 3243 | def pack(self): |
| 3244 | packed = [] |
| 3245 | packed.append(struct.pack("!B", self.version)) |
| 3246 | packed.append(struct.pack("!B", self.type)) |
| 3247 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3248 | packed.append(struct.pack("!L", self.xid)) |
| 3249 | packed.append(struct.pack("!L", self.experimenter)) |
| 3250 | packed.append(struct.pack("!L", self.subtype)) |
| 3251 | packed.append(struct.pack("!L", self.enable)) |
| 3252 | packed.append(struct.pack("!L", self.status)) |
| 3253 | length = sum([len(x) for x in packed]) |
| 3254 | packed[2] = struct.pack("!H", length) |
| 3255 | return ''.join(packed) |
| 3256 | |
| 3257 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3258 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3259 | obj = bsn_flow_idle_enable_set_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3260 | _version = reader.read("!B")[0] |
| 3261 | assert(_version == 4) |
| 3262 | _type = reader.read("!B")[0] |
| 3263 | assert(_type == 4) |
| 3264 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3265 | orig_reader = reader |
| 3266 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3267 | obj.xid = reader.read("!L")[0] |
| 3268 | _experimenter = reader.read("!L")[0] |
| 3269 | assert(_experimenter == 6035143) |
| 3270 | _subtype = reader.read("!L")[0] |
| 3271 | assert(_subtype == 37) |
| 3272 | obj.enable = reader.read("!L")[0] |
| 3273 | obj.status = reader.read("!L")[0] |
| 3274 | return obj |
| 3275 | |
| 3276 | def __eq__(self, other): |
| 3277 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3278 | if self.xid != other.xid: return False |
| 3279 | if self.enable != other.enable: return False |
| 3280 | if self.status != other.status: return False |
| 3281 | return True |
| 3282 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3283 | def pretty_print(self, q): |
| 3284 | q.text("bsn_flow_idle_enable_set_reply {") |
| 3285 | with q.group(): |
| 3286 | with q.indent(2): |
| 3287 | q.breakable() |
| 3288 | q.text("xid = "); |
| 3289 | if self.xid != None: |
| 3290 | q.text("%#x" % self.xid) |
| 3291 | else: |
| 3292 | q.text('None') |
| 3293 | q.text(","); q.breakable() |
| 3294 | q.text("enable = "); |
| 3295 | q.text("%#x" % self.enable) |
| 3296 | q.text(","); q.breakable() |
| 3297 | q.text("status = "); |
| 3298 | q.text("%#x" % self.status) |
| 3299 | q.breakable() |
| 3300 | q.text('}') |
| 3301 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3302 | bsn_header.subtypes[37] = bsn_flow_idle_enable_set_reply |
| 3303 | |
| 3304 | class bsn_flow_idle_enable_set_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3305 | version = 4 |
| 3306 | type = 4 |
| 3307 | experimenter = 6035143 |
| 3308 | subtype = 36 |
| 3309 | |
| 3310 | def __init__(self, xid=None, enable=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3311 | if xid != None: |
| 3312 | self.xid = xid |
| 3313 | else: |
| 3314 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3315 | if enable != None: |
| 3316 | self.enable = enable |
| 3317 | else: |
| 3318 | self.enable = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3319 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3320 | |
| 3321 | def pack(self): |
| 3322 | packed = [] |
| 3323 | packed.append(struct.pack("!B", self.version)) |
| 3324 | packed.append(struct.pack("!B", self.type)) |
| 3325 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3326 | packed.append(struct.pack("!L", self.xid)) |
| 3327 | packed.append(struct.pack("!L", self.experimenter)) |
| 3328 | packed.append(struct.pack("!L", self.subtype)) |
| 3329 | packed.append(struct.pack("!L", self.enable)) |
| 3330 | length = sum([len(x) for x in packed]) |
| 3331 | packed[2] = struct.pack("!H", length) |
| 3332 | return ''.join(packed) |
| 3333 | |
| 3334 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3335 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3336 | obj = bsn_flow_idle_enable_set_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3337 | _version = reader.read("!B")[0] |
| 3338 | assert(_version == 4) |
| 3339 | _type = reader.read("!B")[0] |
| 3340 | assert(_type == 4) |
| 3341 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3342 | orig_reader = reader |
| 3343 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3344 | obj.xid = reader.read("!L")[0] |
| 3345 | _experimenter = reader.read("!L")[0] |
| 3346 | assert(_experimenter == 6035143) |
| 3347 | _subtype = reader.read("!L")[0] |
| 3348 | assert(_subtype == 36) |
| 3349 | obj.enable = reader.read("!L")[0] |
| 3350 | return obj |
| 3351 | |
| 3352 | def __eq__(self, other): |
| 3353 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3354 | if self.xid != other.xid: return False |
| 3355 | if self.enable != other.enable: return False |
| 3356 | return True |
| 3357 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3358 | def pretty_print(self, q): |
| 3359 | q.text("bsn_flow_idle_enable_set_request {") |
| 3360 | with q.group(): |
| 3361 | with q.indent(2): |
| 3362 | q.breakable() |
| 3363 | q.text("xid = "); |
| 3364 | if self.xid != None: |
| 3365 | q.text("%#x" % self.xid) |
| 3366 | else: |
| 3367 | q.text('None') |
| 3368 | q.text(","); q.breakable() |
| 3369 | q.text("enable = "); |
| 3370 | q.text("%#x" % self.enable) |
| 3371 | q.breakable() |
| 3372 | q.text('}') |
| 3373 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3374 | bsn_header.subtypes[36] = bsn_flow_idle_enable_set_request |
| 3375 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3376 | class bsn_gentable_bucket_stats_reply(bsn_stats_reply): |
| 3377 | version = 4 |
| 3378 | type = 19 |
| 3379 | stats_type = 65535 |
| 3380 | experimenter = 6035143 |
| 3381 | subtype = 5 |
| 3382 | |
| 3383 | def __init__(self, xid=None, flags=None, entries=None): |
| 3384 | if xid != None: |
| 3385 | self.xid = xid |
| 3386 | else: |
| 3387 | self.xid = None |
| 3388 | if flags != None: |
| 3389 | self.flags = flags |
| 3390 | else: |
| 3391 | self.flags = 0 |
| 3392 | if entries != None: |
| 3393 | self.entries = entries |
| 3394 | else: |
| 3395 | self.entries = [] |
| 3396 | return |
| 3397 | |
| 3398 | def pack(self): |
| 3399 | packed = [] |
| 3400 | packed.append(struct.pack("!B", self.version)) |
| 3401 | packed.append(struct.pack("!B", self.type)) |
| 3402 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3403 | packed.append(struct.pack("!L", self.xid)) |
| 3404 | packed.append(struct.pack("!H", self.stats_type)) |
| 3405 | packed.append(struct.pack("!H", self.flags)) |
| 3406 | packed.append('\x00' * 4) |
| 3407 | packed.append(struct.pack("!L", self.experimenter)) |
| 3408 | packed.append(struct.pack("!L", self.subtype)) |
| 3409 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 3410 | length = sum([len(x) for x in packed]) |
| 3411 | packed[2] = struct.pack("!H", length) |
| 3412 | return ''.join(packed) |
| 3413 | |
| 3414 | @staticmethod |
| 3415 | def unpack(reader): |
| 3416 | obj = bsn_gentable_bucket_stats_reply() |
| 3417 | _version = reader.read("!B")[0] |
| 3418 | assert(_version == 4) |
| 3419 | _type = reader.read("!B")[0] |
| 3420 | assert(_type == 19) |
| 3421 | _length = reader.read("!H")[0] |
| 3422 | orig_reader = reader |
| 3423 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3424 | obj.xid = reader.read("!L")[0] |
| 3425 | _stats_type = reader.read("!H")[0] |
| 3426 | assert(_stats_type == 65535) |
| 3427 | obj.flags = reader.read("!H")[0] |
| 3428 | reader.skip(4) |
| 3429 | _experimenter = reader.read("!L")[0] |
| 3430 | assert(_experimenter == 6035143) |
| 3431 | _subtype = reader.read("!L")[0] |
| 3432 | assert(_subtype == 5) |
| 3433 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_bucket_stats_entry.unpack) |
| 3434 | return obj |
| 3435 | |
| 3436 | def __eq__(self, other): |
| 3437 | if type(self) != type(other): return False |
| 3438 | if self.xid != other.xid: return False |
| 3439 | if self.flags != other.flags: return False |
| 3440 | if self.entries != other.entries: return False |
| 3441 | return True |
| 3442 | |
| 3443 | def pretty_print(self, q): |
| 3444 | q.text("bsn_gentable_bucket_stats_reply {") |
| 3445 | with q.group(): |
| 3446 | with q.indent(2): |
| 3447 | q.breakable() |
| 3448 | q.text("xid = "); |
| 3449 | if self.xid != None: |
| 3450 | q.text("%#x" % self.xid) |
| 3451 | else: |
| 3452 | q.text('None') |
| 3453 | q.text(","); q.breakable() |
| 3454 | q.text("flags = "); |
| 3455 | q.text("%#x" % self.flags) |
| 3456 | q.text(","); q.breakable() |
| 3457 | q.text("entries = "); |
| 3458 | q.pp(self.entries) |
| 3459 | q.breakable() |
| 3460 | q.text('}') |
| 3461 | |
| 3462 | bsn_stats_reply.subtypes[5] = bsn_gentable_bucket_stats_reply |
| 3463 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3464 | class bsn_gentable_bucket_stats_request(bsn_stats_request): |
| 3465 | version = 4 |
| 3466 | type = 18 |
| 3467 | stats_type = 65535 |
| 3468 | experimenter = 6035143 |
| 3469 | subtype = 5 |
| 3470 | |
| 3471 | def __init__(self, xid=None, flags=None, table_id=None): |
| 3472 | if xid != None: |
| 3473 | self.xid = xid |
| 3474 | else: |
| 3475 | self.xid = None |
| 3476 | if flags != None: |
| 3477 | self.flags = flags |
| 3478 | else: |
| 3479 | self.flags = 0 |
| 3480 | if table_id != None: |
| 3481 | self.table_id = table_id |
| 3482 | else: |
| 3483 | self.table_id = 0 |
| 3484 | return |
| 3485 | |
| 3486 | def pack(self): |
| 3487 | packed = [] |
| 3488 | packed.append(struct.pack("!B", self.version)) |
| 3489 | packed.append(struct.pack("!B", self.type)) |
| 3490 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3491 | packed.append(struct.pack("!L", self.xid)) |
| 3492 | packed.append(struct.pack("!H", self.stats_type)) |
| 3493 | packed.append(struct.pack("!H", self.flags)) |
| 3494 | packed.append('\x00' * 4) |
| 3495 | packed.append(struct.pack("!L", self.experimenter)) |
| 3496 | packed.append(struct.pack("!L", self.subtype)) |
| 3497 | packed.append(struct.pack("!H", self.table_id)) |
| 3498 | length = sum([len(x) for x in packed]) |
| 3499 | packed[2] = struct.pack("!H", length) |
| 3500 | return ''.join(packed) |
| 3501 | |
| 3502 | @staticmethod |
| 3503 | def unpack(reader): |
| 3504 | obj = bsn_gentable_bucket_stats_request() |
| 3505 | _version = reader.read("!B")[0] |
| 3506 | assert(_version == 4) |
| 3507 | _type = reader.read("!B")[0] |
| 3508 | assert(_type == 18) |
| 3509 | _length = reader.read("!H")[0] |
| 3510 | orig_reader = reader |
| 3511 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3512 | obj.xid = reader.read("!L")[0] |
| 3513 | _stats_type = reader.read("!H")[0] |
| 3514 | assert(_stats_type == 65535) |
| 3515 | obj.flags = reader.read("!H")[0] |
| 3516 | reader.skip(4) |
| 3517 | _experimenter = reader.read("!L")[0] |
| 3518 | assert(_experimenter == 6035143) |
| 3519 | _subtype = reader.read("!L")[0] |
| 3520 | assert(_subtype == 5) |
| 3521 | obj.table_id = reader.read("!H")[0] |
| 3522 | return obj |
| 3523 | |
| 3524 | def __eq__(self, other): |
| 3525 | if type(self) != type(other): return False |
| 3526 | if self.xid != other.xid: return False |
| 3527 | if self.flags != other.flags: return False |
| 3528 | if self.table_id != other.table_id: return False |
| 3529 | return True |
| 3530 | |
| 3531 | def pretty_print(self, q): |
| 3532 | q.text("bsn_gentable_bucket_stats_request {") |
| 3533 | with q.group(): |
| 3534 | with q.indent(2): |
| 3535 | q.breakable() |
| 3536 | q.text("xid = "); |
| 3537 | if self.xid != None: |
| 3538 | q.text("%#x" % self.xid) |
| 3539 | else: |
| 3540 | q.text('None') |
| 3541 | q.text(","); q.breakable() |
| 3542 | q.text("flags = "); |
| 3543 | q.text("%#x" % self.flags) |
| 3544 | q.text(","); q.breakable() |
| 3545 | q.text("table_id = "); |
| 3546 | q.text("%#x" % self.table_id) |
| 3547 | q.breakable() |
| 3548 | q.text('}') |
| 3549 | |
| 3550 | bsn_stats_request.subtypes[5] = bsn_gentable_bucket_stats_request |
| 3551 | |
| 3552 | class bsn_gentable_clear_reply(bsn_header): |
| 3553 | version = 4 |
| 3554 | type = 4 |
| 3555 | experimenter = 6035143 |
| 3556 | subtype = 49 |
| 3557 | |
| 3558 | def __init__(self, xid=None, table_id=None, deleted_count=None, error_count=None): |
| 3559 | if xid != None: |
| 3560 | self.xid = xid |
| 3561 | else: |
| 3562 | self.xid = None |
| 3563 | if table_id != None: |
| 3564 | self.table_id = table_id |
| 3565 | else: |
| 3566 | self.table_id = 0 |
| 3567 | if deleted_count != None: |
| 3568 | self.deleted_count = deleted_count |
| 3569 | else: |
| 3570 | self.deleted_count = 0 |
| 3571 | if error_count != None: |
| 3572 | self.error_count = error_count |
| 3573 | else: |
| 3574 | self.error_count = 0 |
| 3575 | return |
| 3576 | |
| 3577 | def pack(self): |
| 3578 | packed = [] |
| 3579 | packed.append(struct.pack("!B", self.version)) |
| 3580 | packed.append(struct.pack("!B", self.type)) |
| 3581 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3582 | packed.append(struct.pack("!L", self.xid)) |
| 3583 | packed.append(struct.pack("!L", self.experimenter)) |
| 3584 | packed.append(struct.pack("!L", self.subtype)) |
| 3585 | packed.append(struct.pack("!H", self.table_id)) |
| 3586 | packed.append('\x00' * 2) |
| 3587 | packed.append(struct.pack("!L", self.deleted_count)) |
| 3588 | packed.append(struct.pack("!L", self.error_count)) |
| 3589 | length = sum([len(x) for x in packed]) |
| 3590 | packed[2] = struct.pack("!H", length) |
| 3591 | return ''.join(packed) |
| 3592 | |
| 3593 | @staticmethod |
| 3594 | def unpack(reader): |
| 3595 | obj = bsn_gentable_clear_reply() |
| 3596 | _version = reader.read("!B")[0] |
| 3597 | assert(_version == 4) |
| 3598 | _type = reader.read("!B")[0] |
| 3599 | assert(_type == 4) |
| 3600 | _length = reader.read("!H")[0] |
| 3601 | orig_reader = reader |
| 3602 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3603 | obj.xid = reader.read("!L")[0] |
| 3604 | _experimenter = reader.read("!L")[0] |
| 3605 | assert(_experimenter == 6035143) |
| 3606 | _subtype = reader.read("!L")[0] |
| 3607 | assert(_subtype == 49) |
| 3608 | obj.table_id = reader.read("!H")[0] |
| 3609 | reader.skip(2) |
| 3610 | obj.deleted_count = reader.read("!L")[0] |
| 3611 | obj.error_count = reader.read("!L")[0] |
| 3612 | return obj |
| 3613 | |
| 3614 | def __eq__(self, other): |
| 3615 | if type(self) != type(other): return False |
| 3616 | if self.xid != other.xid: return False |
| 3617 | if self.table_id != other.table_id: return False |
| 3618 | if self.deleted_count != other.deleted_count: return False |
| 3619 | if self.error_count != other.error_count: return False |
| 3620 | return True |
| 3621 | |
| 3622 | def pretty_print(self, q): |
| 3623 | q.text("bsn_gentable_clear_reply {") |
| 3624 | with q.group(): |
| 3625 | with q.indent(2): |
| 3626 | q.breakable() |
| 3627 | q.text("xid = "); |
| 3628 | if self.xid != None: |
| 3629 | q.text("%#x" % self.xid) |
| 3630 | else: |
| 3631 | q.text('None') |
| 3632 | q.text(","); q.breakable() |
| 3633 | q.text("table_id = "); |
| 3634 | q.text("%#x" % self.table_id) |
| 3635 | q.text(","); q.breakable() |
| 3636 | q.text("deleted_count = "); |
| 3637 | q.text("%#x" % self.deleted_count) |
| 3638 | q.text(","); q.breakable() |
| 3639 | q.text("error_count = "); |
| 3640 | q.text("%#x" % self.error_count) |
| 3641 | q.breakable() |
| 3642 | q.text('}') |
| 3643 | |
| 3644 | bsn_header.subtypes[49] = bsn_gentable_clear_reply |
| 3645 | |
| 3646 | class bsn_gentable_clear_request(bsn_header): |
| 3647 | version = 4 |
| 3648 | type = 4 |
| 3649 | experimenter = 6035143 |
| 3650 | subtype = 48 |
| 3651 | |
| 3652 | def __init__(self, xid=None, table_id=None, checksum=None, checksum_mask=None): |
| 3653 | if xid != None: |
| 3654 | self.xid = xid |
| 3655 | else: |
| 3656 | self.xid = None |
| 3657 | if table_id != None: |
| 3658 | self.table_id = table_id |
| 3659 | else: |
| 3660 | self.table_id = 0 |
| 3661 | if checksum != None: |
| 3662 | self.checksum = checksum |
| 3663 | else: |
| 3664 | self.checksum = 0 |
| 3665 | if checksum_mask != None: |
| 3666 | self.checksum_mask = checksum_mask |
| 3667 | else: |
| 3668 | self.checksum_mask = 0 |
| 3669 | return |
| 3670 | |
| 3671 | def pack(self): |
| 3672 | packed = [] |
| 3673 | packed.append(struct.pack("!B", self.version)) |
| 3674 | packed.append(struct.pack("!B", self.type)) |
| 3675 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3676 | packed.append(struct.pack("!L", self.xid)) |
| 3677 | packed.append(struct.pack("!L", self.experimenter)) |
| 3678 | packed.append(struct.pack("!L", self.subtype)) |
| 3679 | packed.append(struct.pack("!H", self.table_id)) |
| 3680 | packed.append('\x00' * 2) |
| 3681 | packed.append(util.pack_checksum_128(self.checksum)) |
| 3682 | packed.append(util.pack_checksum_128(self.checksum_mask)) |
| 3683 | length = sum([len(x) for x in packed]) |
| 3684 | packed[2] = struct.pack("!H", length) |
| 3685 | return ''.join(packed) |
| 3686 | |
| 3687 | @staticmethod |
| 3688 | def unpack(reader): |
| 3689 | obj = bsn_gentable_clear_request() |
| 3690 | _version = reader.read("!B")[0] |
| 3691 | assert(_version == 4) |
| 3692 | _type = reader.read("!B")[0] |
| 3693 | assert(_type == 4) |
| 3694 | _length = reader.read("!H")[0] |
| 3695 | orig_reader = reader |
| 3696 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3697 | obj.xid = reader.read("!L")[0] |
| 3698 | _experimenter = reader.read("!L")[0] |
| 3699 | assert(_experimenter == 6035143) |
| 3700 | _subtype = reader.read("!L")[0] |
| 3701 | assert(_subtype == 48) |
| 3702 | obj.table_id = reader.read("!H")[0] |
| 3703 | reader.skip(2) |
| 3704 | obj.checksum = util.unpack_checksum_128(reader) |
| 3705 | obj.checksum_mask = util.unpack_checksum_128(reader) |
| 3706 | return obj |
| 3707 | |
| 3708 | def __eq__(self, other): |
| 3709 | if type(self) != type(other): return False |
| 3710 | if self.xid != other.xid: return False |
| 3711 | if self.table_id != other.table_id: return False |
| 3712 | if self.checksum != other.checksum: return False |
| 3713 | if self.checksum_mask != other.checksum_mask: return False |
| 3714 | return True |
| 3715 | |
| 3716 | def pretty_print(self, q): |
| 3717 | q.text("bsn_gentable_clear_request {") |
| 3718 | with q.group(): |
| 3719 | with q.indent(2): |
| 3720 | q.breakable() |
| 3721 | q.text("xid = "); |
| 3722 | if self.xid != None: |
| 3723 | q.text("%#x" % self.xid) |
| 3724 | else: |
| 3725 | q.text('None') |
| 3726 | q.text(","); q.breakable() |
| 3727 | q.text("table_id = "); |
| 3728 | q.text("%#x" % self.table_id) |
| 3729 | q.text(","); q.breakable() |
| 3730 | q.text("checksum = "); |
| 3731 | q.pp(self.checksum) |
| 3732 | q.text(","); q.breakable() |
| 3733 | q.text("checksum_mask = "); |
| 3734 | q.pp(self.checksum_mask) |
| 3735 | q.breakable() |
| 3736 | q.text('}') |
| 3737 | |
| 3738 | bsn_header.subtypes[48] = bsn_gentable_clear_request |
| 3739 | |
| 3740 | class bsn_gentable_desc_stats_reply(bsn_stats_reply): |
| 3741 | version = 4 |
| 3742 | type = 19 |
| 3743 | stats_type = 65535 |
| 3744 | experimenter = 6035143 |
| 3745 | subtype = 4 |
| 3746 | |
| 3747 | def __init__(self, xid=None, flags=None, entries=None): |
| 3748 | if xid != None: |
| 3749 | self.xid = xid |
| 3750 | else: |
| 3751 | self.xid = None |
| 3752 | if flags != None: |
| 3753 | self.flags = flags |
| 3754 | else: |
| 3755 | self.flags = 0 |
| 3756 | if entries != None: |
| 3757 | self.entries = entries |
| 3758 | else: |
| 3759 | self.entries = [] |
| 3760 | return |
| 3761 | |
| 3762 | def pack(self): |
| 3763 | packed = [] |
| 3764 | packed.append(struct.pack("!B", self.version)) |
| 3765 | packed.append(struct.pack("!B", self.type)) |
| 3766 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3767 | packed.append(struct.pack("!L", self.xid)) |
| 3768 | packed.append(struct.pack("!H", self.stats_type)) |
| 3769 | packed.append(struct.pack("!H", self.flags)) |
| 3770 | packed.append('\x00' * 4) |
| 3771 | packed.append(struct.pack("!L", self.experimenter)) |
| 3772 | packed.append(struct.pack("!L", self.subtype)) |
| 3773 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 3774 | length = sum([len(x) for x in packed]) |
| 3775 | packed[2] = struct.pack("!H", length) |
| 3776 | return ''.join(packed) |
| 3777 | |
| 3778 | @staticmethod |
| 3779 | def unpack(reader): |
| 3780 | obj = bsn_gentable_desc_stats_reply() |
| 3781 | _version = reader.read("!B")[0] |
| 3782 | assert(_version == 4) |
| 3783 | _type = reader.read("!B")[0] |
| 3784 | assert(_type == 19) |
| 3785 | _length = reader.read("!H")[0] |
| 3786 | orig_reader = reader |
| 3787 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3788 | obj.xid = reader.read("!L")[0] |
| 3789 | _stats_type = reader.read("!H")[0] |
| 3790 | assert(_stats_type == 65535) |
| 3791 | obj.flags = reader.read("!H")[0] |
| 3792 | reader.skip(4) |
| 3793 | _experimenter = reader.read("!L")[0] |
| 3794 | assert(_experimenter == 6035143) |
| 3795 | _subtype = reader.read("!L")[0] |
| 3796 | assert(_subtype == 4) |
| 3797 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_desc_stats_entry.unpack) |
| 3798 | return obj |
| 3799 | |
| 3800 | def __eq__(self, other): |
| 3801 | if type(self) != type(other): return False |
| 3802 | if self.xid != other.xid: return False |
| 3803 | if self.flags != other.flags: return False |
| 3804 | if self.entries != other.entries: return False |
| 3805 | return True |
| 3806 | |
| 3807 | def pretty_print(self, q): |
| 3808 | q.text("bsn_gentable_desc_stats_reply {") |
| 3809 | with q.group(): |
| 3810 | with q.indent(2): |
| 3811 | q.breakable() |
| 3812 | q.text("xid = "); |
| 3813 | if self.xid != None: |
| 3814 | q.text("%#x" % self.xid) |
| 3815 | else: |
| 3816 | q.text('None') |
| 3817 | q.text(","); q.breakable() |
| 3818 | q.text("flags = "); |
| 3819 | q.text("%#x" % self.flags) |
| 3820 | q.text(","); q.breakable() |
| 3821 | q.text("entries = "); |
| 3822 | q.pp(self.entries) |
| 3823 | q.breakable() |
| 3824 | q.text('}') |
| 3825 | |
| 3826 | bsn_stats_reply.subtypes[4] = bsn_gentable_desc_stats_reply |
| 3827 | |
| 3828 | class bsn_gentable_desc_stats_request(bsn_stats_request): |
| 3829 | version = 4 |
| 3830 | type = 18 |
| 3831 | stats_type = 65535 |
| 3832 | experimenter = 6035143 |
| 3833 | subtype = 4 |
| 3834 | |
| 3835 | def __init__(self, xid=None, flags=None): |
| 3836 | if xid != None: |
| 3837 | self.xid = xid |
| 3838 | else: |
| 3839 | self.xid = None |
| 3840 | if flags != None: |
| 3841 | self.flags = flags |
| 3842 | else: |
| 3843 | self.flags = 0 |
| 3844 | return |
| 3845 | |
| 3846 | def pack(self): |
| 3847 | packed = [] |
| 3848 | packed.append(struct.pack("!B", self.version)) |
| 3849 | packed.append(struct.pack("!B", self.type)) |
| 3850 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3851 | packed.append(struct.pack("!L", self.xid)) |
| 3852 | packed.append(struct.pack("!H", self.stats_type)) |
| 3853 | packed.append(struct.pack("!H", self.flags)) |
| 3854 | packed.append('\x00' * 4) |
| 3855 | packed.append(struct.pack("!L", self.experimenter)) |
| 3856 | packed.append(struct.pack("!L", self.subtype)) |
| 3857 | length = sum([len(x) for x in packed]) |
| 3858 | packed[2] = struct.pack("!H", length) |
| 3859 | return ''.join(packed) |
| 3860 | |
| 3861 | @staticmethod |
| 3862 | def unpack(reader): |
| 3863 | obj = bsn_gentable_desc_stats_request() |
| 3864 | _version = reader.read("!B")[0] |
| 3865 | assert(_version == 4) |
| 3866 | _type = reader.read("!B")[0] |
| 3867 | assert(_type == 18) |
| 3868 | _length = reader.read("!H")[0] |
| 3869 | orig_reader = reader |
| 3870 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3871 | obj.xid = reader.read("!L")[0] |
| 3872 | _stats_type = reader.read("!H")[0] |
| 3873 | assert(_stats_type == 65535) |
| 3874 | obj.flags = reader.read("!H")[0] |
| 3875 | reader.skip(4) |
| 3876 | _experimenter = reader.read("!L")[0] |
| 3877 | assert(_experimenter == 6035143) |
| 3878 | _subtype = reader.read("!L")[0] |
| 3879 | assert(_subtype == 4) |
| 3880 | return obj |
| 3881 | |
| 3882 | def __eq__(self, other): |
| 3883 | if type(self) != type(other): return False |
| 3884 | if self.xid != other.xid: return False |
| 3885 | if self.flags != other.flags: return False |
| 3886 | return True |
| 3887 | |
| 3888 | def pretty_print(self, q): |
| 3889 | q.text("bsn_gentable_desc_stats_request {") |
| 3890 | with q.group(): |
| 3891 | with q.indent(2): |
| 3892 | q.breakable() |
| 3893 | q.text("xid = "); |
| 3894 | if self.xid != None: |
| 3895 | q.text("%#x" % self.xid) |
| 3896 | else: |
| 3897 | q.text('None') |
| 3898 | q.text(","); q.breakable() |
| 3899 | q.text("flags = "); |
| 3900 | q.text("%#x" % self.flags) |
| 3901 | q.breakable() |
| 3902 | q.text('}') |
| 3903 | |
| 3904 | bsn_stats_request.subtypes[4] = bsn_gentable_desc_stats_request |
| 3905 | |
| 3906 | class bsn_gentable_entry_add(bsn_header): |
| 3907 | version = 4 |
| 3908 | type = 4 |
| 3909 | experimenter = 6035143 |
| 3910 | subtype = 46 |
| 3911 | |
| 3912 | def __init__(self, xid=None, table_id=None, checksum=None, key=None, value=None): |
| 3913 | if xid != None: |
| 3914 | self.xid = xid |
| 3915 | else: |
| 3916 | self.xid = None |
| 3917 | if table_id != None: |
| 3918 | self.table_id = table_id |
| 3919 | else: |
| 3920 | self.table_id = 0 |
| 3921 | if checksum != None: |
| 3922 | self.checksum = checksum |
| 3923 | else: |
| 3924 | self.checksum = 0 |
| 3925 | if key != None: |
| 3926 | self.key = key |
| 3927 | else: |
| 3928 | self.key = [] |
| 3929 | if value != None: |
| 3930 | self.value = value |
| 3931 | else: |
| 3932 | self.value = [] |
| 3933 | return |
| 3934 | |
| 3935 | def pack(self): |
| 3936 | packed = [] |
| 3937 | packed.append(struct.pack("!B", self.version)) |
| 3938 | packed.append(struct.pack("!B", self.type)) |
| 3939 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3940 | packed.append(struct.pack("!L", self.xid)) |
| 3941 | packed.append(struct.pack("!L", self.experimenter)) |
| 3942 | packed.append(struct.pack("!L", self.subtype)) |
| 3943 | packed.append(struct.pack("!H", self.table_id)) |
| 3944 | packed.append(struct.pack("!H", 0)) # placeholder for key_length at index 7 |
| 3945 | packed.append(util.pack_checksum_128(self.checksum)) |
| 3946 | packed.append(loxi.generic_util.pack_list(self.key)) |
| 3947 | packed[7] = struct.pack("!H", len(packed[-1])) |
| 3948 | packed.append(loxi.generic_util.pack_list(self.value)) |
| 3949 | length = sum([len(x) for x in packed]) |
| 3950 | packed[2] = struct.pack("!H", length) |
| 3951 | return ''.join(packed) |
| 3952 | |
| 3953 | @staticmethod |
| 3954 | def unpack(reader): |
| 3955 | obj = bsn_gentable_entry_add() |
| 3956 | _version = reader.read("!B")[0] |
| 3957 | assert(_version == 4) |
| 3958 | _type = reader.read("!B")[0] |
| 3959 | assert(_type == 4) |
| 3960 | _length = reader.read("!H")[0] |
| 3961 | orig_reader = reader |
| 3962 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3963 | obj.xid = reader.read("!L")[0] |
| 3964 | _experimenter = reader.read("!L")[0] |
| 3965 | assert(_experimenter == 6035143) |
| 3966 | _subtype = reader.read("!L")[0] |
| 3967 | assert(_subtype == 46) |
| 3968 | obj.table_id = reader.read("!H")[0] |
| 3969 | _key_length = reader.read("!H")[0] |
| 3970 | obj.checksum = util.unpack_checksum_128(reader) |
| 3971 | obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), bsn_tlv.bsn_tlv.unpack) |
| 3972 | obj.value = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack) |
| 3973 | return obj |
| 3974 | |
| 3975 | def __eq__(self, other): |
| 3976 | if type(self) != type(other): return False |
| 3977 | if self.xid != other.xid: return False |
| 3978 | if self.table_id != other.table_id: return False |
| 3979 | if self.checksum != other.checksum: return False |
| 3980 | if self.key != other.key: return False |
| 3981 | if self.value != other.value: return False |
| 3982 | return True |
| 3983 | |
| 3984 | def pretty_print(self, q): |
| 3985 | q.text("bsn_gentable_entry_add {") |
| 3986 | with q.group(): |
| 3987 | with q.indent(2): |
| 3988 | q.breakable() |
| 3989 | q.text("xid = "); |
| 3990 | if self.xid != None: |
| 3991 | q.text("%#x" % self.xid) |
| 3992 | else: |
| 3993 | q.text('None') |
| 3994 | q.text(","); q.breakable() |
| 3995 | q.text("table_id = "); |
| 3996 | q.text("%#x" % self.table_id) |
| 3997 | q.text(","); q.breakable() |
| 3998 | q.text("checksum = "); |
| 3999 | q.pp(self.checksum) |
| 4000 | q.text(","); q.breakable() |
| 4001 | q.text("key = "); |
| 4002 | q.pp(self.key) |
| 4003 | q.text(","); q.breakable() |
| 4004 | q.text("value = "); |
| 4005 | q.pp(self.value) |
| 4006 | q.breakable() |
| 4007 | q.text('}') |
| 4008 | |
| 4009 | bsn_header.subtypes[46] = bsn_gentable_entry_add |
| 4010 | |
| 4011 | class bsn_gentable_entry_delete(bsn_header): |
| 4012 | version = 4 |
| 4013 | type = 4 |
| 4014 | experimenter = 6035143 |
| 4015 | subtype = 47 |
| 4016 | |
| 4017 | def __init__(self, xid=None, table_id=None, key=None): |
| 4018 | if xid != None: |
| 4019 | self.xid = xid |
| 4020 | else: |
| 4021 | self.xid = None |
| 4022 | if table_id != None: |
| 4023 | self.table_id = table_id |
| 4024 | else: |
| 4025 | self.table_id = 0 |
| 4026 | if key != None: |
| 4027 | self.key = key |
| 4028 | else: |
| 4029 | self.key = [] |
| 4030 | return |
| 4031 | |
| 4032 | def pack(self): |
| 4033 | packed = [] |
| 4034 | packed.append(struct.pack("!B", self.version)) |
| 4035 | packed.append(struct.pack("!B", self.type)) |
| 4036 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4037 | packed.append(struct.pack("!L", self.xid)) |
| 4038 | packed.append(struct.pack("!L", self.experimenter)) |
| 4039 | packed.append(struct.pack("!L", self.subtype)) |
| 4040 | packed.append(struct.pack("!H", self.table_id)) |
| 4041 | packed.append(loxi.generic_util.pack_list(self.key)) |
| 4042 | length = sum([len(x) for x in packed]) |
| 4043 | packed[2] = struct.pack("!H", length) |
| 4044 | return ''.join(packed) |
| 4045 | |
| 4046 | @staticmethod |
| 4047 | def unpack(reader): |
| 4048 | obj = bsn_gentable_entry_delete() |
| 4049 | _version = reader.read("!B")[0] |
| 4050 | assert(_version == 4) |
| 4051 | _type = reader.read("!B")[0] |
| 4052 | assert(_type == 4) |
| 4053 | _length = reader.read("!H")[0] |
| 4054 | orig_reader = reader |
| 4055 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4056 | obj.xid = reader.read("!L")[0] |
| 4057 | _experimenter = reader.read("!L")[0] |
| 4058 | assert(_experimenter == 6035143) |
| 4059 | _subtype = reader.read("!L")[0] |
| 4060 | assert(_subtype == 47) |
| 4061 | obj.table_id = reader.read("!H")[0] |
| 4062 | obj.key = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack) |
| 4063 | return obj |
| 4064 | |
| 4065 | def __eq__(self, other): |
| 4066 | if type(self) != type(other): return False |
| 4067 | if self.xid != other.xid: return False |
| 4068 | if self.table_id != other.table_id: return False |
| 4069 | if self.key != other.key: return False |
| 4070 | return True |
| 4071 | |
| 4072 | def pretty_print(self, q): |
| 4073 | q.text("bsn_gentable_entry_delete {") |
| 4074 | with q.group(): |
| 4075 | with q.indent(2): |
| 4076 | q.breakable() |
| 4077 | q.text("xid = "); |
| 4078 | if self.xid != None: |
| 4079 | q.text("%#x" % self.xid) |
| 4080 | else: |
| 4081 | q.text('None') |
| 4082 | q.text(","); q.breakable() |
| 4083 | q.text("table_id = "); |
| 4084 | q.text("%#x" % self.table_id) |
| 4085 | q.text(","); q.breakable() |
| 4086 | q.text("key = "); |
| 4087 | q.pp(self.key) |
| 4088 | q.breakable() |
| 4089 | q.text('}') |
| 4090 | |
| 4091 | bsn_header.subtypes[47] = bsn_gentable_entry_delete |
| 4092 | |
| 4093 | class bsn_gentable_entry_desc_stats_reply(bsn_stats_reply): |
| 4094 | version = 4 |
| 4095 | type = 19 |
| 4096 | stats_type = 65535 |
| 4097 | experimenter = 6035143 |
| 4098 | subtype = 2 |
| 4099 | |
| 4100 | def __init__(self, xid=None, flags=None, entries=None): |
| 4101 | if xid != None: |
| 4102 | self.xid = xid |
| 4103 | else: |
| 4104 | self.xid = None |
| 4105 | if flags != None: |
| 4106 | self.flags = flags |
| 4107 | else: |
| 4108 | self.flags = 0 |
| 4109 | if entries != None: |
| 4110 | self.entries = entries |
| 4111 | else: |
| 4112 | self.entries = [] |
| 4113 | return |
| 4114 | |
| 4115 | def pack(self): |
| 4116 | packed = [] |
| 4117 | packed.append(struct.pack("!B", self.version)) |
| 4118 | packed.append(struct.pack("!B", self.type)) |
| 4119 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4120 | packed.append(struct.pack("!L", self.xid)) |
| 4121 | packed.append(struct.pack("!H", self.stats_type)) |
| 4122 | packed.append(struct.pack("!H", self.flags)) |
| 4123 | packed.append('\x00' * 4) |
| 4124 | packed.append(struct.pack("!L", self.experimenter)) |
| 4125 | packed.append(struct.pack("!L", self.subtype)) |
| 4126 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 4127 | length = sum([len(x) for x in packed]) |
| 4128 | packed[2] = struct.pack("!H", length) |
| 4129 | return ''.join(packed) |
| 4130 | |
| 4131 | @staticmethod |
| 4132 | def unpack(reader): |
| 4133 | obj = bsn_gentable_entry_desc_stats_reply() |
| 4134 | _version = reader.read("!B")[0] |
| 4135 | assert(_version == 4) |
| 4136 | _type = reader.read("!B")[0] |
| 4137 | assert(_type == 19) |
| 4138 | _length = reader.read("!H")[0] |
| 4139 | orig_reader = reader |
| 4140 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4141 | obj.xid = reader.read("!L")[0] |
| 4142 | _stats_type = reader.read("!H")[0] |
| 4143 | assert(_stats_type == 65535) |
| 4144 | obj.flags = reader.read("!H")[0] |
| 4145 | reader.skip(4) |
| 4146 | _experimenter = reader.read("!L")[0] |
| 4147 | assert(_experimenter == 6035143) |
| 4148 | _subtype = reader.read("!L")[0] |
| 4149 | assert(_subtype == 2) |
| 4150 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_entry_desc_stats_entry.unpack) |
| 4151 | return obj |
| 4152 | |
| 4153 | def __eq__(self, other): |
| 4154 | if type(self) != type(other): return False |
| 4155 | if self.xid != other.xid: return False |
| 4156 | if self.flags != other.flags: return False |
| 4157 | if self.entries != other.entries: return False |
| 4158 | return True |
| 4159 | |
| 4160 | def pretty_print(self, q): |
| 4161 | q.text("bsn_gentable_entry_desc_stats_reply {") |
| 4162 | with q.group(): |
| 4163 | with q.indent(2): |
| 4164 | q.breakable() |
| 4165 | q.text("xid = "); |
| 4166 | if self.xid != None: |
| 4167 | q.text("%#x" % self.xid) |
| 4168 | else: |
| 4169 | q.text('None') |
| 4170 | q.text(","); q.breakable() |
| 4171 | q.text("flags = "); |
| 4172 | q.text("%#x" % self.flags) |
| 4173 | q.text(","); q.breakable() |
| 4174 | q.text("entries = "); |
| 4175 | q.pp(self.entries) |
| 4176 | q.breakable() |
| 4177 | q.text('}') |
| 4178 | |
| 4179 | bsn_stats_reply.subtypes[2] = bsn_gentable_entry_desc_stats_reply |
| 4180 | |
| 4181 | class bsn_gentable_entry_desc_stats_request(bsn_stats_request): |
| 4182 | version = 4 |
| 4183 | type = 18 |
| 4184 | stats_type = 65535 |
| 4185 | experimenter = 6035143 |
| 4186 | subtype = 2 |
| 4187 | |
| 4188 | def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None): |
| 4189 | if xid != None: |
| 4190 | self.xid = xid |
| 4191 | else: |
| 4192 | self.xid = None |
| 4193 | if flags != None: |
| 4194 | self.flags = flags |
| 4195 | else: |
| 4196 | self.flags = 0 |
| 4197 | if table_id != None: |
| 4198 | self.table_id = table_id |
| 4199 | else: |
| 4200 | self.table_id = 0 |
| 4201 | if checksum != None: |
| 4202 | self.checksum = checksum |
| 4203 | else: |
| 4204 | self.checksum = 0 |
| 4205 | if checksum_mask != None: |
| 4206 | self.checksum_mask = checksum_mask |
| 4207 | else: |
| 4208 | self.checksum_mask = 0 |
| 4209 | return |
| 4210 | |
| 4211 | def pack(self): |
| 4212 | packed = [] |
| 4213 | packed.append(struct.pack("!B", self.version)) |
| 4214 | packed.append(struct.pack("!B", self.type)) |
| 4215 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4216 | packed.append(struct.pack("!L", self.xid)) |
| 4217 | packed.append(struct.pack("!H", self.stats_type)) |
| 4218 | packed.append(struct.pack("!H", self.flags)) |
| 4219 | packed.append('\x00' * 4) |
| 4220 | packed.append(struct.pack("!L", self.experimenter)) |
| 4221 | packed.append(struct.pack("!L", self.subtype)) |
| 4222 | packed.append(struct.pack("!H", self.table_id)) |
| 4223 | packed.append('\x00' * 2) |
| 4224 | packed.append(util.pack_checksum_128(self.checksum)) |
| 4225 | packed.append(util.pack_checksum_128(self.checksum_mask)) |
| 4226 | length = sum([len(x) for x in packed]) |
| 4227 | packed[2] = struct.pack("!H", length) |
| 4228 | return ''.join(packed) |
| 4229 | |
| 4230 | @staticmethod |
| 4231 | def unpack(reader): |
| 4232 | obj = bsn_gentable_entry_desc_stats_request() |
| 4233 | _version = reader.read("!B")[0] |
| 4234 | assert(_version == 4) |
| 4235 | _type = reader.read("!B")[0] |
| 4236 | assert(_type == 18) |
| 4237 | _length = reader.read("!H")[0] |
| 4238 | orig_reader = reader |
| 4239 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4240 | obj.xid = reader.read("!L")[0] |
| 4241 | _stats_type = reader.read("!H")[0] |
| 4242 | assert(_stats_type == 65535) |
| 4243 | obj.flags = reader.read("!H")[0] |
| 4244 | reader.skip(4) |
| 4245 | _experimenter = reader.read("!L")[0] |
| 4246 | assert(_experimenter == 6035143) |
| 4247 | _subtype = reader.read("!L")[0] |
| 4248 | assert(_subtype == 2) |
| 4249 | obj.table_id = reader.read("!H")[0] |
| 4250 | reader.skip(2) |
| 4251 | obj.checksum = util.unpack_checksum_128(reader) |
| 4252 | obj.checksum_mask = util.unpack_checksum_128(reader) |
| 4253 | return obj |
| 4254 | |
| 4255 | def __eq__(self, other): |
| 4256 | if type(self) != type(other): return False |
| 4257 | if self.xid != other.xid: return False |
| 4258 | if self.flags != other.flags: return False |
| 4259 | if self.table_id != other.table_id: return False |
| 4260 | if self.checksum != other.checksum: return False |
| 4261 | if self.checksum_mask != other.checksum_mask: return False |
| 4262 | return True |
| 4263 | |
| 4264 | def pretty_print(self, q): |
| 4265 | q.text("bsn_gentable_entry_desc_stats_request {") |
| 4266 | with q.group(): |
| 4267 | with q.indent(2): |
| 4268 | q.breakable() |
| 4269 | q.text("xid = "); |
| 4270 | if self.xid != None: |
| 4271 | q.text("%#x" % self.xid) |
| 4272 | else: |
| 4273 | q.text('None') |
| 4274 | q.text(","); q.breakable() |
| 4275 | q.text("flags = "); |
| 4276 | q.text("%#x" % self.flags) |
| 4277 | q.text(","); q.breakable() |
| 4278 | q.text("table_id = "); |
| 4279 | q.text("%#x" % self.table_id) |
| 4280 | q.text(","); q.breakable() |
| 4281 | q.text("checksum = "); |
| 4282 | q.pp(self.checksum) |
| 4283 | q.text(","); q.breakable() |
| 4284 | q.text("checksum_mask = "); |
| 4285 | q.pp(self.checksum_mask) |
| 4286 | q.breakable() |
| 4287 | q.text('}') |
| 4288 | |
| 4289 | bsn_stats_request.subtypes[2] = bsn_gentable_entry_desc_stats_request |
| 4290 | |
| 4291 | class bsn_gentable_entry_stats_reply(bsn_stats_reply): |
| 4292 | version = 4 |
| 4293 | type = 19 |
| 4294 | stats_type = 65535 |
| 4295 | experimenter = 6035143 |
| 4296 | subtype = 3 |
| 4297 | |
| 4298 | def __init__(self, xid=None, flags=None, entries=None): |
| 4299 | if xid != None: |
| 4300 | self.xid = xid |
| 4301 | else: |
| 4302 | self.xid = None |
| 4303 | if flags != None: |
| 4304 | self.flags = flags |
| 4305 | else: |
| 4306 | self.flags = 0 |
| 4307 | if entries != None: |
| 4308 | self.entries = entries |
| 4309 | else: |
| 4310 | self.entries = [] |
| 4311 | return |
| 4312 | |
| 4313 | def pack(self): |
| 4314 | packed = [] |
| 4315 | packed.append(struct.pack("!B", self.version)) |
| 4316 | packed.append(struct.pack("!B", self.type)) |
| 4317 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4318 | packed.append(struct.pack("!L", self.xid)) |
| 4319 | packed.append(struct.pack("!H", self.stats_type)) |
| 4320 | packed.append(struct.pack("!H", self.flags)) |
| 4321 | packed.append('\x00' * 4) |
| 4322 | packed.append(struct.pack("!L", self.experimenter)) |
| 4323 | packed.append(struct.pack("!L", self.subtype)) |
| 4324 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 4325 | length = sum([len(x) for x in packed]) |
| 4326 | packed[2] = struct.pack("!H", length) |
| 4327 | return ''.join(packed) |
| 4328 | |
| 4329 | @staticmethod |
| 4330 | def unpack(reader): |
| 4331 | obj = bsn_gentable_entry_stats_reply() |
| 4332 | _version = reader.read("!B")[0] |
| 4333 | assert(_version == 4) |
| 4334 | _type = reader.read("!B")[0] |
| 4335 | assert(_type == 19) |
| 4336 | _length = reader.read("!H")[0] |
| 4337 | orig_reader = reader |
| 4338 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4339 | obj.xid = reader.read("!L")[0] |
| 4340 | _stats_type = reader.read("!H")[0] |
| 4341 | assert(_stats_type == 65535) |
| 4342 | obj.flags = reader.read("!H")[0] |
| 4343 | reader.skip(4) |
| 4344 | _experimenter = reader.read("!L")[0] |
| 4345 | assert(_experimenter == 6035143) |
| 4346 | _subtype = reader.read("!L")[0] |
| 4347 | assert(_subtype == 3) |
| 4348 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_entry_stats_entry.unpack) |
| 4349 | return obj |
| 4350 | |
| 4351 | def __eq__(self, other): |
| 4352 | if type(self) != type(other): return False |
| 4353 | if self.xid != other.xid: return False |
| 4354 | if self.flags != other.flags: return False |
| 4355 | if self.entries != other.entries: return False |
| 4356 | return True |
| 4357 | |
| 4358 | def pretty_print(self, q): |
| 4359 | q.text("bsn_gentable_entry_stats_reply {") |
| 4360 | with q.group(): |
| 4361 | with q.indent(2): |
| 4362 | q.breakable() |
| 4363 | q.text("xid = "); |
| 4364 | if self.xid != None: |
| 4365 | q.text("%#x" % self.xid) |
| 4366 | else: |
| 4367 | q.text('None') |
| 4368 | q.text(","); q.breakable() |
| 4369 | q.text("flags = "); |
| 4370 | q.text("%#x" % self.flags) |
| 4371 | q.text(","); q.breakable() |
| 4372 | q.text("entries = "); |
| 4373 | q.pp(self.entries) |
| 4374 | q.breakable() |
| 4375 | q.text('}') |
| 4376 | |
| 4377 | bsn_stats_reply.subtypes[3] = bsn_gentable_entry_stats_reply |
| 4378 | |
| 4379 | class bsn_gentable_entry_stats_request(bsn_stats_request): |
| 4380 | version = 4 |
| 4381 | type = 18 |
| 4382 | stats_type = 65535 |
| 4383 | experimenter = 6035143 |
| 4384 | subtype = 3 |
| 4385 | |
| 4386 | def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None): |
| 4387 | if xid != None: |
| 4388 | self.xid = xid |
| 4389 | else: |
| 4390 | self.xid = None |
| 4391 | if flags != None: |
| 4392 | self.flags = flags |
| 4393 | else: |
| 4394 | self.flags = 0 |
| 4395 | if table_id != None: |
| 4396 | self.table_id = table_id |
| 4397 | else: |
| 4398 | self.table_id = 0 |
| 4399 | if checksum != None: |
| 4400 | self.checksum = checksum |
| 4401 | else: |
| 4402 | self.checksum = 0 |
| 4403 | if checksum_mask != None: |
| 4404 | self.checksum_mask = checksum_mask |
| 4405 | else: |
| 4406 | self.checksum_mask = 0 |
| 4407 | return |
| 4408 | |
| 4409 | def pack(self): |
| 4410 | packed = [] |
| 4411 | packed.append(struct.pack("!B", self.version)) |
| 4412 | packed.append(struct.pack("!B", self.type)) |
| 4413 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4414 | packed.append(struct.pack("!L", self.xid)) |
| 4415 | packed.append(struct.pack("!H", self.stats_type)) |
| 4416 | packed.append(struct.pack("!H", self.flags)) |
| 4417 | packed.append('\x00' * 4) |
| 4418 | packed.append(struct.pack("!L", self.experimenter)) |
| 4419 | packed.append(struct.pack("!L", self.subtype)) |
| 4420 | packed.append(struct.pack("!H", self.table_id)) |
| 4421 | packed.append('\x00' * 2) |
| 4422 | packed.append(util.pack_checksum_128(self.checksum)) |
| 4423 | packed.append(util.pack_checksum_128(self.checksum_mask)) |
| 4424 | length = sum([len(x) for x in packed]) |
| 4425 | packed[2] = struct.pack("!H", length) |
| 4426 | return ''.join(packed) |
| 4427 | |
| 4428 | @staticmethod |
| 4429 | def unpack(reader): |
| 4430 | obj = bsn_gentable_entry_stats_request() |
| 4431 | _version = reader.read("!B")[0] |
| 4432 | assert(_version == 4) |
| 4433 | _type = reader.read("!B")[0] |
| 4434 | assert(_type == 18) |
| 4435 | _length = reader.read("!H")[0] |
| 4436 | orig_reader = reader |
| 4437 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4438 | obj.xid = reader.read("!L")[0] |
| 4439 | _stats_type = reader.read("!H")[0] |
| 4440 | assert(_stats_type == 65535) |
| 4441 | obj.flags = reader.read("!H")[0] |
| 4442 | reader.skip(4) |
| 4443 | _experimenter = reader.read("!L")[0] |
| 4444 | assert(_experimenter == 6035143) |
| 4445 | _subtype = reader.read("!L")[0] |
| 4446 | assert(_subtype == 3) |
| 4447 | obj.table_id = reader.read("!H")[0] |
| 4448 | reader.skip(2) |
| 4449 | obj.checksum = util.unpack_checksum_128(reader) |
| 4450 | obj.checksum_mask = util.unpack_checksum_128(reader) |
| 4451 | return obj |
| 4452 | |
| 4453 | def __eq__(self, other): |
| 4454 | if type(self) != type(other): return False |
| 4455 | if self.xid != other.xid: return False |
| 4456 | if self.flags != other.flags: return False |
| 4457 | if self.table_id != other.table_id: return False |
| 4458 | if self.checksum != other.checksum: return False |
| 4459 | if self.checksum_mask != other.checksum_mask: return False |
| 4460 | return True |
| 4461 | |
| 4462 | def pretty_print(self, q): |
| 4463 | q.text("bsn_gentable_entry_stats_request {") |
| 4464 | with q.group(): |
| 4465 | with q.indent(2): |
| 4466 | q.breakable() |
| 4467 | q.text("xid = "); |
| 4468 | if self.xid != None: |
| 4469 | q.text("%#x" % self.xid) |
| 4470 | else: |
| 4471 | q.text('None') |
| 4472 | q.text(","); q.breakable() |
| 4473 | q.text("flags = "); |
| 4474 | q.text("%#x" % self.flags) |
| 4475 | q.text(","); q.breakable() |
| 4476 | q.text("table_id = "); |
| 4477 | q.text("%#x" % self.table_id) |
| 4478 | q.text(","); q.breakable() |
| 4479 | q.text("checksum = "); |
| 4480 | q.pp(self.checksum) |
| 4481 | q.text(","); q.breakable() |
| 4482 | q.text("checksum_mask = "); |
| 4483 | q.pp(self.checksum_mask) |
| 4484 | q.breakable() |
| 4485 | q.text('}') |
| 4486 | |
| 4487 | bsn_stats_request.subtypes[3] = bsn_gentable_entry_stats_request |
| 4488 | |
| 4489 | class bsn_gentable_set_buckets_size(bsn_header): |
| 4490 | version = 4 |
| 4491 | type = 4 |
| 4492 | experimenter = 6035143 |
| 4493 | subtype = 50 |
| 4494 | |
| 4495 | def __init__(self, xid=None, table_id=None, buckets_size=None): |
| 4496 | if xid != None: |
| 4497 | self.xid = xid |
| 4498 | else: |
| 4499 | self.xid = None |
| 4500 | if table_id != None: |
| 4501 | self.table_id = table_id |
| 4502 | else: |
| 4503 | self.table_id = 0 |
| 4504 | if buckets_size != None: |
| 4505 | self.buckets_size = buckets_size |
| 4506 | else: |
| 4507 | self.buckets_size = 0 |
| 4508 | return |
| 4509 | |
| 4510 | def pack(self): |
| 4511 | packed = [] |
| 4512 | packed.append(struct.pack("!B", self.version)) |
| 4513 | packed.append(struct.pack("!B", self.type)) |
| 4514 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4515 | packed.append(struct.pack("!L", self.xid)) |
| 4516 | packed.append(struct.pack("!L", self.experimenter)) |
| 4517 | packed.append(struct.pack("!L", self.subtype)) |
| 4518 | packed.append(struct.pack("!H", self.table_id)) |
| 4519 | packed.append('\x00' * 2) |
| 4520 | packed.append(struct.pack("!L", self.buckets_size)) |
| 4521 | length = sum([len(x) for x in packed]) |
| 4522 | packed[2] = struct.pack("!H", length) |
| 4523 | return ''.join(packed) |
| 4524 | |
| 4525 | @staticmethod |
| 4526 | def unpack(reader): |
| 4527 | obj = bsn_gentable_set_buckets_size() |
| 4528 | _version = reader.read("!B")[0] |
| 4529 | assert(_version == 4) |
| 4530 | _type = reader.read("!B")[0] |
| 4531 | assert(_type == 4) |
| 4532 | _length = reader.read("!H")[0] |
| 4533 | orig_reader = reader |
| 4534 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4535 | obj.xid = reader.read("!L")[0] |
| 4536 | _experimenter = reader.read("!L")[0] |
| 4537 | assert(_experimenter == 6035143) |
| 4538 | _subtype = reader.read("!L")[0] |
| 4539 | assert(_subtype == 50) |
| 4540 | obj.table_id = reader.read("!H")[0] |
| 4541 | reader.skip(2) |
| 4542 | obj.buckets_size = reader.read("!L")[0] |
| 4543 | return obj |
| 4544 | |
| 4545 | def __eq__(self, other): |
| 4546 | if type(self) != type(other): return False |
| 4547 | if self.xid != other.xid: return False |
| 4548 | if self.table_id != other.table_id: return False |
| 4549 | if self.buckets_size != other.buckets_size: return False |
| 4550 | return True |
| 4551 | |
| 4552 | def pretty_print(self, q): |
| 4553 | q.text("bsn_gentable_set_buckets_size {") |
| 4554 | with q.group(): |
| 4555 | with q.indent(2): |
| 4556 | q.breakable() |
| 4557 | q.text("xid = "); |
| 4558 | if self.xid != None: |
| 4559 | q.text("%#x" % self.xid) |
| 4560 | else: |
| 4561 | q.text('None') |
| 4562 | q.text(","); q.breakable() |
| 4563 | q.text("table_id = "); |
| 4564 | q.text("%#x" % self.table_id) |
| 4565 | q.text(","); q.breakable() |
| 4566 | q.text("buckets_size = "); |
| 4567 | q.text("%#x" % self.buckets_size) |
| 4568 | q.breakable() |
| 4569 | q.text('}') |
| 4570 | |
| 4571 | bsn_header.subtypes[50] = bsn_gentable_set_buckets_size |
| 4572 | |
| 4573 | class bsn_gentable_stats_reply(bsn_stats_reply): |
| 4574 | version = 4 |
| 4575 | type = 19 |
| 4576 | stats_type = 65535 |
| 4577 | experimenter = 6035143 |
| 4578 | subtype = 7 |
| 4579 | |
| 4580 | def __init__(self, xid=None, flags=None, entries=None): |
| 4581 | if xid != None: |
| 4582 | self.xid = xid |
| 4583 | else: |
| 4584 | self.xid = None |
| 4585 | if flags != None: |
| 4586 | self.flags = flags |
| 4587 | else: |
| 4588 | self.flags = 0 |
| 4589 | if entries != None: |
| 4590 | self.entries = entries |
| 4591 | else: |
| 4592 | self.entries = [] |
| 4593 | return |
| 4594 | |
| 4595 | def pack(self): |
| 4596 | packed = [] |
| 4597 | packed.append(struct.pack("!B", self.version)) |
| 4598 | packed.append(struct.pack("!B", self.type)) |
| 4599 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4600 | packed.append(struct.pack("!L", self.xid)) |
| 4601 | packed.append(struct.pack("!H", self.stats_type)) |
| 4602 | packed.append(struct.pack("!H", self.flags)) |
| 4603 | packed.append('\x00' * 4) |
| 4604 | packed.append(struct.pack("!L", self.experimenter)) |
| 4605 | packed.append(struct.pack("!L", self.subtype)) |
| 4606 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 4607 | length = sum([len(x) for x in packed]) |
| 4608 | packed[2] = struct.pack("!H", length) |
| 4609 | return ''.join(packed) |
| 4610 | |
| 4611 | @staticmethod |
| 4612 | def unpack(reader): |
| 4613 | obj = bsn_gentable_stats_reply() |
| 4614 | _version = reader.read("!B")[0] |
| 4615 | assert(_version == 4) |
| 4616 | _type = reader.read("!B")[0] |
| 4617 | assert(_type == 19) |
| 4618 | _length = reader.read("!H")[0] |
| 4619 | orig_reader = reader |
| 4620 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4621 | obj.xid = reader.read("!L")[0] |
| 4622 | _stats_type = reader.read("!H")[0] |
| 4623 | assert(_stats_type == 65535) |
| 4624 | obj.flags = reader.read("!H")[0] |
| 4625 | reader.skip(4) |
| 4626 | _experimenter = reader.read("!L")[0] |
| 4627 | assert(_experimenter == 6035143) |
| 4628 | _subtype = reader.read("!L")[0] |
| 4629 | assert(_subtype == 7) |
| 4630 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_stats_entry.unpack) |
| 4631 | return obj |
| 4632 | |
| 4633 | def __eq__(self, other): |
| 4634 | if type(self) != type(other): return False |
| 4635 | if self.xid != other.xid: return False |
| 4636 | if self.flags != other.flags: return False |
| 4637 | if self.entries != other.entries: return False |
| 4638 | return True |
| 4639 | |
| 4640 | def pretty_print(self, q): |
| 4641 | q.text("bsn_gentable_stats_reply {") |
| 4642 | with q.group(): |
| 4643 | with q.indent(2): |
| 4644 | q.breakable() |
| 4645 | q.text("xid = "); |
| 4646 | if self.xid != None: |
| 4647 | q.text("%#x" % self.xid) |
| 4648 | else: |
| 4649 | q.text('None') |
| 4650 | q.text(","); q.breakable() |
| 4651 | q.text("flags = "); |
| 4652 | q.text("%#x" % self.flags) |
| 4653 | q.text(","); q.breakable() |
| 4654 | q.text("entries = "); |
| 4655 | q.pp(self.entries) |
| 4656 | q.breakable() |
| 4657 | q.text('}') |
| 4658 | |
| 4659 | bsn_stats_reply.subtypes[7] = bsn_gentable_stats_reply |
| 4660 | |
| 4661 | class bsn_gentable_stats_request(bsn_stats_request): |
| 4662 | version = 4 |
| 4663 | type = 18 |
| 4664 | stats_type = 65535 |
| 4665 | experimenter = 6035143 |
| 4666 | subtype = 7 |
| 4667 | |
| 4668 | def __init__(self, xid=None, flags=None): |
| 4669 | if xid != None: |
| 4670 | self.xid = xid |
| 4671 | else: |
| 4672 | self.xid = None |
| 4673 | if flags != None: |
| 4674 | self.flags = flags |
| 4675 | else: |
| 4676 | self.flags = 0 |
| 4677 | return |
| 4678 | |
| 4679 | def pack(self): |
| 4680 | packed = [] |
| 4681 | packed.append(struct.pack("!B", self.version)) |
| 4682 | packed.append(struct.pack("!B", self.type)) |
| 4683 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4684 | packed.append(struct.pack("!L", self.xid)) |
| 4685 | packed.append(struct.pack("!H", self.stats_type)) |
| 4686 | packed.append(struct.pack("!H", self.flags)) |
| 4687 | packed.append('\x00' * 4) |
| 4688 | packed.append(struct.pack("!L", self.experimenter)) |
| 4689 | packed.append(struct.pack("!L", self.subtype)) |
| 4690 | length = sum([len(x) for x in packed]) |
| 4691 | packed[2] = struct.pack("!H", length) |
| 4692 | return ''.join(packed) |
| 4693 | |
| 4694 | @staticmethod |
| 4695 | def unpack(reader): |
| 4696 | obj = bsn_gentable_stats_request() |
| 4697 | _version = reader.read("!B")[0] |
| 4698 | assert(_version == 4) |
| 4699 | _type = reader.read("!B")[0] |
| 4700 | assert(_type == 18) |
| 4701 | _length = reader.read("!H")[0] |
| 4702 | orig_reader = reader |
| 4703 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4704 | obj.xid = reader.read("!L")[0] |
| 4705 | _stats_type = reader.read("!H")[0] |
| 4706 | assert(_stats_type == 65535) |
| 4707 | obj.flags = reader.read("!H")[0] |
| 4708 | reader.skip(4) |
| 4709 | _experimenter = reader.read("!L")[0] |
| 4710 | assert(_experimenter == 6035143) |
| 4711 | _subtype = reader.read("!L")[0] |
| 4712 | assert(_subtype == 7) |
| 4713 | return obj |
| 4714 | |
| 4715 | def __eq__(self, other): |
| 4716 | if type(self) != type(other): return False |
| 4717 | if self.xid != other.xid: return False |
| 4718 | if self.flags != other.flags: return False |
| 4719 | return True |
| 4720 | |
| 4721 | def pretty_print(self, q): |
| 4722 | q.text("bsn_gentable_stats_request {") |
| 4723 | with q.group(): |
| 4724 | with q.indent(2): |
| 4725 | q.breakable() |
| 4726 | q.text("xid = "); |
| 4727 | if self.xid != None: |
| 4728 | q.text("%#x" % self.xid) |
| 4729 | else: |
| 4730 | q.text('None') |
| 4731 | q.text(","); q.breakable() |
| 4732 | q.text("flags = "); |
| 4733 | q.text("%#x" % self.flags) |
| 4734 | q.breakable() |
| 4735 | q.text('}') |
| 4736 | |
| 4737 | bsn_stats_request.subtypes[7] = bsn_gentable_stats_request |
| 4738 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4739 | class bsn_get_interfaces_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4740 | version = 4 |
| 4741 | type = 4 |
| 4742 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4743 | subtype = 10 |
| 4744 | |
| 4745 | def __init__(self, xid=None, interfaces=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4746 | if xid != None: |
| 4747 | self.xid = xid |
| 4748 | else: |
| 4749 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4750 | if interfaces != None: |
| 4751 | self.interfaces = interfaces |
| 4752 | else: |
| 4753 | self.interfaces = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4754 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4755 | |
| 4756 | def pack(self): |
| 4757 | packed = [] |
| 4758 | packed.append(struct.pack("!B", self.version)) |
| 4759 | packed.append(struct.pack("!B", self.type)) |
| 4760 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4761 | packed.append(struct.pack("!L", self.xid)) |
| 4762 | packed.append(struct.pack("!L", self.experimenter)) |
| 4763 | packed.append(struct.pack("!L", self.subtype)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4764 | packed.append(loxi.generic_util.pack_list(self.interfaces)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4765 | length = sum([len(x) for x in packed]) |
| 4766 | packed[2] = struct.pack("!H", length) |
| 4767 | return ''.join(packed) |
| 4768 | |
| 4769 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4770 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4771 | obj = bsn_get_interfaces_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4772 | _version = reader.read("!B")[0] |
| 4773 | assert(_version == 4) |
| 4774 | _type = reader.read("!B")[0] |
| 4775 | assert(_type == 4) |
| 4776 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4777 | orig_reader = reader |
| 4778 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4779 | obj.xid = reader.read("!L")[0] |
| 4780 | _experimenter = reader.read("!L")[0] |
| 4781 | assert(_experimenter == 6035143) |
| 4782 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4783 | assert(_subtype == 10) |
| 4784 | obj.interfaces = loxi.generic_util.unpack_list(reader, common.bsn_interface.unpack) |
| 4785 | return obj |
| 4786 | |
| 4787 | def __eq__(self, other): |
| 4788 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4789 | if self.xid != other.xid: return False |
| 4790 | if self.interfaces != other.interfaces: return False |
| 4791 | return True |
| 4792 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4793 | def pretty_print(self, q): |
| 4794 | q.text("bsn_get_interfaces_reply {") |
| 4795 | with q.group(): |
| 4796 | with q.indent(2): |
| 4797 | q.breakable() |
| 4798 | q.text("xid = "); |
| 4799 | if self.xid != None: |
| 4800 | q.text("%#x" % self.xid) |
| 4801 | else: |
| 4802 | q.text('None') |
| 4803 | q.text(","); q.breakable() |
| 4804 | q.text("interfaces = "); |
| 4805 | q.pp(self.interfaces) |
| 4806 | q.breakable() |
| 4807 | q.text('}') |
| 4808 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4809 | bsn_header.subtypes[10] = bsn_get_interfaces_reply |
| 4810 | |
| 4811 | class bsn_get_interfaces_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4812 | version = 4 |
| 4813 | type = 4 |
| 4814 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4815 | subtype = 9 |
| 4816 | |
| 4817 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4818 | if xid != None: |
| 4819 | self.xid = xid |
| 4820 | else: |
| 4821 | self.xid = None |
| 4822 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4823 | |
| 4824 | def pack(self): |
| 4825 | packed = [] |
| 4826 | packed.append(struct.pack("!B", self.version)) |
| 4827 | packed.append(struct.pack("!B", self.type)) |
| 4828 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4829 | packed.append(struct.pack("!L", self.xid)) |
| 4830 | packed.append(struct.pack("!L", self.experimenter)) |
| 4831 | packed.append(struct.pack("!L", self.subtype)) |
| 4832 | length = sum([len(x) for x in packed]) |
| 4833 | packed[2] = struct.pack("!H", length) |
| 4834 | return ''.join(packed) |
| 4835 | |
| 4836 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4837 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4838 | obj = bsn_get_interfaces_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4839 | _version = reader.read("!B")[0] |
| 4840 | assert(_version == 4) |
| 4841 | _type = reader.read("!B")[0] |
| 4842 | assert(_type == 4) |
| 4843 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4844 | orig_reader = reader |
| 4845 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4846 | obj.xid = reader.read("!L")[0] |
| 4847 | _experimenter = reader.read("!L")[0] |
| 4848 | assert(_experimenter == 6035143) |
| 4849 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4850 | assert(_subtype == 9) |
| 4851 | return obj |
| 4852 | |
| 4853 | def __eq__(self, other): |
| 4854 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4855 | if self.xid != other.xid: return False |
| 4856 | return True |
| 4857 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4858 | def pretty_print(self, q): |
| 4859 | q.text("bsn_get_interfaces_request {") |
| 4860 | with q.group(): |
| 4861 | with q.indent(2): |
| 4862 | q.breakable() |
| 4863 | q.text("xid = "); |
| 4864 | if self.xid != None: |
| 4865 | q.text("%#x" % self.xid) |
| 4866 | else: |
| 4867 | q.text('None') |
| 4868 | q.breakable() |
| 4869 | q.text('}') |
| 4870 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4871 | bsn_header.subtypes[9] = bsn_get_interfaces_request |
| 4872 | |
| 4873 | class bsn_get_mirroring_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4874 | version = 4 |
| 4875 | type = 4 |
| 4876 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4877 | subtype = 5 |
| 4878 | |
| 4879 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4880 | if xid != None: |
| 4881 | self.xid = xid |
| 4882 | else: |
| 4883 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4884 | if report_mirror_ports != None: |
| 4885 | self.report_mirror_ports = report_mirror_ports |
| 4886 | else: |
| 4887 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4888 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4889 | |
| 4890 | def pack(self): |
| 4891 | packed = [] |
| 4892 | packed.append(struct.pack("!B", self.version)) |
| 4893 | packed.append(struct.pack("!B", self.type)) |
| 4894 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4895 | packed.append(struct.pack("!L", self.xid)) |
| 4896 | packed.append(struct.pack("!L", self.experimenter)) |
| 4897 | packed.append(struct.pack("!L", self.subtype)) |
| 4898 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 4899 | packed.append('\x00' * 3) |
| 4900 | length = sum([len(x) for x in packed]) |
| 4901 | packed[2] = struct.pack("!H", length) |
| 4902 | return ''.join(packed) |
| 4903 | |
| 4904 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4905 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4906 | obj = bsn_get_mirroring_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4907 | _version = reader.read("!B")[0] |
| 4908 | assert(_version == 4) |
| 4909 | _type = reader.read("!B")[0] |
| 4910 | assert(_type == 4) |
| 4911 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4912 | orig_reader = reader |
| 4913 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4914 | obj.xid = reader.read("!L")[0] |
| 4915 | _experimenter = reader.read("!L")[0] |
| 4916 | assert(_experimenter == 6035143) |
| 4917 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4918 | assert(_subtype == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4919 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4920 | reader.skip(3) |
| 4921 | return obj |
| 4922 | |
| 4923 | def __eq__(self, other): |
| 4924 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4925 | if self.xid != other.xid: return False |
| 4926 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 4927 | return True |
| 4928 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4929 | def pretty_print(self, q): |
| 4930 | q.text("bsn_get_mirroring_reply {") |
| 4931 | with q.group(): |
| 4932 | with q.indent(2): |
| 4933 | q.breakable() |
| 4934 | q.text("xid = "); |
| 4935 | if self.xid != None: |
| 4936 | q.text("%#x" % self.xid) |
| 4937 | else: |
| 4938 | q.text('None') |
| 4939 | q.text(","); q.breakable() |
| 4940 | q.text("report_mirror_ports = "); |
| 4941 | q.text("%#x" % self.report_mirror_ports) |
| 4942 | q.breakable() |
| 4943 | q.text('}') |
| 4944 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4945 | bsn_header.subtypes[5] = bsn_get_mirroring_reply |
| 4946 | |
| 4947 | class bsn_get_mirroring_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4948 | version = 4 |
| 4949 | type = 4 |
| 4950 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4951 | subtype = 4 |
| 4952 | |
| 4953 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4954 | if xid != None: |
| 4955 | self.xid = xid |
| 4956 | else: |
| 4957 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4958 | if report_mirror_ports != None: |
| 4959 | self.report_mirror_ports = report_mirror_ports |
| 4960 | else: |
| 4961 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4962 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4963 | |
| 4964 | def pack(self): |
| 4965 | packed = [] |
| 4966 | packed.append(struct.pack("!B", self.version)) |
| 4967 | packed.append(struct.pack("!B", self.type)) |
| 4968 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4969 | packed.append(struct.pack("!L", self.xid)) |
| 4970 | packed.append(struct.pack("!L", self.experimenter)) |
| 4971 | packed.append(struct.pack("!L", self.subtype)) |
| 4972 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 4973 | packed.append('\x00' * 3) |
| 4974 | length = sum([len(x) for x in packed]) |
| 4975 | packed[2] = struct.pack("!H", length) |
| 4976 | return ''.join(packed) |
| 4977 | |
| 4978 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4979 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4980 | obj = bsn_get_mirroring_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4981 | _version = reader.read("!B")[0] |
| 4982 | assert(_version == 4) |
| 4983 | _type = reader.read("!B")[0] |
| 4984 | assert(_type == 4) |
| 4985 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4986 | orig_reader = reader |
| 4987 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4988 | obj.xid = reader.read("!L")[0] |
| 4989 | _experimenter = reader.read("!L")[0] |
| 4990 | assert(_experimenter == 6035143) |
| 4991 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4992 | assert(_subtype == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4993 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4994 | reader.skip(3) |
| 4995 | return obj |
| 4996 | |
| 4997 | def __eq__(self, other): |
| 4998 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4999 | if self.xid != other.xid: return False |
| 5000 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 5001 | return True |
| 5002 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5003 | def pretty_print(self, q): |
| 5004 | q.text("bsn_get_mirroring_request {") |
| 5005 | with q.group(): |
| 5006 | with q.indent(2): |
| 5007 | q.breakable() |
| 5008 | q.text("xid = "); |
| 5009 | if self.xid != None: |
| 5010 | q.text("%#x" % self.xid) |
| 5011 | else: |
| 5012 | q.text('None') |
| 5013 | q.text(","); q.breakable() |
| 5014 | q.text("report_mirror_ports = "); |
| 5015 | q.text("%#x" % self.report_mirror_ports) |
| 5016 | q.breakable() |
| 5017 | q.text('}') |
| 5018 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5019 | bsn_header.subtypes[4] = bsn_get_mirroring_request |
| 5020 | |
| 5021 | class bsn_get_switch_pipeline_reply(bsn_header): |
| 5022 | version = 4 |
| 5023 | type = 4 |
| 5024 | experimenter = 6035143 |
| 5025 | subtype = 52 |
| 5026 | |
| 5027 | def __init__(self, xid=None, pipeline=None): |
| 5028 | if xid != None: |
| 5029 | self.xid = xid |
| 5030 | else: |
| 5031 | self.xid = None |
| 5032 | if pipeline != None: |
| 5033 | self.pipeline = pipeline |
| 5034 | else: |
| 5035 | self.pipeline = "" |
| 5036 | return |
| 5037 | |
| 5038 | def pack(self): |
| 5039 | packed = [] |
| 5040 | packed.append(struct.pack("!B", self.version)) |
| 5041 | packed.append(struct.pack("!B", self.type)) |
| 5042 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5043 | packed.append(struct.pack("!L", self.xid)) |
| 5044 | packed.append(struct.pack("!L", self.experimenter)) |
| 5045 | packed.append(struct.pack("!L", self.subtype)) |
| 5046 | packed.append(struct.pack("!256s", self.pipeline)) |
| 5047 | length = sum([len(x) for x in packed]) |
| 5048 | packed[2] = struct.pack("!H", length) |
| 5049 | return ''.join(packed) |
| 5050 | |
| 5051 | @staticmethod |
| 5052 | def unpack(reader): |
| 5053 | obj = bsn_get_switch_pipeline_reply() |
| 5054 | _version = reader.read("!B")[0] |
| 5055 | assert(_version == 4) |
| 5056 | _type = reader.read("!B")[0] |
| 5057 | assert(_type == 4) |
| 5058 | _length = reader.read("!H")[0] |
| 5059 | orig_reader = reader |
| 5060 | reader = orig_reader.slice(_length - (2 + 2)) |
| 5061 | obj.xid = reader.read("!L")[0] |
| 5062 | _experimenter = reader.read("!L")[0] |
| 5063 | assert(_experimenter == 6035143) |
| 5064 | _subtype = reader.read("!L")[0] |
| 5065 | assert(_subtype == 52) |
| 5066 | obj.pipeline = reader.read("!256s")[0].rstrip("\x00") |
| 5067 | return obj |
| 5068 | |
| 5069 | def __eq__(self, other): |
| 5070 | if type(self) != type(other): return False |
| 5071 | if self.xid != other.xid: return False |
| 5072 | if self.pipeline != other.pipeline: return False |
| 5073 | return True |
| 5074 | |
| 5075 | def pretty_print(self, q): |
| 5076 | q.text("bsn_get_switch_pipeline_reply {") |
| 5077 | with q.group(): |
| 5078 | with q.indent(2): |
| 5079 | q.breakable() |
| 5080 | q.text("xid = "); |
| 5081 | if self.xid != None: |
| 5082 | q.text("%#x" % self.xid) |
| 5083 | else: |
| 5084 | q.text('None') |
| 5085 | q.text(","); q.breakable() |
| 5086 | q.text("pipeline = "); |
| 5087 | q.pp(self.pipeline) |
| 5088 | q.breakable() |
| 5089 | q.text('}') |
| 5090 | |
| 5091 | bsn_header.subtypes[52] = bsn_get_switch_pipeline_reply |
| 5092 | |
| 5093 | class bsn_get_switch_pipeline_request(bsn_header): |
| 5094 | version = 4 |
| 5095 | type = 4 |
| 5096 | experimenter = 6035143 |
| 5097 | subtype = 51 |
| 5098 | |
| 5099 | def __init__(self, xid=None): |
| 5100 | if xid != None: |
| 5101 | self.xid = xid |
| 5102 | else: |
| 5103 | self.xid = None |
| 5104 | return |
| 5105 | |
| 5106 | def pack(self): |
| 5107 | packed = [] |
| 5108 | packed.append(struct.pack("!B", self.version)) |
| 5109 | packed.append(struct.pack("!B", self.type)) |
| 5110 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5111 | packed.append(struct.pack("!L", self.xid)) |
| 5112 | packed.append(struct.pack("!L", self.experimenter)) |
| 5113 | packed.append(struct.pack("!L", self.subtype)) |
| 5114 | length = sum([len(x) for x in packed]) |
| 5115 | packed[2] = struct.pack("!H", length) |
| 5116 | return ''.join(packed) |
| 5117 | |
| 5118 | @staticmethod |
| 5119 | def unpack(reader): |
| 5120 | obj = bsn_get_switch_pipeline_request() |
| 5121 | _version = reader.read("!B")[0] |
| 5122 | assert(_version == 4) |
| 5123 | _type = reader.read("!B")[0] |
| 5124 | assert(_type == 4) |
| 5125 | _length = reader.read("!H")[0] |
| 5126 | orig_reader = reader |
| 5127 | reader = orig_reader.slice(_length - (2 + 2)) |
| 5128 | obj.xid = reader.read("!L")[0] |
| 5129 | _experimenter = reader.read("!L")[0] |
| 5130 | assert(_experimenter == 6035143) |
| 5131 | _subtype = reader.read("!L")[0] |
| 5132 | assert(_subtype == 51) |
| 5133 | return obj |
| 5134 | |
| 5135 | def __eq__(self, other): |
| 5136 | if type(self) != type(other): return False |
| 5137 | if self.xid != other.xid: return False |
| 5138 | return True |
| 5139 | |
| 5140 | def pretty_print(self, q): |
| 5141 | q.text("bsn_get_switch_pipeline_request {") |
| 5142 | with q.group(): |
| 5143 | with q.indent(2): |
| 5144 | q.breakable() |
| 5145 | q.text("xid = "); |
| 5146 | if self.xid != None: |
| 5147 | q.text("%#x" % self.xid) |
| 5148 | else: |
| 5149 | q.text('None') |
| 5150 | q.breakable() |
| 5151 | q.text('}') |
| 5152 | |
| 5153 | bsn_header.subtypes[51] = bsn_get_switch_pipeline_request |
| 5154 | |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 5155 | class bsn_image_desc_stats_reply(bsn_stats_reply): |
| 5156 | version = 4 |
| 5157 | type = 19 |
| 5158 | stats_type = 65535 |
| 5159 | experimenter = 6035143 |
| 5160 | subtype = 14 |
| 5161 | |
| 5162 | def __init__(self, xid=None, flags=None, image_checksum=None, startup_config_checksum=None): |
| 5163 | if xid != None: |
| 5164 | self.xid = xid |
| 5165 | else: |
| 5166 | self.xid = None |
| 5167 | if flags != None: |
| 5168 | self.flags = flags |
| 5169 | else: |
| 5170 | self.flags = 0 |
| 5171 | if image_checksum != None: |
| 5172 | self.image_checksum = image_checksum |
| 5173 | else: |
| 5174 | self.image_checksum = "" |
| 5175 | if startup_config_checksum != None: |
| 5176 | self.startup_config_checksum = startup_config_checksum |
| 5177 | else: |
| 5178 | self.startup_config_checksum = "" |
| 5179 | return |
| 5180 | |
| 5181 | def pack(self): |
| 5182 | packed = [] |
| 5183 | packed.append(struct.pack("!B", self.version)) |
| 5184 | packed.append(struct.pack("!B", self.type)) |
| 5185 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5186 | packed.append(struct.pack("!L", self.xid)) |
| 5187 | packed.append(struct.pack("!H", self.stats_type)) |
| 5188 | packed.append(struct.pack("!H", self.flags)) |
| 5189 | packed.append('\x00' * 4) |
| 5190 | packed.append(struct.pack("!L", self.experimenter)) |
| 5191 | packed.append(struct.pack("!L", self.subtype)) |
| 5192 | packed.append(struct.pack("!256s", self.image_checksum)) |
| 5193 | packed.append(struct.pack("!256s", self.startup_config_checksum)) |
| 5194 | length = sum([len(x) for x in packed]) |
| 5195 | packed[2] = struct.pack("!H", length) |
| 5196 | return ''.join(packed) |
| 5197 | |
| 5198 | @staticmethod |
| 5199 | def unpack(reader): |
| 5200 | obj = bsn_image_desc_stats_reply() |
| 5201 | _version = reader.read("!B")[0] |
| 5202 | assert(_version == 4) |
| 5203 | _type = reader.read("!B")[0] |
| 5204 | assert(_type == 19) |
| 5205 | _length = reader.read("!H")[0] |
| 5206 | orig_reader = reader |
| 5207 | reader = orig_reader.slice(_length - (2 + 2)) |
| 5208 | obj.xid = reader.read("!L")[0] |
| 5209 | _stats_type = reader.read("!H")[0] |
| 5210 | assert(_stats_type == 65535) |
| 5211 | obj.flags = reader.read("!H")[0] |
| 5212 | reader.skip(4) |
| 5213 | _experimenter = reader.read("!L")[0] |
| 5214 | assert(_experimenter == 6035143) |
| 5215 | _subtype = reader.read("!L")[0] |
| 5216 | assert(_subtype == 14) |
| 5217 | obj.image_checksum = reader.read("!256s")[0].rstrip("\x00") |
| 5218 | obj.startup_config_checksum = reader.read("!256s")[0].rstrip("\x00") |
| 5219 | return obj |
| 5220 | |
| 5221 | def __eq__(self, other): |
| 5222 | if type(self) != type(other): return False |
| 5223 | if self.xid != other.xid: return False |
| 5224 | if self.flags != other.flags: return False |
| 5225 | if self.image_checksum != other.image_checksum: return False |
| 5226 | if self.startup_config_checksum != other.startup_config_checksum: return False |
| 5227 | return True |
| 5228 | |
| 5229 | def pretty_print(self, q): |
| 5230 | q.text("bsn_image_desc_stats_reply {") |
| 5231 | with q.group(): |
| 5232 | with q.indent(2): |
| 5233 | q.breakable() |
| 5234 | q.text("xid = "); |
| 5235 | if self.xid != None: |
| 5236 | q.text("%#x" % self.xid) |
| 5237 | else: |
| 5238 | q.text('None') |
| 5239 | q.text(","); q.breakable() |
| 5240 | q.text("flags = "); |
| 5241 | q.text("%#x" % self.flags) |
| 5242 | q.text(","); q.breakable() |
| 5243 | q.text("image_checksum = "); |
| 5244 | q.pp(self.image_checksum) |
| 5245 | q.text(","); q.breakable() |
| 5246 | q.text("startup_config_checksum = "); |
| 5247 | q.pp(self.startup_config_checksum) |
| 5248 | q.breakable() |
| 5249 | q.text('}') |
| 5250 | |
| 5251 | bsn_stats_reply.subtypes[14] = bsn_image_desc_stats_reply |
| 5252 | |
| 5253 | class bsn_image_desc_stats_request(bsn_stats_request): |
| 5254 | version = 4 |
| 5255 | type = 18 |
| 5256 | stats_type = 65535 |
| 5257 | experimenter = 6035143 |
| 5258 | subtype = 14 |
| 5259 | |
| 5260 | def __init__(self, xid=None, flags=None): |
| 5261 | if xid != None: |
| 5262 | self.xid = xid |
| 5263 | else: |
| 5264 | self.xid = None |
| 5265 | if flags != None: |
| 5266 | self.flags = flags |
| 5267 | else: |
| 5268 | self.flags = 0 |
| 5269 | return |
| 5270 | |
| 5271 | def pack(self): |
| 5272 | packed = [] |
| 5273 | packed.append(struct.pack("!B", self.version)) |
| 5274 | packed.append(struct.pack("!B", self.type)) |
| 5275 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5276 | packed.append(struct.pack("!L", self.xid)) |
| 5277 | packed.append(struct.pack("!H", self.stats_type)) |
| 5278 | packed.append(struct.pack("!H", self.flags)) |
| 5279 | packed.append('\x00' * 4) |
| 5280 | packed.append(struct.pack("!L", self.experimenter)) |
| 5281 | packed.append(struct.pack("!L", self.subtype)) |
| 5282 | length = sum([len(x) for x in packed]) |
| 5283 | packed[2] = struct.pack("!H", length) |
| 5284 | return ''.join(packed) |
| 5285 | |
| 5286 | @staticmethod |
| 5287 | def unpack(reader): |
| 5288 | obj = bsn_image_desc_stats_request() |
| 5289 | _version = reader.read("!B")[0] |
| 5290 | assert(_version == 4) |
| 5291 | _type = reader.read("!B")[0] |
| 5292 | assert(_type == 18) |
| 5293 | _length = reader.read("!H")[0] |
| 5294 | orig_reader = reader |
| 5295 | reader = orig_reader.slice(_length - (2 + 2)) |
| 5296 | obj.xid = reader.read("!L")[0] |
| 5297 | _stats_type = reader.read("!H")[0] |
| 5298 | assert(_stats_type == 65535) |
| 5299 | obj.flags = reader.read("!H")[0] |
| 5300 | reader.skip(4) |
| 5301 | _experimenter = reader.read("!L")[0] |
| 5302 | assert(_experimenter == 6035143) |
| 5303 | _subtype = reader.read("!L")[0] |
| 5304 | assert(_subtype == 14) |
| 5305 | return obj |
| 5306 | |
| 5307 | def __eq__(self, other): |
| 5308 | if type(self) != type(other): return False |
| 5309 | if self.xid != other.xid: return False |
| 5310 | if self.flags != other.flags: return False |
| 5311 | return True |
| 5312 | |
| 5313 | def pretty_print(self, q): |
| 5314 | q.text("bsn_image_desc_stats_request {") |
| 5315 | with q.group(): |
| 5316 | with q.indent(2): |
| 5317 | q.breakable() |
| 5318 | q.text("xid = "); |
| 5319 | if self.xid != None: |
| 5320 | q.text("%#x" % self.xid) |
| 5321 | else: |
| 5322 | q.text('None') |
| 5323 | q.text(","); q.breakable() |
| 5324 | q.text("flags = "); |
| 5325 | q.text("%#x" % self.flags) |
| 5326 | q.breakable() |
| 5327 | q.text('}') |
| 5328 | |
| 5329 | bsn_stats_request.subtypes[14] = bsn_image_desc_stats_request |
| 5330 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5331 | class bsn_lacp_convergence_notif(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5332 | version = 4 |
| 5333 | type = 4 |
| 5334 | experimenter = 6035143 |
| 5335 | subtype = 43 |
| 5336 | |
| 5337 | 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] | 5338 | if xid != None: |
| 5339 | self.xid = xid |
| 5340 | else: |
| 5341 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5342 | if convergence_status != None: |
| 5343 | self.convergence_status = convergence_status |
| 5344 | else: |
| 5345 | self.convergence_status = 0 |
| 5346 | if port_no != None: |
| 5347 | self.port_no = port_no |
| 5348 | else: |
| 5349 | self.port_no = 0 |
| 5350 | if actor_sys_priority != None: |
| 5351 | self.actor_sys_priority = actor_sys_priority |
| 5352 | else: |
| 5353 | self.actor_sys_priority = 0 |
| 5354 | if actor_sys_mac != None: |
| 5355 | self.actor_sys_mac = actor_sys_mac |
| 5356 | else: |
| 5357 | self.actor_sys_mac = [0,0,0,0,0,0] |
| 5358 | if actor_port_priority != None: |
| 5359 | self.actor_port_priority = actor_port_priority |
| 5360 | else: |
| 5361 | self.actor_port_priority = 0 |
| 5362 | if actor_port_num != None: |
| 5363 | self.actor_port_num = actor_port_num |
| 5364 | else: |
| 5365 | self.actor_port_num = 0 |
| 5366 | if actor_key != None: |
| 5367 | self.actor_key = actor_key |
| 5368 | else: |
| 5369 | self.actor_key = 0 |
| 5370 | if partner_sys_priority != None: |
| 5371 | self.partner_sys_priority = partner_sys_priority |
| 5372 | else: |
| 5373 | self.partner_sys_priority = 0 |
| 5374 | if partner_sys_mac != None: |
| 5375 | self.partner_sys_mac = partner_sys_mac |
| 5376 | else: |
| 5377 | self.partner_sys_mac = [0,0,0,0,0,0] |
| 5378 | if partner_port_priority != None: |
| 5379 | self.partner_port_priority = partner_port_priority |
| 5380 | else: |
| 5381 | self.partner_port_priority = 0 |
| 5382 | if partner_port_num != None: |
| 5383 | self.partner_port_num = partner_port_num |
| 5384 | else: |
| 5385 | self.partner_port_num = 0 |
| 5386 | if partner_key != None: |
| 5387 | self.partner_key = partner_key |
| 5388 | else: |
| 5389 | self.partner_key = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5390 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5391 | |
| 5392 | def pack(self): |
| 5393 | packed = [] |
| 5394 | packed.append(struct.pack("!B", self.version)) |
| 5395 | packed.append(struct.pack("!B", self.type)) |
| 5396 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5397 | packed.append(struct.pack("!L", self.xid)) |
| 5398 | packed.append(struct.pack("!L", self.experimenter)) |
| 5399 | packed.append(struct.pack("!L", self.subtype)) |
| 5400 | packed.append(struct.pack("!B", self.convergence_status)) |
| 5401 | packed.append('\x00' * 3) |
| 5402 | packed.append(util.pack_port_no(self.port_no)) |
| 5403 | packed.append(struct.pack("!H", self.actor_sys_priority)) |
| 5404 | packed.append(struct.pack("!6B", *self.actor_sys_mac)) |
| 5405 | packed.append(struct.pack("!H", self.actor_port_priority)) |
| 5406 | packed.append(struct.pack("!H", self.actor_port_num)) |
| 5407 | packed.append(struct.pack("!H", self.actor_key)) |
| 5408 | packed.append(struct.pack("!H", self.partner_sys_priority)) |
| 5409 | packed.append(struct.pack("!6B", *self.partner_sys_mac)) |
| 5410 | packed.append(struct.pack("!H", self.partner_port_priority)) |
| 5411 | packed.append(struct.pack("!H", self.partner_port_num)) |
| 5412 | packed.append(struct.pack("!H", self.partner_key)) |
| 5413 | length = sum([len(x) for x in packed]) |
| 5414 | packed[2] = struct.pack("!H", length) |
| 5415 | return ''.join(packed) |
| 5416 | |
| 5417 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5418 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5419 | obj = bsn_lacp_convergence_notif() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5420 | _version = reader.read("!B")[0] |
| 5421 | assert(_version == 4) |
| 5422 | _type = reader.read("!B")[0] |
| 5423 | assert(_type == 4) |
| 5424 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5425 | orig_reader = reader |
| 5426 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5427 | obj.xid = reader.read("!L")[0] |
| 5428 | _experimenter = reader.read("!L")[0] |
| 5429 | assert(_experimenter == 6035143) |
| 5430 | _subtype = reader.read("!L")[0] |
| 5431 | assert(_subtype == 43) |
| 5432 | obj.convergence_status = reader.read("!B")[0] |
| 5433 | reader.skip(3) |
| 5434 | obj.port_no = util.unpack_port_no(reader) |
| 5435 | obj.actor_sys_priority = reader.read("!H")[0] |
| 5436 | obj.actor_sys_mac = list(reader.read('!6B')) |
| 5437 | obj.actor_port_priority = reader.read("!H")[0] |
| 5438 | obj.actor_port_num = reader.read("!H")[0] |
| 5439 | obj.actor_key = reader.read("!H")[0] |
| 5440 | obj.partner_sys_priority = reader.read("!H")[0] |
| 5441 | obj.partner_sys_mac = list(reader.read('!6B')) |
| 5442 | obj.partner_port_priority = reader.read("!H")[0] |
| 5443 | obj.partner_port_num = reader.read("!H")[0] |
| 5444 | obj.partner_key = reader.read("!H")[0] |
| 5445 | return obj |
| 5446 | |
| 5447 | def __eq__(self, other): |
| 5448 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5449 | if self.xid != other.xid: return False |
| 5450 | if self.convergence_status != other.convergence_status: return False |
| 5451 | if self.port_no != other.port_no: return False |
| 5452 | if self.actor_sys_priority != other.actor_sys_priority: return False |
| 5453 | if self.actor_sys_mac != other.actor_sys_mac: return False |
| 5454 | if self.actor_port_priority != other.actor_port_priority: return False |
| 5455 | if self.actor_port_num != other.actor_port_num: return False |
| 5456 | if self.actor_key != other.actor_key: return False |
| 5457 | if self.partner_sys_priority != other.partner_sys_priority: return False |
| 5458 | if self.partner_sys_mac != other.partner_sys_mac: return False |
| 5459 | if self.partner_port_priority != other.partner_port_priority: return False |
| 5460 | if self.partner_port_num != other.partner_port_num: return False |
| 5461 | if self.partner_key != other.partner_key: return False |
| 5462 | return True |
| 5463 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5464 | def pretty_print(self, q): |
| 5465 | q.text("bsn_lacp_convergence_notif {") |
| 5466 | with q.group(): |
| 5467 | with q.indent(2): |
| 5468 | q.breakable() |
| 5469 | q.text("xid = "); |
| 5470 | if self.xid != None: |
| 5471 | q.text("%#x" % self.xid) |
| 5472 | else: |
| 5473 | q.text('None') |
| 5474 | q.text(","); q.breakable() |
| 5475 | q.text("convergence_status = "); |
| 5476 | q.text("%#x" % self.convergence_status) |
| 5477 | q.text(","); q.breakable() |
| 5478 | q.text("port_no = "); |
| 5479 | q.text(util.pretty_port(self.port_no)) |
| 5480 | q.text(","); q.breakable() |
| 5481 | q.text("actor_sys_priority = "); |
| 5482 | q.text("%#x" % self.actor_sys_priority) |
| 5483 | q.text(","); q.breakable() |
| 5484 | q.text("actor_sys_mac = "); |
| 5485 | q.text(util.pretty_mac(self.actor_sys_mac)) |
| 5486 | q.text(","); q.breakable() |
| 5487 | q.text("actor_port_priority = "); |
| 5488 | q.text("%#x" % self.actor_port_priority) |
| 5489 | q.text(","); q.breakable() |
| 5490 | q.text("actor_port_num = "); |
| 5491 | q.text("%#x" % self.actor_port_num) |
| 5492 | q.text(","); q.breakable() |
| 5493 | q.text("actor_key = "); |
| 5494 | q.text("%#x" % self.actor_key) |
| 5495 | q.text(","); q.breakable() |
| 5496 | q.text("partner_sys_priority = "); |
| 5497 | q.text("%#x" % self.partner_sys_priority) |
| 5498 | q.text(","); q.breakable() |
| 5499 | q.text("partner_sys_mac = "); |
| 5500 | q.text(util.pretty_mac(self.partner_sys_mac)) |
| 5501 | q.text(","); q.breakable() |
| 5502 | q.text("partner_port_priority = "); |
| 5503 | q.text("%#x" % self.partner_port_priority) |
| 5504 | q.text(","); q.breakable() |
| 5505 | q.text("partner_port_num = "); |
| 5506 | q.text("%#x" % self.partner_port_num) |
| 5507 | q.text(","); q.breakable() |
| 5508 | q.text("partner_key = "); |
| 5509 | q.text("%#x" % self.partner_key) |
| 5510 | q.breakable() |
| 5511 | q.text('}') |
| 5512 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5513 | bsn_header.subtypes[43] = bsn_lacp_convergence_notif |
| 5514 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5515 | class bsn_lacp_stats_reply(bsn_stats_reply): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5516 | version = 4 |
| 5517 | type = 19 |
| 5518 | stats_type = 65535 |
| 5519 | experimenter = 6035143 |
| 5520 | subtype = 1 |
| 5521 | |
| 5522 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5523 | if xid != None: |
| 5524 | self.xid = xid |
| 5525 | else: |
| 5526 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5527 | if flags != None: |
| 5528 | self.flags = flags |
| 5529 | else: |
| 5530 | self.flags = 0 |
| 5531 | if entries != None: |
| 5532 | self.entries = entries |
| 5533 | else: |
| 5534 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5535 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5536 | |
| 5537 | def pack(self): |
| 5538 | packed = [] |
| 5539 | packed.append(struct.pack("!B", self.version)) |
| 5540 | packed.append(struct.pack("!B", self.type)) |
| 5541 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5542 | packed.append(struct.pack("!L", self.xid)) |
| 5543 | packed.append(struct.pack("!H", self.stats_type)) |
| 5544 | packed.append(struct.pack("!H", self.flags)) |
| 5545 | packed.append('\x00' * 4) |
| 5546 | packed.append(struct.pack("!L", self.experimenter)) |
| 5547 | packed.append(struct.pack("!L", self.subtype)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5548 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5549 | length = sum([len(x) for x in packed]) |
| 5550 | packed[2] = struct.pack("!H", length) |
| 5551 | return ''.join(packed) |
| 5552 | |
| 5553 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5554 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5555 | obj = bsn_lacp_stats_reply() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5556 | _version = reader.read("!B")[0] |
| 5557 | assert(_version == 4) |
| 5558 | _type = reader.read("!B")[0] |
| 5559 | assert(_type == 19) |
| 5560 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5561 | orig_reader = reader |
| 5562 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5563 | obj.xid = reader.read("!L")[0] |
| 5564 | _stats_type = reader.read("!H")[0] |
| 5565 | assert(_stats_type == 65535) |
| 5566 | obj.flags = reader.read("!H")[0] |
| 5567 | reader.skip(4) |
| 5568 | _experimenter = reader.read("!L")[0] |
| 5569 | assert(_experimenter == 6035143) |
| 5570 | _subtype = reader.read("!L")[0] |
| 5571 | assert(_subtype == 1) |
| 5572 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_lacp_stats_entry.unpack) |
| 5573 | return obj |
| 5574 | |
| 5575 | def __eq__(self, other): |
| 5576 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5577 | if self.xid != other.xid: return False |
| 5578 | if self.flags != other.flags: return False |
| 5579 | if self.entries != other.entries: return False |
| 5580 | return True |
| 5581 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5582 | def pretty_print(self, q): |
| 5583 | q.text("bsn_lacp_stats_reply {") |
| 5584 | with q.group(): |
| 5585 | with q.indent(2): |
| 5586 | q.breakable() |
| 5587 | q.text("xid = "); |
| 5588 | if self.xid != None: |
| 5589 | q.text("%#x" % self.xid) |
| 5590 | else: |
| 5591 | q.text('None') |
| 5592 | q.text(","); q.breakable() |
| 5593 | q.text("flags = "); |
| 5594 | q.text("%#x" % self.flags) |
| 5595 | q.text(","); q.breakable() |
| 5596 | q.text("entries = "); |
| 5597 | q.pp(self.entries) |
| 5598 | q.breakable() |
| 5599 | q.text('}') |
| 5600 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5601 | bsn_stats_reply.subtypes[1] = bsn_lacp_stats_reply |
| 5602 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5603 | class bsn_lacp_stats_request(bsn_stats_request): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5604 | version = 4 |
| 5605 | type = 18 |
| 5606 | stats_type = 65535 |
| 5607 | experimenter = 6035143 |
| 5608 | subtype = 1 |
| 5609 | |
| 5610 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5611 | if xid != None: |
| 5612 | self.xid = xid |
| 5613 | else: |
| 5614 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5615 | if flags != None: |
| 5616 | self.flags = flags |
| 5617 | else: |
| 5618 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5619 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5620 | |
| 5621 | def pack(self): |
| 5622 | packed = [] |
| 5623 | packed.append(struct.pack("!B", self.version)) |
| 5624 | packed.append(struct.pack("!B", self.type)) |
| 5625 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5626 | packed.append(struct.pack("!L", self.xid)) |
| 5627 | packed.append(struct.pack("!H", self.stats_type)) |
| 5628 | packed.append(struct.pack("!H", self.flags)) |
| 5629 | packed.append('\x00' * 4) |
| 5630 | packed.append(struct.pack("!L", self.experimenter)) |
| 5631 | packed.append(struct.pack("!L", self.subtype)) |
| 5632 | length = sum([len(x) for x in packed]) |
| 5633 | packed[2] = struct.pack("!H", length) |
| 5634 | return ''.join(packed) |
| 5635 | |
| 5636 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5637 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5638 | obj = bsn_lacp_stats_request() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5639 | _version = reader.read("!B")[0] |
| 5640 | assert(_version == 4) |
| 5641 | _type = reader.read("!B")[0] |
| 5642 | assert(_type == 18) |
| 5643 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5644 | orig_reader = reader |
| 5645 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5646 | obj.xid = reader.read("!L")[0] |
| 5647 | _stats_type = reader.read("!H")[0] |
| 5648 | assert(_stats_type == 65535) |
| 5649 | obj.flags = reader.read("!H")[0] |
| 5650 | reader.skip(4) |
| 5651 | _experimenter = reader.read("!L")[0] |
| 5652 | assert(_experimenter == 6035143) |
| 5653 | _subtype = reader.read("!L")[0] |
| 5654 | assert(_subtype == 1) |
| 5655 | return obj |
| 5656 | |
| 5657 | def __eq__(self, other): |
| 5658 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5659 | if self.xid != other.xid: return False |
| 5660 | if self.flags != other.flags: return False |
| 5661 | return True |
| 5662 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5663 | def pretty_print(self, q): |
| 5664 | q.text("bsn_lacp_stats_request {") |
| 5665 | with q.group(): |
| 5666 | with q.indent(2): |
| 5667 | q.breakable() |
| 5668 | q.text("xid = "); |
| 5669 | if self.xid != None: |
| 5670 | q.text("%#x" % self.xid) |
| 5671 | else: |
| 5672 | q.text('None') |
| 5673 | q.text(","); q.breakable() |
| 5674 | q.text("flags = "); |
| 5675 | q.text("%#x" % self.flags) |
| 5676 | q.breakable() |
| 5677 | q.text('}') |
| 5678 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5679 | bsn_stats_request.subtypes[1] = bsn_lacp_stats_request |
| 5680 | |
| 5681 | class bsn_pdu_rx_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5682 | version = 4 |
| 5683 | type = 4 |
| 5684 | experimenter = 6035143 |
| 5685 | subtype = 34 |
| 5686 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5687 | 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] | 5688 | if xid != None: |
| 5689 | self.xid = xid |
| 5690 | else: |
| 5691 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5692 | if status != None: |
| 5693 | self.status = status |
| 5694 | else: |
| 5695 | self.status = 0 |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5696 | if port_no != None: |
| 5697 | self.port_no = port_no |
| 5698 | else: |
| 5699 | self.port_no = 0 |
| 5700 | if slot_num != None: |
| 5701 | self.slot_num = slot_num |
| 5702 | else: |
| 5703 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5704 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5705 | |
| 5706 | def pack(self): |
| 5707 | packed = [] |
| 5708 | packed.append(struct.pack("!B", self.version)) |
| 5709 | packed.append(struct.pack("!B", self.type)) |
| 5710 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5711 | packed.append(struct.pack("!L", self.xid)) |
| 5712 | packed.append(struct.pack("!L", self.experimenter)) |
| 5713 | packed.append(struct.pack("!L", self.subtype)) |
| 5714 | packed.append(struct.pack("!L", self.status)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5715 | packed.append(util.pack_port_no(self.port_no)) |
| 5716 | packed.append(struct.pack("!B", self.slot_num)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5717 | length = sum([len(x) for x in packed]) |
| 5718 | packed[2] = struct.pack("!H", length) |
| 5719 | return ''.join(packed) |
| 5720 | |
| 5721 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5722 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5723 | obj = bsn_pdu_rx_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5724 | _version = reader.read("!B")[0] |
| 5725 | assert(_version == 4) |
| 5726 | _type = reader.read("!B")[0] |
| 5727 | assert(_type == 4) |
| 5728 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5729 | orig_reader = reader |
| 5730 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5731 | obj.xid = reader.read("!L")[0] |
| 5732 | _experimenter = reader.read("!L")[0] |
| 5733 | assert(_experimenter == 6035143) |
| 5734 | _subtype = reader.read("!L")[0] |
| 5735 | assert(_subtype == 34) |
| 5736 | obj.status = reader.read("!L")[0] |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5737 | obj.port_no = util.unpack_port_no(reader) |
| 5738 | obj.slot_num = reader.read("!B")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5739 | return obj |
| 5740 | |
| 5741 | def __eq__(self, other): |
| 5742 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5743 | if self.xid != other.xid: return False |
| 5744 | if self.status != other.status: return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5745 | if self.port_no != other.port_no: return False |
| 5746 | if self.slot_num != other.slot_num: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5747 | return True |
| 5748 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5749 | def pretty_print(self, q): |
| 5750 | q.text("bsn_pdu_rx_reply {") |
| 5751 | with q.group(): |
| 5752 | with q.indent(2): |
| 5753 | q.breakable() |
| 5754 | q.text("xid = "); |
| 5755 | if self.xid != None: |
| 5756 | q.text("%#x" % self.xid) |
| 5757 | else: |
| 5758 | q.text('None') |
| 5759 | q.text(","); q.breakable() |
| 5760 | q.text("status = "); |
| 5761 | q.text("%#x" % self.status) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5762 | q.text(","); q.breakable() |
| 5763 | q.text("port_no = "); |
| 5764 | q.text(util.pretty_port(self.port_no)) |
| 5765 | q.text(","); q.breakable() |
| 5766 | q.text("slot_num = "); |
| 5767 | q.text("%#x" % self.slot_num) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5768 | q.breakable() |
| 5769 | q.text('}') |
| 5770 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5771 | bsn_header.subtypes[34] = bsn_pdu_rx_reply |
| 5772 | |
| 5773 | class bsn_pdu_rx_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5774 | version = 4 |
| 5775 | type = 4 |
| 5776 | experimenter = 6035143 |
| 5777 | subtype = 33 |
| 5778 | |
| 5779 | 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] | 5780 | if xid != None: |
| 5781 | self.xid = xid |
| 5782 | else: |
| 5783 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5784 | if timeout_ms != None: |
| 5785 | self.timeout_ms = timeout_ms |
| 5786 | else: |
| 5787 | self.timeout_ms = 0 |
| 5788 | if port_no != None: |
| 5789 | self.port_no = port_no |
| 5790 | else: |
| 5791 | self.port_no = 0 |
| 5792 | if slot_num != None: |
| 5793 | self.slot_num = slot_num |
| 5794 | else: |
| 5795 | self.slot_num = 0 |
| 5796 | if data != None: |
| 5797 | self.data = data |
| 5798 | else: |
| 5799 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5800 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5801 | |
| 5802 | def pack(self): |
| 5803 | packed = [] |
| 5804 | packed.append(struct.pack("!B", self.version)) |
| 5805 | packed.append(struct.pack("!B", self.type)) |
| 5806 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5807 | packed.append(struct.pack("!L", self.xid)) |
| 5808 | packed.append(struct.pack("!L", self.experimenter)) |
| 5809 | packed.append(struct.pack("!L", self.subtype)) |
| 5810 | packed.append(struct.pack("!L", self.timeout_ms)) |
| 5811 | packed.append(util.pack_port_no(self.port_no)) |
| 5812 | packed.append(struct.pack("!B", self.slot_num)) |
| 5813 | packed.append('\x00' * 3) |
| 5814 | packed.append(self.data) |
| 5815 | length = sum([len(x) for x in packed]) |
| 5816 | packed[2] = struct.pack("!H", length) |
| 5817 | return ''.join(packed) |
| 5818 | |
| 5819 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5820 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5821 | obj = bsn_pdu_rx_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5822 | _version = reader.read("!B")[0] |
| 5823 | assert(_version == 4) |
| 5824 | _type = reader.read("!B")[0] |
| 5825 | assert(_type == 4) |
| 5826 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5827 | orig_reader = reader |
| 5828 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5829 | obj.xid = reader.read("!L")[0] |
| 5830 | _experimenter = reader.read("!L")[0] |
| 5831 | assert(_experimenter == 6035143) |
| 5832 | _subtype = reader.read("!L")[0] |
| 5833 | assert(_subtype == 33) |
| 5834 | obj.timeout_ms = reader.read("!L")[0] |
| 5835 | obj.port_no = util.unpack_port_no(reader) |
| 5836 | obj.slot_num = reader.read("!B")[0] |
| 5837 | reader.skip(3) |
| 5838 | obj.data = str(reader.read_all()) |
| 5839 | return obj |
| 5840 | |
| 5841 | def __eq__(self, other): |
| 5842 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5843 | if self.xid != other.xid: return False |
| 5844 | if self.timeout_ms != other.timeout_ms: return False |
| 5845 | if self.port_no != other.port_no: return False |
| 5846 | if self.slot_num != other.slot_num: return False |
| 5847 | if self.data != other.data: return False |
| 5848 | return True |
| 5849 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5850 | def pretty_print(self, q): |
| 5851 | q.text("bsn_pdu_rx_request {") |
| 5852 | with q.group(): |
| 5853 | with q.indent(2): |
| 5854 | q.breakable() |
| 5855 | q.text("xid = "); |
| 5856 | if self.xid != None: |
| 5857 | q.text("%#x" % self.xid) |
| 5858 | else: |
| 5859 | q.text('None') |
| 5860 | q.text(","); q.breakable() |
| 5861 | q.text("timeout_ms = "); |
| 5862 | q.text("%#x" % self.timeout_ms) |
| 5863 | q.text(","); q.breakable() |
| 5864 | q.text("port_no = "); |
| 5865 | q.text(util.pretty_port(self.port_no)) |
| 5866 | q.text(","); q.breakable() |
| 5867 | q.text("slot_num = "); |
| 5868 | q.text("%#x" % self.slot_num) |
| 5869 | q.text(","); q.breakable() |
| 5870 | q.text("data = "); |
| 5871 | q.pp(self.data) |
| 5872 | q.breakable() |
| 5873 | q.text('}') |
| 5874 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5875 | bsn_header.subtypes[33] = bsn_pdu_rx_request |
| 5876 | |
| 5877 | class bsn_pdu_rx_timeout(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5878 | version = 4 |
| 5879 | type = 4 |
| 5880 | experimenter = 6035143 |
| 5881 | subtype = 35 |
| 5882 | |
| 5883 | def __init__(self, xid=None, port_no=None, slot_num=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5884 | if xid != None: |
| 5885 | self.xid = xid |
| 5886 | else: |
| 5887 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5888 | if port_no != None: |
| 5889 | self.port_no = port_no |
| 5890 | else: |
| 5891 | self.port_no = 0 |
| 5892 | if slot_num != None: |
| 5893 | self.slot_num = slot_num |
| 5894 | else: |
| 5895 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5896 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5897 | |
| 5898 | def pack(self): |
| 5899 | packed = [] |
| 5900 | packed.append(struct.pack("!B", self.version)) |
| 5901 | packed.append(struct.pack("!B", self.type)) |
| 5902 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5903 | packed.append(struct.pack("!L", self.xid)) |
| 5904 | packed.append(struct.pack("!L", self.experimenter)) |
| 5905 | packed.append(struct.pack("!L", self.subtype)) |
| 5906 | packed.append(util.pack_port_no(self.port_no)) |
| 5907 | packed.append(struct.pack("!B", self.slot_num)) |
| 5908 | length = sum([len(x) for x in packed]) |
| 5909 | packed[2] = struct.pack("!H", length) |
| 5910 | return ''.join(packed) |
| 5911 | |
| 5912 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5913 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5914 | obj = bsn_pdu_rx_timeout() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5915 | _version = reader.read("!B")[0] |
| 5916 | assert(_version == 4) |
| 5917 | _type = reader.read("!B")[0] |
| 5918 | assert(_type == 4) |
| 5919 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5920 | orig_reader = reader |
| 5921 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5922 | obj.xid = reader.read("!L")[0] |
| 5923 | _experimenter = reader.read("!L")[0] |
| 5924 | assert(_experimenter == 6035143) |
| 5925 | _subtype = reader.read("!L")[0] |
| 5926 | assert(_subtype == 35) |
| 5927 | obj.port_no = util.unpack_port_no(reader) |
| 5928 | obj.slot_num = reader.read("!B")[0] |
| 5929 | return obj |
| 5930 | |
| 5931 | def __eq__(self, other): |
| 5932 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5933 | if self.xid != other.xid: return False |
| 5934 | if self.port_no != other.port_no: return False |
| 5935 | if self.slot_num != other.slot_num: return False |
| 5936 | return True |
| 5937 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5938 | def pretty_print(self, q): |
| 5939 | q.text("bsn_pdu_rx_timeout {") |
| 5940 | with q.group(): |
| 5941 | with q.indent(2): |
| 5942 | q.breakable() |
| 5943 | q.text("xid = "); |
| 5944 | if self.xid != None: |
| 5945 | q.text("%#x" % self.xid) |
| 5946 | else: |
| 5947 | q.text('None') |
| 5948 | q.text(","); q.breakable() |
| 5949 | q.text("port_no = "); |
| 5950 | q.text(util.pretty_port(self.port_no)) |
| 5951 | q.text(","); q.breakable() |
| 5952 | q.text("slot_num = "); |
| 5953 | q.text("%#x" % self.slot_num) |
| 5954 | q.breakable() |
| 5955 | q.text('}') |
| 5956 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5957 | bsn_header.subtypes[35] = bsn_pdu_rx_timeout |
| 5958 | |
| 5959 | class bsn_pdu_tx_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5960 | version = 4 |
| 5961 | type = 4 |
| 5962 | experimenter = 6035143 |
| 5963 | subtype = 32 |
| 5964 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5965 | 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] | 5966 | if xid != None: |
| 5967 | self.xid = xid |
| 5968 | else: |
| 5969 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5970 | if status != None: |
| 5971 | self.status = status |
| 5972 | else: |
| 5973 | self.status = 0 |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5974 | if port_no != None: |
| 5975 | self.port_no = port_no |
| 5976 | else: |
| 5977 | self.port_no = 0 |
| 5978 | if slot_num != None: |
| 5979 | self.slot_num = slot_num |
| 5980 | else: |
| 5981 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5982 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5983 | |
| 5984 | def pack(self): |
| 5985 | packed = [] |
| 5986 | packed.append(struct.pack("!B", self.version)) |
| 5987 | packed.append(struct.pack("!B", self.type)) |
| 5988 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5989 | packed.append(struct.pack("!L", self.xid)) |
| 5990 | packed.append(struct.pack("!L", self.experimenter)) |
| 5991 | packed.append(struct.pack("!L", self.subtype)) |
| 5992 | packed.append(struct.pack("!L", self.status)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5993 | packed.append(util.pack_port_no(self.port_no)) |
| 5994 | packed.append(struct.pack("!B", self.slot_num)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5995 | length = sum([len(x) for x in packed]) |
| 5996 | packed[2] = struct.pack("!H", length) |
| 5997 | return ''.join(packed) |
| 5998 | |
| 5999 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6000 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6001 | obj = bsn_pdu_tx_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6002 | _version = reader.read("!B")[0] |
| 6003 | assert(_version == 4) |
| 6004 | _type = reader.read("!B")[0] |
| 6005 | assert(_type == 4) |
| 6006 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6007 | orig_reader = reader |
| 6008 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6009 | obj.xid = reader.read("!L")[0] |
| 6010 | _experimenter = reader.read("!L")[0] |
| 6011 | assert(_experimenter == 6035143) |
| 6012 | _subtype = reader.read("!L")[0] |
| 6013 | assert(_subtype == 32) |
| 6014 | obj.status = reader.read("!L")[0] |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6015 | obj.port_no = util.unpack_port_no(reader) |
| 6016 | obj.slot_num = reader.read("!B")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6017 | return obj |
| 6018 | |
| 6019 | def __eq__(self, other): |
| 6020 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6021 | if self.xid != other.xid: return False |
| 6022 | if self.status != other.status: return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6023 | if self.port_no != other.port_no: return False |
| 6024 | if self.slot_num != other.slot_num: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6025 | return True |
| 6026 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6027 | def pretty_print(self, q): |
| 6028 | q.text("bsn_pdu_tx_reply {") |
| 6029 | with q.group(): |
| 6030 | with q.indent(2): |
| 6031 | q.breakable() |
| 6032 | q.text("xid = "); |
| 6033 | if self.xid != None: |
| 6034 | q.text("%#x" % self.xid) |
| 6035 | else: |
| 6036 | q.text('None') |
| 6037 | q.text(","); q.breakable() |
| 6038 | q.text("status = "); |
| 6039 | q.text("%#x" % self.status) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6040 | q.text(","); q.breakable() |
| 6041 | q.text("port_no = "); |
| 6042 | q.text(util.pretty_port(self.port_no)) |
| 6043 | q.text(","); q.breakable() |
| 6044 | q.text("slot_num = "); |
| 6045 | q.text("%#x" % self.slot_num) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6046 | q.breakable() |
| 6047 | q.text('}') |
| 6048 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6049 | bsn_header.subtypes[32] = bsn_pdu_tx_reply |
| 6050 | |
| 6051 | class bsn_pdu_tx_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6052 | version = 4 |
| 6053 | type = 4 |
| 6054 | experimenter = 6035143 |
| 6055 | subtype = 31 |
| 6056 | |
| 6057 | 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] | 6058 | if xid != None: |
| 6059 | self.xid = xid |
| 6060 | else: |
| 6061 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6062 | if tx_interval_ms != None: |
| 6063 | self.tx_interval_ms = tx_interval_ms |
| 6064 | else: |
| 6065 | self.tx_interval_ms = 0 |
| 6066 | if port_no != None: |
| 6067 | self.port_no = port_no |
| 6068 | else: |
| 6069 | self.port_no = 0 |
| 6070 | if slot_num != None: |
| 6071 | self.slot_num = slot_num |
| 6072 | else: |
| 6073 | self.slot_num = 0 |
| 6074 | if data != None: |
| 6075 | self.data = data |
| 6076 | else: |
| 6077 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6078 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6079 | |
| 6080 | def pack(self): |
| 6081 | packed = [] |
| 6082 | packed.append(struct.pack("!B", self.version)) |
| 6083 | packed.append(struct.pack("!B", self.type)) |
| 6084 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6085 | packed.append(struct.pack("!L", self.xid)) |
| 6086 | packed.append(struct.pack("!L", self.experimenter)) |
| 6087 | packed.append(struct.pack("!L", self.subtype)) |
| 6088 | packed.append(struct.pack("!L", self.tx_interval_ms)) |
| 6089 | packed.append(util.pack_port_no(self.port_no)) |
| 6090 | packed.append(struct.pack("!B", self.slot_num)) |
| 6091 | packed.append('\x00' * 3) |
| 6092 | packed.append(self.data) |
| 6093 | length = sum([len(x) for x in packed]) |
| 6094 | packed[2] = struct.pack("!H", length) |
| 6095 | return ''.join(packed) |
| 6096 | |
| 6097 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6098 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6099 | obj = bsn_pdu_tx_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6100 | _version = reader.read("!B")[0] |
| 6101 | assert(_version == 4) |
| 6102 | _type = reader.read("!B")[0] |
| 6103 | assert(_type == 4) |
| 6104 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6105 | orig_reader = reader |
| 6106 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6107 | obj.xid = reader.read("!L")[0] |
| 6108 | _experimenter = reader.read("!L")[0] |
| 6109 | assert(_experimenter == 6035143) |
| 6110 | _subtype = reader.read("!L")[0] |
| 6111 | assert(_subtype == 31) |
| 6112 | obj.tx_interval_ms = reader.read("!L")[0] |
| 6113 | obj.port_no = util.unpack_port_no(reader) |
| 6114 | obj.slot_num = reader.read("!B")[0] |
| 6115 | reader.skip(3) |
| 6116 | obj.data = str(reader.read_all()) |
| 6117 | return obj |
| 6118 | |
| 6119 | def __eq__(self, other): |
| 6120 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6121 | if self.xid != other.xid: return False |
| 6122 | if self.tx_interval_ms != other.tx_interval_ms: return False |
| 6123 | if self.port_no != other.port_no: return False |
| 6124 | if self.slot_num != other.slot_num: return False |
| 6125 | if self.data != other.data: return False |
| 6126 | return True |
| 6127 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6128 | def pretty_print(self, q): |
| 6129 | q.text("bsn_pdu_tx_request {") |
| 6130 | with q.group(): |
| 6131 | with q.indent(2): |
| 6132 | q.breakable() |
| 6133 | q.text("xid = "); |
| 6134 | if self.xid != None: |
| 6135 | q.text("%#x" % self.xid) |
| 6136 | else: |
| 6137 | q.text('None') |
| 6138 | q.text(","); q.breakable() |
| 6139 | q.text("tx_interval_ms = "); |
| 6140 | q.text("%#x" % self.tx_interval_ms) |
| 6141 | q.text(","); q.breakable() |
| 6142 | q.text("port_no = "); |
| 6143 | q.text(util.pretty_port(self.port_no)) |
| 6144 | q.text(","); q.breakable() |
| 6145 | q.text("slot_num = "); |
| 6146 | q.text("%#x" % self.slot_num) |
| 6147 | q.text(","); q.breakable() |
| 6148 | q.text("data = "); |
| 6149 | q.pp(self.data) |
| 6150 | q.breakable() |
| 6151 | q.text('}') |
| 6152 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6153 | bsn_header.subtypes[31] = bsn_pdu_tx_request |
| 6154 | |
| 6155 | class bsn_port_counter_stats_reply(bsn_stats_reply): |
| 6156 | version = 4 |
| 6157 | type = 19 |
| 6158 | stats_type = 65535 |
| 6159 | experimenter = 6035143 |
| 6160 | subtype = 8 |
| 6161 | |
| 6162 | def __init__(self, xid=None, flags=None, entries=None): |
| 6163 | if xid != None: |
| 6164 | self.xid = xid |
| 6165 | else: |
| 6166 | self.xid = None |
| 6167 | if flags != None: |
| 6168 | self.flags = flags |
| 6169 | else: |
| 6170 | self.flags = 0 |
| 6171 | if entries != None: |
| 6172 | self.entries = entries |
| 6173 | else: |
| 6174 | self.entries = [] |
| 6175 | return |
| 6176 | |
| 6177 | def pack(self): |
| 6178 | packed = [] |
| 6179 | packed.append(struct.pack("!B", self.version)) |
| 6180 | packed.append(struct.pack("!B", self.type)) |
| 6181 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6182 | packed.append(struct.pack("!L", self.xid)) |
| 6183 | packed.append(struct.pack("!H", self.stats_type)) |
| 6184 | packed.append(struct.pack("!H", self.flags)) |
| 6185 | packed.append('\x00' * 4) |
| 6186 | packed.append(struct.pack("!L", self.experimenter)) |
| 6187 | packed.append(struct.pack("!L", self.subtype)) |
| 6188 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 6189 | length = sum([len(x) for x in packed]) |
| 6190 | packed[2] = struct.pack("!H", length) |
| 6191 | return ''.join(packed) |
| 6192 | |
| 6193 | @staticmethod |
| 6194 | def unpack(reader): |
| 6195 | obj = bsn_port_counter_stats_reply() |
| 6196 | _version = reader.read("!B")[0] |
| 6197 | assert(_version == 4) |
| 6198 | _type = reader.read("!B")[0] |
| 6199 | assert(_type == 19) |
| 6200 | _length = reader.read("!H")[0] |
| 6201 | orig_reader = reader |
| 6202 | reader = orig_reader.slice(_length - (2 + 2)) |
| 6203 | obj.xid = reader.read("!L")[0] |
| 6204 | _stats_type = reader.read("!H")[0] |
| 6205 | assert(_stats_type == 65535) |
| 6206 | obj.flags = reader.read("!H")[0] |
| 6207 | reader.skip(4) |
| 6208 | _experimenter = reader.read("!L")[0] |
| 6209 | assert(_experimenter == 6035143) |
| 6210 | _subtype = reader.read("!L")[0] |
| 6211 | assert(_subtype == 8) |
| 6212 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_port_counter_stats_entry.unpack) |
| 6213 | return obj |
| 6214 | |
| 6215 | def __eq__(self, other): |
| 6216 | if type(self) != type(other): return False |
| 6217 | if self.xid != other.xid: return False |
| 6218 | if self.flags != other.flags: return False |
| 6219 | if self.entries != other.entries: return False |
| 6220 | return True |
| 6221 | |
| 6222 | def pretty_print(self, q): |
| 6223 | q.text("bsn_port_counter_stats_reply {") |
| 6224 | with q.group(): |
| 6225 | with q.indent(2): |
| 6226 | q.breakable() |
| 6227 | q.text("xid = "); |
| 6228 | if self.xid != None: |
| 6229 | q.text("%#x" % self.xid) |
| 6230 | else: |
| 6231 | q.text('None') |
| 6232 | q.text(","); q.breakable() |
| 6233 | q.text("flags = "); |
| 6234 | q.text("%#x" % self.flags) |
| 6235 | q.text(","); q.breakable() |
| 6236 | q.text("entries = "); |
| 6237 | q.pp(self.entries) |
| 6238 | q.breakable() |
| 6239 | q.text('}') |
| 6240 | |
| 6241 | bsn_stats_reply.subtypes[8] = bsn_port_counter_stats_reply |
| 6242 | |
| 6243 | class bsn_port_counter_stats_request(bsn_stats_request): |
| 6244 | version = 4 |
| 6245 | type = 18 |
| 6246 | stats_type = 65535 |
| 6247 | experimenter = 6035143 |
| 6248 | subtype = 8 |
| 6249 | |
| 6250 | def __init__(self, xid=None, flags=None, port_no=None): |
| 6251 | if xid != None: |
| 6252 | self.xid = xid |
| 6253 | else: |
| 6254 | self.xid = None |
| 6255 | if flags != None: |
| 6256 | self.flags = flags |
| 6257 | else: |
| 6258 | self.flags = 0 |
| 6259 | if port_no != None: |
| 6260 | self.port_no = port_no |
| 6261 | else: |
| 6262 | self.port_no = 0 |
| 6263 | return |
| 6264 | |
| 6265 | def pack(self): |
| 6266 | packed = [] |
| 6267 | packed.append(struct.pack("!B", self.version)) |
| 6268 | packed.append(struct.pack("!B", self.type)) |
| 6269 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6270 | packed.append(struct.pack("!L", self.xid)) |
| 6271 | packed.append(struct.pack("!H", self.stats_type)) |
| 6272 | packed.append(struct.pack("!H", self.flags)) |
| 6273 | packed.append('\x00' * 4) |
| 6274 | packed.append(struct.pack("!L", self.experimenter)) |
| 6275 | packed.append(struct.pack("!L", self.subtype)) |
| 6276 | packed.append(util.pack_port_no(self.port_no)) |
| 6277 | length = sum([len(x) for x in packed]) |
| 6278 | packed[2] = struct.pack("!H", length) |
| 6279 | return ''.join(packed) |
| 6280 | |
| 6281 | @staticmethod |
| 6282 | def unpack(reader): |
| 6283 | obj = bsn_port_counter_stats_request() |
| 6284 | _version = reader.read("!B")[0] |
| 6285 | assert(_version == 4) |
| 6286 | _type = reader.read("!B")[0] |
| 6287 | assert(_type == 18) |
| 6288 | _length = reader.read("!H")[0] |
| 6289 | orig_reader = reader |
| 6290 | reader = orig_reader.slice(_length - (2 + 2)) |
| 6291 | obj.xid = reader.read("!L")[0] |
| 6292 | _stats_type = reader.read("!H")[0] |
| 6293 | assert(_stats_type == 65535) |
| 6294 | obj.flags = reader.read("!H")[0] |
| 6295 | reader.skip(4) |
| 6296 | _experimenter = reader.read("!L")[0] |
| 6297 | assert(_experimenter == 6035143) |
| 6298 | _subtype = reader.read("!L")[0] |
| 6299 | assert(_subtype == 8) |
| 6300 | obj.port_no = util.unpack_port_no(reader) |
| 6301 | return obj |
| 6302 | |
| 6303 | def __eq__(self, other): |
| 6304 | if type(self) != type(other): return False |
| 6305 | if self.xid != other.xid: return False |
| 6306 | if self.flags != other.flags: return False |
| 6307 | if self.port_no != other.port_no: return False |
| 6308 | return True |
| 6309 | |
| 6310 | def pretty_print(self, q): |
| 6311 | q.text("bsn_port_counter_stats_request {") |
| 6312 | with q.group(): |
| 6313 | with q.indent(2): |
| 6314 | q.breakable() |
| 6315 | q.text("xid = "); |
| 6316 | if self.xid != None: |
| 6317 | q.text("%#x" % self.xid) |
| 6318 | else: |
| 6319 | q.text('None') |
| 6320 | q.text(","); q.breakable() |
| 6321 | q.text("flags = "); |
| 6322 | q.text("%#x" % self.flags) |
| 6323 | q.text(","); q.breakable() |
| 6324 | q.text("port_no = "); |
| 6325 | q.text(util.pretty_port(self.port_no)) |
| 6326 | q.breakable() |
| 6327 | q.text('}') |
| 6328 | |
| 6329 | bsn_stats_request.subtypes[8] = bsn_port_counter_stats_request |
| 6330 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 6331 | class bsn_role_status(bsn_header): |
| 6332 | version = 4 |
| 6333 | type = 4 |
| 6334 | experimenter = 6035143 |
| 6335 | subtype = 55 |
| 6336 | |
| 6337 | def __init__(self, xid=None, role=None, reason=None, generation_id=None): |
| 6338 | if xid != None: |
| 6339 | self.xid = xid |
| 6340 | else: |
| 6341 | self.xid = None |
| 6342 | if role != None: |
| 6343 | self.role = role |
| 6344 | else: |
| 6345 | self.role = 0 |
| 6346 | if reason != None: |
| 6347 | self.reason = reason |
| 6348 | else: |
| 6349 | self.reason = 0 |
| 6350 | if generation_id != None: |
| 6351 | self.generation_id = generation_id |
| 6352 | else: |
| 6353 | self.generation_id = 0 |
| 6354 | return |
| 6355 | |
| 6356 | def pack(self): |
| 6357 | packed = [] |
| 6358 | packed.append(struct.pack("!B", self.version)) |
| 6359 | packed.append(struct.pack("!B", self.type)) |
| 6360 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6361 | packed.append(struct.pack("!L", self.xid)) |
| 6362 | packed.append(struct.pack("!L", self.experimenter)) |
| 6363 | packed.append(struct.pack("!L", self.subtype)) |
| 6364 | packed.append(struct.pack("!L", self.role)) |
| 6365 | packed.append(struct.pack("!B", self.reason)) |
| 6366 | packed.append('\x00' * 3) |
| 6367 | packed.append(struct.pack("!Q", self.generation_id)) |
| 6368 | length = sum([len(x) for x in packed]) |
| 6369 | packed[2] = struct.pack("!H", length) |
| 6370 | return ''.join(packed) |
| 6371 | |
| 6372 | @staticmethod |
| 6373 | def unpack(reader): |
| 6374 | obj = bsn_role_status() |
| 6375 | _version = reader.read("!B")[0] |
| 6376 | assert(_version == 4) |
| 6377 | _type = reader.read("!B")[0] |
| 6378 | assert(_type == 4) |
| 6379 | _length = reader.read("!H")[0] |
| 6380 | orig_reader = reader |
| 6381 | reader = orig_reader.slice(_length - (2 + 2)) |
| 6382 | obj.xid = reader.read("!L")[0] |
| 6383 | _experimenter = reader.read("!L")[0] |
| 6384 | assert(_experimenter == 6035143) |
| 6385 | _subtype = reader.read("!L")[0] |
| 6386 | assert(_subtype == 55) |
| 6387 | obj.role = reader.read("!L")[0] |
| 6388 | obj.reason = reader.read("!B")[0] |
| 6389 | reader.skip(3) |
| 6390 | obj.generation_id = reader.read("!Q")[0] |
| 6391 | return obj |
| 6392 | |
| 6393 | def __eq__(self, other): |
| 6394 | if type(self) != type(other): return False |
| 6395 | if self.xid != other.xid: return False |
| 6396 | if self.role != other.role: return False |
| 6397 | if self.reason != other.reason: return False |
| 6398 | if self.generation_id != other.generation_id: return False |
| 6399 | return True |
| 6400 | |
| 6401 | def pretty_print(self, q): |
| 6402 | q.text("bsn_role_status {") |
| 6403 | with q.group(): |
| 6404 | with q.indent(2): |
| 6405 | q.breakable() |
| 6406 | q.text("xid = "); |
| 6407 | if self.xid != None: |
| 6408 | q.text("%#x" % self.xid) |
| 6409 | else: |
| 6410 | q.text('None') |
| 6411 | q.text(","); q.breakable() |
| 6412 | q.text("role = "); |
| 6413 | q.text("%#x" % self.role) |
| 6414 | q.text(","); q.breakable() |
| 6415 | q.text("reason = "); |
| 6416 | q.text("%#x" % self.reason) |
| 6417 | q.text(","); q.breakable() |
| 6418 | q.text("generation_id = "); |
| 6419 | q.text("%#x" % self.generation_id) |
| 6420 | q.breakable() |
| 6421 | q.text('}') |
| 6422 | |
| 6423 | bsn_header.subtypes[55] = bsn_role_status |
| 6424 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 6425 | class bsn_set_aux_cxns_reply(bsn_header): |
| 6426 | version = 4 |
| 6427 | type = 4 |
| 6428 | experimenter = 6035143 |
| 6429 | subtype = 59 |
| 6430 | |
| 6431 | def __init__(self, xid=None, num_aux=None, status=None): |
| 6432 | if xid != None: |
| 6433 | self.xid = xid |
| 6434 | else: |
| 6435 | self.xid = None |
| 6436 | if num_aux != None: |
| 6437 | self.num_aux = num_aux |
| 6438 | else: |
| 6439 | self.num_aux = 0 |
| 6440 | if status != None: |
| 6441 | self.status = status |
| 6442 | else: |
| 6443 | self.status = 0 |
| 6444 | return |
| 6445 | |
| 6446 | def pack(self): |
| 6447 | packed = [] |
| 6448 | packed.append(struct.pack("!B", self.version)) |
| 6449 | packed.append(struct.pack("!B", self.type)) |
| 6450 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6451 | packed.append(struct.pack("!L", self.xid)) |
| 6452 | packed.append(struct.pack("!L", self.experimenter)) |
| 6453 | packed.append(struct.pack("!L", self.subtype)) |
| 6454 | packed.append(struct.pack("!L", self.num_aux)) |
| 6455 | packed.append(struct.pack("!L", self.status)) |
| 6456 | length = sum([len(x) for x in packed]) |
| 6457 | packed[2] = struct.pack("!H", length) |
| 6458 | return ''.join(packed) |
| 6459 | |
| 6460 | @staticmethod |
| 6461 | def unpack(reader): |
| 6462 | obj = bsn_set_aux_cxns_reply() |
| 6463 | _version = reader.read("!B")[0] |
| 6464 | assert(_version == 4) |
| 6465 | _type = reader.read("!B")[0] |
| 6466 | assert(_type == 4) |
| 6467 | _length = reader.read("!H")[0] |
| 6468 | orig_reader = reader |
| 6469 | reader = orig_reader.slice(_length - (2 + 2)) |
| 6470 | obj.xid = reader.read("!L")[0] |
| 6471 | _experimenter = reader.read("!L")[0] |
| 6472 | assert(_experimenter == 6035143) |
| 6473 | _subtype = reader.read("!L")[0] |
| 6474 | assert(_subtype == 59) |
| 6475 | obj.num_aux = reader.read("!L")[0] |
| 6476 | obj.status = reader.read("!L")[0] |
| 6477 | return obj |
| 6478 | |
| 6479 | def __eq__(self, other): |
| 6480 | if type(self) != type(other): return False |
| 6481 | if self.xid != other.xid: return False |
| 6482 | if self.num_aux != other.num_aux: return False |
| 6483 | if self.status != other.status: return False |
| 6484 | return True |
| 6485 | |
| 6486 | def pretty_print(self, q): |
| 6487 | q.text("bsn_set_aux_cxns_reply {") |
| 6488 | with q.group(): |
| 6489 | with q.indent(2): |
| 6490 | q.breakable() |
| 6491 | q.text("xid = "); |
| 6492 | if self.xid != None: |
| 6493 | q.text("%#x" % self.xid) |
| 6494 | else: |
| 6495 | q.text('None') |
| 6496 | q.text(","); q.breakable() |
| 6497 | q.text("num_aux = "); |
| 6498 | q.text("%#x" % self.num_aux) |
| 6499 | q.text(","); q.breakable() |
| 6500 | q.text("status = "); |
| 6501 | q.text("%#x" % self.status) |
| 6502 | q.breakable() |
| 6503 | q.text('}') |
| 6504 | |
| 6505 | bsn_header.subtypes[59] = bsn_set_aux_cxns_reply |
| 6506 | |
| 6507 | class bsn_set_aux_cxns_request(bsn_header): |
| 6508 | version = 4 |
| 6509 | type = 4 |
| 6510 | experimenter = 6035143 |
| 6511 | subtype = 58 |
| 6512 | |
| 6513 | def __init__(self, xid=None, num_aux=None): |
| 6514 | if xid != None: |
| 6515 | self.xid = xid |
| 6516 | else: |
| 6517 | self.xid = None |
| 6518 | if num_aux != None: |
| 6519 | self.num_aux = num_aux |
| 6520 | else: |
| 6521 | self.num_aux = 0 |
| 6522 | return |
| 6523 | |
| 6524 | def pack(self): |
| 6525 | packed = [] |
| 6526 | packed.append(struct.pack("!B", self.version)) |
| 6527 | packed.append(struct.pack("!B", self.type)) |
| 6528 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6529 | packed.append(struct.pack("!L", self.xid)) |
| 6530 | packed.append(struct.pack("!L", self.experimenter)) |
| 6531 | packed.append(struct.pack("!L", self.subtype)) |
| 6532 | packed.append(struct.pack("!L", self.num_aux)) |
| 6533 | length = sum([len(x) for x in packed]) |
| 6534 | packed[2] = struct.pack("!H", length) |
| 6535 | return ''.join(packed) |
| 6536 | |
| 6537 | @staticmethod |
| 6538 | def unpack(reader): |
| 6539 | obj = bsn_set_aux_cxns_request() |
| 6540 | _version = reader.read("!B")[0] |
| 6541 | assert(_version == 4) |
| 6542 | _type = reader.read("!B")[0] |
| 6543 | assert(_type == 4) |
| 6544 | _length = reader.read("!H")[0] |
| 6545 | orig_reader = reader |
| 6546 | reader = orig_reader.slice(_length - (2 + 2)) |
| 6547 | obj.xid = reader.read("!L")[0] |
| 6548 | _experimenter = reader.read("!L")[0] |
| 6549 | assert(_experimenter == 6035143) |
| 6550 | _subtype = reader.read("!L")[0] |
| 6551 | assert(_subtype == 58) |
| 6552 | obj.num_aux = reader.read("!L")[0] |
| 6553 | return obj |
| 6554 | |
| 6555 | def __eq__(self, other): |
| 6556 | if type(self) != type(other): return False |
| 6557 | if self.xid != other.xid: return False |
| 6558 | if self.num_aux != other.num_aux: return False |
| 6559 | return True |
| 6560 | |
| 6561 | def pretty_print(self, q): |
| 6562 | q.text("bsn_set_aux_cxns_request {") |
| 6563 | with q.group(): |
| 6564 | with q.indent(2): |
| 6565 | q.breakable() |
| 6566 | q.text("xid = "); |
| 6567 | if self.xid != None: |
| 6568 | q.text("%#x" % self.xid) |
| 6569 | else: |
| 6570 | q.text('None') |
| 6571 | q.text(","); q.breakable() |
| 6572 | q.text("num_aux = "); |
| 6573 | q.text("%#x" % self.num_aux) |
| 6574 | q.breakable() |
| 6575 | q.text('}') |
| 6576 | |
| 6577 | bsn_header.subtypes[58] = bsn_set_aux_cxns_request |
| 6578 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6579 | class bsn_set_lacp_reply(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6580 | version = 4 |
| 6581 | type = 4 |
| 6582 | experimenter = 6035143 |
| 6583 | subtype = 42 |
| 6584 | |
| 6585 | def __init__(self, xid=None, status=None, port_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6586 | if xid != None: |
| 6587 | self.xid = xid |
| 6588 | else: |
| 6589 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6590 | if status != None: |
| 6591 | self.status = status |
| 6592 | else: |
| 6593 | self.status = 0 |
| 6594 | if port_no != None: |
| 6595 | self.port_no = port_no |
| 6596 | else: |
| 6597 | self.port_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6598 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6599 | |
| 6600 | def pack(self): |
| 6601 | packed = [] |
| 6602 | packed.append(struct.pack("!B", self.version)) |
| 6603 | packed.append(struct.pack("!B", self.type)) |
| 6604 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6605 | packed.append(struct.pack("!L", self.xid)) |
| 6606 | packed.append(struct.pack("!L", self.experimenter)) |
| 6607 | packed.append(struct.pack("!L", self.subtype)) |
| 6608 | packed.append(struct.pack("!L", self.status)) |
| 6609 | packed.append(util.pack_port_no(self.port_no)) |
| 6610 | length = sum([len(x) for x in packed]) |
| 6611 | packed[2] = struct.pack("!H", length) |
| 6612 | return ''.join(packed) |
| 6613 | |
| 6614 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6615 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6616 | obj = bsn_set_lacp_reply() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6617 | _version = reader.read("!B")[0] |
| 6618 | assert(_version == 4) |
| 6619 | _type = reader.read("!B")[0] |
| 6620 | assert(_type == 4) |
| 6621 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6622 | orig_reader = reader |
| 6623 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6624 | obj.xid = reader.read("!L")[0] |
| 6625 | _experimenter = reader.read("!L")[0] |
| 6626 | assert(_experimenter == 6035143) |
| 6627 | _subtype = reader.read("!L")[0] |
| 6628 | assert(_subtype == 42) |
| 6629 | obj.status = reader.read("!L")[0] |
| 6630 | obj.port_no = util.unpack_port_no(reader) |
| 6631 | return obj |
| 6632 | |
| 6633 | def __eq__(self, other): |
| 6634 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6635 | if self.xid != other.xid: return False |
| 6636 | if self.status != other.status: return False |
| 6637 | if self.port_no != other.port_no: return False |
| 6638 | return True |
| 6639 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6640 | def pretty_print(self, q): |
| 6641 | q.text("bsn_set_lacp_reply {") |
| 6642 | with q.group(): |
| 6643 | with q.indent(2): |
| 6644 | q.breakable() |
| 6645 | q.text("xid = "); |
| 6646 | if self.xid != None: |
| 6647 | q.text("%#x" % self.xid) |
| 6648 | else: |
| 6649 | q.text('None') |
| 6650 | q.text(","); q.breakable() |
| 6651 | q.text("status = "); |
| 6652 | q.text("%#x" % self.status) |
| 6653 | q.text(","); q.breakable() |
| 6654 | q.text("port_no = "); |
| 6655 | q.text(util.pretty_port(self.port_no)) |
| 6656 | q.breakable() |
| 6657 | q.text('}') |
| 6658 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6659 | bsn_header.subtypes[42] = bsn_set_lacp_reply |
| 6660 | |
| 6661 | class bsn_set_lacp_request(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6662 | version = 4 |
| 6663 | type = 4 |
| 6664 | experimenter = 6035143 |
| 6665 | subtype = 41 |
| 6666 | |
| 6667 | 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] | 6668 | if xid != None: |
| 6669 | self.xid = xid |
| 6670 | else: |
| 6671 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6672 | if enabled != None: |
| 6673 | self.enabled = enabled |
| 6674 | else: |
| 6675 | self.enabled = 0 |
| 6676 | if port_no != None: |
| 6677 | self.port_no = port_no |
| 6678 | else: |
| 6679 | self.port_no = 0 |
| 6680 | if actor_sys_priority != None: |
| 6681 | self.actor_sys_priority = actor_sys_priority |
| 6682 | else: |
| 6683 | self.actor_sys_priority = 0 |
| 6684 | if actor_sys_mac != None: |
| 6685 | self.actor_sys_mac = actor_sys_mac |
| 6686 | else: |
| 6687 | self.actor_sys_mac = [0,0,0,0,0,0] |
| 6688 | if actor_port_priority != None: |
| 6689 | self.actor_port_priority = actor_port_priority |
| 6690 | else: |
| 6691 | self.actor_port_priority = 0 |
| 6692 | if actor_port_num != None: |
| 6693 | self.actor_port_num = actor_port_num |
| 6694 | else: |
| 6695 | self.actor_port_num = 0 |
| 6696 | if actor_key != None: |
| 6697 | self.actor_key = actor_key |
| 6698 | else: |
| 6699 | self.actor_key = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6700 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6701 | |
| 6702 | def pack(self): |
| 6703 | packed = [] |
| 6704 | packed.append(struct.pack("!B", self.version)) |
| 6705 | packed.append(struct.pack("!B", self.type)) |
| 6706 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6707 | packed.append(struct.pack("!L", self.xid)) |
| 6708 | packed.append(struct.pack("!L", self.experimenter)) |
| 6709 | packed.append(struct.pack("!L", self.subtype)) |
| 6710 | packed.append(struct.pack("!B", self.enabled)) |
| 6711 | packed.append('\x00' * 3) |
| 6712 | packed.append(util.pack_port_no(self.port_no)) |
| 6713 | packed.append(struct.pack("!H", self.actor_sys_priority)) |
| 6714 | packed.append(struct.pack("!6B", *self.actor_sys_mac)) |
| 6715 | packed.append(struct.pack("!H", self.actor_port_priority)) |
| 6716 | packed.append(struct.pack("!H", self.actor_port_num)) |
| 6717 | packed.append(struct.pack("!H", self.actor_key)) |
| 6718 | length = sum([len(x) for x in packed]) |
| 6719 | packed[2] = struct.pack("!H", length) |
| 6720 | return ''.join(packed) |
| 6721 | |
| 6722 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6723 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6724 | obj = bsn_set_lacp_request() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6725 | _version = reader.read("!B")[0] |
| 6726 | assert(_version == 4) |
| 6727 | _type = reader.read("!B")[0] |
| 6728 | assert(_type == 4) |
| 6729 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6730 | orig_reader = reader |
| 6731 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6732 | obj.xid = reader.read("!L")[0] |
| 6733 | _experimenter = reader.read("!L")[0] |
| 6734 | assert(_experimenter == 6035143) |
| 6735 | _subtype = reader.read("!L")[0] |
| 6736 | assert(_subtype == 41) |
| 6737 | obj.enabled = reader.read("!B")[0] |
| 6738 | reader.skip(3) |
| 6739 | obj.port_no = util.unpack_port_no(reader) |
| 6740 | obj.actor_sys_priority = reader.read("!H")[0] |
| 6741 | obj.actor_sys_mac = list(reader.read('!6B')) |
| 6742 | obj.actor_port_priority = reader.read("!H")[0] |
| 6743 | obj.actor_port_num = reader.read("!H")[0] |
| 6744 | obj.actor_key = reader.read("!H")[0] |
| 6745 | return obj |
| 6746 | |
| 6747 | def __eq__(self, other): |
| 6748 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6749 | if self.xid != other.xid: return False |
| 6750 | if self.enabled != other.enabled: return False |
| 6751 | if self.port_no != other.port_no: return False |
| 6752 | if self.actor_sys_priority != other.actor_sys_priority: return False |
| 6753 | if self.actor_sys_mac != other.actor_sys_mac: return False |
| 6754 | if self.actor_port_priority != other.actor_port_priority: return False |
| 6755 | if self.actor_port_num != other.actor_port_num: return False |
| 6756 | if self.actor_key != other.actor_key: return False |
| 6757 | return True |
| 6758 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6759 | def pretty_print(self, q): |
| 6760 | q.text("bsn_set_lacp_request {") |
| 6761 | with q.group(): |
| 6762 | with q.indent(2): |
| 6763 | q.breakable() |
| 6764 | q.text("xid = "); |
| 6765 | if self.xid != None: |
| 6766 | q.text("%#x" % self.xid) |
| 6767 | else: |
| 6768 | q.text('None') |
| 6769 | q.text(","); q.breakable() |
| 6770 | q.text("enabled = "); |
| 6771 | q.text("%#x" % self.enabled) |
| 6772 | q.text(","); q.breakable() |
| 6773 | q.text("port_no = "); |
| 6774 | q.text(util.pretty_port(self.port_no)) |
| 6775 | q.text(","); q.breakable() |
| 6776 | q.text("actor_sys_priority = "); |
| 6777 | q.text("%#x" % self.actor_sys_priority) |
| 6778 | q.text(","); q.breakable() |
| 6779 | q.text("actor_sys_mac = "); |
| 6780 | q.text(util.pretty_mac(self.actor_sys_mac)) |
| 6781 | q.text(","); q.breakable() |
| 6782 | q.text("actor_port_priority = "); |
| 6783 | q.text("%#x" % self.actor_port_priority) |
| 6784 | q.text(","); q.breakable() |
| 6785 | q.text("actor_port_num = "); |
| 6786 | q.text("%#x" % self.actor_port_num) |
| 6787 | q.text(","); q.breakable() |
| 6788 | q.text("actor_key = "); |
| 6789 | q.text("%#x" % self.actor_key) |
| 6790 | q.breakable() |
| 6791 | q.text('}') |
| 6792 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6793 | bsn_header.subtypes[41] = bsn_set_lacp_request |
| 6794 | |
| 6795 | class bsn_set_mirroring(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6796 | version = 4 |
| 6797 | type = 4 |
| 6798 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6799 | subtype = 3 |
| 6800 | |
| 6801 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6802 | if xid != None: |
| 6803 | self.xid = xid |
| 6804 | else: |
| 6805 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6806 | if report_mirror_ports != None: |
| 6807 | self.report_mirror_ports = report_mirror_ports |
| 6808 | else: |
| 6809 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6810 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6811 | |
| 6812 | def pack(self): |
| 6813 | packed = [] |
| 6814 | packed.append(struct.pack("!B", self.version)) |
| 6815 | packed.append(struct.pack("!B", self.type)) |
| 6816 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6817 | packed.append(struct.pack("!L", self.xid)) |
| 6818 | packed.append(struct.pack("!L", self.experimenter)) |
| 6819 | packed.append(struct.pack("!L", self.subtype)) |
| 6820 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 6821 | packed.append('\x00' * 3) |
| 6822 | length = sum([len(x) for x in packed]) |
| 6823 | packed[2] = struct.pack("!H", length) |
| 6824 | return ''.join(packed) |
| 6825 | |
| 6826 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6827 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6828 | obj = bsn_set_mirroring() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6829 | _version = reader.read("!B")[0] |
| 6830 | assert(_version == 4) |
| 6831 | _type = reader.read("!B")[0] |
| 6832 | assert(_type == 4) |
| 6833 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6834 | orig_reader = reader |
| 6835 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6836 | obj.xid = reader.read("!L")[0] |
| 6837 | _experimenter = reader.read("!L")[0] |
| 6838 | assert(_experimenter == 6035143) |
| 6839 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6840 | assert(_subtype == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6841 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6842 | reader.skip(3) |
| 6843 | return obj |
| 6844 | |
| 6845 | def __eq__(self, other): |
| 6846 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6847 | if self.xid != other.xid: return False |
| 6848 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 6849 | return True |
| 6850 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6851 | def pretty_print(self, q): |
| 6852 | q.text("bsn_set_mirroring {") |
| 6853 | with q.group(): |
| 6854 | with q.indent(2): |
| 6855 | q.breakable() |
| 6856 | q.text("xid = "); |
| 6857 | if self.xid != None: |
| 6858 | q.text("%#x" % self.xid) |
| 6859 | else: |
| 6860 | q.text('None') |
| 6861 | q.text(","); q.breakable() |
| 6862 | q.text("report_mirror_ports = "); |
| 6863 | q.text("%#x" % self.report_mirror_ports) |
| 6864 | q.breakable() |
| 6865 | q.text('}') |
| 6866 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6867 | bsn_header.subtypes[3] = bsn_set_mirroring |
| 6868 | |
| 6869 | class bsn_set_pktin_suppression_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6870 | version = 4 |
| 6871 | type = 4 |
| 6872 | experimenter = 6035143 |
| 6873 | subtype = 25 |
| 6874 | |
| 6875 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6876 | if xid != None: |
| 6877 | self.xid = xid |
| 6878 | else: |
| 6879 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6880 | if status != None: |
| 6881 | self.status = status |
| 6882 | else: |
| 6883 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6884 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6885 | |
| 6886 | def pack(self): |
| 6887 | packed = [] |
| 6888 | packed.append(struct.pack("!B", self.version)) |
| 6889 | packed.append(struct.pack("!B", self.type)) |
| 6890 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6891 | packed.append(struct.pack("!L", self.xid)) |
| 6892 | packed.append(struct.pack("!L", self.experimenter)) |
| 6893 | packed.append(struct.pack("!L", self.subtype)) |
| 6894 | packed.append(struct.pack("!L", self.status)) |
| 6895 | length = sum([len(x) for x in packed]) |
| 6896 | packed[2] = struct.pack("!H", length) |
| 6897 | return ''.join(packed) |
| 6898 | |
| 6899 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6900 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6901 | obj = bsn_set_pktin_suppression_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6902 | _version = reader.read("!B")[0] |
| 6903 | assert(_version == 4) |
| 6904 | _type = reader.read("!B")[0] |
| 6905 | assert(_type == 4) |
| 6906 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6907 | orig_reader = reader |
| 6908 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6909 | obj.xid = reader.read("!L")[0] |
| 6910 | _experimenter = reader.read("!L")[0] |
| 6911 | assert(_experimenter == 6035143) |
| 6912 | _subtype = reader.read("!L")[0] |
| 6913 | assert(_subtype == 25) |
| 6914 | obj.status = reader.read("!L")[0] |
| 6915 | return obj |
| 6916 | |
| 6917 | def __eq__(self, other): |
| 6918 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6919 | if self.xid != other.xid: return False |
| 6920 | if self.status != other.status: return False |
| 6921 | return True |
| 6922 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6923 | def pretty_print(self, q): |
| 6924 | q.text("bsn_set_pktin_suppression_reply {") |
| 6925 | with q.group(): |
| 6926 | with q.indent(2): |
| 6927 | q.breakable() |
| 6928 | q.text("xid = "); |
| 6929 | if self.xid != None: |
| 6930 | q.text("%#x" % self.xid) |
| 6931 | else: |
| 6932 | q.text('None') |
| 6933 | q.text(","); q.breakable() |
| 6934 | q.text("status = "); |
| 6935 | q.text("%#x" % self.status) |
| 6936 | q.breakable() |
| 6937 | q.text('}') |
| 6938 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6939 | bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply |
| 6940 | |
| 6941 | class bsn_set_pktin_suppression_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6942 | version = 4 |
| 6943 | type = 4 |
| 6944 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6945 | subtype = 11 |
| 6946 | |
| 6947 | 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] | 6948 | if xid != None: |
| 6949 | self.xid = xid |
| 6950 | else: |
| 6951 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6952 | if enabled != None: |
| 6953 | self.enabled = enabled |
| 6954 | else: |
| 6955 | self.enabled = 0 |
| 6956 | if idle_timeout != None: |
| 6957 | self.idle_timeout = idle_timeout |
| 6958 | else: |
| 6959 | self.idle_timeout = 0 |
| 6960 | if hard_timeout != None: |
| 6961 | self.hard_timeout = hard_timeout |
| 6962 | else: |
| 6963 | self.hard_timeout = 0 |
| 6964 | if priority != None: |
| 6965 | self.priority = priority |
| 6966 | else: |
| 6967 | self.priority = 0 |
| 6968 | if cookie != None: |
| 6969 | self.cookie = cookie |
| 6970 | else: |
| 6971 | self.cookie = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6972 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6973 | |
| 6974 | def pack(self): |
| 6975 | packed = [] |
| 6976 | packed.append(struct.pack("!B", self.version)) |
| 6977 | packed.append(struct.pack("!B", self.type)) |
| 6978 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6979 | packed.append(struct.pack("!L", self.xid)) |
| 6980 | packed.append(struct.pack("!L", self.experimenter)) |
| 6981 | packed.append(struct.pack("!L", self.subtype)) |
| 6982 | packed.append(struct.pack("!B", self.enabled)) |
| 6983 | packed.append('\x00' * 1) |
| 6984 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 6985 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 6986 | packed.append(struct.pack("!H", self.priority)) |
| 6987 | packed.append(struct.pack("!Q", self.cookie)) |
| 6988 | length = sum([len(x) for x in packed]) |
| 6989 | packed[2] = struct.pack("!H", length) |
| 6990 | return ''.join(packed) |
| 6991 | |
| 6992 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6993 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6994 | obj = bsn_set_pktin_suppression_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6995 | _version = reader.read("!B")[0] |
| 6996 | assert(_version == 4) |
| 6997 | _type = reader.read("!B")[0] |
| 6998 | assert(_type == 4) |
| 6999 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7000 | orig_reader = reader |
| 7001 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7002 | obj.xid = reader.read("!L")[0] |
| 7003 | _experimenter = reader.read("!L")[0] |
| 7004 | assert(_experimenter == 6035143) |
| 7005 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7006 | assert(_subtype == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7007 | obj.enabled = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7008 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7009 | obj.idle_timeout = reader.read("!H")[0] |
| 7010 | obj.hard_timeout = reader.read("!H")[0] |
| 7011 | obj.priority = reader.read("!H")[0] |
| 7012 | obj.cookie = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7013 | return obj |
| 7014 | |
| 7015 | def __eq__(self, other): |
| 7016 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7017 | if self.xid != other.xid: return False |
| 7018 | if self.enabled != other.enabled: return False |
| 7019 | if self.idle_timeout != other.idle_timeout: return False |
| 7020 | if self.hard_timeout != other.hard_timeout: return False |
| 7021 | if self.priority != other.priority: return False |
| 7022 | if self.cookie != other.cookie: return False |
| 7023 | return True |
| 7024 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7025 | def pretty_print(self, q): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7026 | q.text("bsn_set_pktin_suppression_request {") |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7027 | with q.group(): |
| 7028 | with q.indent(2): |
| 7029 | q.breakable() |
| 7030 | q.text("xid = "); |
| 7031 | if self.xid != None: |
| 7032 | q.text("%#x" % self.xid) |
| 7033 | else: |
| 7034 | q.text('None') |
| 7035 | q.text(","); q.breakable() |
| 7036 | q.text("enabled = "); |
| 7037 | q.text("%#x" % self.enabled) |
| 7038 | q.text(","); q.breakable() |
| 7039 | q.text("idle_timeout = "); |
| 7040 | q.text("%#x" % self.idle_timeout) |
| 7041 | q.text(","); q.breakable() |
| 7042 | q.text("hard_timeout = "); |
| 7043 | q.text("%#x" % self.hard_timeout) |
| 7044 | q.text(","); q.breakable() |
| 7045 | q.text("priority = "); |
| 7046 | q.text("%#x" % self.priority) |
| 7047 | q.text(","); q.breakable() |
| 7048 | q.text("cookie = "); |
| 7049 | q.text("%#x" % self.cookie) |
| 7050 | q.breakable() |
| 7051 | q.text('}') |
| 7052 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7053 | bsn_header.subtypes[11] = bsn_set_pktin_suppression_request |
| 7054 | |
| 7055 | class bsn_set_switch_pipeline_reply(bsn_header): |
| 7056 | version = 4 |
| 7057 | type = 4 |
| 7058 | experimenter = 6035143 |
| 7059 | subtype = 54 |
| 7060 | |
| 7061 | def __init__(self, xid=None, status=None): |
| 7062 | if xid != None: |
| 7063 | self.xid = xid |
| 7064 | else: |
| 7065 | self.xid = None |
| 7066 | if status != None: |
| 7067 | self.status = status |
| 7068 | else: |
| 7069 | self.status = 0 |
| 7070 | return |
| 7071 | |
| 7072 | def pack(self): |
| 7073 | packed = [] |
| 7074 | packed.append(struct.pack("!B", self.version)) |
| 7075 | packed.append(struct.pack("!B", self.type)) |
| 7076 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7077 | packed.append(struct.pack("!L", self.xid)) |
| 7078 | packed.append(struct.pack("!L", self.experimenter)) |
| 7079 | packed.append(struct.pack("!L", self.subtype)) |
| 7080 | packed.append(struct.pack("!L", self.status)) |
| 7081 | length = sum([len(x) for x in packed]) |
| 7082 | packed[2] = struct.pack("!H", length) |
| 7083 | return ''.join(packed) |
| 7084 | |
| 7085 | @staticmethod |
| 7086 | def unpack(reader): |
| 7087 | obj = bsn_set_switch_pipeline_reply() |
| 7088 | _version = reader.read("!B")[0] |
| 7089 | assert(_version == 4) |
| 7090 | _type = reader.read("!B")[0] |
| 7091 | assert(_type == 4) |
| 7092 | _length = reader.read("!H")[0] |
| 7093 | orig_reader = reader |
| 7094 | reader = orig_reader.slice(_length - (2 + 2)) |
| 7095 | obj.xid = reader.read("!L")[0] |
| 7096 | _experimenter = reader.read("!L")[0] |
| 7097 | assert(_experimenter == 6035143) |
| 7098 | _subtype = reader.read("!L")[0] |
| 7099 | assert(_subtype == 54) |
| 7100 | obj.status = reader.read("!L")[0] |
| 7101 | return obj |
| 7102 | |
| 7103 | def __eq__(self, other): |
| 7104 | if type(self) != type(other): return False |
| 7105 | if self.xid != other.xid: return False |
| 7106 | if self.status != other.status: return False |
| 7107 | return True |
| 7108 | |
| 7109 | def pretty_print(self, q): |
| 7110 | q.text("bsn_set_switch_pipeline_reply {") |
| 7111 | with q.group(): |
| 7112 | with q.indent(2): |
| 7113 | q.breakable() |
| 7114 | q.text("xid = "); |
| 7115 | if self.xid != None: |
| 7116 | q.text("%#x" % self.xid) |
| 7117 | else: |
| 7118 | q.text('None') |
| 7119 | q.text(","); q.breakable() |
| 7120 | q.text("status = "); |
| 7121 | q.text("%#x" % self.status) |
| 7122 | q.breakable() |
| 7123 | q.text('}') |
| 7124 | |
| 7125 | bsn_header.subtypes[54] = bsn_set_switch_pipeline_reply |
| 7126 | |
| 7127 | class bsn_set_switch_pipeline_request(bsn_header): |
| 7128 | version = 4 |
| 7129 | type = 4 |
| 7130 | experimenter = 6035143 |
| 7131 | subtype = 53 |
| 7132 | |
| 7133 | def __init__(self, xid=None, pipeline=None): |
| 7134 | if xid != None: |
| 7135 | self.xid = xid |
| 7136 | else: |
| 7137 | self.xid = None |
| 7138 | if pipeline != None: |
| 7139 | self.pipeline = pipeline |
| 7140 | else: |
| 7141 | self.pipeline = "" |
| 7142 | return |
| 7143 | |
| 7144 | def pack(self): |
| 7145 | packed = [] |
| 7146 | packed.append(struct.pack("!B", self.version)) |
| 7147 | packed.append(struct.pack("!B", self.type)) |
| 7148 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7149 | packed.append(struct.pack("!L", self.xid)) |
| 7150 | packed.append(struct.pack("!L", self.experimenter)) |
| 7151 | packed.append(struct.pack("!L", self.subtype)) |
| 7152 | packed.append(struct.pack("!256s", self.pipeline)) |
| 7153 | length = sum([len(x) for x in packed]) |
| 7154 | packed[2] = struct.pack("!H", length) |
| 7155 | return ''.join(packed) |
| 7156 | |
| 7157 | @staticmethod |
| 7158 | def unpack(reader): |
| 7159 | obj = bsn_set_switch_pipeline_request() |
| 7160 | _version = reader.read("!B")[0] |
| 7161 | assert(_version == 4) |
| 7162 | _type = reader.read("!B")[0] |
| 7163 | assert(_type == 4) |
| 7164 | _length = reader.read("!H")[0] |
| 7165 | orig_reader = reader |
| 7166 | reader = orig_reader.slice(_length - (2 + 2)) |
| 7167 | obj.xid = reader.read("!L")[0] |
| 7168 | _experimenter = reader.read("!L")[0] |
| 7169 | assert(_experimenter == 6035143) |
| 7170 | _subtype = reader.read("!L")[0] |
| 7171 | assert(_subtype == 53) |
| 7172 | obj.pipeline = reader.read("!256s")[0].rstrip("\x00") |
| 7173 | return obj |
| 7174 | |
| 7175 | def __eq__(self, other): |
| 7176 | if type(self) != type(other): return False |
| 7177 | if self.xid != other.xid: return False |
| 7178 | if self.pipeline != other.pipeline: return False |
| 7179 | return True |
| 7180 | |
| 7181 | def pretty_print(self, q): |
| 7182 | q.text("bsn_set_switch_pipeline_request {") |
| 7183 | with q.group(): |
| 7184 | with q.indent(2): |
| 7185 | q.breakable() |
| 7186 | q.text("xid = "); |
| 7187 | if self.xid != None: |
| 7188 | q.text("%#x" % self.xid) |
| 7189 | else: |
| 7190 | q.text('None') |
| 7191 | q.text(","); q.breakable() |
| 7192 | q.text("pipeline = "); |
| 7193 | q.pp(self.pipeline) |
| 7194 | q.breakable() |
| 7195 | q.text('}') |
| 7196 | |
| 7197 | bsn_header.subtypes[53] = bsn_set_switch_pipeline_request |
| 7198 | |
| 7199 | class bsn_switch_pipeline_stats_reply(bsn_stats_reply): |
| 7200 | version = 4 |
| 7201 | type = 19 |
| 7202 | stats_type = 65535 |
| 7203 | experimenter = 6035143 |
| 7204 | subtype = 6 |
| 7205 | |
| 7206 | def __init__(self, xid=None, flags=None, entries=None): |
| 7207 | if xid != None: |
| 7208 | self.xid = xid |
| 7209 | else: |
| 7210 | self.xid = None |
| 7211 | if flags != None: |
| 7212 | self.flags = flags |
| 7213 | else: |
| 7214 | self.flags = 0 |
| 7215 | if entries != None: |
| 7216 | self.entries = entries |
| 7217 | else: |
| 7218 | self.entries = [] |
| 7219 | return |
| 7220 | |
| 7221 | def pack(self): |
| 7222 | packed = [] |
| 7223 | packed.append(struct.pack("!B", self.version)) |
| 7224 | packed.append(struct.pack("!B", self.type)) |
| 7225 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7226 | packed.append(struct.pack("!L", self.xid)) |
| 7227 | packed.append(struct.pack("!H", self.stats_type)) |
| 7228 | packed.append(struct.pack("!H", self.flags)) |
| 7229 | packed.append('\x00' * 4) |
| 7230 | packed.append(struct.pack("!L", self.experimenter)) |
| 7231 | packed.append(struct.pack("!L", self.subtype)) |
| 7232 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 7233 | length = sum([len(x) for x in packed]) |
| 7234 | packed[2] = struct.pack("!H", length) |
| 7235 | return ''.join(packed) |
| 7236 | |
| 7237 | @staticmethod |
| 7238 | def unpack(reader): |
| 7239 | obj = bsn_switch_pipeline_stats_reply() |
| 7240 | _version = reader.read("!B")[0] |
| 7241 | assert(_version == 4) |
| 7242 | _type = reader.read("!B")[0] |
| 7243 | assert(_type == 19) |
| 7244 | _length = reader.read("!H")[0] |
| 7245 | orig_reader = reader |
| 7246 | reader = orig_reader.slice(_length - (2 + 2)) |
| 7247 | obj.xid = reader.read("!L")[0] |
| 7248 | _stats_type = reader.read("!H")[0] |
| 7249 | assert(_stats_type == 65535) |
| 7250 | obj.flags = reader.read("!H")[0] |
| 7251 | reader.skip(4) |
| 7252 | _experimenter = reader.read("!L")[0] |
| 7253 | assert(_experimenter == 6035143) |
| 7254 | _subtype = reader.read("!L")[0] |
| 7255 | assert(_subtype == 6) |
| 7256 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_switch_pipeline_stats_entry.unpack) |
| 7257 | return obj |
| 7258 | |
| 7259 | def __eq__(self, other): |
| 7260 | if type(self) != type(other): return False |
| 7261 | if self.xid != other.xid: return False |
| 7262 | if self.flags != other.flags: return False |
| 7263 | if self.entries != other.entries: return False |
| 7264 | return True |
| 7265 | |
| 7266 | def pretty_print(self, q): |
| 7267 | q.text("bsn_switch_pipeline_stats_reply {") |
| 7268 | with q.group(): |
| 7269 | with q.indent(2): |
| 7270 | q.breakable() |
| 7271 | q.text("xid = "); |
| 7272 | if self.xid != None: |
| 7273 | q.text("%#x" % self.xid) |
| 7274 | else: |
| 7275 | q.text('None') |
| 7276 | q.text(","); q.breakable() |
| 7277 | q.text("flags = "); |
| 7278 | q.text("%#x" % self.flags) |
| 7279 | q.text(","); q.breakable() |
| 7280 | q.text("entries = "); |
| 7281 | q.pp(self.entries) |
| 7282 | q.breakable() |
| 7283 | q.text('}') |
| 7284 | |
| 7285 | bsn_stats_reply.subtypes[6] = bsn_switch_pipeline_stats_reply |
| 7286 | |
| 7287 | class bsn_switch_pipeline_stats_request(bsn_stats_request): |
| 7288 | version = 4 |
| 7289 | type = 18 |
| 7290 | stats_type = 65535 |
| 7291 | experimenter = 6035143 |
| 7292 | subtype = 6 |
| 7293 | |
| 7294 | def __init__(self, xid=None, flags=None): |
| 7295 | if xid != None: |
| 7296 | self.xid = xid |
| 7297 | else: |
| 7298 | self.xid = None |
| 7299 | if flags != None: |
| 7300 | self.flags = flags |
| 7301 | else: |
| 7302 | self.flags = 0 |
| 7303 | return |
| 7304 | |
| 7305 | def pack(self): |
| 7306 | packed = [] |
| 7307 | packed.append(struct.pack("!B", self.version)) |
| 7308 | packed.append(struct.pack("!B", self.type)) |
| 7309 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7310 | packed.append(struct.pack("!L", self.xid)) |
| 7311 | packed.append(struct.pack("!H", self.stats_type)) |
| 7312 | packed.append(struct.pack("!H", self.flags)) |
| 7313 | packed.append('\x00' * 4) |
| 7314 | packed.append(struct.pack("!L", self.experimenter)) |
| 7315 | packed.append(struct.pack("!L", self.subtype)) |
| 7316 | length = sum([len(x) for x in packed]) |
| 7317 | packed[2] = struct.pack("!H", length) |
| 7318 | return ''.join(packed) |
| 7319 | |
| 7320 | @staticmethod |
| 7321 | def unpack(reader): |
| 7322 | obj = bsn_switch_pipeline_stats_request() |
| 7323 | _version = reader.read("!B")[0] |
| 7324 | assert(_version == 4) |
| 7325 | _type = reader.read("!B")[0] |
| 7326 | assert(_type == 18) |
| 7327 | _length = reader.read("!H")[0] |
| 7328 | orig_reader = reader |
| 7329 | reader = orig_reader.slice(_length - (2 + 2)) |
| 7330 | obj.xid = reader.read("!L")[0] |
| 7331 | _stats_type = reader.read("!H")[0] |
| 7332 | assert(_stats_type == 65535) |
| 7333 | obj.flags = reader.read("!H")[0] |
| 7334 | reader.skip(4) |
| 7335 | _experimenter = reader.read("!L")[0] |
| 7336 | assert(_experimenter == 6035143) |
| 7337 | _subtype = reader.read("!L")[0] |
| 7338 | assert(_subtype == 6) |
| 7339 | return obj |
| 7340 | |
| 7341 | def __eq__(self, other): |
| 7342 | if type(self) != type(other): return False |
| 7343 | if self.xid != other.xid: return False |
| 7344 | if self.flags != other.flags: return False |
| 7345 | return True |
| 7346 | |
| 7347 | def pretty_print(self, q): |
| 7348 | q.text("bsn_switch_pipeline_stats_request {") |
| 7349 | with q.group(): |
| 7350 | with q.indent(2): |
| 7351 | q.breakable() |
| 7352 | q.text("xid = "); |
| 7353 | if self.xid != None: |
| 7354 | q.text("%#x" % self.xid) |
| 7355 | else: |
| 7356 | q.text('None') |
| 7357 | q.text(","); q.breakable() |
| 7358 | q.text("flags = "); |
| 7359 | q.text("%#x" % self.flags) |
| 7360 | q.breakable() |
| 7361 | q.text('}') |
| 7362 | |
| 7363 | bsn_stats_request.subtypes[6] = bsn_switch_pipeline_stats_request |
| 7364 | |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 7365 | class bsn_table_checksum_stats_reply(bsn_stats_reply): |
| 7366 | version = 4 |
| 7367 | type = 19 |
| 7368 | stats_type = 65535 |
| 7369 | experimenter = 6035143 |
| 7370 | subtype = 11 |
| 7371 | |
| 7372 | def __init__(self, xid=None, flags=None, entries=None): |
| 7373 | if xid != None: |
| 7374 | self.xid = xid |
| 7375 | else: |
| 7376 | self.xid = None |
| 7377 | if flags != None: |
| 7378 | self.flags = flags |
| 7379 | else: |
| 7380 | self.flags = 0 |
| 7381 | if entries != None: |
| 7382 | self.entries = entries |
| 7383 | else: |
| 7384 | self.entries = [] |
| 7385 | return |
| 7386 | |
| 7387 | def pack(self): |
| 7388 | packed = [] |
| 7389 | packed.append(struct.pack("!B", self.version)) |
| 7390 | packed.append(struct.pack("!B", self.type)) |
| 7391 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7392 | packed.append(struct.pack("!L", self.xid)) |
| 7393 | packed.append(struct.pack("!H", self.stats_type)) |
| 7394 | packed.append(struct.pack("!H", self.flags)) |
| 7395 | packed.append('\x00' * 4) |
| 7396 | packed.append(struct.pack("!L", self.experimenter)) |
| 7397 | packed.append(struct.pack("!L", self.subtype)) |
| 7398 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 7399 | length = sum([len(x) for x in packed]) |
| 7400 | packed[2] = struct.pack("!H", length) |
| 7401 | return ''.join(packed) |
| 7402 | |
| 7403 | @staticmethod |
| 7404 | def unpack(reader): |
| 7405 | obj = bsn_table_checksum_stats_reply() |
| 7406 | _version = reader.read("!B")[0] |
| 7407 | assert(_version == 4) |
| 7408 | _type = reader.read("!B")[0] |
| 7409 | assert(_type == 19) |
| 7410 | _length = reader.read("!H")[0] |
| 7411 | orig_reader = reader |
| 7412 | reader = orig_reader.slice(_length - (2 + 2)) |
| 7413 | obj.xid = reader.read("!L")[0] |
| 7414 | _stats_type = reader.read("!H")[0] |
| 7415 | assert(_stats_type == 65535) |
| 7416 | obj.flags = reader.read("!H")[0] |
| 7417 | reader.skip(4) |
| 7418 | _experimenter = reader.read("!L")[0] |
| 7419 | assert(_experimenter == 6035143) |
| 7420 | _subtype = reader.read("!L")[0] |
| 7421 | assert(_subtype == 11) |
| 7422 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_table_checksum_stats_entry.unpack) |
| 7423 | return obj |
| 7424 | |
| 7425 | def __eq__(self, other): |
| 7426 | if type(self) != type(other): return False |
| 7427 | if self.xid != other.xid: return False |
| 7428 | if self.flags != other.flags: return False |
| 7429 | if self.entries != other.entries: return False |
| 7430 | return True |
| 7431 | |
| 7432 | def pretty_print(self, q): |
| 7433 | q.text("bsn_table_checksum_stats_reply {") |
| 7434 | with q.group(): |
| 7435 | with q.indent(2): |
| 7436 | q.breakable() |
| 7437 | q.text("xid = "); |
| 7438 | if self.xid != None: |
| 7439 | q.text("%#x" % self.xid) |
| 7440 | else: |
| 7441 | q.text('None') |
| 7442 | q.text(","); q.breakable() |
| 7443 | q.text("flags = "); |
| 7444 | q.text("%#x" % self.flags) |
| 7445 | q.text(","); q.breakable() |
| 7446 | q.text("entries = "); |
| 7447 | q.pp(self.entries) |
| 7448 | q.breakable() |
| 7449 | q.text('}') |
| 7450 | |
| 7451 | bsn_stats_reply.subtypes[11] = bsn_table_checksum_stats_reply |
| 7452 | |
| 7453 | class bsn_table_checksum_stats_request(bsn_stats_request): |
| 7454 | version = 4 |
| 7455 | type = 18 |
| 7456 | stats_type = 65535 |
| 7457 | experimenter = 6035143 |
| 7458 | subtype = 11 |
| 7459 | |
| 7460 | def __init__(self, xid=None, flags=None): |
| 7461 | if xid != None: |
| 7462 | self.xid = xid |
| 7463 | else: |
| 7464 | self.xid = None |
| 7465 | if flags != None: |
| 7466 | self.flags = flags |
| 7467 | else: |
| 7468 | self.flags = 0 |
| 7469 | return |
| 7470 | |
| 7471 | def pack(self): |
| 7472 | packed = [] |
| 7473 | packed.append(struct.pack("!B", self.version)) |
| 7474 | packed.append(struct.pack("!B", self.type)) |
| 7475 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7476 | packed.append(struct.pack("!L", self.xid)) |
| 7477 | packed.append(struct.pack("!H", self.stats_type)) |
| 7478 | packed.append(struct.pack("!H", self.flags)) |
| 7479 | packed.append('\x00' * 4) |
| 7480 | packed.append(struct.pack("!L", self.experimenter)) |
| 7481 | packed.append(struct.pack("!L", self.subtype)) |
| 7482 | length = sum([len(x) for x in packed]) |
| 7483 | packed[2] = struct.pack("!H", length) |
| 7484 | return ''.join(packed) |
| 7485 | |
| 7486 | @staticmethod |
| 7487 | def unpack(reader): |
| 7488 | obj = bsn_table_checksum_stats_request() |
| 7489 | _version = reader.read("!B")[0] |
| 7490 | assert(_version == 4) |
| 7491 | _type = reader.read("!B")[0] |
| 7492 | assert(_type == 18) |
| 7493 | _length = reader.read("!H")[0] |
| 7494 | orig_reader = reader |
| 7495 | reader = orig_reader.slice(_length - (2 + 2)) |
| 7496 | obj.xid = reader.read("!L")[0] |
| 7497 | _stats_type = reader.read("!H")[0] |
| 7498 | assert(_stats_type == 65535) |
| 7499 | obj.flags = reader.read("!H")[0] |
| 7500 | reader.skip(4) |
| 7501 | _experimenter = reader.read("!L")[0] |
| 7502 | assert(_experimenter == 6035143) |
| 7503 | _subtype = reader.read("!L")[0] |
| 7504 | assert(_subtype == 11) |
| 7505 | return obj |
| 7506 | |
| 7507 | def __eq__(self, other): |
| 7508 | if type(self) != type(other): return False |
| 7509 | if self.xid != other.xid: return False |
| 7510 | if self.flags != other.flags: return False |
| 7511 | return True |
| 7512 | |
| 7513 | def pretty_print(self, q): |
| 7514 | q.text("bsn_table_checksum_stats_request {") |
| 7515 | with q.group(): |
| 7516 | with q.indent(2): |
| 7517 | q.breakable() |
| 7518 | q.text("xid = "); |
| 7519 | if self.xid != None: |
| 7520 | q.text("%#x" % self.xid) |
| 7521 | else: |
| 7522 | q.text('None') |
| 7523 | q.text(","); q.breakable() |
| 7524 | q.text("flags = "); |
| 7525 | q.text("%#x" % self.flags) |
| 7526 | q.breakable() |
| 7527 | q.text('}') |
| 7528 | |
| 7529 | bsn_stats_request.subtypes[11] = bsn_table_checksum_stats_request |
| 7530 | |
| 7531 | class bsn_table_set_buckets_size(bsn_header): |
| 7532 | version = 4 |
| 7533 | type = 4 |
| 7534 | experimenter = 6035143 |
| 7535 | subtype = 61 |
| 7536 | |
| 7537 | def __init__(self, xid=None, table_id=None, buckets_size=None): |
| 7538 | if xid != None: |
| 7539 | self.xid = xid |
| 7540 | else: |
| 7541 | self.xid = None |
| 7542 | if table_id != None: |
| 7543 | self.table_id = table_id |
| 7544 | else: |
| 7545 | self.table_id = 0 |
| 7546 | if buckets_size != None: |
| 7547 | self.buckets_size = buckets_size |
| 7548 | else: |
| 7549 | self.buckets_size = 0 |
| 7550 | return |
| 7551 | |
| 7552 | def pack(self): |
| 7553 | packed = [] |
| 7554 | packed.append(struct.pack("!B", self.version)) |
| 7555 | packed.append(struct.pack("!B", self.type)) |
| 7556 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7557 | packed.append(struct.pack("!L", self.xid)) |
| 7558 | packed.append(struct.pack("!L", self.experimenter)) |
| 7559 | packed.append(struct.pack("!L", self.subtype)) |
| 7560 | packed.append(struct.pack("!H", self.table_id)) |
| 7561 | packed.append('\x00' * 2) |
| 7562 | packed.append(struct.pack("!L", self.buckets_size)) |
| 7563 | length = sum([len(x) for x in packed]) |
| 7564 | packed[2] = struct.pack("!H", length) |
| 7565 | return ''.join(packed) |
| 7566 | |
| 7567 | @staticmethod |
| 7568 | def unpack(reader): |
| 7569 | obj = bsn_table_set_buckets_size() |
| 7570 | _version = reader.read("!B")[0] |
| 7571 | assert(_version == 4) |
| 7572 | _type = reader.read("!B")[0] |
| 7573 | assert(_type == 4) |
| 7574 | _length = reader.read("!H")[0] |
| 7575 | orig_reader = reader |
| 7576 | reader = orig_reader.slice(_length - (2 + 2)) |
| 7577 | obj.xid = reader.read("!L")[0] |
| 7578 | _experimenter = reader.read("!L")[0] |
| 7579 | assert(_experimenter == 6035143) |
| 7580 | _subtype = reader.read("!L")[0] |
| 7581 | assert(_subtype == 61) |
| 7582 | obj.table_id = reader.read("!H")[0] |
| 7583 | reader.skip(2) |
| 7584 | obj.buckets_size = reader.read("!L")[0] |
| 7585 | return obj |
| 7586 | |
| 7587 | def __eq__(self, other): |
| 7588 | if type(self) != type(other): return False |
| 7589 | if self.xid != other.xid: return False |
| 7590 | if self.table_id != other.table_id: return False |
| 7591 | if self.buckets_size != other.buckets_size: return False |
| 7592 | return True |
| 7593 | |
| 7594 | def pretty_print(self, q): |
| 7595 | q.text("bsn_table_set_buckets_size {") |
| 7596 | with q.group(): |
| 7597 | with q.indent(2): |
| 7598 | q.breakable() |
| 7599 | q.text("xid = "); |
| 7600 | if self.xid != None: |
| 7601 | q.text("%#x" % self.xid) |
| 7602 | else: |
| 7603 | q.text('None') |
| 7604 | q.text(","); q.breakable() |
| 7605 | q.text("table_id = "); |
| 7606 | q.text("%#x" % self.table_id) |
| 7607 | q.text(","); q.breakable() |
| 7608 | q.text("buckets_size = "); |
| 7609 | q.text("%#x" % self.buckets_size) |
| 7610 | q.breakable() |
| 7611 | q.text('}') |
| 7612 | |
| 7613 | bsn_header.subtypes[61] = bsn_table_set_buckets_size |
| 7614 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7615 | class bsn_time_reply(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7616 | version = 4 |
| 7617 | type = 4 |
| 7618 | experimenter = 6035143 |
| 7619 | subtype = 45 |
| 7620 | |
| 7621 | def __init__(self, xid=None, time_ms=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7622 | if xid != None: |
| 7623 | self.xid = xid |
| 7624 | else: |
| 7625 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7626 | if time_ms != None: |
| 7627 | self.time_ms = time_ms |
| 7628 | else: |
| 7629 | self.time_ms = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7630 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7631 | |
| 7632 | def pack(self): |
| 7633 | packed = [] |
| 7634 | packed.append(struct.pack("!B", self.version)) |
| 7635 | packed.append(struct.pack("!B", self.type)) |
| 7636 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7637 | packed.append(struct.pack("!L", self.xid)) |
| 7638 | packed.append(struct.pack("!L", self.experimenter)) |
| 7639 | packed.append(struct.pack("!L", self.subtype)) |
| 7640 | packed.append(struct.pack("!Q", self.time_ms)) |
| 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 | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7647 | obj = bsn_time_reply() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7648 | _version = reader.read("!B")[0] |
| 7649 | assert(_version == 4) |
| 7650 | _type = reader.read("!B")[0] |
| 7651 | assert(_type == 4) |
| 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)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7655 | obj.xid = reader.read("!L")[0] |
| 7656 | _experimenter = reader.read("!L")[0] |
| 7657 | assert(_experimenter == 6035143) |
| 7658 | _subtype = reader.read("!L")[0] |
| 7659 | assert(_subtype == 45) |
| 7660 | obj.time_ms = reader.read("!Q")[0] |
| 7661 | return obj |
| 7662 | |
| 7663 | def __eq__(self, other): |
| 7664 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7665 | if self.xid != other.xid: return False |
| 7666 | if self.time_ms != other.time_ms: return False |
| 7667 | return True |
| 7668 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7669 | def pretty_print(self, q): |
| 7670 | q.text("bsn_time_reply {") |
| 7671 | with q.group(): |
| 7672 | with q.indent(2): |
| 7673 | q.breakable() |
| 7674 | q.text("xid = "); |
| 7675 | if self.xid != None: |
| 7676 | q.text("%#x" % self.xid) |
| 7677 | else: |
| 7678 | q.text('None') |
| 7679 | q.text(","); q.breakable() |
| 7680 | q.text("time_ms = "); |
| 7681 | q.text("%#x" % self.time_ms) |
| 7682 | q.breakable() |
| 7683 | q.text('}') |
| 7684 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7685 | bsn_header.subtypes[45] = bsn_time_reply |
| 7686 | |
| 7687 | class bsn_time_request(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7688 | version = 4 |
| 7689 | type = 4 |
| 7690 | experimenter = 6035143 |
| 7691 | subtype = 44 |
| 7692 | |
| 7693 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7694 | if xid != None: |
| 7695 | self.xid = xid |
| 7696 | else: |
| 7697 | self.xid = None |
| 7698 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7699 | |
| 7700 | def pack(self): |
| 7701 | packed = [] |
| 7702 | packed.append(struct.pack("!B", self.version)) |
| 7703 | packed.append(struct.pack("!B", self.type)) |
| 7704 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7705 | packed.append(struct.pack("!L", self.xid)) |
| 7706 | packed.append(struct.pack("!L", self.experimenter)) |
| 7707 | packed.append(struct.pack("!L", self.subtype)) |
| 7708 | length = sum([len(x) for x in packed]) |
| 7709 | packed[2] = struct.pack("!H", length) |
| 7710 | return ''.join(packed) |
| 7711 | |
| 7712 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7713 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7714 | obj = bsn_time_request() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7715 | _version = reader.read("!B")[0] |
| 7716 | assert(_version == 4) |
| 7717 | _type = reader.read("!B")[0] |
| 7718 | assert(_type == 4) |
| 7719 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7720 | orig_reader = reader |
| 7721 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7722 | obj.xid = reader.read("!L")[0] |
| 7723 | _experimenter = reader.read("!L")[0] |
| 7724 | assert(_experimenter == 6035143) |
| 7725 | _subtype = reader.read("!L")[0] |
| 7726 | assert(_subtype == 44) |
| 7727 | return obj |
| 7728 | |
| 7729 | def __eq__(self, other): |
| 7730 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7731 | if self.xid != other.xid: return False |
| 7732 | return True |
| 7733 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7734 | def pretty_print(self, q): |
| 7735 | q.text("bsn_time_request {") |
| 7736 | with q.group(): |
| 7737 | with q.indent(2): |
| 7738 | q.breakable() |
| 7739 | q.text("xid = "); |
| 7740 | if self.xid != None: |
| 7741 | q.text("%#x" % self.xid) |
| 7742 | else: |
| 7743 | q.text('None') |
| 7744 | q.breakable() |
| 7745 | q.text('}') |
| 7746 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7747 | bsn_header.subtypes[44] = bsn_time_request |
| 7748 | |
| 7749 | class bsn_virtual_port_create_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7750 | version = 4 |
| 7751 | type = 4 |
| 7752 | experimenter = 6035143 |
| 7753 | subtype = 16 |
| 7754 | |
| 7755 | def __init__(self, xid=None, status=None, vport_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7756 | if xid != None: |
| 7757 | self.xid = xid |
| 7758 | else: |
| 7759 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7760 | if status != None: |
| 7761 | self.status = status |
| 7762 | else: |
| 7763 | self.status = 0 |
| 7764 | if vport_no != None: |
| 7765 | self.vport_no = vport_no |
| 7766 | else: |
| 7767 | self.vport_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7768 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7769 | |
| 7770 | def pack(self): |
| 7771 | packed = [] |
| 7772 | packed.append(struct.pack("!B", self.version)) |
| 7773 | packed.append(struct.pack("!B", self.type)) |
| 7774 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7775 | packed.append(struct.pack("!L", self.xid)) |
| 7776 | packed.append(struct.pack("!L", self.experimenter)) |
| 7777 | packed.append(struct.pack("!L", self.subtype)) |
| 7778 | packed.append(struct.pack("!L", self.status)) |
| 7779 | packed.append(struct.pack("!L", self.vport_no)) |
| 7780 | length = sum([len(x) for x in packed]) |
| 7781 | packed[2] = struct.pack("!H", length) |
| 7782 | return ''.join(packed) |
| 7783 | |
| 7784 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7785 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7786 | obj = bsn_virtual_port_create_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7787 | _version = reader.read("!B")[0] |
| 7788 | assert(_version == 4) |
| 7789 | _type = reader.read("!B")[0] |
| 7790 | assert(_type == 4) |
| 7791 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7792 | orig_reader = reader |
| 7793 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7794 | obj.xid = reader.read("!L")[0] |
| 7795 | _experimenter = reader.read("!L")[0] |
| 7796 | assert(_experimenter == 6035143) |
| 7797 | _subtype = reader.read("!L")[0] |
| 7798 | assert(_subtype == 16) |
| 7799 | obj.status = reader.read("!L")[0] |
| 7800 | obj.vport_no = reader.read("!L")[0] |
| 7801 | return obj |
| 7802 | |
| 7803 | def __eq__(self, other): |
| 7804 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7805 | if self.xid != other.xid: return False |
| 7806 | if self.status != other.status: return False |
| 7807 | if self.vport_no != other.vport_no: return False |
| 7808 | return True |
| 7809 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7810 | def pretty_print(self, q): |
| 7811 | q.text("bsn_virtual_port_create_reply {") |
| 7812 | with q.group(): |
| 7813 | with q.indent(2): |
| 7814 | q.breakable() |
| 7815 | q.text("xid = "); |
| 7816 | if self.xid != None: |
| 7817 | q.text("%#x" % self.xid) |
| 7818 | else: |
| 7819 | q.text('None') |
| 7820 | q.text(","); q.breakable() |
| 7821 | q.text("status = "); |
| 7822 | q.text("%#x" % self.status) |
| 7823 | q.text(","); q.breakable() |
| 7824 | q.text("vport_no = "); |
| 7825 | q.text("%#x" % self.vport_no) |
| 7826 | q.breakable() |
| 7827 | q.text('}') |
| 7828 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7829 | bsn_header.subtypes[16] = bsn_virtual_port_create_reply |
| 7830 | |
| 7831 | class bsn_virtual_port_create_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7832 | version = 4 |
| 7833 | type = 4 |
| 7834 | experimenter = 6035143 |
| 7835 | subtype = 15 |
| 7836 | |
| 7837 | def __init__(self, xid=None, vport=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7838 | if xid != None: |
| 7839 | self.xid = xid |
| 7840 | else: |
| 7841 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7842 | if vport != None: |
| 7843 | self.vport = vport |
| 7844 | else: |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 7845 | self.vport = common.bsn_vport() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7846 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7847 | |
| 7848 | def pack(self): |
| 7849 | packed = [] |
| 7850 | packed.append(struct.pack("!B", self.version)) |
| 7851 | packed.append(struct.pack("!B", self.type)) |
| 7852 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7853 | packed.append(struct.pack("!L", self.xid)) |
| 7854 | packed.append(struct.pack("!L", self.experimenter)) |
| 7855 | packed.append(struct.pack("!L", self.subtype)) |
| 7856 | packed.append(self.vport.pack()) |
| 7857 | length = sum([len(x) for x in packed]) |
| 7858 | packed[2] = struct.pack("!H", length) |
| 7859 | return ''.join(packed) |
| 7860 | |
| 7861 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7862 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7863 | obj = bsn_virtual_port_create_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7864 | _version = reader.read("!B")[0] |
| 7865 | assert(_version == 4) |
| 7866 | _type = reader.read("!B")[0] |
| 7867 | assert(_type == 4) |
| 7868 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7869 | orig_reader = reader |
| 7870 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7871 | obj.xid = reader.read("!L")[0] |
| 7872 | _experimenter = reader.read("!L")[0] |
| 7873 | assert(_experimenter == 6035143) |
| 7874 | _subtype = reader.read("!L")[0] |
| 7875 | assert(_subtype == 15) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 7876 | obj.vport = common.bsn_vport.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7877 | return obj |
| 7878 | |
| 7879 | def __eq__(self, other): |
| 7880 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7881 | if self.xid != other.xid: return False |
| 7882 | if self.vport != other.vport: return False |
| 7883 | return True |
| 7884 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7885 | def pretty_print(self, q): |
| 7886 | q.text("bsn_virtual_port_create_request {") |
| 7887 | with q.group(): |
| 7888 | with q.indent(2): |
| 7889 | q.breakable() |
| 7890 | q.text("xid = "); |
| 7891 | if self.xid != None: |
| 7892 | q.text("%#x" % self.xid) |
| 7893 | else: |
| 7894 | q.text('None') |
| 7895 | q.text(","); q.breakable() |
| 7896 | q.text("vport = "); |
| 7897 | q.pp(self.vport) |
| 7898 | q.breakable() |
| 7899 | q.text('}') |
| 7900 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7901 | bsn_header.subtypes[15] = bsn_virtual_port_create_request |
| 7902 | |
| 7903 | class bsn_virtual_port_remove_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7904 | version = 4 |
| 7905 | type = 4 |
| 7906 | experimenter = 6035143 |
| 7907 | subtype = 26 |
| 7908 | |
| 7909 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7910 | if xid != None: |
| 7911 | self.xid = xid |
| 7912 | else: |
| 7913 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7914 | if status != None: |
| 7915 | self.status = status |
| 7916 | else: |
| 7917 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7918 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7919 | |
| 7920 | def pack(self): |
| 7921 | packed = [] |
| 7922 | packed.append(struct.pack("!B", self.version)) |
| 7923 | packed.append(struct.pack("!B", self.type)) |
| 7924 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7925 | packed.append(struct.pack("!L", self.xid)) |
| 7926 | packed.append(struct.pack("!L", self.experimenter)) |
| 7927 | packed.append(struct.pack("!L", self.subtype)) |
| 7928 | packed.append(struct.pack("!L", self.status)) |
| 7929 | length = sum([len(x) for x in packed]) |
| 7930 | packed[2] = struct.pack("!H", length) |
| 7931 | return ''.join(packed) |
| 7932 | |
| 7933 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7934 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7935 | obj = bsn_virtual_port_remove_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7936 | _version = reader.read("!B")[0] |
| 7937 | assert(_version == 4) |
| 7938 | _type = reader.read("!B")[0] |
| 7939 | assert(_type == 4) |
| 7940 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7941 | orig_reader = reader |
| 7942 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7943 | obj.xid = reader.read("!L")[0] |
| 7944 | _experimenter = reader.read("!L")[0] |
| 7945 | assert(_experimenter == 6035143) |
| 7946 | _subtype = reader.read("!L")[0] |
| 7947 | assert(_subtype == 26) |
| 7948 | obj.status = reader.read("!L")[0] |
| 7949 | return obj |
| 7950 | |
| 7951 | def __eq__(self, other): |
| 7952 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7953 | if self.xid != other.xid: return False |
| 7954 | if self.status != other.status: return False |
| 7955 | return True |
| 7956 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7957 | def pretty_print(self, q): |
| 7958 | q.text("bsn_virtual_port_remove_reply {") |
| 7959 | with q.group(): |
| 7960 | with q.indent(2): |
| 7961 | q.breakable() |
| 7962 | q.text("xid = "); |
| 7963 | if self.xid != None: |
| 7964 | q.text("%#x" % self.xid) |
| 7965 | else: |
| 7966 | q.text('None') |
| 7967 | q.text(","); q.breakable() |
| 7968 | q.text("status = "); |
| 7969 | q.text("%#x" % self.status) |
| 7970 | q.breakable() |
| 7971 | q.text('}') |
| 7972 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7973 | bsn_header.subtypes[26] = bsn_virtual_port_remove_reply |
| 7974 | |
| 7975 | class bsn_virtual_port_remove_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7976 | version = 4 |
| 7977 | type = 4 |
| 7978 | experimenter = 6035143 |
| 7979 | subtype = 17 |
| 7980 | |
| 7981 | def __init__(self, xid=None, vport_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7982 | if xid != None: |
| 7983 | self.xid = xid |
| 7984 | else: |
| 7985 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7986 | if vport_no != None: |
| 7987 | self.vport_no = vport_no |
| 7988 | else: |
| 7989 | self.vport_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7990 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7991 | |
| 7992 | def pack(self): |
| 7993 | packed = [] |
| 7994 | packed.append(struct.pack("!B", self.version)) |
| 7995 | packed.append(struct.pack("!B", self.type)) |
| 7996 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7997 | packed.append(struct.pack("!L", self.xid)) |
| 7998 | packed.append(struct.pack("!L", self.experimenter)) |
| 7999 | packed.append(struct.pack("!L", self.subtype)) |
| 8000 | packed.append(struct.pack("!L", self.vport_no)) |
| 8001 | length = sum([len(x) for x in packed]) |
| 8002 | packed[2] = struct.pack("!H", length) |
| 8003 | return ''.join(packed) |
| 8004 | |
| 8005 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8006 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8007 | obj = bsn_virtual_port_remove_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8008 | _version = reader.read("!B")[0] |
| 8009 | assert(_version == 4) |
| 8010 | _type = reader.read("!B")[0] |
| 8011 | assert(_type == 4) |
| 8012 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8013 | orig_reader = reader |
| 8014 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8015 | obj.xid = reader.read("!L")[0] |
| 8016 | _experimenter = reader.read("!L")[0] |
| 8017 | assert(_experimenter == 6035143) |
| 8018 | _subtype = reader.read("!L")[0] |
| 8019 | assert(_subtype == 17) |
| 8020 | obj.vport_no = reader.read("!L")[0] |
| 8021 | return obj |
| 8022 | |
| 8023 | def __eq__(self, other): |
| 8024 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8025 | if self.xid != other.xid: return False |
| 8026 | if self.vport_no != other.vport_no: return False |
| 8027 | return True |
| 8028 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8029 | def pretty_print(self, q): |
| 8030 | q.text("bsn_virtual_port_remove_request {") |
| 8031 | with q.group(): |
| 8032 | with q.indent(2): |
| 8033 | q.breakable() |
| 8034 | q.text("xid = "); |
| 8035 | if self.xid != None: |
| 8036 | q.text("%#x" % self.xid) |
| 8037 | else: |
| 8038 | q.text('None') |
| 8039 | q.text(","); q.breakable() |
| 8040 | q.text("vport_no = "); |
| 8041 | q.text("%#x" % self.vport_no) |
| 8042 | q.breakable() |
| 8043 | q.text('}') |
| 8044 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8045 | bsn_header.subtypes[17] = bsn_virtual_port_remove_request |
| 8046 | |
| 8047 | class bsn_vlan_counter_stats_reply(bsn_stats_reply): |
| 8048 | version = 4 |
| 8049 | type = 19 |
| 8050 | stats_type = 65535 |
| 8051 | experimenter = 6035143 |
| 8052 | subtype = 9 |
| 8053 | |
| 8054 | def __init__(self, xid=None, flags=None, entries=None): |
| 8055 | if xid != None: |
| 8056 | self.xid = xid |
| 8057 | else: |
| 8058 | self.xid = None |
| 8059 | if flags != None: |
| 8060 | self.flags = flags |
| 8061 | else: |
| 8062 | self.flags = 0 |
| 8063 | if entries != None: |
| 8064 | self.entries = entries |
| 8065 | else: |
| 8066 | self.entries = [] |
| 8067 | return |
| 8068 | |
| 8069 | def pack(self): |
| 8070 | packed = [] |
| 8071 | packed.append(struct.pack("!B", self.version)) |
| 8072 | packed.append(struct.pack("!B", self.type)) |
| 8073 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8074 | packed.append(struct.pack("!L", self.xid)) |
| 8075 | packed.append(struct.pack("!H", self.stats_type)) |
| 8076 | packed.append(struct.pack("!H", self.flags)) |
| 8077 | packed.append('\x00' * 4) |
| 8078 | packed.append(struct.pack("!L", self.experimenter)) |
| 8079 | packed.append(struct.pack("!L", self.subtype)) |
| 8080 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 8081 | length = sum([len(x) for x in packed]) |
| 8082 | packed[2] = struct.pack("!H", length) |
| 8083 | return ''.join(packed) |
| 8084 | |
| 8085 | @staticmethod |
| 8086 | def unpack(reader): |
| 8087 | obj = bsn_vlan_counter_stats_reply() |
| 8088 | _version = reader.read("!B")[0] |
| 8089 | assert(_version == 4) |
| 8090 | _type = reader.read("!B")[0] |
| 8091 | assert(_type == 19) |
| 8092 | _length = reader.read("!H")[0] |
| 8093 | orig_reader = reader |
| 8094 | reader = orig_reader.slice(_length - (2 + 2)) |
| 8095 | obj.xid = reader.read("!L")[0] |
| 8096 | _stats_type = reader.read("!H")[0] |
| 8097 | assert(_stats_type == 65535) |
| 8098 | obj.flags = reader.read("!H")[0] |
| 8099 | reader.skip(4) |
| 8100 | _experimenter = reader.read("!L")[0] |
| 8101 | assert(_experimenter == 6035143) |
| 8102 | _subtype = reader.read("!L")[0] |
| 8103 | assert(_subtype == 9) |
| 8104 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_vlan_counter_stats_entry.unpack) |
| 8105 | return obj |
| 8106 | |
| 8107 | def __eq__(self, other): |
| 8108 | if type(self) != type(other): return False |
| 8109 | if self.xid != other.xid: return False |
| 8110 | if self.flags != other.flags: return False |
| 8111 | if self.entries != other.entries: return False |
| 8112 | return True |
| 8113 | |
| 8114 | def pretty_print(self, q): |
| 8115 | q.text("bsn_vlan_counter_stats_reply {") |
| 8116 | with q.group(): |
| 8117 | with q.indent(2): |
| 8118 | q.breakable() |
| 8119 | q.text("xid = "); |
| 8120 | if self.xid != None: |
| 8121 | q.text("%#x" % self.xid) |
| 8122 | else: |
| 8123 | q.text('None') |
| 8124 | q.text(","); q.breakable() |
| 8125 | q.text("flags = "); |
| 8126 | q.text("%#x" % self.flags) |
| 8127 | q.text(","); q.breakable() |
| 8128 | q.text("entries = "); |
| 8129 | q.pp(self.entries) |
| 8130 | q.breakable() |
| 8131 | q.text('}') |
| 8132 | |
| 8133 | bsn_stats_reply.subtypes[9] = bsn_vlan_counter_stats_reply |
| 8134 | |
| 8135 | class bsn_vlan_counter_stats_request(bsn_stats_request): |
| 8136 | version = 4 |
| 8137 | type = 18 |
| 8138 | stats_type = 65535 |
| 8139 | experimenter = 6035143 |
| 8140 | subtype = 9 |
| 8141 | |
| 8142 | def __init__(self, xid=None, flags=None, vlan_vid=None): |
| 8143 | if xid != None: |
| 8144 | self.xid = xid |
| 8145 | else: |
| 8146 | self.xid = None |
| 8147 | if flags != None: |
| 8148 | self.flags = flags |
| 8149 | else: |
| 8150 | self.flags = 0 |
| 8151 | if vlan_vid != None: |
| 8152 | self.vlan_vid = vlan_vid |
| 8153 | else: |
| 8154 | self.vlan_vid = 0 |
| 8155 | return |
| 8156 | |
| 8157 | def pack(self): |
| 8158 | packed = [] |
| 8159 | packed.append(struct.pack("!B", self.version)) |
| 8160 | packed.append(struct.pack("!B", self.type)) |
| 8161 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8162 | packed.append(struct.pack("!L", self.xid)) |
| 8163 | packed.append(struct.pack("!H", self.stats_type)) |
| 8164 | packed.append(struct.pack("!H", self.flags)) |
| 8165 | packed.append('\x00' * 4) |
| 8166 | packed.append(struct.pack("!L", self.experimenter)) |
| 8167 | packed.append(struct.pack("!L", self.subtype)) |
| 8168 | packed.append(struct.pack("!H", self.vlan_vid)) |
| 8169 | length = sum([len(x) for x in packed]) |
| 8170 | packed[2] = struct.pack("!H", length) |
| 8171 | return ''.join(packed) |
| 8172 | |
| 8173 | @staticmethod |
| 8174 | def unpack(reader): |
| 8175 | obj = bsn_vlan_counter_stats_request() |
| 8176 | _version = reader.read("!B")[0] |
| 8177 | assert(_version == 4) |
| 8178 | _type = reader.read("!B")[0] |
| 8179 | assert(_type == 18) |
| 8180 | _length = reader.read("!H")[0] |
| 8181 | orig_reader = reader |
| 8182 | reader = orig_reader.slice(_length - (2 + 2)) |
| 8183 | obj.xid = reader.read("!L")[0] |
| 8184 | _stats_type = reader.read("!H")[0] |
| 8185 | assert(_stats_type == 65535) |
| 8186 | obj.flags = reader.read("!H")[0] |
| 8187 | reader.skip(4) |
| 8188 | _experimenter = reader.read("!L")[0] |
| 8189 | assert(_experimenter == 6035143) |
| 8190 | _subtype = reader.read("!L")[0] |
| 8191 | assert(_subtype == 9) |
| 8192 | obj.vlan_vid = reader.read("!H")[0] |
| 8193 | return obj |
| 8194 | |
| 8195 | def __eq__(self, other): |
| 8196 | if type(self) != type(other): return False |
| 8197 | if self.xid != other.xid: return False |
| 8198 | if self.flags != other.flags: return False |
| 8199 | if self.vlan_vid != other.vlan_vid: return False |
| 8200 | return True |
| 8201 | |
| 8202 | def pretty_print(self, q): |
| 8203 | q.text("bsn_vlan_counter_stats_request {") |
| 8204 | with q.group(): |
| 8205 | with q.indent(2): |
| 8206 | q.breakable() |
| 8207 | q.text("xid = "); |
| 8208 | if self.xid != None: |
| 8209 | q.text("%#x" % self.xid) |
| 8210 | else: |
| 8211 | q.text('None') |
| 8212 | q.text(","); q.breakable() |
| 8213 | q.text("flags = "); |
| 8214 | q.text("%#x" % self.flags) |
| 8215 | q.text(","); q.breakable() |
| 8216 | q.text("vlan_vid = "); |
| 8217 | q.text("%#x" % self.vlan_vid) |
| 8218 | q.breakable() |
| 8219 | q.text('}') |
| 8220 | |
| 8221 | bsn_stats_request.subtypes[9] = bsn_vlan_counter_stats_request |
| 8222 | |
| 8223 | class desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8224 | version = 4 |
| 8225 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8226 | stats_type = 0 |
| 8227 | |
| 8228 | 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] | 8229 | if xid != None: |
| 8230 | self.xid = xid |
| 8231 | else: |
| 8232 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8233 | if flags != None: |
| 8234 | self.flags = flags |
| 8235 | else: |
| 8236 | self.flags = 0 |
| 8237 | if mfr_desc != None: |
| 8238 | self.mfr_desc = mfr_desc |
| 8239 | else: |
| 8240 | self.mfr_desc = "" |
| 8241 | if hw_desc != None: |
| 8242 | self.hw_desc = hw_desc |
| 8243 | else: |
| 8244 | self.hw_desc = "" |
| 8245 | if sw_desc != None: |
| 8246 | self.sw_desc = sw_desc |
| 8247 | else: |
| 8248 | self.sw_desc = "" |
| 8249 | if serial_num != None: |
| 8250 | self.serial_num = serial_num |
| 8251 | else: |
| 8252 | self.serial_num = "" |
| 8253 | if dp_desc != None: |
| 8254 | self.dp_desc = dp_desc |
| 8255 | else: |
| 8256 | self.dp_desc = "" |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8257 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8258 | |
| 8259 | def pack(self): |
| 8260 | packed = [] |
| 8261 | packed.append(struct.pack("!B", self.version)) |
| 8262 | packed.append(struct.pack("!B", self.type)) |
| 8263 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8264 | packed.append(struct.pack("!L", self.xid)) |
| 8265 | packed.append(struct.pack("!H", self.stats_type)) |
| 8266 | packed.append(struct.pack("!H", self.flags)) |
| 8267 | packed.append('\x00' * 4) |
| 8268 | packed.append(struct.pack("!256s", self.mfr_desc)) |
| 8269 | packed.append(struct.pack("!256s", self.hw_desc)) |
| 8270 | packed.append(struct.pack("!256s", self.sw_desc)) |
| 8271 | packed.append(struct.pack("!32s", self.serial_num)) |
| 8272 | packed.append(struct.pack("!256s", self.dp_desc)) |
| 8273 | length = sum([len(x) for x in packed]) |
| 8274 | packed[2] = struct.pack("!H", length) |
| 8275 | return ''.join(packed) |
| 8276 | |
| 8277 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8278 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8279 | obj = desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8280 | _version = reader.read("!B")[0] |
| 8281 | assert(_version == 4) |
| 8282 | _type = reader.read("!B")[0] |
| 8283 | assert(_type == 19) |
| 8284 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8285 | orig_reader = reader |
| 8286 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8287 | obj.xid = reader.read("!L")[0] |
| 8288 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8289 | assert(_stats_type == 0) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8290 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8291 | reader.skip(4) |
| 8292 | obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00") |
| 8293 | obj.hw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 8294 | obj.sw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 8295 | obj.serial_num = reader.read("!32s")[0].rstrip("\x00") |
| 8296 | obj.dp_desc = reader.read("!256s")[0].rstrip("\x00") |
| 8297 | return obj |
| 8298 | |
| 8299 | def __eq__(self, other): |
| 8300 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8301 | if self.xid != other.xid: return False |
| 8302 | if self.flags != other.flags: return False |
| 8303 | if self.mfr_desc != other.mfr_desc: return False |
| 8304 | if self.hw_desc != other.hw_desc: return False |
| 8305 | if self.sw_desc != other.sw_desc: return False |
| 8306 | if self.serial_num != other.serial_num: return False |
| 8307 | if self.dp_desc != other.dp_desc: return False |
| 8308 | return True |
| 8309 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8310 | def pretty_print(self, q): |
| 8311 | q.text("desc_stats_reply {") |
| 8312 | with q.group(): |
| 8313 | with q.indent(2): |
| 8314 | q.breakable() |
| 8315 | q.text("xid = "); |
| 8316 | if self.xid != None: |
| 8317 | q.text("%#x" % self.xid) |
| 8318 | else: |
| 8319 | q.text('None') |
| 8320 | q.text(","); q.breakable() |
| 8321 | q.text("flags = "); |
| 8322 | q.text("%#x" % self.flags) |
| 8323 | q.text(","); q.breakable() |
| 8324 | q.text("mfr_desc = "); |
| 8325 | q.pp(self.mfr_desc) |
| 8326 | q.text(","); q.breakable() |
| 8327 | q.text("hw_desc = "); |
| 8328 | q.pp(self.hw_desc) |
| 8329 | q.text(","); q.breakable() |
| 8330 | q.text("sw_desc = "); |
| 8331 | q.pp(self.sw_desc) |
| 8332 | q.text(","); q.breakable() |
| 8333 | q.text("serial_num = "); |
| 8334 | q.pp(self.serial_num) |
| 8335 | q.text(","); q.breakable() |
| 8336 | q.text("dp_desc = "); |
| 8337 | q.pp(self.dp_desc) |
| 8338 | q.breakable() |
| 8339 | q.text('}') |
| 8340 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8341 | stats_reply.subtypes[0] = desc_stats_reply |
| 8342 | |
| 8343 | class desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8344 | version = 4 |
| 8345 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8346 | stats_type = 0 |
| 8347 | |
| 8348 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8349 | if xid != None: |
| 8350 | self.xid = xid |
| 8351 | else: |
| 8352 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8353 | if flags != None: |
| 8354 | self.flags = flags |
| 8355 | else: |
| 8356 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8357 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8358 | |
| 8359 | def pack(self): |
| 8360 | packed = [] |
| 8361 | packed.append(struct.pack("!B", self.version)) |
| 8362 | packed.append(struct.pack("!B", self.type)) |
| 8363 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8364 | packed.append(struct.pack("!L", self.xid)) |
| 8365 | packed.append(struct.pack("!H", self.stats_type)) |
| 8366 | packed.append(struct.pack("!H", self.flags)) |
| 8367 | packed.append('\x00' * 4) |
| 8368 | length = sum([len(x) for x in packed]) |
| 8369 | packed[2] = struct.pack("!H", length) |
| 8370 | return ''.join(packed) |
| 8371 | |
| 8372 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8373 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8374 | obj = desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8375 | _version = reader.read("!B")[0] |
| 8376 | assert(_version == 4) |
| 8377 | _type = reader.read("!B")[0] |
| 8378 | assert(_type == 18) |
| 8379 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8380 | orig_reader = reader |
| 8381 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8382 | obj.xid = reader.read("!L")[0] |
| 8383 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8384 | assert(_stats_type == 0) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8385 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8386 | reader.skip(4) |
| 8387 | return obj |
| 8388 | |
| 8389 | def __eq__(self, other): |
| 8390 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8391 | if self.xid != other.xid: return False |
| 8392 | if self.flags != other.flags: return False |
| 8393 | return True |
| 8394 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8395 | def pretty_print(self, q): |
| 8396 | q.text("desc_stats_request {") |
| 8397 | with q.group(): |
| 8398 | with q.indent(2): |
| 8399 | q.breakable() |
| 8400 | q.text("xid = "); |
| 8401 | if self.xid != None: |
| 8402 | q.text("%#x" % self.xid) |
| 8403 | else: |
| 8404 | q.text('None') |
| 8405 | q.text(","); q.breakable() |
| 8406 | q.text("flags = "); |
| 8407 | q.text("%#x" % self.flags) |
| 8408 | q.breakable() |
| 8409 | q.text('}') |
| 8410 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8411 | stats_request.subtypes[0] = desc_stats_request |
| 8412 | |
| 8413 | class echo_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8414 | version = 4 |
| 8415 | type = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8416 | |
| 8417 | def __init__(self, xid=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8418 | if xid != None: |
| 8419 | self.xid = xid |
| 8420 | else: |
| 8421 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8422 | if data != None: |
| 8423 | self.data = data |
| 8424 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8425 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8426 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8427 | |
| 8428 | def pack(self): |
| 8429 | packed = [] |
| 8430 | packed.append(struct.pack("!B", self.version)) |
| 8431 | packed.append(struct.pack("!B", self.type)) |
| 8432 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8433 | packed.append(struct.pack("!L", self.xid)) |
| 8434 | packed.append(self.data) |
| 8435 | length = sum([len(x) for x in packed]) |
| 8436 | packed[2] = struct.pack("!H", length) |
| 8437 | return ''.join(packed) |
| 8438 | |
| 8439 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8440 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8441 | obj = echo_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8442 | _version = reader.read("!B")[0] |
| 8443 | assert(_version == 4) |
| 8444 | _type = reader.read("!B")[0] |
| 8445 | assert(_type == 3) |
| 8446 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8447 | orig_reader = reader |
| 8448 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8449 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8450 | obj.data = str(reader.read_all()) |
| 8451 | return obj |
| 8452 | |
| 8453 | def __eq__(self, other): |
| 8454 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8455 | if self.xid != other.xid: return False |
| 8456 | if self.data != other.data: return False |
| 8457 | return True |
| 8458 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8459 | def pretty_print(self, q): |
| 8460 | q.text("echo_reply {") |
| 8461 | with q.group(): |
| 8462 | with q.indent(2): |
| 8463 | q.breakable() |
| 8464 | q.text("xid = "); |
| 8465 | if self.xid != None: |
| 8466 | q.text("%#x" % self.xid) |
| 8467 | else: |
| 8468 | q.text('None') |
| 8469 | q.text(","); q.breakable() |
| 8470 | q.text("data = "); |
| 8471 | q.pp(self.data) |
| 8472 | q.breakable() |
| 8473 | q.text('}') |
| 8474 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8475 | message.subtypes[3] = echo_reply |
| 8476 | |
| 8477 | class echo_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8478 | version = 4 |
| 8479 | type = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8480 | |
| 8481 | def __init__(self, xid=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8482 | if xid != None: |
| 8483 | self.xid = xid |
| 8484 | else: |
| 8485 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8486 | if data != None: |
| 8487 | self.data = data |
| 8488 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8489 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8490 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8491 | |
| 8492 | def pack(self): |
| 8493 | packed = [] |
| 8494 | packed.append(struct.pack("!B", self.version)) |
| 8495 | packed.append(struct.pack("!B", self.type)) |
| 8496 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8497 | packed.append(struct.pack("!L", self.xid)) |
| 8498 | packed.append(self.data) |
| 8499 | length = sum([len(x) for x in packed]) |
| 8500 | packed[2] = struct.pack("!H", length) |
| 8501 | return ''.join(packed) |
| 8502 | |
| 8503 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8504 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8505 | obj = echo_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8506 | _version = reader.read("!B")[0] |
| 8507 | assert(_version == 4) |
| 8508 | _type = reader.read("!B")[0] |
| 8509 | assert(_type == 2) |
| 8510 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8511 | orig_reader = reader |
| 8512 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8513 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8514 | obj.data = str(reader.read_all()) |
| 8515 | return obj |
| 8516 | |
| 8517 | def __eq__(self, other): |
| 8518 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8519 | if self.xid != other.xid: return False |
| 8520 | if self.data != other.data: return False |
| 8521 | return True |
| 8522 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8523 | def pretty_print(self, q): |
| 8524 | q.text("echo_request {") |
| 8525 | with q.group(): |
| 8526 | with q.indent(2): |
| 8527 | q.breakable() |
| 8528 | q.text("xid = "); |
| 8529 | if self.xid != None: |
| 8530 | q.text("%#x" % self.xid) |
| 8531 | else: |
| 8532 | q.text('None') |
| 8533 | q.text(","); q.breakable() |
| 8534 | q.text("data = "); |
| 8535 | q.pp(self.data) |
| 8536 | q.breakable() |
| 8537 | q.text('}') |
| 8538 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8539 | message.subtypes[2] = echo_request |
| 8540 | |
| 8541 | class experimenter_error_msg(error_msg): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8542 | version = 4 |
| 8543 | type = 1 |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8544 | err_type = 65535 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8545 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8546 | def __init__(self, xid=None, subtype=None, experimenter=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8547 | if xid != None: |
| 8548 | self.xid = xid |
| 8549 | else: |
| 8550 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8551 | if subtype != None: |
| 8552 | self.subtype = subtype |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8553 | else: |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8554 | self.subtype = 0 |
| 8555 | if experimenter != None: |
| 8556 | self.experimenter = experimenter |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8557 | else: |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8558 | self.experimenter = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8559 | if data != None: |
| 8560 | self.data = data |
| 8561 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8562 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8563 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8564 | |
| 8565 | def pack(self): |
| 8566 | packed = [] |
| 8567 | packed.append(struct.pack("!B", self.version)) |
| 8568 | packed.append(struct.pack("!B", self.type)) |
| 8569 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8570 | packed.append(struct.pack("!L", self.xid)) |
| 8571 | packed.append(struct.pack("!H", self.err_type)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8572 | packed.append(struct.pack("!H", self.subtype)) |
| 8573 | packed.append(struct.pack("!L", self.experimenter)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8574 | packed.append(self.data) |
| 8575 | length = sum([len(x) for x in packed]) |
| 8576 | packed[2] = struct.pack("!H", length) |
| 8577 | return ''.join(packed) |
| 8578 | |
| 8579 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8580 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8581 | obj = experimenter_error_msg() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8582 | _version = reader.read("!B")[0] |
| 8583 | assert(_version == 4) |
| 8584 | _type = reader.read("!B")[0] |
| 8585 | assert(_type == 1) |
| 8586 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8587 | orig_reader = reader |
| 8588 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8589 | obj.xid = reader.read("!L")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8590 | _err_type = reader.read("!H")[0] |
| 8591 | assert(_err_type == 65535) |
| 8592 | obj.subtype = reader.read("!H")[0] |
| 8593 | obj.experimenter = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8594 | obj.data = str(reader.read_all()) |
| 8595 | return obj |
| 8596 | |
| 8597 | def __eq__(self, other): |
| 8598 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8599 | if self.xid != other.xid: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8600 | if self.subtype != other.subtype: return False |
| 8601 | if self.experimenter != other.experimenter: return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8602 | if self.data != other.data: return False |
| 8603 | return True |
| 8604 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8605 | def pretty_print(self, q): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8606 | q.text("experimenter_error_msg {") |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8607 | with q.group(): |
| 8608 | with q.indent(2): |
| 8609 | q.breakable() |
| 8610 | q.text("xid = "); |
| 8611 | if self.xid != None: |
| 8612 | q.text("%#x" % self.xid) |
| 8613 | else: |
| 8614 | q.text('None') |
| 8615 | q.text(","); q.breakable() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8616 | q.text("subtype = "); |
| 8617 | q.text("%#x" % self.subtype) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8618 | q.text(","); q.breakable() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8619 | q.text("experimenter = "); |
| 8620 | q.text("%#x" % self.experimenter) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8621 | q.text(","); q.breakable() |
| 8622 | q.text("data = "); |
| 8623 | q.pp(self.data) |
| 8624 | q.breakable() |
| 8625 | q.text('}') |
| 8626 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8627 | error_msg.subtypes[65535] = experimenter_error_msg |
| 8628 | |
| 8629 | class features_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8630 | version = 4 |
| 8631 | type = 6 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8632 | |
| 8633 | 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] | 8634 | if xid != None: |
| 8635 | self.xid = xid |
| 8636 | else: |
| 8637 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8638 | if datapath_id != None: |
| 8639 | self.datapath_id = datapath_id |
| 8640 | else: |
| 8641 | self.datapath_id = 0 |
| 8642 | if n_buffers != None: |
| 8643 | self.n_buffers = n_buffers |
| 8644 | else: |
| 8645 | self.n_buffers = 0 |
| 8646 | if n_tables != None: |
| 8647 | self.n_tables = n_tables |
| 8648 | else: |
| 8649 | self.n_tables = 0 |
| 8650 | if auxiliary_id != None: |
| 8651 | self.auxiliary_id = auxiliary_id |
| 8652 | else: |
| 8653 | self.auxiliary_id = 0 |
| 8654 | if capabilities != None: |
| 8655 | self.capabilities = capabilities |
| 8656 | else: |
| 8657 | self.capabilities = 0 |
| 8658 | if reserved != None: |
| 8659 | self.reserved = reserved |
| 8660 | else: |
| 8661 | self.reserved = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8662 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8663 | |
| 8664 | def pack(self): |
| 8665 | packed = [] |
| 8666 | packed.append(struct.pack("!B", self.version)) |
| 8667 | packed.append(struct.pack("!B", self.type)) |
| 8668 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8669 | packed.append(struct.pack("!L", self.xid)) |
| 8670 | packed.append(struct.pack("!Q", self.datapath_id)) |
| 8671 | packed.append(struct.pack("!L", self.n_buffers)) |
| 8672 | packed.append(struct.pack("!B", self.n_tables)) |
| 8673 | packed.append(struct.pack("!B", self.auxiliary_id)) |
| 8674 | packed.append('\x00' * 2) |
| 8675 | packed.append(struct.pack("!L", self.capabilities)) |
| 8676 | packed.append(struct.pack("!L", self.reserved)) |
| 8677 | length = sum([len(x) for x in packed]) |
| 8678 | packed[2] = struct.pack("!H", length) |
| 8679 | return ''.join(packed) |
| 8680 | |
| 8681 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8682 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8683 | obj = features_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8684 | _version = reader.read("!B")[0] |
| 8685 | assert(_version == 4) |
| 8686 | _type = reader.read("!B")[0] |
| 8687 | assert(_type == 6) |
| 8688 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8689 | orig_reader = reader |
| 8690 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8691 | obj.xid = reader.read("!L")[0] |
| 8692 | obj.datapath_id = reader.read("!Q")[0] |
| 8693 | obj.n_buffers = reader.read("!L")[0] |
| 8694 | obj.n_tables = reader.read("!B")[0] |
| 8695 | obj.auxiliary_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8696 | reader.skip(2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8697 | obj.capabilities = reader.read("!L")[0] |
| 8698 | obj.reserved = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8699 | return obj |
| 8700 | |
| 8701 | def __eq__(self, other): |
| 8702 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8703 | if self.xid != other.xid: return False |
| 8704 | if self.datapath_id != other.datapath_id: return False |
| 8705 | if self.n_buffers != other.n_buffers: return False |
| 8706 | if self.n_tables != other.n_tables: return False |
| 8707 | if self.auxiliary_id != other.auxiliary_id: return False |
| 8708 | if self.capabilities != other.capabilities: return False |
| 8709 | if self.reserved != other.reserved: return False |
| 8710 | return True |
| 8711 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8712 | def pretty_print(self, q): |
| 8713 | q.text("features_reply {") |
| 8714 | with q.group(): |
| 8715 | with q.indent(2): |
| 8716 | q.breakable() |
| 8717 | q.text("xid = "); |
| 8718 | if self.xid != None: |
| 8719 | q.text("%#x" % self.xid) |
| 8720 | else: |
| 8721 | q.text('None') |
| 8722 | q.text(","); q.breakable() |
| 8723 | q.text("datapath_id = "); |
| 8724 | q.text("%#x" % self.datapath_id) |
| 8725 | q.text(","); q.breakable() |
| 8726 | q.text("n_buffers = "); |
| 8727 | q.text("%#x" % self.n_buffers) |
| 8728 | q.text(","); q.breakable() |
| 8729 | q.text("n_tables = "); |
| 8730 | q.text("%#x" % self.n_tables) |
| 8731 | q.text(","); q.breakable() |
| 8732 | q.text("auxiliary_id = "); |
| 8733 | q.text("%#x" % self.auxiliary_id) |
| 8734 | q.text(","); q.breakable() |
| 8735 | q.text("capabilities = "); |
| 8736 | q.text("%#x" % self.capabilities) |
| 8737 | q.text(","); q.breakable() |
| 8738 | q.text("reserved = "); |
| 8739 | q.text("%#x" % self.reserved) |
| 8740 | q.breakable() |
| 8741 | q.text('}') |
| 8742 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8743 | message.subtypes[6] = features_reply |
| 8744 | |
| 8745 | class features_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8746 | version = 4 |
| 8747 | type = 5 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8748 | |
| 8749 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8750 | if xid != None: |
| 8751 | self.xid = xid |
| 8752 | else: |
| 8753 | self.xid = None |
| 8754 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8755 | |
| 8756 | def pack(self): |
| 8757 | packed = [] |
| 8758 | packed.append(struct.pack("!B", self.version)) |
| 8759 | packed.append(struct.pack("!B", self.type)) |
| 8760 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8761 | packed.append(struct.pack("!L", self.xid)) |
| 8762 | length = sum([len(x) for x in packed]) |
| 8763 | packed[2] = struct.pack("!H", length) |
| 8764 | return ''.join(packed) |
| 8765 | |
| 8766 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8767 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8768 | obj = features_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8769 | _version = reader.read("!B")[0] |
| 8770 | assert(_version == 4) |
| 8771 | _type = reader.read("!B")[0] |
| 8772 | assert(_type == 5) |
| 8773 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8774 | orig_reader = reader |
| 8775 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8776 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8777 | return obj |
| 8778 | |
| 8779 | def __eq__(self, other): |
| 8780 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8781 | if self.xid != other.xid: return False |
| 8782 | return True |
| 8783 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8784 | def pretty_print(self, q): |
| 8785 | q.text("features_request {") |
| 8786 | with q.group(): |
| 8787 | with q.indent(2): |
| 8788 | q.breakable() |
| 8789 | q.text("xid = "); |
| 8790 | if self.xid != None: |
| 8791 | q.text("%#x" % self.xid) |
| 8792 | else: |
| 8793 | q.text('None') |
| 8794 | q.breakable() |
| 8795 | q.text('}') |
| 8796 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8797 | message.subtypes[5] = features_request |
| 8798 | |
| 8799 | class flow_mod(message): |
| 8800 | subtypes = {} |
| 8801 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 8802 | version = 4 |
| 8803 | type = 14 |
| 8804 | |
| 8805 | 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): |
| 8806 | if xid != None: |
| 8807 | self.xid = xid |
| 8808 | else: |
| 8809 | self.xid = None |
| 8810 | if cookie != None: |
| 8811 | self.cookie = cookie |
| 8812 | else: |
| 8813 | self.cookie = 0 |
| 8814 | if cookie_mask != None: |
| 8815 | self.cookie_mask = cookie_mask |
| 8816 | else: |
| 8817 | self.cookie_mask = 0 |
| 8818 | if table_id != None: |
| 8819 | self.table_id = table_id |
| 8820 | else: |
| 8821 | self.table_id = 0 |
| 8822 | if _command != None: |
| 8823 | self._command = _command |
| 8824 | else: |
| 8825 | self._command = 0 |
| 8826 | if idle_timeout != None: |
| 8827 | self.idle_timeout = idle_timeout |
| 8828 | else: |
| 8829 | self.idle_timeout = 0 |
| 8830 | if hard_timeout != None: |
| 8831 | self.hard_timeout = hard_timeout |
| 8832 | else: |
| 8833 | self.hard_timeout = 0 |
| 8834 | if priority != None: |
| 8835 | self.priority = priority |
| 8836 | else: |
| 8837 | self.priority = 0 |
| 8838 | if buffer_id != None: |
| 8839 | self.buffer_id = buffer_id |
| 8840 | else: |
| 8841 | self.buffer_id = 0 |
| 8842 | if out_port != None: |
| 8843 | self.out_port = out_port |
| 8844 | else: |
| 8845 | self.out_port = 0 |
| 8846 | if out_group != None: |
| 8847 | self.out_group = out_group |
| 8848 | else: |
| 8849 | self.out_group = 0 |
| 8850 | if flags != None: |
| 8851 | self.flags = flags |
| 8852 | else: |
| 8853 | self.flags = 0 |
| 8854 | if match != None: |
| 8855 | self.match = match |
| 8856 | else: |
| 8857 | self.match = common.match() |
| 8858 | if instructions != None: |
| 8859 | self.instructions = instructions |
| 8860 | else: |
| 8861 | self.instructions = [] |
| 8862 | return |
| 8863 | |
| 8864 | def pack(self): |
| 8865 | packed = [] |
| 8866 | packed.append(struct.pack("!B", self.version)) |
| 8867 | packed.append(struct.pack("!B", self.type)) |
| 8868 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8869 | packed.append(struct.pack("!L", self.xid)) |
| 8870 | packed.append(struct.pack("!Q", self.cookie)) |
| 8871 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 8872 | packed.append(struct.pack("!B", self.table_id)) |
| 8873 | packed.append(util.pack_fm_cmd(self._command)) |
| 8874 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 8875 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 8876 | packed.append(struct.pack("!H", self.priority)) |
| 8877 | packed.append(struct.pack("!L", self.buffer_id)) |
| 8878 | packed.append(util.pack_port_no(self.out_port)) |
| 8879 | packed.append(struct.pack("!L", self.out_group)) |
| 8880 | packed.append(struct.pack("!H", self.flags)) |
| 8881 | packed.append('\x00' * 2) |
| 8882 | packed.append(self.match.pack()) |
| 8883 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
| 8884 | length = sum([len(x) for x in packed]) |
| 8885 | packed[2] = struct.pack("!H", length) |
| 8886 | return ''.join(packed) |
| 8887 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8888 | @staticmethod |
| 8889 | def unpack(reader): |
| 8890 | subtype, = reader.peek('B', 25) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 8891 | subclass = flow_mod.subtypes.get(subtype) |
| 8892 | if subclass: |
| 8893 | return subclass.unpack(reader) |
| 8894 | |
| 8895 | obj = flow_mod() |
| 8896 | _version = reader.read("!B")[0] |
| 8897 | assert(_version == 4) |
| 8898 | _type = reader.read("!B")[0] |
| 8899 | assert(_type == 14) |
| 8900 | _length = reader.read("!H")[0] |
| 8901 | orig_reader = reader |
| 8902 | reader = orig_reader.slice(_length - (2 + 2)) |
| 8903 | obj.xid = reader.read("!L")[0] |
| 8904 | obj.cookie = reader.read("!Q")[0] |
| 8905 | obj.cookie_mask = reader.read("!Q")[0] |
| 8906 | obj.table_id = reader.read("!B")[0] |
| 8907 | obj._command = util.unpack_fm_cmd(reader) |
| 8908 | obj.idle_timeout = reader.read("!H")[0] |
| 8909 | obj.hard_timeout = reader.read("!H")[0] |
| 8910 | obj.priority = reader.read("!H")[0] |
| 8911 | obj.buffer_id = reader.read("!L")[0] |
| 8912 | obj.out_port = util.unpack_port_no(reader) |
| 8913 | obj.out_group = reader.read("!L")[0] |
| 8914 | obj.flags = reader.read("!H")[0] |
| 8915 | reader.skip(2) |
| 8916 | obj.match = common.match.unpack(reader) |
| 8917 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
| 8918 | return obj |
| 8919 | |
| 8920 | def __eq__(self, other): |
| 8921 | if type(self) != type(other): return False |
| 8922 | if self.xid != other.xid: return False |
| 8923 | if self.cookie != other.cookie: return False |
| 8924 | if self.cookie_mask != other.cookie_mask: return False |
| 8925 | if self.table_id != other.table_id: return False |
| 8926 | if self._command != other._command: return False |
| 8927 | if self.idle_timeout != other.idle_timeout: return False |
| 8928 | if self.hard_timeout != other.hard_timeout: return False |
| 8929 | if self.priority != other.priority: return False |
| 8930 | if self.buffer_id != other.buffer_id: return False |
| 8931 | if self.out_port != other.out_port: return False |
| 8932 | if self.out_group != other.out_group: return False |
| 8933 | if self.flags != other.flags: return False |
| 8934 | if self.match != other.match: return False |
| 8935 | if self.instructions != other.instructions: return False |
| 8936 | return True |
| 8937 | |
| 8938 | def pretty_print(self, q): |
| 8939 | q.text("flow_mod {") |
| 8940 | with q.group(): |
| 8941 | with q.indent(2): |
| 8942 | q.breakable() |
| 8943 | q.text("xid = "); |
| 8944 | if self.xid != None: |
| 8945 | q.text("%#x" % self.xid) |
| 8946 | else: |
| 8947 | q.text('None') |
| 8948 | q.text(","); q.breakable() |
| 8949 | q.text("cookie = "); |
| 8950 | q.text("%#x" % self.cookie) |
| 8951 | q.text(","); q.breakable() |
| 8952 | q.text("cookie_mask = "); |
| 8953 | q.text("%#x" % self.cookie_mask) |
| 8954 | q.text(","); q.breakable() |
| 8955 | q.text("table_id = "); |
| 8956 | q.text("%#x" % self.table_id) |
| 8957 | q.text(","); q.breakable() |
| 8958 | q.text("idle_timeout = "); |
| 8959 | q.text("%#x" % self.idle_timeout) |
| 8960 | q.text(","); q.breakable() |
| 8961 | q.text("hard_timeout = "); |
| 8962 | q.text("%#x" % self.hard_timeout) |
| 8963 | q.text(","); q.breakable() |
| 8964 | q.text("priority = "); |
| 8965 | q.text("%#x" % self.priority) |
| 8966 | q.text(","); q.breakable() |
| 8967 | q.text("buffer_id = "); |
| 8968 | q.text("%#x" % self.buffer_id) |
| 8969 | q.text(","); q.breakable() |
| 8970 | q.text("out_port = "); |
| 8971 | q.text(util.pretty_port(self.out_port)) |
| 8972 | q.text(","); q.breakable() |
| 8973 | q.text("out_group = "); |
| 8974 | q.text("%#x" % self.out_group) |
| 8975 | q.text(","); q.breakable() |
| 8976 | q.text("flags = "); |
| 8977 | q.text("%#x" % self.flags) |
| 8978 | q.text(","); q.breakable() |
| 8979 | q.text("match = "); |
| 8980 | q.pp(self.match) |
| 8981 | q.text(","); q.breakable() |
| 8982 | q.text("instructions = "); |
| 8983 | q.pp(self.instructions) |
| 8984 | q.breakable() |
| 8985 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8986 | |
| 8987 | message.subtypes[14] = flow_mod |
| 8988 | |
| 8989 | class flow_add(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8990 | version = 4 |
| 8991 | type = 14 |
| 8992 | _command = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8993 | |
| 8994 | 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] | 8995 | if xid != None: |
| 8996 | self.xid = xid |
| 8997 | else: |
| 8998 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8999 | if cookie != None: |
| 9000 | self.cookie = cookie |
| 9001 | else: |
| 9002 | self.cookie = 0 |
| 9003 | if cookie_mask != None: |
| 9004 | self.cookie_mask = cookie_mask |
| 9005 | else: |
| 9006 | self.cookie_mask = 0 |
| 9007 | if table_id != None: |
| 9008 | self.table_id = table_id |
| 9009 | else: |
| 9010 | self.table_id = 0 |
| 9011 | if idle_timeout != None: |
| 9012 | self.idle_timeout = idle_timeout |
| 9013 | else: |
| 9014 | self.idle_timeout = 0 |
| 9015 | if hard_timeout != None: |
| 9016 | self.hard_timeout = hard_timeout |
| 9017 | else: |
| 9018 | self.hard_timeout = 0 |
| 9019 | if priority != None: |
| 9020 | self.priority = priority |
| 9021 | else: |
| 9022 | self.priority = 0 |
| 9023 | if buffer_id != None: |
| 9024 | self.buffer_id = buffer_id |
| 9025 | else: |
| 9026 | self.buffer_id = 0 |
| 9027 | if out_port != None: |
| 9028 | self.out_port = out_port |
| 9029 | else: |
| 9030 | self.out_port = 0 |
| 9031 | if out_group != None: |
| 9032 | self.out_group = out_group |
| 9033 | else: |
| 9034 | self.out_group = 0 |
| 9035 | if flags != None: |
| 9036 | self.flags = flags |
| 9037 | else: |
| 9038 | self.flags = 0 |
| 9039 | if match != None: |
| 9040 | self.match = match |
| 9041 | else: |
| 9042 | self.match = common.match() |
| 9043 | if instructions != None: |
| 9044 | self.instructions = instructions |
| 9045 | else: |
| 9046 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9047 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9048 | |
| 9049 | def pack(self): |
| 9050 | packed = [] |
| 9051 | packed.append(struct.pack("!B", self.version)) |
| 9052 | packed.append(struct.pack("!B", self.type)) |
| 9053 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9054 | packed.append(struct.pack("!L", self.xid)) |
| 9055 | packed.append(struct.pack("!Q", self.cookie)) |
| 9056 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 9057 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9058 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9059 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 9060 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 9061 | packed.append(struct.pack("!H", self.priority)) |
| 9062 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9063 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9064 | packed.append(struct.pack("!L", self.out_group)) |
| 9065 | packed.append(struct.pack("!H", self.flags)) |
| 9066 | packed.append('\x00' * 2) |
| 9067 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9068 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9069 | length = sum([len(x) for x in packed]) |
| 9070 | packed[2] = struct.pack("!H", length) |
| 9071 | return ''.join(packed) |
| 9072 | |
| 9073 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9074 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9075 | obj = flow_add() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9076 | _version = reader.read("!B")[0] |
| 9077 | assert(_version == 4) |
| 9078 | _type = reader.read("!B")[0] |
| 9079 | assert(_type == 14) |
| 9080 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9081 | orig_reader = reader |
| 9082 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9083 | obj.xid = reader.read("!L")[0] |
| 9084 | obj.cookie = reader.read("!Q")[0] |
| 9085 | obj.cookie_mask = reader.read("!Q")[0] |
| 9086 | obj.table_id = reader.read("!B")[0] |
| 9087 | __command = util.unpack_fm_cmd(reader) |
| 9088 | assert(__command == 0) |
| 9089 | obj.idle_timeout = reader.read("!H")[0] |
| 9090 | obj.hard_timeout = reader.read("!H")[0] |
| 9091 | obj.priority = reader.read("!H")[0] |
| 9092 | obj.buffer_id = reader.read("!L")[0] |
| 9093 | obj.out_port = util.unpack_port_no(reader) |
| 9094 | obj.out_group = reader.read("!L")[0] |
| 9095 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9096 | reader.skip(2) |
| 9097 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9098 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9099 | return obj |
| 9100 | |
| 9101 | def __eq__(self, other): |
| 9102 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9103 | if self.xid != other.xid: return False |
| 9104 | if self.cookie != other.cookie: return False |
| 9105 | if self.cookie_mask != other.cookie_mask: return False |
| 9106 | if self.table_id != other.table_id: return False |
| 9107 | if self.idle_timeout != other.idle_timeout: return False |
| 9108 | if self.hard_timeout != other.hard_timeout: return False |
| 9109 | if self.priority != other.priority: return False |
| 9110 | if self.buffer_id != other.buffer_id: return False |
| 9111 | if self.out_port != other.out_port: return False |
| 9112 | if self.out_group != other.out_group: return False |
| 9113 | if self.flags != other.flags: return False |
| 9114 | if self.match != other.match: return False |
| 9115 | if self.instructions != other.instructions: return False |
| 9116 | return True |
| 9117 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9118 | def pretty_print(self, q): |
| 9119 | q.text("flow_add {") |
| 9120 | with q.group(): |
| 9121 | with q.indent(2): |
| 9122 | q.breakable() |
| 9123 | q.text("xid = "); |
| 9124 | if self.xid != None: |
| 9125 | q.text("%#x" % self.xid) |
| 9126 | else: |
| 9127 | q.text('None') |
| 9128 | q.text(","); q.breakable() |
| 9129 | q.text("cookie = "); |
| 9130 | q.text("%#x" % self.cookie) |
| 9131 | q.text(","); q.breakable() |
| 9132 | q.text("cookie_mask = "); |
| 9133 | q.text("%#x" % self.cookie_mask) |
| 9134 | q.text(","); q.breakable() |
| 9135 | q.text("table_id = "); |
| 9136 | q.text("%#x" % self.table_id) |
| 9137 | q.text(","); q.breakable() |
| 9138 | q.text("idle_timeout = "); |
| 9139 | q.text("%#x" % self.idle_timeout) |
| 9140 | q.text(","); q.breakable() |
| 9141 | q.text("hard_timeout = "); |
| 9142 | q.text("%#x" % self.hard_timeout) |
| 9143 | q.text(","); q.breakable() |
| 9144 | q.text("priority = "); |
| 9145 | q.text("%#x" % self.priority) |
| 9146 | q.text(","); q.breakable() |
| 9147 | q.text("buffer_id = "); |
| 9148 | q.text("%#x" % self.buffer_id) |
| 9149 | q.text(","); q.breakable() |
| 9150 | q.text("out_port = "); |
| 9151 | q.text(util.pretty_port(self.out_port)) |
| 9152 | q.text(","); q.breakable() |
| 9153 | q.text("out_group = "); |
| 9154 | q.text("%#x" % self.out_group) |
| 9155 | q.text(","); q.breakable() |
| 9156 | q.text("flags = "); |
| 9157 | q.text("%#x" % self.flags) |
| 9158 | q.text(","); q.breakable() |
| 9159 | q.text("match = "); |
| 9160 | q.pp(self.match) |
| 9161 | q.text(","); q.breakable() |
| 9162 | q.text("instructions = "); |
| 9163 | q.pp(self.instructions) |
| 9164 | q.breakable() |
| 9165 | q.text('}') |
| 9166 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9167 | flow_mod.subtypes[0] = flow_add |
| 9168 | |
| 9169 | class flow_delete(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9170 | version = 4 |
| 9171 | type = 14 |
| 9172 | _command = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9173 | |
| 9174 | 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] | 9175 | if xid != None: |
| 9176 | self.xid = xid |
| 9177 | else: |
| 9178 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9179 | if cookie != None: |
| 9180 | self.cookie = cookie |
| 9181 | else: |
| 9182 | self.cookie = 0 |
| 9183 | if cookie_mask != None: |
| 9184 | self.cookie_mask = cookie_mask |
| 9185 | else: |
| 9186 | self.cookie_mask = 0 |
| 9187 | if table_id != None: |
| 9188 | self.table_id = table_id |
| 9189 | else: |
| 9190 | self.table_id = 0 |
| 9191 | if idle_timeout != None: |
| 9192 | self.idle_timeout = idle_timeout |
| 9193 | else: |
| 9194 | self.idle_timeout = 0 |
| 9195 | if hard_timeout != None: |
| 9196 | self.hard_timeout = hard_timeout |
| 9197 | else: |
| 9198 | self.hard_timeout = 0 |
| 9199 | if priority != None: |
| 9200 | self.priority = priority |
| 9201 | else: |
| 9202 | self.priority = 0 |
| 9203 | if buffer_id != None: |
| 9204 | self.buffer_id = buffer_id |
| 9205 | else: |
| 9206 | self.buffer_id = 0 |
| 9207 | if out_port != None: |
| 9208 | self.out_port = out_port |
| 9209 | else: |
| 9210 | self.out_port = 0 |
| 9211 | if out_group != None: |
| 9212 | self.out_group = out_group |
| 9213 | else: |
| 9214 | self.out_group = 0 |
| 9215 | if flags != None: |
| 9216 | self.flags = flags |
| 9217 | else: |
| 9218 | self.flags = 0 |
| 9219 | if match != None: |
| 9220 | self.match = match |
| 9221 | else: |
| 9222 | self.match = common.match() |
| 9223 | if instructions != None: |
| 9224 | self.instructions = instructions |
| 9225 | else: |
| 9226 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9227 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9228 | |
| 9229 | def pack(self): |
| 9230 | packed = [] |
| 9231 | packed.append(struct.pack("!B", self.version)) |
| 9232 | packed.append(struct.pack("!B", self.type)) |
| 9233 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9234 | packed.append(struct.pack("!L", self.xid)) |
| 9235 | packed.append(struct.pack("!Q", self.cookie)) |
| 9236 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 9237 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9238 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9239 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 9240 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 9241 | packed.append(struct.pack("!H", self.priority)) |
| 9242 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9243 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9244 | packed.append(struct.pack("!L", self.out_group)) |
| 9245 | packed.append(struct.pack("!H", self.flags)) |
| 9246 | packed.append('\x00' * 2) |
| 9247 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9248 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9249 | length = sum([len(x) for x in packed]) |
| 9250 | packed[2] = struct.pack("!H", length) |
| 9251 | return ''.join(packed) |
| 9252 | |
| 9253 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9254 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9255 | obj = flow_delete() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9256 | _version = reader.read("!B")[0] |
| 9257 | assert(_version == 4) |
| 9258 | _type = reader.read("!B")[0] |
| 9259 | assert(_type == 14) |
| 9260 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9261 | orig_reader = reader |
| 9262 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9263 | obj.xid = reader.read("!L")[0] |
| 9264 | obj.cookie = reader.read("!Q")[0] |
| 9265 | obj.cookie_mask = reader.read("!Q")[0] |
| 9266 | obj.table_id = reader.read("!B")[0] |
| 9267 | __command = util.unpack_fm_cmd(reader) |
| 9268 | assert(__command == 3) |
| 9269 | obj.idle_timeout = reader.read("!H")[0] |
| 9270 | obj.hard_timeout = reader.read("!H")[0] |
| 9271 | obj.priority = reader.read("!H")[0] |
| 9272 | obj.buffer_id = reader.read("!L")[0] |
| 9273 | obj.out_port = util.unpack_port_no(reader) |
| 9274 | obj.out_group = reader.read("!L")[0] |
| 9275 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9276 | reader.skip(2) |
| 9277 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9278 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9279 | return obj |
| 9280 | |
| 9281 | def __eq__(self, other): |
| 9282 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9283 | if self.xid != other.xid: return False |
| 9284 | if self.cookie != other.cookie: return False |
| 9285 | if self.cookie_mask != other.cookie_mask: return False |
| 9286 | if self.table_id != other.table_id: return False |
| 9287 | if self.idle_timeout != other.idle_timeout: return False |
| 9288 | if self.hard_timeout != other.hard_timeout: return False |
| 9289 | if self.priority != other.priority: return False |
| 9290 | if self.buffer_id != other.buffer_id: return False |
| 9291 | if self.out_port != other.out_port: return False |
| 9292 | if self.out_group != other.out_group: return False |
| 9293 | if self.flags != other.flags: return False |
| 9294 | if self.match != other.match: return False |
| 9295 | if self.instructions != other.instructions: return False |
| 9296 | return True |
| 9297 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9298 | def pretty_print(self, q): |
| 9299 | q.text("flow_delete {") |
| 9300 | with q.group(): |
| 9301 | with q.indent(2): |
| 9302 | q.breakable() |
| 9303 | q.text("xid = "); |
| 9304 | if self.xid != None: |
| 9305 | q.text("%#x" % self.xid) |
| 9306 | else: |
| 9307 | q.text('None') |
| 9308 | q.text(","); q.breakable() |
| 9309 | q.text("cookie = "); |
| 9310 | q.text("%#x" % self.cookie) |
| 9311 | q.text(","); q.breakable() |
| 9312 | q.text("cookie_mask = "); |
| 9313 | q.text("%#x" % self.cookie_mask) |
| 9314 | q.text(","); q.breakable() |
| 9315 | q.text("table_id = "); |
| 9316 | q.text("%#x" % self.table_id) |
| 9317 | q.text(","); q.breakable() |
| 9318 | q.text("idle_timeout = "); |
| 9319 | q.text("%#x" % self.idle_timeout) |
| 9320 | q.text(","); q.breakable() |
| 9321 | q.text("hard_timeout = "); |
| 9322 | q.text("%#x" % self.hard_timeout) |
| 9323 | q.text(","); q.breakable() |
| 9324 | q.text("priority = "); |
| 9325 | q.text("%#x" % self.priority) |
| 9326 | q.text(","); q.breakable() |
| 9327 | q.text("buffer_id = "); |
| 9328 | q.text("%#x" % self.buffer_id) |
| 9329 | q.text(","); q.breakable() |
| 9330 | q.text("out_port = "); |
| 9331 | q.text(util.pretty_port(self.out_port)) |
| 9332 | q.text(","); q.breakable() |
| 9333 | q.text("out_group = "); |
| 9334 | q.text("%#x" % self.out_group) |
| 9335 | q.text(","); q.breakable() |
| 9336 | q.text("flags = "); |
| 9337 | q.text("%#x" % self.flags) |
| 9338 | q.text(","); q.breakable() |
| 9339 | q.text("match = "); |
| 9340 | q.pp(self.match) |
| 9341 | q.text(","); q.breakable() |
| 9342 | q.text("instructions = "); |
| 9343 | q.pp(self.instructions) |
| 9344 | q.breakable() |
| 9345 | q.text('}') |
| 9346 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9347 | flow_mod.subtypes[3] = flow_delete |
| 9348 | |
| 9349 | class flow_delete_strict(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9350 | version = 4 |
| 9351 | type = 14 |
| 9352 | _command = 4 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9353 | |
| 9354 | 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] | 9355 | if xid != None: |
| 9356 | self.xid = xid |
| 9357 | else: |
| 9358 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9359 | if cookie != None: |
| 9360 | self.cookie = cookie |
| 9361 | else: |
| 9362 | self.cookie = 0 |
| 9363 | if cookie_mask != None: |
| 9364 | self.cookie_mask = cookie_mask |
| 9365 | else: |
| 9366 | self.cookie_mask = 0 |
| 9367 | if table_id != None: |
| 9368 | self.table_id = table_id |
| 9369 | else: |
| 9370 | self.table_id = 0 |
| 9371 | if idle_timeout != None: |
| 9372 | self.idle_timeout = idle_timeout |
| 9373 | else: |
| 9374 | self.idle_timeout = 0 |
| 9375 | if hard_timeout != None: |
| 9376 | self.hard_timeout = hard_timeout |
| 9377 | else: |
| 9378 | self.hard_timeout = 0 |
| 9379 | if priority != None: |
| 9380 | self.priority = priority |
| 9381 | else: |
| 9382 | self.priority = 0 |
| 9383 | if buffer_id != None: |
| 9384 | self.buffer_id = buffer_id |
| 9385 | else: |
| 9386 | self.buffer_id = 0 |
| 9387 | if out_port != None: |
| 9388 | self.out_port = out_port |
| 9389 | else: |
| 9390 | self.out_port = 0 |
| 9391 | if out_group != None: |
| 9392 | self.out_group = out_group |
| 9393 | else: |
| 9394 | self.out_group = 0 |
| 9395 | if flags != None: |
| 9396 | self.flags = flags |
| 9397 | else: |
| 9398 | self.flags = 0 |
| 9399 | if match != None: |
| 9400 | self.match = match |
| 9401 | else: |
| 9402 | self.match = common.match() |
| 9403 | if instructions != None: |
| 9404 | self.instructions = instructions |
| 9405 | else: |
| 9406 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9407 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9408 | |
| 9409 | def pack(self): |
| 9410 | packed = [] |
| 9411 | packed.append(struct.pack("!B", self.version)) |
| 9412 | packed.append(struct.pack("!B", self.type)) |
| 9413 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9414 | packed.append(struct.pack("!L", self.xid)) |
| 9415 | packed.append(struct.pack("!Q", self.cookie)) |
| 9416 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 9417 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9418 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9419 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 9420 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 9421 | packed.append(struct.pack("!H", self.priority)) |
| 9422 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9423 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9424 | packed.append(struct.pack("!L", self.out_group)) |
| 9425 | packed.append(struct.pack("!H", self.flags)) |
| 9426 | packed.append('\x00' * 2) |
| 9427 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9428 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9429 | length = sum([len(x) for x in packed]) |
| 9430 | packed[2] = struct.pack("!H", length) |
| 9431 | return ''.join(packed) |
| 9432 | |
| 9433 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9434 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9435 | obj = flow_delete_strict() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9436 | _version = reader.read("!B")[0] |
| 9437 | assert(_version == 4) |
| 9438 | _type = reader.read("!B")[0] |
| 9439 | assert(_type == 14) |
| 9440 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9441 | orig_reader = reader |
| 9442 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9443 | obj.xid = reader.read("!L")[0] |
| 9444 | obj.cookie = reader.read("!Q")[0] |
| 9445 | obj.cookie_mask = reader.read("!Q")[0] |
| 9446 | obj.table_id = reader.read("!B")[0] |
| 9447 | __command = util.unpack_fm_cmd(reader) |
| 9448 | assert(__command == 4) |
| 9449 | obj.idle_timeout = reader.read("!H")[0] |
| 9450 | obj.hard_timeout = reader.read("!H")[0] |
| 9451 | obj.priority = reader.read("!H")[0] |
| 9452 | obj.buffer_id = reader.read("!L")[0] |
| 9453 | obj.out_port = util.unpack_port_no(reader) |
| 9454 | obj.out_group = reader.read("!L")[0] |
| 9455 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9456 | reader.skip(2) |
| 9457 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9458 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9459 | return obj |
| 9460 | |
| 9461 | def __eq__(self, other): |
| 9462 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9463 | if self.xid != other.xid: return False |
| 9464 | if self.cookie != other.cookie: return False |
| 9465 | if self.cookie_mask != other.cookie_mask: return False |
| 9466 | if self.table_id != other.table_id: return False |
| 9467 | if self.idle_timeout != other.idle_timeout: return False |
| 9468 | if self.hard_timeout != other.hard_timeout: return False |
| 9469 | if self.priority != other.priority: return False |
| 9470 | if self.buffer_id != other.buffer_id: return False |
| 9471 | if self.out_port != other.out_port: return False |
| 9472 | if self.out_group != other.out_group: return False |
| 9473 | if self.flags != other.flags: return False |
| 9474 | if self.match != other.match: return False |
| 9475 | if self.instructions != other.instructions: return False |
| 9476 | return True |
| 9477 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9478 | def pretty_print(self, q): |
| 9479 | q.text("flow_delete_strict {") |
| 9480 | with q.group(): |
| 9481 | with q.indent(2): |
| 9482 | q.breakable() |
| 9483 | q.text("xid = "); |
| 9484 | if self.xid != None: |
| 9485 | q.text("%#x" % self.xid) |
| 9486 | else: |
| 9487 | q.text('None') |
| 9488 | q.text(","); q.breakable() |
| 9489 | q.text("cookie = "); |
| 9490 | q.text("%#x" % self.cookie) |
| 9491 | q.text(","); q.breakable() |
| 9492 | q.text("cookie_mask = "); |
| 9493 | q.text("%#x" % self.cookie_mask) |
| 9494 | q.text(","); q.breakable() |
| 9495 | q.text("table_id = "); |
| 9496 | q.text("%#x" % self.table_id) |
| 9497 | q.text(","); q.breakable() |
| 9498 | q.text("idle_timeout = "); |
| 9499 | q.text("%#x" % self.idle_timeout) |
| 9500 | q.text(","); q.breakable() |
| 9501 | q.text("hard_timeout = "); |
| 9502 | q.text("%#x" % self.hard_timeout) |
| 9503 | q.text(","); q.breakable() |
| 9504 | q.text("priority = "); |
| 9505 | q.text("%#x" % self.priority) |
| 9506 | q.text(","); q.breakable() |
| 9507 | q.text("buffer_id = "); |
| 9508 | q.text("%#x" % self.buffer_id) |
| 9509 | q.text(","); q.breakable() |
| 9510 | q.text("out_port = "); |
| 9511 | q.text(util.pretty_port(self.out_port)) |
| 9512 | q.text(","); q.breakable() |
| 9513 | q.text("out_group = "); |
| 9514 | q.text("%#x" % self.out_group) |
| 9515 | q.text(","); q.breakable() |
| 9516 | q.text("flags = "); |
| 9517 | q.text("%#x" % self.flags) |
| 9518 | q.text(","); q.breakable() |
| 9519 | q.text("match = "); |
| 9520 | q.pp(self.match) |
| 9521 | q.text(","); q.breakable() |
| 9522 | q.text("instructions = "); |
| 9523 | q.pp(self.instructions) |
| 9524 | q.breakable() |
| 9525 | q.text('}') |
| 9526 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9527 | flow_mod.subtypes[4] = flow_delete_strict |
| 9528 | |
| 9529 | class flow_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9530 | version = 4 |
| 9531 | type = 1 |
| 9532 | err_type = 5 |
| 9533 | |
| 9534 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9535 | if xid != None: |
| 9536 | self.xid = xid |
| 9537 | else: |
| 9538 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9539 | if code != None: |
| 9540 | self.code = code |
| 9541 | else: |
| 9542 | self.code = 0 |
| 9543 | if data != None: |
| 9544 | self.data = data |
| 9545 | else: |
| 9546 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9547 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9548 | |
| 9549 | def pack(self): |
| 9550 | packed = [] |
| 9551 | packed.append(struct.pack("!B", self.version)) |
| 9552 | packed.append(struct.pack("!B", self.type)) |
| 9553 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9554 | packed.append(struct.pack("!L", self.xid)) |
| 9555 | packed.append(struct.pack("!H", self.err_type)) |
| 9556 | packed.append(struct.pack("!H", self.code)) |
| 9557 | packed.append(self.data) |
| 9558 | length = sum([len(x) for x in packed]) |
| 9559 | packed[2] = struct.pack("!H", length) |
| 9560 | return ''.join(packed) |
| 9561 | |
| 9562 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9563 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9564 | obj = flow_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9565 | _version = reader.read("!B")[0] |
| 9566 | assert(_version == 4) |
| 9567 | _type = reader.read("!B")[0] |
| 9568 | assert(_type == 1) |
| 9569 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9570 | orig_reader = reader |
| 9571 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9572 | obj.xid = reader.read("!L")[0] |
| 9573 | _err_type = reader.read("!H")[0] |
| 9574 | assert(_err_type == 5) |
| 9575 | obj.code = reader.read("!H")[0] |
| 9576 | obj.data = str(reader.read_all()) |
| 9577 | return obj |
| 9578 | |
| 9579 | def __eq__(self, other): |
| 9580 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9581 | if self.xid != other.xid: return False |
| 9582 | if self.code != other.code: return False |
| 9583 | if self.data != other.data: return False |
| 9584 | return True |
| 9585 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9586 | def pretty_print(self, q): |
| 9587 | q.text("flow_mod_failed_error_msg {") |
| 9588 | with q.group(): |
| 9589 | with q.indent(2): |
| 9590 | q.breakable() |
| 9591 | q.text("xid = "); |
| 9592 | if self.xid != None: |
| 9593 | q.text("%#x" % self.xid) |
| 9594 | else: |
| 9595 | q.text('None') |
| 9596 | q.text(","); q.breakable() |
| 9597 | q.text("code = "); |
| 9598 | q.text("%#x" % self.code) |
| 9599 | q.text(","); q.breakable() |
| 9600 | q.text("data = "); |
| 9601 | q.pp(self.data) |
| 9602 | q.breakable() |
| 9603 | q.text('}') |
| 9604 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9605 | error_msg.subtypes[5] = flow_mod_failed_error_msg |
| 9606 | |
| 9607 | class flow_modify(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9608 | version = 4 |
| 9609 | type = 14 |
| 9610 | _command = 1 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9611 | |
| 9612 | 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] | 9613 | if xid != None: |
| 9614 | self.xid = xid |
| 9615 | else: |
| 9616 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9617 | if cookie != None: |
| 9618 | self.cookie = cookie |
| 9619 | else: |
| 9620 | self.cookie = 0 |
| 9621 | if cookie_mask != None: |
| 9622 | self.cookie_mask = cookie_mask |
| 9623 | else: |
| 9624 | self.cookie_mask = 0 |
| 9625 | if table_id != None: |
| 9626 | self.table_id = table_id |
| 9627 | else: |
| 9628 | self.table_id = 0 |
| 9629 | if idle_timeout != None: |
| 9630 | self.idle_timeout = idle_timeout |
| 9631 | else: |
| 9632 | self.idle_timeout = 0 |
| 9633 | if hard_timeout != None: |
| 9634 | self.hard_timeout = hard_timeout |
| 9635 | else: |
| 9636 | self.hard_timeout = 0 |
| 9637 | if priority != None: |
| 9638 | self.priority = priority |
| 9639 | else: |
| 9640 | self.priority = 0 |
| 9641 | if buffer_id != None: |
| 9642 | self.buffer_id = buffer_id |
| 9643 | else: |
| 9644 | self.buffer_id = 0 |
| 9645 | if out_port != None: |
| 9646 | self.out_port = out_port |
| 9647 | else: |
| 9648 | self.out_port = 0 |
| 9649 | if out_group != None: |
| 9650 | self.out_group = out_group |
| 9651 | else: |
| 9652 | self.out_group = 0 |
| 9653 | if flags != None: |
| 9654 | self.flags = flags |
| 9655 | else: |
| 9656 | self.flags = 0 |
| 9657 | if match != None: |
| 9658 | self.match = match |
| 9659 | else: |
| 9660 | self.match = common.match() |
| 9661 | if instructions != None: |
| 9662 | self.instructions = instructions |
| 9663 | else: |
| 9664 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9665 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9666 | |
| 9667 | def pack(self): |
| 9668 | packed = [] |
| 9669 | packed.append(struct.pack("!B", self.version)) |
| 9670 | packed.append(struct.pack("!B", self.type)) |
| 9671 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9672 | packed.append(struct.pack("!L", self.xid)) |
| 9673 | packed.append(struct.pack("!Q", self.cookie)) |
| 9674 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 9675 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9676 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9677 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 9678 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 9679 | packed.append(struct.pack("!H", self.priority)) |
| 9680 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9681 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9682 | packed.append(struct.pack("!L", self.out_group)) |
| 9683 | packed.append(struct.pack("!H", self.flags)) |
| 9684 | packed.append('\x00' * 2) |
| 9685 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9686 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9687 | length = sum([len(x) for x in packed]) |
| 9688 | packed[2] = struct.pack("!H", length) |
| 9689 | return ''.join(packed) |
| 9690 | |
| 9691 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9692 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9693 | obj = flow_modify() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9694 | _version = reader.read("!B")[0] |
| 9695 | assert(_version == 4) |
| 9696 | _type = reader.read("!B")[0] |
| 9697 | assert(_type == 14) |
| 9698 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9699 | orig_reader = reader |
| 9700 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9701 | obj.xid = reader.read("!L")[0] |
| 9702 | obj.cookie = reader.read("!Q")[0] |
| 9703 | obj.cookie_mask = reader.read("!Q")[0] |
| 9704 | obj.table_id = reader.read("!B")[0] |
| 9705 | __command = util.unpack_fm_cmd(reader) |
| 9706 | assert(__command == 1) |
| 9707 | obj.idle_timeout = reader.read("!H")[0] |
| 9708 | obj.hard_timeout = reader.read("!H")[0] |
| 9709 | obj.priority = reader.read("!H")[0] |
| 9710 | obj.buffer_id = reader.read("!L")[0] |
| 9711 | obj.out_port = util.unpack_port_no(reader) |
| 9712 | obj.out_group = reader.read("!L")[0] |
| 9713 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9714 | reader.skip(2) |
| 9715 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9716 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9717 | return obj |
| 9718 | |
| 9719 | def __eq__(self, other): |
| 9720 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9721 | if self.xid != other.xid: return False |
| 9722 | if self.cookie != other.cookie: return False |
| 9723 | if self.cookie_mask != other.cookie_mask: return False |
| 9724 | if self.table_id != other.table_id: return False |
| 9725 | if self.idle_timeout != other.idle_timeout: return False |
| 9726 | if self.hard_timeout != other.hard_timeout: return False |
| 9727 | if self.priority != other.priority: return False |
| 9728 | if self.buffer_id != other.buffer_id: return False |
| 9729 | if self.out_port != other.out_port: return False |
| 9730 | if self.out_group != other.out_group: return False |
| 9731 | if self.flags != other.flags: return False |
| 9732 | if self.match != other.match: return False |
| 9733 | if self.instructions != other.instructions: return False |
| 9734 | return True |
| 9735 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9736 | def pretty_print(self, q): |
| 9737 | q.text("flow_modify {") |
| 9738 | with q.group(): |
| 9739 | with q.indent(2): |
| 9740 | q.breakable() |
| 9741 | q.text("xid = "); |
| 9742 | if self.xid != None: |
| 9743 | q.text("%#x" % self.xid) |
| 9744 | else: |
| 9745 | q.text('None') |
| 9746 | q.text(","); q.breakable() |
| 9747 | q.text("cookie = "); |
| 9748 | q.text("%#x" % self.cookie) |
| 9749 | q.text(","); q.breakable() |
| 9750 | q.text("cookie_mask = "); |
| 9751 | q.text("%#x" % self.cookie_mask) |
| 9752 | q.text(","); q.breakable() |
| 9753 | q.text("table_id = "); |
| 9754 | q.text("%#x" % self.table_id) |
| 9755 | q.text(","); q.breakable() |
| 9756 | q.text("idle_timeout = "); |
| 9757 | q.text("%#x" % self.idle_timeout) |
| 9758 | q.text(","); q.breakable() |
| 9759 | q.text("hard_timeout = "); |
| 9760 | q.text("%#x" % self.hard_timeout) |
| 9761 | q.text(","); q.breakable() |
| 9762 | q.text("priority = "); |
| 9763 | q.text("%#x" % self.priority) |
| 9764 | q.text(","); q.breakable() |
| 9765 | q.text("buffer_id = "); |
| 9766 | q.text("%#x" % self.buffer_id) |
| 9767 | q.text(","); q.breakable() |
| 9768 | q.text("out_port = "); |
| 9769 | q.text(util.pretty_port(self.out_port)) |
| 9770 | q.text(","); q.breakable() |
| 9771 | q.text("out_group = "); |
| 9772 | q.text("%#x" % self.out_group) |
| 9773 | q.text(","); q.breakable() |
| 9774 | q.text("flags = "); |
| 9775 | q.text("%#x" % self.flags) |
| 9776 | q.text(","); q.breakable() |
| 9777 | q.text("match = "); |
| 9778 | q.pp(self.match) |
| 9779 | q.text(","); q.breakable() |
| 9780 | q.text("instructions = "); |
| 9781 | q.pp(self.instructions) |
| 9782 | q.breakable() |
| 9783 | q.text('}') |
| 9784 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9785 | flow_mod.subtypes[1] = flow_modify |
| 9786 | |
| 9787 | class flow_modify_strict(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9788 | version = 4 |
| 9789 | type = 14 |
| 9790 | _command = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9791 | |
| 9792 | 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] | 9793 | if xid != None: |
| 9794 | self.xid = xid |
| 9795 | else: |
| 9796 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9797 | if cookie != None: |
| 9798 | self.cookie = cookie |
| 9799 | else: |
| 9800 | self.cookie = 0 |
| 9801 | if cookie_mask != None: |
| 9802 | self.cookie_mask = cookie_mask |
| 9803 | else: |
| 9804 | self.cookie_mask = 0 |
| 9805 | if table_id != None: |
| 9806 | self.table_id = table_id |
| 9807 | else: |
| 9808 | self.table_id = 0 |
| 9809 | if idle_timeout != None: |
| 9810 | self.idle_timeout = idle_timeout |
| 9811 | else: |
| 9812 | self.idle_timeout = 0 |
| 9813 | if hard_timeout != None: |
| 9814 | self.hard_timeout = hard_timeout |
| 9815 | else: |
| 9816 | self.hard_timeout = 0 |
| 9817 | if priority != None: |
| 9818 | self.priority = priority |
| 9819 | else: |
| 9820 | self.priority = 0 |
| 9821 | if buffer_id != None: |
| 9822 | self.buffer_id = buffer_id |
| 9823 | else: |
| 9824 | self.buffer_id = 0 |
| 9825 | if out_port != None: |
| 9826 | self.out_port = out_port |
| 9827 | else: |
| 9828 | self.out_port = 0 |
| 9829 | if out_group != None: |
| 9830 | self.out_group = out_group |
| 9831 | else: |
| 9832 | self.out_group = 0 |
| 9833 | if flags != None: |
| 9834 | self.flags = flags |
| 9835 | else: |
| 9836 | self.flags = 0 |
| 9837 | if match != None: |
| 9838 | self.match = match |
| 9839 | else: |
| 9840 | self.match = common.match() |
| 9841 | if instructions != None: |
| 9842 | self.instructions = instructions |
| 9843 | else: |
| 9844 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9845 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9846 | |
| 9847 | def pack(self): |
| 9848 | packed = [] |
| 9849 | packed.append(struct.pack("!B", self.version)) |
| 9850 | packed.append(struct.pack("!B", self.type)) |
| 9851 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9852 | packed.append(struct.pack("!L", self.xid)) |
| 9853 | packed.append(struct.pack("!Q", self.cookie)) |
| 9854 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 9855 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9856 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9857 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 9858 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 9859 | packed.append(struct.pack("!H", self.priority)) |
| 9860 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9861 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9862 | packed.append(struct.pack("!L", self.out_group)) |
| 9863 | packed.append(struct.pack("!H", self.flags)) |
| 9864 | packed.append('\x00' * 2) |
| 9865 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9866 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9867 | length = sum([len(x) for x in packed]) |
| 9868 | packed[2] = struct.pack("!H", length) |
| 9869 | return ''.join(packed) |
| 9870 | |
| 9871 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9872 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9873 | obj = flow_modify_strict() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9874 | _version = reader.read("!B")[0] |
| 9875 | assert(_version == 4) |
| 9876 | _type = reader.read("!B")[0] |
| 9877 | assert(_type == 14) |
| 9878 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9879 | orig_reader = reader |
| 9880 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9881 | obj.xid = reader.read("!L")[0] |
| 9882 | obj.cookie = reader.read("!Q")[0] |
| 9883 | obj.cookie_mask = reader.read("!Q")[0] |
| 9884 | obj.table_id = reader.read("!B")[0] |
| 9885 | __command = util.unpack_fm_cmd(reader) |
| 9886 | assert(__command == 2) |
| 9887 | obj.idle_timeout = reader.read("!H")[0] |
| 9888 | obj.hard_timeout = reader.read("!H")[0] |
| 9889 | obj.priority = reader.read("!H")[0] |
| 9890 | obj.buffer_id = reader.read("!L")[0] |
| 9891 | obj.out_port = util.unpack_port_no(reader) |
| 9892 | obj.out_group = reader.read("!L")[0] |
| 9893 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9894 | reader.skip(2) |
| 9895 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9896 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9897 | return obj |
| 9898 | |
| 9899 | def __eq__(self, other): |
| 9900 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9901 | if self.xid != other.xid: return False |
| 9902 | if self.cookie != other.cookie: return False |
| 9903 | if self.cookie_mask != other.cookie_mask: return False |
| 9904 | if self.table_id != other.table_id: return False |
| 9905 | if self.idle_timeout != other.idle_timeout: return False |
| 9906 | if self.hard_timeout != other.hard_timeout: return False |
| 9907 | if self.priority != other.priority: return False |
| 9908 | if self.buffer_id != other.buffer_id: return False |
| 9909 | if self.out_port != other.out_port: return False |
| 9910 | if self.out_group != other.out_group: return False |
| 9911 | if self.flags != other.flags: return False |
| 9912 | if self.match != other.match: return False |
| 9913 | if self.instructions != other.instructions: return False |
| 9914 | return True |
| 9915 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9916 | def pretty_print(self, q): |
| 9917 | q.text("flow_modify_strict {") |
| 9918 | with q.group(): |
| 9919 | with q.indent(2): |
| 9920 | q.breakable() |
| 9921 | q.text("xid = "); |
| 9922 | if self.xid != None: |
| 9923 | q.text("%#x" % self.xid) |
| 9924 | else: |
| 9925 | q.text('None') |
| 9926 | q.text(","); q.breakable() |
| 9927 | q.text("cookie = "); |
| 9928 | q.text("%#x" % self.cookie) |
| 9929 | q.text(","); q.breakable() |
| 9930 | q.text("cookie_mask = "); |
| 9931 | q.text("%#x" % self.cookie_mask) |
| 9932 | q.text(","); q.breakable() |
| 9933 | q.text("table_id = "); |
| 9934 | q.text("%#x" % self.table_id) |
| 9935 | q.text(","); q.breakable() |
| 9936 | q.text("idle_timeout = "); |
| 9937 | q.text("%#x" % self.idle_timeout) |
| 9938 | q.text(","); q.breakable() |
| 9939 | q.text("hard_timeout = "); |
| 9940 | q.text("%#x" % self.hard_timeout) |
| 9941 | q.text(","); q.breakable() |
| 9942 | q.text("priority = "); |
| 9943 | q.text("%#x" % self.priority) |
| 9944 | q.text(","); q.breakable() |
| 9945 | q.text("buffer_id = "); |
| 9946 | q.text("%#x" % self.buffer_id) |
| 9947 | q.text(","); q.breakable() |
| 9948 | q.text("out_port = "); |
| 9949 | q.text(util.pretty_port(self.out_port)) |
| 9950 | q.text(","); q.breakable() |
| 9951 | q.text("out_group = "); |
| 9952 | q.text("%#x" % self.out_group) |
| 9953 | q.text(","); q.breakable() |
| 9954 | q.text("flags = "); |
| 9955 | q.text("%#x" % self.flags) |
| 9956 | q.text(","); q.breakable() |
| 9957 | q.text("match = "); |
| 9958 | q.pp(self.match) |
| 9959 | q.text(","); q.breakable() |
| 9960 | q.text("instructions = "); |
| 9961 | q.pp(self.instructions) |
| 9962 | q.breakable() |
| 9963 | q.text('}') |
| 9964 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9965 | flow_mod.subtypes[2] = flow_modify_strict |
| 9966 | |
| 9967 | class flow_removed(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9968 | version = 4 |
| 9969 | type = 11 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9970 | |
| 9971 | 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] | 9972 | if xid != None: |
| 9973 | self.xid = xid |
| 9974 | else: |
| 9975 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9976 | if cookie != None: |
| 9977 | self.cookie = cookie |
| 9978 | else: |
| 9979 | self.cookie = 0 |
| 9980 | if priority != None: |
| 9981 | self.priority = priority |
| 9982 | else: |
| 9983 | self.priority = 0 |
| 9984 | if reason != None: |
| 9985 | self.reason = reason |
| 9986 | else: |
| 9987 | self.reason = 0 |
| 9988 | if table_id != None: |
| 9989 | self.table_id = table_id |
| 9990 | else: |
| 9991 | self.table_id = 0 |
| 9992 | if duration_sec != None: |
| 9993 | self.duration_sec = duration_sec |
| 9994 | else: |
| 9995 | self.duration_sec = 0 |
| 9996 | if duration_nsec != None: |
| 9997 | self.duration_nsec = duration_nsec |
| 9998 | else: |
| 9999 | self.duration_nsec = 0 |
| 10000 | if idle_timeout != None: |
| 10001 | self.idle_timeout = idle_timeout |
| 10002 | else: |
| 10003 | self.idle_timeout = 0 |
| 10004 | if hard_timeout != None: |
| 10005 | self.hard_timeout = hard_timeout |
| 10006 | else: |
| 10007 | self.hard_timeout = 0 |
| 10008 | if packet_count != None: |
| 10009 | self.packet_count = packet_count |
| 10010 | else: |
| 10011 | self.packet_count = 0 |
| 10012 | if byte_count != None: |
| 10013 | self.byte_count = byte_count |
| 10014 | else: |
| 10015 | self.byte_count = 0 |
| 10016 | if match != None: |
| 10017 | self.match = match |
| 10018 | else: |
| 10019 | self.match = common.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10020 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10021 | |
| 10022 | def pack(self): |
| 10023 | packed = [] |
| 10024 | packed.append(struct.pack("!B", self.version)) |
| 10025 | packed.append(struct.pack("!B", self.type)) |
| 10026 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10027 | packed.append(struct.pack("!L", self.xid)) |
| 10028 | packed.append(struct.pack("!Q", self.cookie)) |
| 10029 | packed.append(struct.pack("!H", self.priority)) |
| 10030 | packed.append(struct.pack("!B", self.reason)) |
| 10031 | packed.append(struct.pack("!B", self.table_id)) |
| 10032 | packed.append(struct.pack("!L", self.duration_sec)) |
| 10033 | packed.append(struct.pack("!L", self.duration_nsec)) |
| 10034 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 10035 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 10036 | packed.append(struct.pack("!Q", self.packet_count)) |
| 10037 | packed.append(struct.pack("!Q", self.byte_count)) |
| 10038 | packed.append(self.match.pack()) |
| 10039 | length = sum([len(x) for x in packed]) |
| 10040 | packed[2] = struct.pack("!H", length) |
| 10041 | return ''.join(packed) |
| 10042 | |
| 10043 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10044 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10045 | obj = flow_removed() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10046 | _version = reader.read("!B")[0] |
| 10047 | assert(_version == 4) |
| 10048 | _type = reader.read("!B")[0] |
| 10049 | assert(_type == 11) |
| 10050 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10051 | orig_reader = reader |
| 10052 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10053 | obj.xid = reader.read("!L")[0] |
| 10054 | obj.cookie = reader.read("!Q")[0] |
| 10055 | obj.priority = reader.read("!H")[0] |
| 10056 | obj.reason = reader.read("!B")[0] |
| 10057 | obj.table_id = reader.read("!B")[0] |
| 10058 | obj.duration_sec = reader.read("!L")[0] |
| 10059 | obj.duration_nsec = reader.read("!L")[0] |
| 10060 | obj.idle_timeout = reader.read("!H")[0] |
| 10061 | obj.hard_timeout = reader.read("!H")[0] |
| 10062 | obj.packet_count = reader.read("!Q")[0] |
| 10063 | obj.byte_count = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10064 | obj.match = common.match.unpack(reader) |
| 10065 | return obj |
| 10066 | |
| 10067 | def __eq__(self, other): |
| 10068 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10069 | if self.xid != other.xid: return False |
| 10070 | if self.cookie != other.cookie: return False |
| 10071 | if self.priority != other.priority: return False |
| 10072 | if self.reason != other.reason: return False |
| 10073 | if self.table_id != other.table_id: return False |
| 10074 | if self.duration_sec != other.duration_sec: return False |
| 10075 | if self.duration_nsec != other.duration_nsec: return False |
| 10076 | if self.idle_timeout != other.idle_timeout: return False |
| 10077 | if self.hard_timeout != other.hard_timeout: return False |
| 10078 | if self.packet_count != other.packet_count: return False |
| 10079 | if self.byte_count != other.byte_count: return False |
| 10080 | if self.match != other.match: return False |
| 10081 | return True |
| 10082 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10083 | def pretty_print(self, q): |
| 10084 | q.text("flow_removed {") |
| 10085 | with q.group(): |
| 10086 | with q.indent(2): |
| 10087 | q.breakable() |
| 10088 | q.text("xid = "); |
| 10089 | if self.xid != None: |
| 10090 | q.text("%#x" % self.xid) |
| 10091 | else: |
| 10092 | q.text('None') |
| 10093 | q.text(","); q.breakable() |
| 10094 | q.text("cookie = "); |
| 10095 | q.text("%#x" % self.cookie) |
| 10096 | q.text(","); q.breakable() |
| 10097 | q.text("priority = "); |
| 10098 | q.text("%#x" % self.priority) |
| 10099 | q.text(","); q.breakable() |
| 10100 | q.text("reason = "); |
| 10101 | q.text("%#x" % self.reason) |
| 10102 | q.text(","); q.breakable() |
| 10103 | q.text("table_id = "); |
| 10104 | q.text("%#x" % self.table_id) |
| 10105 | q.text(","); q.breakable() |
| 10106 | q.text("duration_sec = "); |
| 10107 | q.text("%#x" % self.duration_sec) |
| 10108 | q.text(","); q.breakable() |
| 10109 | q.text("duration_nsec = "); |
| 10110 | q.text("%#x" % self.duration_nsec) |
| 10111 | q.text(","); q.breakable() |
| 10112 | q.text("idle_timeout = "); |
| 10113 | q.text("%#x" % self.idle_timeout) |
| 10114 | q.text(","); q.breakable() |
| 10115 | q.text("hard_timeout = "); |
| 10116 | q.text("%#x" % self.hard_timeout) |
| 10117 | q.text(","); q.breakable() |
| 10118 | q.text("packet_count = "); |
| 10119 | q.text("%#x" % self.packet_count) |
| 10120 | q.text(","); q.breakable() |
| 10121 | q.text("byte_count = "); |
| 10122 | q.text("%#x" % self.byte_count) |
| 10123 | q.text(","); q.breakable() |
| 10124 | q.text("match = "); |
| 10125 | q.pp(self.match) |
| 10126 | q.breakable() |
| 10127 | q.text('}') |
| 10128 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10129 | message.subtypes[11] = flow_removed |
| 10130 | |
| 10131 | class flow_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10132 | version = 4 |
| 10133 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10134 | stats_type = 1 |
| 10135 | |
| 10136 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10137 | if xid != None: |
| 10138 | self.xid = xid |
| 10139 | else: |
| 10140 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10141 | if flags != None: |
| 10142 | self.flags = flags |
| 10143 | else: |
| 10144 | self.flags = 0 |
| 10145 | if entries != None: |
| 10146 | self.entries = entries |
| 10147 | else: |
| 10148 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10149 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10150 | |
| 10151 | def pack(self): |
| 10152 | packed = [] |
| 10153 | packed.append(struct.pack("!B", self.version)) |
| 10154 | packed.append(struct.pack("!B", self.type)) |
| 10155 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10156 | packed.append(struct.pack("!L", self.xid)) |
| 10157 | packed.append(struct.pack("!H", self.stats_type)) |
| 10158 | packed.append(struct.pack("!H", self.flags)) |
| 10159 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10160 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10161 | length = sum([len(x) for x in packed]) |
| 10162 | packed[2] = struct.pack("!H", length) |
| 10163 | return ''.join(packed) |
| 10164 | |
| 10165 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10166 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10167 | obj = flow_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10168 | _version = reader.read("!B")[0] |
| 10169 | assert(_version == 4) |
| 10170 | _type = reader.read("!B")[0] |
| 10171 | assert(_type == 19) |
| 10172 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10173 | orig_reader = reader |
| 10174 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10175 | obj.xid = reader.read("!L")[0] |
| 10176 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10177 | assert(_stats_type == 1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10178 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10179 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10180 | 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] | 10181 | return obj |
| 10182 | |
| 10183 | def __eq__(self, other): |
| 10184 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10185 | if self.xid != other.xid: return False |
| 10186 | if self.flags != other.flags: return False |
| 10187 | if self.entries != other.entries: return False |
| 10188 | return True |
| 10189 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10190 | def pretty_print(self, q): |
| 10191 | q.text("flow_stats_reply {") |
| 10192 | with q.group(): |
| 10193 | with q.indent(2): |
| 10194 | q.breakable() |
| 10195 | q.text("xid = "); |
| 10196 | if self.xid != None: |
| 10197 | q.text("%#x" % self.xid) |
| 10198 | else: |
| 10199 | q.text('None') |
| 10200 | q.text(","); q.breakable() |
| 10201 | q.text("flags = "); |
| 10202 | q.text("%#x" % self.flags) |
| 10203 | q.text(","); q.breakable() |
| 10204 | q.text("entries = "); |
| 10205 | q.pp(self.entries) |
| 10206 | q.breakable() |
| 10207 | q.text('}') |
| 10208 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10209 | stats_reply.subtypes[1] = flow_stats_reply |
| 10210 | |
| 10211 | class flow_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10212 | version = 4 |
| 10213 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10214 | stats_type = 1 |
| 10215 | |
| 10216 | 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] | 10217 | if xid != None: |
| 10218 | self.xid = xid |
| 10219 | else: |
| 10220 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10221 | if flags != None: |
| 10222 | self.flags = flags |
| 10223 | else: |
| 10224 | self.flags = 0 |
| 10225 | if table_id != None: |
| 10226 | self.table_id = table_id |
| 10227 | else: |
| 10228 | self.table_id = 0 |
| 10229 | if out_port != None: |
| 10230 | self.out_port = out_port |
| 10231 | else: |
| 10232 | self.out_port = 0 |
| 10233 | if out_group != None: |
| 10234 | self.out_group = out_group |
| 10235 | else: |
| 10236 | self.out_group = 0 |
| 10237 | if cookie != None: |
| 10238 | self.cookie = cookie |
| 10239 | else: |
| 10240 | self.cookie = 0 |
| 10241 | if cookie_mask != None: |
| 10242 | self.cookie_mask = cookie_mask |
| 10243 | else: |
| 10244 | self.cookie_mask = 0 |
| 10245 | if match != None: |
| 10246 | self.match = match |
| 10247 | else: |
| 10248 | self.match = common.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10249 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10250 | |
| 10251 | def pack(self): |
| 10252 | packed = [] |
| 10253 | packed.append(struct.pack("!B", self.version)) |
| 10254 | packed.append(struct.pack("!B", self.type)) |
| 10255 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10256 | packed.append(struct.pack("!L", self.xid)) |
| 10257 | packed.append(struct.pack("!H", self.stats_type)) |
| 10258 | packed.append(struct.pack("!H", self.flags)) |
| 10259 | packed.append('\x00' * 4) |
| 10260 | packed.append(struct.pack("!B", self.table_id)) |
| 10261 | packed.append('\x00' * 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10262 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10263 | packed.append(struct.pack("!L", self.out_group)) |
| 10264 | packed.append('\x00' * 4) |
| 10265 | packed.append(struct.pack("!Q", self.cookie)) |
| 10266 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 10267 | packed.append(self.match.pack()) |
| 10268 | length = sum([len(x) for x in packed]) |
| 10269 | packed[2] = struct.pack("!H", length) |
| 10270 | return ''.join(packed) |
| 10271 | |
| 10272 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10273 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10274 | obj = flow_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10275 | _version = reader.read("!B")[0] |
| 10276 | assert(_version == 4) |
| 10277 | _type = reader.read("!B")[0] |
| 10278 | assert(_type == 18) |
| 10279 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10280 | orig_reader = reader |
| 10281 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10282 | obj.xid = reader.read("!L")[0] |
| 10283 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10284 | assert(_stats_type == 1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10285 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10286 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10287 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10288 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10289 | obj.out_port = util.unpack_port_no(reader) |
| 10290 | obj.out_group = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10291 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10292 | obj.cookie = reader.read("!Q")[0] |
| 10293 | obj.cookie_mask = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10294 | obj.match = common.match.unpack(reader) |
| 10295 | return obj |
| 10296 | |
| 10297 | def __eq__(self, other): |
| 10298 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10299 | if self.xid != other.xid: return False |
| 10300 | if self.flags != other.flags: return False |
| 10301 | if self.table_id != other.table_id: return False |
| 10302 | if self.out_port != other.out_port: return False |
| 10303 | if self.out_group != other.out_group: return False |
| 10304 | if self.cookie != other.cookie: return False |
| 10305 | if self.cookie_mask != other.cookie_mask: return False |
| 10306 | if self.match != other.match: return False |
| 10307 | return True |
| 10308 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10309 | def pretty_print(self, q): |
| 10310 | q.text("flow_stats_request {") |
| 10311 | with q.group(): |
| 10312 | with q.indent(2): |
| 10313 | q.breakable() |
| 10314 | q.text("xid = "); |
| 10315 | if self.xid != None: |
| 10316 | q.text("%#x" % self.xid) |
| 10317 | else: |
| 10318 | q.text('None') |
| 10319 | q.text(","); q.breakable() |
| 10320 | q.text("flags = "); |
| 10321 | q.text("%#x" % self.flags) |
| 10322 | q.text(","); q.breakable() |
| 10323 | q.text("table_id = "); |
| 10324 | q.text("%#x" % self.table_id) |
| 10325 | q.text(","); q.breakable() |
| 10326 | q.text("out_port = "); |
| 10327 | q.text(util.pretty_port(self.out_port)) |
| 10328 | q.text(","); q.breakable() |
| 10329 | q.text("out_group = "); |
| 10330 | q.text("%#x" % self.out_group) |
| 10331 | q.text(","); q.breakable() |
| 10332 | q.text("cookie = "); |
| 10333 | q.text("%#x" % self.cookie) |
| 10334 | q.text(","); q.breakable() |
| 10335 | q.text("cookie_mask = "); |
| 10336 | q.text("%#x" % self.cookie_mask) |
| 10337 | q.text(","); q.breakable() |
| 10338 | q.text("match = "); |
| 10339 | q.pp(self.match) |
| 10340 | q.breakable() |
| 10341 | q.text('}') |
| 10342 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10343 | stats_request.subtypes[1] = flow_stats_request |
| 10344 | |
| 10345 | class get_config_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10346 | version = 4 |
| 10347 | type = 8 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10348 | |
| 10349 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10350 | if xid != None: |
| 10351 | self.xid = xid |
| 10352 | else: |
| 10353 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10354 | if flags != None: |
| 10355 | self.flags = flags |
| 10356 | else: |
| 10357 | self.flags = 0 |
| 10358 | if miss_send_len != None: |
| 10359 | self.miss_send_len = miss_send_len |
| 10360 | else: |
| 10361 | self.miss_send_len = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10362 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10363 | |
| 10364 | def pack(self): |
| 10365 | packed = [] |
| 10366 | packed.append(struct.pack("!B", self.version)) |
| 10367 | packed.append(struct.pack("!B", self.type)) |
| 10368 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10369 | packed.append(struct.pack("!L", self.xid)) |
| 10370 | packed.append(struct.pack("!H", self.flags)) |
| 10371 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 10372 | length = sum([len(x) for x in packed]) |
| 10373 | packed[2] = struct.pack("!H", length) |
| 10374 | return ''.join(packed) |
| 10375 | |
| 10376 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10377 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10378 | obj = get_config_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10379 | _version = reader.read("!B")[0] |
| 10380 | assert(_version == 4) |
| 10381 | _type = reader.read("!B")[0] |
| 10382 | assert(_type == 8) |
| 10383 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10384 | orig_reader = reader |
| 10385 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10386 | obj.xid = reader.read("!L")[0] |
| 10387 | obj.flags = reader.read("!H")[0] |
| 10388 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10389 | return obj |
| 10390 | |
| 10391 | def __eq__(self, other): |
| 10392 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10393 | if self.xid != other.xid: return False |
| 10394 | if self.flags != other.flags: return False |
| 10395 | if self.miss_send_len != other.miss_send_len: return False |
| 10396 | return True |
| 10397 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10398 | def pretty_print(self, q): |
| 10399 | q.text("get_config_reply {") |
| 10400 | with q.group(): |
| 10401 | with q.indent(2): |
| 10402 | q.breakable() |
| 10403 | q.text("xid = "); |
| 10404 | if self.xid != None: |
| 10405 | q.text("%#x" % self.xid) |
| 10406 | else: |
| 10407 | q.text('None') |
| 10408 | q.text(","); q.breakable() |
| 10409 | q.text("flags = "); |
| 10410 | q.text("%#x" % self.flags) |
| 10411 | q.text(","); q.breakable() |
| 10412 | q.text("miss_send_len = "); |
| 10413 | q.text("%#x" % self.miss_send_len) |
| 10414 | q.breakable() |
| 10415 | q.text('}') |
| 10416 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10417 | message.subtypes[8] = get_config_reply |
| 10418 | |
| 10419 | class get_config_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10420 | version = 4 |
| 10421 | type = 7 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10422 | |
| 10423 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10424 | if xid != None: |
| 10425 | self.xid = xid |
| 10426 | else: |
| 10427 | self.xid = None |
| 10428 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10429 | |
| 10430 | def pack(self): |
| 10431 | packed = [] |
| 10432 | packed.append(struct.pack("!B", self.version)) |
| 10433 | packed.append(struct.pack("!B", self.type)) |
| 10434 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10435 | packed.append(struct.pack("!L", self.xid)) |
| 10436 | length = sum([len(x) for x in packed]) |
| 10437 | packed[2] = struct.pack("!H", length) |
| 10438 | return ''.join(packed) |
| 10439 | |
| 10440 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10441 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10442 | obj = get_config_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10443 | _version = reader.read("!B")[0] |
| 10444 | assert(_version == 4) |
| 10445 | _type = reader.read("!B")[0] |
| 10446 | assert(_type == 7) |
| 10447 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10448 | orig_reader = reader |
| 10449 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10450 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10451 | return obj |
| 10452 | |
| 10453 | def __eq__(self, other): |
| 10454 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10455 | if self.xid != other.xid: return False |
| 10456 | return True |
| 10457 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10458 | def pretty_print(self, q): |
| 10459 | q.text("get_config_request {") |
| 10460 | with q.group(): |
| 10461 | with q.indent(2): |
| 10462 | q.breakable() |
| 10463 | q.text("xid = "); |
| 10464 | if self.xid != None: |
| 10465 | q.text("%#x" % self.xid) |
| 10466 | else: |
| 10467 | q.text('None') |
| 10468 | q.breakable() |
| 10469 | q.text('}') |
| 10470 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10471 | message.subtypes[7] = get_config_request |
| 10472 | |
| 10473 | class group_mod(message): |
| 10474 | subtypes = {} |
| 10475 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 10476 | version = 4 |
| 10477 | type = 15 |
| 10478 | |
| 10479 | def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None): |
| 10480 | if xid != None: |
| 10481 | self.xid = xid |
| 10482 | else: |
| 10483 | self.xid = None |
| 10484 | if command != None: |
| 10485 | self.command = command |
| 10486 | else: |
| 10487 | self.command = 0 |
| 10488 | if group_type != None: |
| 10489 | self.group_type = group_type |
| 10490 | else: |
| 10491 | self.group_type = 0 |
| 10492 | if group_id != None: |
| 10493 | self.group_id = group_id |
| 10494 | else: |
| 10495 | self.group_id = 0 |
| 10496 | if buckets != None: |
| 10497 | self.buckets = buckets |
| 10498 | else: |
| 10499 | self.buckets = [] |
| 10500 | return |
| 10501 | |
| 10502 | def pack(self): |
| 10503 | packed = [] |
| 10504 | packed.append(struct.pack("!B", self.version)) |
| 10505 | packed.append(struct.pack("!B", self.type)) |
| 10506 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10507 | packed.append(struct.pack("!L", self.xid)) |
| 10508 | packed.append(struct.pack("!H", self.command)) |
| 10509 | packed.append(struct.pack("!B", self.group_type)) |
| 10510 | packed.append('\x00' * 1) |
| 10511 | packed.append(struct.pack("!L", self.group_id)) |
| 10512 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
| 10513 | length = sum([len(x) for x in packed]) |
| 10514 | packed[2] = struct.pack("!H", length) |
| 10515 | return ''.join(packed) |
| 10516 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10517 | @staticmethod |
| 10518 | def unpack(reader): |
| 10519 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 10520 | subclass = group_mod.subtypes.get(subtype) |
| 10521 | if subclass: |
| 10522 | return subclass.unpack(reader) |
| 10523 | |
| 10524 | obj = group_mod() |
| 10525 | _version = reader.read("!B")[0] |
| 10526 | assert(_version == 4) |
| 10527 | _type = reader.read("!B")[0] |
| 10528 | assert(_type == 15) |
| 10529 | _length = reader.read("!H")[0] |
| 10530 | orig_reader = reader |
| 10531 | reader = orig_reader.slice(_length - (2 + 2)) |
| 10532 | obj.xid = reader.read("!L")[0] |
| 10533 | obj.command = reader.read("!H")[0] |
| 10534 | obj.group_type = reader.read("!B")[0] |
| 10535 | reader.skip(1) |
| 10536 | obj.group_id = reader.read("!L")[0] |
| 10537 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
| 10538 | return obj |
| 10539 | |
| 10540 | def __eq__(self, other): |
| 10541 | if type(self) != type(other): return False |
| 10542 | if self.xid != other.xid: return False |
| 10543 | if self.command != other.command: return False |
| 10544 | if self.group_type != other.group_type: return False |
| 10545 | if self.group_id != other.group_id: return False |
| 10546 | if self.buckets != other.buckets: return False |
| 10547 | return True |
| 10548 | |
| 10549 | def pretty_print(self, q): |
| 10550 | q.text("group_mod {") |
| 10551 | with q.group(): |
| 10552 | with q.indent(2): |
| 10553 | q.breakable() |
| 10554 | q.text("xid = "); |
| 10555 | if self.xid != None: |
| 10556 | q.text("%#x" % self.xid) |
| 10557 | else: |
| 10558 | q.text('None') |
| 10559 | q.text(","); q.breakable() |
| 10560 | q.text("group_type = "); |
| 10561 | q.text("%#x" % self.group_type) |
| 10562 | q.text(","); q.breakable() |
| 10563 | q.text("group_id = "); |
| 10564 | q.text("%#x" % self.group_id) |
| 10565 | q.text(","); q.breakable() |
| 10566 | q.text("buckets = "); |
| 10567 | q.pp(self.buckets) |
| 10568 | q.breakable() |
| 10569 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10570 | |
| 10571 | message.subtypes[15] = group_mod |
| 10572 | |
| 10573 | class group_add(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10574 | version = 4 |
| 10575 | type = 15 |
| 10576 | command = 0 |
| 10577 | |
| 10578 | 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] | 10579 | if xid != None: |
| 10580 | self.xid = xid |
| 10581 | else: |
| 10582 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10583 | if group_type != None: |
| 10584 | self.group_type = group_type |
| 10585 | else: |
| 10586 | self.group_type = 0 |
| 10587 | if group_id != None: |
| 10588 | self.group_id = group_id |
| 10589 | else: |
| 10590 | self.group_id = 0 |
| 10591 | if buckets != None: |
| 10592 | self.buckets = buckets |
| 10593 | else: |
| 10594 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10595 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10596 | |
| 10597 | def pack(self): |
| 10598 | packed = [] |
| 10599 | packed.append(struct.pack("!B", self.version)) |
| 10600 | packed.append(struct.pack("!B", self.type)) |
| 10601 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10602 | packed.append(struct.pack("!L", self.xid)) |
| 10603 | packed.append(struct.pack("!H", self.command)) |
| 10604 | packed.append(struct.pack("!B", self.group_type)) |
| 10605 | packed.append('\x00' * 1) |
| 10606 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10607 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10608 | length = sum([len(x) for x in packed]) |
| 10609 | packed[2] = struct.pack("!H", length) |
| 10610 | return ''.join(packed) |
| 10611 | |
| 10612 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10613 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10614 | obj = group_add() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10615 | _version = reader.read("!B")[0] |
| 10616 | assert(_version == 4) |
| 10617 | _type = reader.read("!B")[0] |
| 10618 | assert(_type == 15) |
| 10619 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10620 | orig_reader = reader |
| 10621 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10622 | obj.xid = reader.read("!L")[0] |
| 10623 | _command = reader.read("!H")[0] |
| 10624 | assert(_command == 0) |
| 10625 | obj.group_type = reader.read("!B")[0] |
| 10626 | reader.skip(1) |
| 10627 | obj.group_id = reader.read("!L")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10628 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10629 | return obj |
| 10630 | |
| 10631 | def __eq__(self, other): |
| 10632 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10633 | if self.xid != other.xid: return False |
| 10634 | if self.group_type != other.group_type: return False |
| 10635 | if self.group_id != other.group_id: return False |
| 10636 | if self.buckets != other.buckets: return False |
| 10637 | return True |
| 10638 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10639 | def pretty_print(self, q): |
| 10640 | q.text("group_add {") |
| 10641 | with q.group(): |
| 10642 | with q.indent(2): |
| 10643 | q.breakable() |
| 10644 | q.text("xid = "); |
| 10645 | if self.xid != None: |
| 10646 | q.text("%#x" % self.xid) |
| 10647 | else: |
| 10648 | q.text('None') |
| 10649 | q.text(","); q.breakable() |
| 10650 | q.text("group_type = "); |
| 10651 | q.text("%#x" % self.group_type) |
| 10652 | q.text(","); q.breakable() |
| 10653 | q.text("group_id = "); |
| 10654 | q.text("%#x" % self.group_id) |
| 10655 | q.text(","); q.breakable() |
| 10656 | q.text("buckets = "); |
| 10657 | q.pp(self.buckets) |
| 10658 | q.breakable() |
| 10659 | q.text('}') |
| 10660 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10661 | group_mod.subtypes[0] = group_add |
| 10662 | |
| 10663 | class group_delete(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10664 | version = 4 |
| 10665 | type = 15 |
| 10666 | command = 2 |
| 10667 | |
| 10668 | 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] | 10669 | if xid != None: |
| 10670 | self.xid = xid |
| 10671 | else: |
| 10672 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10673 | if group_type != None: |
| 10674 | self.group_type = group_type |
| 10675 | else: |
| 10676 | self.group_type = 0 |
| 10677 | if group_id != None: |
| 10678 | self.group_id = group_id |
| 10679 | else: |
| 10680 | self.group_id = 0 |
| 10681 | if buckets != None: |
| 10682 | self.buckets = buckets |
| 10683 | else: |
| 10684 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10685 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10686 | |
| 10687 | def pack(self): |
| 10688 | packed = [] |
| 10689 | packed.append(struct.pack("!B", self.version)) |
| 10690 | packed.append(struct.pack("!B", self.type)) |
| 10691 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10692 | packed.append(struct.pack("!L", self.xid)) |
| 10693 | packed.append(struct.pack("!H", self.command)) |
| 10694 | packed.append(struct.pack("!B", self.group_type)) |
| 10695 | packed.append('\x00' * 1) |
| 10696 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10697 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10698 | length = sum([len(x) for x in packed]) |
| 10699 | packed[2] = struct.pack("!H", length) |
| 10700 | return ''.join(packed) |
| 10701 | |
| 10702 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10703 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10704 | obj = group_delete() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10705 | _version = reader.read("!B")[0] |
| 10706 | assert(_version == 4) |
| 10707 | _type = reader.read("!B")[0] |
| 10708 | assert(_type == 15) |
| 10709 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10710 | orig_reader = reader |
| 10711 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10712 | obj.xid = reader.read("!L")[0] |
| 10713 | _command = reader.read("!H")[0] |
| 10714 | assert(_command == 2) |
| 10715 | obj.group_type = reader.read("!B")[0] |
| 10716 | reader.skip(1) |
| 10717 | obj.group_id = reader.read("!L")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10718 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10719 | return obj |
| 10720 | |
| 10721 | def __eq__(self, other): |
| 10722 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10723 | if self.xid != other.xid: return False |
| 10724 | if self.group_type != other.group_type: return False |
| 10725 | if self.group_id != other.group_id: return False |
| 10726 | if self.buckets != other.buckets: return False |
| 10727 | return True |
| 10728 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10729 | def pretty_print(self, q): |
| 10730 | q.text("group_delete {") |
| 10731 | with q.group(): |
| 10732 | with q.indent(2): |
| 10733 | q.breakable() |
| 10734 | q.text("xid = "); |
| 10735 | if self.xid != None: |
| 10736 | q.text("%#x" % self.xid) |
| 10737 | else: |
| 10738 | q.text('None') |
| 10739 | q.text(","); q.breakable() |
| 10740 | q.text("group_type = "); |
| 10741 | q.text("%#x" % self.group_type) |
| 10742 | q.text(","); q.breakable() |
| 10743 | q.text("group_id = "); |
| 10744 | q.text("%#x" % self.group_id) |
| 10745 | q.text(","); q.breakable() |
| 10746 | q.text("buckets = "); |
| 10747 | q.pp(self.buckets) |
| 10748 | q.breakable() |
| 10749 | q.text('}') |
| 10750 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10751 | group_mod.subtypes[2] = group_delete |
| 10752 | |
| 10753 | class group_desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10754 | version = 4 |
| 10755 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10756 | stats_type = 7 |
| 10757 | |
| 10758 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10759 | if xid != None: |
| 10760 | self.xid = xid |
| 10761 | else: |
| 10762 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10763 | if flags != None: |
| 10764 | self.flags = flags |
| 10765 | else: |
| 10766 | self.flags = 0 |
| 10767 | if entries != None: |
| 10768 | self.entries = entries |
| 10769 | else: |
| 10770 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10771 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10772 | |
| 10773 | def pack(self): |
| 10774 | packed = [] |
| 10775 | packed.append(struct.pack("!B", self.version)) |
| 10776 | packed.append(struct.pack("!B", self.type)) |
| 10777 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10778 | packed.append(struct.pack("!L", self.xid)) |
| 10779 | packed.append(struct.pack("!H", self.stats_type)) |
| 10780 | packed.append(struct.pack("!H", self.flags)) |
| 10781 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10782 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10783 | length = sum([len(x) for x in packed]) |
| 10784 | packed[2] = struct.pack("!H", length) |
| 10785 | return ''.join(packed) |
| 10786 | |
| 10787 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10788 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10789 | obj = group_desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10790 | _version = reader.read("!B")[0] |
| 10791 | assert(_version == 4) |
| 10792 | _type = reader.read("!B")[0] |
| 10793 | assert(_type == 19) |
| 10794 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10795 | orig_reader = reader |
| 10796 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10797 | obj.xid = reader.read("!L")[0] |
| 10798 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10799 | assert(_stats_type == 7) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10800 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10801 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10802 | 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] | 10803 | return obj |
| 10804 | |
| 10805 | def __eq__(self, other): |
| 10806 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10807 | if self.xid != other.xid: return False |
| 10808 | if self.flags != other.flags: return False |
| 10809 | if self.entries != other.entries: return False |
| 10810 | return True |
| 10811 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10812 | def pretty_print(self, q): |
| 10813 | q.text("group_desc_stats_reply {") |
| 10814 | with q.group(): |
| 10815 | with q.indent(2): |
| 10816 | q.breakable() |
| 10817 | q.text("xid = "); |
| 10818 | if self.xid != None: |
| 10819 | q.text("%#x" % self.xid) |
| 10820 | else: |
| 10821 | q.text('None') |
| 10822 | q.text(","); q.breakable() |
| 10823 | q.text("flags = "); |
| 10824 | q.text("%#x" % self.flags) |
| 10825 | q.text(","); q.breakable() |
| 10826 | q.text("entries = "); |
| 10827 | q.pp(self.entries) |
| 10828 | q.breakable() |
| 10829 | q.text('}') |
| 10830 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10831 | stats_reply.subtypes[7] = group_desc_stats_reply |
| 10832 | |
| 10833 | class group_desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10834 | version = 4 |
| 10835 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10836 | stats_type = 7 |
| 10837 | |
| 10838 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10839 | if xid != None: |
| 10840 | self.xid = xid |
| 10841 | else: |
| 10842 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10843 | if flags != None: |
| 10844 | self.flags = flags |
| 10845 | else: |
| 10846 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10847 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10848 | |
| 10849 | def pack(self): |
| 10850 | packed = [] |
| 10851 | packed.append(struct.pack("!B", self.version)) |
| 10852 | packed.append(struct.pack("!B", self.type)) |
| 10853 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10854 | packed.append(struct.pack("!L", self.xid)) |
| 10855 | packed.append(struct.pack("!H", self.stats_type)) |
| 10856 | packed.append(struct.pack("!H", self.flags)) |
| 10857 | packed.append('\x00' * 4) |
| 10858 | length = sum([len(x) for x in packed]) |
| 10859 | packed[2] = struct.pack("!H", length) |
| 10860 | return ''.join(packed) |
| 10861 | |
| 10862 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10863 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10864 | obj = group_desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10865 | _version = reader.read("!B")[0] |
| 10866 | assert(_version == 4) |
| 10867 | _type = reader.read("!B")[0] |
| 10868 | assert(_type == 18) |
| 10869 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10870 | orig_reader = reader |
| 10871 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10872 | obj.xid = reader.read("!L")[0] |
| 10873 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10874 | assert(_stats_type == 7) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10875 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10876 | reader.skip(4) |
| 10877 | return obj |
| 10878 | |
| 10879 | def __eq__(self, other): |
| 10880 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10881 | if self.xid != other.xid: return False |
| 10882 | if self.flags != other.flags: return False |
| 10883 | return True |
| 10884 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10885 | def pretty_print(self, q): |
| 10886 | q.text("group_desc_stats_request {") |
| 10887 | with q.group(): |
| 10888 | with q.indent(2): |
| 10889 | q.breakable() |
| 10890 | q.text("xid = "); |
| 10891 | if self.xid != None: |
| 10892 | q.text("%#x" % self.xid) |
| 10893 | else: |
| 10894 | q.text('None') |
| 10895 | q.text(","); q.breakable() |
| 10896 | q.text("flags = "); |
| 10897 | q.text("%#x" % self.flags) |
| 10898 | q.breakable() |
| 10899 | q.text('}') |
| 10900 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10901 | stats_request.subtypes[7] = group_desc_stats_request |
| 10902 | |
| 10903 | class group_features_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10904 | version = 4 |
| 10905 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10906 | stats_type = 8 |
| 10907 | |
| 10908 | 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] | 10909 | if xid != None: |
| 10910 | self.xid = xid |
| 10911 | else: |
| 10912 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10913 | if flags != None: |
| 10914 | self.flags = flags |
| 10915 | else: |
| 10916 | self.flags = 0 |
| 10917 | if types != None: |
| 10918 | self.types = types |
| 10919 | else: |
| 10920 | self.types = 0 |
| 10921 | if capabilities != None: |
| 10922 | self.capabilities = capabilities |
| 10923 | else: |
| 10924 | self.capabilities = 0 |
| 10925 | if max_groups_all != None: |
| 10926 | self.max_groups_all = max_groups_all |
| 10927 | else: |
| 10928 | self.max_groups_all = 0 |
| 10929 | if max_groups_select != None: |
| 10930 | self.max_groups_select = max_groups_select |
| 10931 | else: |
| 10932 | self.max_groups_select = 0 |
| 10933 | if max_groups_indirect != None: |
| 10934 | self.max_groups_indirect = max_groups_indirect |
| 10935 | else: |
| 10936 | self.max_groups_indirect = 0 |
| 10937 | if max_groups_ff != None: |
| 10938 | self.max_groups_ff = max_groups_ff |
| 10939 | else: |
| 10940 | self.max_groups_ff = 0 |
| 10941 | if actions_all != None: |
| 10942 | self.actions_all = actions_all |
| 10943 | else: |
| 10944 | self.actions_all = 0 |
| 10945 | if actions_select != None: |
| 10946 | self.actions_select = actions_select |
| 10947 | else: |
| 10948 | self.actions_select = 0 |
| 10949 | if actions_indirect != None: |
| 10950 | self.actions_indirect = actions_indirect |
| 10951 | else: |
| 10952 | self.actions_indirect = 0 |
| 10953 | if actions_ff != None: |
| 10954 | self.actions_ff = actions_ff |
| 10955 | else: |
| 10956 | self.actions_ff = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10957 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10958 | |
| 10959 | def pack(self): |
| 10960 | packed = [] |
| 10961 | packed.append(struct.pack("!B", self.version)) |
| 10962 | packed.append(struct.pack("!B", self.type)) |
| 10963 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10964 | packed.append(struct.pack("!L", self.xid)) |
| 10965 | packed.append(struct.pack("!H", self.stats_type)) |
| 10966 | packed.append(struct.pack("!H", self.flags)) |
| 10967 | packed.append('\x00' * 4) |
| 10968 | packed.append(struct.pack("!L", self.types)) |
| 10969 | packed.append(struct.pack("!L", self.capabilities)) |
| 10970 | packed.append(struct.pack("!L", self.max_groups_all)) |
| 10971 | packed.append(struct.pack("!L", self.max_groups_select)) |
| 10972 | packed.append(struct.pack("!L", self.max_groups_indirect)) |
| 10973 | packed.append(struct.pack("!L", self.max_groups_ff)) |
| 10974 | packed.append(struct.pack("!L", self.actions_all)) |
| 10975 | packed.append(struct.pack("!L", self.actions_select)) |
| 10976 | packed.append(struct.pack("!L", self.actions_indirect)) |
| 10977 | packed.append(struct.pack("!L", self.actions_ff)) |
| 10978 | length = sum([len(x) for x in packed]) |
| 10979 | packed[2] = struct.pack("!H", length) |
| 10980 | return ''.join(packed) |
| 10981 | |
| 10982 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10983 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10984 | obj = group_features_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10985 | _version = reader.read("!B")[0] |
| 10986 | assert(_version == 4) |
| 10987 | _type = reader.read("!B")[0] |
| 10988 | assert(_type == 19) |
| 10989 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10990 | orig_reader = reader |
| 10991 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10992 | obj.xid = reader.read("!L")[0] |
| 10993 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10994 | assert(_stats_type == 8) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10995 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10996 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10997 | obj.types = reader.read("!L")[0] |
| 10998 | obj.capabilities = reader.read("!L")[0] |
| 10999 | obj.max_groups_all = reader.read("!L")[0] |
| 11000 | obj.max_groups_select = reader.read("!L")[0] |
| 11001 | obj.max_groups_indirect = reader.read("!L")[0] |
| 11002 | obj.max_groups_ff = reader.read("!L")[0] |
| 11003 | obj.actions_all = reader.read("!L")[0] |
| 11004 | obj.actions_select = reader.read("!L")[0] |
| 11005 | obj.actions_indirect = reader.read("!L")[0] |
| 11006 | obj.actions_ff = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11007 | return obj |
| 11008 | |
| 11009 | def __eq__(self, other): |
| 11010 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11011 | if self.xid != other.xid: return False |
| 11012 | if self.flags != other.flags: return False |
| 11013 | if self.types != other.types: return False |
| 11014 | if self.capabilities != other.capabilities: return False |
| 11015 | if self.max_groups_all != other.max_groups_all: return False |
| 11016 | if self.max_groups_select != other.max_groups_select: return False |
| 11017 | if self.max_groups_indirect != other.max_groups_indirect: return False |
| 11018 | if self.max_groups_ff != other.max_groups_ff: return False |
| 11019 | if self.actions_all != other.actions_all: return False |
| 11020 | if self.actions_select != other.actions_select: return False |
| 11021 | if self.actions_indirect != other.actions_indirect: return False |
| 11022 | if self.actions_ff != other.actions_ff: return False |
| 11023 | return True |
| 11024 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11025 | def pretty_print(self, q): |
| 11026 | q.text("group_features_stats_reply {") |
| 11027 | with q.group(): |
| 11028 | with q.indent(2): |
| 11029 | q.breakable() |
| 11030 | q.text("xid = "); |
| 11031 | if self.xid != None: |
| 11032 | q.text("%#x" % self.xid) |
| 11033 | else: |
| 11034 | q.text('None') |
| 11035 | q.text(","); q.breakable() |
| 11036 | q.text("flags = "); |
| 11037 | q.text("%#x" % self.flags) |
| 11038 | q.text(","); q.breakable() |
| 11039 | q.text("types = "); |
| 11040 | q.text("%#x" % self.types) |
| 11041 | q.text(","); q.breakable() |
| 11042 | q.text("capabilities = "); |
| 11043 | q.text("%#x" % self.capabilities) |
| 11044 | q.text(","); q.breakable() |
| 11045 | q.text("max_groups_all = "); |
| 11046 | q.text("%#x" % self.max_groups_all) |
| 11047 | q.text(","); q.breakable() |
| 11048 | q.text("max_groups_select = "); |
| 11049 | q.text("%#x" % self.max_groups_select) |
| 11050 | q.text(","); q.breakable() |
| 11051 | q.text("max_groups_indirect = "); |
| 11052 | q.text("%#x" % self.max_groups_indirect) |
| 11053 | q.text(","); q.breakable() |
| 11054 | q.text("max_groups_ff = "); |
| 11055 | q.text("%#x" % self.max_groups_ff) |
| 11056 | q.text(","); q.breakable() |
| 11057 | q.text("actions_all = "); |
| 11058 | q.text("%#x" % self.actions_all) |
| 11059 | q.text(","); q.breakable() |
| 11060 | q.text("actions_select = "); |
| 11061 | q.text("%#x" % self.actions_select) |
| 11062 | q.text(","); q.breakable() |
| 11063 | q.text("actions_indirect = "); |
| 11064 | q.text("%#x" % self.actions_indirect) |
| 11065 | q.text(","); q.breakable() |
| 11066 | q.text("actions_ff = "); |
| 11067 | q.text("%#x" % self.actions_ff) |
| 11068 | q.breakable() |
| 11069 | q.text('}') |
| 11070 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11071 | stats_reply.subtypes[8] = group_features_stats_reply |
| 11072 | |
| 11073 | class group_features_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11074 | version = 4 |
| 11075 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11076 | stats_type = 8 |
| 11077 | |
| 11078 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11079 | if xid != None: |
| 11080 | self.xid = xid |
| 11081 | else: |
| 11082 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11083 | if flags != None: |
| 11084 | self.flags = flags |
| 11085 | else: |
| 11086 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11087 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11088 | |
| 11089 | def pack(self): |
| 11090 | packed = [] |
| 11091 | packed.append(struct.pack("!B", self.version)) |
| 11092 | packed.append(struct.pack("!B", self.type)) |
| 11093 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11094 | packed.append(struct.pack("!L", self.xid)) |
| 11095 | packed.append(struct.pack("!H", self.stats_type)) |
| 11096 | packed.append(struct.pack("!H", self.flags)) |
| 11097 | packed.append('\x00' * 4) |
| 11098 | length = sum([len(x) for x in packed]) |
| 11099 | packed[2] = struct.pack("!H", length) |
| 11100 | return ''.join(packed) |
| 11101 | |
| 11102 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11103 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11104 | obj = group_features_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11105 | _version = reader.read("!B")[0] |
| 11106 | assert(_version == 4) |
| 11107 | _type = reader.read("!B")[0] |
| 11108 | assert(_type == 18) |
| 11109 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11110 | orig_reader = reader |
| 11111 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11112 | obj.xid = reader.read("!L")[0] |
| 11113 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11114 | assert(_stats_type == 8) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11115 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11116 | reader.skip(4) |
| 11117 | return obj |
| 11118 | |
| 11119 | def __eq__(self, other): |
| 11120 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11121 | if self.xid != other.xid: return False |
| 11122 | if self.flags != other.flags: return False |
| 11123 | return True |
| 11124 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11125 | def pretty_print(self, q): |
| 11126 | q.text("group_features_stats_request {") |
| 11127 | with q.group(): |
| 11128 | with q.indent(2): |
| 11129 | q.breakable() |
| 11130 | q.text("xid = "); |
| 11131 | if self.xid != None: |
| 11132 | q.text("%#x" % self.xid) |
| 11133 | else: |
| 11134 | q.text('None') |
| 11135 | q.text(","); q.breakable() |
| 11136 | q.text("flags = "); |
| 11137 | q.text("%#x" % self.flags) |
| 11138 | q.breakable() |
| 11139 | q.text('}') |
| 11140 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11141 | stats_request.subtypes[8] = group_features_stats_request |
| 11142 | |
| 11143 | class group_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11144 | version = 4 |
| 11145 | type = 1 |
| 11146 | err_type = 6 |
| 11147 | |
| 11148 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11149 | if xid != None: |
| 11150 | self.xid = xid |
| 11151 | else: |
| 11152 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11153 | if code != None: |
| 11154 | self.code = code |
| 11155 | else: |
| 11156 | self.code = 0 |
| 11157 | if data != None: |
| 11158 | self.data = data |
| 11159 | else: |
| 11160 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11161 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11162 | |
| 11163 | def pack(self): |
| 11164 | packed = [] |
| 11165 | packed.append(struct.pack("!B", self.version)) |
| 11166 | packed.append(struct.pack("!B", self.type)) |
| 11167 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11168 | packed.append(struct.pack("!L", self.xid)) |
| 11169 | packed.append(struct.pack("!H", self.err_type)) |
| 11170 | packed.append(struct.pack("!H", self.code)) |
| 11171 | packed.append(self.data) |
| 11172 | length = sum([len(x) for x in packed]) |
| 11173 | packed[2] = struct.pack("!H", length) |
| 11174 | return ''.join(packed) |
| 11175 | |
| 11176 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11177 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11178 | obj = group_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11179 | _version = reader.read("!B")[0] |
| 11180 | assert(_version == 4) |
| 11181 | _type = reader.read("!B")[0] |
| 11182 | assert(_type == 1) |
| 11183 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11184 | orig_reader = reader |
| 11185 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11186 | obj.xid = reader.read("!L")[0] |
| 11187 | _err_type = reader.read("!H")[0] |
| 11188 | assert(_err_type == 6) |
| 11189 | obj.code = reader.read("!H")[0] |
| 11190 | obj.data = str(reader.read_all()) |
| 11191 | return obj |
| 11192 | |
| 11193 | def __eq__(self, other): |
| 11194 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11195 | if self.xid != other.xid: return False |
| 11196 | if self.code != other.code: return False |
| 11197 | if self.data != other.data: return False |
| 11198 | return True |
| 11199 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11200 | def pretty_print(self, q): |
| 11201 | q.text("group_mod_failed_error_msg {") |
| 11202 | with q.group(): |
| 11203 | with q.indent(2): |
| 11204 | q.breakable() |
| 11205 | q.text("xid = "); |
| 11206 | if self.xid != None: |
| 11207 | q.text("%#x" % self.xid) |
| 11208 | else: |
| 11209 | q.text('None') |
| 11210 | q.text(","); q.breakable() |
| 11211 | q.text("code = "); |
| 11212 | q.text("%#x" % self.code) |
| 11213 | q.text(","); q.breakable() |
| 11214 | q.text("data = "); |
| 11215 | q.pp(self.data) |
| 11216 | q.breakable() |
| 11217 | q.text('}') |
| 11218 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11219 | error_msg.subtypes[6] = group_mod_failed_error_msg |
| 11220 | |
| 11221 | class group_modify(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11222 | version = 4 |
| 11223 | type = 15 |
| 11224 | command = 1 |
| 11225 | |
| 11226 | 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] | 11227 | if xid != None: |
| 11228 | self.xid = xid |
| 11229 | else: |
| 11230 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11231 | if group_type != None: |
| 11232 | self.group_type = group_type |
| 11233 | else: |
| 11234 | self.group_type = 0 |
| 11235 | if group_id != None: |
| 11236 | self.group_id = group_id |
| 11237 | else: |
| 11238 | self.group_id = 0 |
| 11239 | if buckets != None: |
| 11240 | self.buckets = buckets |
| 11241 | else: |
| 11242 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11243 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11244 | |
| 11245 | def pack(self): |
| 11246 | packed = [] |
| 11247 | packed.append(struct.pack("!B", self.version)) |
| 11248 | packed.append(struct.pack("!B", self.type)) |
| 11249 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11250 | packed.append(struct.pack("!L", self.xid)) |
| 11251 | packed.append(struct.pack("!H", self.command)) |
| 11252 | packed.append(struct.pack("!B", self.group_type)) |
| 11253 | packed.append('\x00' * 1) |
| 11254 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11255 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11256 | length = sum([len(x) for x in packed]) |
| 11257 | packed[2] = struct.pack("!H", length) |
| 11258 | return ''.join(packed) |
| 11259 | |
| 11260 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11261 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11262 | obj = group_modify() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11263 | _version = reader.read("!B")[0] |
| 11264 | assert(_version == 4) |
| 11265 | _type = reader.read("!B")[0] |
| 11266 | assert(_type == 15) |
| 11267 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11268 | orig_reader = reader |
| 11269 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11270 | obj.xid = reader.read("!L")[0] |
| 11271 | _command = reader.read("!H")[0] |
| 11272 | assert(_command == 1) |
| 11273 | obj.group_type = reader.read("!B")[0] |
| 11274 | reader.skip(1) |
| 11275 | obj.group_id = reader.read("!L")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11276 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11277 | return obj |
| 11278 | |
| 11279 | def __eq__(self, other): |
| 11280 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11281 | if self.xid != other.xid: return False |
| 11282 | if self.group_type != other.group_type: return False |
| 11283 | if self.group_id != other.group_id: return False |
| 11284 | if self.buckets != other.buckets: return False |
| 11285 | return True |
| 11286 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11287 | def pretty_print(self, q): |
| 11288 | q.text("group_modify {") |
| 11289 | with q.group(): |
| 11290 | with q.indent(2): |
| 11291 | q.breakable() |
| 11292 | q.text("xid = "); |
| 11293 | if self.xid != None: |
| 11294 | q.text("%#x" % self.xid) |
| 11295 | else: |
| 11296 | q.text('None') |
| 11297 | q.text(","); q.breakable() |
| 11298 | q.text("group_type = "); |
| 11299 | q.text("%#x" % self.group_type) |
| 11300 | q.text(","); q.breakable() |
| 11301 | q.text("group_id = "); |
| 11302 | q.text("%#x" % self.group_id) |
| 11303 | q.text(","); q.breakable() |
| 11304 | q.text("buckets = "); |
| 11305 | q.pp(self.buckets) |
| 11306 | q.breakable() |
| 11307 | q.text('}') |
| 11308 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11309 | group_mod.subtypes[1] = group_modify |
| 11310 | |
| 11311 | class group_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11312 | version = 4 |
| 11313 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11314 | stats_type = 6 |
| 11315 | |
| 11316 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11317 | if xid != None: |
| 11318 | self.xid = xid |
| 11319 | else: |
| 11320 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11321 | if flags != None: |
| 11322 | self.flags = flags |
| 11323 | else: |
| 11324 | self.flags = 0 |
| 11325 | if entries != None: |
| 11326 | self.entries = entries |
| 11327 | else: |
| 11328 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11329 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11330 | |
| 11331 | def pack(self): |
| 11332 | packed = [] |
| 11333 | packed.append(struct.pack("!B", self.version)) |
| 11334 | packed.append(struct.pack("!B", self.type)) |
| 11335 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11336 | packed.append(struct.pack("!L", self.xid)) |
| 11337 | packed.append(struct.pack("!H", self.stats_type)) |
| 11338 | packed.append(struct.pack("!H", self.flags)) |
| 11339 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11340 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11341 | length = sum([len(x) for x in packed]) |
| 11342 | packed[2] = struct.pack("!H", length) |
| 11343 | return ''.join(packed) |
| 11344 | |
| 11345 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11346 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11347 | obj = group_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11348 | _version = reader.read("!B")[0] |
| 11349 | assert(_version == 4) |
| 11350 | _type = reader.read("!B")[0] |
| 11351 | assert(_type == 19) |
| 11352 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11353 | orig_reader = reader |
| 11354 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11355 | obj.xid = reader.read("!L")[0] |
| 11356 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11357 | assert(_stats_type == 6) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11358 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11359 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11360 | 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] | 11361 | return obj |
| 11362 | |
| 11363 | def __eq__(self, other): |
| 11364 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11365 | if self.xid != other.xid: return False |
| 11366 | if self.flags != other.flags: return False |
| 11367 | if self.entries != other.entries: return False |
| 11368 | return True |
| 11369 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11370 | def pretty_print(self, q): |
| 11371 | q.text("group_stats_reply {") |
| 11372 | with q.group(): |
| 11373 | with q.indent(2): |
| 11374 | q.breakable() |
| 11375 | q.text("xid = "); |
| 11376 | if self.xid != None: |
| 11377 | q.text("%#x" % self.xid) |
| 11378 | else: |
| 11379 | q.text('None') |
| 11380 | q.text(","); q.breakable() |
| 11381 | q.text("flags = "); |
| 11382 | q.text("%#x" % self.flags) |
| 11383 | q.text(","); q.breakable() |
| 11384 | q.text("entries = "); |
| 11385 | q.pp(self.entries) |
| 11386 | q.breakable() |
| 11387 | q.text('}') |
| 11388 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11389 | stats_reply.subtypes[6] = group_stats_reply |
| 11390 | |
| 11391 | class group_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11392 | version = 4 |
| 11393 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11394 | stats_type = 6 |
| 11395 | |
| 11396 | def __init__(self, xid=None, flags=None, group_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11397 | if xid != None: |
| 11398 | self.xid = xid |
| 11399 | else: |
| 11400 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11401 | if flags != None: |
| 11402 | self.flags = flags |
| 11403 | else: |
| 11404 | self.flags = 0 |
| 11405 | if group_id != None: |
| 11406 | self.group_id = group_id |
| 11407 | else: |
| 11408 | self.group_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11409 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11410 | |
| 11411 | def pack(self): |
| 11412 | packed = [] |
| 11413 | packed.append(struct.pack("!B", self.version)) |
| 11414 | packed.append(struct.pack("!B", self.type)) |
| 11415 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11416 | packed.append(struct.pack("!L", self.xid)) |
| 11417 | packed.append(struct.pack("!H", self.stats_type)) |
| 11418 | packed.append(struct.pack("!H", self.flags)) |
| 11419 | packed.append('\x00' * 4) |
| 11420 | packed.append(struct.pack("!L", self.group_id)) |
| 11421 | packed.append('\x00' * 4) |
| 11422 | length = sum([len(x) for x in packed]) |
| 11423 | packed[2] = struct.pack("!H", length) |
| 11424 | return ''.join(packed) |
| 11425 | |
| 11426 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11427 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11428 | obj = group_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11429 | _version = reader.read("!B")[0] |
| 11430 | assert(_version == 4) |
| 11431 | _type = reader.read("!B")[0] |
| 11432 | assert(_type == 18) |
| 11433 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11434 | orig_reader = reader |
| 11435 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11436 | obj.xid = reader.read("!L")[0] |
| 11437 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11438 | assert(_stats_type == 6) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11439 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11440 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11441 | obj.group_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11442 | reader.skip(4) |
| 11443 | return obj |
| 11444 | |
| 11445 | def __eq__(self, other): |
| 11446 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11447 | if self.xid != other.xid: return False |
| 11448 | if self.flags != other.flags: return False |
| 11449 | if self.group_id != other.group_id: return False |
| 11450 | return True |
| 11451 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11452 | def pretty_print(self, q): |
| 11453 | q.text("group_stats_request {") |
| 11454 | with q.group(): |
| 11455 | with q.indent(2): |
| 11456 | q.breakable() |
| 11457 | q.text("xid = "); |
| 11458 | if self.xid != None: |
| 11459 | q.text("%#x" % self.xid) |
| 11460 | else: |
| 11461 | q.text('None') |
| 11462 | q.text(","); q.breakable() |
| 11463 | q.text("flags = "); |
| 11464 | q.text("%#x" % self.flags) |
| 11465 | q.text(","); q.breakable() |
| 11466 | q.text("group_id = "); |
| 11467 | q.text("%#x" % self.group_id) |
| 11468 | q.breakable() |
| 11469 | q.text('}') |
| 11470 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11471 | stats_request.subtypes[6] = group_stats_request |
| 11472 | |
| 11473 | class hello(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11474 | version = 4 |
| 11475 | type = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11476 | |
| 11477 | def __init__(self, xid=None, elements=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11478 | if xid != None: |
| 11479 | self.xid = xid |
| 11480 | else: |
| 11481 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11482 | if elements != None: |
| 11483 | self.elements = elements |
| 11484 | else: |
| 11485 | self.elements = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11486 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11487 | |
| 11488 | def pack(self): |
| 11489 | packed = [] |
| 11490 | packed.append(struct.pack("!B", self.version)) |
| 11491 | packed.append(struct.pack("!B", self.type)) |
| 11492 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11493 | packed.append(struct.pack("!L", self.xid)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11494 | packed.append(loxi.generic_util.pack_list(self.elements)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11495 | length = sum([len(x) for x in packed]) |
| 11496 | packed[2] = struct.pack("!H", length) |
| 11497 | return ''.join(packed) |
| 11498 | |
| 11499 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11500 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11501 | obj = hello() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11502 | _version = reader.read("!B")[0] |
| 11503 | assert(_version == 4) |
| 11504 | _type = reader.read("!B")[0] |
| 11505 | assert(_type == 0) |
| 11506 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11507 | orig_reader = reader |
| 11508 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11509 | obj.xid = reader.read("!L")[0] |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 11510 | obj.elements = loxi.generic_util.unpack_list(reader, common.hello_elem.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11511 | return obj |
| 11512 | |
| 11513 | def __eq__(self, other): |
| 11514 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11515 | if self.xid != other.xid: return False |
| 11516 | if self.elements != other.elements: return False |
| 11517 | return True |
| 11518 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11519 | def pretty_print(self, q): |
| 11520 | q.text("hello {") |
| 11521 | with q.group(): |
| 11522 | with q.indent(2): |
| 11523 | q.breakable() |
| 11524 | q.text("xid = "); |
| 11525 | if self.xid != None: |
| 11526 | q.text("%#x" % self.xid) |
| 11527 | else: |
| 11528 | q.text('None') |
| 11529 | q.text(","); q.breakable() |
| 11530 | q.text("elements = "); |
| 11531 | q.pp(self.elements) |
| 11532 | q.breakable() |
| 11533 | q.text('}') |
| 11534 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11535 | message.subtypes[0] = hello |
| 11536 | |
| 11537 | class hello_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11538 | version = 4 |
| 11539 | type = 1 |
| 11540 | err_type = 0 |
| 11541 | |
| 11542 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11543 | if xid != None: |
| 11544 | self.xid = xid |
| 11545 | else: |
| 11546 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11547 | if code != None: |
| 11548 | self.code = code |
| 11549 | else: |
| 11550 | self.code = 0 |
| 11551 | if data != None: |
| 11552 | self.data = data |
| 11553 | else: |
| 11554 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11555 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11556 | |
| 11557 | def pack(self): |
| 11558 | packed = [] |
| 11559 | packed.append(struct.pack("!B", self.version)) |
| 11560 | packed.append(struct.pack("!B", self.type)) |
| 11561 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11562 | packed.append(struct.pack("!L", self.xid)) |
| 11563 | packed.append(struct.pack("!H", self.err_type)) |
| 11564 | packed.append(struct.pack("!H", self.code)) |
| 11565 | packed.append(self.data) |
| 11566 | length = sum([len(x) for x in packed]) |
| 11567 | packed[2] = struct.pack("!H", length) |
| 11568 | return ''.join(packed) |
| 11569 | |
| 11570 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11571 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11572 | obj = hello_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11573 | _version = reader.read("!B")[0] |
| 11574 | assert(_version == 4) |
| 11575 | _type = reader.read("!B")[0] |
| 11576 | assert(_type == 1) |
| 11577 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11578 | orig_reader = reader |
| 11579 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11580 | obj.xid = reader.read("!L")[0] |
| 11581 | _err_type = reader.read("!H")[0] |
| 11582 | assert(_err_type == 0) |
| 11583 | obj.code = reader.read("!H")[0] |
| 11584 | obj.data = str(reader.read_all()) |
| 11585 | return obj |
| 11586 | |
| 11587 | def __eq__(self, other): |
| 11588 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11589 | if self.xid != other.xid: return False |
| 11590 | if self.code != other.code: return False |
| 11591 | if self.data != other.data: return False |
| 11592 | return True |
| 11593 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11594 | def pretty_print(self, q): |
| 11595 | q.text("hello_failed_error_msg {") |
| 11596 | with q.group(): |
| 11597 | with q.indent(2): |
| 11598 | q.breakable() |
| 11599 | q.text("xid = "); |
| 11600 | if self.xid != None: |
| 11601 | q.text("%#x" % self.xid) |
| 11602 | else: |
| 11603 | q.text('None') |
| 11604 | q.text(","); q.breakable() |
| 11605 | q.text("code = "); |
| 11606 | q.text("%#x" % self.code) |
| 11607 | q.text(","); q.breakable() |
| 11608 | q.text("data = "); |
| 11609 | q.pp(self.data) |
| 11610 | q.breakable() |
| 11611 | q.text('}') |
| 11612 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11613 | error_msg.subtypes[0] = hello_failed_error_msg |
| 11614 | |
| 11615 | class meter_config_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11616 | version = 4 |
| 11617 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11618 | stats_type = 10 |
| 11619 | |
| 11620 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11621 | if xid != None: |
| 11622 | self.xid = xid |
| 11623 | else: |
| 11624 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11625 | if flags != None: |
| 11626 | self.flags = flags |
| 11627 | else: |
| 11628 | self.flags = 0 |
| 11629 | if entries != None: |
| 11630 | self.entries = entries |
| 11631 | else: |
| 11632 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11633 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11634 | |
| 11635 | def pack(self): |
| 11636 | packed = [] |
| 11637 | packed.append(struct.pack("!B", self.version)) |
| 11638 | packed.append(struct.pack("!B", self.type)) |
| 11639 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11640 | packed.append(struct.pack("!L", self.xid)) |
| 11641 | packed.append(struct.pack("!H", self.stats_type)) |
| 11642 | packed.append(struct.pack("!H", self.flags)) |
| 11643 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11644 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11645 | length = sum([len(x) for x in packed]) |
| 11646 | packed[2] = struct.pack("!H", length) |
| 11647 | return ''.join(packed) |
| 11648 | |
| 11649 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11650 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11651 | obj = meter_config_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11652 | _version = reader.read("!B")[0] |
| 11653 | assert(_version == 4) |
| 11654 | _type = reader.read("!B")[0] |
| 11655 | assert(_type == 19) |
| 11656 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11657 | orig_reader = reader |
| 11658 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11659 | obj.xid = reader.read("!L")[0] |
| 11660 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11661 | assert(_stats_type == 10) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11662 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11663 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11664 | 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] | 11665 | return obj |
| 11666 | |
| 11667 | def __eq__(self, other): |
| 11668 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11669 | if self.xid != other.xid: return False |
| 11670 | if self.flags != other.flags: return False |
| 11671 | if self.entries != other.entries: return False |
| 11672 | return True |
| 11673 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11674 | def pretty_print(self, q): |
| 11675 | q.text("meter_config_stats_reply {") |
| 11676 | with q.group(): |
| 11677 | with q.indent(2): |
| 11678 | q.breakable() |
| 11679 | q.text("xid = "); |
| 11680 | if self.xid != None: |
| 11681 | q.text("%#x" % self.xid) |
| 11682 | else: |
| 11683 | q.text('None') |
| 11684 | q.text(","); q.breakable() |
| 11685 | q.text("flags = "); |
| 11686 | q.text("%#x" % self.flags) |
| 11687 | q.text(","); q.breakable() |
| 11688 | q.text("entries = "); |
| 11689 | q.pp(self.entries) |
| 11690 | q.breakable() |
| 11691 | q.text('}') |
| 11692 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11693 | stats_reply.subtypes[10] = meter_config_stats_reply |
| 11694 | |
| 11695 | class meter_config_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11696 | version = 4 |
| 11697 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11698 | stats_type = 10 |
| 11699 | |
| 11700 | def __init__(self, xid=None, flags=None, meter_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11701 | if xid != None: |
| 11702 | self.xid = xid |
| 11703 | else: |
| 11704 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11705 | if flags != None: |
| 11706 | self.flags = flags |
| 11707 | else: |
| 11708 | self.flags = 0 |
| 11709 | if meter_id != None: |
| 11710 | self.meter_id = meter_id |
| 11711 | else: |
| 11712 | self.meter_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11713 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11714 | |
| 11715 | def pack(self): |
| 11716 | packed = [] |
| 11717 | packed.append(struct.pack("!B", self.version)) |
| 11718 | packed.append(struct.pack("!B", self.type)) |
| 11719 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11720 | packed.append(struct.pack("!L", self.xid)) |
| 11721 | packed.append(struct.pack("!H", self.stats_type)) |
| 11722 | packed.append(struct.pack("!H", self.flags)) |
| 11723 | packed.append('\x00' * 4) |
| 11724 | packed.append(struct.pack("!L", self.meter_id)) |
| 11725 | packed.append('\x00' * 4) |
| 11726 | length = sum([len(x) for x in packed]) |
| 11727 | packed[2] = struct.pack("!H", length) |
| 11728 | return ''.join(packed) |
| 11729 | |
| 11730 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11731 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11732 | obj = meter_config_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11733 | _version = reader.read("!B")[0] |
| 11734 | assert(_version == 4) |
| 11735 | _type = reader.read("!B")[0] |
| 11736 | assert(_type == 18) |
| 11737 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11738 | orig_reader = reader |
| 11739 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11740 | obj.xid = reader.read("!L")[0] |
| 11741 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11742 | assert(_stats_type == 10) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11743 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11744 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11745 | obj.meter_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11746 | reader.skip(4) |
| 11747 | return obj |
| 11748 | |
| 11749 | def __eq__(self, other): |
| 11750 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11751 | if self.xid != other.xid: return False |
| 11752 | if self.flags != other.flags: return False |
| 11753 | if self.meter_id != other.meter_id: 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("meter_config_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.text(","); q.breakable() |
| 11770 | q.text("meter_id = "); |
| 11771 | q.text("%#x" % self.meter_id) |
| 11772 | q.breakable() |
| 11773 | q.text('}') |
| 11774 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11775 | stats_request.subtypes[10] = meter_config_stats_request |
| 11776 | |
| 11777 | class meter_features_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11778 | version = 4 |
| 11779 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11780 | stats_type = 11 |
| 11781 | |
| 11782 | def __init__(self, xid=None, flags=None, features=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11783 | if xid != None: |
| 11784 | self.xid = xid |
| 11785 | else: |
| 11786 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11787 | if flags != None: |
| 11788 | self.flags = flags |
| 11789 | else: |
| 11790 | self.flags = 0 |
| 11791 | if features != None: |
| 11792 | self.features = features |
| 11793 | else: |
| 11794 | self.features = common.meter_features() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11795 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11796 | |
| 11797 | def pack(self): |
| 11798 | packed = [] |
| 11799 | packed.append(struct.pack("!B", self.version)) |
| 11800 | packed.append(struct.pack("!B", self.type)) |
| 11801 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11802 | packed.append(struct.pack("!L", self.xid)) |
| 11803 | packed.append(struct.pack("!H", self.stats_type)) |
| 11804 | packed.append(struct.pack("!H", self.flags)) |
| 11805 | packed.append('\x00' * 4) |
| 11806 | packed.append(self.features.pack()) |
| 11807 | length = sum([len(x) for x in packed]) |
| 11808 | packed[2] = struct.pack("!H", length) |
| 11809 | return ''.join(packed) |
| 11810 | |
| 11811 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11812 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11813 | obj = meter_features_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11814 | _version = reader.read("!B")[0] |
| 11815 | assert(_version == 4) |
| 11816 | _type = reader.read("!B")[0] |
| 11817 | assert(_type == 19) |
| 11818 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11819 | orig_reader = reader |
| 11820 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11821 | obj.xid = reader.read("!L")[0] |
| 11822 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11823 | assert(_stats_type == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11824 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11825 | reader.skip(4) |
| 11826 | obj.features = common.meter_features.unpack(reader) |
| 11827 | return obj |
| 11828 | |
| 11829 | def __eq__(self, other): |
| 11830 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11831 | if self.xid != other.xid: return False |
| 11832 | if self.flags != other.flags: return False |
| 11833 | if self.features != other.features: return False |
| 11834 | return True |
| 11835 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11836 | def pretty_print(self, q): |
| 11837 | q.text("meter_features_stats_reply {") |
| 11838 | with q.group(): |
| 11839 | with q.indent(2): |
| 11840 | q.breakable() |
| 11841 | q.text("xid = "); |
| 11842 | if self.xid != None: |
| 11843 | q.text("%#x" % self.xid) |
| 11844 | else: |
| 11845 | q.text('None') |
| 11846 | q.text(","); q.breakable() |
| 11847 | q.text("flags = "); |
| 11848 | q.text("%#x" % self.flags) |
| 11849 | q.text(","); q.breakable() |
| 11850 | q.text("features = "); |
| 11851 | q.pp(self.features) |
| 11852 | q.breakable() |
| 11853 | q.text('}') |
| 11854 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11855 | stats_reply.subtypes[11] = meter_features_stats_reply |
| 11856 | |
| 11857 | class meter_features_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11858 | version = 4 |
| 11859 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11860 | stats_type = 11 |
| 11861 | |
| 11862 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11863 | if xid != None: |
| 11864 | self.xid = xid |
| 11865 | else: |
| 11866 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11867 | if flags != None: |
| 11868 | self.flags = flags |
| 11869 | else: |
| 11870 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11871 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11872 | |
| 11873 | def pack(self): |
| 11874 | packed = [] |
| 11875 | packed.append(struct.pack("!B", self.version)) |
| 11876 | packed.append(struct.pack("!B", self.type)) |
| 11877 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11878 | packed.append(struct.pack("!L", self.xid)) |
| 11879 | packed.append(struct.pack("!H", self.stats_type)) |
| 11880 | packed.append(struct.pack("!H", self.flags)) |
| 11881 | packed.append('\x00' * 4) |
| 11882 | length = sum([len(x) for x in packed]) |
| 11883 | packed[2] = struct.pack("!H", length) |
| 11884 | return ''.join(packed) |
| 11885 | |
| 11886 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11887 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11888 | obj = meter_features_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11889 | _version = reader.read("!B")[0] |
| 11890 | assert(_version == 4) |
| 11891 | _type = reader.read("!B")[0] |
| 11892 | assert(_type == 18) |
| 11893 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11894 | orig_reader = reader |
| 11895 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11896 | obj.xid = reader.read("!L")[0] |
| 11897 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11898 | assert(_stats_type == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11899 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11900 | reader.skip(4) |
| 11901 | return obj |
| 11902 | |
| 11903 | def __eq__(self, other): |
| 11904 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11905 | if self.xid != other.xid: return False |
| 11906 | if self.flags != other.flags: return False |
| 11907 | return True |
| 11908 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11909 | def pretty_print(self, q): |
| 11910 | q.text("meter_features_stats_request {") |
| 11911 | with q.group(): |
| 11912 | with q.indent(2): |
| 11913 | q.breakable() |
| 11914 | q.text("xid = "); |
| 11915 | if self.xid != None: |
| 11916 | q.text("%#x" % self.xid) |
| 11917 | else: |
| 11918 | q.text('None') |
| 11919 | q.text(","); q.breakable() |
| 11920 | q.text("flags = "); |
| 11921 | q.text("%#x" % self.flags) |
| 11922 | q.breakable() |
| 11923 | q.text('}') |
| 11924 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11925 | stats_request.subtypes[11] = meter_features_stats_request |
| 11926 | |
| 11927 | class meter_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11928 | version = 4 |
| 11929 | type = 29 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11930 | |
| 11931 | 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] | 11932 | if xid != None: |
| 11933 | self.xid = xid |
| 11934 | else: |
| 11935 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11936 | if command != None: |
| 11937 | self.command = command |
| 11938 | else: |
| 11939 | self.command = 0 |
| 11940 | if flags != None: |
| 11941 | self.flags = flags |
| 11942 | else: |
| 11943 | self.flags = 0 |
| 11944 | if meter_id != None: |
| 11945 | self.meter_id = meter_id |
| 11946 | else: |
| 11947 | self.meter_id = 0 |
| 11948 | if meters != None: |
| 11949 | self.meters = meters |
| 11950 | else: |
| 11951 | self.meters = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11952 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11953 | |
| 11954 | def pack(self): |
| 11955 | packed = [] |
| 11956 | packed.append(struct.pack("!B", self.version)) |
| 11957 | packed.append(struct.pack("!B", self.type)) |
| 11958 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11959 | packed.append(struct.pack("!L", self.xid)) |
| 11960 | packed.append(struct.pack("!H", self.command)) |
| 11961 | packed.append(struct.pack("!H", self.flags)) |
| 11962 | packed.append(struct.pack("!L", self.meter_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11963 | packed.append(loxi.generic_util.pack_list(self.meters)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11964 | length = sum([len(x) for x in packed]) |
| 11965 | packed[2] = struct.pack("!H", length) |
| 11966 | return ''.join(packed) |
| 11967 | |
| 11968 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11969 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11970 | obj = meter_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11971 | _version = reader.read("!B")[0] |
| 11972 | assert(_version == 4) |
| 11973 | _type = reader.read("!B")[0] |
| 11974 | assert(_type == 29) |
| 11975 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11976 | orig_reader = reader |
| 11977 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11978 | obj.xid = reader.read("!L")[0] |
| 11979 | obj.command = reader.read("!H")[0] |
| 11980 | obj.flags = reader.read("!H")[0] |
| 11981 | obj.meter_id = reader.read("!L")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11982 | 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] | 11983 | return obj |
| 11984 | |
| 11985 | def __eq__(self, other): |
| 11986 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11987 | if self.xid != other.xid: return False |
| 11988 | if self.command != other.command: return False |
| 11989 | if self.flags != other.flags: return False |
| 11990 | if self.meter_id != other.meter_id: return False |
| 11991 | if self.meters != other.meters: return False |
| 11992 | return True |
| 11993 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11994 | def pretty_print(self, q): |
| 11995 | q.text("meter_mod {") |
| 11996 | with q.group(): |
| 11997 | with q.indent(2): |
| 11998 | q.breakable() |
| 11999 | q.text("xid = "); |
| 12000 | if self.xid != None: |
| 12001 | q.text("%#x" % self.xid) |
| 12002 | else: |
| 12003 | q.text('None') |
| 12004 | q.text(","); q.breakable() |
| 12005 | q.text("command = "); |
| 12006 | q.text("%#x" % self.command) |
| 12007 | q.text(","); q.breakable() |
| 12008 | q.text("flags = "); |
| 12009 | q.text("%#x" % self.flags) |
| 12010 | q.text(","); q.breakable() |
| 12011 | q.text("meter_id = "); |
| 12012 | q.text("%#x" % self.meter_id) |
| 12013 | q.text(","); q.breakable() |
| 12014 | q.text("meters = "); |
| 12015 | q.pp(self.meters) |
| 12016 | q.breakable() |
| 12017 | q.text('}') |
| 12018 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12019 | message.subtypes[29] = meter_mod |
| 12020 | |
| 12021 | class meter_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12022 | version = 4 |
| 12023 | type = 1 |
| 12024 | err_type = 12 |
| 12025 | |
| 12026 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12027 | if xid != None: |
| 12028 | self.xid = xid |
| 12029 | else: |
| 12030 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12031 | if code != None: |
| 12032 | self.code = code |
| 12033 | else: |
| 12034 | self.code = 0 |
| 12035 | if data != None: |
| 12036 | self.data = data |
| 12037 | else: |
| 12038 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12039 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12040 | |
| 12041 | def pack(self): |
| 12042 | packed = [] |
| 12043 | packed.append(struct.pack("!B", self.version)) |
| 12044 | packed.append(struct.pack("!B", self.type)) |
| 12045 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12046 | packed.append(struct.pack("!L", self.xid)) |
| 12047 | packed.append(struct.pack("!H", self.err_type)) |
| 12048 | packed.append(struct.pack("!H", self.code)) |
| 12049 | packed.append(self.data) |
| 12050 | length = sum([len(x) for x in packed]) |
| 12051 | packed[2] = struct.pack("!H", length) |
| 12052 | return ''.join(packed) |
| 12053 | |
| 12054 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12055 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12056 | obj = meter_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12057 | _version = reader.read("!B")[0] |
| 12058 | assert(_version == 4) |
| 12059 | _type = reader.read("!B")[0] |
| 12060 | assert(_type == 1) |
| 12061 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12062 | orig_reader = reader |
| 12063 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12064 | obj.xid = reader.read("!L")[0] |
| 12065 | _err_type = reader.read("!H")[0] |
| 12066 | assert(_err_type == 12) |
| 12067 | obj.code = reader.read("!H")[0] |
| 12068 | obj.data = str(reader.read_all()) |
| 12069 | return obj |
| 12070 | |
| 12071 | def __eq__(self, other): |
| 12072 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12073 | if self.xid != other.xid: return False |
| 12074 | if self.code != other.code: return False |
| 12075 | if self.data != other.data: return False |
| 12076 | return True |
| 12077 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12078 | def pretty_print(self, q): |
| 12079 | q.text("meter_mod_failed_error_msg {") |
| 12080 | with q.group(): |
| 12081 | with q.indent(2): |
| 12082 | q.breakable() |
| 12083 | q.text("xid = "); |
| 12084 | if self.xid != None: |
| 12085 | q.text("%#x" % self.xid) |
| 12086 | else: |
| 12087 | q.text('None') |
| 12088 | q.text(","); q.breakable() |
| 12089 | q.text("code = "); |
| 12090 | q.text("%#x" % self.code) |
| 12091 | q.text(","); q.breakable() |
| 12092 | q.text("data = "); |
| 12093 | q.pp(self.data) |
| 12094 | q.breakable() |
| 12095 | q.text('}') |
| 12096 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12097 | error_msg.subtypes[12] = meter_mod_failed_error_msg |
| 12098 | |
| 12099 | class meter_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12100 | version = 4 |
| 12101 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12102 | stats_type = 9 |
| 12103 | |
| 12104 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12105 | if xid != None: |
| 12106 | self.xid = xid |
| 12107 | else: |
| 12108 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12109 | if flags != None: |
| 12110 | self.flags = flags |
| 12111 | else: |
| 12112 | self.flags = 0 |
| 12113 | if entries != None: |
| 12114 | self.entries = entries |
| 12115 | else: |
| 12116 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12117 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12118 | |
| 12119 | def pack(self): |
| 12120 | packed = [] |
| 12121 | packed.append(struct.pack("!B", self.version)) |
| 12122 | packed.append(struct.pack("!B", self.type)) |
| 12123 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12124 | packed.append(struct.pack("!L", self.xid)) |
| 12125 | packed.append(struct.pack("!H", self.stats_type)) |
| 12126 | packed.append(struct.pack("!H", self.flags)) |
| 12127 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12128 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12129 | length = sum([len(x) for x in packed]) |
| 12130 | packed[2] = struct.pack("!H", length) |
| 12131 | return ''.join(packed) |
| 12132 | |
| 12133 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12134 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12135 | obj = meter_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12136 | _version = reader.read("!B")[0] |
| 12137 | assert(_version == 4) |
| 12138 | _type = reader.read("!B")[0] |
| 12139 | assert(_type == 19) |
| 12140 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12141 | orig_reader = reader |
| 12142 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12143 | obj.xid = reader.read("!L")[0] |
| 12144 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12145 | assert(_stats_type == 9) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12146 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12147 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12148 | obj.entries = loxi.generic_util.unpack_list(reader, common.meter_stats.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12149 | return obj |
| 12150 | |
| 12151 | def __eq__(self, other): |
| 12152 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12153 | if self.xid != other.xid: return False |
| 12154 | if self.flags != other.flags: return False |
| 12155 | if self.entries != other.entries: return False |
| 12156 | return True |
| 12157 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12158 | def pretty_print(self, q): |
| 12159 | q.text("meter_stats_reply {") |
| 12160 | with q.group(): |
| 12161 | with q.indent(2): |
| 12162 | q.breakable() |
| 12163 | q.text("xid = "); |
| 12164 | if self.xid != None: |
| 12165 | q.text("%#x" % self.xid) |
| 12166 | else: |
| 12167 | q.text('None') |
| 12168 | q.text(","); q.breakable() |
| 12169 | q.text("flags = "); |
| 12170 | q.text("%#x" % self.flags) |
| 12171 | q.text(","); q.breakable() |
| 12172 | q.text("entries = "); |
| 12173 | q.pp(self.entries) |
| 12174 | q.breakable() |
| 12175 | q.text('}') |
| 12176 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12177 | stats_reply.subtypes[9] = meter_stats_reply |
| 12178 | |
| 12179 | class meter_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12180 | version = 4 |
| 12181 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12182 | stats_type = 9 |
| 12183 | |
| 12184 | def __init__(self, xid=None, flags=None, meter_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12185 | if xid != None: |
| 12186 | self.xid = xid |
| 12187 | else: |
| 12188 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12189 | if flags != None: |
| 12190 | self.flags = flags |
| 12191 | else: |
| 12192 | self.flags = 0 |
| 12193 | if meter_id != None: |
| 12194 | self.meter_id = meter_id |
| 12195 | else: |
| 12196 | self.meter_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12197 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12198 | |
| 12199 | def pack(self): |
| 12200 | packed = [] |
| 12201 | packed.append(struct.pack("!B", self.version)) |
| 12202 | packed.append(struct.pack("!B", self.type)) |
| 12203 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12204 | packed.append(struct.pack("!L", self.xid)) |
| 12205 | packed.append(struct.pack("!H", self.stats_type)) |
| 12206 | packed.append(struct.pack("!H", self.flags)) |
| 12207 | packed.append('\x00' * 4) |
| 12208 | packed.append(struct.pack("!L", self.meter_id)) |
| 12209 | packed.append('\x00' * 4) |
| 12210 | length = sum([len(x) for x in packed]) |
| 12211 | packed[2] = struct.pack("!H", length) |
| 12212 | return ''.join(packed) |
| 12213 | |
| 12214 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12215 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12216 | obj = meter_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12217 | _version = reader.read("!B")[0] |
| 12218 | assert(_version == 4) |
| 12219 | _type = reader.read("!B")[0] |
| 12220 | assert(_type == 18) |
| 12221 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12222 | orig_reader = reader |
| 12223 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12224 | obj.xid = reader.read("!L")[0] |
| 12225 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12226 | assert(_stats_type == 9) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12227 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12228 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12229 | obj.meter_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12230 | reader.skip(4) |
| 12231 | return obj |
| 12232 | |
| 12233 | def __eq__(self, other): |
| 12234 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12235 | if self.xid != other.xid: return False |
| 12236 | if self.flags != other.flags: return False |
| 12237 | if self.meter_id != other.meter_id: return False |
| 12238 | return True |
| 12239 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12240 | def pretty_print(self, q): |
| 12241 | q.text("meter_stats_request {") |
| 12242 | with q.group(): |
| 12243 | with q.indent(2): |
| 12244 | q.breakable() |
| 12245 | q.text("xid = "); |
| 12246 | if self.xid != None: |
| 12247 | q.text("%#x" % self.xid) |
| 12248 | else: |
| 12249 | q.text('None') |
| 12250 | q.text(","); q.breakable() |
| 12251 | q.text("flags = "); |
| 12252 | q.text("%#x" % self.flags) |
| 12253 | q.text(","); q.breakable() |
| 12254 | q.text("meter_id = "); |
| 12255 | q.text("%#x" % self.meter_id) |
| 12256 | q.breakable() |
| 12257 | q.text('}') |
| 12258 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12259 | stats_request.subtypes[9] = meter_stats_request |
| 12260 | |
| 12261 | class nicira_header(experimenter): |
| 12262 | subtypes = {} |
| 12263 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 12264 | version = 4 |
| 12265 | type = 4 |
| 12266 | experimenter = 8992 |
| 12267 | |
| 12268 | def __init__(self, xid=None, subtype=None): |
| 12269 | if xid != None: |
| 12270 | self.xid = xid |
| 12271 | else: |
| 12272 | self.xid = None |
| 12273 | if subtype != None: |
| 12274 | self.subtype = subtype |
| 12275 | else: |
| 12276 | self.subtype = 0 |
| 12277 | return |
| 12278 | |
| 12279 | def pack(self): |
| 12280 | packed = [] |
| 12281 | packed.append(struct.pack("!B", self.version)) |
| 12282 | packed.append(struct.pack("!B", self.type)) |
| 12283 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12284 | packed.append(struct.pack("!L", self.xid)) |
| 12285 | packed.append(struct.pack("!L", self.experimenter)) |
| 12286 | packed.append(struct.pack("!L", self.subtype)) |
| 12287 | length = sum([len(x) for x in packed]) |
| 12288 | packed[2] = struct.pack("!H", length) |
| 12289 | return ''.join(packed) |
| 12290 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12291 | @staticmethod |
| 12292 | def unpack(reader): |
| 12293 | subtype, = reader.peek('!L', 12) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 12294 | subclass = nicira_header.subtypes.get(subtype) |
| 12295 | if subclass: |
| 12296 | return subclass.unpack(reader) |
| 12297 | |
| 12298 | obj = nicira_header() |
| 12299 | _version = reader.read("!B")[0] |
| 12300 | assert(_version == 4) |
| 12301 | _type = reader.read("!B")[0] |
| 12302 | assert(_type == 4) |
| 12303 | _length = reader.read("!H")[0] |
| 12304 | orig_reader = reader |
| 12305 | reader = orig_reader.slice(_length - (2 + 2)) |
| 12306 | obj.xid = reader.read("!L")[0] |
| 12307 | _experimenter = reader.read("!L")[0] |
| 12308 | assert(_experimenter == 8992) |
| 12309 | obj.subtype = reader.read("!L")[0] |
| 12310 | return obj |
| 12311 | |
| 12312 | def __eq__(self, other): |
| 12313 | if type(self) != type(other): return False |
| 12314 | if self.xid != other.xid: return False |
| 12315 | if self.subtype != other.subtype: return False |
| 12316 | return True |
| 12317 | |
| 12318 | def pretty_print(self, q): |
| 12319 | q.text("nicira_header {") |
| 12320 | with q.group(): |
| 12321 | with q.indent(2): |
| 12322 | q.breakable() |
| 12323 | q.text("xid = "); |
| 12324 | if self.xid != None: |
| 12325 | q.text("%#x" % self.xid) |
| 12326 | else: |
| 12327 | q.text('None') |
| 12328 | q.breakable() |
| 12329 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12330 | |
| 12331 | experimenter.subtypes[8992] = nicira_header |
| 12332 | |
| 12333 | class packet_in(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12334 | version = 4 |
| 12335 | type = 10 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12336 | |
| 12337 | 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] | 12338 | if xid != None: |
| 12339 | self.xid = xid |
| 12340 | else: |
| 12341 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12342 | if buffer_id != None: |
| 12343 | self.buffer_id = buffer_id |
| 12344 | else: |
| 12345 | self.buffer_id = 0 |
| 12346 | if total_len != None: |
| 12347 | self.total_len = total_len |
| 12348 | else: |
| 12349 | self.total_len = 0 |
| 12350 | if reason != None: |
| 12351 | self.reason = reason |
| 12352 | else: |
| 12353 | self.reason = 0 |
| 12354 | if table_id != None: |
| 12355 | self.table_id = table_id |
| 12356 | else: |
| 12357 | self.table_id = 0 |
| 12358 | if cookie != None: |
| 12359 | self.cookie = cookie |
| 12360 | else: |
| 12361 | self.cookie = 0 |
| 12362 | if match != None: |
| 12363 | self.match = match |
| 12364 | else: |
| 12365 | self.match = common.match() |
| 12366 | if data != None: |
| 12367 | self.data = data |
| 12368 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12369 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12370 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12371 | |
| 12372 | def pack(self): |
| 12373 | packed = [] |
| 12374 | packed.append(struct.pack("!B", self.version)) |
| 12375 | packed.append(struct.pack("!B", self.type)) |
| 12376 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12377 | packed.append(struct.pack("!L", self.xid)) |
| 12378 | packed.append(struct.pack("!L", self.buffer_id)) |
| 12379 | packed.append(struct.pack("!H", self.total_len)) |
| 12380 | packed.append(struct.pack("!B", self.reason)) |
| 12381 | packed.append(struct.pack("!B", self.table_id)) |
| 12382 | packed.append(struct.pack("!Q", self.cookie)) |
| 12383 | packed.append(self.match.pack()) |
| 12384 | packed.append('\x00' * 2) |
| 12385 | packed.append(self.data) |
| 12386 | length = sum([len(x) for x in packed]) |
| 12387 | packed[2] = struct.pack("!H", length) |
| 12388 | return ''.join(packed) |
| 12389 | |
| 12390 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12391 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12392 | obj = packet_in() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12393 | _version = reader.read("!B")[0] |
| 12394 | assert(_version == 4) |
| 12395 | _type = reader.read("!B")[0] |
| 12396 | assert(_type == 10) |
| 12397 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12398 | orig_reader = reader |
| 12399 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12400 | obj.xid = reader.read("!L")[0] |
| 12401 | obj.buffer_id = reader.read("!L")[0] |
| 12402 | obj.total_len = reader.read("!H")[0] |
| 12403 | obj.reason = reader.read("!B")[0] |
| 12404 | obj.table_id = reader.read("!B")[0] |
| 12405 | obj.cookie = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12406 | obj.match = common.match.unpack(reader) |
| 12407 | reader.skip(2) |
| 12408 | obj.data = str(reader.read_all()) |
| 12409 | return obj |
| 12410 | |
| 12411 | def __eq__(self, other): |
| 12412 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12413 | if self.xid != other.xid: return False |
| 12414 | if self.buffer_id != other.buffer_id: return False |
| 12415 | if self.total_len != other.total_len: return False |
| 12416 | if self.reason != other.reason: return False |
| 12417 | if self.table_id != other.table_id: return False |
| 12418 | if self.cookie != other.cookie: return False |
| 12419 | if self.match != other.match: return False |
| 12420 | if self.data != other.data: return False |
| 12421 | return True |
| 12422 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12423 | def pretty_print(self, q): |
| 12424 | q.text("packet_in {") |
| 12425 | with q.group(): |
| 12426 | with q.indent(2): |
| 12427 | q.breakable() |
| 12428 | q.text("xid = "); |
| 12429 | if self.xid != None: |
| 12430 | q.text("%#x" % self.xid) |
| 12431 | else: |
| 12432 | q.text('None') |
| 12433 | q.text(","); q.breakable() |
| 12434 | q.text("buffer_id = "); |
| 12435 | q.text("%#x" % self.buffer_id) |
| 12436 | q.text(","); q.breakable() |
| 12437 | q.text("total_len = "); |
| 12438 | q.text("%#x" % self.total_len) |
| 12439 | q.text(","); q.breakable() |
| 12440 | q.text("reason = "); |
| 12441 | q.text("%#x" % self.reason) |
| 12442 | q.text(","); q.breakable() |
| 12443 | q.text("table_id = "); |
| 12444 | q.text("%#x" % self.table_id) |
| 12445 | q.text(","); q.breakable() |
| 12446 | q.text("cookie = "); |
| 12447 | q.text("%#x" % self.cookie) |
| 12448 | q.text(","); q.breakable() |
| 12449 | q.text("match = "); |
| 12450 | q.pp(self.match) |
| 12451 | q.text(","); q.breakable() |
| 12452 | q.text("data = "); |
| 12453 | q.pp(self.data) |
| 12454 | q.breakable() |
| 12455 | q.text('}') |
| 12456 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12457 | message.subtypes[10] = packet_in |
| 12458 | |
| 12459 | class packet_out(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12460 | version = 4 |
| 12461 | type = 13 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12462 | |
| 12463 | 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] | 12464 | if xid != None: |
| 12465 | self.xid = xid |
| 12466 | else: |
| 12467 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12468 | if buffer_id != None: |
| 12469 | self.buffer_id = buffer_id |
| 12470 | else: |
| 12471 | self.buffer_id = 0 |
| 12472 | if in_port != None: |
| 12473 | self.in_port = in_port |
| 12474 | else: |
| 12475 | self.in_port = 0 |
| 12476 | if actions != None: |
| 12477 | self.actions = actions |
| 12478 | else: |
| 12479 | self.actions = [] |
| 12480 | if data != None: |
| 12481 | self.data = data |
| 12482 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12483 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12484 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12485 | |
| 12486 | def pack(self): |
| 12487 | packed = [] |
| 12488 | packed.append(struct.pack("!B", self.version)) |
| 12489 | packed.append(struct.pack("!B", self.type)) |
| 12490 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12491 | packed.append(struct.pack("!L", self.xid)) |
| 12492 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12493 | packed.append(util.pack_port_no(self.in_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12494 | packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6 |
| 12495 | packed.append('\x00' * 6) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12496 | packed.append(loxi.generic_util.pack_list(self.actions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12497 | packed[6] = struct.pack("!H", len(packed[-1])) |
| 12498 | packed.append(self.data) |
| 12499 | length = sum([len(x) for x in packed]) |
| 12500 | packed[2] = struct.pack("!H", length) |
| 12501 | return ''.join(packed) |
| 12502 | |
| 12503 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12504 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12505 | obj = packet_out() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12506 | _version = reader.read("!B")[0] |
| 12507 | assert(_version == 4) |
| 12508 | _type = reader.read("!B")[0] |
| 12509 | assert(_type == 13) |
| 12510 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12511 | orig_reader = reader |
| 12512 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12513 | obj.xid = reader.read("!L")[0] |
| 12514 | obj.buffer_id = reader.read("!L")[0] |
| 12515 | obj.in_port = util.unpack_port_no(reader) |
| 12516 | _actions_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12517 | reader.skip(6) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12518 | 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] | 12519 | obj.data = str(reader.read_all()) |
| 12520 | return obj |
| 12521 | |
| 12522 | def __eq__(self, other): |
| 12523 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12524 | if self.xid != other.xid: return False |
| 12525 | if self.buffer_id != other.buffer_id: return False |
| 12526 | if self.in_port != other.in_port: return False |
| 12527 | if self.actions != other.actions: return False |
| 12528 | if self.data != other.data: return False |
| 12529 | return True |
| 12530 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12531 | def pretty_print(self, q): |
| 12532 | q.text("packet_out {") |
| 12533 | with q.group(): |
| 12534 | with q.indent(2): |
| 12535 | q.breakable() |
| 12536 | q.text("xid = "); |
| 12537 | if self.xid != None: |
| 12538 | q.text("%#x" % self.xid) |
| 12539 | else: |
| 12540 | q.text('None') |
| 12541 | q.text(","); q.breakable() |
| 12542 | q.text("buffer_id = "); |
| 12543 | q.text("%#x" % self.buffer_id) |
| 12544 | q.text(","); q.breakable() |
| 12545 | q.text("in_port = "); |
| 12546 | q.text(util.pretty_port(self.in_port)) |
| 12547 | q.text(","); q.breakable() |
| 12548 | q.text("actions = "); |
| 12549 | q.pp(self.actions) |
| 12550 | q.text(","); q.breakable() |
| 12551 | q.text("data = "); |
| 12552 | q.pp(self.data) |
| 12553 | q.breakable() |
| 12554 | q.text('}') |
| 12555 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12556 | message.subtypes[13] = packet_out |
| 12557 | |
| 12558 | class port_desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12559 | version = 4 |
| 12560 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12561 | stats_type = 13 |
| 12562 | |
| 12563 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12564 | if xid != None: |
| 12565 | self.xid = xid |
| 12566 | else: |
| 12567 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12568 | if flags != None: |
| 12569 | self.flags = flags |
| 12570 | else: |
| 12571 | self.flags = 0 |
| 12572 | if entries != None: |
| 12573 | self.entries = entries |
| 12574 | else: |
| 12575 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12576 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12577 | |
| 12578 | def pack(self): |
| 12579 | packed = [] |
| 12580 | packed.append(struct.pack("!B", self.version)) |
| 12581 | packed.append(struct.pack("!B", self.type)) |
| 12582 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12583 | packed.append(struct.pack("!L", self.xid)) |
| 12584 | packed.append(struct.pack("!H", self.stats_type)) |
| 12585 | packed.append(struct.pack("!H", self.flags)) |
| 12586 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12587 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12588 | length = sum([len(x) for x in packed]) |
| 12589 | packed[2] = struct.pack("!H", length) |
| 12590 | return ''.join(packed) |
| 12591 | |
| 12592 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12593 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12594 | obj = port_desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12595 | _version = reader.read("!B")[0] |
| 12596 | assert(_version == 4) |
| 12597 | _type = reader.read("!B")[0] |
| 12598 | assert(_type == 19) |
| 12599 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12600 | orig_reader = reader |
| 12601 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12602 | obj.xid = reader.read("!L")[0] |
| 12603 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12604 | assert(_stats_type == 13) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12605 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12606 | reader.skip(4) |
| 12607 | obj.entries = loxi.generic_util.unpack_list(reader, common.port_desc.unpack) |
| 12608 | return obj |
| 12609 | |
| 12610 | def __eq__(self, other): |
| 12611 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12612 | if self.xid != other.xid: return False |
| 12613 | if self.flags != other.flags: return False |
| 12614 | if self.entries != other.entries: return False |
| 12615 | return True |
| 12616 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12617 | def pretty_print(self, q): |
| 12618 | q.text("port_desc_stats_reply {") |
| 12619 | with q.group(): |
| 12620 | with q.indent(2): |
| 12621 | q.breakable() |
| 12622 | q.text("xid = "); |
| 12623 | if self.xid != None: |
| 12624 | q.text("%#x" % self.xid) |
| 12625 | else: |
| 12626 | q.text('None') |
| 12627 | q.text(","); q.breakable() |
| 12628 | q.text("flags = "); |
| 12629 | q.text("%#x" % self.flags) |
| 12630 | q.text(","); q.breakable() |
| 12631 | q.text("entries = "); |
| 12632 | q.pp(self.entries) |
| 12633 | q.breakable() |
| 12634 | q.text('}') |
| 12635 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12636 | stats_reply.subtypes[13] = port_desc_stats_reply |
| 12637 | |
| 12638 | class port_desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12639 | version = 4 |
| 12640 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12641 | stats_type = 13 |
| 12642 | |
| 12643 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12644 | if xid != None: |
| 12645 | self.xid = xid |
| 12646 | else: |
| 12647 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12648 | if flags != None: |
| 12649 | self.flags = flags |
| 12650 | else: |
| 12651 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12652 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12653 | |
| 12654 | def pack(self): |
| 12655 | packed = [] |
| 12656 | packed.append(struct.pack("!B", self.version)) |
| 12657 | packed.append(struct.pack("!B", self.type)) |
| 12658 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12659 | packed.append(struct.pack("!L", self.xid)) |
| 12660 | packed.append(struct.pack("!H", self.stats_type)) |
| 12661 | packed.append(struct.pack("!H", self.flags)) |
| 12662 | packed.append('\x00' * 4) |
| 12663 | length = sum([len(x) for x in packed]) |
| 12664 | packed[2] = struct.pack("!H", length) |
| 12665 | return ''.join(packed) |
| 12666 | |
| 12667 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12668 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12669 | obj = port_desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12670 | _version = reader.read("!B")[0] |
| 12671 | assert(_version == 4) |
| 12672 | _type = reader.read("!B")[0] |
| 12673 | assert(_type == 18) |
| 12674 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12675 | orig_reader = reader |
| 12676 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12677 | obj.xid = reader.read("!L")[0] |
| 12678 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12679 | assert(_stats_type == 13) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12680 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12681 | reader.skip(4) |
| 12682 | return obj |
| 12683 | |
| 12684 | def __eq__(self, other): |
| 12685 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12686 | if self.xid != other.xid: return False |
| 12687 | if self.flags != other.flags: return False |
| 12688 | return True |
| 12689 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12690 | def pretty_print(self, q): |
| 12691 | q.text("port_desc_stats_request {") |
| 12692 | with q.group(): |
| 12693 | with q.indent(2): |
| 12694 | q.breakable() |
| 12695 | q.text("xid = "); |
| 12696 | if self.xid != None: |
| 12697 | q.text("%#x" % self.xid) |
| 12698 | else: |
| 12699 | q.text('None') |
| 12700 | q.text(","); q.breakable() |
| 12701 | q.text("flags = "); |
| 12702 | q.text("%#x" % self.flags) |
| 12703 | q.breakable() |
| 12704 | q.text('}') |
| 12705 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12706 | stats_request.subtypes[13] = port_desc_stats_request |
| 12707 | |
| 12708 | class port_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12709 | version = 4 |
| 12710 | type = 16 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12711 | |
| 12712 | 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] | 12713 | if xid != None: |
| 12714 | self.xid = xid |
| 12715 | else: |
| 12716 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12717 | if port_no != None: |
| 12718 | self.port_no = port_no |
| 12719 | else: |
| 12720 | self.port_no = 0 |
| 12721 | if hw_addr != None: |
| 12722 | self.hw_addr = hw_addr |
| 12723 | else: |
| 12724 | self.hw_addr = [0,0,0,0,0,0] |
| 12725 | if config != None: |
| 12726 | self.config = config |
| 12727 | else: |
| 12728 | self.config = 0 |
| 12729 | if mask != None: |
| 12730 | self.mask = mask |
| 12731 | else: |
| 12732 | self.mask = 0 |
| 12733 | if advertise != None: |
| 12734 | self.advertise = advertise |
| 12735 | else: |
| 12736 | self.advertise = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12737 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12738 | |
| 12739 | def pack(self): |
| 12740 | packed = [] |
| 12741 | packed.append(struct.pack("!B", self.version)) |
| 12742 | packed.append(struct.pack("!B", self.type)) |
| 12743 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12744 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12745 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12746 | packed.append('\x00' * 4) |
| 12747 | packed.append(struct.pack("!6B", *self.hw_addr)) |
| 12748 | packed.append('\x00' * 2) |
| 12749 | packed.append(struct.pack("!L", self.config)) |
| 12750 | packed.append(struct.pack("!L", self.mask)) |
| 12751 | packed.append(struct.pack("!L", self.advertise)) |
| 12752 | packed.append('\x00' * 4) |
| 12753 | length = sum([len(x) for x in packed]) |
| 12754 | packed[2] = struct.pack("!H", length) |
| 12755 | return ''.join(packed) |
| 12756 | |
| 12757 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12758 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12759 | obj = port_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12760 | _version = reader.read("!B")[0] |
| 12761 | assert(_version == 4) |
| 12762 | _type = reader.read("!B")[0] |
| 12763 | assert(_type == 16) |
| 12764 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12765 | orig_reader = reader |
| 12766 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12767 | obj.xid = reader.read("!L")[0] |
| 12768 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12769 | reader.skip(4) |
| 12770 | obj.hw_addr = list(reader.read('!6B')) |
| 12771 | reader.skip(2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12772 | obj.config = reader.read("!L")[0] |
| 12773 | obj.mask = reader.read("!L")[0] |
| 12774 | obj.advertise = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12775 | reader.skip(4) |
| 12776 | return obj |
| 12777 | |
| 12778 | def __eq__(self, other): |
| 12779 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12780 | if self.xid != other.xid: return False |
| 12781 | if self.port_no != other.port_no: return False |
| 12782 | if self.hw_addr != other.hw_addr: return False |
| 12783 | if self.config != other.config: return False |
| 12784 | if self.mask != other.mask: return False |
| 12785 | if self.advertise != other.advertise: return False |
| 12786 | return True |
| 12787 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12788 | def pretty_print(self, q): |
| 12789 | q.text("port_mod {") |
| 12790 | with q.group(): |
| 12791 | with q.indent(2): |
| 12792 | q.breakable() |
| 12793 | q.text("xid = "); |
| 12794 | if self.xid != None: |
| 12795 | q.text("%#x" % self.xid) |
| 12796 | else: |
| 12797 | q.text('None') |
| 12798 | q.text(","); q.breakable() |
| 12799 | q.text("port_no = "); |
| 12800 | q.text(util.pretty_port(self.port_no)) |
| 12801 | q.text(","); q.breakable() |
| 12802 | q.text("hw_addr = "); |
| 12803 | q.text(util.pretty_mac(self.hw_addr)) |
| 12804 | q.text(","); q.breakable() |
| 12805 | q.text("config = "); |
| 12806 | q.text("%#x" % self.config) |
| 12807 | q.text(","); q.breakable() |
| 12808 | q.text("mask = "); |
| 12809 | q.text("%#x" % self.mask) |
| 12810 | q.text(","); q.breakable() |
| 12811 | q.text("advertise = "); |
| 12812 | q.text("%#x" % self.advertise) |
| 12813 | q.breakable() |
| 12814 | q.text('}') |
| 12815 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12816 | message.subtypes[16] = port_mod |
| 12817 | |
| 12818 | class port_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12819 | version = 4 |
| 12820 | type = 1 |
| 12821 | err_type = 7 |
| 12822 | |
| 12823 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12824 | if xid != None: |
| 12825 | self.xid = xid |
| 12826 | else: |
| 12827 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12828 | if code != None: |
| 12829 | self.code = code |
| 12830 | else: |
| 12831 | self.code = 0 |
| 12832 | if data != None: |
| 12833 | self.data = data |
| 12834 | else: |
| 12835 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12836 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12837 | |
| 12838 | def pack(self): |
| 12839 | packed = [] |
| 12840 | packed.append(struct.pack("!B", self.version)) |
| 12841 | packed.append(struct.pack("!B", self.type)) |
| 12842 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12843 | packed.append(struct.pack("!L", self.xid)) |
| 12844 | packed.append(struct.pack("!H", self.err_type)) |
| 12845 | packed.append(struct.pack("!H", self.code)) |
| 12846 | packed.append(self.data) |
| 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 | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12853 | obj = port_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12854 | _version = reader.read("!B")[0] |
| 12855 | assert(_version == 4) |
| 12856 | _type = reader.read("!B")[0] |
| 12857 | assert(_type == 1) |
| 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)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12861 | obj.xid = reader.read("!L")[0] |
| 12862 | _err_type = reader.read("!H")[0] |
| 12863 | assert(_err_type == 7) |
| 12864 | obj.code = reader.read("!H")[0] |
| 12865 | obj.data = str(reader.read_all()) |
| 12866 | return obj |
| 12867 | |
| 12868 | def __eq__(self, other): |
| 12869 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12870 | if self.xid != other.xid: return False |
| 12871 | if self.code != other.code: return False |
| 12872 | if self.data != other.data: return False |
| 12873 | return True |
| 12874 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12875 | def pretty_print(self, q): |
| 12876 | q.text("port_mod_failed_error_msg {") |
| 12877 | with q.group(): |
| 12878 | with q.indent(2): |
| 12879 | q.breakable() |
| 12880 | q.text("xid = "); |
| 12881 | if self.xid != None: |
| 12882 | q.text("%#x" % self.xid) |
| 12883 | else: |
| 12884 | q.text('None') |
| 12885 | q.text(","); q.breakable() |
| 12886 | q.text("code = "); |
| 12887 | q.text("%#x" % self.code) |
| 12888 | q.text(","); q.breakable() |
| 12889 | q.text("data = "); |
| 12890 | q.pp(self.data) |
| 12891 | q.breakable() |
| 12892 | q.text('}') |
| 12893 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12894 | error_msg.subtypes[7] = port_mod_failed_error_msg |
| 12895 | |
| 12896 | class port_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12897 | version = 4 |
| 12898 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12899 | stats_type = 4 |
| 12900 | |
| 12901 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12902 | if xid != None: |
| 12903 | self.xid = xid |
| 12904 | else: |
| 12905 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12906 | if flags != None: |
| 12907 | self.flags = flags |
| 12908 | else: |
| 12909 | self.flags = 0 |
| 12910 | if entries != None: |
| 12911 | self.entries = entries |
| 12912 | else: |
| 12913 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12914 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12915 | |
| 12916 | def pack(self): |
| 12917 | packed = [] |
| 12918 | packed.append(struct.pack("!B", self.version)) |
| 12919 | packed.append(struct.pack("!B", self.type)) |
| 12920 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12921 | packed.append(struct.pack("!L", self.xid)) |
| 12922 | packed.append(struct.pack("!H", self.stats_type)) |
| 12923 | packed.append(struct.pack("!H", self.flags)) |
| 12924 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12925 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12926 | length = sum([len(x) for x in packed]) |
| 12927 | packed[2] = struct.pack("!H", length) |
| 12928 | return ''.join(packed) |
| 12929 | |
| 12930 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12931 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12932 | obj = port_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12933 | _version = reader.read("!B")[0] |
| 12934 | assert(_version == 4) |
| 12935 | _type = reader.read("!B")[0] |
| 12936 | assert(_type == 19) |
| 12937 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12938 | orig_reader = reader |
| 12939 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12940 | obj.xid = reader.read("!L")[0] |
| 12941 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12942 | assert(_stats_type == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12943 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12944 | reader.skip(4) |
| 12945 | obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack) |
| 12946 | return obj |
| 12947 | |
| 12948 | def __eq__(self, other): |
| 12949 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12950 | if self.xid != other.xid: return False |
| 12951 | if self.flags != other.flags: return False |
| 12952 | if self.entries != other.entries: return False |
| 12953 | return True |
| 12954 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12955 | def pretty_print(self, q): |
| 12956 | q.text("port_stats_reply {") |
| 12957 | with q.group(): |
| 12958 | with q.indent(2): |
| 12959 | q.breakable() |
| 12960 | q.text("xid = "); |
| 12961 | if self.xid != None: |
| 12962 | q.text("%#x" % self.xid) |
| 12963 | else: |
| 12964 | q.text('None') |
| 12965 | q.text(","); q.breakable() |
| 12966 | q.text("flags = "); |
| 12967 | q.text("%#x" % self.flags) |
| 12968 | q.text(","); q.breakable() |
| 12969 | q.text("entries = "); |
| 12970 | q.pp(self.entries) |
| 12971 | q.breakable() |
| 12972 | q.text('}') |
| 12973 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12974 | stats_reply.subtypes[4] = port_stats_reply |
| 12975 | |
| 12976 | class port_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12977 | version = 4 |
| 12978 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12979 | stats_type = 4 |
| 12980 | |
| 12981 | def __init__(self, xid=None, flags=None, port_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12982 | if xid != None: |
| 12983 | self.xid = xid |
| 12984 | else: |
| 12985 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12986 | if flags != None: |
| 12987 | self.flags = flags |
| 12988 | else: |
| 12989 | self.flags = 0 |
| 12990 | if port_no != None: |
| 12991 | self.port_no = port_no |
| 12992 | else: |
| 12993 | self.port_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12994 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12995 | |
| 12996 | def pack(self): |
| 12997 | packed = [] |
| 12998 | packed.append(struct.pack("!B", self.version)) |
| 12999 | packed.append(struct.pack("!B", self.type)) |
| 13000 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13001 | packed.append(struct.pack("!L", self.xid)) |
| 13002 | packed.append(struct.pack("!H", self.stats_type)) |
| 13003 | packed.append(struct.pack("!H", self.flags)) |
| 13004 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13005 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13006 | packed.append('\x00' * 4) |
| 13007 | length = sum([len(x) for x in packed]) |
| 13008 | packed[2] = struct.pack("!H", length) |
| 13009 | return ''.join(packed) |
| 13010 | |
| 13011 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13012 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13013 | obj = port_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13014 | _version = reader.read("!B")[0] |
| 13015 | assert(_version == 4) |
| 13016 | _type = reader.read("!B")[0] |
| 13017 | assert(_type == 18) |
| 13018 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13019 | orig_reader = reader |
| 13020 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13021 | obj.xid = reader.read("!L")[0] |
| 13022 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13023 | assert(_stats_type == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13024 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13025 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13026 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13027 | reader.skip(4) |
| 13028 | return obj |
| 13029 | |
| 13030 | def __eq__(self, other): |
| 13031 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13032 | if self.xid != other.xid: return False |
| 13033 | if self.flags != other.flags: return False |
| 13034 | if self.port_no != other.port_no: return False |
| 13035 | return True |
| 13036 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13037 | def pretty_print(self, q): |
| 13038 | q.text("port_stats_request {") |
| 13039 | with q.group(): |
| 13040 | with q.indent(2): |
| 13041 | q.breakable() |
| 13042 | q.text("xid = "); |
| 13043 | if self.xid != None: |
| 13044 | q.text("%#x" % self.xid) |
| 13045 | else: |
| 13046 | q.text('None') |
| 13047 | q.text(","); q.breakable() |
| 13048 | q.text("flags = "); |
| 13049 | q.text("%#x" % self.flags) |
| 13050 | q.text(","); q.breakable() |
| 13051 | q.text("port_no = "); |
| 13052 | q.text(util.pretty_port(self.port_no)) |
| 13053 | q.breakable() |
| 13054 | q.text('}') |
| 13055 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13056 | stats_request.subtypes[4] = port_stats_request |
| 13057 | |
| 13058 | class port_status(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13059 | version = 4 |
| 13060 | type = 12 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13061 | |
| 13062 | def __init__(self, xid=None, reason=None, desc=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13063 | if xid != None: |
| 13064 | self.xid = xid |
| 13065 | else: |
| 13066 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13067 | if reason != None: |
| 13068 | self.reason = reason |
| 13069 | else: |
| 13070 | self.reason = 0 |
| 13071 | if desc != None: |
| 13072 | self.desc = desc |
| 13073 | else: |
| 13074 | self.desc = common.port_desc() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13075 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13076 | |
| 13077 | def pack(self): |
| 13078 | packed = [] |
| 13079 | packed.append(struct.pack("!B", self.version)) |
| 13080 | packed.append(struct.pack("!B", self.type)) |
| 13081 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13082 | packed.append(struct.pack("!L", self.xid)) |
| 13083 | packed.append(struct.pack("!B", self.reason)) |
| 13084 | packed.append('\x00' * 7) |
| 13085 | packed.append(self.desc.pack()) |
| 13086 | length = sum([len(x) for x in packed]) |
| 13087 | packed[2] = struct.pack("!H", length) |
| 13088 | return ''.join(packed) |
| 13089 | |
| 13090 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13091 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13092 | obj = port_status() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13093 | _version = reader.read("!B")[0] |
| 13094 | assert(_version == 4) |
| 13095 | _type = reader.read("!B")[0] |
| 13096 | assert(_type == 12) |
| 13097 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13098 | orig_reader = reader |
| 13099 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13100 | obj.xid = reader.read("!L")[0] |
| 13101 | obj.reason = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13102 | reader.skip(7) |
| 13103 | obj.desc = common.port_desc.unpack(reader) |
| 13104 | return obj |
| 13105 | |
| 13106 | def __eq__(self, other): |
| 13107 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13108 | if self.xid != other.xid: return False |
| 13109 | if self.reason != other.reason: return False |
| 13110 | if self.desc != other.desc: return False |
| 13111 | return True |
| 13112 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13113 | def pretty_print(self, q): |
| 13114 | q.text("port_status {") |
| 13115 | with q.group(): |
| 13116 | with q.indent(2): |
| 13117 | q.breakable() |
| 13118 | q.text("xid = "); |
| 13119 | if self.xid != None: |
| 13120 | q.text("%#x" % self.xid) |
| 13121 | else: |
| 13122 | q.text('None') |
| 13123 | q.text(","); q.breakable() |
| 13124 | q.text("reason = "); |
| 13125 | q.text("%#x" % self.reason) |
| 13126 | q.text(","); q.breakable() |
| 13127 | q.text("desc = "); |
| 13128 | q.pp(self.desc) |
| 13129 | q.breakable() |
| 13130 | q.text('}') |
| 13131 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13132 | message.subtypes[12] = port_status |
| 13133 | |
| 13134 | class queue_get_config_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13135 | version = 4 |
| 13136 | type = 23 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13137 | |
| 13138 | def __init__(self, xid=None, port=None, queues=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13139 | if xid != None: |
| 13140 | self.xid = xid |
| 13141 | else: |
| 13142 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13143 | if port != None: |
| 13144 | self.port = port |
| 13145 | else: |
| 13146 | self.port = 0 |
| 13147 | if queues != None: |
| 13148 | self.queues = queues |
| 13149 | else: |
| 13150 | self.queues = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13151 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13152 | |
| 13153 | def pack(self): |
| 13154 | packed = [] |
| 13155 | packed.append(struct.pack("!B", self.version)) |
| 13156 | packed.append(struct.pack("!B", self.type)) |
| 13157 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13158 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13159 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13160 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13161 | packed.append(loxi.generic_util.pack_list(self.queues)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13162 | length = sum([len(x) for x in packed]) |
| 13163 | packed[2] = struct.pack("!H", length) |
| 13164 | return ''.join(packed) |
| 13165 | |
| 13166 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13167 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13168 | obj = queue_get_config_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13169 | _version = reader.read("!B")[0] |
| 13170 | assert(_version == 4) |
| 13171 | _type = reader.read("!B")[0] |
| 13172 | assert(_type == 23) |
| 13173 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13174 | orig_reader = reader |
| 13175 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13176 | obj.xid = reader.read("!L")[0] |
| 13177 | obj.port = util.unpack_port_no(reader) |
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.queues = loxi.generic_util.unpack_list(reader, common.packet_queue.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.port != other.port: return False |
| 13186 | if self.queues != other.queues: 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("queue_get_config_reply {") |
| 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("port = "); |
| 13201 | q.text(util.pretty_port(self.port)) |
| 13202 | q.text(","); q.breakable() |
| 13203 | q.text("queues = "); |
| 13204 | q.pp(self.queues) |
| 13205 | q.breakable() |
| 13206 | q.text('}') |
| 13207 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13208 | message.subtypes[23] = queue_get_config_reply |
| 13209 | |
| 13210 | class queue_get_config_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13211 | version = 4 |
| 13212 | type = 22 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13213 | |
| 13214 | def __init__(self, xid=None, port=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 port != None: |
| 13220 | self.port = port |
| 13221 | else: |
| 13222 | self.port = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13223 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13224 | |
| 13225 | def pack(self): |
| 13226 | packed = [] |
| 13227 | packed.append(struct.pack("!B", self.version)) |
| 13228 | packed.append(struct.pack("!B", self.type)) |
| 13229 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13230 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13231 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13232 | packed.append('\x00' * 4) |
| 13233 | length = sum([len(x) for x in packed]) |
| 13234 | packed[2] = struct.pack("!H", length) |
| 13235 | return ''.join(packed) |
| 13236 | |
| 13237 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13238 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13239 | obj = queue_get_config_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13240 | _version = reader.read("!B")[0] |
| 13241 | assert(_version == 4) |
| 13242 | _type = reader.read("!B")[0] |
| 13243 | assert(_type == 22) |
| 13244 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13245 | orig_reader = reader |
| 13246 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13247 | obj.xid = reader.read("!L")[0] |
| 13248 | obj.port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13249 | reader.skip(4) |
| 13250 | return obj |
| 13251 | |
| 13252 | def __eq__(self, other): |
| 13253 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13254 | if self.xid != other.xid: return False |
| 13255 | if self.port != other.port: return False |
| 13256 | return True |
| 13257 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13258 | def pretty_print(self, q): |
| 13259 | q.text("queue_get_config_request {") |
| 13260 | with q.group(): |
| 13261 | with q.indent(2): |
| 13262 | q.breakable() |
| 13263 | q.text("xid = "); |
| 13264 | if self.xid != None: |
| 13265 | q.text("%#x" % self.xid) |
| 13266 | else: |
| 13267 | q.text('None') |
| 13268 | q.text(","); q.breakable() |
| 13269 | q.text("port = "); |
| 13270 | q.text(util.pretty_port(self.port)) |
| 13271 | q.breakable() |
| 13272 | q.text('}') |
| 13273 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13274 | message.subtypes[22] = queue_get_config_request |
| 13275 | |
| 13276 | class queue_op_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13277 | version = 4 |
| 13278 | type = 1 |
| 13279 | err_type = 9 |
| 13280 | |
| 13281 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13282 | if xid != None: |
| 13283 | self.xid = xid |
| 13284 | else: |
| 13285 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13286 | if code != None: |
| 13287 | self.code = code |
| 13288 | else: |
| 13289 | self.code = 0 |
| 13290 | if data != None: |
| 13291 | self.data = data |
| 13292 | else: |
| 13293 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13294 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13295 | |
| 13296 | def pack(self): |
| 13297 | packed = [] |
| 13298 | packed.append(struct.pack("!B", self.version)) |
| 13299 | packed.append(struct.pack("!B", self.type)) |
| 13300 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13301 | packed.append(struct.pack("!L", self.xid)) |
| 13302 | packed.append(struct.pack("!H", self.err_type)) |
| 13303 | packed.append(struct.pack("!H", self.code)) |
| 13304 | packed.append(self.data) |
| 13305 | length = sum([len(x) for x in packed]) |
| 13306 | packed[2] = struct.pack("!H", length) |
| 13307 | return ''.join(packed) |
| 13308 | |
| 13309 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13310 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13311 | obj = queue_op_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13312 | _version = reader.read("!B")[0] |
| 13313 | assert(_version == 4) |
| 13314 | _type = reader.read("!B")[0] |
| 13315 | assert(_type == 1) |
| 13316 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13317 | orig_reader = reader |
| 13318 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13319 | obj.xid = reader.read("!L")[0] |
| 13320 | _err_type = reader.read("!H")[0] |
| 13321 | assert(_err_type == 9) |
| 13322 | obj.code = reader.read("!H")[0] |
| 13323 | obj.data = str(reader.read_all()) |
| 13324 | return obj |
| 13325 | |
| 13326 | def __eq__(self, other): |
| 13327 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13328 | if self.xid != other.xid: return False |
| 13329 | if self.code != other.code: return False |
| 13330 | if self.data != other.data: return False |
| 13331 | return True |
| 13332 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13333 | def pretty_print(self, q): |
| 13334 | q.text("queue_op_failed_error_msg {") |
| 13335 | with q.group(): |
| 13336 | with q.indent(2): |
| 13337 | q.breakable() |
| 13338 | q.text("xid = "); |
| 13339 | if self.xid != None: |
| 13340 | q.text("%#x" % self.xid) |
| 13341 | else: |
| 13342 | q.text('None') |
| 13343 | q.text(","); q.breakable() |
| 13344 | q.text("code = "); |
| 13345 | q.text("%#x" % self.code) |
| 13346 | q.text(","); q.breakable() |
| 13347 | q.text("data = "); |
| 13348 | q.pp(self.data) |
| 13349 | q.breakable() |
| 13350 | q.text('}') |
| 13351 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13352 | error_msg.subtypes[9] = queue_op_failed_error_msg |
| 13353 | |
| 13354 | class queue_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13355 | version = 4 |
| 13356 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13357 | stats_type = 5 |
| 13358 | |
| 13359 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13360 | if xid != None: |
| 13361 | self.xid = xid |
| 13362 | else: |
| 13363 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13364 | if flags != None: |
| 13365 | self.flags = flags |
| 13366 | else: |
| 13367 | self.flags = 0 |
| 13368 | if entries != None: |
| 13369 | self.entries = entries |
| 13370 | else: |
| 13371 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13372 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13373 | |
| 13374 | def pack(self): |
| 13375 | packed = [] |
| 13376 | packed.append(struct.pack("!B", self.version)) |
| 13377 | packed.append(struct.pack("!B", self.type)) |
| 13378 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13379 | packed.append(struct.pack("!L", self.xid)) |
| 13380 | packed.append(struct.pack("!H", self.stats_type)) |
| 13381 | packed.append(struct.pack("!H", self.flags)) |
| 13382 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13383 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13384 | length = sum([len(x) for x in packed]) |
| 13385 | packed[2] = struct.pack("!H", length) |
| 13386 | return ''.join(packed) |
| 13387 | |
| 13388 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13389 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13390 | obj = queue_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13391 | _version = reader.read("!B")[0] |
| 13392 | assert(_version == 4) |
| 13393 | _type = reader.read("!B")[0] |
| 13394 | assert(_type == 19) |
| 13395 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13396 | orig_reader = reader |
| 13397 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13398 | obj.xid = reader.read("!L")[0] |
| 13399 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13400 | assert(_stats_type == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13401 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13402 | reader.skip(4) |
| 13403 | obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack) |
| 13404 | return obj |
| 13405 | |
| 13406 | def __eq__(self, other): |
| 13407 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13408 | if self.xid != other.xid: return False |
| 13409 | if self.flags != other.flags: return False |
| 13410 | if self.entries != other.entries: return False |
| 13411 | return True |
| 13412 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13413 | def pretty_print(self, q): |
| 13414 | q.text("queue_stats_reply {") |
| 13415 | with q.group(): |
| 13416 | with q.indent(2): |
| 13417 | q.breakable() |
| 13418 | q.text("xid = "); |
| 13419 | if self.xid != None: |
| 13420 | q.text("%#x" % self.xid) |
| 13421 | else: |
| 13422 | q.text('None') |
| 13423 | q.text(","); q.breakable() |
| 13424 | q.text("flags = "); |
| 13425 | q.text("%#x" % self.flags) |
| 13426 | q.text(","); q.breakable() |
| 13427 | q.text("entries = "); |
| 13428 | q.pp(self.entries) |
| 13429 | q.breakable() |
| 13430 | q.text('}') |
| 13431 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13432 | stats_reply.subtypes[5] = queue_stats_reply |
| 13433 | |
| 13434 | class queue_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13435 | version = 4 |
| 13436 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13437 | stats_type = 5 |
| 13438 | |
| 13439 | 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] | 13440 | if xid != None: |
| 13441 | self.xid = xid |
| 13442 | else: |
| 13443 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13444 | if flags != None: |
| 13445 | self.flags = flags |
| 13446 | else: |
| 13447 | self.flags = 0 |
| 13448 | if port_no != None: |
| 13449 | self.port_no = port_no |
| 13450 | else: |
| 13451 | self.port_no = 0 |
| 13452 | if queue_id != None: |
| 13453 | self.queue_id = queue_id |
| 13454 | else: |
| 13455 | self.queue_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13456 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13457 | |
| 13458 | def pack(self): |
| 13459 | packed = [] |
| 13460 | packed.append(struct.pack("!B", self.version)) |
| 13461 | packed.append(struct.pack("!B", self.type)) |
| 13462 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13463 | packed.append(struct.pack("!L", self.xid)) |
| 13464 | packed.append(struct.pack("!H", self.stats_type)) |
| 13465 | packed.append(struct.pack("!H", self.flags)) |
| 13466 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13467 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13468 | packed.append(struct.pack("!L", self.queue_id)) |
| 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 = queue_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 == 5) |
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) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13488 | obj.port_no = util.unpack_port_no(reader) |
| 13489 | obj.queue_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13490 | return obj |
| 13491 | |
| 13492 | def __eq__(self, other): |
| 13493 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13494 | if self.xid != other.xid: return False |
| 13495 | if self.flags != other.flags: return False |
| 13496 | if self.port_no != other.port_no: return False |
| 13497 | if self.queue_id != other.queue_id: return False |
| 13498 | return True |
| 13499 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13500 | def pretty_print(self, q): |
| 13501 | q.text("queue_stats_request {") |
| 13502 | with q.group(): |
| 13503 | with q.indent(2): |
| 13504 | q.breakable() |
| 13505 | q.text("xid = "); |
| 13506 | if self.xid != None: |
| 13507 | q.text("%#x" % self.xid) |
| 13508 | else: |
| 13509 | q.text('None') |
| 13510 | q.text(","); q.breakable() |
| 13511 | q.text("flags = "); |
| 13512 | q.text("%#x" % self.flags) |
| 13513 | q.text(","); q.breakable() |
| 13514 | q.text("port_no = "); |
| 13515 | q.text(util.pretty_port(self.port_no)) |
| 13516 | q.text(","); q.breakable() |
| 13517 | q.text("queue_id = "); |
| 13518 | q.text("%#x" % self.queue_id) |
| 13519 | q.breakable() |
| 13520 | q.text('}') |
| 13521 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13522 | stats_request.subtypes[5] = queue_stats_request |
| 13523 | |
| 13524 | class role_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13525 | version = 4 |
| 13526 | type = 25 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13527 | |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 13528 | def __init__(self, xid=None, role=None, generation_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13529 | if xid != None: |
| 13530 | self.xid = xid |
| 13531 | else: |
| 13532 | self.xid = None |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 13533 | if role != None: |
| 13534 | self.role = role |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13535 | else: |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 13536 | self.role = 0 |
| 13537 | if generation_id != None: |
| 13538 | self.generation_id = generation_id |
| 13539 | else: |
| 13540 | self.generation_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13541 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13542 | |
| 13543 | def pack(self): |
| 13544 | packed = [] |
| 13545 | packed.append(struct.pack("!B", self.version)) |
| 13546 | packed.append(struct.pack("!B", self.type)) |
| 13547 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13548 | packed.append(struct.pack("!L", self.xid)) |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 13549 | packed.append(struct.pack("!L", self.role)) |
| 13550 | packed.append('\x00' * 4) |
| 13551 | packed.append(struct.pack("!Q", self.generation_id)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13552 | length = sum([len(x) for x in packed]) |
| 13553 | packed[2] = struct.pack("!H", length) |
| 13554 | return ''.join(packed) |
| 13555 | |
| 13556 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13557 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13558 | obj = role_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13559 | _version = reader.read("!B")[0] |
| 13560 | assert(_version == 4) |
| 13561 | _type = reader.read("!B")[0] |
| 13562 | assert(_type == 25) |
| 13563 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13564 | orig_reader = reader |
| 13565 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13566 | obj.xid = reader.read("!L")[0] |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 13567 | obj.role = reader.read("!L")[0] |
| 13568 | reader.skip(4) |
| 13569 | obj.generation_id = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13570 | return obj |
| 13571 | |
| 13572 | def __eq__(self, other): |
| 13573 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13574 | if self.xid != other.xid: return False |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 13575 | if self.role != other.role: return False |
| 13576 | if self.generation_id != other.generation_id: return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13577 | return True |
| 13578 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13579 | def pretty_print(self, q): |
| 13580 | q.text("role_reply {") |
| 13581 | with q.group(): |
| 13582 | with q.indent(2): |
| 13583 | q.breakable() |
| 13584 | q.text("xid = "); |
| 13585 | if self.xid != None: |
| 13586 | q.text("%#x" % self.xid) |
| 13587 | else: |
| 13588 | q.text('None') |
| 13589 | q.text(","); q.breakable() |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 13590 | q.text("role = "); |
| 13591 | q.text("%#x" % self.role) |
| 13592 | q.text(","); q.breakable() |
| 13593 | q.text("generation_id = "); |
| 13594 | q.text("%#x" % self.generation_id) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13595 | q.breakable() |
| 13596 | q.text('}') |
| 13597 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13598 | message.subtypes[25] = role_reply |
| 13599 | |
| 13600 | class role_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13601 | version = 4 |
| 13602 | type = 24 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13603 | |
| 13604 | def __init__(self, xid=None, role=None, generation_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13605 | if xid != None: |
| 13606 | self.xid = xid |
| 13607 | else: |
| 13608 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13609 | if role != None: |
| 13610 | self.role = role |
| 13611 | else: |
| 13612 | self.role = 0 |
| 13613 | if generation_id != None: |
| 13614 | self.generation_id = generation_id |
| 13615 | else: |
| 13616 | self.generation_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13617 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13618 | |
| 13619 | def pack(self): |
| 13620 | packed = [] |
| 13621 | packed.append(struct.pack("!B", self.version)) |
| 13622 | packed.append(struct.pack("!B", self.type)) |
| 13623 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13624 | packed.append(struct.pack("!L", self.xid)) |
| 13625 | packed.append(struct.pack("!L", self.role)) |
| 13626 | packed.append('\x00' * 4) |
| 13627 | packed.append(struct.pack("!Q", self.generation_id)) |
| 13628 | length = sum([len(x) for x in packed]) |
| 13629 | packed[2] = struct.pack("!H", length) |
| 13630 | return ''.join(packed) |
| 13631 | |
| 13632 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13633 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13634 | obj = role_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13635 | _version = reader.read("!B")[0] |
| 13636 | assert(_version == 4) |
| 13637 | _type = reader.read("!B")[0] |
| 13638 | assert(_type == 24) |
| 13639 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13640 | orig_reader = reader |
| 13641 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13642 | obj.xid = reader.read("!L")[0] |
| 13643 | obj.role = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13644 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13645 | obj.generation_id = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13646 | return obj |
| 13647 | |
| 13648 | def __eq__(self, other): |
| 13649 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13650 | if self.xid != other.xid: return False |
| 13651 | if self.role != other.role: return False |
| 13652 | if self.generation_id != other.generation_id: return False |
| 13653 | return True |
| 13654 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13655 | def pretty_print(self, q): |
| 13656 | q.text("role_request {") |
| 13657 | with q.group(): |
| 13658 | with q.indent(2): |
| 13659 | q.breakable() |
| 13660 | q.text("xid = "); |
| 13661 | if self.xid != None: |
| 13662 | q.text("%#x" % self.xid) |
| 13663 | else: |
| 13664 | q.text('None') |
| 13665 | q.text(","); q.breakable() |
| 13666 | q.text("role = "); |
| 13667 | q.text("%#x" % self.role) |
| 13668 | q.text(","); q.breakable() |
| 13669 | q.text("generation_id = "); |
| 13670 | q.text("%#x" % self.generation_id) |
| 13671 | q.breakable() |
| 13672 | q.text('}') |
| 13673 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13674 | message.subtypes[24] = role_request |
| 13675 | |
| 13676 | class role_request_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13677 | version = 4 |
| 13678 | type = 1 |
| 13679 | err_type = 11 |
| 13680 | |
| 13681 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13682 | if xid != None: |
| 13683 | self.xid = xid |
| 13684 | else: |
| 13685 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13686 | if code != None: |
| 13687 | self.code = code |
| 13688 | else: |
| 13689 | self.code = 0 |
| 13690 | if data != None: |
| 13691 | self.data = data |
| 13692 | else: |
| 13693 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13694 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13695 | |
| 13696 | def pack(self): |
| 13697 | packed = [] |
| 13698 | packed.append(struct.pack("!B", self.version)) |
| 13699 | packed.append(struct.pack("!B", self.type)) |
| 13700 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13701 | packed.append(struct.pack("!L", self.xid)) |
| 13702 | packed.append(struct.pack("!H", self.err_type)) |
| 13703 | packed.append(struct.pack("!H", self.code)) |
| 13704 | packed.append(self.data) |
| 13705 | length = sum([len(x) for x in packed]) |
| 13706 | packed[2] = struct.pack("!H", length) |
| 13707 | return ''.join(packed) |
| 13708 | |
| 13709 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13710 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13711 | obj = role_request_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13712 | _version = reader.read("!B")[0] |
| 13713 | assert(_version == 4) |
| 13714 | _type = reader.read("!B")[0] |
| 13715 | assert(_type == 1) |
| 13716 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13717 | orig_reader = reader |
| 13718 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13719 | obj.xid = reader.read("!L")[0] |
| 13720 | _err_type = reader.read("!H")[0] |
| 13721 | assert(_err_type == 11) |
| 13722 | obj.code = reader.read("!H")[0] |
| 13723 | obj.data = str(reader.read_all()) |
| 13724 | return obj |
| 13725 | |
| 13726 | def __eq__(self, other): |
| 13727 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13728 | if self.xid != other.xid: return False |
| 13729 | if self.code != other.code: return False |
| 13730 | if self.data != other.data: return False |
| 13731 | return True |
| 13732 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13733 | def pretty_print(self, q): |
| 13734 | q.text("role_request_failed_error_msg {") |
| 13735 | with q.group(): |
| 13736 | with q.indent(2): |
| 13737 | q.breakable() |
| 13738 | q.text("xid = "); |
| 13739 | if self.xid != None: |
| 13740 | q.text("%#x" % self.xid) |
| 13741 | else: |
| 13742 | q.text('None') |
| 13743 | q.text(","); q.breakable() |
| 13744 | q.text("code = "); |
| 13745 | q.text("%#x" % self.code) |
| 13746 | q.text(","); q.breakable() |
| 13747 | q.text("data = "); |
| 13748 | q.pp(self.data) |
| 13749 | q.breakable() |
| 13750 | q.text('}') |
| 13751 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13752 | error_msg.subtypes[11] = role_request_failed_error_msg |
| 13753 | |
| 13754 | class set_config(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13755 | version = 4 |
| 13756 | type = 9 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13757 | |
| 13758 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13759 | if xid != None: |
| 13760 | self.xid = xid |
| 13761 | else: |
| 13762 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13763 | if flags != None: |
| 13764 | self.flags = flags |
| 13765 | else: |
| 13766 | self.flags = 0 |
| 13767 | if miss_send_len != None: |
| 13768 | self.miss_send_len = miss_send_len |
| 13769 | else: |
| 13770 | self.miss_send_len = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13771 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13772 | |
| 13773 | def pack(self): |
| 13774 | packed = [] |
| 13775 | packed.append(struct.pack("!B", self.version)) |
| 13776 | packed.append(struct.pack("!B", self.type)) |
| 13777 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13778 | packed.append(struct.pack("!L", self.xid)) |
| 13779 | packed.append(struct.pack("!H", self.flags)) |
| 13780 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 13781 | length = sum([len(x) for x in packed]) |
| 13782 | packed[2] = struct.pack("!H", length) |
| 13783 | return ''.join(packed) |
| 13784 | |
| 13785 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13786 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13787 | obj = set_config() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13788 | _version = reader.read("!B")[0] |
| 13789 | assert(_version == 4) |
| 13790 | _type = reader.read("!B")[0] |
| 13791 | assert(_type == 9) |
| 13792 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13793 | orig_reader = reader |
| 13794 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13795 | obj.xid = reader.read("!L")[0] |
| 13796 | obj.flags = reader.read("!H")[0] |
| 13797 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13798 | return obj |
| 13799 | |
| 13800 | def __eq__(self, other): |
| 13801 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13802 | if self.xid != other.xid: return False |
| 13803 | if self.flags != other.flags: return False |
| 13804 | if self.miss_send_len != other.miss_send_len: return False |
| 13805 | return True |
| 13806 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13807 | def pretty_print(self, q): |
| 13808 | q.text("set_config {") |
| 13809 | with q.group(): |
| 13810 | with q.indent(2): |
| 13811 | q.breakable() |
| 13812 | q.text("xid = "); |
| 13813 | if self.xid != None: |
| 13814 | q.text("%#x" % self.xid) |
| 13815 | else: |
| 13816 | q.text('None') |
| 13817 | q.text(","); q.breakable() |
| 13818 | q.text("flags = "); |
| 13819 | q.text("%#x" % self.flags) |
| 13820 | q.text(","); q.breakable() |
| 13821 | q.text("miss_send_len = "); |
| 13822 | q.text("%#x" % self.miss_send_len) |
| 13823 | q.breakable() |
| 13824 | q.text('}') |
| 13825 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13826 | message.subtypes[9] = set_config |
| 13827 | |
| 13828 | class switch_config_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13829 | version = 4 |
| 13830 | type = 1 |
| 13831 | err_type = 10 |
| 13832 | |
| 13833 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13834 | if xid != None: |
| 13835 | self.xid = xid |
| 13836 | else: |
| 13837 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13838 | if code != None: |
| 13839 | self.code = code |
| 13840 | else: |
| 13841 | self.code = 0 |
| 13842 | if data != None: |
| 13843 | self.data = data |
| 13844 | else: |
| 13845 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13846 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13847 | |
| 13848 | def pack(self): |
| 13849 | packed = [] |
| 13850 | packed.append(struct.pack("!B", self.version)) |
| 13851 | packed.append(struct.pack("!B", self.type)) |
| 13852 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13853 | packed.append(struct.pack("!L", self.xid)) |
| 13854 | packed.append(struct.pack("!H", self.err_type)) |
| 13855 | packed.append(struct.pack("!H", self.code)) |
| 13856 | packed.append(self.data) |
| 13857 | length = sum([len(x) for x in packed]) |
| 13858 | packed[2] = struct.pack("!H", length) |
| 13859 | return ''.join(packed) |
| 13860 | |
| 13861 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13862 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13863 | obj = switch_config_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13864 | _version = reader.read("!B")[0] |
| 13865 | assert(_version == 4) |
| 13866 | _type = reader.read("!B")[0] |
| 13867 | assert(_type == 1) |
| 13868 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13869 | orig_reader = reader |
| 13870 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13871 | obj.xid = reader.read("!L")[0] |
| 13872 | _err_type = reader.read("!H")[0] |
| 13873 | assert(_err_type == 10) |
| 13874 | obj.code = reader.read("!H")[0] |
| 13875 | obj.data = str(reader.read_all()) |
| 13876 | return obj |
| 13877 | |
| 13878 | def __eq__(self, other): |
| 13879 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13880 | if self.xid != other.xid: return False |
| 13881 | if self.code != other.code: return False |
| 13882 | if self.data != other.data: return False |
| 13883 | return True |
| 13884 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13885 | def pretty_print(self, q): |
| 13886 | q.text("switch_config_failed_error_msg {") |
| 13887 | with q.group(): |
| 13888 | with q.indent(2): |
| 13889 | q.breakable() |
| 13890 | q.text("xid = "); |
| 13891 | if self.xid != None: |
| 13892 | q.text("%#x" % self.xid) |
| 13893 | else: |
| 13894 | q.text('None') |
| 13895 | q.text(","); q.breakable() |
| 13896 | q.text("code = "); |
| 13897 | q.text("%#x" % self.code) |
| 13898 | q.text(","); q.breakable() |
| 13899 | q.text("data = "); |
| 13900 | q.pp(self.data) |
| 13901 | q.breakable() |
| 13902 | q.text('}') |
| 13903 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13904 | error_msg.subtypes[10] = switch_config_failed_error_msg |
| 13905 | |
| 13906 | class table_features_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13907 | version = 4 |
| 13908 | type = 1 |
| 13909 | err_type = 13 |
| 13910 | |
| 13911 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13912 | if xid != None: |
| 13913 | self.xid = xid |
| 13914 | else: |
| 13915 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13916 | if code != None: |
| 13917 | self.code = code |
| 13918 | else: |
| 13919 | self.code = 0 |
| 13920 | if data != None: |
| 13921 | self.data = data |
| 13922 | else: |
| 13923 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13924 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13925 | |
| 13926 | def pack(self): |
| 13927 | packed = [] |
| 13928 | packed.append(struct.pack("!B", self.version)) |
| 13929 | packed.append(struct.pack("!B", self.type)) |
| 13930 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13931 | packed.append(struct.pack("!L", self.xid)) |
| 13932 | packed.append(struct.pack("!H", self.err_type)) |
| 13933 | packed.append(struct.pack("!H", self.code)) |
| 13934 | packed.append(self.data) |
| 13935 | length = sum([len(x) for x in packed]) |
| 13936 | packed[2] = struct.pack("!H", length) |
| 13937 | return ''.join(packed) |
| 13938 | |
| 13939 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13940 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13941 | obj = table_features_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13942 | _version = reader.read("!B")[0] |
| 13943 | assert(_version == 4) |
| 13944 | _type = reader.read("!B")[0] |
| 13945 | assert(_type == 1) |
| 13946 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13947 | orig_reader = reader |
| 13948 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13949 | obj.xid = reader.read("!L")[0] |
| 13950 | _err_type = reader.read("!H")[0] |
| 13951 | assert(_err_type == 13) |
| 13952 | obj.code = reader.read("!H")[0] |
| 13953 | obj.data = str(reader.read_all()) |
| 13954 | return obj |
| 13955 | |
| 13956 | def __eq__(self, other): |
| 13957 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13958 | if self.xid != other.xid: return False |
| 13959 | if self.code != other.code: return False |
| 13960 | if self.data != other.data: return False |
| 13961 | return True |
| 13962 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13963 | def pretty_print(self, q): |
| 13964 | q.text("table_features_failed_error_msg {") |
| 13965 | with q.group(): |
| 13966 | with q.indent(2): |
| 13967 | q.breakable() |
| 13968 | q.text("xid = "); |
| 13969 | if self.xid != None: |
| 13970 | q.text("%#x" % self.xid) |
| 13971 | else: |
| 13972 | q.text('None') |
| 13973 | q.text(","); q.breakable() |
| 13974 | q.text("code = "); |
| 13975 | q.text("%#x" % self.code) |
| 13976 | q.text(","); q.breakable() |
| 13977 | q.text("data = "); |
| 13978 | q.pp(self.data) |
| 13979 | q.breakable() |
| 13980 | q.text('}') |
| 13981 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13982 | error_msg.subtypes[13] = table_features_failed_error_msg |
| 13983 | |
| 13984 | class table_features_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13985 | version = 4 |
| 13986 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13987 | stats_type = 12 |
| 13988 | |
| 13989 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13990 | if xid != None: |
| 13991 | self.xid = xid |
| 13992 | else: |
| 13993 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13994 | if flags != None: |
| 13995 | self.flags = flags |
| 13996 | else: |
| 13997 | self.flags = 0 |
| 13998 | if entries != None: |
| 13999 | self.entries = entries |
| 14000 | else: |
| 14001 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14002 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14003 | |
| 14004 | def pack(self): |
| 14005 | packed = [] |
| 14006 | packed.append(struct.pack("!B", self.version)) |
| 14007 | packed.append(struct.pack("!B", self.type)) |
| 14008 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14009 | packed.append(struct.pack("!L", self.xid)) |
| 14010 | packed.append(struct.pack("!H", self.stats_type)) |
| 14011 | packed.append(struct.pack("!H", self.flags)) |
| 14012 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14013 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14014 | length = sum([len(x) for x in packed]) |
| 14015 | packed[2] = struct.pack("!H", length) |
| 14016 | return ''.join(packed) |
| 14017 | |
| 14018 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14019 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14020 | obj = table_features_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14021 | _version = reader.read("!B")[0] |
| 14022 | assert(_version == 4) |
| 14023 | _type = reader.read("!B")[0] |
| 14024 | assert(_type == 19) |
| 14025 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14026 | orig_reader = reader |
| 14027 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14028 | obj.xid = reader.read("!L")[0] |
| 14029 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14030 | assert(_stats_type == 12) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14031 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14032 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14033 | obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14034 | return obj |
| 14035 | |
| 14036 | def __eq__(self, other): |
| 14037 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14038 | if self.xid != other.xid: return False |
| 14039 | if self.flags != other.flags: return False |
| 14040 | if self.entries != other.entries: return False |
| 14041 | return True |
| 14042 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14043 | def pretty_print(self, q): |
| 14044 | q.text("table_features_stats_reply {") |
| 14045 | with q.group(): |
| 14046 | with q.indent(2): |
| 14047 | q.breakable() |
| 14048 | q.text("xid = "); |
| 14049 | if self.xid != None: |
| 14050 | q.text("%#x" % self.xid) |
| 14051 | else: |
| 14052 | q.text('None') |
| 14053 | q.text(","); q.breakable() |
| 14054 | q.text("flags = "); |
| 14055 | q.text("%#x" % self.flags) |
| 14056 | q.text(","); q.breakable() |
| 14057 | q.text("entries = "); |
| 14058 | q.pp(self.entries) |
| 14059 | q.breakable() |
| 14060 | q.text('}') |
| 14061 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14062 | stats_reply.subtypes[12] = table_features_stats_reply |
| 14063 | |
| 14064 | class table_features_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14065 | version = 4 |
| 14066 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14067 | stats_type = 12 |
| 14068 | |
| 14069 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14070 | if xid != None: |
| 14071 | self.xid = xid |
| 14072 | else: |
| 14073 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14074 | if flags != None: |
| 14075 | self.flags = flags |
| 14076 | else: |
| 14077 | self.flags = 0 |
| 14078 | if entries != None: |
| 14079 | self.entries = entries |
| 14080 | else: |
| 14081 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14082 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14083 | |
| 14084 | def pack(self): |
| 14085 | packed = [] |
| 14086 | packed.append(struct.pack("!B", self.version)) |
| 14087 | packed.append(struct.pack("!B", self.type)) |
| 14088 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14089 | packed.append(struct.pack("!L", self.xid)) |
| 14090 | packed.append(struct.pack("!H", self.stats_type)) |
| 14091 | packed.append(struct.pack("!H", self.flags)) |
| 14092 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14093 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14094 | length = sum([len(x) for x in packed]) |
| 14095 | packed[2] = struct.pack("!H", length) |
| 14096 | return ''.join(packed) |
| 14097 | |
| 14098 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14099 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14100 | obj = table_features_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14101 | _version = reader.read("!B")[0] |
| 14102 | assert(_version == 4) |
| 14103 | _type = reader.read("!B")[0] |
| 14104 | assert(_type == 18) |
| 14105 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14106 | orig_reader = reader |
| 14107 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14108 | obj.xid = reader.read("!L")[0] |
| 14109 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14110 | assert(_stats_type == 12) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14111 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14112 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14113 | obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14114 | return obj |
| 14115 | |
| 14116 | def __eq__(self, other): |
| 14117 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14118 | if self.xid != other.xid: return False |
| 14119 | if self.flags != other.flags: return False |
| 14120 | if self.entries != other.entries: return False |
| 14121 | return True |
| 14122 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14123 | def pretty_print(self, q): |
| 14124 | q.text("table_features_stats_request {") |
| 14125 | with q.group(): |
| 14126 | with q.indent(2): |
| 14127 | q.breakable() |
| 14128 | q.text("xid = "); |
| 14129 | if self.xid != None: |
| 14130 | q.text("%#x" % self.xid) |
| 14131 | else: |
| 14132 | q.text('None') |
| 14133 | q.text(","); q.breakable() |
| 14134 | q.text("flags = "); |
| 14135 | q.text("%#x" % self.flags) |
| 14136 | q.text(","); q.breakable() |
| 14137 | q.text("entries = "); |
| 14138 | q.pp(self.entries) |
| 14139 | q.breakable() |
| 14140 | q.text('}') |
| 14141 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14142 | stats_request.subtypes[12] = table_features_stats_request |
| 14143 | |
| 14144 | class table_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14145 | version = 4 |
| 14146 | type = 17 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14147 | |
| 14148 | def __init__(self, xid=None, table_id=None, config=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14149 | if xid != None: |
| 14150 | self.xid = xid |
| 14151 | else: |
| 14152 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14153 | if table_id != None: |
| 14154 | self.table_id = table_id |
| 14155 | else: |
| 14156 | self.table_id = 0 |
| 14157 | if config != None: |
| 14158 | self.config = config |
| 14159 | else: |
| 14160 | self.config = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14161 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14162 | |
| 14163 | def pack(self): |
| 14164 | packed = [] |
| 14165 | packed.append(struct.pack("!B", self.version)) |
| 14166 | packed.append(struct.pack("!B", self.type)) |
| 14167 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14168 | packed.append(struct.pack("!L", self.xid)) |
| 14169 | packed.append(struct.pack("!B", self.table_id)) |
| 14170 | packed.append('\x00' * 3) |
| 14171 | packed.append(struct.pack("!L", self.config)) |
| 14172 | length = sum([len(x) for x in packed]) |
| 14173 | packed[2] = struct.pack("!H", length) |
| 14174 | return ''.join(packed) |
| 14175 | |
| 14176 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14177 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14178 | obj = table_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14179 | _version = reader.read("!B")[0] |
| 14180 | assert(_version == 4) |
| 14181 | _type = reader.read("!B")[0] |
| 14182 | assert(_type == 17) |
| 14183 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14184 | orig_reader = reader |
| 14185 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14186 | obj.xid = reader.read("!L")[0] |
| 14187 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14188 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14189 | obj.config = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14190 | return obj |
| 14191 | |
| 14192 | def __eq__(self, other): |
| 14193 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14194 | if self.xid != other.xid: return False |
| 14195 | if self.table_id != other.table_id: return False |
| 14196 | if self.config != other.config: return False |
| 14197 | return True |
| 14198 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14199 | def pretty_print(self, q): |
| 14200 | q.text("table_mod {") |
| 14201 | with q.group(): |
| 14202 | with q.indent(2): |
| 14203 | q.breakable() |
| 14204 | q.text("xid = "); |
| 14205 | if self.xid != None: |
| 14206 | q.text("%#x" % self.xid) |
| 14207 | else: |
| 14208 | q.text('None') |
| 14209 | q.text(","); q.breakable() |
| 14210 | q.text("table_id = "); |
| 14211 | q.text("%#x" % self.table_id) |
| 14212 | q.text(","); q.breakable() |
| 14213 | q.text("config = "); |
| 14214 | q.text("%#x" % self.config) |
| 14215 | q.breakable() |
| 14216 | q.text('}') |
| 14217 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14218 | message.subtypes[17] = table_mod |
| 14219 | |
| 14220 | class table_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14221 | version = 4 |
| 14222 | type = 1 |
| 14223 | err_type = 8 |
| 14224 | |
| 14225 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14226 | if xid != None: |
| 14227 | self.xid = xid |
| 14228 | else: |
| 14229 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14230 | if code != None: |
| 14231 | self.code = code |
| 14232 | else: |
| 14233 | self.code = 0 |
| 14234 | if data != None: |
| 14235 | self.data = data |
| 14236 | else: |
| 14237 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14238 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14239 | |
| 14240 | def pack(self): |
| 14241 | packed = [] |
| 14242 | packed.append(struct.pack("!B", self.version)) |
| 14243 | packed.append(struct.pack("!B", self.type)) |
| 14244 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14245 | packed.append(struct.pack("!L", self.xid)) |
| 14246 | packed.append(struct.pack("!H", self.err_type)) |
| 14247 | packed.append(struct.pack("!H", self.code)) |
| 14248 | packed.append(self.data) |
| 14249 | length = sum([len(x) for x in packed]) |
| 14250 | packed[2] = struct.pack("!H", length) |
| 14251 | return ''.join(packed) |
| 14252 | |
| 14253 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14254 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14255 | obj = table_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14256 | _version = reader.read("!B")[0] |
| 14257 | assert(_version == 4) |
| 14258 | _type = reader.read("!B")[0] |
| 14259 | assert(_type == 1) |
| 14260 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14261 | orig_reader = reader |
| 14262 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14263 | obj.xid = reader.read("!L")[0] |
| 14264 | _err_type = reader.read("!H")[0] |
| 14265 | assert(_err_type == 8) |
| 14266 | obj.code = reader.read("!H")[0] |
| 14267 | obj.data = str(reader.read_all()) |
| 14268 | return obj |
| 14269 | |
| 14270 | def __eq__(self, other): |
| 14271 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14272 | if self.xid != other.xid: return False |
| 14273 | if self.code != other.code: return False |
| 14274 | if self.data != other.data: return False |
| 14275 | return True |
| 14276 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14277 | def pretty_print(self, q): |
| 14278 | q.text("table_mod_failed_error_msg {") |
| 14279 | with q.group(): |
| 14280 | with q.indent(2): |
| 14281 | q.breakable() |
| 14282 | q.text("xid = "); |
| 14283 | if self.xid != None: |
| 14284 | q.text("%#x" % self.xid) |
| 14285 | else: |
| 14286 | q.text('None') |
| 14287 | q.text(","); q.breakable() |
| 14288 | q.text("code = "); |
| 14289 | q.text("%#x" % self.code) |
| 14290 | q.text(","); q.breakable() |
| 14291 | q.text("data = "); |
| 14292 | q.pp(self.data) |
| 14293 | q.breakable() |
| 14294 | q.text('}') |
| 14295 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14296 | error_msg.subtypes[8] = table_mod_failed_error_msg |
| 14297 | |
| 14298 | class table_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14299 | version = 4 |
| 14300 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14301 | stats_type = 3 |
| 14302 | |
| 14303 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14304 | if xid != None: |
| 14305 | self.xid = xid |
| 14306 | else: |
| 14307 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14308 | if flags != None: |
| 14309 | self.flags = flags |
| 14310 | else: |
| 14311 | self.flags = 0 |
| 14312 | if entries != None: |
| 14313 | self.entries = entries |
| 14314 | else: |
| 14315 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14316 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14317 | |
| 14318 | def pack(self): |
| 14319 | packed = [] |
| 14320 | packed.append(struct.pack("!B", self.version)) |
| 14321 | packed.append(struct.pack("!B", self.type)) |
| 14322 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14323 | packed.append(struct.pack("!L", self.xid)) |
| 14324 | packed.append(struct.pack("!H", self.stats_type)) |
| 14325 | packed.append(struct.pack("!H", self.flags)) |
| 14326 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14327 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14328 | length = sum([len(x) for x in packed]) |
| 14329 | packed[2] = struct.pack("!H", length) |
| 14330 | return ''.join(packed) |
| 14331 | |
| 14332 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14333 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14334 | obj = table_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14335 | _version = reader.read("!B")[0] |
| 14336 | assert(_version == 4) |
| 14337 | _type = reader.read("!B")[0] |
| 14338 | assert(_type == 19) |
| 14339 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14340 | orig_reader = reader |
| 14341 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14342 | obj.xid = reader.read("!L")[0] |
| 14343 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14344 | assert(_stats_type == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14345 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14346 | reader.skip(4) |
| 14347 | obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack) |
| 14348 | return obj |
| 14349 | |
| 14350 | def __eq__(self, other): |
| 14351 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14352 | if self.xid != other.xid: return False |
| 14353 | if self.flags != other.flags: return False |
| 14354 | if self.entries != other.entries: return False |
| 14355 | return True |
| 14356 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14357 | def pretty_print(self, q): |
| 14358 | q.text("table_stats_reply {") |
| 14359 | with q.group(): |
| 14360 | with q.indent(2): |
| 14361 | q.breakable() |
| 14362 | q.text("xid = "); |
| 14363 | if self.xid != None: |
| 14364 | q.text("%#x" % self.xid) |
| 14365 | else: |
| 14366 | q.text('None') |
| 14367 | q.text(","); q.breakable() |
| 14368 | q.text("flags = "); |
| 14369 | q.text("%#x" % self.flags) |
| 14370 | q.text(","); q.breakable() |
| 14371 | q.text("entries = "); |
| 14372 | q.pp(self.entries) |
| 14373 | q.breakable() |
| 14374 | q.text('}') |
| 14375 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14376 | stats_reply.subtypes[3] = table_stats_reply |
| 14377 | |
| 14378 | class table_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14379 | version = 4 |
| 14380 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14381 | stats_type = 3 |
| 14382 | |
| 14383 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14384 | if xid != None: |
| 14385 | self.xid = xid |
| 14386 | else: |
| 14387 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14388 | if flags != None: |
| 14389 | self.flags = flags |
| 14390 | else: |
| 14391 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14392 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14393 | |
| 14394 | def pack(self): |
| 14395 | packed = [] |
| 14396 | packed.append(struct.pack("!B", self.version)) |
| 14397 | packed.append(struct.pack("!B", self.type)) |
| 14398 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14399 | packed.append(struct.pack("!L", self.xid)) |
| 14400 | packed.append(struct.pack("!H", self.stats_type)) |
| 14401 | packed.append(struct.pack("!H", self.flags)) |
| 14402 | packed.append('\x00' * 4) |
| 14403 | length = sum([len(x) for x in packed]) |
| 14404 | packed[2] = struct.pack("!H", length) |
| 14405 | return ''.join(packed) |
| 14406 | |
| 14407 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14408 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14409 | obj = table_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14410 | _version = reader.read("!B")[0] |
| 14411 | assert(_version == 4) |
| 14412 | _type = reader.read("!B")[0] |
| 14413 | assert(_type == 18) |
| 14414 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14415 | orig_reader = reader |
| 14416 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14417 | obj.xid = reader.read("!L")[0] |
| 14418 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14419 | assert(_stats_type == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14420 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14421 | reader.skip(4) |
| 14422 | return obj |
| 14423 | |
| 14424 | def __eq__(self, other): |
| 14425 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14426 | if self.xid != other.xid: return False |
| 14427 | if self.flags != other.flags: return False |
| 14428 | return True |
| 14429 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14430 | def pretty_print(self, q): |
| 14431 | q.text("table_stats_request {") |
| 14432 | with q.group(): |
| 14433 | with q.indent(2): |
| 14434 | q.breakable() |
| 14435 | q.text("xid = "); |
| 14436 | if self.xid != None: |
| 14437 | q.text("%#x" % self.xid) |
| 14438 | else: |
| 14439 | q.text('None') |
| 14440 | q.text(","); q.breakable() |
| 14441 | q.text("flags = "); |
| 14442 | q.text("%#x" % self.flags) |
| 14443 | q.breakable() |
| 14444 | q.text('}') |
| 14445 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14446 | stats_request.subtypes[3] = table_stats_request |
| 14447 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14448 | |
| 14449 | def parse_header(buf): |
| 14450 | if len(buf) < 8: |
| 14451 | raise loxi.ProtocolError("too short to be an OpenFlow message") |
| 14452 | return struct.unpack_from("!BBHL", buf) |
| 14453 | |
| 14454 | def parse_message(buf): |
| 14455 | msg_ver, msg_type, msg_len, msg_xid = parse_header(buf) |
Rich Lane | fe600f5 | 2013-07-09 13:22:32 -0700 | [diff] [blame] | 14456 | if msg_ver != const.OFP_VERSION and msg_type != const.OFPT_HELLO: |
| 14457 | 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] | 14458 | if len(buf) != msg_len: |
| 14459 | raise loxi.ProtocolError("incorrect message size") |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14460 | return message.unpack(loxi.generic_util.OFReader(buf)) |