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 |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame^] | 12 | import bsn_tlv |
| 13 | import meter_band |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14 | import instruction |
| 15 | import oxm |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame^] | 16 | import common |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 17 | import instruction_id |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame^] | 18 | import action |
| 19 | import message |
| 20 | import action_id |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 21 | import util |
| 22 | import loxi.generic_util |
| 23 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 24 | class message(loxi.OFObject): |
| 25 | subtypes = {} |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 26 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 27 | version = 4 |
| 28 | |
| 29 | def __init__(self, type=None, xid=None): |
| 30 | if type != None: |
| 31 | self.type = type |
| 32 | else: |
| 33 | self.type = 0 |
| 34 | if xid != None: |
| 35 | self.xid = xid |
| 36 | else: |
| 37 | self.xid = None |
| 38 | return |
| 39 | |
| 40 | def pack(self): |
| 41 | packed = [] |
| 42 | packed.append(struct.pack("!B", self.version)) |
| 43 | packed.append(struct.pack("!B", self.type)) |
| 44 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 45 | packed.append(struct.pack("!L", self.xid)) |
| 46 | length = sum([len(x) for x in packed]) |
| 47 | packed[2] = struct.pack("!H", length) |
| 48 | return ''.join(packed) |
| 49 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 50 | @staticmethod |
| 51 | def unpack(reader): |
| 52 | subtype, = reader.peek('B', 1) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 53 | subclass = message.subtypes.get(subtype) |
| 54 | if subclass: |
| 55 | return subclass.unpack(reader) |
| 56 | |
| 57 | obj = message() |
| 58 | _version = reader.read("!B")[0] |
| 59 | assert(_version == 4) |
| 60 | obj.type = reader.read("!B")[0] |
| 61 | _length = reader.read("!H")[0] |
| 62 | orig_reader = reader |
| 63 | reader = orig_reader.slice(_length - (2 + 2)) |
| 64 | obj.xid = reader.read("!L")[0] |
| 65 | return obj |
| 66 | |
| 67 | def __eq__(self, other): |
| 68 | if type(self) != type(other): return False |
| 69 | if self.type != other.type: return False |
| 70 | if self.xid != other.xid: return False |
| 71 | return True |
| 72 | |
| 73 | def pretty_print(self, q): |
| 74 | q.text("message {") |
| 75 | with q.group(): |
| 76 | with q.indent(2): |
| 77 | q.breakable() |
| 78 | q.text("xid = "); |
| 79 | if self.xid != None: |
| 80 | q.text("%#x" % self.xid) |
| 81 | else: |
| 82 | q.text('None') |
| 83 | q.breakable() |
| 84 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 85 | |
| 86 | |
| 87 | class stats_reply(message): |
| 88 | subtypes = {} |
| 89 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 90 | version = 4 |
| 91 | type = 19 |
| 92 | |
| 93 | def __init__(self, xid=None, stats_type=None, flags=None): |
| 94 | if xid != None: |
| 95 | self.xid = xid |
| 96 | else: |
| 97 | self.xid = None |
| 98 | if stats_type != None: |
| 99 | self.stats_type = stats_type |
| 100 | else: |
| 101 | self.stats_type = 0 |
| 102 | if flags != None: |
| 103 | self.flags = flags |
| 104 | else: |
| 105 | self.flags = 0 |
| 106 | return |
| 107 | |
| 108 | def pack(self): |
| 109 | packed = [] |
| 110 | packed.append(struct.pack("!B", self.version)) |
| 111 | packed.append(struct.pack("!B", self.type)) |
| 112 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 113 | packed.append(struct.pack("!L", self.xid)) |
| 114 | packed.append(struct.pack("!H", self.stats_type)) |
| 115 | packed.append(struct.pack("!H", self.flags)) |
| 116 | packed.append('\x00' * 4) |
| 117 | length = sum([len(x) for x in packed]) |
| 118 | packed[2] = struct.pack("!H", length) |
| 119 | return ''.join(packed) |
| 120 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 121 | @staticmethod |
| 122 | def unpack(reader): |
| 123 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 124 | subclass = stats_reply.subtypes.get(subtype) |
| 125 | if subclass: |
| 126 | return subclass.unpack(reader) |
| 127 | |
| 128 | obj = stats_reply() |
| 129 | _version = reader.read("!B")[0] |
| 130 | assert(_version == 4) |
| 131 | _type = reader.read("!B")[0] |
| 132 | assert(_type == 19) |
| 133 | _length = reader.read("!H")[0] |
| 134 | orig_reader = reader |
| 135 | reader = orig_reader.slice(_length - (2 + 2)) |
| 136 | obj.xid = reader.read("!L")[0] |
| 137 | obj.stats_type = reader.read("!H")[0] |
| 138 | obj.flags = reader.read("!H")[0] |
| 139 | reader.skip(4) |
| 140 | return obj |
| 141 | |
| 142 | def __eq__(self, other): |
| 143 | if type(self) != type(other): return False |
| 144 | if self.xid != other.xid: return False |
| 145 | if self.stats_type != other.stats_type: return False |
| 146 | if self.flags != other.flags: return False |
| 147 | return True |
| 148 | |
| 149 | def pretty_print(self, q): |
| 150 | q.text("stats_reply {") |
| 151 | with q.group(): |
| 152 | with q.indent(2): |
| 153 | q.breakable() |
| 154 | q.text("xid = "); |
| 155 | if self.xid != None: |
| 156 | q.text("%#x" % self.xid) |
| 157 | else: |
| 158 | q.text('None') |
| 159 | q.text(","); q.breakable() |
| 160 | q.text("flags = "); |
| 161 | q.text("%#x" % self.flags) |
| 162 | q.breakable() |
| 163 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 164 | |
| 165 | message.subtypes[19] = stats_reply |
| 166 | |
| 167 | class aggregate_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 168 | version = 4 |
| 169 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 170 | stats_type = 2 |
| 171 | |
| 172 | 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] | 173 | if xid != None: |
| 174 | self.xid = xid |
| 175 | else: |
| 176 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 177 | if flags != None: |
| 178 | self.flags = flags |
| 179 | else: |
| 180 | self.flags = 0 |
| 181 | if packet_count != None: |
| 182 | self.packet_count = packet_count |
| 183 | else: |
| 184 | self.packet_count = 0 |
| 185 | if byte_count != None: |
| 186 | self.byte_count = byte_count |
| 187 | else: |
| 188 | self.byte_count = 0 |
| 189 | if flow_count != None: |
| 190 | self.flow_count = flow_count |
| 191 | else: |
| 192 | self.flow_count = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 193 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 194 | |
| 195 | def pack(self): |
| 196 | packed = [] |
| 197 | packed.append(struct.pack("!B", self.version)) |
| 198 | packed.append(struct.pack("!B", self.type)) |
| 199 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 200 | packed.append(struct.pack("!L", self.xid)) |
| 201 | packed.append(struct.pack("!H", self.stats_type)) |
| 202 | packed.append(struct.pack("!H", self.flags)) |
| 203 | packed.append('\x00' * 4) |
| 204 | packed.append(struct.pack("!Q", self.packet_count)) |
| 205 | packed.append(struct.pack("!Q", self.byte_count)) |
| 206 | packed.append(struct.pack("!L", self.flow_count)) |
| 207 | packed.append('\x00' * 4) |
| 208 | length = sum([len(x) for x in packed]) |
| 209 | packed[2] = struct.pack("!H", length) |
| 210 | return ''.join(packed) |
| 211 | |
| 212 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 213 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 214 | obj = aggregate_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 215 | _version = reader.read("!B")[0] |
| 216 | assert(_version == 4) |
| 217 | _type = reader.read("!B")[0] |
| 218 | assert(_type == 19) |
| 219 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 220 | orig_reader = reader |
| 221 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 222 | obj.xid = reader.read("!L")[0] |
| 223 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 224 | assert(_stats_type == 2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 225 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 226 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 227 | obj.packet_count = reader.read("!Q")[0] |
| 228 | obj.byte_count = reader.read("!Q")[0] |
| 229 | obj.flow_count = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 230 | reader.skip(4) |
| 231 | return obj |
| 232 | |
| 233 | def __eq__(self, other): |
| 234 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 235 | if self.xid != other.xid: return False |
| 236 | if self.flags != other.flags: return False |
| 237 | if self.packet_count != other.packet_count: return False |
| 238 | if self.byte_count != other.byte_count: return False |
| 239 | if self.flow_count != other.flow_count: return False |
| 240 | return True |
| 241 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 242 | def pretty_print(self, q): |
| 243 | q.text("aggregate_stats_reply {") |
| 244 | with q.group(): |
| 245 | with q.indent(2): |
| 246 | q.breakable() |
| 247 | q.text("xid = "); |
| 248 | if self.xid != None: |
| 249 | q.text("%#x" % self.xid) |
| 250 | else: |
| 251 | q.text('None') |
| 252 | q.text(","); q.breakable() |
| 253 | q.text("flags = "); |
| 254 | q.text("%#x" % self.flags) |
| 255 | q.text(","); q.breakable() |
| 256 | q.text("packet_count = "); |
| 257 | q.text("%#x" % self.packet_count) |
| 258 | q.text(","); q.breakable() |
| 259 | q.text("byte_count = "); |
| 260 | q.text("%#x" % self.byte_count) |
| 261 | q.text(","); q.breakable() |
| 262 | q.text("flow_count = "); |
| 263 | q.text("%#x" % self.flow_count) |
| 264 | q.breakable() |
| 265 | q.text('}') |
| 266 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 267 | stats_reply.subtypes[2] = aggregate_stats_reply |
| 268 | |
| 269 | class stats_request(message): |
| 270 | subtypes = {} |
| 271 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 272 | version = 4 |
| 273 | type = 18 |
| 274 | |
| 275 | def __init__(self, xid=None, stats_type=None, flags=None): |
| 276 | if xid != None: |
| 277 | self.xid = xid |
| 278 | else: |
| 279 | self.xid = None |
| 280 | if stats_type != None: |
| 281 | self.stats_type = stats_type |
| 282 | else: |
| 283 | self.stats_type = 0 |
| 284 | if flags != None: |
| 285 | self.flags = flags |
| 286 | else: |
| 287 | self.flags = 0 |
| 288 | return |
| 289 | |
| 290 | def pack(self): |
| 291 | packed = [] |
| 292 | packed.append(struct.pack("!B", self.version)) |
| 293 | packed.append(struct.pack("!B", self.type)) |
| 294 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 295 | packed.append(struct.pack("!L", self.xid)) |
| 296 | packed.append(struct.pack("!H", self.stats_type)) |
| 297 | packed.append(struct.pack("!H", self.flags)) |
| 298 | packed.append('\x00' * 4) |
| 299 | length = sum([len(x) for x in packed]) |
| 300 | packed[2] = struct.pack("!H", length) |
| 301 | return ''.join(packed) |
| 302 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 303 | @staticmethod |
| 304 | def unpack(reader): |
| 305 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 306 | subclass = stats_request.subtypes.get(subtype) |
| 307 | if subclass: |
| 308 | return subclass.unpack(reader) |
| 309 | |
| 310 | obj = stats_request() |
| 311 | _version = reader.read("!B")[0] |
| 312 | assert(_version == 4) |
| 313 | _type = reader.read("!B")[0] |
| 314 | assert(_type == 18) |
| 315 | _length = reader.read("!H")[0] |
| 316 | orig_reader = reader |
| 317 | reader = orig_reader.slice(_length - (2 + 2)) |
| 318 | obj.xid = reader.read("!L")[0] |
| 319 | obj.stats_type = reader.read("!H")[0] |
| 320 | obj.flags = reader.read("!H")[0] |
| 321 | reader.skip(4) |
| 322 | return obj |
| 323 | |
| 324 | def __eq__(self, other): |
| 325 | if type(self) != type(other): return False |
| 326 | if self.xid != other.xid: return False |
| 327 | if self.stats_type != other.stats_type: return False |
| 328 | if self.flags != other.flags: return False |
| 329 | return True |
| 330 | |
| 331 | def pretty_print(self, q): |
| 332 | q.text("stats_request {") |
| 333 | with q.group(): |
| 334 | with q.indent(2): |
| 335 | q.breakable() |
| 336 | q.text("xid = "); |
| 337 | if self.xid != None: |
| 338 | q.text("%#x" % self.xid) |
| 339 | else: |
| 340 | q.text('None') |
| 341 | q.text(","); q.breakable() |
| 342 | q.text("flags = "); |
| 343 | q.text("%#x" % self.flags) |
| 344 | q.breakable() |
| 345 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 346 | |
| 347 | message.subtypes[18] = stats_request |
| 348 | |
| 349 | class aggregate_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 350 | version = 4 |
| 351 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 352 | stats_type = 2 |
| 353 | |
| 354 | 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] | 355 | if xid != None: |
| 356 | self.xid = xid |
| 357 | else: |
| 358 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 359 | if flags != None: |
| 360 | self.flags = flags |
| 361 | else: |
| 362 | self.flags = 0 |
| 363 | if table_id != None: |
| 364 | self.table_id = table_id |
| 365 | else: |
| 366 | self.table_id = 0 |
| 367 | if out_port != None: |
| 368 | self.out_port = out_port |
| 369 | else: |
| 370 | self.out_port = 0 |
| 371 | if out_group != None: |
| 372 | self.out_group = out_group |
| 373 | else: |
| 374 | self.out_group = 0 |
| 375 | if cookie != None: |
| 376 | self.cookie = cookie |
| 377 | else: |
| 378 | self.cookie = 0 |
| 379 | if cookie_mask != None: |
| 380 | self.cookie_mask = cookie_mask |
| 381 | else: |
| 382 | self.cookie_mask = 0 |
| 383 | if match != None: |
| 384 | self.match = match |
| 385 | else: |
| 386 | self.match = common.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 387 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 388 | |
| 389 | def pack(self): |
| 390 | packed = [] |
| 391 | packed.append(struct.pack("!B", self.version)) |
| 392 | packed.append(struct.pack("!B", self.type)) |
| 393 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 394 | packed.append(struct.pack("!L", self.xid)) |
| 395 | packed.append(struct.pack("!H", self.stats_type)) |
| 396 | packed.append(struct.pack("!H", self.flags)) |
| 397 | packed.append('\x00' * 4) |
| 398 | packed.append(struct.pack("!B", self.table_id)) |
| 399 | packed.append('\x00' * 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 400 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 401 | packed.append(struct.pack("!L", self.out_group)) |
| 402 | packed.append('\x00' * 4) |
| 403 | packed.append(struct.pack("!Q", self.cookie)) |
| 404 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 405 | packed.append(self.match.pack()) |
| 406 | length = sum([len(x) for x in packed]) |
| 407 | packed[2] = struct.pack("!H", length) |
| 408 | return ''.join(packed) |
| 409 | |
| 410 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 411 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 412 | obj = aggregate_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 413 | _version = reader.read("!B")[0] |
| 414 | assert(_version == 4) |
| 415 | _type = reader.read("!B")[0] |
| 416 | assert(_type == 18) |
| 417 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 418 | orig_reader = reader |
| 419 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 420 | obj.xid = reader.read("!L")[0] |
| 421 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 422 | assert(_stats_type == 2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 423 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 424 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 425 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 426 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 427 | obj.out_port = util.unpack_port_no(reader) |
| 428 | obj.out_group = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 429 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 430 | obj.cookie = reader.read("!Q")[0] |
| 431 | obj.cookie_mask = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 432 | obj.match = common.match.unpack(reader) |
| 433 | return obj |
| 434 | |
| 435 | def __eq__(self, other): |
| 436 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 437 | if self.xid != other.xid: return False |
| 438 | if self.flags != other.flags: return False |
| 439 | if self.table_id != other.table_id: return False |
| 440 | if self.out_port != other.out_port: return False |
| 441 | if self.out_group != other.out_group: return False |
| 442 | if self.cookie != other.cookie: return False |
| 443 | if self.cookie_mask != other.cookie_mask: return False |
| 444 | if self.match != other.match: return False |
| 445 | return True |
| 446 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 447 | def pretty_print(self, q): |
| 448 | q.text("aggregate_stats_request {") |
| 449 | with q.group(): |
| 450 | with q.indent(2): |
| 451 | q.breakable() |
| 452 | q.text("xid = "); |
| 453 | if self.xid != None: |
| 454 | q.text("%#x" % self.xid) |
| 455 | else: |
| 456 | q.text('None') |
| 457 | q.text(","); q.breakable() |
| 458 | q.text("flags = "); |
| 459 | q.text("%#x" % self.flags) |
| 460 | q.text(","); q.breakable() |
| 461 | q.text("table_id = "); |
| 462 | q.text("%#x" % self.table_id) |
| 463 | q.text(","); q.breakable() |
| 464 | q.text("out_port = "); |
| 465 | q.text(util.pretty_port(self.out_port)) |
| 466 | q.text(","); q.breakable() |
| 467 | q.text("out_group = "); |
| 468 | q.text("%#x" % self.out_group) |
| 469 | q.text(","); q.breakable() |
| 470 | q.text("cookie = "); |
| 471 | q.text("%#x" % self.cookie) |
| 472 | q.text(","); q.breakable() |
| 473 | q.text("cookie_mask = "); |
| 474 | q.text("%#x" % self.cookie_mask) |
| 475 | q.text(","); q.breakable() |
| 476 | q.text("match = "); |
| 477 | q.pp(self.match) |
| 478 | q.breakable() |
| 479 | q.text('}') |
| 480 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 481 | stats_request.subtypes[2] = aggregate_stats_request |
| 482 | |
| 483 | class async_get_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 484 | version = 4 |
| 485 | type = 27 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 486 | |
| 487 | 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] | 488 | if xid != None: |
| 489 | self.xid = xid |
| 490 | else: |
| 491 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 492 | if packet_in_mask_equal_master != None: |
| 493 | self.packet_in_mask_equal_master = packet_in_mask_equal_master |
| 494 | else: |
| 495 | self.packet_in_mask_equal_master = 0 |
| 496 | if packet_in_mask_slave != None: |
| 497 | self.packet_in_mask_slave = packet_in_mask_slave |
| 498 | else: |
| 499 | self.packet_in_mask_slave = 0 |
| 500 | if port_status_mask_equal_master != None: |
| 501 | self.port_status_mask_equal_master = port_status_mask_equal_master |
| 502 | else: |
| 503 | self.port_status_mask_equal_master = 0 |
| 504 | if port_status_mask_slave != None: |
| 505 | self.port_status_mask_slave = port_status_mask_slave |
| 506 | else: |
| 507 | self.port_status_mask_slave = 0 |
| 508 | if flow_removed_mask_equal_master != None: |
| 509 | self.flow_removed_mask_equal_master = flow_removed_mask_equal_master |
| 510 | else: |
| 511 | self.flow_removed_mask_equal_master = 0 |
| 512 | if flow_removed_mask_slave != None: |
| 513 | self.flow_removed_mask_slave = flow_removed_mask_slave |
| 514 | else: |
| 515 | self.flow_removed_mask_slave = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 516 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 517 | |
| 518 | def pack(self): |
| 519 | packed = [] |
| 520 | packed.append(struct.pack("!B", self.version)) |
| 521 | packed.append(struct.pack("!B", self.type)) |
| 522 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 523 | packed.append(struct.pack("!L", self.xid)) |
| 524 | packed.append(struct.pack("!L", self.packet_in_mask_equal_master)) |
| 525 | packed.append(struct.pack("!L", self.packet_in_mask_slave)) |
| 526 | packed.append(struct.pack("!L", self.port_status_mask_equal_master)) |
| 527 | packed.append(struct.pack("!L", self.port_status_mask_slave)) |
| 528 | packed.append(struct.pack("!L", self.flow_removed_mask_equal_master)) |
| 529 | packed.append(struct.pack("!L", self.flow_removed_mask_slave)) |
| 530 | length = sum([len(x) for x in packed]) |
| 531 | packed[2] = struct.pack("!H", length) |
| 532 | return ''.join(packed) |
| 533 | |
| 534 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 535 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 536 | obj = async_get_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 537 | _version = reader.read("!B")[0] |
| 538 | assert(_version == 4) |
| 539 | _type = reader.read("!B")[0] |
| 540 | assert(_type == 27) |
| 541 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 542 | orig_reader = reader |
| 543 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 544 | obj.xid = reader.read("!L")[0] |
| 545 | obj.packet_in_mask_equal_master = reader.read("!L")[0] |
| 546 | obj.packet_in_mask_slave = reader.read("!L")[0] |
| 547 | obj.port_status_mask_equal_master = reader.read("!L")[0] |
| 548 | obj.port_status_mask_slave = reader.read("!L")[0] |
| 549 | obj.flow_removed_mask_equal_master = reader.read("!L")[0] |
| 550 | obj.flow_removed_mask_slave = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 551 | return obj |
| 552 | |
| 553 | def __eq__(self, other): |
| 554 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 555 | if self.xid != other.xid: return False |
| 556 | if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False |
| 557 | if self.packet_in_mask_slave != other.packet_in_mask_slave: return False |
| 558 | if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False |
| 559 | if self.port_status_mask_slave != other.port_status_mask_slave: return False |
| 560 | if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False |
| 561 | if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False |
| 562 | return True |
| 563 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 564 | def pretty_print(self, q): |
| 565 | q.text("async_get_reply {") |
| 566 | with q.group(): |
| 567 | with q.indent(2): |
| 568 | q.breakable() |
| 569 | q.text("xid = "); |
| 570 | if self.xid != None: |
| 571 | q.text("%#x" % self.xid) |
| 572 | else: |
| 573 | q.text('None') |
| 574 | q.text(","); q.breakable() |
| 575 | q.text("packet_in_mask_equal_master = "); |
| 576 | q.text("%#x" % self.packet_in_mask_equal_master) |
| 577 | q.text(","); q.breakable() |
| 578 | q.text("packet_in_mask_slave = "); |
| 579 | q.text("%#x" % self.packet_in_mask_slave) |
| 580 | q.text(","); q.breakable() |
| 581 | q.text("port_status_mask_equal_master = "); |
| 582 | q.text("%#x" % self.port_status_mask_equal_master) |
| 583 | q.text(","); q.breakable() |
| 584 | q.text("port_status_mask_slave = "); |
| 585 | q.text("%#x" % self.port_status_mask_slave) |
| 586 | q.text(","); q.breakable() |
| 587 | q.text("flow_removed_mask_equal_master = "); |
| 588 | q.text("%#x" % self.flow_removed_mask_equal_master) |
| 589 | q.text(","); q.breakable() |
| 590 | q.text("flow_removed_mask_slave = "); |
| 591 | q.text("%#x" % self.flow_removed_mask_slave) |
| 592 | q.breakable() |
| 593 | q.text('}') |
| 594 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 595 | message.subtypes[27] = async_get_reply |
| 596 | |
| 597 | class async_get_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 598 | version = 4 |
| 599 | type = 26 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 600 | |
| 601 | 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] | 602 | if xid != None: |
| 603 | self.xid = xid |
| 604 | else: |
| 605 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 606 | if packet_in_mask_equal_master != None: |
| 607 | self.packet_in_mask_equal_master = packet_in_mask_equal_master |
| 608 | else: |
| 609 | self.packet_in_mask_equal_master = 0 |
| 610 | if packet_in_mask_slave != None: |
| 611 | self.packet_in_mask_slave = packet_in_mask_slave |
| 612 | else: |
| 613 | self.packet_in_mask_slave = 0 |
| 614 | if port_status_mask_equal_master != None: |
| 615 | self.port_status_mask_equal_master = port_status_mask_equal_master |
| 616 | else: |
| 617 | self.port_status_mask_equal_master = 0 |
| 618 | if port_status_mask_slave != None: |
| 619 | self.port_status_mask_slave = port_status_mask_slave |
| 620 | else: |
| 621 | self.port_status_mask_slave = 0 |
| 622 | if flow_removed_mask_equal_master != None: |
| 623 | self.flow_removed_mask_equal_master = flow_removed_mask_equal_master |
| 624 | else: |
| 625 | self.flow_removed_mask_equal_master = 0 |
| 626 | if flow_removed_mask_slave != None: |
| 627 | self.flow_removed_mask_slave = flow_removed_mask_slave |
| 628 | else: |
| 629 | self.flow_removed_mask_slave = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 630 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 631 | |
| 632 | def pack(self): |
| 633 | packed = [] |
| 634 | packed.append(struct.pack("!B", self.version)) |
| 635 | packed.append(struct.pack("!B", self.type)) |
| 636 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 637 | packed.append(struct.pack("!L", self.xid)) |
| 638 | packed.append(struct.pack("!L", self.packet_in_mask_equal_master)) |
| 639 | packed.append(struct.pack("!L", self.packet_in_mask_slave)) |
| 640 | packed.append(struct.pack("!L", self.port_status_mask_equal_master)) |
| 641 | packed.append(struct.pack("!L", self.port_status_mask_slave)) |
| 642 | packed.append(struct.pack("!L", self.flow_removed_mask_equal_master)) |
| 643 | packed.append(struct.pack("!L", self.flow_removed_mask_slave)) |
| 644 | length = sum([len(x) for x in packed]) |
| 645 | packed[2] = struct.pack("!H", length) |
| 646 | return ''.join(packed) |
| 647 | |
| 648 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 649 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 650 | obj = async_get_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 651 | _version = reader.read("!B")[0] |
| 652 | assert(_version == 4) |
| 653 | _type = reader.read("!B")[0] |
| 654 | assert(_type == 26) |
| 655 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 656 | orig_reader = reader |
| 657 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 658 | obj.xid = reader.read("!L")[0] |
| 659 | obj.packet_in_mask_equal_master = reader.read("!L")[0] |
| 660 | obj.packet_in_mask_slave = reader.read("!L")[0] |
| 661 | obj.port_status_mask_equal_master = reader.read("!L")[0] |
| 662 | obj.port_status_mask_slave = reader.read("!L")[0] |
| 663 | obj.flow_removed_mask_equal_master = reader.read("!L")[0] |
| 664 | obj.flow_removed_mask_slave = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 665 | return obj |
| 666 | |
| 667 | def __eq__(self, other): |
| 668 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 669 | if self.xid != other.xid: return False |
| 670 | if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False |
| 671 | if self.packet_in_mask_slave != other.packet_in_mask_slave: return False |
| 672 | if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False |
| 673 | if self.port_status_mask_slave != other.port_status_mask_slave: return False |
| 674 | if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False |
| 675 | if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False |
| 676 | return True |
| 677 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 678 | def pretty_print(self, q): |
| 679 | q.text("async_get_request {") |
| 680 | with q.group(): |
| 681 | with q.indent(2): |
| 682 | q.breakable() |
| 683 | q.text("xid = "); |
| 684 | if self.xid != None: |
| 685 | q.text("%#x" % self.xid) |
| 686 | else: |
| 687 | q.text('None') |
| 688 | q.text(","); q.breakable() |
| 689 | q.text("packet_in_mask_equal_master = "); |
| 690 | q.text("%#x" % self.packet_in_mask_equal_master) |
| 691 | q.text(","); q.breakable() |
| 692 | q.text("packet_in_mask_slave = "); |
| 693 | q.text("%#x" % self.packet_in_mask_slave) |
| 694 | q.text(","); q.breakable() |
| 695 | q.text("port_status_mask_equal_master = "); |
| 696 | q.text("%#x" % self.port_status_mask_equal_master) |
| 697 | q.text(","); q.breakable() |
| 698 | q.text("port_status_mask_slave = "); |
| 699 | q.text("%#x" % self.port_status_mask_slave) |
| 700 | q.text(","); q.breakable() |
| 701 | q.text("flow_removed_mask_equal_master = "); |
| 702 | q.text("%#x" % self.flow_removed_mask_equal_master) |
| 703 | q.text(","); q.breakable() |
| 704 | q.text("flow_removed_mask_slave = "); |
| 705 | q.text("%#x" % self.flow_removed_mask_slave) |
| 706 | q.breakable() |
| 707 | q.text('}') |
| 708 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 709 | message.subtypes[26] = async_get_request |
| 710 | |
| 711 | class async_set(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 712 | version = 4 |
| 713 | type = 28 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 714 | |
| 715 | 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] | 716 | if xid != None: |
| 717 | self.xid = xid |
| 718 | else: |
| 719 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 720 | if packet_in_mask_equal_master != None: |
| 721 | self.packet_in_mask_equal_master = packet_in_mask_equal_master |
| 722 | else: |
| 723 | self.packet_in_mask_equal_master = 0 |
| 724 | if packet_in_mask_slave != None: |
| 725 | self.packet_in_mask_slave = packet_in_mask_slave |
| 726 | else: |
| 727 | self.packet_in_mask_slave = 0 |
| 728 | if port_status_mask_equal_master != None: |
| 729 | self.port_status_mask_equal_master = port_status_mask_equal_master |
| 730 | else: |
| 731 | self.port_status_mask_equal_master = 0 |
| 732 | if port_status_mask_slave != None: |
| 733 | self.port_status_mask_slave = port_status_mask_slave |
| 734 | else: |
| 735 | self.port_status_mask_slave = 0 |
| 736 | if flow_removed_mask_equal_master != None: |
| 737 | self.flow_removed_mask_equal_master = flow_removed_mask_equal_master |
| 738 | else: |
| 739 | self.flow_removed_mask_equal_master = 0 |
| 740 | if flow_removed_mask_slave != None: |
| 741 | self.flow_removed_mask_slave = flow_removed_mask_slave |
| 742 | else: |
| 743 | self.flow_removed_mask_slave = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 744 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 745 | |
| 746 | def pack(self): |
| 747 | packed = [] |
| 748 | packed.append(struct.pack("!B", self.version)) |
| 749 | packed.append(struct.pack("!B", self.type)) |
| 750 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 751 | packed.append(struct.pack("!L", self.xid)) |
| 752 | packed.append(struct.pack("!L", self.packet_in_mask_equal_master)) |
| 753 | packed.append(struct.pack("!L", self.packet_in_mask_slave)) |
| 754 | packed.append(struct.pack("!L", self.port_status_mask_equal_master)) |
| 755 | packed.append(struct.pack("!L", self.port_status_mask_slave)) |
| 756 | packed.append(struct.pack("!L", self.flow_removed_mask_equal_master)) |
| 757 | packed.append(struct.pack("!L", self.flow_removed_mask_slave)) |
| 758 | length = sum([len(x) for x in packed]) |
| 759 | packed[2] = struct.pack("!H", length) |
| 760 | return ''.join(packed) |
| 761 | |
| 762 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 763 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 764 | obj = async_set() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 765 | _version = reader.read("!B")[0] |
| 766 | assert(_version == 4) |
| 767 | _type = reader.read("!B")[0] |
| 768 | assert(_type == 28) |
| 769 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 770 | orig_reader = reader |
| 771 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 772 | obj.xid = reader.read("!L")[0] |
| 773 | obj.packet_in_mask_equal_master = reader.read("!L")[0] |
| 774 | obj.packet_in_mask_slave = reader.read("!L")[0] |
| 775 | obj.port_status_mask_equal_master = reader.read("!L")[0] |
| 776 | obj.port_status_mask_slave = reader.read("!L")[0] |
| 777 | obj.flow_removed_mask_equal_master = reader.read("!L")[0] |
| 778 | obj.flow_removed_mask_slave = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 779 | return obj |
| 780 | |
| 781 | def __eq__(self, other): |
| 782 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 783 | if self.xid != other.xid: return False |
| 784 | if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False |
| 785 | if self.packet_in_mask_slave != other.packet_in_mask_slave: return False |
| 786 | if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False |
| 787 | if self.port_status_mask_slave != other.port_status_mask_slave: return False |
| 788 | if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False |
| 789 | if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False |
| 790 | return True |
| 791 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 792 | def pretty_print(self, q): |
| 793 | q.text("async_set {") |
| 794 | with q.group(): |
| 795 | with q.indent(2): |
| 796 | q.breakable() |
| 797 | q.text("xid = "); |
| 798 | if self.xid != None: |
| 799 | q.text("%#x" % self.xid) |
| 800 | else: |
| 801 | q.text('None') |
| 802 | q.text(","); q.breakable() |
| 803 | q.text("packet_in_mask_equal_master = "); |
| 804 | q.text("%#x" % self.packet_in_mask_equal_master) |
| 805 | q.text(","); q.breakable() |
| 806 | q.text("packet_in_mask_slave = "); |
| 807 | q.text("%#x" % self.packet_in_mask_slave) |
| 808 | q.text(","); q.breakable() |
| 809 | q.text("port_status_mask_equal_master = "); |
| 810 | q.text("%#x" % self.port_status_mask_equal_master) |
| 811 | q.text(","); q.breakable() |
| 812 | q.text("port_status_mask_slave = "); |
| 813 | q.text("%#x" % self.port_status_mask_slave) |
| 814 | q.text(","); q.breakable() |
| 815 | q.text("flow_removed_mask_equal_master = "); |
| 816 | q.text("%#x" % self.flow_removed_mask_equal_master) |
| 817 | q.text(","); q.breakable() |
| 818 | q.text("flow_removed_mask_slave = "); |
| 819 | q.text("%#x" % self.flow_removed_mask_slave) |
| 820 | q.breakable() |
| 821 | q.text('}') |
| 822 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 823 | message.subtypes[28] = async_set |
| 824 | |
| 825 | class error_msg(message): |
| 826 | subtypes = {} |
| 827 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 828 | version = 4 |
| 829 | type = 1 |
| 830 | |
| 831 | def __init__(self, xid=None, err_type=None): |
| 832 | if xid != None: |
| 833 | self.xid = xid |
| 834 | else: |
| 835 | self.xid = None |
| 836 | if err_type != None: |
| 837 | self.err_type = err_type |
| 838 | else: |
| 839 | self.err_type = 0 |
| 840 | return |
| 841 | |
| 842 | def pack(self): |
| 843 | packed = [] |
| 844 | packed.append(struct.pack("!B", self.version)) |
| 845 | packed.append(struct.pack("!B", self.type)) |
| 846 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 847 | packed.append(struct.pack("!L", self.xid)) |
| 848 | packed.append(struct.pack("!H", self.err_type)) |
| 849 | length = sum([len(x) for x in packed]) |
| 850 | packed[2] = struct.pack("!H", length) |
| 851 | return ''.join(packed) |
| 852 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 853 | @staticmethod |
| 854 | def unpack(reader): |
| 855 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 856 | subclass = error_msg.subtypes.get(subtype) |
| 857 | if subclass: |
| 858 | return subclass.unpack(reader) |
| 859 | |
| 860 | obj = error_msg() |
| 861 | _version = reader.read("!B")[0] |
| 862 | assert(_version == 4) |
| 863 | _type = reader.read("!B")[0] |
| 864 | assert(_type == 1) |
| 865 | _length = reader.read("!H")[0] |
| 866 | orig_reader = reader |
| 867 | reader = orig_reader.slice(_length - (2 + 2)) |
| 868 | obj.xid = reader.read("!L")[0] |
| 869 | obj.err_type = reader.read("!H")[0] |
| 870 | return obj |
| 871 | |
| 872 | def __eq__(self, other): |
| 873 | if type(self) != type(other): return False |
| 874 | if self.xid != other.xid: return False |
| 875 | if self.err_type != other.err_type: return False |
| 876 | return True |
| 877 | |
| 878 | def pretty_print(self, q): |
| 879 | q.text("error_msg {") |
| 880 | with q.group(): |
| 881 | with q.indent(2): |
| 882 | q.breakable() |
| 883 | q.text("xid = "); |
| 884 | if self.xid != None: |
| 885 | q.text("%#x" % self.xid) |
| 886 | else: |
| 887 | q.text('None') |
| 888 | q.breakable() |
| 889 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 890 | |
| 891 | message.subtypes[1] = error_msg |
| 892 | |
| 893 | class bad_action_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 894 | version = 4 |
| 895 | type = 1 |
| 896 | err_type = 2 |
| 897 | |
| 898 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 899 | if xid != None: |
| 900 | self.xid = xid |
| 901 | else: |
| 902 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 903 | if code != None: |
| 904 | self.code = code |
| 905 | else: |
| 906 | self.code = 0 |
| 907 | if data != None: |
| 908 | self.data = data |
| 909 | else: |
| 910 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 911 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 912 | |
| 913 | def pack(self): |
| 914 | packed = [] |
| 915 | packed.append(struct.pack("!B", self.version)) |
| 916 | packed.append(struct.pack("!B", self.type)) |
| 917 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 918 | packed.append(struct.pack("!L", self.xid)) |
| 919 | packed.append(struct.pack("!H", self.err_type)) |
| 920 | packed.append(struct.pack("!H", self.code)) |
| 921 | packed.append(self.data) |
| 922 | length = sum([len(x) for x in packed]) |
| 923 | packed[2] = struct.pack("!H", length) |
| 924 | return ''.join(packed) |
| 925 | |
| 926 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 927 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 928 | obj = bad_action_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 929 | _version = reader.read("!B")[0] |
| 930 | assert(_version == 4) |
| 931 | _type = reader.read("!B")[0] |
| 932 | assert(_type == 1) |
| 933 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 934 | orig_reader = reader |
| 935 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 936 | obj.xid = reader.read("!L")[0] |
| 937 | _err_type = reader.read("!H")[0] |
| 938 | assert(_err_type == 2) |
| 939 | obj.code = reader.read("!H")[0] |
| 940 | obj.data = str(reader.read_all()) |
| 941 | return obj |
| 942 | |
| 943 | def __eq__(self, other): |
| 944 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 945 | if self.xid != other.xid: return False |
| 946 | if self.code != other.code: return False |
| 947 | if self.data != other.data: return False |
| 948 | return True |
| 949 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 950 | def pretty_print(self, q): |
| 951 | q.text("bad_action_error_msg {") |
| 952 | with q.group(): |
| 953 | with q.indent(2): |
| 954 | q.breakable() |
| 955 | q.text("xid = "); |
| 956 | if self.xid != None: |
| 957 | q.text("%#x" % self.xid) |
| 958 | else: |
| 959 | q.text('None') |
| 960 | q.text(","); q.breakable() |
| 961 | q.text("code = "); |
| 962 | q.text("%#x" % self.code) |
| 963 | q.text(","); q.breakable() |
| 964 | q.text("data = "); |
| 965 | q.pp(self.data) |
| 966 | q.breakable() |
| 967 | q.text('}') |
| 968 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 969 | error_msg.subtypes[2] = bad_action_error_msg |
| 970 | |
| 971 | class bad_instruction_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 972 | version = 4 |
| 973 | type = 1 |
| 974 | err_type = 3 |
| 975 | |
| 976 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 977 | if xid != None: |
| 978 | self.xid = xid |
| 979 | else: |
| 980 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 981 | if code != None: |
| 982 | self.code = code |
| 983 | else: |
| 984 | self.code = 0 |
| 985 | if data != None: |
| 986 | self.data = data |
| 987 | else: |
| 988 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 989 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 990 | |
| 991 | def pack(self): |
| 992 | packed = [] |
| 993 | packed.append(struct.pack("!B", self.version)) |
| 994 | packed.append(struct.pack("!B", self.type)) |
| 995 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 996 | packed.append(struct.pack("!L", self.xid)) |
| 997 | packed.append(struct.pack("!H", self.err_type)) |
| 998 | packed.append(struct.pack("!H", self.code)) |
| 999 | packed.append(self.data) |
| 1000 | length = sum([len(x) for x in packed]) |
| 1001 | packed[2] = struct.pack("!H", length) |
| 1002 | return ''.join(packed) |
| 1003 | |
| 1004 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1005 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1006 | obj = bad_instruction_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1007 | _version = reader.read("!B")[0] |
| 1008 | assert(_version == 4) |
| 1009 | _type = reader.read("!B")[0] |
| 1010 | assert(_type == 1) |
| 1011 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1012 | orig_reader = reader |
| 1013 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1014 | obj.xid = reader.read("!L")[0] |
| 1015 | _err_type = reader.read("!H")[0] |
| 1016 | assert(_err_type == 3) |
| 1017 | obj.code = reader.read("!H")[0] |
| 1018 | obj.data = str(reader.read_all()) |
| 1019 | return obj |
| 1020 | |
| 1021 | def __eq__(self, other): |
| 1022 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1023 | if self.xid != other.xid: return False |
| 1024 | if self.code != other.code: return False |
| 1025 | if self.data != other.data: return False |
| 1026 | return True |
| 1027 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1028 | def pretty_print(self, q): |
| 1029 | q.text("bad_instruction_error_msg {") |
| 1030 | with q.group(): |
| 1031 | with q.indent(2): |
| 1032 | q.breakable() |
| 1033 | q.text("xid = "); |
| 1034 | if self.xid != None: |
| 1035 | q.text("%#x" % self.xid) |
| 1036 | else: |
| 1037 | q.text('None') |
| 1038 | q.text(","); q.breakable() |
| 1039 | q.text("code = "); |
| 1040 | q.text("%#x" % self.code) |
| 1041 | q.text(","); q.breakable() |
| 1042 | q.text("data = "); |
| 1043 | q.pp(self.data) |
| 1044 | q.breakable() |
| 1045 | q.text('}') |
| 1046 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1047 | error_msg.subtypes[3] = bad_instruction_error_msg |
| 1048 | |
| 1049 | class bad_match_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1050 | version = 4 |
| 1051 | type = 1 |
| 1052 | err_type = 4 |
| 1053 | |
| 1054 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1055 | if xid != None: |
| 1056 | self.xid = xid |
| 1057 | else: |
| 1058 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1059 | if code != None: |
| 1060 | self.code = code |
| 1061 | else: |
| 1062 | self.code = 0 |
| 1063 | if data != None: |
| 1064 | self.data = data |
| 1065 | else: |
| 1066 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1067 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1068 | |
| 1069 | def pack(self): |
| 1070 | packed = [] |
| 1071 | packed.append(struct.pack("!B", self.version)) |
| 1072 | packed.append(struct.pack("!B", self.type)) |
| 1073 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1074 | packed.append(struct.pack("!L", self.xid)) |
| 1075 | packed.append(struct.pack("!H", self.err_type)) |
| 1076 | packed.append(struct.pack("!H", self.code)) |
| 1077 | packed.append(self.data) |
| 1078 | length = sum([len(x) for x in packed]) |
| 1079 | packed[2] = struct.pack("!H", length) |
| 1080 | return ''.join(packed) |
| 1081 | |
| 1082 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1083 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1084 | obj = bad_match_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1085 | _version = reader.read("!B")[0] |
| 1086 | assert(_version == 4) |
| 1087 | _type = reader.read("!B")[0] |
| 1088 | assert(_type == 1) |
| 1089 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1090 | orig_reader = reader |
| 1091 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1092 | obj.xid = reader.read("!L")[0] |
| 1093 | _err_type = reader.read("!H")[0] |
| 1094 | assert(_err_type == 4) |
| 1095 | obj.code = reader.read("!H")[0] |
| 1096 | obj.data = str(reader.read_all()) |
| 1097 | return obj |
| 1098 | |
| 1099 | def __eq__(self, other): |
| 1100 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1101 | if self.xid != other.xid: return False |
| 1102 | if self.code != other.code: return False |
| 1103 | if self.data != other.data: return False |
| 1104 | return True |
| 1105 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1106 | def pretty_print(self, q): |
| 1107 | q.text("bad_match_error_msg {") |
| 1108 | with q.group(): |
| 1109 | with q.indent(2): |
| 1110 | q.breakable() |
| 1111 | q.text("xid = "); |
| 1112 | if self.xid != None: |
| 1113 | q.text("%#x" % self.xid) |
| 1114 | else: |
| 1115 | q.text('None') |
| 1116 | q.text(","); q.breakable() |
| 1117 | q.text("code = "); |
| 1118 | q.text("%#x" % self.code) |
| 1119 | q.text(","); q.breakable() |
| 1120 | q.text("data = "); |
| 1121 | q.pp(self.data) |
| 1122 | q.breakable() |
| 1123 | q.text('}') |
| 1124 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1125 | error_msg.subtypes[4] = bad_match_error_msg |
| 1126 | |
| 1127 | class bad_request_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1128 | version = 4 |
| 1129 | type = 1 |
| 1130 | err_type = 1 |
| 1131 | |
| 1132 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1133 | if xid != None: |
| 1134 | self.xid = xid |
| 1135 | else: |
| 1136 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1137 | if code != None: |
| 1138 | self.code = code |
| 1139 | else: |
| 1140 | self.code = 0 |
| 1141 | if data != None: |
| 1142 | self.data = data |
| 1143 | else: |
| 1144 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1145 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1146 | |
| 1147 | def pack(self): |
| 1148 | packed = [] |
| 1149 | packed.append(struct.pack("!B", self.version)) |
| 1150 | packed.append(struct.pack("!B", self.type)) |
| 1151 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1152 | packed.append(struct.pack("!L", self.xid)) |
| 1153 | packed.append(struct.pack("!H", self.err_type)) |
| 1154 | packed.append(struct.pack("!H", self.code)) |
| 1155 | packed.append(self.data) |
| 1156 | length = sum([len(x) for x in packed]) |
| 1157 | packed[2] = struct.pack("!H", length) |
| 1158 | return ''.join(packed) |
| 1159 | |
| 1160 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1161 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1162 | obj = bad_request_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1163 | _version = reader.read("!B")[0] |
| 1164 | assert(_version == 4) |
| 1165 | _type = reader.read("!B")[0] |
| 1166 | assert(_type == 1) |
| 1167 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1168 | orig_reader = reader |
| 1169 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1170 | obj.xid = reader.read("!L")[0] |
| 1171 | _err_type = reader.read("!H")[0] |
| 1172 | assert(_err_type == 1) |
| 1173 | obj.code = reader.read("!H")[0] |
| 1174 | obj.data = str(reader.read_all()) |
| 1175 | return obj |
| 1176 | |
| 1177 | def __eq__(self, other): |
| 1178 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1179 | if self.xid != other.xid: return False |
| 1180 | if self.code != other.code: return False |
| 1181 | if self.data != other.data: return False |
| 1182 | return True |
| 1183 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1184 | def pretty_print(self, q): |
| 1185 | q.text("bad_request_error_msg {") |
| 1186 | with q.group(): |
| 1187 | with q.indent(2): |
| 1188 | q.breakable() |
| 1189 | q.text("xid = "); |
| 1190 | if self.xid != None: |
| 1191 | q.text("%#x" % self.xid) |
| 1192 | else: |
| 1193 | q.text('None') |
| 1194 | q.text(","); q.breakable() |
| 1195 | q.text("code = "); |
| 1196 | q.text("%#x" % self.code) |
| 1197 | q.text(","); q.breakable() |
| 1198 | q.text("data = "); |
| 1199 | q.pp(self.data) |
| 1200 | q.breakable() |
| 1201 | q.text('}') |
| 1202 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1203 | error_msg.subtypes[1] = bad_request_error_msg |
| 1204 | |
| 1205 | class barrier_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1206 | version = 4 |
| 1207 | type = 21 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1208 | |
| 1209 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1210 | if xid != None: |
| 1211 | self.xid = xid |
| 1212 | else: |
| 1213 | self.xid = None |
| 1214 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1215 | |
| 1216 | def pack(self): |
| 1217 | packed = [] |
| 1218 | packed.append(struct.pack("!B", self.version)) |
| 1219 | packed.append(struct.pack("!B", self.type)) |
| 1220 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1221 | packed.append(struct.pack("!L", self.xid)) |
| 1222 | length = sum([len(x) for x in packed]) |
| 1223 | packed[2] = struct.pack("!H", length) |
| 1224 | return ''.join(packed) |
| 1225 | |
| 1226 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1227 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1228 | obj = barrier_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1229 | _version = reader.read("!B")[0] |
| 1230 | assert(_version == 4) |
| 1231 | _type = reader.read("!B")[0] |
| 1232 | assert(_type == 21) |
| 1233 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1234 | orig_reader = reader |
| 1235 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1236 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1237 | return obj |
| 1238 | |
| 1239 | def __eq__(self, other): |
| 1240 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1241 | if self.xid != other.xid: return False |
| 1242 | return True |
| 1243 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1244 | def pretty_print(self, q): |
| 1245 | q.text("barrier_reply {") |
| 1246 | with q.group(): |
| 1247 | with q.indent(2): |
| 1248 | q.breakable() |
| 1249 | q.text("xid = "); |
| 1250 | if self.xid != None: |
| 1251 | q.text("%#x" % self.xid) |
| 1252 | else: |
| 1253 | q.text('None') |
| 1254 | q.breakable() |
| 1255 | q.text('}') |
| 1256 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1257 | message.subtypes[21] = barrier_reply |
| 1258 | |
| 1259 | class barrier_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1260 | version = 4 |
| 1261 | type = 20 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1262 | |
| 1263 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1264 | if xid != None: |
| 1265 | self.xid = xid |
| 1266 | else: |
| 1267 | self.xid = None |
| 1268 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1269 | |
| 1270 | def pack(self): |
| 1271 | packed = [] |
| 1272 | packed.append(struct.pack("!B", self.version)) |
| 1273 | packed.append(struct.pack("!B", self.type)) |
| 1274 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1275 | packed.append(struct.pack("!L", self.xid)) |
| 1276 | length = sum([len(x) for x in packed]) |
| 1277 | packed[2] = struct.pack("!H", length) |
| 1278 | return ''.join(packed) |
| 1279 | |
| 1280 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1281 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1282 | obj = barrier_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1283 | _version = reader.read("!B")[0] |
| 1284 | assert(_version == 4) |
| 1285 | _type = reader.read("!B")[0] |
| 1286 | assert(_type == 20) |
| 1287 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1288 | orig_reader = reader |
| 1289 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1290 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1291 | return obj |
| 1292 | |
| 1293 | def __eq__(self, other): |
| 1294 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1295 | if self.xid != other.xid: return False |
| 1296 | return True |
| 1297 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1298 | def pretty_print(self, q): |
| 1299 | q.text("barrier_request {") |
| 1300 | with q.group(): |
| 1301 | with q.indent(2): |
| 1302 | q.breakable() |
| 1303 | q.text("xid = "); |
| 1304 | if self.xid != None: |
| 1305 | q.text("%#x" % self.xid) |
| 1306 | else: |
| 1307 | q.text('None') |
| 1308 | q.breakable() |
| 1309 | q.text('}') |
| 1310 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1311 | message.subtypes[20] = barrier_request |
| 1312 | |
| 1313 | class experimenter(message): |
| 1314 | subtypes = {} |
| 1315 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1316 | version = 4 |
| 1317 | type = 4 |
| 1318 | |
| 1319 | def __init__(self, xid=None, experimenter=None, subtype=None, data=None): |
| 1320 | if xid != None: |
| 1321 | self.xid = xid |
| 1322 | else: |
| 1323 | self.xid = None |
| 1324 | if experimenter != None: |
| 1325 | self.experimenter = experimenter |
| 1326 | else: |
| 1327 | self.experimenter = 0 |
| 1328 | if subtype != None: |
| 1329 | self.subtype = subtype |
| 1330 | else: |
| 1331 | self.subtype = 0 |
| 1332 | if data != None: |
| 1333 | self.data = data |
| 1334 | else: |
| 1335 | self.data = '' |
| 1336 | return |
| 1337 | |
| 1338 | def pack(self): |
| 1339 | packed = [] |
| 1340 | packed.append(struct.pack("!B", self.version)) |
| 1341 | packed.append(struct.pack("!B", self.type)) |
| 1342 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1343 | packed.append(struct.pack("!L", self.xid)) |
| 1344 | packed.append(struct.pack("!L", self.experimenter)) |
| 1345 | packed.append(struct.pack("!L", self.subtype)) |
| 1346 | packed.append(self.data) |
| 1347 | length = sum([len(x) for x in packed]) |
| 1348 | packed[2] = struct.pack("!H", length) |
| 1349 | return ''.join(packed) |
| 1350 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1351 | @staticmethod |
| 1352 | def unpack(reader): |
| 1353 | subtype, = reader.peek('!L', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1354 | subclass = experimenter.subtypes.get(subtype) |
| 1355 | if subclass: |
| 1356 | return subclass.unpack(reader) |
| 1357 | |
| 1358 | obj = experimenter() |
| 1359 | _version = reader.read("!B")[0] |
| 1360 | assert(_version == 4) |
| 1361 | _type = reader.read("!B")[0] |
| 1362 | assert(_type == 4) |
| 1363 | _length = reader.read("!H")[0] |
| 1364 | orig_reader = reader |
| 1365 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1366 | obj.xid = reader.read("!L")[0] |
| 1367 | obj.experimenter = reader.read("!L")[0] |
| 1368 | obj.subtype = reader.read("!L")[0] |
| 1369 | obj.data = str(reader.read_all()) |
| 1370 | return obj |
| 1371 | |
| 1372 | def __eq__(self, other): |
| 1373 | if type(self) != type(other): return False |
| 1374 | if self.xid != other.xid: return False |
| 1375 | if self.experimenter != other.experimenter: return False |
| 1376 | if self.subtype != other.subtype: return False |
| 1377 | if self.data != other.data: return False |
| 1378 | return True |
| 1379 | |
| 1380 | def pretty_print(self, q): |
| 1381 | q.text("experimenter {") |
| 1382 | with q.group(): |
| 1383 | with q.indent(2): |
| 1384 | q.breakable() |
| 1385 | q.text("xid = "); |
| 1386 | if self.xid != None: |
| 1387 | q.text("%#x" % self.xid) |
| 1388 | else: |
| 1389 | q.text('None') |
| 1390 | q.text(","); q.breakable() |
| 1391 | q.text("subtype = "); |
| 1392 | q.text("%#x" % self.subtype) |
| 1393 | q.text(","); q.breakable() |
| 1394 | q.text("data = "); |
| 1395 | q.pp(self.data) |
| 1396 | q.breakable() |
| 1397 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1398 | |
| 1399 | message.subtypes[4] = experimenter |
| 1400 | |
| 1401 | class bsn_header(experimenter): |
| 1402 | subtypes = {} |
| 1403 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1404 | version = 4 |
| 1405 | type = 4 |
| 1406 | experimenter = 6035143 |
| 1407 | |
| 1408 | def __init__(self, xid=None, subtype=None): |
| 1409 | if xid != None: |
| 1410 | self.xid = xid |
| 1411 | else: |
| 1412 | self.xid = None |
| 1413 | if subtype != None: |
| 1414 | self.subtype = subtype |
| 1415 | else: |
| 1416 | self.subtype = 0 |
| 1417 | return |
| 1418 | |
| 1419 | def pack(self): |
| 1420 | packed = [] |
| 1421 | packed.append(struct.pack("!B", self.version)) |
| 1422 | packed.append(struct.pack("!B", self.type)) |
| 1423 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1424 | packed.append(struct.pack("!L", self.xid)) |
| 1425 | packed.append(struct.pack("!L", self.experimenter)) |
| 1426 | packed.append(struct.pack("!L", self.subtype)) |
| 1427 | length = sum([len(x) for x in packed]) |
| 1428 | packed[2] = struct.pack("!H", length) |
| 1429 | return ''.join(packed) |
| 1430 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1431 | @staticmethod |
| 1432 | def unpack(reader): |
| 1433 | subtype, = reader.peek('!L', 12) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1434 | subclass = bsn_header.subtypes.get(subtype) |
| 1435 | if subclass: |
| 1436 | return subclass.unpack(reader) |
| 1437 | |
| 1438 | obj = bsn_header() |
| 1439 | _version = reader.read("!B")[0] |
| 1440 | assert(_version == 4) |
| 1441 | _type = reader.read("!B")[0] |
| 1442 | assert(_type == 4) |
| 1443 | _length = reader.read("!H")[0] |
| 1444 | orig_reader = reader |
| 1445 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1446 | obj.xid = reader.read("!L")[0] |
| 1447 | _experimenter = reader.read("!L")[0] |
| 1448 | assert(_experimenter == 6035143) |
| 1449 | obj.subtype = reader.read("!L")[0] |
| 1450 | return obj |
| 1451 | |
| 1452 | def __eq__(self, other): |
| 1453 | if type(self) != type(other): return False |
| 1454 | if self.xid != other.xid: return False |
| 1455 | if self.subtype != other.subtype: return False |
| 1456 | return True |
| 1457 | |
| 1458 | def pretty_print(self, q): |
| 1459 | q.text("bsn_header {") |
| 1460 | with q.group(): |
| 1461 | with q.indent(2): |
| 1462 | q.breakable() |
| 1463 | q.text("xid = "); |
| 1464 | if self.xid != None: |
| 1465 | q.text("%#x" % self.xid) |
| 1466 | else: |
| 1467 | q.text('None') |
| 1468 | q.breakable() |
| 1469 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1470 | |
| 1471 | experimenter.subtypes[6035143] = bsn_header |
| 1472 | |
Rich Lane | a61048f | 2014-01-30 16:14:00 -0800 | [diff] [blame] | 1473 | class bsn_arp_idle(bsn_header): |
| 1474 | version = 4 |
| 1475 | type = 4 |
| 1476 | experimenter = 6035143 |
| 1477 | subtype = 60 |
| 1478 | |
| 1479 | def __init__(self, xid=None, vlan_vid=None, ipv4_addr=None): |
| 1480 | if xid != None: |
| 1481 | self.xid = xid |
| 1482 | else: |
| 1483 | self.xid = None |
| 1484 | if vlan_vid != None: |
| 1485 | self.vlan_vid = vlan_vid |
| 1486 | else: |
| 1487 | self.vlan_vid = 0 |
| 1488 | if ipv4_addr != None: |
| 1489 | self.ipv4_addr = ipv4_addr |
| 1490 | else: |
| 1491 | self.ipv4_addr = 0 |
| 1492 | return |
| 1493 | |
| 1494 | def pack(self): |
| 1495 | packed = [] |
| 1496 | packed.append(struct.pack("!B", self.version)) |
| 1497 | packed.append(struct.pack("!B", self.type)) |
| 1498 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1499 | packed.append(struct.pack("!L", self.xid)) |
| 1500 | packed.append(struct.pack("!L", self.experimenter)) |
| 1501 | packed.append(struct.pack("!L", self.subtype)) |
| 1502 | packed.append(struct.pack("!H", self.vlan_vid)) |
| 1503 | packed.append('\x00' * 2) |
| 1504 | packed.append(struct.pack("!L", self.ipv4_addr)) |
| 1505 | length = sum([len(x) for x in packed]) |
| 1506 | packed[2] = struct.pack("!H", length) |
| 1507 | return ''.join(packed) |
| 1508 | |
| 1509 | @staticmethod |
| 1510 | def unpack(reader): |
| 1511 | obj = bsn_arp_idle() |
| 1512 | _version = reader.read("!B")[0] |
| 1513 | assert(_version == 4) |
| 1514 | _type = reader.read("!B")[0] |
| 1515 | assert(_type == 4) |
| 1516 | _length = reader.read("!H")[0] |
| 1517 | orig_reader = reader |
| 1518 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1519 | obj.xid = reader.read("!L")[0] |
| 1520 | _experimenter = reader.read("!L")[0] |
| 1521 | assert(_experimenter == 6035143) |
| 1522 | _subtype = reader.read("!L")[0] |
| 1523 | assert(_subtype == 60) |
| 1524 | obj.vlan_vid = reader.read("!H")[0] |
| 1525 | reader.skip(2) |
| 1526 | obj.ipv4_addr = reader.read("!L")[0] |
| 1527 | return obj |
| 1528 | |
| 1529 | def __eq__(self, other): |
| 1530 | if type(self) != type(other): return False |
| 1531 | if self.xid != other.xid: return False |
| 1532 | if self.vlan_vid != other.vlan_vid: return False |
| 1533 | if self.ipv4_addr != other.ipv4_addr: return False |
| 1534 | return True |
| 1535 | |
| 1536 | def pretty_print(self, q): |
| 1537 | q.text("bsn_arp_idle {") |
| 1538 | with q.group(): |
| 1539 | with q.indent(2): |
| 1540 | q.breakable() |
| 1541 | q.text("xid = "); |
| 1542 | if self.xid != None: |
| 1543 | q.text("%#x" % self.xid) |
| 1544 | else: |
| 1545 | q.text('None') |
| 1546 | q.text(","); q.breakable() |
| 1547 | q.text("vlan_vid = "); |
| 1548 | q.text("%#x" % self.vlan_vid) |
| 1549 | q.text(","); q.breakable() |
| 1550 | q.text("ipv4_addr = "); |
| 1551 | q.text(util.pretty_ipv4(self.ipv4_addr)) |
| 1552 | q.breakable() |
| 1553 | q.text('}') |
| 1554 | |
| 1555 | bsn_header.subtypes[60] = bsn_arp_idle |
| 1556 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1557 | class bsn_bw_clear_data_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1558 | version = 4 |
| 1559 | type = 4 |
| 1560 | experimenter = 6035143 |
| 1561 | subtype = 22 |
| 1562 | |
| 1563 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1564 | if xid != None: |
| 1565 | self.xid = xid |
| 1566 | else: |
| 1567 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1568 | if status != None: |
| 1569 | self.status = status |
| 1570 | else: |
| 1571 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1572 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1573 | |
| 1574 | def pack(self): |
| 1575 | packed = [] |
| 1576 | packed.append(struct.pack("!B", self.version)) |
| 1577 | packed.append(struct.pack("!B", self.type)) |
| 1578 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1579 | packed.append(struct.pack("!L", self.xid)) |
| 1580 | packed.append(struct.pack("!L", self.experimenter)) |
| 1581 | packed.append(struct.pack("!L", self.subtype)) |
| 1582 | packed.append(struct.pack("!L", self.status)) |
| 1583 | length = sum([len(x) for x in packed]) |
| 1584 | packed[2] = struct.pack("!H", length) |
| 1585 | return ''.join(packed) |
| 1586 | |
| 1587 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1588 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1589 | obj = bsn_bw_clear_data_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1590 | _version = reader.read("!B")[0] |
| 1591 | assert(_version == 4) |
| 1592 | _type = reader.read("!B")[0] |
| 1593 | assert(_type == 4) |
| 1594 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1595 | orig_reader = reader |
| 1596 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1597 | obj.xid = reader.read("!L")[0] |
| 1598 | _experimenter = reader.read("!L")[0] |
| 1599 | assert(_experimenter == 6035143) |
| 1600 | _subtype = reader.read("!L")[0] |
| 1601 | assert(_subtype == 22) |
| 1602 | obj.status = reader.read("!L")[0] |
| 1603 | return obj |
| 1604 | |
| 1605 | def __eq__(self, other): |
| 1606 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1607 | if self.xid != other.xid: return False |
| 1608 | if self.status != other.status: return False |
| 1609 | return True |
| 1610 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1611 | def pretty_print(self, q): |
| 1612 | q.text("bsn_bw_clear_data_reply {") |
| 1613 | with q.group(): |
| 1614 | with q.indent(2): |
| 1615 | q.breakable() |
| 1616 | q.text("xid = "); |
| 1617 | if self.xid != None: |
| 1618 | q.text("%#x" % self.xid) |
| 1619 | else: |
| 1620 | q.text('None') |
| 1621 | q.text(","); q.breakable() |
| 1622 | q.text("status = "); |
| 1623 | q.text("%#x" % self.status) |
| 1624 | q.breakable() |
| 1625 | q.text('}') |
| 1626 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1627 | bsn_header.subtypes[22] = bsn_bw_clear_data_reply |
| 1628 | |
| 1629 | class bsn_bw_clear_data_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1630 | version = 4 |
| 1631 | type = 4 |
| 1632 | experimenter = 6035143 |
| 1633 | subtype = 21 |
| 1634 | |
| 1635 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1636 | if xid != None: |
| 1637 | self.xid = xid |
| 1638 | else: |
| 1639 | self.xid = None |
| 1640 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1641 | |
| 1642 | def pack(self): |
| 1643 | packed = [] |
| 1644 | packed.append(struct.pack("!B", self.version)) |
| 1645 | packed.append(struct.pack("!B", self.type)) |
| 1646 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1647 | packed.append(struct.pack("!L", self.xid)) |
| 1648 | packed.append(struct.pack("!L", self.experimenter)) |
| 1649 | packed.append(struct.pack("!L", self.subtype)) |
| 1650 | length = sum([len(x) for x in packed]) |
| 1651 | packed[2] = struct.pack("!H", length) |
| 1652 | return ''.join(packed) |
| 1653 | |
| 1654 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1655 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1656 | obj = bsn_bw_clear_data_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1657 | _version = reader.read("!B")[0] |
| 1658 | assert(_version == 4) |
| 1659 | _type = reader.read("!B")[0] |
| 1660 | assert(_type == 4) |
| 1661 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1662 | orig_reader = reader |
| 1663 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1664 | obj.xid = reader.read("!L")[0] |
| 1665 | _experimenter = reader.read("!L")[0] |
| 1666 | assert(_experimenter == 6035143) |
| 1667 | _subtype = reader.read("!L")[0] |
| 1668 | assert(_subtype == 21) |
| 1669 | return obj |
| 1670 | |
| 1671 | def __eq__(self, other): |
| 1672 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1673 | if self.xid != other.xid: return False |
| 1674 | return True |
| 1675 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1676 | def pretty_print(self, q): |
| 1677 | q.text("bsn_bw_clear_data_request {") |
| 1678 | with q.group(): |
| 1679 | with q.indent(2): |
| 1680 | q.breakable() |
| 1681 | q.text("xid = "); |
| 1682 | if self.xid != None: |
| 1683 | q.text("%#x" % self.xid) |
| 1684 | else: |
| 1685 | q.text('None') |
| 1686 | q.breakable() |
| 1687 | q.text('}') |
| 1688 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1689 | bsn_header.subtypes[21] = bsn_bw_clear_data_request |
| 1690 | |
| 1691 | class bsn_bw_enable_get_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1692 | version = 4 |
| 1693 | type = 4 |
| 1694 | experimenter = 6035143 |
| 1695 | subtype = 20 |
| 1696 | |
| 1697 | def __init__(self, xid=None, enabled=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1698 | if xid != None: |
| 1699 | self.xid = xid |
| 1700 | else: |
| 1701 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1702 | if enabled != None: |
| 1703 | self.enabled = enabled |
| 1704 | else: |
| 1705 | self.enabled = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1706 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1707 | |
| 1708 | def pack(self): |
| 1709 | packed = [] |
| 1710 | packed.append(struct.pack("!B", self.version)) |
| 1711 | packed.append(struct.pack("!B", self.type)) |
| 1712 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1713 | packed.append(struct.pack("!L", self.xid)) |
| 1714 | packed.append(struct.pack("!L", self.experimenter)) |
| 1715 | packed.append(struct.pack("!L", self.subtype)) |
| 1716 | packed.append(struct.pack("!L", self.enabled)) |
| 1717 | length = sum([len(x) for x in packed]) |
| 1718 | packed[2] = struct.pack("!H", length) |
| 1719 | return ''.join(packed) |
| 1720 | |
| 1721 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1722 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1723 | obj = bsn_bw_enable_get_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1724 | _version = reader.read("!B")[0] |
| 1725 | assert(_version == 4) |
| 1726 | _type = reader.read("!B")[0] |
| 1727 | assert(_type == 4) |
| 1728 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1729 | orig_reader = reader |
| 1730 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1731 | obj.xid = reader.read("!L")[0] |
| 1732 | _experimenter = reader.read("!L")[0] |
| 1733 | assert(_experimenter == 6035143) |
| 1734 | _subtype = reader.read("!L")[0] |
| 1735 | assert(_subtype == 20) |
| 1736 | obj.enabled = reader.read("!L")[0] |
| 1737 | return obj |
| 1738 | |
| 1739 | def __eq__(self, other): |
| 1740 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1741 | if self.xid != other.xid: return False |
| 1742 | if self.enabled != other.enabled: return False |
| 1743 | return True |
| 1744 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1745 | def pretty_print(self, q): |
| 1746 | q.text("bsn_bw_enable_get_reply {") |
| 1747 | with q.group(): |
| 1748 | with q.indent(2): |
| 1749 | q.breakable() |
| 1750 | q.text("xid = "); |
| 1751 | if self.xid != None: |
| 1752 | q.text("%#x" % self.xid) |
| 1753 | else: |
| 1754 | q.text('None') |
| 1755 | q.text(","); q.breakable() |
| 1756 | q.text("enabled = "); |
| 1757 | q.text("%#x" % self.enabled) |
| 1758 | q.breakable() |
| 1759 | q.text('}') |
| 1760 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1761 | bsn_header.subtypes[20] = bsn_bw_enable_get_reply |
| 1762 | |
| 1763 | class bsn_bw_enable_get_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1764 | version = 4 |
| 1765 | type = 4 |
| 1766 | experimenter = 6035143 |
| 1767 | subtype = 19 |
| 1768 | |
| 1769 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1770 | if xid != None: |
| 1771 | self.xid = xid |
| 1772 | else: |
| 1773 | self.xid = None |
| 1774 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1775 | |
| 1776 | def pack(self): |
| 1777 | packed = [] |
| 1778 | packed.append(struct.pack("!B", self.version)) |
| 1779 | packed.append(struct.pack("!B", self.type)) |
| 1780 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1781 | packed.append(struct.pack("!L", self.xid)) |
| 1782 | packed.append(struct.pack("!L", self.experimenter)) |
| 1783 | packed.append(struct.pack("!L", self.subtype)) |
| 1784 | length = sum([len(x) for x in packed]) |
| 1785 | packed[2] = struct.pack("!H", length) |
| 1786 | return ''.join(packed) |
| 1787 | |
| 1788 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1789 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1790 | obj = bsn_bw_enable_get_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1791 | _version = reader.read("!B")[0] |
| 1792 | assert(_version == 4) |
| 1793 | _type = reader.read("!B")[0] |
| 1794 | assert(_type == 4) |
| 1795 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1796 | orig_reader = reader |
| 1797 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1798 | obj.xid = reader.read("!L")[0] |
| 1799 | _experimenter = reader.read("!L")[0] |
| 1800 | assert(_experimenter == 6035143) |
| 1801 | _subtype = reader.read("!L")[0] |
| 1802 | assert(_subtype == 19) |
| 1803 | return obj |
| 1804 | |
| 1805 | def __eq__(self, other): |
| 1806 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1807 | if self.xid != other.xid: return False |
| 1808 | return True |
| 1809 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1810 | def pretty_print(self, q): |
| 1811 | q.text("bsn_bw_enable_get_request {") |
| 1812 | with q.group(): |
| 1813 | with q.indent(2): |
| 1814 | q.breakable() |
| 1815 | q.text("xid = "); |
| 1816 | if self.xid != None: |
| 1817 | q.text("%#x" % self.xid) |
| 1818 | else: |
| 1819 | q.text('None') |
| 1820 | q.breakable() |
| 1821 | q.text('}') |
| 1822 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1823 | bsn_header.subtypes[19] = bsn_bw_enable_get_request |
| 1824 | |
| 1825 | class bsn_bw_enable_set_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1826 | version = 4 |
| 1827 | type = 4 |
| 1828 | experimenter = 6035143 |
| 1829 | subtype = 23 |
| 1830 | |
| 1831 | def __init__(self, xid=None, enable=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1832 | if xid != None: |
| 1833 | self.xid = xid |
| 1834 | else: |
| 1835 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1836 | if enable != None: |
| 1837 | self.enable = enable |
| 1838 | else: |
| 1839 | self.enable = 0 |
| 1840 | if status != None: |
| 1841 | self.status = status |
| 1842 | else: |
| 1843 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1844 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1845 | |
| 1846 | def pack(self): |
| 1847 | packed = [] |
| 1848 | packed.append(struct.pack("!B", self.version)) |
| 1849 | packed.append(struct.pack("!B", self.type)) |
| 1850 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1851 | packed.append(struct.pack("!L", self.xid)) |
| 1852 | packed.append(struct.pack("!L", self.experimenter)) |
| 1853 | packed.append(struct.pack("!L", self.subtype)) |
| 1854 | packed.append(struct.pack("!L", self.enable)) |
| 1855 | packed.append(struct.pack("!L", self.status)) |
| 1856 | length = sum([len(x) for x in packed]) |
| 1857 | packed[2] = struct.pack("!H", length) |
| 1858 | return ''.join(packed) |
| 1859 | |
| 1860 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1861 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1862 | obj = bsn_bw_enable_set_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1863 | _version = reader.read("!B")[0] |
| 1864 | assert(_version == 4) |
| 1865 | _type = reader.read("!B")[0] |
| 1866 | assert(_type == 4) |
| 1867 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1868 | orig_reader = reader |
| 1869 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1870 | obj.xid = reader.read("!L")[0] |
| 1871 | _experimenter = reader.read("!L")[0] |
| 1872 | assert(_experimenter == 6035143) |
| 1873 | _subtype = reader.read("!L")[0] |
| 1874 | assert(_subtype == 23) |
| 1875 | obj.enable = reader.read("!L")[0] |
| 1876 | obj.status = reader.read("!L")[0] |
| 1877 | return obj |
| 1878 | |
| 1879 | def __eq__(self, other): |
| 1880 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1881 | if self.xid != other.xid: return False |
| 1882 | if self.enable != other.enable: return False |
| 1883 | if self.status != other.status: return False |
| 1884 | return True |
| 1885 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1886 | def pretty_print(self, q): |
| 1887 | q.text("bsn_bw_enable_set_reply {") |
| 1888 | with q.group(): |
| 1889 | with q.indent(2): |
| 1890 | q.breakable() |
| 1891 | q.text("xid = "); |
| 1892 | if self.xid != None: |
| 1893 | q.text("%#x" % self.xid) |
| 1894 | else: |
| 1895 | q.text('None') |
| 1896 | q.text(","); q.breakable() |
| 1897 | q.text("enable = "); |
| 1898 | q.text("%#x" % self.enable) |
| 1899 | q.text(","); q.breakable() |
| 1900 | q.text("status = "); |
| 1901 | q.text("%#x" % self.status) |
| 1902 | q.breakable() |
| 1903 | q.text('}') |
| 1904 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1905 | bsn_header.subtypes[23] = bsn_bw_enable_set_reply |
| 1906 | |
| 1907 | class bsn_bw_enable_set_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1908 | version = 4 |
| 1909 | type = 4 |
| 1910 | experimenter = 6035143 |
| 1911 | subtype = 18 |
| 1912 | |
| 1913 | def __init__(self, xid=None, enable=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1914 | if xid != None: |
| 1915 | self.xid = xid |
| 1916 | else: |
| 1917 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1918 | if enable != None: |
| 1919 | self.enable = enable |
| 1920 | else: |
| 1921 | self.enable = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1922 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1923 | |
| 1924 | def pack(self): |
| 1925 | packed = [] |
| 1926 | packed.append(struct.pack("!B", self.version)) |
| 1927 | packed.append(struct.pack("!B", self.type)) |
| 1928 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1929 | packed.append(struct.pack("!L", self.xid)) |
| 1930 | packed.append(struct.pack("!L", self.experimenter)) |
| 1931 | packed.append(struct.pack("!L", self.subtype)) |
| 1932 | packed.append(struct.pack("!L", self.enable)) |
| 1933 | length = sum([len(x) for x in packed]) |
| 1934 | packed[2] = struct.pack("!H", length) |
| 1935 | return ''.join(packed) |
| 1936 | |
| 1937 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1938 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1939 | obj = bsn_bw_enable_set_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1940 | _version = reader.read("!B")[0] |
| 1941 | assert(_version == 4) |
| 1942 | _type = reader.read("!B")[0] |
| 1943 | assert(_type == 4) |
| 1944 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1945 | orig_reader = reader |
| 1946 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1947 | obj.xid = reader.read("!L")[0] |
| 1948 | _experimenter = reader.read("!L")[0] |
| 1949 | assert(_experimenter == 6035143) |
| 1950 | _subtype = reader.read("!L")[0] |
| 1951 | assert(_subtype == 18) |
| 1952 | obj.enable = reader.read("!L")[0] |
| 1953 | return obj |
| 1954 | |
| 1955 | def __eq__(self, other): |
| 1956 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1957 | if self.xid != other.xid: return False |
| 1958 | if self.enable != other.enable: return False |
| 1959 | return True |
| 1960 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1961 | def pretty_print(self, q): |
| 1962 | q.text("bsn_bw_enable_set_request {") |
| 1963 | with q.group(): |
| 1964 | with q.indent(2): |
| 1965 | q.breakable() |
| 1966 | q.text("xid = "); |
| 1967 | if self.xid != None: |
| 1968 | q.text("%#x" % self.xid) |
| 1969 | else: |
| 1970 | q.text('None') |
| 1971 | q.text(","); q.breakable() |
| 1972 | q.text("enable = "); |
| 1973 | q.text("%#x" % self.enable) |
| 1974 | q.breakable() |
| 1975 | q.text('}') |
| 1976 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1977 | bsn_header.subtypes[18] = bsn_bw_enable_set_request |
| 1978 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 1979 | class bsn_controller_connections_reply(bsn_header): |
| 1980 | version = 4 |
| 1981 | type = 4 |
| 1982 | experimenter = 6035143 |
| 1983 | subtype = 57 |
| 1984 | |
| 1985 | def __init__(self, xid=None, connections=None): |
| 1986 | if xid != None: |
| 1987 | self.xid = xid |
| 1988 | else: |
| 1989 | self.xid = None |
| 1990 | if connections != None: |
| 1991 | self.connections = connections |
| 1992 | else: |
| 1993 | self.connections = [] |
| 1994 | return |
| 1995 | |
| 1996 | def pack(self): |
| 1997 | packed = [] |
| 1998 | packed.append(struct.pack("!B", self.version)) |
| 1999 | packed.append(struct.pack("!B", self.type)) |
| 2000 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2001 | packed.append(struct.pack("!L", self.xid)) |
| 2002 | packed.append(struct.pack("!L", self.experimenter)) |
| 2003 | packed.append(struct.pack("!L", self.subtype)) |
| 2004 | packed.append(loxi.generic_util.pack_list(self.connections)) |
| 2005 | length = sum([len(x) for x in packed]) |
| 2006 | packed[2] = struct.pack("!H", length) |
| 2007 | return ''.join(packed) |
| 2008 | |
| 2009 | @staticmethod |
| 2010 | def unpack(reader): |
| 2011 | obj = bsn_controller_connections_reply() |
| 2012 | _version = reader.read("!B")[0] |
| 2013 | assert(_version == 4) |
| 2014 | _type = reader.read("!B")[0] |
| 2015 | assert(_type == 4) |
| 2016 | _length = reader.read("!H")[0] |
| 2017 | orig_reader = reader |
| 2018 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2019 | obj.xid = reader.read("!L")[0] |
| 2020 | _experimenter = reader.read("!L")[0] |
| 2021 | assert(_experimenter == 6035143) |
| 2022 | _subtype = reader.read("!L")[0] |
| 2023 | assert(_subtype == 57) |
| 2024 | obj.connections = loxi.generic_util.unpack_list(reader, common.bsn_controller_connection.unpack) |
| 2025 | return obj |
| 2026 | |
| 2027 | def __eq__(self, other): |
| 2028 | if type(self) != type(other): return False |
| 2029 | if self.xid != other.xid: return False |
| 2030 | if self.connections != other.connections: return False |
| 2031 | return True |
| 2032 | |
| 2033 | def pretty_print(self, q): |
| 2034 | q.text("bsn_controller_connections_reply {") |
| 2035 | with q.group(): |
| 2036 | with q.indent(2): |
| 2037 | q.breakable() |
| 2038 | q.text("xid = "); |
| 2039 | if self.xid != None: |
| 2040 | q.text("%#x" % self.xid) |
| 2041 | else: |
| 2042 | q.text('None') |
| 2043 | q.text(","); q.breakable() |
| 2044 | q.text("connections = "); |
| 2045 | q.pp(self.connections) |
| 2046 | q.breakable() |
| 2047 | q.text('}') |
| 2048 | |
| 2049 | bsn_header.subtypes[57] = bsn_controller_connections_reply |
| 2050 | |
| 2051 | class bsn_controller_connections_request(bsn_header): |
| 2052 | version = 4 |
| 2053 | type = 4 |
| 2054 | experimenter = 6035143 |
| 2055 | subtype = 56 |
| 2056 | |
| 2057 | def __init__(self, xid=None): |
| 2058 | if xid != None: |
| 2059 | self.xid = xid |
| 2060 | else: |
| 2061 | self.xid = None |
| 2062 | return |
| 2063 | |
| 2064 | def pack(self): |
| 2065 | packed = [] |
| 2066 | packed.append(struct.pack("!B", self.version)) |
| 2067 | packed.append(struct.pack("!B", self.type)) |
| 2068 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2069 | packed.append(struct.pack("!L", self.xid)) |
| 2070 | packed.append(struct.pack("!L", self.experimenter)) |
| 2071 | packed.append(struct.pack("!L", self.subtype)) |
| 2072 | length = sum([len(x) for x in packed]) |
| 2073 | packed[2] = struct.pack("!H", length) |
| 2074 | return ''.join(packed) |
| 2075 | |
| 2076 | @staticmethod |
| 2077 | def unpack(reader): |
| 2078 | obj = bsn_controller_connections_request() |
| 2079 | _version = reader.read("!B")[0] |
| 2080 | assert(_version == 4) |
| 2081 | _type = reader.read("!B")[0] |
| 2082 | assert(_type == 4) |
| 2083 | _length = reader.read("!H")[0] |
| 2084 | orig_reader = reader |
| 2085 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2086 | obj.xid = reader.read("!L")[0] |
| 2087 | _experimenter = reader.read("!L")[0] |
| 2088 | assert(_experimenter == 6035143) |
| 2089 | _subtype = reader.read("!L")[0] |
| 2090 | assert(_subtype == 56) |
| 2091 | return obj |
| 2092 | |
| 2093 | def __eq__(self, other): |
| 2094 | if type(self) != type(other): return False |
| 2095 | if self.xid != other.xid: return False |
| 2096 | return True |
| 2097 | |
| 2098 | def pretty_print(self, q): |
| 2099 | q.text("bsn_controller_connections_request {") |
| 2100 | with q.group(): |
| 2101 | with q.indent(2): |
| 2102 | q.breakable() |
| 2103 | q.text("xid = "); |
| 2104 | if self.xid != None: |
| 2105 | q.text("%#x" % self.xid) |
| 2106 | else: |
| 2107 | q.text('None') |
| 2108 | q.breakable() |
| 2109 | q.text('}') |
| 2110 | |
| 2111 | bsn_header.subtypes[56] = bsn_controller_connections_request |
| 2112 | |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2113 | class experimenter_stats_reply(stats_reply): |
| 2114 | subtypes = {} |
| 2115 | |
| 2116 | version = 4 |
| 2117 | type = 19 |
| 2118 | stats_type = 65535 |
| 2119 | |
| 2120 | def __init__(self, xid=None, flags=None, experimenter=None, subtype=None): |
| 2121 | if xid != None: |
| 2122 | self.xid = xid |
| 2123 | else: |
| 2124 | self.xid = None |
| 2125 | if flags != None: |
| 2126 | self.flags = flags |
| 2127 | else: |
| 2128 | self.flags = 0 |
| 2129 | if experimenter != None: |
| 2130 | self.experimenter = experimenter |
| 2131 | else: |
| 2132 | self.experimenter = 0 |
| 2133 | if subtype != None: |
| 2134 | self.subtype = subtype |
| 2135 | else: |
| 2136 | self.subtype = 0 |
| 2137 | return |
| 2138 | |
| 2139 | def pack(self): |
| 2140 | packed = [] |
| 2141 | packed.append(struct.pack("!B", self.version)) |
| 2142 | packed.append(struct.pack("!B", self.type)) |
| 2143 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2144 | packed.append(struct.pack("!L", self.xid)) |
| 2145 | packed.append(struct.pack("!H", self.stats_type)) |
| 2146 | packed.append(struct.pack("!H", self.flags)) |
| 2147 | packed.append('\x00' * 4) |
| 2148 | packed.append(struct.pack("!L", self.experimenter)) |
| 2149 | packed.append(struct.pack("!L", self.subtype)) |
| 2150 | length = sum([len(x) for x in packed]) |
| 2151 | packed[2] = struct.pack("!H", length) |
| 2152 | return ''.join(packed) |
| 2153 | |
| 2154 | @staticmethod |
| 2155 | def unpack(reader): |
| 2156 | subtype, = reader.peek('!L', 16) |
| 2157 | subclass = experimenter_stats_reply.subtypes.get(subtype) |
| 2158 | if subclass: |
| 2159 | return subclass.unpack(reader) |
| 2160 | |
| 2161 | obj = experimenter_stats_reply() |
| 2162 | _version = reader.read("!B")[0] |
| 2163 | assert(_version == 4) |
| 2164 | _type = reader.read("!B")[0] |
| 2165 | assert(_type == 19) |
| 2166 | _length = reader.read("!H")[0] |
| 2167 | orig_reader = reader |
| 2168 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2169 | obj.xid = reader.read("!L")[0] |
| 2170 | _stats_type = reader.read("!H")[0] |
| 2171 | assert(_stats_type == 65535) |
| 2172 | obj.flags = reader.read("!H")[0] |
| 2173 | reader.skip(4) |
| 2174 | obj.experimenter = reader.read("!L")[0] |
| 2175 | obj.subtype = reader.read("!L")[0] |
| 2176 | return obj |
| 2177 | |
| 2178 | def __eq__(self, other): |
| 2179 | if type(self) != type(other): return False |
| 2180 | if self.xid != other.xid: return False |
| 2181 | if self.flags != other.flags: return False |
| 2182 | if self.experimenter != other.experimenter: return False |
| 2183 | if self.subtype != other.subtype: return False |
| 2184 | return True |
| 2185 | |
| 2186 | def pretty_print(self, q): |
| 2187 | q.text("experimenter_stats_reply {") |
| 2188 | with q.group(): |
| 2189 | with q.indent(2): |
| 2190 | q.breakable() |
| 2191 | q.text("xid = "); |
| 2192 | if self.xid != None: |
| 2193 | q.text("%#x" % self.xid) |
| 2194 | else: |
| 2195 | q.text('None') |
| 2196 | q.text(","); q.breakable() |
| 2197 | q.text("flags = "); |
| 2198 | q.text("%#x" % self.flags) |
| 2199 | q.text(","); q.breakable() |
| 2200 | q.text("subtype = "); |
| 2201 | q.text("%#x" % self.subtype) |
| 2202 | q.breakable() |
| 2203 | q.text('}') |
| 2204 | |
| 2205 | stats_reply.subtypes[65535] = experimenter_stats_reply |
| 2206 | |
| 2207 | class bsn_stats_reply(experimenter_stats_reply): |
| 2208 | subtypes = {} |
| 2209 | |
| 2210 | version = 4 |
| 2211 | type = 19 |
| 2212 | stats_type = 65535 |
| 2213 | experimenter = 6035143 |
| 2214 | |
| 2215 | def __init__(self, xid=None, flags=None, subtype=None): |
| 2216 | if xid != None: |
| 2217 | self.xid = xid |
| 2218 | else: |
| 2219 | self.xid = None |
| 2220 | if flags != None: |
| 2221 | self.flags = flags |
| 2222 | else: |
| 2223 | self.flags = 0 |
| 2224 | if subtype != None: |
| 2225 | self.subtype = subtype |
| 2226 | else: |
| 2227 | self.subtype = 0 |
| 2228 | return |
| 2229 | |
| 2230 | def pack(self): |
| 2231 | packed = [] |
| 2232 | packed.append(struct.pack("!B", self.version)) |
| 2233 | packed.append(struct.pack("!B", self.type)) |
| 2234 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2235 | packed.append(struct.pack("!L", self.xid)) |
| 2236 | packed.append(struct.pack("!H", self.stats_type)) |
| 2237 | packed.append(struct.pack("!H", self.flags)) |
| 2238 | packed.append('\x00' * 4) |
| 2239 | packed.append(struct.pack("!L", self.experimenter)) |
| 2240 | packed.append(struct.pack("!L", self.subtype)) |
| 2241 | length = sum([len(x) for x in packed]) |
| 2242 | packed[2] = struct.pack("!H", length) |
| 2243 | return ''.join(packed) |
| 2244 | |
| 2245 | @staticmethod |
| 2246 | def unpack(reader): |
| 2247 | subtype, = reader.peek('!L', 20) |
| 2248 | subclass = bsn_stats_reply.subtypes.get(subtype) |
| 2249 | if subclass: |
| 2250 | return subclass.unpack(reader) |
| 2251 | |
| 2252 | obj = bsn_stats_reply() |
| 2253 | _version = reader.read("!B")[0] |
| 2254 | assert(_version == 4) |
| 2255 | _type = reader.read("!B")[0] |
| 2256 | assert(_type == 19) |
| 2257 | _length = reader.read("!H")[0] |
| 2258 | orig_reader = reader |
| 2259 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2260 | obj.xid = reader.read("!L")[0] |
| 2261 | _stats_type = reader.read("!H")[0] |
| 2262 | assert(_stats_type == 65535) |
| 2263 | obj.flags = reader.read("!H")[0] |
| 2264 | reader.skip(4) |
| 2265 | _experimenter = reader.read("!L")[0] |
| 2266 | assert(_experimenter == 6035143) |
| 2267 | obj.subtype = reader.read("!L")[0] |
| 2268 | return obj |
| 2269 | |
| 2270 | def __eq__(self, other): |
| 2271 | if type(self) != type(other): return False |
| 2272 | if self.xid != other.xid: return False |
| 2273 | if self.flags != other.flags: return False |
| 2274 | if self.subtype != other.subtype: return False |
| 2275 | return True |
| 2276 | |
| 2277 | def pretty_print(self, q): |
| 2278 | q.text("bsn_stats_reply {") |
| 2279 | with q.group(): |
| 2280 | with q.indent(2): |
| 2281 | q.breakable() |
| 2282 | q.text("xid = "); |
| 2283 | if self.xid != None: |
| 2284 | q.text("%#x" % self.xid) |
| 2285 | else: |
| 2286 | q.text('None') |
| 2287 | q.text(","); q.breakable() |
| 2288 | q.text("flags = "); |
| 2289 | q.text("%#x" % self.flags) |
| 2290 | q.breakable() |
| 2291 | q.text('}') |
| 2292 | |
| 2293 | experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply |
| 2294 | |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2295 | class bsn_debug_counter_desc_stats_reply(bsn_stats_reply): |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2296 | version = 4 |
| 2297 | type = 19 |
| 2298 | stats_type = 65535 |
| 2299 | experimenter = 6035143 |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2300 | subtype = 13 |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2301 | |
| 2302 | def __init__(self, xid=None, flags=None, entries=None): |
| 2303 | if xid != None: |
| 2304 | self.xid = xid |
| 2305 | else: |
| 2306 | self.xid = None |
| 2307 | if flags != None: |
| 2308 | self.flags = flags |
| 2309 | else: |
| 2310 | self.flags = 0 |
| 2311 | if entries != None: |
| 2312 | self.entries = entries |
| 2313 | else: |
| 2314 | self.entries = [] |
| 2315 | return |
| 2316 | |
| 2317 | def pack(self): |
| 2318 | packed = [] |
| 2319 | packed.append(struct.pack("!B", self.version)) |
| 2320 | packed.append(struct.pack("!B", self.type)) |
| 2321 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2322 | packed.append(struct.pack("!L", self.xid)) |
| 2323 | packed.append(struct.pack("!H", self.stats_type)) |
| 2324 | packed.append(struct.pack("!H", self.flags)) |
| 2325 | packed.append('\x00' * 4) |
| 2326 | packed.append(struct.pack("!L", self.experimenter)) |
| 2327 | packed.append(struct.pack("!L", self.subtype)) |
| 2328 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 2329 | length = sum([len(x) for x in packed]) |
| 2330 | packed[2] = struct.pack("!H", length) |
| 2331 | return ''.join(packed) |
| 2332 | |
| 2333 | @staticmethod |
| 2334 | def unpack(reader): |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2335 | obj = bsn_debug_counter_desc_stats_reply() |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2336 | _version = reader.read("!B")[0] |
| 2337 | assert(_version == 4) |
| 2338 | _type = reader.read("!B")[0] |
| 2339 | assert(_type == 19) |
| 2340 | _length = reader.read("!H")[0] |
| 2341 | orig_reader = reader |
| 2342 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2343 | obj.xid = reader.read("!L")[0] |
| 2344 | _stats_type = reader.read("!H")[0] |
| 2345 | assert(_stats_type == 65535) |
| 2346 | obj.flags = reader.read("!H")[0] |
| 2347 | reader.skip(4) |
| 2348 | _experimenter = reader.read("!L")[0] |
| 2349 | assert(_experimenter == 6035143) |
| 2350 | _subtype = reader.read("!L")[0] |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2351 | assert(_subtype == 13) |
| 2352 | 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] | 2353 | return obj |
| 2354 | |
| 2355 | def __eq__(self, other): |
| 2356 | if type(self) != type(other): return False |
| 2357 | if self.xid != other.xid: return False |
| 2358 | if self.flags != other.flags: return False |
| 2359 | if self.entries != other.entries: return False |
| 2360 | return True |
| 2361 | |
| 2362 | def pretty_print(self, q): |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2363 | q.text("bsn_debug_counter_desc_stats_reply {") |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2364 | with q.group(): |
| 2365 | with q.indent(2): |
| 2366 | q.breakable() |
| 2367 | q.text("xid = "); |
| 2368 | if self.xid != None: |
| 2369 | q.text("%#x" % self.xid) |
| 2370 | else: |
| 2371 | q.text('None') |
| 2372 | q.text(","); q.breakable() |
| 2373 | q.text("flags = "); |
| 2374 | q.text("%#x" % self.flags) |
| 2375 | q.text(","); q.breakable() |
| 2376 | q.text("entries = "); |
| 2377 | q.pp(self.entries) |
| 2378 | q.breakable() |
| 2379 | q.text('}') |
| 2380 | |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2381 | bsn_stats_reply.subtypes[13] = bsn_debug_counter_desc_stats_reply |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2382 | |
| 2383 | class experimenter_stats_request(stats_request): |
| 2384 | subtypes = {} |
| 2385 | |
| 2386 | version = 4 |
| 2387 | type = 18 |
| 2388 | stats_type = 65535 |
| 2389 | |
| 2390 | def __init__(self, xid=None, flags=None, experimenter=None, subtype=None): |
| 2391 | if xid != None: |
| 2392 | self.xid = xid |
| 2393 | else: |
| 2394 | self.xid = None |
| 2395 | if flags != None: |
| 2396 | self.flags = flags |
| 2397 | else: |
| 2398 | self.flags = 0 |
| 2399 | if experimenter != None: |
| 2400 | self.experimenter = experimenter |
| 2401 | else: |
| 2402 | self.experimenter = 0 |
| 2403 | if subtype != None: |
| 2404 | self.subtype = subtype |
| 2405 | else: |
| 2406 | self.subtype = 0 |
| 2407 | return |
| 2408 | |
| 2409 | def pack(self): |
| 2410 | packed = [] |
| 2411 | packed.append(struct.pack("!B", self.version)) |
| 2412 | packed.append(struct.pack("!B", self.type)) |
| 2413 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2414 | packed.append(struct.pack("!L", self.xid)) |
| 2415 | packed.append(struct.pack("!H", self.stats_type)) |
| 2416 | packed.append(struct.pack("!H", self.flags)) |
| 2417 | packed.append('\x00' * 4) |
| 2418 | packed.append(struct.pack("!L", self.experimenter)) |
| 2419 | packed.append(struct.pack("!L", self.subtype)) |
| 2420 | length = sum([len(x) for x in packed]) |
| 2421 | packed[2] = struct.pack("!H", length) |
| 2422 | return ''.join(packed) |
| 2423 | |
| 2424 | @staticmethod |
| 2425 | def unpack(reader): |
| 2426 | subtype, = reader.peek('!L', 16) |
| 2427 | subclass = experimenter_stats_request.subtypes.get(subtype) |
| 2428 | if subclass: |
| 2429 | return subclass.unpack(reader) |
| 2430 | |
| 2431 | obj = experimenter_stats_request() |
| 2432 | _version = reader.read("!B")[0] |
| 2433 | assert(_version == 4) |
| 2434 | _type = reader.read("!B")[0] |
| 2435 | assert(_type == 18) |
| 2436 | _length = reader.read("!H")[0] |
| 2437 | orig_reader = reader |
| 2438 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2439 | obj.xid = reader.read("!L")[0] |
| 2440 | _stats_type = reader.read("!H")[0] |
| 2441 | assert(_stats_type == 65535) |
| 2442 | obj.flags = reader.read("!H")[0] |
| 2443 | reader.skip(4) |
| 2444 | obj.experimenter = reader.read("!L")[0] |
| 2445 | obj.subtype = reader.read("!L")[0] |
| 2446 | return obj |
| 2447 | |
| 2448 | def __eq__(self, other): |
| 2449 | if type(self) != type(other): return False |
| 2450 | if self.xid != other.xid: return False |
| 2451 | if self.flags != other.flags: return False |
| 2452 | if self.experimenter != other.experimenter: return False |
| 2453 | if self.subtype != other.subtype: return False |
| 2454 | return True |
| 2455 | |
| 2456 | def pretty_print(self, q): |
| 2457 | q.text("experimenter_stats_request {") |
| 2458 | with q.group(): |
| 2459 | with q.indent(2): |
| 2460 | q.breakable() |
| 2461 | q.text("xid = "); |
| 2462 | if self.xid != None: |
| 2463 | q.text("%#x" % self.xid) |
| 2464 | else: |
| 2465 | q.text('None') |
| 2466 | q.text(","); q.breakable() |
| 2467 | q.text("flags = "); |
| 2468 | q.text("%#x" % self.flags) |
| 2469 | q.text(","); q.breakable() |
| 2470 | q.text("subtype = "); |
| 2471 | q.text("%#x" % self.subtype) |
| 2472 | q.breakable() |
| 2473 | q.text('}') |
| 2474 | |
| 2475 | stats_request.subtypes[65535] = experimenter_stats_request |
| 2476 | |
| 2477 | class bsn_stats_request(experimenter_stats_request): |
| 2478 | subtypes = {} |
| 2479 | |
| 2480 | version = 4 |
| 2481 | type = 18 |
| 2482 | stats_type = 65535 |
| 2483 | experimenter = 6035143 |
| 2484 | |
| 2485 | def __init__(self, xid=None, flags=None, subtype=None): |
| 2486 | if xid != None: |
| 2487 | self.xid = xid |
| 2488 | else: |
| 2489 | self.xid = None |
| 2490 | if flags != None: |
| 2491 | self.flags = flags |
| 2492 | else: |
| 2493 | self.flags = 0 |
| 2494 | if subtype != None: |
| 2495 | self.subtype = subtype |
| 2496 | else: |
| 2497 | self.subtype = 0 |
| 2498 | return |
| 2499 | |
| 2500 | def pack(self): |
| 2501 | packed = [] |
| 2502 | packed.append(struct.pack("!B", self.version)) |
| 2503 | packed.append(struct.pack("!B", self.type)) |
| 2504 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2505 | packed.append(struct.pack("!L", self.xid)) |
| 2506 | packed.append(struct.pack("!H", self.stats_type)) |
| 2507 | packed.append(struct.pack("!H", self.flags)) |
| 2508 | packed.append('\x00' * 4) |
| 2509 | packed.append(struct.pack("!L", self.experimenter)) |
| 2510 | packed.append(struct.pack("!L", self.subtype)) |
| 2511 | length = sum([len(x) for x in packed]) |
| 2512 | packed[2] = struct.pack("!H", length) |
| 2513 | return ''.join(packed) |
| 2514 | |
| 2515 | @staticmethod |
| 2516 | def unpack(reader): |
| 2517 | subtype, = reader.peek('!L', 20) |
| 2518 | subclass = bsn_stats_request.subtypes.get(subtype) |
| 2519 | if subclass: |
| 2520 | return subclass.unpack(reader) |
| 2521 | |
| 2522 | obj = bsn_stats_request() |
| 2523 | _version = reader.read("!B")[0] |
| 2524 | assert(_version == 4) |
| 2525 | _type = reader.read("!B")[0] |
| 2526 | assert(_type == 18) |
| 2527 | _length = reader.read("!H")[0] |
| 2528 | orig_reader = reader |
| 2529 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2530 | obj.xid = reader.read("!L")[0] |
| 2531 | _stats_type = reader.read("!H")[0] |
| 2532 | assert(_stats_type == 65535) |
| 2533 | obj.flags = reader.read("!H")[0] |
| 2534 | reader.skip(4) |
| 2535 | _experimenter = reader.read("!L")[0] |
| 2536 | assert(_experimenter == 6035143) |
| 2537 | obj.subtype = reader.read("!L")[0] |
| 2538 | return obj |
| 2539 | |
| 2540 | def __eq__(self, other): |
| 2541 | if type(self) != type(other): return False |
| 2542 | if self.xid != other.xid: return False |
| 2543 | if self.flags != other.flags: return False |
| 2544 | if self.subtype != other.subtype: return False |
| 2545 | return True |
| 2546 | |
| 2547 | def pretty_print(self, q): |
| 2548 | q.text("bsn_stats_request {") |
| 2549 | with q.group(): |
| 2550 | with q.indent(2): |
| 2551 | q.breakable() |
| 2552 | q.text("xid = "); |
| 2553 | if self.xid != None: |
| 2554 | q.text("%#x" % self.xid) |
| 2555 | else: |
| 2556 | q.text('None') |
| 2557 | q.text(","); q.breakable() |
| 2558 | q.text("flags = "); |
| 2559 | q.text("%#x" % self.flags) |
| 2560 | q.breakable() |
| 2561 | q.text('}') |
| 2562 | |
| 2563 | experimenter_stats_request.subtypes[6035143] = bsn_stats_request |
| 2564 | |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2565 | class bsn_debug_counter_desc_stats_request(bsn_stats_request): |
| 2566 | version = 4 |
| 2567 | type = 18 |
| 2568 | stats_type = 65535 |
| 2569 | experimenter = 6035143 |
| 2570 | subtype = 13 |
| 2571 | |
| 2572 | def __init__(self, xid=None, flags=None): |
| 2573 | if xid != None: |
| 2574 | self.xid = xid |
| 2575 | else: |
| 2576 | self.xid = None |
| 2577 | if flags != None: |
| 2578 | self.flags = flags |
| 2579 | else: |
| 2580 | self.flags = 0 |
| 2581 | return |
| 2582 | |
| 2583 | def pack(self): |
| 2584 | packed = [] |
| 2585 | packed.append(struct.pack("!B", self.version)) |
| 2586 | packed.append(struct.pack("!B", self.type)) |
| 2587 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2588 | packed.append(struct.pack("!L", self.xid)) |
| 2589 | packed.append(struct.pack("!H", self.stats_type)) |
| 2590 | packed.append(struct.pack("!H", self.flags)) |
| 2591 | packed.append('\x00' * 4) |
| 2592 | packed.append(struct.pack("!L", self.experimenter)) |
| 2593 | packed.append(struct.pack("!L", self.subtype)) |
| 2594 | length = sum([len(x) for x in packed]) |
| 2595 | packed[2] = struct.pack("!H", length) |
| 2596 | return ''.join(packed) |
| 2597 | |
| 2598 | @staticmethod |
| 2599 | def unpack(reader): |
| 2600 | obj = bsn_debug_counter_desc_stats_request() |
| 2601 | _version = reader.read("!B")[0] |
| 2602 | assert(_version == 4) |
| 2603 | _type = reader.read("!B")[0] |
| 2604 | assert(_type == 18) |
| 2605 | _length = reader.read("!H")[0] |
| 2606 | orig_reader = reader |
| 2607 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2608 | obj.xid = reader.read("!L")[0] |
| 2609 | _stats_type = reader.read("!H")[0] |
| 2610 | assert(_stats_type == 65535) |
| 2611 | obj.flags = reader.read("!H")[0] |
| 2612 | reader.skip(4) |
| 2613 | _experimenter = reader.read("!L")[0] |
| 2614 | assert(_experimenter == 6035143) |
| 2615 | _subtype = reader.read("!L")[0] |
| 2616 | assert(_subtype == 13) |
| 2617 | return obj |
| 2618 | |
| 2619 | def __eq__(self, other): |
| 2620 | if type(self) != type(other): return False |
| 2621 | if self.xid != other.xid: return False |
| 2622 | if self.flags != other.flags: return False |
| 2623 | return True |
| 2624 | |
| 2625 | def pretty_print(self, q): |
| 2626 | q.text("bsn_debug_counter_desc_stats_request {") |
| 2627 | with q.group(): |
| 2628 | with q.indent(2): |
| 2629 | q.breakable() |
| 2630 | q.text("xid = "); |
| 2631 | if self.xid != None: |
| 2632 | q.text("%#x" % self.xid) |
| 2633 | else: |
| 2634 | q.text('None') |
| 2635 | q.text(","); q.breakable() |
| 2636 | q.text("flags = "); |
| 2637 | q.text("%#x" % self.flags) |
| 2638 | q.breakable() |
| 2639 | q.text('}') |
| 2640 | |
| 2641 | bsn_stats_request.subtypes[13] = bsn_debug_counter_desc_stats_request |
| 2642 | |
| 2643 | class bsn_debug_counter_stats_reply(bsn_stats_reply): |
| 2644 | version = 4 |
| 2645 | type = 19 |
| 2646 | stats_type = 65535 |
| 2647 | experimenter = 6035143 |
| 2648 | subtype = 12 |
| 2649 | |
| 2650 | def __init__(self, xid=None, flags=None, entries=None): |
| 2651 | if xid != None: |
| 2652 | self.xid = xid |
| 2653 | else: |
| 2654 | self.xid = None |
| 2655 | if flags != None: |
| 2656 | self.flags = flags |
| 2657 | else: |
| 2658 | self.flags = 0 |
| 2659 | if entries != None: |
| 2660 | self.entries = entries |
| 2661 | else: |
| 2662 | self.entries = [] |
| 2663 | return |
| 2664 | |
| 2665 | def pack(self): |
| 2666 | packed = [] |
| 2667 | packed.append(struct.pack("!B", self.version)) |
| 2668 | packed.append(struct.pack("!B", self.type)) |
| 2669 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2670 | packed.append(struct.pack("!L", self.xid)) |
| 2671 | packed.append(struct.pack("!H", self.stats_type)) |
| 2672 | packed.append(struct.pack("!H", self.flags)) |
| 2673 | packed.append('\x00' * 4) |
| 2674 | packed.append(struct.pack("!L", self.experimenter)) |
| 2675 | packed.append(struct.pack("!L", self.subtype)) |
| 2676 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 2677 | length = sum([len(x) for x in packed]) |
| 2678 | packed[2] = struct.pack("!H", length) |
| 2679 | return ''.join(packed) |
| 2680 | |
| 2681 | @staticmethod |
| 2682 | def unpack(reader): |
| 2683 | obj = bsn_debug_counter_stats_reply() |
| 2684 | _version = reader.read("!B")[0] |
| 2685 | assert(_version == 4) |
| 2686 | _type = reader.read("!B")[0] |
| 2687 | assert(_type == 19) |
| 2688 | _length = reader.read("!H")[0] |
| 2689 | orig_reader = reader |
| 2690 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2691 | obj.xid = reader.read("!L")[0] |
| 2692 | _stats_type = reader.read("!H")[0] |
| 2693 | assert(_stats_type == 65535) |
| 2694 | obj.flags = reader.read("!H")[0] |
| 2695 | reader.skip(4) |
| 2696 | _experimenter = reader.read("!L")[0] |
| 2697 | assert(_experimenter == 6035143) |
| 2698 | _subtype = reader.read("!L")[0] |
| 2699 | assert(_subtype == 12) |
| 2700 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_debug_counter_stats_entry.unpack) |
| 2701 | return obj |
| 2702 | |
| 2703 | def __eq__(self, other): |
| 2704 | if type(self) != type(other): return False |
| 2705 | if self.xid != other.xid: return False |
| 2706 | if self.flags != other.flags: return False |
| 2707 | if self.entries != other.entries: return False |
| 2708 | return True |
| 2709 | |
| 2710 | def pretty_print(self, q): |
| 2711 | q.text("bsn_debug_counter_stats_reply {") |
| 2712 | with q.group(): |
| 2713 | with q.indent(2): |
| 2714 | q.breakable() |
| 2715 | q.text("xid = "); |
| 2716 | if self.xid != None: |
| 2717 | q.text("%#x" % self.xid) |
| 2718 | else: |
| 2719 | q.text('None') |
| 2720 | q.text(","); q.breakable() |
| 2721 | q.text("flags = "); |
| 2722 | q.text("%#x" % self.flags) |
| 2723 | q.text(","); q.breakable() |
| 2724 | q.text("entries = "); |
| 2725 | q.pp(self.entries) |
| 2726 | q.breakable() |
| 2727 | q.text('}') |
| 2728 | |
| 2729 | bsn_stats_reply.subtypes[12] = bsn_debug_counter_stats_reply |
| 2730 | |
| 2731 | class bsn_debug_counter_stats_request(bsn_stats_request): |
| 2732 | version = 4 |
| 2733 | type = 18 |
| 2734 | stats_type = 65535 |
| 2735 | experimenter = 6035143 |
| 2736 | subtype = 12 |
| 2737 | |
| 2738 | def __init__(self, xid=None, flags=None): |
| 2739 | if xid != None: |
| 2740 | self.xid = xid |
| 2741 | else: |
| 2742 | self.xid = None |
| 2743 | if flags != None: |
| 2744 | self.flags = flags |
| 2745 | else: |
| 2746 | self.flags = 0 |
| 2747 | return |
| 2748 | |
| 2749 | def pack(self): |
| 2750 | packed = [] |
| 2751 | packed.append(struct.pack("!B", self.version)) |
| 2752 | packed.append(struct.pack("!B", self.type)) |
| 2753 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2754 | packed.append(struct.pack("!L", self.xid)) |
| 2755 | packed.append(struct.pack("!H", self.stats_type)) |
| 2756 | packed.append(struct.pack("!H", self.flags)) |
| 2757 | packed.append('\x00' * 4) |
| 2758 | packed.append(struct.pack("!L", self.experimenter)) |
| 2759 | packed.append(struct.pack("!L", self.subtype)) |
| 2760 | length = sum([len(x) for x in packed]) |
| 2761 | packed[2] = struct.pack("!H", length) |
| 2762 | return ''.join(packed) |
| 2763 | |
| 2764 | @staticmethod |
| 2765 | def unpack(reader): |
| 2766 | obj = bsn_debug_counter_stats_request() |
| 2767 | _version = reader.read("!B")[0] |
| 2768 | assert(_version == 4) |
| 2769 | _type = reader.read("!B")[0] |
| 2770 | assert(_type == 18) |
| 2771 | _length = reader.read("!H")[0] |
| 2772 | orig_reader = reader |
| 2773 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2774 | obj.xid = reader.read("!L")[0] |
| 2775 | _stats_type = reader.read("!H")[0] |
| 2776 | assert(_stats_type == 65535) |
| 2777 | obj.flags = reader.read("!H")[0] |
| 2778 | reader.skip(4) |
| 2779 | _experimenter = reader.read("!L")[0] |
| 2780 | assert(_experimenter == 6035143) |
| 2781 | _subtype = reader.read("!L")[0] |
| 2782 | assert(_subtype == 12) |
| 2783 | return obj |
| 2784 | |
| 2785 | def __eq__(self, other): |
| 2786 | if type(self) != type(other): return False |
| 2787 | if self.xid != other.xid: return False |
| 2788 | if self.flags != other.flags: return False |
| 2789 | return True |
| 2790 | |
| 2791 | def pretty_print(self, q): |
| 2792 | q.text("bsn_debug_counter_stats_request {") |
| 2793 | with q.group(): |
| 2794 | with q.indent(2): |
| 2795 | q.breakable() |
| 2796 | q.text("xid = "); |
| 2797 | if self.xid != None: |
| 2798 | q.text("%#x" % self.xid) |
| 2799 | else: |
| 2800 | q.text('None') |
| 2801 | q.text(","); q.breakable() |
| 2802 | q.text("flags = "); |
| 2803 | q.text("%#x" % self.flags) |
| 2804 | q.breakable() |
| 2805 | q.text('}') |
| 2806 | |
| 2807 | bsn_stats_request.subtypes[12] = bsn_debug_counter_stats_request |
| 2808 | |
| 2809 | class bsn_flow_checksum_bucket_stats_reply(bsn_stats_reply): |
| 2810 | version = 4 |
| 2811 | type = 19 |
| 2812 | stats_type = 65535 |
| 2813 | experimenter = 6035143 |
| 2814 | subtype = 10 |
| 2815 | |
| 2816 | def __init__(self, xid=None, flags=None, entries=None): |
| 2817 | if xid != None: |
| 2818 | self.xid = xid |
| 2819 | else: |
| 2820 | self.xid = None |
| 2821 | if flags != None: |
| 2822 | self.flags = flags |
| 2823 | else: |
| 2824 | self.flags = 0 |
| 2825 | if entries != None: |
| 2826 | self.entries = entries |
| 2827 | else: |
| 2828 | self.entries = [] |
| 2829 | return |
| 2830 | |
| 2831 | def pack(self): |
| 2832 | packed = [] |
| 2833 | packed.append(struct.pack("!B", self.version)) |
| 2834 | packed.append(struct.pack("!B", self.type)) |
| 2835 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2836 | packed.append(struct.pack("!L", self.xid)) |
| 2837 | packed.append(struct.pack("!H", self.stats_type)) |
| 2838 | packed.append(struct.pack("!H", self.flags)) |
| 2839 | packed.append('\x00' * 4) |
| 2840 | packed.append(struct.pack("!L", self.experimenter)) |
| 2841 | packed.append(struct.pack("!L", self.subtype)) |
| 2842 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 2843 | length = sum([len(x) for x in packed]) |
| 2844 | packed[2] = struct.pack("!H", length) |
| 2845 | return ''.join(packed) |
| 2846 | |
| 2847 | @staticmethod |
| 2848 | def unpack(reader): |
| 2849 | obj = bsn_flow_checksum_bucket_stats_reply() |
| 2850 | _version = reader.read("!B")[0] |
| 2851 | assert(_version == 4) |
| 2852 | _type = reader.read("!B")[0] |
| 2853 | assert(_type == 19) |
| 2854 | _length = reader.read("!H")[0] |
| 2855 | orig_reader = reader |
| 2856 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2857 | obj.xid = reader.read("!L")[0] |
| 2858 | _stats_type = reader.read("!H")[0] |
| 2859 | assert(_stats_type == 65535) |
| 2860 | obj.flags = reader.read("!H")[0] |
| 2861 | reader.skip(4) |
| 2862 | _experimenter = reader.read("!L")[0] |
| 2863 | assert(_experimenter == 6035143) |
| 2864 | _subtype = reader.read("!L")[0] |
| 2865 | assert(_subtype == 10) |
| 2866 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_flow_checksum_bucket_stats_entry.unpack) |
| 2867 | return obj |
| 2868 | |
| 2869 | def __eq__(self, other): |
| 2870 | if type(self) != type(other): return False |
| 2871 | if self.xid != other.xid: return False |
| 2872 | if self.flags != other.flags: return False |
| 2873 | if self.entries != other.entries: return False |
| 2874 | return True |
| 2875 | |
| 2876 | def pretty_print(self, q): |
| 2877 | q.text("bsn_flow_checksum_bucket_stats_reply {") |
| 2878 | with q.group(): |
| 2879 | with q.indent(2): |
| 2880 | q.breakable() |
| 2881 | q.text("xid = "); |
| 2882 | if self.xid != None: |
| 2883 | q.text("%#x" % self.xid) |
| 2884 | else: |
| 2885 | q.text('None') |
| 2886 | q.text(","); q.breakable() |
| 2887 | q.text("flags = "); |
| 2888 | q.text("%#x" % self.flags) |
| 2889 | q.text(","); q.breakable() |
| 2890 | q.text("entries = "); |
| 2891 | q.pp(self.entries) |
| 2892 | q.breakable() |
| 2893 | q.text('}') |
| 2894 | |
| 2895 | bsn_stats_reply.subtypes[10] = bsn_flow_checksum_bucket_stats_reply |
| 2896 | |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2897 | class bsn_flow_checksum_bucket_stats_request(bsn_stats_request): |
| 2898 | version = 4 |
| 2899 | type = 18 |
| 2900 | stats_type = 65535 |
| 2901 | experimenter = 6035143 |
| 2902 | subtype = 10 |
| 2903 | |
| 2904 | def __init__(self, xid=None, flags=None, table_id=None): |
| 2905 | if xid != None: |
| 2906 | self.xid = xid |
| 2907 | else: |
| 2908 | self.xid = None |
| 2909 | if flags != None: |
| 2910 | self.flags = flags |
| 2911 | else: |
| 2912 | self.flags = 0 |
| 2913 | if table_id != None: |
| 2914 | self.table_id = table_id |
| 2915 | else: |
| 2916 | self.table_id = 0 |
| 2917 | return |
| 2918 | |
| 2919 | def pack(self): |
| 2920 | packed = [] |
| 2921 | packed.append(struct.pack("!B", self.version)) |
| 2922 | packed.append(struct.pack("!B", self.type)) |
| 2923 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2924 | packed.append(struct.pack("!L", self.xid)) |
| 2925 | packed.append(struct.pack("!H", self.stats_type)) |
| 2926 | packed.append(struct.pack("!H", self.flags)) |
| 2927 | packed.append('\x00' * 4) |
| 2928 | packed.append(struct.pack("!L", self.experimenter)) |
| 2929 | packed.append(struct.pack("!L", self.subtype)) |
| 2930 | packed.append(struct.pack("!B", self.table_id)) |
| 2931 | length = sum([len(x) for x in packed]) |
| 2932 | packed[2] = struct.pack("!H", length) |
| 2933 | return ''.join(packed) |
| 2934 | |
| 2935 | @staticmethod |
| 2936 | def unpack(reader): |
| 2937 | obj = bsn_flow_checksum_bucket_stats_request() |
| 2938 | _version = reader.read("!B")[0] |
| 2939 | assert(_version == 4) |
| 2940 | _type = reader.read("!B")[0] |
| 2941 | assert(_type == 18) |
| 2942 | _length = reader.read("!H")[0] |
| 2943 | orig_reader = reader |
| 2944 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2945 | obj.xid = reader.read("!L")[0] |
| 2946 | _stats_type = reader.read("!H")[0] |
| 2947 | assert(_stats_type == 65535) |
| 2948 | obj.flags = reader.read("!H")[0] |
| 2949 | reader.skip(4) |
| 2950 | _experimenter = reader.read("!L")[0] |
| 2951 | assert(_experimenter == 6035143) |
| 2952 | _subtype = reader.read("!L")[0] |
| 2953 | assert(_subtype == 10) |
| 2954 | obj.table_id = reader.read("!B")[0] |
| 2955 | return obj |
| 2956 | |
| 2957 | def __eq__(self, other): |
| 2958 | if type(self) != type(other): return False |
| 2959 | if self.xid != other.xid: return False |
| 2960 | if self.flags != other.flags: return False |
| 2961 | if self.table_id != other.table_id: return False |
| 2962 | return True |
| 2963 | |
| 2964 | def pretty_print(self, q): |
| 2965 | q.text("bsn_flow_checksum_bucket_stats_request {") |
| 2966 | with q.group(): |
| 2967 | with q.indent(2): |
| 2968 | q.breakable() |
| 2969 | q.text("xid = "); |
| 2970 | if self.xid != None: |
| 2971 | q.text("%#x" % self.xid) |
| 2972 | else: |
| 2973 | q.text('None') |
| 2974 | q.text(","); q.breakable() |
| 2975 | q.text("flags = "); |
| 2976 | q.text("%#x" % self.flags) |
| 2977 | q.text(","); q.breakable() |
| 2978 | q.text("table_id = "); |
| 2979 | q.text("%#x" % self.table_id) |
| 2980 | q.breakable() |
| 2981 | q.text('}') |
| 2982 | |
| 2983 | bsn_stats_request.subtypes[10] = bsn_flow_checksum_bucket_stats_request |
| 2984 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2985 | class bsn_flow_idle(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2986 | version = 4 |
| 2987 | type = 4 |
| 2988 | experimenter = 6035143 |
| 2989 | subtype = 40 |
| 2990 | |
| 2991 | 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] | 2992 | if xid != None: |
| 2993 | self.xid = xid |
| 2994 | else: |
| 2995 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2996 | if cookie != None: |
| 2997 | self.cookie = cookie |
| 2998 | else: |
| 2999 | self.cookie = 0 |
| 3000 | if priority != None: |
| 3001 | self.priority = priority |
| 3002 | else: |
| 3003 | self.priority = 0 |
| 3004 | if table_id != None: |
| 3005 | self.table_id = table_id |
| 3006 | else: |
| 3007 | self.table_id = 0 |
| 3008 | if match != None: |
| 3009 | self.match = match |
| 3010 | else: |
| 3011 | self.match = common.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3012 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3013 | |
| 3014 | def pack(self): |
| 3015 | packed = [] |
| 3016 | packed.append(struct.pack("!B", self.version)) |
| 3017 | packed.append(struct.pack("!B", self.type)) |
| 3018 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3019 | packed.append(struct.pack("!L", self.xid)) |
| 3020 | packed.append(struct.pack("!L", self.experimenter)) |
| 3021 | packed.append(struct.pack("!L", self.subtype)) |
| 3022 | packed.append(struct.pack("!Q", self.cookie)) |
| 3023 | packed.append(struct.pack("!H", self.priority)) |
| 3024 | packed.append(struct.pack("!B", self.table_id)) |
| 3025 | packed.append('\x00' * 5) |
| 3026 | packed.append(self.match.pack()) |
| 3027 | length = sum([len(x) for x in packed]) |
| 3028 | packed[2] = struct.pack("!H", length) |
| 3029 | return ''.join(packed) |
| 3030 | |
| 3031 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3032 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3033 | obj = bsn_flow_idle() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3034 | _version = reader.read("!B")[0] |
| 3035 | assert(_version == 4) |
| 3036 | _type = reader.read("!B")[0] |
| 3037 | assert(_type == 4) |
| 3038 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3039 | orig_reader = reader |
| 3040 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3041 | obj.xid = reader.read("!L")[0] |
| 3042 | _experimenter = reader.read("!L")[0] |
| 3043 | assert(_experimenter == 6035143) |
| 3044 | _subtype = reader.read("!L")[0] |
| 3045 | assert(_subtype == 40) |
| 3046 | obj.cookie = reader.read("!Q")[0] |
| 3047 | obj.priority = reader.read("!H")[0] |
| 3048 | obj.table_id = reader.read("!B")[0] |
| 3049 | reader.skip(5) |
| 3050 | obj.match = common.match.unpack(reader) |
| 3051 | return obj |
| 3052 | |
| 3053 | def __eq__(self, other): |
| 3054 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3055 | if self.xid != other.xid: return False |
| 3056 | if self.cookie != other.cookie: return False |
| 3057 | if self.priority != other.priority: return False |
| 3058 | if self.table_id != other.table_id: return False |
| 3059 | if self.match != other.match: return False |
| 3060 | return True |
| 3061 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3062 | def pretty_print(self, q): |
| 3063 | q.text("bsn_flow_idle {") |
| 3064 | with q.group(): |
| 3065 | with q.indent(2): |
| 3066 | q.breakable() |
| 3067 | q.text("xid = "); |
| 3068 | if self.xid != None: |
| 3069 | q.text("%#x" % self.xid) |
| 3070 | else: |
| 3071 | q.text('None') |
| 3072 | q.text(","); q.breakable() |
| 3073 | q.text("cookie = "); |
| 3074 | q.text("%#x" % self.cookie) |
| 3075 | q.text(","); q.breakable() |
| 3076 | q.text("priority = "); |
| 3077 | q.text("%#x" % self.priority) |
| 3078 | q.text(","); q.breakable() |
| 3079 | q.text("table_id = "); |
| 3080 | q.text("%#x" % self.table_id) |
| 3081 | q.text(","); q.breakable() |
| 3082 | q.text("match = "); |
| 3083 | q.pp(self.match) |
| 3084 | q.breakable() |
| 3085 | q.text('}') |
| 3086 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3087 | bsn_header.subtypes[40] = bsn_flow_idle |
| 3088 | |
| 3089 | class bsn_flow_idle_enable_get_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3090 | version = 4 |
| 3091 | type = 4 |
| 3092 | experimenter = 6035143 |
| 3093 | subtype = 39 |
| 3094 | |
| 3095 | def __init__(self, xid=None, enabled=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3096 | if xid != None: |
| 3097 | self.xid = xid |
| 3098 | else: |
| 3099 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3100 | if enabled != None: |
| 3101 | self.enabled = enabled |
| 3102 | else: |
| 3103 | self.enabled = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3104 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3105 | |
| 3106 | def pack(self): |
| 3107 | packed = [] |
| 3108 | packed.append(struct.pack("!B", self.version)) |
| 3109 | packed.append(struct.pack("!B", self.type)) |
| 3110 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3111 | packed.append(struct.pack("!L", self.xid)) |
| 3112 | packed.append(struct.pack("!L", self.experimenter)) |
| 3113 | packed.append(struct.pack("!L", self.subtype)) |
| 3114 | packed.append(struct.pack("!L", self.enabled)) |
| 3115 | length = sum([len(x) for x in packed]) |
| 3116 | packed[2] = struct.pack("!H", length) |
| 3117 | return ''.join(packed) |
| 3118 | |
| 3119 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3120 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3121 | obj = bsn_flow_idle_enable_get_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3122 | _version = reader.read("!B")[0] |
| 3123 | assert(_version == 4) |
| 3124 | _type = reader.read("!B")[0] |
| 3125 | assert(_type == 4) |
| 3126 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3127 | orig_reader = reader |
| 3128 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3129 | obj.xid = reader.read("!L")[0] |
| 3130 | _experimenter = reader.read("!L")[0] |
| 3131 | assert(_experimenter == 6035143) |
| 3132 | _subtype = reader.read("!L")[0] |
| 3133 | assert(_subtype == 39) |
| 3134 | obj.enabled = reader.read("!L")[0] |
| 3135 | return obj |
| 3136 | |
| 3137 | def __eq__(self, other): |
| 3138 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3139 | if self.xid != other.xid: return False |
| 3140 | if self.enabled != other.enabled: return False |
| 3141 | return True |
| 3142 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3143 | def pretty_print(self, q): |
| 3144 | q.text("bsn_flow_idle_enable_get_reply {") |
| 3145 | with q.group(): |
| 3146 | with q.indent(2): |
| 3147 | q.breakable() |
| 3148 | q.text("xid = "); |
| 3149 | if self.xid != None: |
| 3150 | q.text("%#x" % self.xid) |
| 3151 | else: |
| 3152 | q.text('None') |
| 3153 | q.text(","); q.breakable() |
| 3154 | q.text("enabled = "); |
| 3155 | q.text("%#x" % self.enabled) |
| 3156 | q.breakable() |
| 3157 | q.text('}') |
| 3158 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3159 | bsn_header.subtypes[39] = bsn_flow_idle_enable_get_reply |
| 3160 | |
| 3161 | class bsn_flow_idle_enable_get_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3162 | version = 4 |
| 3163 | type = 4 |
| 3164 | experimenter = 6035143 |
| 3165 | subtype = 38 |
| 3166 | |
| 3167 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3168 | if xid != None: |
| 3169 | self.xid = xid |
| 3170 | else: |
| 3171 | self.xid = None |
| 3172 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3173 | |
| 3174 | def pack(self): |
| 3175 | packed = [] |
| 3176 | packed.append(struct.pack("!B", self.version)) |
| 3177 | packed.append(struct.pack("!B", self.type)) |
| 3178 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3179 | packed.append(struct.pack("!L", self.xid)) |
| 3180 | packed.append(struct.pack("!L", self.experimenter)) |
| 3181 | packed.append(struct.pack("!L", self.subtype)) |
| 3182 | length = sum([len(x) for x in packed]) |
| 3183 | packed[2] = struct.pack("!H", length) |
| 3184 | return ''.join(packed) |
| 3185 | |
| 3186 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3187 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3188 | obj = bsn_flow_idle_enable_get_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3189 | _version = reader.read("!B")[0] |
| 3190 | assert(_version == 4) |
| 3191 | _type = reader.read("!B")[0] |
| 3192 | assert(_type == 4) |
| 3193 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3194 | orig_reader = reader |
| 3195 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3196 | obj.xid = reader.read("!L")[0] |
| 3197 | _experimenter = reader.read("!L")[0] |
| 3198 | assert(_experimenter == 6035143) |
| 3199 | _subtype = reader.read("!L")[0] |
| 3200 | assert(_subtype == 38) |
| 3201 | return obj |
| 3202 | |
| 3203 | def __eq__(self, other): |
| 3204 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3205 | if self.xid != other.xid: return False |
| 3206 | return True |
| 3207 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3208 | def pretty_print(self, q): |
| 3209 | q.text("bsn_flow_idle_enable_get_request {") |
| 3210 | with q.group(): |
| 3211 | with q.indent(2): |
| 3212 | q.breakable() |
| 3213 | q.text("xid = "); |
| 3214 | if self.xid != None: |
| 3215 | q.text("%#x" % self.xid) |
| 3216 | else: |
| 3217 | q.text('None') |
| 3218 | q.breakable() |
| 3219 | q.text('}') |
| 3220 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3221 | bsn_header.subtypes[38] = bsn_flow_idle_enable_get_request |
| 3222 | |
| 3223 | class bsn_flow_idle_enable_set_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3224 | version = 4 |
| 3225 | type = 4 |
| 3226 | experimenter = 6035143 |
| 3227 | subtype = 37 |
| 3228 | |
| 3229 | def __init__(self, xid=None, enable=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3230 | if xid != None: |
| 3231 | self.xid = xid |
| 3232 | else: |
| 3233 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3234 | if enable != None: |
| 3235 | self.enable = enable |
| 3236 | else: |
| 3237 | self.enable = 0 |
| 3238 | if status != None: |
| 3239 | self.status = status |
| 3240 | else: |
| 3241 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3242 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3243 | |
| 3244 | def pack(self): |
| 3245 | packed = [] |
| 3246 | packed.append(struct.pack("!B", self.version)) |
| 3247 | packed.append(struct.pack("!B", self.type)) |
| 3248 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3249 | packed.append(struct.pack("!L", self.xid)) |
| 3250 | packed.append(struct.pack("!L", self.experimenter)) |
| 3251 | packed.append(struct.pack("!L", self.subtype)) |
| 3252 | packed.append(struct.pack("!L", self.enable)) |
| 3253 | packed.append(struct.pack("!L", self.status)) |
| 3254 | length = sum([len(x) for x in packed]) |
| 3255 | packed[2] = struct.pack("!H", length) |
| 3256 | return ''.join(packed) |
| 3257 | |
| 3258 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3259 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3260 | obj = bsn_flow_idle_enable_set_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3261 | _version = reader.read("!B")[0] |
| 3262 | assert(_version == 4) |
| 3263 | _type = reader.read("!B")[0] |
| 3264 | assert(_type == 4) |
| 3265 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3266 | orig_reader = reader |
| 3267 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3268 | obj.xid = reader.read("!L")[0] |
| 3269 | _experimenter = reader.read("!L")[0] |
| 3270 | assert(_experimenter == 6035143) |
| 3271 | _subtype = reader.read("!L")[0] |
| 3272 | assert(_subtype == 37) |
| 3273 | obj.enable = reader.read("!L")[0] |
| 3274 | obj.status = reader.read("!L")[0] |
| 3275 | return obj |
| 3276 | |
| 3277 | def __eq__(self, other): |
| 3278 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3279 | if self.xid != other.xid: return False |
| 3280 | if self.enable != other.enable: return False |
| 3281 | if self.status != other.status: return False |
| 3282 | return True |
| 3283 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3284 | def pretty_print(self, q): |
| 3285 | q.text("bsn_flow_idle_enable_set_reply {") |
| 3286 | with q.group(): |
| 3287 | with q.indent(2): |
| 3288 | q.breakable() |
| 3289 | q.text("xid = "); |
| 3290 | if self.xid != None: |
| 3291 | q.text("%#x" % self.xid) |
| 3292 | else: |
| 3293 | q.text('None') |
| 3294 | q.text(","); q.breakable() |
| 3295 | q.text("enable = "); |
| 3296 | q.text("%#x" % self.enable) |
| 3297 | q.text(","); q.breakable() |
| 3298 | q.text("status = "); |
| 3299 | q.text("%#x" % self.status) |
| 3300 | q.breakable() |
| 3301 | q.text('}') |
| 3302 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3303 | bsn_header.subtypes[37] = bsn_flow_idle_enable_set_reply |
| 3304 | |
| 3305 | class bsn_flow_idle_enable_set_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3306 | version = 4 |
| 3307 | type = 4 |
| 3308 | experimenter = 6035143 |
| 3309 | subtype = 36 |
| 3310 | |
| 3311 | def __init__(self, xid=None, enable=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3312 | if xid != None: |
| 3313 | self.xid = xid |
| 3314 | else: |
| 3315 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3316 | if enable != None: |
| 3317 | self.enable = enable |
| 3318 | else: |
| 3319 | self.enable = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3320 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3321 | |
| 3322 | def pack(self): |
| 3323 | packed = [] |
| 3324 | packed.append(struct.pack("!B", self.version)) |
| 3325 | packed.append(struct.pack("!B", self.type)) |
| 3326 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3327 | packed.append(struct.pack("!L", self.xid)) |
| 3328 | packed.append(struct.pack("!L", self.experimenter)) |
| 3329 | packed.append(struct.pack("!L", self.subtype)) |
| 3330 | packed.append(struct.pack("!L", self.enable)) |
| 3331 | length = sum([len(x) for x in packed]) |
| 3332 | packed[2] = struct.pack("!H", length) |
| 3333 | return ''.join(packed) |
| 3334 | |
| 3335 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3336 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3337 | obj = bsn_flow_idle_enable_set_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3338 | _version = reader.read("!B")[0] |
| 3339 | assert(_version == 4) |
| 3340 | _type = reader.read("!B")[0] |
| 3341 | assert(_type == 4) |
| 3342 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3343 | orig_reader = reader |
| 3344 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3345 | obj.xid = reader.read("!L")[0] |
| 3346 | _experimenter = reader.read("!L")[0] |
| 3347 | assert(_experimenter == 6035143) |
| 3348 | _subtype = reader.read("!L")[0] |
| 3349 | assert(_subtype == 36) |
| 3350 | obj.enable = reader.read("!L")[0] |
| 3351 | return obj |
| 3352 | |
| 3353 | def __eq__(self, other): |
| 3354 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3355 | if self.xid != other.xid: return False |
| 3356 | if self.enable != other.enable: return False |
| 3357 | return True |
| 3358 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3359 | def pretty_print(self, q): |
| 3360 | q.text("bsn_flow_idle_enable_set_request {") |
| 3361 | with q.group(): |
| 3362 | with q.indent(2): |
| 3363 | q.breakable() |
| 3364 | q.text("xid = "); |
| 3365 | if self.xid != None: |
| 3366 | q.text("%#x" % self.xid) |
| 3367 | else: |
| 3368 | q.text('None') |
| 3369 | q.text(","); q.breakable() |
| 3370 | q.text("enable = "); |
| 3371 | q.text("%#x" % self.enable) |
| 3372 | q.breakable() |
| 3373 | q.text('}') |
| 3374 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3375 | bsn_header.subtypes[36] = bsn_flow_idle_enable_set_request |
| 3376 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3377 | class bsn_gentable_bucket_stats_reply(bsn_stats_reply): |
| 3378 | version = 4 |
| 3379 | type = 19 |
| 3380 | stats_type = 65535 |
| 3381 | experimenter = 6035143 |
| 3382 | subtype = 5 |
| 3383 | |
| 3384 | def __init__(self, xid=None, flags=None, entries=None): |
| 3385 | if xid != None: |
| 3386 | self.xid = xid |
| 3387 | else: |
| 3388 | self.xid = None |
| 3389 | if flags != None: |
| 3390 | self.flags = flags |
| 3391 | else: |
| 3392 | self.flags = 0 |
| 3393 | if entries != None: |
| 3394 | self.entries = entries |
| 3395 | else: |
| 3396 | self.entries = [] |
| 3397 | return |
| 3398 | |
| 3399 | def pack(self): |
| 3400 | packed = [] |
| 3401 | packed.append(struct.pack("!B", self.version)) |
| 3402 | packed.append(struct.pack("!B", self.type)) |
| 3403 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3404 | packed.append(struct.pack("!L", self.xid)) |
| 3405 | packed.append(struct.pack("!H", self.stats_type)) |
| 3406 | packed.append(struct.pack("!H", self.flags)) |
| 3407 | packed.append('\x00' * 4) |
| 3408 | packed.append(struct.pack("!L", self.experimenter)) |
| 3409 | packed.append(struct.pack("!L", self.subtype)) |
| 3410 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 3411 | length = sum([len(x) for x in packed]) |
| 3412 | packed[2] = struct.pack("!H", length) |
| 3413 | return ''.join(packed) |
| 3414 | |
| 3415 | @staticmethod |
| 3416 | def unpack(reader): |
| 3417 | obj = bsn_gentable_bucket_stats_reply() |
| 3418 | _version = reader.read("!B")[0] |
| 3419 | assert(_version == 4) |
| 3420 | _type = reader.read("!B")[0] |
| 3421 | assert(_type == 19) |
| 3422 | _length = reader.read("!H")[0] |
| 3423 | orig_reader = reader |
| 3424 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3425 | obj.xid = reader.read("!L")[0] |
| 3426 | _stats_type = reader.read("!H")[0] |
| 3427 | assert(_stats_type == 65535) |
| 3428 | obj.flags = reader.read("!H")[0] |
| 3429 | reader.skip(4) |
| 3430 | _experimenter = reader.read("!L")[0] |
| 3431 | assert(_experimenter == 6035143) |
| 3432 | _subtype = reader.read("!L")[0] |
| 3433 | assert(_subtype == 5) |
| 3434 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_bucket_stats_entry.unpack) |
| 3435 | return obj |
| 3436 | |
| 3437 | def __eq__(self, other): |
| 3438 | if type(self) != type(other): return False |
| 3439 | if self.xid != other.xid: return False |
| 3440 | if self.flags != other.flags: return False |
| 3441 | if self.entries != other.entries: return False |
| 3442 | return True |
| 3443 | |
| 3444 | def pretty_print(self, q): |
| 3445 | q.text("bsn_gentable_bucket_stats_reply {") |
| 3446 | with q.group(): |
| 3447 | with q.indent(2): |
| 3448 | q.breakable() |
| 3449 | q.text("xid = "); |
| 3450 | if self.xid != None: |
| 3451 | q.text("%#x" % self.xid) |
| 3452 | else: |
| 3453 | q.text('None') |
| 3454 | q.text(","); q.breakable() |
| 3455 | q.text("flags = "); |
| 3456 | q.text("%#x" % self.flags) |
| 3457 | q.text(","); q.breakable() |
| 3458 | q.text("entries = "); |
| 3459 | q.pp(self.entries) |
| 3460 | q.breakable() |
| 3461 | q.text('}') |
| 3462 | |
| 3463 | bsn_stats_reply.subtypes[5] = bsn_gentable_bucket_stats_reply |
| 3464 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3465 | class bsn_gentable_bucket_stats_request(bsn_stats_request): |
| 3466 | version = 4 |
| 3467 | type = 18 |
| 3468 | stats_type = 65535 |
| 3469 | experimenter = 6035143 |
| 3470 | subtype = 5 |
| 3471 | |
| 3472 | def __init__(self, xid=None, flags=None, table_id=None): |
| 3473 | if xid != None: |
| 3474 | self.xid = xid |
| 3475 | else: |
| 3476 | self.xid = None |
| 3477 | if flags != None: |
| 3478 | self.flags = flags |
| 3479 | else: |
| 3480 | self.flags = 0 |
| 3481 | if table_id != None: |
| 3482 | self.table_id = table_id |
| 3483 | else: |
| 3484 | self.table_id = 0 |
| 3485 | return |
| 3486 | |
| 3487 | def pack(self): |
| 3488 | packed = [] |
| 3489 | packed.append(struct.pack("!B", self.version)) |
| 3490 | packed.append(struct.pack("!B", self.type)) |
| 3491 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3492 | packed.append(struct.pack("!L", self.xid)) |
| 3493 | packed.append(struct.pack("!H", self.stats_type)) |
| 3494 | packed.append(struct.pack("!H", self.flags)) |
| 3495 | packed.append('\x00' * 4) |
| 3496 | packed.append(struct.pack("!L", self.experimenter)) |
| 3497 | packed.append(struct.pack("!L", self.subtype)) |
| 3498 | packed.append(struct.pack("!H", self.table_id)) |
| 3499 | length = sum([len(x) for x in packed]) |
| 3500 | packed[2] = struct.pack("!H", length) |
| 3501 | return ''.join(packed) |
| 3502 | |
| 3503 | @staticmethod |
| 3504 | def unpack(reader): |
| 3505 | obj = bsn_gentable_bucket_stats_request() |
| 3506 | _version = reader.read("!B")[0] |
| 3507 | assert(_version == 4) |
| 3508 | _type = reader.read("!B")[0] |
| 3509 | assert(_type == 18) |
| 3510 | _length = reader.read("!H")[0] |
| 3511 | orig_reader = reader |
| 3512 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3513 | obj.xid = reader.read("!L")[0] |
| 3514 | _stats_type = reader.read("!H")[0] |
| 3515 | assert(_stats_type == 65535) |
| 3516 | obj.flags = reader.read("!H")[0] |
| 3517 | reader.skip(4) |
| 3518 | _experimenter = reader.read("!L")[0] |
| 3519 | assert(_experimenter == 6035143) |
| 3520 | _subtype = reader.read("!L")[0] |
| 3521 | assert(_subtype == 5) |
| 3522 | obj.table_id = reader.read("!H")[0] |
| 3523 | return obj |
| 3524 | |
| 3525 | def __eq__(self, other): |
| 3526 | if type(self) != type(other): return False |
| 3527 | if self.xid != other.xid: return False |
| 3528 | if self.flags != other.flags: return False |
| 3529 | if self.table_id != other.table_id: return False |
| 3530 | return True |
| 3531 | |
| 3532 | def pretty_print(self, q): |
| 3533 | q.text("bsn_gentable_bucket_stats_request {") |
| 3534 | with q.group(): |
| 3535 | with q.indent(2): |
| 3536 | q.breakable() |
| 3537 | q.text("xid = "); |
| 3538 | if self.xid != None: |
| 3539 | q.text("%#x" % self.xid) |
| 3540 | else: |
| 3541 | q.text('None') |
| 3542 | q.text(","); q.breakable() |
| 3543 | q.text("flags = "); |
| 3544 | q.text("%#x" % self.flags) |
| 3545 | q.text(","); q.breakable() |
| 3546 | q.text("table_id = "); |
| 3547 | q.text("%#x" % self.table_id) |
| 3548 | q.breakable() |
| 3549 | q.text('}') |
| 3550 | |
| 3551 | bsn_stats_request.subtypes[5] = bsn_gentable_bucket_stats_request |
| 3552 | |
| 3553 | class bsn_gentable_clear_reply(bsn_header): |
| 3554 | version = 4 |
| 3555 | type = 4 |
| 3556 | experimenter = 6035143 |
| 3557 | subtype = 49 |
| 3558 | |
| 3559 | def __init__(self, xid=None, table_id=None, deleted_count=None, error_count=None): |
| 3560 | if xid != None: |
| 3561 | self.xid = xid |
| 3562 | else: |
| 3563 | self.xid = None |
| 3564 | if table_id != None: |
| 3565 | self.table_id = table_id |
| 3566 | else: |
| 3567 | self.table_id = 0 |
| 3568 | if deleted_count != None: |
| 3569 | self.deleted_count = deleted_count |
| 3570 | else: |
| 3571 | self.deleted_count = 0 |
| 3572 | if error_count != None: |
| 3573 | self.error_count = error_count |
| 3574 | else: |
| 3575 | self.error_count = 0 |
| 3576 | return |
| 3577 | |
| 3578 | def pack(self): |
| 3579 | packed = [] |
| 3580 | packed.append(struct.pack("!B", self.version)) |
| 3581 | packed.append(struct.pack("!B", self.type)) |
| 3582 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3583 | packed.append(struct.pack("!L", self.xid)) |
| 3584 | packed.append(struct.pack("!L", self.experimenter)) |
| 3585 | packed.append(struct.pack("!L", self.subtype)) |
| 3586 | packed.append(struct.pack("!H", self.table_id)) |
| 3587 | packed.append('\x00' * 2) |
| 3588 | packed.append(struct.pack("!L", self.deleted_count)) |
| 3589 | packed.append(struct.pack("!L", self.error_count)) |
| 3590 | length = sum([len(x) for x in packed]) |
| 3591 | packed[2] = struct.pack("!H", length) |
| 3592 | return ''.join(packed) |
| 3593 | |
| 3594 | @staticmethod |
| 3595 | def unpack(reader): |
| 3596 | obj = bsn_gentable_clear_reply() |
| 3597 | _version = reader.read("!B")[0] |
| 3598 | assert(_version == 4) |
| 3599 | _type = reader.read("!B")[0] |
| 3600 | assert(_type == 4) |
| 3601 | _length = reader.read("!H")[0] |
| 3602 | orig_reader = reader |
| 3603 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3604 | obj.xid = reader.read("!L")[0] |
| 3605 | _experimenter = reader.read("!L")[0] |
| 3606 | assert(_experimenter == 6035143) |
| 3607 | _subtype = reader.read("!L")[0] |
| 3608 | assert(_subtype == 49) |
| 3609 | obj.table_id = reader.read("!H")[0] |
| 3610 | reader.skip(2) |
| 3611 | obj.deleted_count = reader.read("!L")[0] |
| 3612 | obj.error_count = reader.read("!L")[0] |
| 3613 | return obj |
| 3614 | |
| 3615 | def __eq__(self, other): |
| 3616 | if type(self) != type(other): return False |
| 3617 | if self.xid != other.xid: return False |
| 3618 | if self.table_id != other.table_id: return False |
| 3619 | if self.deleted_count != other.deleted_count: return False |
| 3620 | if self.error_count != other.error_count: return False |
| 3621 | return True |
| 3622 | |
| 3623 | def pretty_print(self, q): |
| 3624 | q.text("bsn_gentable_clear_reply {") |
| 3625 | with q.group(): |
| 3626 | with q.indent(2): |
| 3627 | q.breakable() |
| 3628 | q.text("xid = "); |
| 3629 | if self.xid != None: |
| 3630 | q.text("%#x" % self.xid) |
| 3631 | else: |
| 3632 | q.text('None') |
| 3633 | q.text(","); q.breakable() |
| 3634 | q.text("table_id = "); |
| 3635 | q.text("%#x" % self.table_id) |
| 3636 | q.text(","); q.breakable() |
| 3637 | q.text("deleted_count = "); |
| 3638 | q.text("%#x" % self.deleted_count) |
| 3639 | q.text(","); q.breakable() |
| 3640 | q.text("error_count = "); |
| 3641 | q.text("%#x" % self.error_count) |
| 3642 | q.breakable() |
| 3643 | q.text('}') |
| 3644 | |
| 3645 | bsn_header.subtypes[49] = bsn_gentable_clear_reply |
| 3646 | |
| 3647 | class bsn_gentable_clear_request(bsn_header): |
| 3648 | version = 4 |
| 3649 | type = 4 |
| 3650 | experimenter = 6035143 |
| 3651 | subtype = 48 |
| 3652 | |
| 3653 | def __init__(self, xid=None, table_id=None, checksum=None, checksum_mask=None): |
| 3654 | if xid != None: |
| 3655 | self.xid = xid |
| 3656 | else: |
| 3657 | self.xid = None |
| 3658 | if table_id != None: |
| 3659 | self.table_id = table_id |
| 3660 | else: |
| 3661 | self.table_id = 0 |
| 3662 | if checksum != None: |
| 3663 | self.checksum = checksum |
| 3664 | else: |
| 3665 | self.checksum = 0 |
| 3666 | if checksum_mask != None: |
| 3667 | self.checksum_mask = checksum_mask |
| 3668 | else: |
| 3669 | self.checksum_mask = 0 |
| 3670 | return |
| 3671 | |
| 3672 | def pack(self): |
| 3673 | packed = [] |
| 3674 | packed.append(struct.pack("!B", self.version)) |
| 3675 | packed.append(struct.pack("!B", self.type)) |
| 3676 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3677 | packed.append(struct.pack("!L", self.xid)) |
| 3678 | packed.append(struct.pack("!L", self.experimenter)) |
| 3679 | packed.append(struct.pack("!L", self.subtype)) |
| 3680 | packed.append(struct.pack("!H", self.table_id)) |
| 3681 | packed.append('\x00' * 2) |
| 3682 | packed.append(util.pack_checksum_128(self.checksum)) |
| 3683 | packed.append(util.pack_checksum_128(self.checksum_mask)) |
| 3684 | length = sum([len(x) for x in packed]) |
| 3685 | packed[2] = struct.pack("!H", length) |
| 3686 | return ''.join(packed) |
| 3687 | |
| 3688 | @staticmethod |
| 3689 | def unpack(reader): |
| 3690 | obj = bsn_gentable_clear_request() |
| 3691 | _version = reader.read("!B")[0] |
| 3692 | assert(_version == 4) |
| 3693 | _type = reader.read("!B")[0] |
| 3694 | assert(_type == 4) |
| 3695 | _length = reader.read("!H")[0] |
| 3696 | orig_reader = reader |
| 3697 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3698 | obj.xid = reader.read("!L")[0] |
| 3699 | _experimenter = reader.read("!L")[0] |
| 3700 | assert(_experimenter == 6035143) |
| 3701 | _subtype = reader.read("!L")[0] |
| 3702 | assert(_subtype == 48) |
| 3703 | obj.table_id = reader.read("!H")[0] |
| 3704 | reader.skip(2) |
| 3705 | obj.checksum = util.unpack_checksum_128(reader) |
| 3706 | obj.checksum_mask = util.unpack_checksum_128(reader) |
| 3707 | return obj |
| 3708 | |
| 3709 | def __eq__(self, other): |
| 3710 | if type(self) != type(other): return False |
| 3711 | if self.xid != other.xid: return False |
| 3712 | if self.table_id != other.table_id: return False |
| 3713 | if self.checksum != other.checksum: return False |
| 3714 | if self.checksum_mask != other.checksum_mask: return False |
| 3715 | return True |
| 3716 | |
| 3717 | def pretty_print(self, q): |
| 3718 | q.text("bsn_gentable_clear_request {") |
| 3719 | with q.group(): |
| 3720 | with q.indent(2): |
| 3721 | q.breakable() |
| 3722 | q.text("xid = "); |
| 3723 | if self.xid != None: |
| 3724 | q.text("%#x" % self.xid) |
| 3725 | else: |
| 3726 | q.text('None') |
| 3727 | q.text(","); q.breakable() |
| 3728 | q.text("table_id = "); |
| 3729 | q.text("%#x" % self.table_id) |
| 3730 | q.text(","); q.breakable() |
| 3731 | q.text("checksum = "); |
| 3732 | q.pp(self.checksum) |
| 3733 | q.text(","); q.breakable() |
| 3734 | q.text("checksum_mask = "); |
| 3735 | q.pp(self.checksum_mask) |
| 3736 | q.breakable() |
| 3737 | q.text('}') |
| 3738 | |
| 3739 | bsn_header.subtypes[48] = bsn_gentable_clear_request |
| 3740 | |
| 3741 | class bsn_gentable_desc_stats_reply(bsn_stats_reply): |
| 3742 | version = 4 |
| 3743 | type = 19 |
| 3744 | stats_type = 65535 |
| 3745 | experimenter = 6035143 |
| 3746 | subtype = 4 |
| 3747 | |
| 3748 | def __init__(self, xid=None, flags=None, entries=None): |
| 3749 | if xid != None: |
| 3750 | self.xid = xid |
| 3751 | else: |
| 3752 | self.xid = None |
| 3753 | if flags != None: |
| 3754 | self.flags = flags |
| 3755 | else: |
| 3756 | self.flags = 0 |
| 3757 | if entries != None: |
| 3758 | self.entries = entries |
| 3759 | else: |
| 3760 | self.entries = [] |
| 3761 | return |
| 3762 | |
| 3763 | def pack(self): |
| 3764 | packed = [] |
| 3765 | packed.append(struct.pack("!B", self.version)) |
| 3766 | packed.append(struct.pack("!B", self.type)) |
| 3767 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3768 | packed.append(struct.pack("!L", self.xid)) |
| 3769 | packed.append(struct.pack("!H", self.stats_type)) |
| 3770 | packed.append(struct.pack("!H", self.flags)) |
| 3771 | packed.append('\x00' * 4) |
| 3772 | packed.append(struct.pack("!L", self.experimenter)) |
| 3773 | packed.append(struct.pack("!L", self.subtype)) |
| 3774 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 3775 | length = sum([len(x) for x in packed]) |
| 3776 | packed[2] = struct.pack("!H", length) |
| 3777 | return ''.join(packed) |
| 3778 | |
| 3779 | @staticmethod |
| 3780 | def unpack(reader): |
| 3781 | obj = bsn_gentable_desc_stats_reply() |
| 3782 | _version = reader.read("!B")[0] |
| 3783 | assert(_version == 4) |
| 3784 | _type = reader.read("!B")[0] |
| 3785 | assert(_type == 19) |
| 3786 | _length = reader.read("!H")[0] |
| 3787 | orig_reader = reader |
| 3788 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3789 | obj.xid = reader.read("!L")[0] |
| 3790 | _stats_type = reader.read("!H")[0] |
| 3791 | assert(_stats_type == 65535) |
| 3792 | obj.flags = reader.read("!H")[0] |
| 3793 | reader.skip(4) |
| 3794 | _experimenter = reader.read("!L")[0] |
| 3795 | assert(_experimenter == 6035143) |
| 3796 | _subtype = reader.read("!L")[0] |
| 3797 | assert(_subtype == 4) |
| 3798 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_desc_stats_entry.unpack) |
| 3799 | return obj |
| 3800 | |
| 3801 | def __eq__(self, other): |
| 3802 | if type(self) != type(other): return False |
| 3803 | if self.xid != other.xid: return False |
| 3804 | if self.flags != other.flags: return False |
| 3805 | if self.entries != other.entries: return False |
| 3806 | return True |
| 3807 | |
| 3808 | def pretty_print(self, q): |
| 3809 | q.text("bsn_gentable_desc_stats_reply {") |
| 3810 | with q.group(): |
| 3811 | with q.indent(2): |
| 3812 | q.breakable() |
| 3813 | q.text("xid = "); |
| 3814 | if self.xid != None: |
| 3815 | q.text("%#x" % self.xid) |
| 3816 | else: |
| 3817 | q.text('None') |
| 3818 | q.text(","); q.breakable() |
| 3819 | q.text("flags = "); |
| 3820 | q.text("%#x" % self.flags) |
| 3821 | q.text(","); q.breakable() |
| 3822 | q.text("entries = "); |
| 3823 | q.pp(self.entries) |
| 3824 | q.breakable() |
| 3825 | q.text('}') |
| 3826 | |
| 3827 | bsn_stats_reply.subtypes[4] = bsn_gentable_desc_stats_reply |
| 3828 | |
| 3829 | class bsn_gentable_desc_stats_request(bsn_stats_request): |
| 3830 | version = 4 |
| 3831 | type = 18 |
| 3832 | stats_type = 65535 |
| 3833 | experimenter = 6035143 |
| 3834 | subtype = 4 |
| 3835 | |
| 3836 | def __init__(self, xid=None, flags=None): |
| 3837 | if xid != None: |
| 3838 | self.xid = xid |
| 3839 | else: |
| 3840 | self.xid = None |
| 3841 | if flags != None: |
| 3842 | self.flags = flags |
| 3843 | else: |
| 3844 | self.flags = 0 |
| 3845 | return |
| 3846 | |
| 3847 | def pack(self): |
| 3848 | packed = [] |
| 3849 | packed.append(struct.pack("!B", self.version)) |
| 3850 | packed.append(struct.pack("!B", self.type)) |
| 3851 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3852 | packed.append(struct.pack("!L", self.xid)) |
| 3853 | packed.append(struct.pack("!H", self.stats_type)) |
| 3854 | packed.append(struct.pack("!H", self.flags)) |
| 3855 | packed.append('\x00' * 4) |
| 3856 | packed.append(struct.pack("!L", self.experimenter)) |
| 3857 | packed.append(struct.pack("!L", self.subtype)) |
| 3858 | length = sum([len(x) for x in packed]) |
| 3859 | packed[2] = struct.pack("!H", length) |
| 3860 | return ''.join(packed) |
| 3861 | |
| 3862 | @staticmethod |
| 3863 | def unpack(reader): |
| 3864 | obj = bsn_gentable_desc_stats_request() |
| 3865 | _version = reader.read("!B")[0] |
| 3866 | assert(_version == 4) |
| 3867 | _type = reader.read("!B")[0] |
| 3868 | assert(_type == 18) |
| 3869 | _length = reader.read("!H")[0] |
| 3870 | orig_reader = reader |
| 3871 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3872 | obj.xid = reader.read("!L")[0] |
| 3873 | _stats_type = reader.read("!H")[0] |
| 3874 | assert(_stats_type == 65535) |
| 3875 | obj.flags = reader.read("!H")[0] |
| 3876 | reader.skip(4) |
| 3877 | _experimenter = reader.read("!L")[0] |
| 3878 | assert(_experimenter == 6035143) |
| 3879 | _subtype = reader.read("!L")[0] |
| 3880 | assert(_subtype == 4) |
| 3881 | return obj |
| 3882 | |
| 3883 | def __eq__(self, other): |
| 3884 | if type(self) != type(other): return False |
| 3885 | if self.xid != other.xid: return False |
| 3886 | if self.flags != other.flags: return False |
| 3887 | return True |
| 3888 | |
| 3889 | def pretty_print(self, q): |
| 3890 | q.text("bsn_gentable_desc_stats_request {") |
| 3891 | with q.group(): |
| 3892 | with q.indent(2): |
| 3893 | q.breakable() |
| 3894 | q.text("xid = "); |
| 3895 | if self.xid != None: |
| 3896 | q.text("%#x" % self.xid) |
| 3897 | else: |
| 3898 | q.text('None') |
| 3899 | q.text(","); q.breakable() |
| 3900 | q.text("flags = "); |
| 3901 | q.text("%#x" % self.flags) |
| 3902 | q.breakable() |
| 3903 | q.text('}') |
| 3904 | |
| 3905 | bsn_stats_request.subtypes[4] = bsn_gentable_desc_stats_request |
| 3906 | |
| 3907 | class bsn_gentable_entry_add(bsn_header): |
| 3908 | version = 4 |
| 3909 | type = 4 |
| 3910 | experimenter = 6035143 |
| 3911 | subtype = 46 |
| 3912 | |
| 3913 | def __init__(self, xid=None, table_id=None, checksum=None, key=None, value=None): |
| 3914 | if xid != None: |
| 3915 | self.xid = xid |
| 3916 | else: |
| 3917 | self.xid = None |
| 3918 | if table_id != None: |
| 3919 | self.table_id = table_id |
| 3920 | else: |
| 3921 | self.table_id = 0 |
| 3922 | if checksum != None: |
| 3923 | self.checksum = checksum |
| 3924 | else: |
| 3925 | self.checksum = 0 |
| 3926 | if key != None: |
| 3927 | self.key = key |
| 3928 | else: |
| 3929 | self.key = [] |
| 3930 | if value != None: |
| 3931 | self.value = value |
| 3932 | else: |
| 3933 | self.value = [] |
| 3934 | return |
| 3935 | |
| 3936 | def pack(self): |
| 3937 | packed = [] |
| 3938 | packed.append(struct.pack("!B", self.version)) |
| 3939 | packed.append(struct.pack("!B", self.type)) |
| 3940 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3941 | packed.append(struct.pack("!L", self.xid)) |
| 3942 | packed.append(struct.pack("!L", self.experimenter)) |
| 3943 | packed.append(struct.pack("!L", self.subtype)) |
| 3944 | packed.append(struct.pack("!H", self.table_id)) |
| 3945 | packed.append(struct.pack("!H", 0)) # placeholder for key_length at index 7 |
| 3946 | packed.append(util.pack_checksum_128(self.checksum)) |
| 3947 | packed.append(loxi.generic_util.pack_list(self.key)) |
| 3948 | packed[7] = struct.pack("!H", len(packed[-1])) |
| 3949 | packed.append(loxi.generic_util.pack_list(self.value)) |
| 3950 | length = sum([len(x) for x in packed]) |
| 3951 | packed[2] = struct.pack("!H", length) |
| 3952 | return ''.join(packed) |
| 3953 | |
| 3954 | @staticmethod |
| 3955 | def unpack(reader): |
| 3956 | obj = bsn_gentable_entry_add() |
| 3957 | _version = reader.read("!B")[0] |
| 3958 | assert(_version == 4) |
| 3959 | _type = reader.read("!B")[0] |
| 3960 | assert(_type == 4) |
| 3961 | _length = reader.read("!H")[0] |
| 3962 | orig_reader = reader |
| 3963 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3964 | obj.xid = reader.read("!L")[0] |
| 3965 | _experimenter = reader.read("!L")[0] |
| 3966 | assert(_experimenter == 6035143) |
| 3967 | _subtype = reader.read("!L")[0] |
| 3968 | assert(_subtype == 46) |
| 3969 | obj.table_id = reader.read("!H")[0] |
| 3970 | _key_length = reader.read("!H")[0] |
| 3971 | obj.checksum = util.unpack_checksum_128(reader) |
| 3972 | obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), bsn_tlv.bsn_tlv.unpack) |
| 3973 | obj.value = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack) |
| 3974 | return obj |
| 3975 | |
| 3976 | def __eq__(self, other): |
| 3977 | if type(self) != type(other): return False |
| 3978 | if self.xid != other.xid: return False |
| 3979 | if self.table_id != other.table_id: return False |
| 3980 | if self.checksum != other.checksum: return False |
| 3981 | if self.key != other.key: return False |
| 3982 | if self.value != other.value: return False |
| 3983 | return True |
| 3984 | |
| 3985 | def pretty_print(self, q): |
| 3986 | q.text("bsn_gentable_entry_add {") |
| 3987 | with q.group(): |
| 3988 | with q.indent(2): |
| 3989 | q.breakable() |
| 3990 | q.text("xid = "); |
| 3991 | if self.xid != None: |
| 3992 | q.text("%#x" % self.xid) |
| 3993 | else: |
| 3994 | q.text('None') |
| 3995 | q.text(","); q.breakable() |
| 3996 | q.text("table_id = "); |
| 3997 | q.text("%#x" % self.table_id) |
| 3998 | q.text(","); q.breakable() |
| 3999 | q.text("checksum = "); |
| 4000 | q.pp(self.checksum) |
| 4001 | q.text(","); q.breakable() |
| 4002 | q.text("key = "); |
| 4003 | q.pp(self.key) |
| 4004 | q.text(","); q.breakable() |
| 4005 | q.text("value = "); |
| 4006 | q.pp(self.value) |
| 4007 | q.breakable() |
| 4008 | q.text('}') |
| 4009 | |
| 4010 | bsn_header.subtypes[46] = bsn_gentable_entry_add |
| 4011 | |
| 4012 | class bsn_gentable_entry_delete(bsn_header): |
| 4013 | version = 4 |
| 4014 | type = 4 |
| 4015 | experimenter = 6035143 |
| 4016 | subtype = 47 |
| 4017 | |
| 4018 | def __init__(self, xid=None, table_id=None, key=None): |
| 4019 | if xid != None: |
| 4020 | self.xid = xid |
| 4021 | else: |
| 4022 | self.xid = None |
| 4023 | if table_id != None: |
| 4024 | self.table_id = table_id |
| 4025 | else: |
| 4026 | self.table_id = 0 |
| 4027 | if key != None: |
| 4028 | self.key = key |
| 4029 | else: |
| 4030 | self.key = [] |
| 4031 | return |
| 4032 | |
| 4033 | def pack(self): |
| 4034 | packed = [] |
| 4035 | packed.append(struct.pack("!B", self.version)) |
| 4036 | packed.append(struct.pack("!B", self.type)) |
| 4037 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4038 | packed.append(struct.pack("!L", self.xid)) |
| 4039 | packed.append(struct.pack("!L", self.experimenter)) |
| 4040 | packed.append(struct.pack("!L", self.subtype)) |
| 4041 | packed.append(struct.pack("!H", self.table_id)) |
| 4042 | packed.append(loxi.generic_util.pack_list(self.key)) |
| 4043 | length = sum([len(x) for x in packed]) |
| 4044 | packed[2] = struct.pack("!H", length) |
| 4045 | return ''.join(packed) |
| 4046 | |
| 4047 | @staticmethod |
| 4048 | def unpack(reader): |
| 4049 | obj = bsn_gentable_entry_delete() |
| 4050 | _version = reader.read("!B")[0] |
| 4051 | assert(_version == 4) |
| 4052 | _type = reader.read("!B")[0] |
| 4053 | assert(_type == 4) |
| 4054 | _length = reader.read("!H")[0] |
| 4055 | orig_reader = reader |
| 4056 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4057 | obj.xid = reader.read("!L")[0] |
| 4058 | _experimenter = reader.read("!L")[0] |
| 4059 | assert(_experimenter == 6035143) |
| 4060 | _subtype = reader.read("!L")[0] |
| 4061 | assert(_subtype == 47) |
| 4062 | obj.table_id = reader.read("!H")[0] |
| 4063 | obj.key = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack) |
| 4064 | return obj |
| 4065 | |
| 4066 | def __eq__(self, other): |
| 4067 | if type(self) != type(other): return False |
| 4068 | if self.xid != other.xid: return False |
| 4069 | if self.table_id != other.table_id: return False |
| 4070 | if self.key != other.key: return False |
| 4071 | return True |
| 4072 | |
| 4073 | def pretty_print(self, q): |
| 4074 | q.text("bsn_gentable_entry_delete {") |
| 4075 | with q.group(): |
| 4076 | with q.indent(2): |
| 4077 | q.breakable() |
| 4078 | q.text("xid = "); |
| 4079 | if self.xid != None: |
| 4080 | q.text("%#x" % self.xid) |
| 4081 | else: |
| 4082 | q.text('None') |
| 4083 | q.text(","); q.breakable() |
| 4084 | q.text("table_id = "); |
| 4085 | q.text("%#x" % self.table_id) |
| 4086 | q.text(","); q.breakable() |
| 4087 | q.text("key = "); |
| 4088 | q.pp(self.key) |
| 4089 | q.breakable() |
| 4090 | q.text('}') |
| 4091 | |
| 4092 | bsn_header.subtypes[47] = bsn_gentable_entry_delete |
| 4093 | |
| 4094 | class bsn_gentable_entry_desc_stats_reply(bsn_stats_reply): |
| 4095 | version = 4 |
| 4096 | type = 19 |
| 4097 | stats_type = 65535 |
| 4098 | experimenter = 6035143 |
| 4099 | subtype = 2 |
| 4100 | |
| 4101 | def __init__(self, xid=None, flags=None, entries=None): |
| 4102 | if xid != None: |
| 4103 | self.xid = xid |
| 4104 | else: |
| 4105 | self.xid = None |
| 4106 | if flags != None: |
| 4107 | self.flags = flags |
| 4108 | else: |
| 4109 | self.flags = 0 |
| 4110 | if entries != None: |
| 4111 | self.entries = entries |
| 4112 | else: |
| 4113 | self.entries = [] |
| 4114 | return |
| 4115 | |
| 4116 | def pack(self): |
| 4117 | packed = [] |
| 4118 | packed.append(struct.pack("!B", self.version)) |
| 4119 | packed.append(struct.pack("!B", self.type)) |
| 4120 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4121 | packed.append(struct.pack("!L", self.xid)) |
| 4122 | packed.append(struct.pack("!H", self.stats_type)) |
| 4123 | packed.append(struct.pack("!H", self.flags)) |
| 4124 | packed.append('\x00' * 4) |
| 4125 | packed.append(struct.pack("!L", self.experimenter)) |
| 4126 | packed.append(struct.pack("!L", self.subtype)) |
| 4127 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 4128 | length = sum([len(x) for x in packed]) |
| 4129 | packed[2] = struct.pack("!H", length) |
| 4130 | return ''.join(packed) |
| 4131 | |
| 4132 | @staticmethod |
| 4133 | def unpack(reader): |
| 4134 | obj = bsn_gentable_entry_desc_stats_reply() |
| 4135 | _version = reader.read("!B")[0] |
| 4136 | assert(_version == 4) |
| 4137 | _type = reader.read("!B")[0] |
| 4138 | assert(_type == 19) |
| 4139 | _length = reader.read("!H")[0] |
| 4140 | orig_reader = reader |
| 4141 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4142 | obj.xid = reader.read("!L")[0] |
| 4143 | _stats_type = reader.read("!H")[0] |
| 4144 | assert(_stats_type == 65535) |
| 4145 | obj.flags = reader.read("!H")[0] |
| 4146 | reader.skip(4) |
| 4147 | _experimenter = reader.read("!L")[0] |
| 4148 | assert(_experimenter == 6035143) |
| 4149 | _subtype = reader.read("!L")[0] |
| 4150 | assert(_subtype == 2) |
| 4151 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_entry_desc_stats_entry.unpack) |
| 4152 | return obj |
| 4153 | |
| 4154 | def __eq__(self, other): |
| 4155 | if type(self) != type(other): return False |
| 4156 | if self.xid != other.xid: return False |
| 4157 | if self.flags != other.flags: return False |
| 4158 | if self.entries != other.entries: return False |
| 4159 | return True |
| 4160 | |
| 4161 | def pretty_print(self, q): |
| 4162 | q.text("bsn_gentable_entry_desc_stats_reply {") |
| 4163 | with q.group(): |
| 4164 | with q.indent(2): |
| 4165 | q.breakable() |
| 4166 | q.text("xid = "); |
| 4167 | if self.xid != None: |
| 4168 | q.text("%#x" % self.xid) |
| 4169 | else: |
| 4170 | q.text('None') |
| 4171 | q.text(","); q.breakable() |
| 4172 | q.text("flags = "); |
| 4173 | q.text("%#x" % self.flags) |
| 4174 | q.text(","); q.breakable() |
| 4175 | q.text("entries = "); |
| 4176 | q.pp(self.entries) |
| 4177 | q.breakable() |
| 4178 | q.text('}') |
| 4179 | |
| 4180 | bsn_stats_reply.subtypes[2] = bsn_gentable_entry_desc_stats_reply |
| 4181 | |
| 4182 | class bsn_gentable_entry_desc_stats_request(bsn_stats_request): |
| 4183 | version = 4 |
| 4184 | type = 18 |
| 4185 | stats_type = 65535 |
| 4186 | experimenter = 6035143 |
| 4187 | subtype = 2 |
| 4188 | |
| 4189 | def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None): |
| 4190 | if xid != None: |
| 4191 | self.xid = xid |
| 4192 | else: |
| 4193 | self.xid = None |
| 4194 | if flags != None: |
| 4195 | self.flags = flags |
| 4196 | else: |
| 4197 | self.flags = 0 |
| 4198 | if table_id != None: |
| 4199 | self.table_id = table_id |
| 4200 | else: |
| 4201 | self.table_id = 0 |
| 4202 | if checksum != None: |
| 4203 | self.checksum = checksum |
| 4204 | else: |
| 4205 | self.checksum = 0 |
| 4206 | if checksum_mask != None: |
| 4207 | self.checksum_mask = checksum_mask |
| 4208 | else: |
| 4209 | self.checksum_mask = 0 |
| 4210 | return |
| 4211 | |
| 4212 | def pack(self): |
| 4213 | packed = [] |
| 4214 | packed.append(struct.pack("!B", self.version)) |
| 4215 | packed.append(struct.pack("!B", self.type)) |
| 4216 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4217 | packed.append(struct.pack("!L", self.xid)) |
| 4218 | packed.append(struct.pack("!H", self.stats_type)) |
| 4219 | packed.append(struct.pack("!H", self.flags)) |
| 4220 | packed.append('\x00' * 4) |
| 4221 | packed.append(struct.pack("!L", self.experimenter)) |
| 4222 | packed.append(struct.pack("!L", self.subtype)) |
| 4223 | packed.append(struct.pack("!H", self.table_id)) |
| 4224 | packed.append('\x00' * 2) |
| 4225 | packed.append(util.pack_checksum_128(self.checksum)) |
| 4226 | packed.append(util.pack_checksum_128(self.checksum_mask)) |
| 4227 | length = sum([len(x) for x in packed]) |
| 4228 | packed[2] = struct.pack("!H", length) |
| 4229 | return ''.join(packed) |
| 4230 | |
| 4231 | @staticmethod |
| 4232 | def unpack(reader): |
| 4233 | obj = bsn_gentable_entry_desc_stats_request() |
| 4234 | _version = reader.read("!B")[0] |
| 4235 | assert(_version == 4) |
| 4236 | _type = reader.read("!B")[0] |
| 4237 | assert(_type == 18) |
| 4238 | _length = reader.read("!H")[0] |
| 4239 | orig_reader = reader |
| 4240 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4241 | obj.xid = reader.read("!L")[0] |
| 4242 | _stats_type = reader.read("!H")[0] |
| 4243 | assert(_stats_type == 65535) |
| 4244 | obj.flags = reader.read("!H")[0] |
| 4245 | reader.skip(4) |
| 4246 | _experimenter = reader.read("!L")[0] |
| 4247 | assert(_experimenter == 6035143) |
| 4248 | _subtype = reader.read("!L")[0] |
| 4249 | assert(_subtype == 2) |
| 4250 | obj.table_id = reader.read("!H")[0] |
| 4251 | reader.skip(2) |
| 4252 | obj.checksum = util.unpack_checksum_128(reader) |
| 4253 | obj.checksum_mask = util.unpack_checksum_128(reader) |
| 4254 | return obj |
| 4255 | |
| 4256 | def __eq__(self, other): |
| 4257 | if type(self) != type(other): return False |
| 4258 | if self.xid != other.xid: return False |
| 4259 | if self.flags != other.flags: return False |
| 4260 | if self.table_id != other.table_id: return False |
| 4261 | if self.checksum != other.checksum: return False |
| 4262 | if self.checksum_mask != other.checksum_mask: return False |
| 4263 | return True |
| 4264 | |
| 4265 | def pretty_print(self, q): |
| 4266 | q.text("bsn_gentable_entry_desc_stats_request {") |
| 4267 | with q.group(): |
| 4268 | with q.indent(2): |
| 4269 | q.breakable() |
| 4270 | q.text("xid = "); |
| 4271 | if self.xid != None: |
| 4272 | q.text("%#x" % self.xid) |
| 4273 | else: |
| 4274 | q.text('None') |
| 4275 | q.text(","); q.breakable() |
| 4276 | q.text("flags = "); |
| 4277 | q.text("%#x" % self.flags) |
| 4278 | q.text(","); q.breakable() |
| 4279 | q.text("table_id = "); |
| 4280 | q.text("%#x" % self.table_id) |
| 4281 | q.text(","); q.breakable() |
| 4282 | q.text("checksum = "); |
| 4283 | q.pp(self.checksum) |
| 4284 | q.text(","); q.breakable() |
| 4285 | q.text("checksum_mask = "); |
| 4286 | q.pp(self.checksum_mask) |
| 4287 | q.breakable() |
| 4288 | q.text('}') |
| 4289 | |
| 4290 | bsn_stats_request.subtypes[2] = bsn_gentable_entry_desc_stats_request |
| 4291 | |
| 4292 | class bsn_gentable_entry_stats_reply(bsn_stats_reply): |
| 4293 | version = 4 |
| 4294 | type = 19 |
| 4295 | stats_type = 65535 |
| 4296 | experimenter = 6035143 |
| 4297 | subtype = 3 |
| 4298 | |
| 4299 | def __init__(self, xid=None, flags=None, entries=None): |
| 4300 | if xid != None: |
| 4301 | self.xid = xid |
| 4302 | else: |
| 4303 | self.xid = None |
| 4304 | if flags != None: |
| 4305 | self.flags = flags |
| 4306 | else: |
| 4307 | self.flags = 0 |
| 4308 | if entries != None: |
| 4309 | self.entries = entries |
| 4310 | else: |
| 4311 | self.entries = [] |
| 4312 | return |
| 4313 | |
| 4314 | def pack(self): |
| 4315 | packed = [] |
| 4316 | packed.append(struct.pack("!B", self.version)) |
| 4317 | packed.append(struct.pack("!B", self.type)) |
| 4318 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4319 | packed.append(struct.pack("!L", self.xid)) |
| 4320 | packed.append(struct.pack("!H", self.stats_type)) |
| 4321 | packed.append(struct.pack("!H", self.flags)) |
| 4322 | packed.append('\x00' * 4) |
| 4323 | packed.append(struct.pack("!L", self.experimenter)) |
| 4324 | packed.append(struct.pack("!L", self.subtype)) |
| 4325 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 4326 | length = sum([len(x) for x in packed]) |
| 4327 | packed[2] = struct.pack("!H", length) |
| 4328 | return ''.join(packed) |
| 4329 | |
| 4330 | @staticmethod |
| 4331 | def unpack(reader): |
| 4332 | obj = bsn_gentable_entry_stats_reply() |
| 4333 | _version = reader.read("!B")[0] |
| 4334 | assert(_version == 4) |
| 4335 | _type = reader.read("!B")[0] |
| 4336 | assert(_type == 19) |
| 4337 | _length = reader.read("!H")[0] |
| 4338 | orig_reader = reader |
| 4339 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4340 | obj.xid = reader.read("!L")[0] |
| 4341 | _stats_type = reader.read("!H")[0] |
| 4342 | assert(_stats_type == 65535) |
| 4343 | obj.flags = reader.read("!H")[0] |
| 4344 | reader.skip(4) |
| 4345 | _experimenter = reader.read("!L")[0] |
| 4346 | assert(_experimenter == 6035143) |
| 4347 | _subtype = reader.read("!L")[0] |
| 4348 | assert(_subtype == 3) |
| 4349 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_entry_stats_entry.unpack) |
| 4350 | return obj |
| 4351 | |
| 4352 | def __eq__(self, other): |
| 4353 | if type(self) != type(other): return False |
| 4354 | if self.xid != other.xid: return False |
| 4355 | if self.flags != other.flags: return False |
| 4356 | if self.entries != other.entries: return False |
| 4357 | return True |
| 4358 | |
| 4359 | def pretty_print(self, q): |
| 4360 | q.text("bsn_gentable_entry_stats_reply {") |
| 4361 | with q.group(): |
| 4362 | with q.indent(2): |
| 4363 | q.breakable() |
| 4364 | q.text("xid = "); |
| 4365 | if self.xid != None: |
| 4366 | q.text("%#x" % self.xid) |
| 4367 | else: |
| 4368 | q.text('None') |
| 4369 | q.text(","); q.breakable() |
| 4370 | q.text("flags = "); |
| 4371 | q.text("%#x" % self.flags) |
| 4372 | q.text(","); q.breakable() |
| 4373 | q.text("entries = "); |
| 4374 | q.pp(self.entries) |
| 4375 | q.breakable() |
| 4376 | q.text('}') |
| 4377 | |
| 4378 | bsn_stats_reply.subtypes[3] = bsn_gentable_entry_stats_reply |
| 4379 | |
| 4380 | class bsn_gentable_entry_stats_request(bsn_stats_request): |
| 4381 | version = 4 |
| 4382 | type = 18 |
| 4383 | stats_type = 65535 |
| 4384 | experimenter = 6035143 |
| 4385 | subtype = 3 |
| 4386 | |
| 4387 | def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None): |
| 4388 | if xid != None: |
| 4389 | self.xid = xid |
| 4390 | else: |
| 4391 | self.xid = None |
| 4392 | if flags != None: |
| 4393 | self.flags = flags |
| 4394 | else: |
| 4395 | self.flags = 0 |
| 4396 | if table_id != None: |
| 4397 | self.table_id = table_id |
| 4398 | else: |
| 4399 | self.table_id = 0 |
| 4400 | if checksum != None: |
| 4401 | self.checksum = checksum |
| 4402 | else: |
| 4403 | self.checksum = 0 |
| 4404 | if checksum_mask != None: |
| 4405 | self.checksum_mask = checksum_mask |
| 4406 | else: |
| 4407 | self.checksum_mask = 0 |
| 4408 | return |
| 4409 | |
| 4410 | def pack(self): |
| 4411 | packed = [] |
| 4412 | packed.append(struct.pack("!B", self.version)) |
| 4413 | packed.append(struct.pack("!B", self.type)) |
| 4414 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4415 | packed.append(struct.pack("!L", self.xid)) |
| 4416 | packed.append(struct.pack("!H", self.stats_type)) |
| 4417 | packed.append(struct.pack("!H", self.flags)) |
| 4418 | packed.append('\x00' * 4) |
| 4419 | packed.append(struct.pack("!L", self.experimenter)) |
| 4420 | packed.append(struct.pack("!L", self.subtype)) |
| 4421 | packed.append(struct.pack("!H", self.table_id)) |
| 4422 | packed.append('\x00' * 2) |
| 4423 | packed.append(util.pack_checksum_128(self.checksum)) |
| 4424 | packed.append(util.pack_checksum_128(self.checksum_mask)) |
| 4425 | length = sum([len(x) for x in packed]) |
| 4426 | packed[2] = struct.pack("!H", length) |
| 4427 | return ''.join(packed) |
| 4428 | |
| 4429 | @staticmethod |
| 4430 | def unpack(reader): |
| 4431 | obj = bsn_gentable_entry_stats_request() |
| 4432 | _version = reader.read("!B")[0] |
| 4433 | assert(_version == 4) |
| 4434 | _type = reader.read("!B")[0] |
| 4435 | assert(_type == 18) |
| 4436 | _length = reader.read("!H")[0] |
| 4437 | orig_reader = reader |
| 4438 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4439 | obj.xid = reader.read("!L")[0] |
| 4440 | _stats_type = reader.read("!H")[0] |
| 4441 | assert(_stats_type == 65535) |
| 4442 | obj.flags = reader.read("!H")[0] |
| 4443 | reader.skip(4) |
| 4444 | _experimenter = reader.read("!L")[0] |
| 4445 | assert(_experimenter == 6035143) |
| 4446 | _subtype = reader.read("!L")[0] |
| 4447 | assert(_subtype == 3) |
| 4448 | obj.table_id = reader.read("!H")[0] |
| 4449 | reader.skip(2) |
| 4450 | obj.checksum = util.unpack_checksum_128(reader) |
| 4451 | obj.checksum_mask = util.unpack_checksum_128(reader) |
| 4452 | return obj |
| 4453 | |
| 4454 | def __eq__(self, other): |
| 4455 | if type(self) != type(other): return False |
| 4456 | if self.xid != other.xid: return False |
| 4457 | if self.flags != other.flags: return False |
| 4458 | if self.table_id != other.table_id: return False |
| 4459 | if self.checksum != other.checksum: return False |
| 4460 | if self.checksum_mask != other.checksum_mask: return False |
| 4461 | return True |
| 4462 | |
| 4463 | def pretty_print(self, q): |
| 4464 | q.text("bsn_gentable_entry_stats_request {") |
| 4465 | with q.group(): |
| 4466 | with q.indent(2): |
| 4467 | q.breakable() |
| 4468 | q.text("xid = "); |
| 4469 | if self.xid != None: |
| 4470 | q.text("%#x" % self.xid) |
| 4471 | else: |
| 4472 | q.text('None') |
| 4473 | q.text(","); q.breakable() |
| 4474 | q.text("flags = "); |
| 4475 | q.text("%#x" % self.flags) |
| 4476 | q.text(","); q.breakable() |
| 4477 | q.text("table_id = "); |
| 4478 | q.text("%#x" % self.table_id) |
| 4479 | q.text(","); q.breakable() |
| 4480 | q.text("checksum = "); |
| 4481 | q.pp(self.checksum) |
| 4482 | q.text(","); q.breakable() |
| 4483 | q.text("checksum_mask = "); |
| 4484 | q.pp(self.checksum_mask) |
| 4485 | q.breakable() |
| 4486 | q.text('}') |
| 4487 | |
| 4488 | bsn_stats_request.subtypes[3] = bsn_gentable_entry_stats_request |
| 4489 | |
| 4490 | class bsn_gentable_set_buckets_size(bsn_header): |
| 4491 | version = 4 |
| 4492 | type = 4 |
| 4493 | experimenter = 6035143 |
| 4494 | subtype = 50 |
| 4495 | |
| 4496 | def __init__(self, xid=None, table_id=None, buckets_size=None): |
| 4497 | if xid != None: |
| 4498 | self.xid = xid |
| 4499 | else: |
| 4500 | self.xid = None |
| 4501 | if table_id != None: |
| 4502 | self.table_id = table_id |
| 4503 | else: |
| 4504 | self.table_id = 0 |
| 4505 | if buckets_size != None: |
| 4506 | self.buckets_size = buckets_size |
| 4507 | else: |
| 4508 | self.buckets_size = 0 |
| 4509 | return |
| 4510 | |
| 4511 | def pack(self): |
| 4512 | packed = [] |
| 4513 | packed.append(struct.pack("!B", self.version)) |
| 4514 | packed.append(struct.pack("!B", self.type)) |
| 4515 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4516 | packed.append(struct.pack("!L", self.xid)) |
| 4517 | packed.append(struct.pack("!L", self.experimenter)) |
| 4518 | packed.append(struct.pack("!L", self.subtype)) |
| 4519 | packed.append(struct.pack("!H", self.table_id)) |
| 4520 | packed.append('\x00' * 2) |
| 4521 | packed.append(struct.pack("!L", self.buckets_size)) |
| 4522 | length = sum([len(x) for x in packed]) |
| 4523 | packed[2] = struct.pack("!H", length) |
| 4524 | return ''.join(packed) |
| 4525 | |
| 4526 | @staticmethod |
| 4527 | def unpack(reader): |
| 4528 | obj = bsn_gentable_set_buckets_size() |
| 4529 | _version = reader.read("!B")[0] |
| 4530 | assert(_version == 4) |
| 4531 | _type = reader.read("!B")[0] |
| 4532 | assert(_type == 4) |
| 4533 | _length = reader.read("!H")[0] |
| 4534 | orig_reader = reader |
| 4535 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4536 | obj.xid = reader.read("!L")[0] |
| 4537 | _experimenter = reader.read("!L")[0] |
| 4538 | assert(_experimenter == 6035143) |
| 4539 | _subtype = reader.read("!L")[0] |
| 4540 | assert(_subtype == 50) |
| 4541 | obj.table_id = reader.read("!H")[0] |
| 4542 | reader.skip(2) |
| 4543 | obj.buckets_size = reader.read("!L")[0] |
| 4544 | return obj |
| 4545 | |
| 4546 | def __eq__(self, other): |
| 4547 | if type(self) != type(other): return False |
| 4548 | if self.xid != other.xid: return False |
| 4549 | if self.table_id != other.table_id: return False |
| 4550 | if self.buckets_size != other.buckets_size: return False |
| 4551 | return True |
| 4552 | |
| 4553 | def pretty_print(self, q): |
| 4554 | q.text("bsn_gentable_set_buckets_size {") |
| 4555 | with q.group(): |
| 4556 | with q.indent(2): |
| 4557 | q.breakable() |
| 4558 | q.text("xid = "); |
| 4559 | if self.xid != None: |
| 4560 | q.text("%#x" % self.xid) |
| 4561 | else: |
| 4562 | q.text('None') |
| 4563 | q.text(","); q.breakable() |
| 4564 | q.text("table_id = "); |
| 4565 | q.text("%#x" % self.table_id) |
| 4566 | q.text(","); q.breakable() |
| 4567 | q.text("buckets_size = "); |
| 4568 | q.text("%#x" % self.buckets_size) |
| 4569 | q.breakable() |
| 4570 | q.text('}') |
| 4571 | |
| 4572 | bsn_header.subtypes[50] = bsn_gentable_set_buckets_size |
| 4573 | |
| 4574 | class bsn_gentable_stats_reply(bsn_stats_reply): |
| 4575 | version = 4 |
| 4576 | type = 19 |
| 4577 | stats_type = 65535 |
| 4578 | experimenter = 6035143 |
| 4579 | subtype = 7 |
| 4580 | |
| 4581 | def __init__(self, xid=None, flags=None, entries=None): |
| 4582 | if xid != None: |
| 4583 | self.xid = xid |
| 4584 | else: |
| 4585 | self.xid = None |
| 4586 | if flags != None: |
| 4587 | self.flags = flags |
| 4588 | else: |
| 4589 | self.flags = 0 |
| 4590 | if entries != None: |
| 4591 | self.entries = entries |
| 4592 | else: |
| 4593 | self.entries = [] |
| 4594 | return |
| 4595 | |
| 4596 | def pack(self): |
| 4597 | packed = [] |
| 4598 | packed.append(struct.pack("!B", self.version)) |
| 4599 | packed.append(struct.pack("!B", self.type)) |
| 4600 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4601 | packed.append(struct.pack("!L", self.xid)) |
| 4602 | packed.append(struct.pack("!H", self.stats_type)) |
| 4603 | packed.append(struct.pack("!H", self.flags)) |
| 4604 | packed.append('\x00' * 4) |
| 4605 | packed.append(struct.pack("!L", self.experimenter)) |
| 4606 | packed.append(struct.pack("!L", self.subtype)) |
| 4607 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 4608 | length = sum([len(x) for x in packed]) |
| 4609 | packed[2] = struct.pack("!H", length) |
| 4610 | return ''.join(packed) |
| 4611 | |
| 4612 | @staticmethod |
| 4613 | def unpack(reader): |
| 4614 | obj = bsn_gentable_stats_reply() |
| 4615 | _version = reader.read("!B")[0] |
| 4616 | assert(_version == 4) |
| 4617 | _type = reader.read("!B")[0] |
| 4618 | assert(_type == 19) |
| 4619 | _length = reader.read("!H")[0] |
| 4620 | orig_reader = reader |
| 4621 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4622 | obj.xid = reader.read("!L")[0] |
| 4623 | _stats_type = reader.read("!H")[0] |
| 4624 | assert(_stats_type == 65535) |
| 4625 | obj.flags = reader.read("!H")[0] |
| 4626 | reader.skip(4) |
| 4627 | _experimenter = reader.read("!L")[0] |
| 4628 | assert(_experimenter == 6035143) |
| 4629 | _subtype = reader.read("!L")[0] |
| 4630 | assert(_subtype == 7) |
| 4631 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_stats_entry.unpack) |
| 4632 | return obj |
| 4633 | |
| 4634 | def __eq__(self, other): |
| 4635 | if type(self) != type(other): return False |
| 4636 | if self.xid != other.xid: return False |
| 4637 | if self.flags != other.flags: return False |
| 4638 | if self.entries != other.entries: return False |
| 4639 | return True |
| 4640 | |
| 4641 | def pretty_print(self, q): |
| 4642 | q.text("bsn_gentable_stats_reply {") |
| 4643 | with q.group(): |
| 4644 | with q.indent(2): |
| 4645 | q.breakable() |
| 4646 | q.text("xid = "); |
| 4647 | if self.xid != None: |
| 4648 | q.text("%#x" % self.xid) |
| 4649 | else: |
| 4650 | q.text('None') |
| 4651 | q.text(","); q.breakable() |
| 4652 | q.text("flags = "); |
| 4653 | q.text("%#x" % self.flags) |
| 4654 | q.text(","); q.breakable() |
| 4655 | q.text("entries = "); |
| 4656 | q.pp(self.entries) |
| 4657 | q.breakable() |
| 4658 | q.text('}') |
| 4659 | |
| 4660 | bsn_stats_reply.subtypes[7] = bsn_gentable_stats_reply |
| 4661 | |
| 4662 | class bsn_gentable_stats_request(bsn_stats_request): |
| 4663 | version = 4 |
| 4664 | type = 18 |
| 4665 | stats_type = 65535 |
| 4666 | experimenter = 6035143 |
| 4667 | subtype = 7 |
| 4668 | |
| 4669 | def __init__(self, xid=None, flags=None): |
| 4670 | if xid != None: |
| 4671 | self.xid = xid |
| 4672 | else: |
| 4673 | self.xid = None |
| 4674 | if flags != None: |
| 4675 | self.flags = flags |
| 4676 | else: |
| 4677 | self.flags = 0 |
| 4678 | return |
| 4679 | |
| 4680 | def pack(self): |
| 4681 | packed = [] |
| 4682 | packed.append(struct.pack("!B", self.version)) |
| 4683 | packed.append(struct.pack("!B", self.type)) |
| 4684 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4685 | packed.append(struct.pack("!L", self.xid)) |
| 4686 | packed.append(struct.pack("!H", self.stats_type)) |
| 4687 | packed.append(struct.pack("!H", self.flags)) |
| 4688 | packed.append('\x00' * 4) |
| 4689 | packed.append(struct.pack("!L", self.experimenter)) |
| 4690 | packed.append(struct.pack("!L", self.subtype)) |
| 4691 | length = sum([len(x) for x in packed]) |
| 4692 | packed[2] = struct.pack("!H", length) |
| 4693 | return ''.join(packed) |
| 4694 | |
| 4695 | @staticmethod |
| 4696 | def unpack(reader): |
| 4697 | obj = bsn_gentable_stats_request() |
| 4698 | _version = reader.read("!B")[0] |
| 4699 | assert(_version == 4) |
| 4700 | _type = reader.read("!B")[0] |
| 4701 | assert(_type == 18) |
| 4702 | _length = reader.read("!H")[0] |
| 4703 | orig_reader = reader |
| 4704 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4705 | obj.xid = reader.read("!L")[0] |
| 4706 | _stats_type = reader.read("!H")[0] |
| 4707 | assert(_stats_type == 65535) |
| 4708 | obj.flags = reader.read("!H")[0] |
| 4709 | reader.skip(4) |
| 4710 | _experimenter = reader.read("!L")[0] |
| 4711 | assert(_experimenter == 6035143) |
| 4712 | _subtype = reader.read("!L")[0] |
| 4713 | assert(_subtype == 7) |
| 4714 | return obj |
| 4715 | |
| 4716 | def __eq__(self, other): |
| 4717 | if type(self) != type(other): return False |
| 4718 | if self.xid != other.xid: return False |
| 4719 | if self.flags != other.flags: return False |
| 4720 | return True |
| 4721 | |
| 4722 | def pretty_print(self, q): |
| 4723 | q.text("bsn_gentable_stats_request {") |
| 4724 | with q.group(): |
| 4725 | with q.indent(2): |
| 4726 | q.breakable() |
| 4727 | q.text("xid = "); |
| 4728 | if self.xid != None: |
| 4729 | q.text("%#x" % self.xid) |
| 4730 | else: |
| 4731 | q.text('None') |
| 4732 | q.text(","); q.breakable() |
| 4733 | q.text("flags = "); |
| 4734 | q.text("%#x" % self.flags) |
| 4735 | q.breakable() |
| 4736 | q.text('}') |
| 4737 | |
| 4738 | bsn_stats_request.subtypes[7] = bsn_gentable_stats_request |
| 4739 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4740 | class bsn_get_interfaces_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4741 | version = 4 |
| 4742 | type = 4 |
| 4743 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4744 | subtype = 10 |
| 4745 | |
| 4746 | def __init__(self, xid=None, interfaces=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4747 | if xid != None: |
| 4748 | self.xid = xid |
| 4749 | else: |
| 4750 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4751 | if interfaces != None: |
| 4752 | self.interfaces = interfaces |
| 4753 | else: |
| 4754 | self.interfaces = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4755 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4756 | |
| 4757 | def pack(self): |
| 4758 | packed = [] |
| 4759 | packed.append(struct.pack("!B", self.version)) |
| 4760 | packed.append(struct.pack("!B", self.type)) |
| 4761 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4762 | packed.append(struct.pack("!L", self.xid)) |
| 4763 | packed.append(struct.pack("!L", self.experimenter)) |
| 4764 | packed.append(struct.pack("!L", self.subtype)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4765 | packed.append(loxi.generic_util.pack_list(self.interfaces)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4766 | length = sum([len(x) for x in packed]) |
| 4767 | packed[2] = struct.pack("!H", length) |
| 4768 | return ''.join(packed) |
| 4769 | |
| 4770 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4771 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4772 | obj = bsn_get_interfaces_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4773 | _version = reader.read("!B")[0] |
| 4774 | assert(_version == 4) |
| 4775 | _type = reader.read("!B")[0] |
| 4776 | assert(_type == 4) |
| 4777 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4778 | orig_reader = reader |
| 4779 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4780 | obj.xid = reader.read("!L")[0] |
| 4781 | _experimenter = reader.read("!L")[0] |
| 4782 | assert(_experimenter == 6035143) |
| 4783 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4784 | assert(_subtype == 10) |
| 4785 | obj.interfaces = loxi.generic_util.unpack_list(reader, common.bsn_interface.unpack) |
| 4786 | return obj |
| 4787 | |
| 4788 | def __eq__(self, other): |
| 4789 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4790 | if self.xid != other.xid: return False |
| 4791 | if self.interfaces != other.interfaces: return False |
| 4792 | return True |
| 4793 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4794 | def pretty_print(self, q): |
| 4795 | q.text("bsn_get_interfaces_reply {") |
| 4796 | with q.group(): |
| 4797 | with q.indent(2): |
| 4798 | q.breakable() |
| 4799 | q.text("xid = "); |
| 4800 | if self.xid != None: |
| 4801 | q.text("%#x" % self.xid) |
| 4802 | else: |
| 4803 | q.text('None') |
| 4804 | q.text(","); q.breakable() |
| 4805 | q.text("interfaces = "); |
| 4806 | q.pp(self.interfaces) |
| 4807 | q.breakable() |
| 4808 | q.text('}') |
| 4809 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4810 | bsn_header.subtypes[10] = bsn_get_interfaces_reply |
| 4811 | |
| 4812 | class bsn_get_interfaces_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4813 | version = 4 |
| 4814 | type = 4 |
| 4815 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4816 | subtype = 9 |
| 4817 | |
| 4818 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4819 | if xid != None: |
| 4820 | self.xid = xid |
| 4821 | else: |
| 4822 | self.xid = None |
| 4823 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4824 | |
| 4825 | def pack(self): |
| 4826 | packed = [] |
| 4827 | packed.append(struct.pack("!B", self.version)) |
| 4828 | packed.append(struct.pack("!B", self.type)) |
| 4829 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4830 | packed.append(struct.pack("!L", self.xid)) |
| 4831 | packed.append(struct.pack("!L", self.experimenter)) |
| 4832 | packed.append(struct.pack("!L", self.subtype)) |
| 4833 | length = sum([len(x) for x in packed]) |
| 4834 | packed[2] = struct.pack("!H", length) |
| 4835 | return ''.join(packed) |
| 4836 | |
| 4837 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4838 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4839 | obj = bsn_get_interfaces_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4840 | _version = reader.read("!B")[0] |
| 4841 | assert(_version == 4) |
| 4842 | _type = reader.read("!B")[0] |
| 4843 | assert(_type == 4) |
| 4844 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4845 | orig_reader = reader |
| 4846 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4847 | obj.xid = reader.read("!L")[0] |
| 4848 | _experimenter = reader.read("!L")[0] |
| 4849 | assert(_experimenter == 6035143) |
| 4850 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4851 | assert(_subtype == 9) |
| 4852 | return obj |
| 4853 | |
| 4854 | def __eq__(self, other): |
| 4855 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4856 | if self.xid != other.xid: return False |
| 4857 | return True |
| 4858 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4859 | def pretty_print(self, q): |
| 4860 | q.text("bsn_get_interfaces_request {") |
| 4861 | with q.group(): |
| 4862 | with q.indent(2): |
| 4863 | q.breakable() |
| 4864 | q.text("xid = "); |
| 4865 | if self.xid != None: |
| 4866 | q.text("%#x" % self.xid) |
| 4867 | else: |
| 4868 | q.text('None') |
| 4869 | q.breakable() |
| 4870 | q.text('}') |
| 4871 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4872 | bsn_header.subtypes[9] = bsn_get_interfaces_request |
| 4873 | |
| 4874 | class bsn_get_mirroring_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4875 | version = 4 |
| 4876 | type = 4 |
| 4877 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4878 | subtype = 5 |
| 4879 | |
| 4880 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4881 | if xid != None: |
| 4882 | self.xid = xid |
| 4883 | else: |
| 4884 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4885 | if report_mirror_ports != None: |
| 4886 | self.report_mirror_ports = report_mirror_ports |
| 4887 | else: |
| 4888 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4889 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4890 | |
| 4891 | def pack(self): |
| 4892 | packed = [] |
| 4893 | packed.append(struct.pack("!B", self.version)) |
| 4894 | packed.append(struct.pack("!B", self.type)) |
| 4895 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4896 | packed.append(struct.pack("!L", self.xid)) |
| 4897 | packed.append(struct.pack("!L", self.experimenter)) |
| 4898 | packed.append(struct.pack("!L", self.subtype)) |
| 4899 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 4900 | packed.append('\x00' * 3) |
| 4901 | length = sum([len(x) for x in packed]) |
| 4902 | packed[2] = struct.pack("!H", length) |
| 4903 | return ''.join(packed) |
| 4904 | |
| 4905 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4906 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4907 | obj = bsn_get_mirroring_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4908 | _version = reader.read("!B")[0] |
| 4909 | assert(_version == 4) |
| 4910 | _type = reader.read("!B")[0] |
| 4911 | assert(_type == 4) |
| 4912 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4913 | orig_reader = reader |
| 4914 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4915 | obj.xid = reader.read("!L")[0] |
| 4916 | _experimenter = reader.read("!L")[0] |
| 4917 | assert(_experimenter == 6035143) |
| 4918 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4919 | assert(_subtype == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4920 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4921 | reader.skip(3) |
| 4922 | return obj |
| 4923 | |
| 4924 | def __eq__(self, other): |
| 4925 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4926 | if self.xid != other.xid: return False |
| 4927 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 4928 | return True |
| 4929 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4930 | def pretty_print(self, q): |
| 4931 | q.text("bsn_get_mirroring_reply {") |
| 4932 | with q.group(): |
| 4933 | with q.indent(2): |
| 4934 | q.breakable() |
| 4935 | q.text("xid = "); |
| 4936 | if self.xid != None: |
| 4937 | q.text("%#x" % self.xid) |
| 4938 | else: |
| 4939 | q.text('None') |
| 4940 | q.text(","); q.breakable() |
| 4941 | q.text("report_mirror_ports = "); |
| 4942 | q.text("%#x" % self.report_mirror_ports) |
| 4943 | q.breakable() |
| 4944 | q.text('}') |
| 4945 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4946 | bsn_header.subtypes[5] = bsn_get_mirroring_reply |
| 4947 | |
| 4948 | class bsn_get_mirroring_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4949 | version = 4 |
| 4950 | type = 4 |
| 4951 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4952 | subtype = 4 |
| 4953 | |
| 4954 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4955 | if xid != None: |
| 4956 | self.xid = xid |
| 4957 | else: |
| 4958 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4959 | if report_mirror_ports != None: |
| 4960 | self.report_mirror_ports = report_mirror_ports |
| 4961 | else: |
| 4962 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4963 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4964 | |
| 4965 | def pack(self): |
| 4966 | packed = [] |
| 4967 | packed.append(struct.pack("!B", self.version)) |
| 4968 | packed.append(struct.pack("!B", self.type)) |
| 4969 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4970 | packed.append(struct.pack("!L", self.xid)) |
| 4971 | packed.append(struct.pack("!L", self.experimenter)) |
| 4972 | packed.append(struct.pack("!L", self.subtype)) |
| 4973 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 4974 | packed.append('\x00' * 3) |
| 4975 | length = sum([len(x) for x in packed]) |
| 4976 | packed[2] = struct.pack("!H", length) |
| 4977 | return ''.join(packed) |
| 4978 | |
| 4979 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4980 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4981 | obj = bsn_get_mirroring_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4982 | _version = reader.read("!B")[0] |
| 4983 | assert(_version == 4) |
| 4984 | _type = reader.read("!B")[0] |
| 4985 | assert(_type == 4) |
| 4986 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4987 | orig_reader = reader |
| 4988 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4989 | obj.xid = reader.read("!L")[0] |
| 4990 | _experimenter = reader.read("!L")[0] |
| 4991 | assert(_experimenter == 6035143) |
| 4992 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4993 | assert(_subtype == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4994 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4995 | reader.skip(3) |
| 4996 | return obj |
| 4997 | |
| 4998 | def __eq__(self, other): |
| 4999 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5000 | if self.xid != other.xid: return False |
| 5001 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 5002 | return True |
| 5003 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5004 | def pretty_print(self, q): |
| 5005 | q.text("bsn_get_mirroring_request {") |
| 5006 | with q.group(): |
| 5007 | with q.indent(2): |
| 5008 | q.breakable() |
| 5009 | q.text("xid = "); |
| 5010 | if self.xid != None: |
| 5011 | q.text("%#x" % self.xid) |
| 5012 | else: |
| 5013 | q.text('None') |
| 5014 | q.text(","); q.breakable() |
| 5015 | q.text("report_mirror_ports = "); |
| 5016 | q.text("%#x" % self.report_mirror_ports) |
| 5017 | q.breakable() |
| 5018 | q.text('}') |
| 5019 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5020 | bsn_header.subtypes[4] = bsn_get_mirroring_request |
| 5021 | |
| 5022 | class bsn_get_switch_pipeline_reply(bsn_header): |
| 5023 | version = 4 |
| 5024 | type = 4 |
| 5025 | experimenter = 6035143 |
| 5026 | subtype = 52 |
| 5027 | |
| 5028 | def __init__(self, xid=None, pipeline=None): |
| 5029 | if xid != None: |
| 5030 | self.xid = xid |
| 5031 | else: |
| 5032 | self.xid = None |
| 5033 | if pipeline != None: |
| 5034 | self.pipeline = pipeline |
| 5035 | else: |
| 5036 | self.pipeline = "" |
| 5037 | return |
| 5038 | |
| 5039 | def pack(self): |
| 5040 | packed = [] |
| 5041 | packed.append(struct.pack("!B", self.version)) |
| 5042 | packed.append(struct.pack("!B", self.type)) |
| 5043 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5044 | packed.append(struct.pack("!L", self.xid)) |
| 5045 | packed.append(struct.pack("!L", self.experimenter)) |
| 5046 | packed.append(struct.pack("!L", self.subtype)) |
| 5047 | packed.append(struct.pack("!256s", self.pipeline)) |
| 5048 | length = sum([len(x) for x in packed]) |
| 5049 | packed[2] = struct.pack("!H", length) |
| 5050 | return ''.join(packed) |
| 5051 | |
| 5052 | @staticmethod |
| 5053 | def unpack(reader): |
| 5054 | obj = bsn_get_switch_pipeline_reply() |
| 5055 | _version = reader.read("!B")[0] |
| 5056 | assert(_version == 4) |
| 5057 | _type = reader.read("!B")[0] |
| 5058 | assert(_type == 4) |
| 5059 | _length = reader.read("!H")[0] |
| 5060 | orig_reader = reader |
| 5061 | reader = orig_reader.slice(_length - (2 + 2)) |
| 5062 | obj.xid = reader.read("!L")[0] |
| 5063 | _experimenter = reader.read("!L")[0] |
| 5064 | assert(_experimenter == 6035143) |
| 5065 | _subtype = reader.read("!L")[0] |
| 5066 | assert(_subtype == 52) |
| 5067 | obj.pipeline = reader.read("!256s")[0].rstrip("\x00") |
| 5068 | return obj |
| 5069 | |
| 5070 | def __eq__(self, other): |
| 5071 | if type(self) != type(other): return False |
| 5072 | if self.xid != other.xid: return False |
| 5073 | if self.pipeline != other.pipeline: return False |
| 5074 | return True |
| 5075 | |
| 5076 | def pretty_print(self, q): |
| 5077 | q.text("bsn_get_switch_pipeline_reply {") |
| 5078 | with q.group(): |
| 5079 | with q.indent(2): |
| 5080 | q.breakable() |
| 5081 | q.text("xid = "); |
| 5082 | if self.xid != None: |
| 5083 | q.text("%#x" % self.xid) |
| 5084 | else: |
| 5085 | q.text('None') |
| 5086 | q.text(","); q.breakable() |
| 5087 | q.text("pipeline = "); |
| 5088 | q.pp(self.pipeline) |
| 5089 | q.breakable() |
| 5090 | q.text('}') |
| 5091 | |
| 5092 | bsn_header.subtypes[52] = bsn_get_switch_pipeline_reply |
| 5093 | |
| 5094 | class bsn_get_switch_pipeline_request(bsn_header): |
| 5095 | version = 4 |
| 5096 | type = 4 |
| 5097 | experimenter = 6035143 |
| 5098 | subtype = 51 |
| 5099 | |
| 5100 | def __init__(self, xid=None): |
| 5101 | if xid != None: |
| 5102 | self.xid = xid |
| 5103 | else: |
| 5104 | self.xid = None |
| 5105 | return |
| 5106 | |
| 5107 | def pack(self): |
| 5108 | packed = [] |
| 5109 | packed.append(struct.pack("!B", self.version)) |
| 5110 | packed.append(struct.pack("!B", self.type)) |
| 5111 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5112 | packed.append(struct.pack("!L", self.xid)) |
| 5113 | packed.append(struct.pack("!L", self.experimenter)) |
| 5114 | packed.append(struct.pack("!L", self.subtype)) |
| 5115 | length = sum([len(x) for x in packed]) |
| 5116 | packed[2] = struct.pack("!H", length) |
| 5117 | return ''.join(packed) |
| 5118 | |
| 5119 | @staticmethod |
| 5120 | def unpack(reader): |
| 5121 | obj = bsn_get_switch_pipeline_request() |
| 5122 | _version = reader.read("!B")[0] |
| 5123 | assert(_version == 4) |
| 5124 | _type = reader.read("!B")[0] |
| 5125 | assert(_type == 4) |
| 5126 | _length = reader.read("!H")[0] |
| 5127 | orig_reader = reader |
| 5128 | reader = orig_reader.slice(_length - (2 + 2)) |
| 5129 | obj.xid = reader.read("!L")[0] |
| 5130 | _experimenter = reader.read("!L")[0] |
| 5131 | assert(_experimenter == 6035143) |
| 5132 | _subtype = reader.read("!L")[0] |
| 5133 | assert(_subtype == 51) |
| 5134 | return obj |
| 5135 | |
| 5136 | def __eq__(self, other): |
| 5137 | if type(self) != type(other): return False |
| 5138 | if self.xid != other.xid: return False |
| 5139 | return True |
| 5140 | |
| 5141 | def pretty_print(self, q): |
| 5142 | q.text("bsn_get_switch_pipeline_request {") |
| 5143 | with q.group(): |
| 5144 | with q.indent(2): |
| 5145 | q.breakable() |
| 5146 | q.text("xid = "); |
| 5147 | if self.xid != None: |
| 5148 | q.text("%#x" % self.xid) |
| 5149 | else: |
| 5150 | q.text('None') |
| 5151 | q.breakable() |
| 5152 | q.text('}') |
| 5153 | |
| 5154 | bsn_header.subtypes[51] = bsn_get_switch_pipeline_request |
| 5155 | |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 5156 | class bsn_image_desc_stats_reply(bsn_stats_reply): |
| 5157 | version = 4 |
| 5158 | type = 19 |
| 5159 | stats_type = 65535 |
| 5160 | experimenter = 6035143 |
| 5161 | subtype = 14 |
| 5162 | |
| 5163 | def __init__(self, xid=None, flags=None, image_checksum=None, startup_config_checksum=None): |
| 5164 | if xid != None: |
| 5165 | self.xid = xid |
| 5166 | else: |
| 5167 | self.xid = None |
| 5168 | if flags != None: |
| 5169 | self.flags = flags |
| 5170 | else: |
| 5171 | self.flags = 0 |
| 5172 | if image_checksum != None: |
| 5173 | self.image_checksum = image_checksum |
| 5174 | else: |
| 5175 | self.image_checksum = "" |
| 5176 | if startup_config_checksum != None: |
| 5177 | self.startup_config_checksum = startup_config_checksum |
| 5178 | else: |
| 5179 | self.startup_config_checksum = "" |
| 5180 | return |
| 5181 | |
| 5182 | def pack(self): |
| 5183 | packed = [] |
| 5184 | packed.append(struct.pack("!B", self.version)) |
| 5185 | packed.append(struct.pack("!B", self.type)) |
| 5186 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5187 | packed.append(struct.pack("!L", self.xid)) |
| 5188 | packed.append(struct.pack("!H", self.stats_type)) |
| 5189 | packed.append(struct.pack("!H", self.flags)) |
| 5190 | packed.append('\x00' * 4) |
| 5191 | packed.append(struct.pack("!L", self.experimenter)) |
| 5192 | packed.append(struct.pack("!L", self.subtype)) |
| 5193 | packed.append(struct.pack("!256s", self.image_checksum)) |
| 5194 | packed.append(struct.pack("!256s", self.startup_config_checksum)) |
| 5195 | length = sum([len(x) for x in packed]) |
| 5196 | packed[2] = struct.pack("!H", length) |
| 5197 | return ''.join(packed) |
| 5198 | |
| 5199 | @staticmethod |
| 5200 | def unpack(reader): |
| 5201 | obj = bsn_image_desc_stats_reply() |
| 5202 | _version = reader.read("!B")[0] |
| 5203 | assert(_version == 4) |
| 5204 | _type = reader.read("!B")[0] |
| 5205 | assert(_type == 19) |
| 5206 | _length = reader.read("!H")[0] |
| 5207 | orig_reader = reader |
| 5208 | reader = orig_reader.slice(_length - (2 + 2)) |
| 5209 | obj.xid = reader.read("!L")[0] |
| 5210 | _stats_type = reader.read("!H")[0] |
| 5211 | assert(_stats_type == 65535) |
| 5212 | obj.flags = reader.read("!H")[0] |
| 5213 | reader.skip(4) |
| 5214 | _experimenter = reader.read("!L")[0] |
| 5215 | assert(_experimenter == 6035143) |
| 5216 | _subtype = reader.read("!L")[0] |
| 5217 | assert(_subtype == 14) |
| 5218 | obj.image_checksum = reader.read("!256s")[0].rstrip("\x00") |
| 5219 | obj.startup_config_checksum = reader.read("!256s")[0].rstrip("\x00") |
| 5220 | return obj |
| 5221 | |
| 5222 | def __eq__(self, other): |
| 5223 | if type(self) != type(other): return False |
| 5224 | if self.xid != other.xid: return False |
| 5225 | if self.flags != other.flags: return False |
| 5226 | if self.image_checksum != other.image_checksum: return False |
| 5227 | if self.startup_config_checksum != other.startup_config_checksum: return False |
| 5228 | return True |
| 5229 | |
| 5230 | def pretty_print(self, q): |
| 5231 | q.text("bsn_image_desc_stats_reply {") |
| 5232 | with q.group(): |
| 5233 | with q.indent(2): |
| 5234 | q.breakable() |
| 5235 | q.text("xid = "); |
| 5236 | if self.xid != None: |
| 5237 | q.text("%#x" % self.xid) |
| 5238 | else: |
| 5239 | q.text('None') |
| 5240 | q.text(","); q.breakable() |
| 5241 | q.text("flags = "); |
| 5242 | q.text("%#x" % self.flags) |
| 5243 | q.text(","); q.breakable() |
| 5244 | q.text("image_checksum = "); |
| 5245 | q.pp(self.image_checksum) |
| 5246 | q.text(","); q.breakable() |
| 5247 | q.text("startup_config_checksum = "); |
| 5248 | q.pp(self.startup_config_checksum) |
| 5249 | q.breakable() |
| 5250 | q.text('}') |
| 5251 | |
| 5252 | bsn_stats_reply.subtypes[14] = bsn_image_desc_stats_reply |
| 5253 | |
| 5254 | class bsn_image_desc_stats_request(bsn_stats_request): |
| 5255 | version = 4 |
| 5256 | type = 18 |
| 5257 | stats_type = 65535 |
| 5258 | experimenter = 6035143 |
| 5259 | subtype = 14 |
| 5260 | |
| 5261 | def __init__(self, xid=None, flags=None): |
| 5262 | if xid != None: |
| 5263 | self.xid = xid |
| 5264 | else: |
| 5265 | self.xid = None |
| 5266 | if flags != None: |
| 5267 | self.flags = flags |
| 5268 | else: |
| 5269 | self.flags = 0 |
| 5270 | return |
| 5271 | |
| 5272 | def pack(self): |
| 5273 | packed = [] |
| 5274 | packed.append(struct.pack("!B", self.version)) |
| 5275 | packed.append(struct.pack("!B", self.type)) |
| 5276 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5277 | packed.append(struct.pack("!L", self.xid)) |
| 5278 | packed.append(struct.pack("!H", self.stats_type)) |
| 5279 | packed.append(struct.pack("!H", self.flags)) |
| 5280 | packed.append('\x00' * 4) |
| 5281 | packed.append(struct.pack("!L", self.experimenter)) |
| 5282 | packed.append(struct.pack("!L", self.subtype)) |
| 5283 | length = sum([len(x) for x in packed]) |
| 5284 | packed[2] = struct.pack("!H", length) |
| 5285 | return ''.join(packed) |
| 5286 | |
| 5287 | @staticmethod |
| 5288 | def unpack(reader): |
| 5289 | obj = bsn_image_desc_stats_request() |
| 5290 | _version = reader.read("!B")[0] |
| 5291 | assert(_version == 4) |
| 5292 | _type = reader.read("!B")[0] |
| 5293 | assert(_type == 18) |
| 5294 | _length = reader.read("!H")[0] |
| 5295 | orig_reader = reader |
| 5296 | reader = orig_reader.slice(_length - (2 + 2)) |
| 5297 | obj.xid = reader.read("!L")[0] |
| 5298 | _stats_type = reader.read("!H")[0] |
| 5299 | assert(_stats_type == 65535) |
| 5300 | obj.flags = reader.read("!H")[0] |
| 5301 | reader.skip(4) |
| 5302 | _experimenter = reader.read("!L")[0] |
| 5303 | assert(_experimenter == 6035143) |
| 5304 | _subtype = reader.read("!L")[0] |
| 5305 | assert(_subtype == 14) |
| 5306 | return obj |
| 5307 | |
| 5308 | def __eq__(self, other): |
| 5309 | if type(self) != type(other): return False |
| 5310 | if self.xid != other.xid: return False |
| 5311 | if self.flags != other.flags: return False |
| 5312 | return True |
| 5313 | |
| 5314 | def pretty_print(self, q): |
| 5315 | q.text("bsn_image_desc_stats_request {") |
| 5316 | with q.group(): |
| 5317 | with q.indent(2): |
| 5318 | q.breakable() |
| 5319 | q.text("xid = "); |
| 5320 | if self.xid != None: |
| 5321 | q.text("%#x" % self.xid) |
| 5322 | else: |
| 5323 | q.text('None') |
| 5324 | q.text(","); q.breakable() |
| 5325 | q.text("flags = "); |
| 5326 | q.text("%#x" % self.flags) |
| 5327 | q.breakable() |
| 5328 | q.text('}') |
| 5329 | |
| 5330 | bsn_stats_request.subtypes[14] = bsn_image_desc_stats_request |
| 5331 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5332 | class bsn_lacp_convergence_notif(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5333 | version = 4 |
| 5334 | type = 4 |
| 5335 | experimenter = 6035143 |
| 5336 | subtype = 43 |
| 5337 | |
| 5338 | 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] | 5339 | if xid != None: |
| 5340 | self.xid = xid |
| 5341 | else: |
| 5342 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5343 | if convergence_status != None: |
| 5344 | self.convergence_status = convergence_status |
| 5345 | else: |
| 5346 | self.convergence_status = 0 |
| 5347 | if port_no != None: |
| 5348 | self.port_no = port_no |
| 5349 | else: |
| 5350 | self.port_no = 0 |
| 5351 | if actor_sys_priority != None: |
| 5352 | self.actor_sys_priority = actor_sys_priority |
| 5353 | else: |
| 5354 | self.actor_sys_priority = 0 |
| 5355 | if actor_sys_mac != None: |
| 5356 | self.actor_sys_mac = actor_sys_mac |
| 5357 | else: |
| 5358 | self.actor_sys_mac = [0,0,0,0,0,0] |
| 5359 | if actor_port_priority != None: |
| 5360 | self.actor_port_priority = actor_port_priority |
| 5361 | else: |
| 5362 | self.actor_port_priority = 0 |
| 5363 | if actor_port_num != None: |
| 5364 | self.actor_port_num = actor_port_num |
| 5365 | else: |
| 5366 | self.actor_port_num = 0 |
| 5367 | if actor_key != None: |
| 5368 | self.actor_key = actor_key |
| 5369 | else: |
| 5370 | self.actor_key = 0 |
| 5371 | if partner_sys_priority != None: |
| 5372 | self.partner_sys_priority = partner_sys_priority |
| 5373 | else: |
| 5374 | self.partner_sys_priority = 0 |
| 5375 | if partner_sys_mac != None: |
| 5376 | self.partner_sys_mac = partner_sys_mac |
| 5377 | else: |
| 5378 | self.partner_sys_mac = [0,0,0,0,0,0] |
| 5379 | if partner_port_priority != None: |
| 5380 | self.partner_port_priority = partner_port_priority |
| 5381 | else: |
| 5382 | self.partner_port_priority = 0 |
| 5383 | if partner_port_num != None: |
| 5384 | self.partner_port_num = partner_port_num |
| 5385 | else: |
| 5386 | self.partner_port_num = 0 |
| 5387 | if partner_key != None: |
| 5388 | self.partner_key = partner_key |
| 5389 | else: |
| 5390 | self.partner_key = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5391 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5392 | |
| 5393 | def pack(self): |
| 5394 | packed = [] |
| 5395 | packed.append(struct.pack("!B", self.version)) |
| 5396 | packed.append(struct.pack("!B", self.type)) |
| 5397 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5398 | packed.append(struct.pack("!L", self.xid)) |
| 5399 | packed.append(struct.pack("!L", self.experimenter)) |
| 5400 | packed.append(struct.pack("!L", self.subtype)) |
| 5401 | packed.append(struct.pack("!B", self.convergence_status)) |
| 5402 | packed.append('\x00' * 3) |
| 5403 | packed.append(util.pack_port_no(self.port_no)) |
| 5404 | packed.append(struct.pack("!H", self.actor_sys_priority)) |
| 5405 | packed.append(struct.pack("!6B", *self.actor_sys_mac)) |
| 5406 | packed.append(struct.pack("!H", self.actor_port_priority)) |
| 5407 | packed.append(struct.pack("!H", self.actor_port_num)) |
| 5408 | packed.append(struct.pack("!H", self.actor_key)) |
| 5409 | packed.append(struct.pack("!H", self.partner_sys_priority)) |
| 5410 | packed.append(struct.pack("!6B", *self.partner_sys_mac)) |
| 5411 | packed.append(struct.pack("!H", self.partner_port_priority)) |
| 5412 | packed.append(struct.pack("!H", self.partner_port_num)) |
| 5413 | packed.append(struct.pack("!H", self.partner_key)) |
| 5414 | length = sum([len(x) for x in packed]) |
| 5415 | packed[2] = struct.pack("!H", length) |
| 5416 | return ''.join(packed) |
| 5417 | |
| 5418 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5419 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5420 | obj = bsn_lacp_convergence_notif() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5421 | _version = reader.read("!B")[0] |
| 5422 | assert(_version == 4) |
| 5423 | _type = reader.read("!B")[0] |
| 5424 | assert(_type == 4) |
| 5425 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5426 | orig_reader = reader |
| 5427 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5428 | obj.xid = reader.read("!L")[0] |
| 5429 | _experimenter = reader.read("!L")[0] |
| 5430 | assert(_experimenter == 6035143) |
| 5431 | _subtype = reader.read("!L")[0] |
| 5432 | assert(_subtype == 43) |
| 5433 | obj.convergence_status = reader.read("!B")[0] |
| 5434 | reader.skip(3) |
| 5435 | obj.port_no = util.unpack_port_no(reader) |
| 5436 | obj.actor_sys_priority = reader.read("!H")[0] |
| 5437 | obj.actor_sys_mac = list(reader.read('!6B')) |
| 5438 | obj.actor_port_priority = reader.read("!H")[0] |
| 5439 | obj.actor_port_num = reader.read("!H")[0] |
| 5440 | obj.actor_key = reader.read("!H")[0] |
| 5441 | obj.partner_sys_priority = reader.read("!H")[0] |
| 5442 | obj.partner_sys_mac = list(reader.read('!6B')) |
| 5443 | obj.partner_port_priority = reader.read("!H")[0] |
| 5444 | obj.partner_port_num = reader.read("!H")[0] |
| 5445 | obj.partner_key = reader.read("!H")[0] |
| 5446 | return obj |
| 5447 | |
| 5448 | def __eq__(self, other): |
| 5449 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5450 | if self.xid != other.xid: return False |
| 5451 | if self.convergence_status != other.convergence_status: return False |
| 5452 | if self.port_no != other.port_no: return False |
| 5453 | if self.actor_sys_priority != other.actor_sys_priority: return False |
| 5454 | if self.actor_sys_mac != other.actor_sys_mac: return False |
| 5455 | if self.actor_port_priority != other.actor_port_priority: return False |
| 5456 | if self.actor_port_num != other.actor_port_num: return False |
| 5457 | if self.actor_key != other.actor_key: return False |
| 5458 | if self.partner_sys_priority != other.partner_sys_priority: return False |
| 5459 | if self.partner_sys_mac != other.partner_sys_mac: return False |
| 5460 | if self.partner_port_priority != other.partner_port_priority: return False |
| 5461 | if self.partner_port_num != other.partner_port_num: return False |
| 5462 | if self.partner_key != other.partner_key: return False |
| 5463 | return True |
| 5464 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5465 | def pretty_print(self, q): |
| 5466 | q.text("bsn_lacp_convergence_notif {") |
| 5467 | with q.group(): |
| 5468 | with q.indent(2): |
| 5469 | q.breakable() |
| 5470 | q.text("xid = "); |
| 5471 | if self.xid != None: |
| 5472 | q.text("%#x" % self.xid) |
| 5473 | else: |
| 5474 | q.text('None') |
| 5475 | q.text(","); q.breakable() |
| 5476 | q.text("convergence_status = "); |
| 5477 | q.text("%#x" % self.convergence_status) |
| 5478 | q.text(","); q.breakable() |
| 5479 | q.text("port_no = "); |
| 5480 | q.text(util.pretty_port(self.port_no)) |
| 5481 | q.text(","); q.breakable() |
| 5482 | q.text("actor_sys_priority = "); |
| 5483 | q.text("%#x" % self.actor_sys_priority) |
| 5484 | q.text(","); q.breakable() |
| 5485 | q.text("actor_sys_mac = "); |
| 5486 | q.text(util.pretty_mac(self.actor_sys_mac)) |
| 5487 | q.text(","); q.breakable() |
| 5488 | q.text("actor_port_priority = "); |
| 5489 | q.text("%#x" % self.actor_port_priority) |
| 5490 | q.text(","); q.breakable() |
| 5491 | q.text("actor_port_num = "); |
| 5492 | q.text("%#x" % self.actor_port_num) |
| 5493 | q.text(","); q.breakable() |
| 5494 | q.text("actor_key = "); |
| 5495 | q.text("%#x" % self.actor_key) |
| 5496 | q.text(","); q.breakable() |
| 5497 | q.text("partner_sys_priority = "); |
| 5498 | q.text("%#x" % self.partner_sys_priority) |
| 5499 | q.text(","); q.breakable() |
| 5500 | q.text("partner_sys_mac = "); |
| 5501 | q.text(util.pretty_mac(self.partner_sys_mac)) |
| 5502 | q.text(","); q.breakable() |
| 5503 | q.text("partner_port_priority = "); |
| 5504 | q.text("%#x" % self.partner_port_priority) |
| 5505 | q.text(","); q.breakable() |
| 5506 | q.text("partner_port_num = "); |
| 5507 | q.text("%#x" % self.partner_port_num) |
| 5508 | q.text(","); q.breakable() |
| 5509 | q.text("partner_key = "); |
| 5510 | q.text("%#x" % self.partner_key) |
| 5511 | q.breakable() |
| 5512 | q.text('}') |
| 5513 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5514 | bsn_header.subtypes[43] = bsn_lacp_convergence_notif |
| 5515 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5516 | class bsn_lacp_stats_reply(bsn_stats_reply): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5517 | version = 4 |
| 5518 | type = 19 |
| 5519 | stats_type = 65535 |
| 5520 | experimenter = 6035143 |
| 5521 | subtype = 1 |
| 5522 | |
| 5523 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5524 | if xid != None: |
| 5525 | self.xid = xid |
| 5526 | else: |
| 5527 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5528 | if flags != None: |
| 5529 | self.flags = flags |
| 5530 | else: |
| 5531 | self.flags = 0 |
| 5532 | if entries != None: |
| 5533 | self.entries = entries |
| 5534 | else: |
| 5535 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5536 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5537 | |
| 5538 | def pack(self): |
| 5539 | packed = [] |
| 5540 | packed.append(struct.pack("!B", self.version)) |
| 5541 | packed.append(struct.pack("!B", self.type)) |
| 5542 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5543 | packed.append(struct.pack("!L", self.xid)) |
| 5544 | packed.append(struct.pack("!H", self.stats_type)) |
| 5545 | packed.append(struct.pack("!H", self.flags)) |
| 5546 | packed.append('\x00' * 4) |
| 5547 | packed.append(struct.pack("!L", self.experimenter)) |
| 5548 | packed.append(struct.pack("!L", self.subtype)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5549 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5550 | length = sum([len(x) for x in packed]) |
| 5551 | packed[2] = struct.pack("!H", length) |
| 5552 | return ''.join(packed) |
| 5553 | |
| 5554 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5555 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5556 | obj = bsn_lacp_stats_reply() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5557 | _version = reader.read("!B")[0] |
| 5558 | assert(_version == 4) |
| 5559 | _type = reader.read("!B")[0] |
| 5560 | assert(_type == 19) |
| 5561 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5562 | orig_reader = reader |
| 5563 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5564 | obj.xid = reader.read("!L")[0] |
| 5565 | _stats_type = reader.read("!H")[0] |
| 5566 | assert(_stats_type == 65535) |
| 5567 | obj.flags = reader.read("!H")[0] |
| 5568 | reader.skip(4) |
| 5569 | _experimenter = reader.read("!L")[0] |
| 5570 | assert(_experimenter == 6035143) |
| 5571 | _subtype = reader.read("!L")[0] |
| 5572 | assert(_subtype == 1) |
| 5573 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_lacp_stats_entry.unpack) |
| 5574 | return obj |
| 5575 | |
| 5576 | def __eq__(self, other): |
| 5577 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5578 | if self.xid != other.xid: return False |
| 5579 | if self.flags != other.flags: return False |
| 5580 | if self.entries != other.entries: return False |
| 5581 | return True |
| 5582 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5583 | def pretty_print(self, q): |
| 5584 | q.text("bsn_lacp_stats_reply {") |
| 5585 | with q.group(): |
| 5586 | with q.indent(2): |
| 5587 | q.breakable() |
| 5588 | q.text("xid = "); |
| 5589 | if self.xid != None: |
| 5590 | q.text("%#x" % self.xid) |
| 5591 | else: |
| 5592 | q.text('None') |
| 5593 | q.text(","); q.breakable() |
| 5594 | q.text("flags = "); |
| 5595 | q.text("%#x" % self.flags) |
| 5596 | q.text(","); q.breakable() |
| 5597 | q.text("entries = "); |
| 5598 | q.pp(self.entries) |
| 5599 | q.breakable() |
| 5600 | q.text('}') |
| 5601 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5602 | bsn_stats_reply.subtypes[1] = bsn_lacp_stats_reply |
| 5603 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5604 | class bsn_lacp_stats_request(bsn_stats_request): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5605 | version = 4 |
| 5606 | type = 18 |
| 5607 | stats_type = 65535 |
| 5608 | experimenter = 6035143 |
| 5609 | subtype = 1 |
| 5610 | |
| 5611 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5612 | if xid != None: |
| 5613 | self.xid = xid |
| 5614 | else: |
| 5615 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5616 | if flags != None: |
| 5617 | self.flags = flags |
| 5618 | else: |
| 5619 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5620 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5621 | |
| 5622 | def pack(self): |
| 5623 | packed = [] |
| 5624 | packed.append(struct.pack("!B", self.version)) |
| 5625 | packed.append(struct.pack("!B", self.type)) |
| 5626 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5627 | packed.append(struct.pack("!L", self.xid)) |
| 5628 | packed.append(struct.pack("!H", self.stats_type)) |
| 5629 | packed.append(struct.pack("!H", self.flags)) |
| 5630 | packed.append('\x00' * 4) |
| 5631 | packed.append(struct.pack("!L", self.experimenter)) |
| 5632 | packed.append(struct.pack("!L", self.subtype)) |
| 5633 | length = sum([len(x) for x in packed]) |
| 5634 | packed[2] = struct.pack("!H", length) |
| 5635 | return ''.join(packed) |
| 5636 | |
| 5637 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5638 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5639 | obj = bsn_lacp_stats_request() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5640 | _version = reader.read("!B")[0] |
| 5641 | assert(_version == 4) |
| 5642 | _type = reader.read("!B")[0] |
| 5643 | assert(_type == 18) |
| 5644 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5645 | orig_reader = reader |
| 5646 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5647 | obj.xid = reader.read("!L")[0] |
| 5648 | _stats_type = reader.read("!H")[0] |
| 5649 | assert(_stats_type == 65535) |
| 5650 | obj.flags = reader.read("!H")[0] |
| 5651 | reader.skip(4) |
| 5652 | _experimenter = reader.read("!L")[0] |
| 5653 | assert(_experimenter == 6035143) |
| 5654 | _subtype = reader.read("!L")[0] |
| 5655 | assert(_subtype == 1) |
| 5656 | return obj |
| 5657 | |
| 5658 | def __eq__(self, other): |
| 5659 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5660 | if self.xid != other.xid: return False |
| 5661 | if self.flags != other.flags: return False |
| 5662 | return True |
| 5663 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5664 | def pretty_print(self, q): |
| 5665 | q.text("bsn_lacp_stats_request {") |
| 5666 | with q.group(): |
| 5667 | with q.indent(2): |
| 5668 | q.breakable() |
| 5669 | q.text("xid = "); |
| 5670 | if self.xid != None: |
| 5671 | q.text("%#x" % self.xid) |
| 5672 | else: |
| 5673 | q.text('None') |
| 5674 | q.text(","); q.breakable() |
| 5675 | q.text("flags = "); |
| 5676 | q.text("%#x" % self.flags) |
| 5677 | q.breakable() |
| 5678 | q.text('}') |
| 5679 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5680 | bsn_stats_request.subtypes[1] = bsn_lacp_stats_request |
| 5681 | |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 5682 | class bsn_log(bsn_header): |
| 5683 | version = 4 |
| 5684 | type = 4 |
| 5685 | experimenter = 6035143 |
| 5686 | subtype = 63 |
| 5687 | |
| 5688 | def __init__(self, xid=None, loglevel=None, data=None): |
| 5689 | if xid != None: |
| 5690 | self.xid = xid |
| 5691 | else: |
| 5692 | self.xid = None |
| 5693 | if loglevel != None: |
| 5694 | self.loglevel = loglevel |
| 5695 | else: |
| 5696 | self.loglevel = 0 |
| 5697 | if data != None: |
| 5698 | self.data = data |
| 5699 | else: |
| 5700 | self.data = '' |
| 5701 | return |
| 5702 | |
| 5703 | def pack(self): |
| 5704 | packed = [] |
| 5705 | packed.append(struct.pack("!B", self.version)) |
| 5706 | packed.append(struct.pack("!B", self.type)) |
| 5707 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5708 | packed.append(struct.pack("!L", self.xid)) |
| 5709 | packed.append(struct.pack("!L", self.experimenter)) |
| 5710 | packed.append(struct.pack("!L", self.subtype)) |
| 5711 | packed.append(struct.pack("!B", self.loglevel)) |
| 5712 | packed.append(self.data) |
| 5713 | length = sum([len(x) for x in packed]) |
| 5714 | packed[2] = struct.pack("!H", length) |
| 5715 | return ''.join(packed) |
| 5716 | |
| 5717 | @staticmethod |
| 5718 | def unpack(reader): |
| 5719 | obj = bsn_log() |
| 5720 | _version = reader.read("!B")[0] |
| 5721 | assert(_version == 4) |
| 5722 | _type = reader.read("!B")[0] |
| 5723 | assert(_type == 4) |
| 5724 | _length = reader.read("!H")[0] |
| 5725 | orig_reader = reader |
| 5726 | reader = orig_reader.slice(_length - (2 + 2)) |
| 5727 | obj.xid = reader.read("!L")[0] |
| 5728 | _experimenter = reader.read("!L")[0] |
| 5729 | assert(_experimenter == 6035143) |
| 5730 | _subtype = reader.read("!L")[0] |
| 5731 | assert(_subtype == 63) |
| 5732 | obj.loglevel = reader.read("!B")[0] |
| 5733 | obj.data = str(reader.read_all()) |
| 5734 | return obj |
| 5735 | |
| 5736 | def __eq__(self, other): |
| 5737 | if type(self) != type(other): return False |
| 5738 | if self.xid != other.xid: return False |
| 5739 | if self.loglevel != other.loglevel: return False |
| 5740 | if self.data != other.data: return False |
| 5741 | return True |
| 5742 | |
| 5743 | def pretty_print(self, q): |
| 5744 | q.text("bsn_log {") |
| 5745 | with q.group(): |
| 5746 | with q.indent(2): |
| 5747 | q.breakable() |
| 5748 | q.text("xid = "); |
| 5749 | if self.xid != None: |
| 5750 | q.text("%#x" % self.xid) |
| 5751 | else: |
| 5752 | q.text('None') |
| 5753 | q.text(","); q.breakable() |
| 5754 | q.text("loglevel = "); |
| 5755 | q.text("%#x" % self.loglevel) |
| 5756 | q.text(","); q.breakable() |
| 5757 | q.text("data = "); |
| 5758 | q.pp(self.data) |
| 5759 | q.breakable() |
| 5760 | q.text('}') |
| 5761 | |
| 5762 | bsn_header.subtypes[63] = bsn_log |
| 5763 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5764 | class bsn_pdu_rx_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5765 | version = 4 |
| 5766 | type = 4 |
| 5767 | experimenter = 6035143 |
| 5768 | subtype = 34 |
| 5769 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5770 | 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] | 5771 | if xid != None: |
| 5772 | self.xid = xid |
| 5773 | else: |
| 5774 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5775 | if status != None: |
| 5776 | self.status = status |
| 5777 | else: |
| 5778 | self.status = 0 |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5779 | if port_no != None: |
| 5780 | self.port_no = port_no |
| 5781 | else: |
| 5782 | self.port_no = 0 |
| 5783 | if slot_num != None: |
| 5784 | self.slot_num = slot_num |
| 5785 | else: |
| 5786 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5787 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5788 | |
| 5789 | def pack(self): |
| 5790 | packed = [] |
| 5791 | packed.append(struct.pack("!B", self.version)) |
| 5792 | packed.append(struct.pack("!B", self.type)) |
| 5793 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5794 | packed.append(struct.pack("!L", self.xid)) |
| 5795 | packed.append(struct.pack("!L", self.experimenter)) |
| 5796 | packed.append(struct.pack("!L", self.subtype)) |
| 5797 | packed.append(struct.pack("!L", self.status)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5798 | packed.append(util.pack_port_no(self.port_no)) |
| 5799 | packed.append(struct.pack("!B", self.slot_num)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5800 | length = sum([len(x) for x in packed]) |
| 5801 | packed[2] = struct.pack("!H", length) |
| 5802 | return ''.join(packed) |
| 5803 | |
| 5804 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5805 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5806 | obj = bsn_pdu_rx_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5807 | _version = reader.read("!B")[0] |
| 5808 | assert(_version == 4) |
| 5809 | _type = reader.read("!B")[0] |
| 5810 | assert(_type == 4) |
| 5811 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5812 | orig_reader = reader |
| 5813 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5814 | obj.xid = reader.read("!L")[0] |
| 5815 | _experimenter = reader.read("!L")[0] |
| 5816 | assert(_experimenter == 6035143) |
| 5817 | _subtype = reader.read("!L")[0] |
| 5818 | assert(_subtype == 34) |
| 5819 | obj.status = reader.read("!L")[0] |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5820 | obj.port_no = util.unpack_port_no(reader) |
| 5821 | obj.slot_num = reader.read("!B")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5822 | return obj |
| 5823 | |
| 5824 | def __eq__(self, other): |
| 5825 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5826 | if self.xid != other.xid: return False |
| 5827 | if self.status != other.status: return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5828 | if self.port_no != other.port_no: return False |
| 5829 | if self.slot_num != other.slot_num: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5830 | return True |
| 5831 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5832 | def pretty_print(self, q): |
| 5833 | q.text("bsn_pdu_rx_reply {") |
| 5834 | with q.group(): |
| 5835 | with q.indent(2): |
| 5836 | q.breakable() |
| 5837 | q.text("xid = "); |
| 5838 | if self.xid != None: |
| 5839 | q.text("%#x" % self.xid) |
| 5840 | else: |
| 5841 | q.text('None') |
| 5842 | q.text(","); q.breakable() |
| 5843 | q.text("status = "); |
| 5844 | q.text("%#x" % self.status) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5845 | q.text(","); q.breakable() |
| 5846 | q.text("port_no = "); |
| 5847 | q.text(util.pretty_port(self.port_no)) |
| 5848 | q.text(","); q.breakable() |
| 5849 | q.text("slot_num = "); |
| 5850 | q.text("%#x" % self.slot_num) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5851 | q.breakable() |
| 5852 | q.text('}') |
| 5853 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5854 | bsn_header.subtypes[34] = bsn_pdu_rx_reply |
| 5855 | |
| 5856 | class bsn_pdu_rx_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5857 | version = 4 |
| 5858 | type = 4 |
| 5859 | experimenter = 6035143 |
| 5860 | subtype = 33 |
| 5861 | |
| 5862 | 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] | 5863 | if xid != None: |
| 5864 | self.xid = xid |
| 5865 | else: |
| 5866 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5867 | if timeout_ms != None: |
| 5868 | self.timeout_ms = timeout_ms |
| 5869 | else: |
| 5870 | self.timeout_ms = 0 |
| 5871 | if port_no != None: |
| 5872 | self.port_no = port_no |
| 5873 | else: |
| 5874 | self.port_no = 0 |
| 5875 | if slot_num != None: |
| 5876 | self.slot_num = slot_num |
| 5877 | else: |
| 5878 | self.slot_num = 0 |
| 5879 | if data != None: |
| 5880 | self.data = data |
| 5881 | else: |
| 5882 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5883 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5884 | |
| 5885 | def pack(self): |
| 5886 | packed = [] |
| 5887 | packed.append(struct.pack("!B", self.version)) |
| 5888 | packed.append(struct.pack("!B", self.type)) |
| 5889 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5890 | packed.append(struct.pack("!L", self.xid)) |
| 5891 | packed.append(struct.pack("!L", self.experimenter)) |
| 5892 | packed.append(struct.pack("!L", self.subtype)) |
| 5893 | packed.append(struct.pack("!L", self.timeout_ms)) |
| 5894 | packed.append(util.pack_port_no(self.port_no)) |
| 5895 | packed.append(struct.pack("!B", self.slot_num)) |
| 5896 | packed.append('\x00' * 3) |
| 5897 | packed.append(self.data) |
| 5898 | length = sum([len(x) for x in packed]) |
| 5899 | packed[2] = struct.pack("!H", length) |
| 5900 | return ''.join(packed) |
| 5901 | |
| 5902 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5903 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5904 | obj = bsn_pdu_rx_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5905 | _version = reader.read("!B")[0] |
| 5906 | assert(_version == 4) |
| 5907 | _type = reader.read("!B")[0] |
| 5908 | assert(_type == 4) |
| 5909 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5910 | orig_reader = reader |
| 5911 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5912 | obj.xid = reader.read("!L")[0] |
| 5913 | _experimenter = reader.read("!L")[0] |
| 5914 | assert(_experimenter == 6035143) |
| 5915 | _subtype = reader.read("!L")[0] |
| 5916 | assert(_subtype == 33) |
| 5917 | obj.timeout_ms = reader.read("!L")[0] |
| 5918 | obj.port_no = util.unpack_port_no(reader) |
| 5919 | obj.slot_num = reader.read("!B")[0] |
| 5920 | reader.skip(3) |
| 5921 | obj.data = str(reader.read_all()) |
| 5922 | return obj |
| 5923 | |
| 5924 | def __eq__(self, other): |
| 5925 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5926 | if self.xid != other.xid: return False |
| 5927 | if self.timeout_ms != other.timeout_ms: return False |
| 5928 | if self.port_no != other.port_no: return False |
| 5929 | if self.slot_num != other.slot_num: return False |
| 5930 | if self.data != other.data: return False |
| 5931 | return True |
| 5932 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5933 | def pretty_print(self, q): |
| 5934 | q.text("bsn_pdu_rx_request {") |
| 5935 | with q.group(): |
| 5936 | with q.indent(2): |
| 5937 | q.breakable() |
| 5938 | q.text("xid = "); |
| 5939 | if self.xid != None: |
| 5940 | q.text("%#x" % self.xid) |
| 5941 | else: |
| 5942 | q.text('None') |
| 5943 | q.text(","); q.breakable() |
| 5944 | q.text("timeout_ms = "); |
| 5945 | q.text("%#x" % self.timeout_ms) |
| 5946 | q.text(","); q.breakable() |
| 5947 | q.text("port_no = "); |
| 5948 | q.text(util.pretty_port(self.port_no)) |
| 5949 | q.text(","); q.breakable() |
| 5950 | q.text("slot_num = "); |
| 5951 | q.text("%#x" % self.slot_num) |
| 5952 | q.text(","); q.breakable() |
| 5953 | q.text("data = "); |
| 5954 | q.pp(self.data) |
| 5955 | q.breakable() |
| 5956 | q.text('}') |
| 5957 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5958 | bsn_header.subtypes[33] = bsn_pdu_rx_request |
| 5959 | |
| 5960 | class bsn_pdu_rx_timeout(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5961 | version = 4 |
| 5962 | type = 4 |
| 5963 | experimenter = 6035143 |
| 5964 | subtype = 35 |
| 5965 | |
| 5966 | def __init__(self, xid=None, port_no=None, slot_num=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5967 | if xid != None: |
| 5968 | self.xid = xid |
| 5969 | else: |
| 5970 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5971 | if port_no != None: |
| 5972 | self.port_no = port_no |
| 5973 | else: |
| 5974 | self.port_no = 0 |
| 5975 | if slot_num != None: |
| 5976 | self.slot_num = slot_num |
| 5977 | else: |
| 5978 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5979 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5980 | |
| 5981 | def pack(self): |
| 5982 | packed = [] |
| 5983 | packed.append(struct.pack("!B", self.version)) |
| 5984 | packed.append(struct.pack("!B", self.type)) |
| 5985 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5986 | packed.append(struct.pack("!L", self.xid)) |
| 5987 | packed.append(struct.pack("!L", self.experimenter)) |
| 5988 | packed.append(struct.pack("!L", self.subtype)) |
| 5989 | packed.append(util.pack_port_no(self.port_no)) |
| 5990 | packed.append(struct.pack("!B", self.slot_num)) |
| 5991 | length = sum([len(x) for x in packed]) |
| 5992 | packed[2] = struct.pack("!H", length) |
| 5993 | return ''.join(packed) |
| 5994 | |
| 5995 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5996 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5997 | obj = bsn_pdu_rx_timeout() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5998 | _version = reader.read("!B")[0] |
| 5999 | assert(_version == 4) |
| 6000 | _type = reader.read("!B")[0] |
| 6001 | assert(_type == 4) |
| 6002 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6003 | orig_reader = reader |
| 6004 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6005 | obj.xid = reader.read("!L")[0] |
| 6006 | _experimenter = reader.read("!L")[0] |
| 6007 | assert(_experimenter == 6035143) |
| 6008 | _subtype = reader.read("!L")[0] |
| 6009 | assert(_subtype == 35) |
| 6010 | obj.port_no = util.unpack_port_no(reader) |
| 6011 | obj.slot_num = reader.read("!B")[0] |
| 6012 | return obj |
| 6013 | |
| 6014 | def __eq__(self, other): |
| 6015 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6016 | if self.xid != other.xid: return False |
| 6017 | if self.port_no != other.port_no: return False |
| 6018 | if self.slot_num != other.slot_num: return False |
| 6019 | return True |
| 6020 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6021 | def pretty_print(self, q): |
| 6022 | q.text("bsn_pdu_rx_timeout {") |
| 6023 | with q.group(): |
| 6024 | with q.indent(2): |
| 6025 | q.breakable() |
| 6026 | q.text("xid = "); |
| 6027 | if self.xid != None: |
| 6028 | q.text("%#x" % self.xid) |
| 6029 | else: |
| 6030 | q.text('None') |
| 6031 | q.text(","); q.breakable() |
| 6032 | q.text("port_no = "); |
| 6033 | q.text(util.pretty_port(self.port_no)) |
| 6034 | q.text(","); q.breakable() |
| 6035 | q.text("slot_num = "); |
| 6036 | q.text("%#x" % self.slot_num) |
| 6037 | q.breakable() |
| 6038 | q.text('}') |
| 6039 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6040 | bsn_header.subtypes[35] = bsn_pdu_rx_timeout |
| 6041 | |
| 6042 | class bsn_pdu_tx_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6043 | version = 4 |
| 6044 | type = 4 |
| 6045 | experimenter = 6035143 |
| 6046 | subtype = 32 |
| 6047 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6048 | 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] | 6049 | if xid != None: |
| 6050 | self.xid = xid |
| 6051 | else: |
| 6052 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6053 | if status != None: |
| 6054 | self.status = status |
| 6055 | else: |
| 6056 | self.status = 0 |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6057 | if port_no != None: |
| 6058 | self.port_no = port_no |
| 6059 | else: |
| 6060 | self.port_no = 0 |
| 6061 | if slot_num != None: |
| 6062 | self.slot_num = slot_num |
| 6063 | else: |
| 6064 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6065 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6066 | |
| 6067 | def pack(self): |
| 6068 | packed = [] |
| 6069 | packed.append(struct.pack("!B", self.version)) |
| 6070 | packed.append(struct.pack("!B", self.type)) |
| 6071 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6072 | packed.append(struct.pack("!L", self.xid)) |
| 6073 | packed.append(struct.pack("!L", self.experimenter)) |
| 6074 | packed.append(struct.pack("!L", self.subtype)) |
| 6075 | packed.append(struct.pack("!L", self.status)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6076 | packed.append(util.pack_port_no(self.port_no)) |
| 6077 | packed.append(struct.pack("!B", self.slot_num)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6078 | length = sum([len(x) for x in packed]) |
| 6079 | packed[2] = struct.pack("!H", length) |
| 6080 | return ''.join(packed) |
| 6081 | |
| 6082 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6083 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6084 | obj = bsn_pdu_tx_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6085 | _version = reader.read("!B")[0] |
| 6086 | assert(_version == 4) |
| 6087 | _type = reader.read("!B")[0] |
| 6088 | assert(_type == 4) |
| 6089 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6090 | orig_reader = reader |
| 6091 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6092 | obj.xid = reader.read("!L")[0] |
| 6093 | _experimenter = reader.read("!L")[0] |
| 6094 | assert(_experimenter == 6035143) |
| 6095 | _subtype = reader.read("!L")[0] |
| 6096 | assert(_subtype == 32) |
| 6097 | obj.status = reader.read("!L")[0] |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6098 | obj.port_no = util.unpack_port_no(reader) |
| 6099 | obj.slot_num = reader.read("!B")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6100 | return obj |
| 6101 | |
| 6102 | def __eq__(self, other): |
| 6103 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6104 | if self.xid != other.xid: return False |
| 6105 | if self.status != other.status: return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6106 | if self.port_no != other.port_no: return False |
| 6107 | if self.slot_num != other.slot_num: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6108 | return True |
| 6109 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6110 | def pretty_print(self, q): |
| 6111 | q.text("bsn_pdu_tx_reply {") |
| 6112 | with q.group(): |
| 6113 | with q.indent(2): |
| 6114 | q.breakable() |
| 6115 | q.text("xid = "); |
| 6116 | if self.xid != None: |
| 6117 | q.text("%#x" % self.xid) |
| 6118 | else: |
| 6119 | q.text('None') |
| 6120 | q.text(","); q.breakable() |
| 6121 | q.text("status = "); |
| 6122 | q.text("%#x" % self.status) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6123 | q.text(","); q.breakable() |
| 6124 | q.text("port_no = "); |
| 6125 | q.text(util.pretty_port(self.port_no)) |
| 6126 | q.text(","); q.breakable() |
| 6127 | q.text("slot_num = "); |
| 6128 | q.text("%#x" % self.slot_num) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6129 | q.breakable() |
| 6130 | q.text('}') |
| 6131 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6132 | bsn_header.subtypes[32] = bsn_pdu_tx_reply |
| 6133 | |
| 6134 | class bsn_pdu_tx_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6135 | version = 4 |
| 6136 | type = 4 |
| 6137 | experimenter = 6035143 |
| 6138 | subtype = 31 |
| 6139 | |
| 6140 | 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] | 6141 | if xid != None: |
| 6142 | self.xid = xid |
| 6143 | else: |
| 6144 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6145 | if tx_interval_ms != None: |
| 6146 | self.tx_interval_ms = tx_interval_ms |
| 6147 | else: |
| 6148 | self.tx_interval_ms = 0 |
| 6149 | if port_no != None: |
| 6150 | self.port_no = port_no |
| 6151 | else: |
| 6152 | self.port_no = 0 |
| 6153 | if slot_num != None: |
| 6154 | self.slot_num = slot_num |
| 6155 | else: |
| 6156 | self.slot_num = 0 |
| 6157 | if data != None: |
| 6158 | self.data = data |
| 6159 | else: |
| 6160 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6161 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6162 | |
| 6163 | def pack(self): |
| 6164 | packed = [] |
| 6165 | packed.append(struct.pack("!B", self.version)) |
| 6166 | packed.append(struct.pack("!B", self.type)) |
| 6167 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6168 | packed.append(struct.pack("!L", self.xid)) |
| 6169 | packed.append(struct.pack("!L", self.experimenter)) |
| 6170 | packed.append(struct.pack("!L", self.subtype)) |
| 6171 | packed.append(struct.pack("!L", self.tx_interval_ms)) |
| 6172 | packed.append(util.pack_port_no(self.port_no)) |
| 6173 | packed.append(struct.pack("!B", self.slot_num)) |
| 6174 | packed.append('\x00' * 3) |
| 6175 | packed.append(self.data) |
| 6176 | length = sum([len(x) for x in packed]) |
| 6177 | packed[2] = struct.pack("!H", length) |
| 6178 | return ''.join(packed) |
| 6179 | |
| 6180 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6181 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6182 | obj = bsn_pdu_tx_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6183 | _version = reader.read("!B")[0] |
| 6184 | assert(_version == 4) |
| 6185 | _type = reader.read("!B")[0] |
| 6186 | assert(_type == 4) |
| 6187 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6188 | orig_reader = reader |
| 6189 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6190 | obj.xid = reader.read("!L")[0] |
| 6191 | _experimenter = reader.read("!L")[0] |
| 6192 | assert(_experimenter == 6035143) |
| 6193 | _subtype = reader.read("!L")[0] |
| 6194 | assert(_subtype == 31) |
| 6195 | obj.tx_interval_ms = reader.read("!L")[0] |
| 6196 | obj.port_no = util.unpack_port_no(reader) |
| 6197 | obj.slot_num = reader.read("!B")[0] |
| 6198 | reader.skip(3) |
| 6199 | obj.data = str(reader.read_all()) |
| 6200 | return obj |
| 6201 | |
| 6202 | def __eq__(self, other): |
| 6203 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6204 | if self.xid != other.xid: return False |
| 6205 | if self.tx_interval_ms != other.tx_interval_ms: return False |
| 6206 | if self.port_no != other.port_no: return False |
| 6207 | if self.slot_num != other.slot_num: return False |
| 6208 | if self.data != other.data: return False |
| 6209 | return True |
| 6210 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6211 | def pretty_print(self, q): |
| 6212 | q.text("bsn_pdu_tx_request {") |
| 6213 | with q.group(): |
| 6214 | with q.indent(2): |
| 6215 | q.breakable() |
| 6216 | q.text("xid = "); |
| 6217 | if self.xid != None: |
| 6218 | q.text("%#x" % self.xid) |
| 6219 | else: |
| 6220 | q.text('None') |
| 6221 | q.text(","); q.breakable() |
| 6222 | q.text("tx_interval_ms = "); |
| 6223 | q.text("%#x" % self.tx_interval_ms) |
| 6224 | q.text(","); q.breakable() |
| 6225 | q.text("port_no = "); |
| 6226 | q.text(util.pretty_port(self.port_no)) |
| 6227 | q.text(","); q.breakable() |
| 6228 | q.text("slot_num = "); |
| 6229 | q.text("%#x" % self.slot_num) |
| 6230 | q.text(","); q.breakable() |
| 6231 | q.text("data = "); |
| 6232 | q.pp(self.data) |
| 6233 | q.breakable() |
| 6234 | q.text('}') |
| 6235 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6236 | bsn_header.subtypes[31] = bsn_pdu_tx_request |
| 6237 | |
| 6238 | class bsn_port_counter_stats_reply(bsn_stats_reply): |
| 6239 | version = 4 |
| 6240 | type = 19 |
| 6241 | stats_type = 65535 |
| 6242 | experimenter = 6035143 |
| 6243 | subtype = 8 |
| 6244 | |
| 6245 | def __init__(self, xid=None, flags=None, entries=None): |
| 6246 | if xid != None: |
| 6247 | self.xid = xid |
| 6248 | else: |
| 6249 | self.xid = None |
| 6250 | if flags != None: |
| 6251 | self.flags = flags |
| 6252 | else: |
| 6253 | self.flags = 0 |
| 6254 | if entries != None: |
| 6255 | self.entries = entries |
| 6256 | else: |
| 6257 | self.entries = [] |
| 6258 | return |
| 6259 | |
| 6260 | def pack(self): |
| 6261 | packed = [] |
| 6262 | packed.append(struct.pack("!B", self.version)) |
| 6263 | packed.append(struct.pack("!B", self.type)) |
| 6264 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6265 | packed.append(struct.pack("!L", self.xid)) |
| 6266 | packed.append(struct.pack("!H", self.stats_type)) |
| 6267 | packed.append(struct.pack("!H", self.flags)) |
| 6268 | packed.append('\x00' * 4) |
| 6269 | packed.append(struct.pack("!L", self.experimenter)) |
| 6270 | packed.append(struct.pack("!L", self.subtype)) |
| 6271 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 6272 | length = sum([len(x) for x in packed]) |
| 6273 | packed[2] = struct.pack("!H", length) |
| 6274 | return ''.join(packed) |
| 6275 | |
| 6276 | @staticmethod |
| 6277 | def unpack(reader): |
| 6278 | obj = bsn_port_counter_stats_reply() |
| 6279 | _version = reader.read("!B")[0] |
| 6280 | assert(_version == 4) |
| 6281 | _type = reader.read("!B")[0] |
| 6282 | assert(_type == 19) |
| 6283 | _length = reader.read("!H")[0] |
| 6284 | orig_reader = reader |
| 6285 | reader = orig_reader.slice(_length - (2 + 2)) |
| 6286 | obj.xid = reader.read("!L")[0] |
| 6287 | _stats_type = reader.read("!H")[0] |
| 6288 | assert(_stats_type == 65535) |
| 6289 | obj.flags = reader.read("!H")[0] |
| 6290 | reader.skip(4) |
| 6291 | _experimenter = reader.read("!L")[0] |
| 6292 | assert(_experimenter == 6035143) |
| 6293 | _subtype = reader.read("!L")[0] |
| 6294 | assert(_subtype == 8) |
| 6295 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_port_counter_stats_entry.unpack) |
| 6296 | return obj |
| 6297 | |
| 6298 | def __eq__(self, other): |
| 6299 | if type(self) != type(other): return False |
| 6300 | if self.xid != other.xid: return False |
| 6301 | if self.flags != other.flags: return False |
| 6302 | if self.entries != other.entries: return False |
| 6303 | return True |
| 6304 | |
| 6305 | def pretty_print(self, q): |
| 6306 | q.text("bsn_port_counter_stats_reply {") |
| 6307 | with q.group(): |
| 6308 | with q.indent(2): |
| 6309 | q.breakable() |
| 6310 | q.text("xid = "); |
| 6311 | if self.xid != None: |
| 6312 | q.text("%#x" % self.xid) |
| 6313 | else: |
| 6314 | q.text('None') |
| 6315 | q.text(","); q.breakable() |
| 6316 | q.text("flags = "); |
| 6317 | q.text("%#x" % self.flags) |
| 6318 | q.text(","); q.breakable() |
| 6319 | q.text("entries = "); |
| 6320 | q.pp(self.entries) |
| 6321 | q.breakable() |
| 6322 | q.text('}') |
| 6323 | |
| 6324 | bsn_stats_reply.subtypes[8] = bsn_port_counter_stats_reply |
| 6325 | |
| 6326 | class bsn_port_counter_stats_request(bsn_stats_request): |
| 6327 | version = 4 |
| 6328 | type = 18 |
| 6329 | stats_type = 65535 |
| 6330 | experimenter = 6035143 |
| 6331 | subtype = 8 |
| 6332 | |
| 6333 | def __init__(self, xid=None, flags=None, port_no=None): |
| 6334 | if xid != None: |
| 6335 | self.xid = xid |
| 6336 | else: |
| 6337 | self.xid = None |
| 6338 | if flags != None: |
| 6339 | self.flags = flags |
| 6340 | else: |
| 6341 | self.flags = 0 |
| 6342 | if port_no != None: |
| 6343 | self.port_no = port_no |
| 6344 | else: |
| 6345 | self.port_no = 0 |
| 6346 | return |
| 6347 | |
| 6348 | def pack(self): |
| 6349 | packed = [] |
| 6350 | packed.append(struct.pack("!B", self.version)) |
| 6351 | packed.append(struct.pack("!B", self.type)) |
| 6352 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6353 | packed.append(struct.pack("!L", self.xid)) |
| 6354 | packed.append(struct.pack("!H", self.stats_type)) |
| 6355 | packed.append(struct.pack("!H", self.flags)) |
| 6356 | packed.append('\x00' * 4) |
| 6357 | packed.append(struct.pack("!L", self.experimenter)) |
| 6358 | packed.append(struct.pack("!L", self.subtype)) |
| 6359 | packed.append(util.pack_port_no(self.port_no)) |
| 6360 | length = sum([len(x) for x in packed]) |
| 6361 | packed[2] = struct.pack("!H", length) |
| 6362 | return ''.join(packed) |
| 6363 | |
| 6364 | @staticmethod |
| 6365 | def unpack(reader): |
| 6366 | obj = bsn_port_counter_stats_request() |
| 6367 | _version = reader.read("!B")[0] |
| 6368 | assert(_version == 4) |
| 6369 | _type = reader.read("!B")[0] |
| 6370 | assert(_type == 18) |
| 6371 | _length = reader.read("!H")[0] |
| 6372 | orig_reader = reader |
| 6373 | reader = orig_reader.slice(_length - (2 + 2)) |
| 6374 | obj.xid = reader.read("!L")[0] |
| 6375 | _stats_type = reader.read("!H")[0] |
| 6376 | assert(_stats_type == 65535) |
| 6377 | obj.flags = reader.read("!H")[0] |
| 6378 | reader.skip(4) |
| 6379 | _experimenter = reader.read("!L")[0] |
| 6380 | assert(_experimenter == 6035143) |
| 6381 | _subtype = reader.read("!L")[0] |
| 6382 | assert(_subtype == 8) |
| 6383 | obj.port_no = util.unpack_port_no(reader) |
| 6384 | return obj |
| 6385 | |
| 6386 | def __eq__(self, other): |
| 6387 | if type(self) != type(other): return False |
| 6388 | if self.xid != other.xid: return False |
| 6389 | if self.flags != other.flags: return False |
| 6390 | if self.port_no != other.port_no: return False |
| 6391 | return True |
| 6392 | |
| 6393 | def pretty_print(self, q): |
| 6394 | q.text("bsn_port_counter_stats_request {") |
| 6395 | with q.group(): |
| 6396 | with q.indent(2): |
| 6397 | q.breakable() |
| 6398 | q.text("xid = "); |
| 6399 | if self.xid != None: |
| 6400 | q.text("%#x" % self.xid) |
| 6401 | else: |
| 6402 | q.text('None') |
| 6403 | q.text(","); q.breakable() |
| 6404 | q.text("flags = "); |
| 6405 | q.text("%#x" % self.flags) |
| 6406 | q.text(","); q.breakable() |
| 6407 | q.text("port_no = "); |
| 6408 | q.text(util.pretty_port(self.port_no)) |
| 6409 | q.breakable() |
| 6410 | q.text('}') |
| 6411 | |
| 6412 | bsn_stats_request.subtypes[8] = bsn_port_counter_stats_request |
| 6413 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 6414 | class bsn_role_status(bsn_header): |
| 6415 | version = 4 |
| 6416 | type = 4 |
| 6417 | experimenter = 6035143 |
| 6418 | subtype = 55 |
| 6419 | |
| 6420 | def __init__(self, xid=None, role=None, reason=None, generation_id=None): |
| 6421 | if xid != None: |
| 6422 | self.xid = xid |
| 6423 | else: |
| 6424 | self.xid = None |
| 6425 | if role != None: |
| 6426 | self.role = role |
| 6427 | else: |
| 6428 | self.role = 0 |
| 6429 | if reason != None: |
| 6430 | self.reason = reason |
| 6431 | else: |
| 6432 | self.reason = 0 |
| 6433 | if generation_id != None: |
| 6434 | self.generation_id = generation_id |
| 6435 | else: |
| 6436 | self.generation_id = 0 |
| 6437 | return |
| 6438 | |
| 6439 | def pack(self): |
| 6440 | packed = [] |
| 6441 | packed.append(struct.pack("!B", self.version)) |
| 6442 | packed.append(struct.pack("!B", self.type)) |
| 6443 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6444 | packed.append(struct.pack("!L", self.xid)) |
| 6445 | packed.append(struct.pack("!L", self.experimenter)) |
| 6446 | packed.append(struct.pack("!L", self.subtype)) |
| 6447 | packed.append(struct.pack("!L", self.role)) |
| 6448 | packed.append(struct.pack("!B", self.reason)) |
| 6449 | packed.append('\x00' * 3) |
| 6450 | packed.append(struct.pack("!Q", self.generation_id)) |
| 6451 | length = sum([len(x) for x in packed]) |
| 6452 | packed[2] = struct.pack("!H", length) |
| 6453 | return ''.join(packed) |
| 6454 | |
| 6455 | @staticmethod |
| 6456 | def unpack(reader): |
| 6457 | obj = bsn_role_status() |
| 6458 | _version = reader.read("!B")[0] |
| 6459 | assert(_version == 4) |
| 6460 | _type = reader.read("!B")[0] |
| 6461 | assert(_type == 4) |
| 6462 | _length = reader.read("!H")[0] |
| 6463 | orig_reader = reader |
| 6464 | reader = orig_reader.slice(_length - (2 + 2)) |
| 6465 | obj.xid = reader.read("!L")[0] |
| 6466 | _experimenter = reader.read("!L")[0] |
| 6467 | assert(_experimenter == 6035143) |
| 6468 | _subtype = reader.read("!L")[0] |
| 6469 | assert(_subtype == 55) |
| 6470 | obj.role = reader.read("!L")[0] |
| 6471 | obj.reason = reader.read("!B")[0] |
| 6472 | reader.skip(3) |
| 6473 | obj.generation_id = reader.read("!Q")[0] |
| 6474 | return obj |
| 6475 | |
| 6476 | def __eq__(self, other): |
| 6477 | if type(self) != type(other): return False |
| 6478 | if self.xid != other.xid: return False |
| 6479 | if self.role != other.role: return False |
| 6480 | if self.reason != other.reason: return False |
| 6481 | if self.generation_id != other.generation_id: return False |
| 6482 | return True |
| 6483 | |
| 6484 | def pretty_print(self, q): |
| 6485 | q.text("bsn_role_status {") |
| 6486 | with q.group(): |
| 6487 | with q.indent(2): |
| 6488 | q.breakable() |
| 6489 | q.text("xid = "); |
| 6490 | if self.xid != None: |
| 6491 | q.text("%#x" % self.xid) |
| 6492 | else: |
| 6493 | q.text('None') |
| 6494 | q.text(","); q.breakable() |
| 6495 | q.text("role = "); |
| 6496 | q.text("%#x" % self.role) |
| 6497 | q.text(","); q.breakable() |
| 6498 | q.text("reason = "); |
| 6499 | q.text("%#x" % self.reason) |
| 6500 | q.text(","); q.breakable() |
| 6501 | q.text("generation_id = "); |
| 6502 | q.text("%#x" % self.generation_id) |
| 6503 | q.breakable() |
| 6504 | q.text('}') |
| 6505 | |
| 6506 | bsn_header.subtypes[55] = bsn_role_status |
| 6507 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 6508 | class bsn_set_aux_cxns_reply(bsn_header): |
| 6509 | version = 4 |
| 6510 | type = 4 |
| 6511 | experimenter = 6035143 |
| 6512 | subtype = 59 |
| 6513 | |
| 6514 | def __init__(self, xid=None, num_aux=None, status=None): |
| 6515 | if xid != None: |
| 6516 | self.xid = xid |
| 6517 | else: |
| 6518 | self.xid = None |
| 6519 | if num_aux != None: |
| 6520 | self.num_aux = num_aux |
| 6521 | else: |
| 6522 | self.num_aux = 0 |
| 6523 | if status != None: |
| 6524 | self.status = status |
| 6525 | else: |
| 6526 | self.status = 0 |
| 6527 | return |
| 6528 | |
| 6529 | def pack(self): |
| 6530 | packed = [] |
| 6531 | packed.append(struct.pack("!B", self.version)) |
| 6532 | packed.append(struct.pack("!B", self.type)) |
| 6533 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6534 | packed.append(struct.pack("!L", self.xid)) |
| 6535 | packed.append(struct.pack("!L", self.experimenter)) |
| 6536 | packed.append(struct.pack("!L", self.subtype)) |
| 6537 | packed.append(struct.pack("!L", self.num_aux)) |
| 6538 | packed.append(struct.pack("!L", self.status)) |
| 6539 | length = sum([len(x) for x in packed]) |
| 6540 | packed[2] = struct.pack("!H", length) |
| 6541 | return ''.join(packed) |
| 6542 | |
| 6543 | @staticmethod |
| 6544 | def unpack(reader): |
| 6545 | obj = bsn_set_aux_cxns_reply() |
| 6546 | _version = reader.read("!B")[0] |
| 6547 | assert(_version == 4) |
| 6548 | _type = reader.read("!B")[0] |
| 6549 | assert(_type == 4) |
| 6550 | _length = reader.read("!H")[0] |
| 6551 | orig_reader = reader |
| 6552 | reader = orig_reader.slice(_length - (2 + 2)) |
| 6553 | obj.xid = reader.read("!L")[0] |
| 6554 | _experimenter = reader.read("!L")[0] |
| 6555 | assert(_experimenter == 6035143) |
| 6556 | _subtype = reader.read("!L")[0] |
| 6557 | assert(_subtype == 59) |
| 6558 | obj.num_aux = reader.read("!L")[0] |
| 6559 | obj.status = reader.read("!L")[0] |
| 6560 | return obj |
| 6561 | |
| 6562 | def __eq__(self, other): |
| 6563 | if type(self) != type(other): return False |
| 6564 | if self.xid != other.xid: return False |
| 6565 | if self.num_aux != other.num_aux: return False |
| 6566 | if self.status != other.status: return False |
| 6567 | return True |
| 6568 | |
| 6569 | def pretty_print(self, q): |
| 6570 | q.text("bsn_set_aux_cxns_reply {") |
| 6571 | with q.group(): |
| 6572 | with q.indent(2): |
| 6573 | q.breakable() |
| 6574 | q.text("xid = "); |
| 6575 | if self.xid != None: |
| 6576 | q.text("%#x" % self.xid) |
| 6577 | else: |
| 6578 | q.text('None') |
| 6579 | q.text(","); q.breakable() |
| 6580 | q.text("num_aux = "); |
| 6581 | q.text("%#x" % self.num_aux) |
| 6582 | q.text(","); q.breakable() |
| 6583 | q.text("status = "); |
| 6584 | q.text("%#x" % self.status) |
| 6585 | q.breakable() |
| 6586 | q.text('}') |
| 6587 | |
| 6588 | bsn_header.subtypes[59] = bsn_set_aux_cxns_reply |
| 6589 | |
| 6590 | class bsn_set_aux_cxns_request(bsn_header): |
| 6591 | version = 4 |
| 6592 | type = 4 |
| 6593 | experimenter = 6035143 |
| 6594 | subtype = 58 |
| 6595 | |
| 6596 | def __init__(self, xid=None, num_aux=None): |
| 6597 | if xid != None: |
| 6598 | self.xid = xid |
| 6599 | else: |
| 6600 | self.xid = None |
| 6601 | if num_aux != None: |
| 6602 | self.num_aux = num_aux |
| 6603 | else: |
| 6604 | self.num_aux = 0 |
| 6605 | return |
| 6606 | |
| 6607 | def pack(self): |
| 6608 | packed = [] |
| 6609 | packed.append(struct.pack("!B", self.version)) |
| 6610 | packed.append(struct.pack("!B", self.type)) |
| 6611 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6612 | packed.append(struct.pack("!L", self.xid)) |
| 6613 | packed.append(struct.pack("!L", self.experimenter)) |
| 6614 | packed.append(struct.pack("!L", self.subtype)) |
| 6615 | packed.append(struct.pack("!L", self.num_aux)) |
| 6616 | length = sum([len(x) for x in packed]) |
| 6617 | packed[2] = struct.pack("!H", length) |
| 6618 | return ''.join(packed) |
| 6619 | |
| 6620 | @staticmethod |
| 6621 | def unpack(reader): |
| 6622 | obj = bsn_set_aux_cxns_request() |
| 6623 | _version = reader.read("!B")[0] |
| 6624 | assert(_version == 4) |
| 6625 | _type = reader.read("!B")[0] |
| 6626 | assert(_type == 4) |
| 6627 | _length = reader.read("!H")[0] |
| 6628 | orig_reader = reader |
| 6629 | reader = orig_reader.slice(_length - (2 + 2)) |
| 6630 | obj.xid = reader.read("!L")[0] |
| 6631 | _experimenter = reader.read("!L")[0] |
| 6632 | assert(_experimenter == 6035143) |
| 6633 | _subtype = reader.read("!L")[0] |
| 6634 | assert(_subtype == 58) |
| 6635 | obj.num_aux = reader.read("!L")[0] |
| 6636 | return obj |
| 6637 | |
| 6638 | def __eq__(self, other): |
| 6639 | if type(self) != type(other): return False |
| 6640 | if self.xid != other.xid: return False |
| 6641 | if self.num_aux != other.num_aux: return False |
| 6642 | return True |
| 6643 | |
| 6644 | def pretty_print(self, q): |
| 6645 | q.text("bsn_set_aux_cxns_request {") |
| 6646 | with q.group(): |
| 6647 | with q.indent(2): |
| 6648 | q.breakable() |
| 6649 | q.text("xid = "); |
| 6650 | if self.xid != None: |
| 6651 | q.text("%#x" % self.xid) |
| 6652 | else: |
| 6653 | q.text('None') |
| 6654 | q.text(","); q.breakable() |
| 6655 | q.text("num_aux = "); |
| 6656 | q.text("%#x" % self.num_aux) |
| 6657 | q.breakable() |
| 6658 | q.text('}') |
| 6659 | |
| 6660 | bsn_header.subtypes[58] = bsn_set_aux_cxns_request |
| 6661 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6662 | class bsn_set_lacp_reply(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6663 | version = 4 |
| 6664 | type = 4 |
| 6665 | experimenter = 6035143 |
| 6666 | subtype = 42 |
| 6667 | |
| 6668 | def __init__(self, xid=None, status=None, port_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6669 | if xid != None: |
| 6670 | self.xid = xid |
| 6671 | else: |
| 6672 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6673 | if status != None: |
| 6674 | self.status = status |
| 6675 | else: |
| 6676 | self.status = 0 |
| 6677 | if port_no != None: |
| 6678 | self.port_no = port_no |
| 6679 | else: |
| 6680 | self.port_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6681 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6682 | |
| 6683 | def pack(self): |
| 6684 | packed = [] |
| 6685 | packed.append(struct.pack("!B", self.version)) |
| 6686 | packed.append(struct.pack("!B", self.type)) |
| 6687 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6688 | packed.append(struct.pack("!L", self.xid)) |
| 6689 | packed.append(struct.pack("!L", self.experimenter)) |
| 6690 | packed.append(struct.pack("!L", self.subtype)) |
| 6691 | packed.append(struct.pack("!L", self.status)) |
| 6692 | packed.append(util.pack_port_no(self.port_no)) |
| 6693 | length = sum([len(x) for x in packed]) |
| 6694 | packed[2] = struct.pack("!H", length) |
| 6695 | return ''.join(packed) |
| 6696 | |
| 6697 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6698 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6699 | obj = bsn_set_lacp_reply() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6700 | _version = reader.read("!B")[0] |
| 6701 | assert(_version == 4) |
| 6702 | _type = reader.read("!B")[0] |
| 6703 | assert(_type == 4) |
| 6704 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6705 | orig_reader = reader |
| 6706 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6707 | obj.xid = reader.read("!L")[0] |
| 6708 | _experimenter = reader.read("!L")[0] |
| 6709 | assert(_experimenter == 6035143) |
| 6710 | _subtype = reader.read("!L")[0] |
| 6711 | assert(_subtype == 42) |
| 6712 | obj.status = reader.read("!L")[0] |
| 6713 | obj.port_no = util.unpack_port_no(reader) |
| 6714 | return obj |
| 6715 | |
| 6716 | def __eq__(self, other): |
| 6717 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6718 | if self.xid != other.xid: return False |
| 6719 | if self.status != other.status: return False |
| 6720 | if self.port_no != other.port_no: return False |
| 6721 | return True |
| 6722 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6723 | def pretty_print(self, q): |
| 6724 | q.text("bsn_set_lacp_reply {") |
| 6725 | with q.group(): |
| 6726 | with q.indent(2): |
| 6727 | q.breakable() |
| 6728 | q.text("xid = "); |
| 6729 | if self.xid != None: |
| 6730 | q.text("%#x" % self.xid) |
| 6731 | else: |
| 6732 | q.text('None') |
| 6733 | q.text(","); q.breakable() |
| 6734 | q.text("status = "); |
| 6735 | q.text("%#x" % self.status) |
| 6736 | q.text(","); q.breakable() |
| 6737 | q.text("port_no = "); |
| 6738 | q.text(util.pretty_port(self.port_no)) |
| 6739 | q.breakable() |
| 6740 | q.text('}') |
| 6741 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6742 | bsn_header.subtypes[42] = bsn_set_lacp_reply |
| 6743 | |
| 6744 | class bsn_set_lacp_request(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6745 | version = 4 |
| 6746 | type = 4 |
| 6747 | experimenter = 6035143 |
| 6748 | subtype = 41 |
| 6749 | |
| 6750 | 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] | 6751 | if xid != None: |
| 6752 | self.xid = xid |
| 6753 | else: |
| 6754 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6755 | if enabled != None: |
| 6756 | self.enabled = enabled |
| 6757 | else: |
| 6758 | self.enabled = 0 |
| 6759 | if port_no != None: |
| 6760 | self.port_no = port_no |
| 6761 | else: |
| 6762 | self.port_no = 0 |
| 6763 | if actor_sys_priority != None: |
| 6764 | self.actor_sys_priority = actor_sys_priority |
| 6765 | else: |
| 6766 | self.actor_sys_priority = 0 |
| 6767 | if actor_sys_mac != None: |
| 6768 | self.actor_sys_mac = actor_sys_mac |
| 6769 | else: |
| 6770 | self.actor_sys_mac = [0,0,0,0,0,0] |
| 6771 | if actor_port_priority != None: |
| 6772 | self.actor_port_priority = actor_port_priority |
| 6773 | else: |
| 6774 | self.actor_port_priority = 0 |
| 6775 | if actor_port_num != None: |
| 6776 | self.actor_port_num = actor_port_num |
| 6777 | else: |
| 6778 | self.actor_port_num = 0 |
| 6779 | if actor_key != None: |
| 6780 | self.actor_key = actor_key |
| 6781 | else: |
| 6782 | self.actor_key = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6783 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6784 | |
| 6785 | def pack(self): |
| 6786 | packed = [] |
| 6787 | packed.append(struct.pack("!B", self.version)) |
| 6788 | packed.append(struct.pack("!B", self.type)) |
| 6789 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6790 | packed.append(struct.pack("!L", self.xid)) |
| 6791 | packed.append(struct.pack("!L", self.experimenter)) |
| 6792 | packed.append(struct.pack("!L", self.subtype)) |
| 6793 | packed.append(struct.pack("!B", self.enabled)) |
| 6794 | packed.append('\x00' * 3) |
| 6795 | packed.append(util.pack_port_no(self.port_no)) |
| 6796 | packed.append(struct.pack("!H", self.actor_sys_priority)) |
| 6797 | packed.append(struct.pack("!6B", *self.actor_sys_mac)) |
| 6798 | packed.append(struct.pack("!H", self.actor_port_priority)) |
| 6799 | packed.append(struct.pack("!H", self.actor_port_num)) |
| 6800 | packed.append(struct.pack("!H", self.actor_key)) |
| 6801 | length = sum([len(x) for x in packed]) |
| 6802 | packed[2] = struct.pack("!H", length) |
| 6803 | return ''.join(packed) |
| 6804 | |
| 6805 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6806 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6807 | obj = bsn_set_lacp_request() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6808 | _version = reader.read("!B")[0] |
| 6809 | assert(_version == 4) |
| 6810 | _type = reader.read("!B")[0] |
| 6811 | assert(_type == 4) |
| 6812 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6813 | orig_reader = reader |
| 6814 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6815 | obj.xid = reader.read("!L")[0] |
| 6816 | _experimenter = reader.read("!L")[0] |
| 6817 | assert(_experimenter == 6035143) |
| 6818 | _subtype = reader.read("!L")[0] |
| 6819 | assert(_subtype == 41) |
| 6820 | obj.enabled = reader.read("!B")[0] |
| 6821 | reader.skip(3) |
| 6822 | obj.port_no = util.unpack_port_no(reader) |
| 6823 | obj.actor_sys_priority = reader.read("!H")[0] |
| 6824 | obj.actor_sys_mac = list(reader.read('!6B')) |
| 6825 | obj.actor_port_priority = reader.read("!H")[0] |
| 6826 | obj.actor_port_num = reader.read("!H")[0] |
| 6827 | obj.actor_key = reader.read("!H")[0] |
| 6828 | return obj |
| 6829 | |
| 6830 | def __eq__(self, other): |
| 6831 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6832 | if self.xid != other.xid: return False |
| 6833 | if self.enabled != other.enabled: return False |
| 6834 | if self.port_no != other.port_no: return False |
| 6835 | if self.actor_sys_priority != other.actor_sys_priority: return False |
| 6836 | if self.actor_sys_mac != other.actor_sys_mac: return False |
| 6837 | if self.actor_port_priority != other.actor_port_priority: return False |
| 6838 | if self.actor_port_num != other.actor_port_num: return False |
| 6839 | if self.actor_key != other.actor_key: return False |
| 6840 | return True |
| 6841 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6842 | def pretty_print(self, q): |
| 6843 | q.text("bsn_set_lacp_request {") |
| 6844 | with q.group(): |
| 6845 | with q.indent(2): |
| 6846 | q.breakable() |
| 6847 | q.text("xid = "); |
| 6848 | if self.xid != None: |
| 6849 | q.text("%#x" % self.xid) |
| 6850 | else: |
| 6851 | q.text('None') |
| 6852 | q.text(","); q.breakable() |
| 6853 | q.text("enabled = "); |
| 6854 | q.text("%#x" % self.enabled) |
| 6855 | q.text(","); q.breakable() |
| 6856 | q.text("port_no = "); |
| 6857 | q.text(util.pretty_port(self.port_no)) |
| 6858 | q.text(","); q.breakable() |
| 6859 | q.text("actor_sys_priority = "); |
| 6860 | q.text("%#x" % self.actor_sys_priority) |
| 6861 | q.text(","); q.breakable() |
| 6862 | q.text("actor_sys_mac = "); |
| 6863 | q.text(util.pretty_mac(self.actor_sys_mac)) |
| 6864 | q.text(","); q.breakable() |
| 6865 | q.text("actor_port_priority = "); |
| 6866 | q.text("%#x" % self.actor_port_priority) |
| 6867 | q.text(","); q.breakable() |
| 6868 | q.text("actor_port_num = "); |
| 6869 | q.text("%#x" % self.actor_port_num) |
| 6870 | q.text(","); q.breakable() |
| 6871 | q.text("actor_key = "); |
| 6872 | q.text("%#x" % self.actor_key) |
| 6873 | q.breakable() |
| 6874 | q.text('}') |
| 6875 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6876 | bsn_header.subtypes[41] = bsn_set_lacp_request |
| 6877 | |
| 6878 | class bsn_set_mirroring(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6879 | version = 4 |
| 6880 | type = 4 |
| 6881 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6882 | subtype = 3 |
| 6883 | |
| 6884 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6885 | if xid != None: |
| 6886 | self.xid = xid |
| 6887 | else: |
| 6888 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6889 | if report_mirror_ports != None: |
| 6890 | self.report_mirror_ports = report_mirror_ports |
| 6891 | else: |
| 6892 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6893 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6894 | |
| 6895 | def pack(self): |
| 6896 | packed = [] |
| 6897 | packed.append(struct.pack("!B", self.version)) |
| 6898 | packed.append(struct.pack("!B", self.type)) |
| 6899 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6900 | packed.append(struct.pack("!L", self.xid)) |
| 6901 | packed.append(struct.pack("!L", self.experimenter)) |
| 6902 | packed.append(struct.pack("!L", self.subtype)) |
| 6903 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 6904 | packed.append('\x00' * 3) |
| 6905 | length = sum([len(x) for x in packed]) |
| 6906 | packed[2] = struct.pack("!H", length) |
| 6907 | return ''.join(packed) |
| 6908 | |
| 6909 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6910 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6911 | obj = bsn_set_mirroring() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6912 | _version = reader.read("!B")[0] |
| 6913 | assert(_version == 4) |
| 6914 | _type = reader.read("!B")[0] |
| 6915 | assert(_type == 4) |
| 6916 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6917 | orig_reader = reader |
| 6918 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6919 | obj.xid = reader.read("!L")[0] |
| 6920 | _experimenter = reader.read("!L")[0] |
| 6921 | assert(_experimenter == 6035143) |
| 6922 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6923 | assert(_subtype == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6924 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6925 | reader.skip(3) |
| 6926 | return obj |
| 6927 | |
| 6928 | def __eq__(self, other): |
| 6929 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6930 | if self.xid != other.xid: return False |
| 6931 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 6932 | return True |
| 6933 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6934 | def pretty_print(self, q): |
| 6935 | q.text("bsn_set_mirroring {") |
| 6936 | with q.group(): |
| 6937 | with q.indent(2): |
| 6938 | q.breakable() |
| 6939 | q.text("xid = "); |
| 6940 | if self.xid != None: |
| 6941 | q.text("%#x" % self.xid) |
| 6942 | else: |
| 6943 | q.text('None') |
| 6944 | q.text(","); q.breakable() |
| 6945 | q.text("report_mirror_ports = "); |
| 6946 | q.text("%#x" % self.report_mirror_ports) |
| 6947 | q.breakable() |
| 6948 | q.text('}') |
| 6949 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6950 | bsn_header.subtypes[3] = bsn_set_mirroring |
| 6951 | |
| 6952 | class bsn_set_pktin_suppression_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6953 | version = 4 |
| 6954 | type = 4 |
| 6955 | experimenter = 6035143 |
| 6956 | subtype = 25 |
| 6957 | |
| 6958 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6959 | if xid != None: |
| 6960 | self.xid = xid |
| 6961 | else: |
| 6962 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6963 | if status != None: |
| 6964 | self.status = status |
| 6965 | else: |
| 6966 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6967 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6968 | |
| 6969 | def pack(self): |
| 6970 | packed = [] |
| 6971 | packed.append(struct.pack("!B", self.version)) |
| 6972 | packed.append(struct.pack("!B", self.type)) |
| 6973 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6974 | packed.append(struct.pack("!L", self.xid)) |
| 6975 | packed.append(struct.pack("!L", self.experimenter)) |
| 6976 | packed.append(struct.pack("!L", self.subtype)) |
| 6977 | packed.append(struct.pack("!L", self.status)) |
| 6978 | length = sum([len(x) for x in packed]) |
| 6979 | packed[2] = struct.pack("!H", length) |
| 6980 | return ''.join(packed) |
| 6981 | |
| 6982 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6983 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6984 | obj = bsn_set_pktin_suppression_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6985 | _version = reader.read("!B")[0] |
| 6986 | assert(_version == 4) |
| 6987 | _type = reader.read("!B")[0] |
| 6988 | assert(_type == 4) |
| 6989 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6990 | orig_reader = reader |
| 6991 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6992 | obj.xid = reader.read("!L")[0] |
| 6993 | _experimenter = reader.read("!L")[0] |
| 6994 | assert(_experimenter == 6035143) |
| 6995 | _subtype = reader.read("!L")[0] |
| 6996 | assert(_subtype == 25) |
| 6997 | obj.status = reader.read("!L")[0] |
| 6998 | return obj |
| 6999 | |
| 7000 | def __eq__(self, other): |
| 7001 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7002 | if self.xid != other.xid: return False |
| 7003 | if self.status != other.status: return False |
| 7004 | return True |
| 7005 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7006 | def pretty_print(self, q): |
| 7007 | q.text("bsn_set_pktin_suppression_reply {") |
| 7008 | with q.group(): |
| 7009 | with q.indent(2): |
| 7010 | q.breakable() |
| 7011 | q.text("xid = "); |
| 7012 | if self.xid != None: |
| 7013 | q.text("%#x" % self.xid) |
| 7014 | else: |
| 7015 | q.text('None') |
| 7016 | q.text(","); q.breakable() |
| 7017 | q.text("status = "); |
| 7018 | q.text("%#x" % self.status) |
| 7019 | q.breakable() |
| 7020 | q.text('}') |
| 7021 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7022 | bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply |
| 7023 | |
| 7024 | class bsn_set_pktin_suppression_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7025 | version = 4 |
| 7026 | type = 4 |
| 7027 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7028 | subtype = 11 |
| 7029 | |
| 7030 | 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] | 7031 | if xid != None: |
| 7032 | self.xid = xid |
| 7033 | else: |
| 7034 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7035 | if enabled != None: |
| 7036 | self.enabled = enabled |
| 7037 | else: |
| 7038 | self.enabled = 0 |
| 7039 | if idle_timeout != None: |
| 7040 | self.idle_timeout = idle_timeout |
| 7041 | else: |
| 7042 | self.idle_timeout = 0 |
| 7043 | if hard_timeout != None: |
| 7044 | self.hard_timeout = hard_timeout |
| 7045 | else: |
| 7046 | self.hard_timeout = 0 |
| 7047 | if priority != None: |
| 7048 | self.priority = priority |
| 7049 | else: |
| 7050 | self.priority = 0 |
| 7051 | if cookie != None: |
| 7052 | self.cookie = cookie |
| 7053 | else: |
| 7054 | self.cookie = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7055 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7056 | |
| 7057 | def pack(self): |
| 7058 | packed = [] |
| 7059 | packed.append(struct.pack("!B", self.version)) |
| 7060 | packed.append(struct.pack("!B", self.type)) |
| 7061 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7062 | packed.append(struct.pack("!L", self.xid)) |
| 7063 | packed.append(struct.pack("!L", self.experimenter)) |
| 7064 | packed.append(struct.pack("!L", self.subtype)) |
| 7065 | packed.append(struct.pack("!B", self.enabled)) |
| 7066 | packed.append('\x00' * 1) |
| 7067 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 7068 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 7069 | packed.append(struct.pack("!H", self.priority)) |
| 7070 | packed.append(struct.pack("!Q", self.cookie)) |
| 7071 | length = sum([len(x) for x in packed]) |
| 7072 | packed[2] = struct.pack("!H", length) |
| 7073 | return ''.join(packed) |
| 7074 | |
| 7075 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7076 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7077 | obj = bsn_set_pktin_suppression_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7078 | _version = reader.read("!B")[0] |
| 7079 | assert(_version == 4) |
| 7080 | _type = reader.read("!B")[0] |
| 7081 | assert(_type == 4) |
| 7082 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7083 | orig_reader = reader |
| 7084 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7085 | obj.xid = reader.read("!L")[0] |
| 7086 | _experimenter = reader.read("!L")[0] |
| 7087 | assert(_experimenter == 6035143) |
| 7088 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7089 | assert(_subtype == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7090 | obj.enabled = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7091 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7092 | obj.idle_timeout = reader.read("!H")[0] |
| 7093 | obj.hard_timeout = reader.read("!H")[0] |
| 7094 | obj.priority = reader.read("!H")[0] |
| 7095 | obj.cookie = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7096 | return obj |
| 7097 | |
| 7098 | def __eq__(self, other): |
| 7099 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7100 | if self.xid != other.xid: return False |
| 7101 | if self.enabled != other.enabled: return False |
| 7102 | if self.idle_timeout != other.idle_timeout: return False |
| 7103 | if self.hard_timeout != other.hard_timeout: return False |
| 7104 | if self.priority != other.priority: return False |
| 7105 | if self.cookie != other.cookie: return False |
| 7106 | return True |
| 7107 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7108 | def pretty_print(self, q): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7109 | q.text("bsn_set_pktin_suppression_request {") |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7110 | with q.group(): |
| 7111 | with q.indent(2): |
| 7112 | q.breakable() |
| 7113 | q.text("xid = "); |
| 7114 | if self.xid != None: |
| 7115 | q.text("%#x" % self.xid) |
| 7116 | else: |
| 7117 | q.text('None') |
| 7118 | q.text(","); q.breakable() |
| 7119 | q.text("enabled = "); |
| 7120 | q.text("%#x" % self.enabled) |
| 7121 | q.text(","); q.breakable() |
| 7122 | q.text("idle_timeout = "); |
| 7123 | q.text("%#x" % self.idle_timeout) |
| 7124 | q.text(","); q.breakable() |
| 7125 | q.text("hard_timeout = "); |
| 7126 | q.text("%#x" % self.hard_timeout) |
| 7127 | q.text(","); q.breakable() |
| 7128 | q.text("priority = "); |
| 7129 | q.text("%#x" % self.priority) |
| 7130 | q.text(","); q.breakable() |
| 7131 | q.text("cookie = "); |
| 7132 | q.text("%#x" % self.cookie) |
| 7133 | q.breakable() |
| 7134 | q.text('}') |
| 7135 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7136 | bsn_header.subtypes[11] = bsn_set_pktin_suppression_request |
| 7137 | |
| 7138 | class bsn_set_switch_pipeline_reply(bsn_header): |
| 7139 | version = 4 |
| 7140 | type = 4 |
| 7141 | experimenter = 6035143 |
| 7142 | subtype = 54 |
| 7143 | |
| 7144 | def __init__(self, xid=None, status=None): |
| 7145 | if xid != None: |
| 7146 | self.xid = xid |
| 7147 | else: |
| 7148 | self.xid = None |
| 7149 | if status != None: |
| 7150 | self.status = status |
| 7151 | else: |
| 7152 | self.status = 0 |
| 7153 | return |
| 7154 | |
| 7155 | def pack(self): |
| 7156 | packed = [] |
| 7157 | packed.append(struct.pack("!B", self.version)) |
| 7158 | packed.append(struct.pack("!B", self.type)) |
| 7159 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7160 | packed.append(struct.pack("!L", self.xid)) |
| 7161 | packed.append(struct.pack("!L", self.experimenter)) |
| 7162 | packed.append(struct.pack("!L", self.subtype)) |
| 7163 | packed.append(struct.pack("!L", self.status)) |
| 7164 | length = sum([len(x) for x in packed]) |
| 7165 | packed[2] = struct.pack("!H", length) |
| 7166 | return ''.join(packed) |
| 7167 | |
| 7168 | @staticmethod |
| 7169 | def unpack(reader): |
| 7170 | obj = bsn_set_switch_pipeline_reply() |
| 7171 | _version = reader.read("!B")[0] |
| 7172 | assert(_version == 4) |
| 7173 | _type = reader.read("!B")[0] |
| 7174 | assert(_type == 4) |
| 7175 | _length = reader.read("!H")[0] |
| 7176 | orig_reader = reader |
| 7177 | reader = orig_reader.slice(_length - (2 + 2)) |
| 7178 | obj.xid = reader.read("!L")[0] |
| 7179 | _experimenter = reader.read("!L")[0] |
| 7180 | assert(_experimenter == 6035143) |
| 7181 | _subtype = reader.read("!L")[0] |
| 7182 | assert(_subtype == 54) |
| 7183 | obj.status = reader.read("!L")[0] |
| 7184 | return obj |
| 7185 | |
| 7186 | def __eq__(self, other): |
| 7187 | if type(self) != type(other): return False |
| 7188 | if self.xid != other.xid: return False |
| 7189 | if self.status != other.status: return False |
| 7190 | return True |
| 7191 | |
| 7192 | def pretty_print(self, q): |
| 7193 | q.text("bsn_set_switch_pipeline_reply {") |
| 7194 | with q.group(): |
| 7195 | with q.indent(2): |
| 7196 | q.breakable() |
| 7197 | q.text("xid = "); |
| 7198 | if self.xid != None: |
| 7199 | q.text("%#x" % self.xid) |
| 7200 | else: |
| 7201 | q.text('None') |
| 7202 | q.text(","); q.breakable() |
| 7203 | q.text("status = "); |
| 7204 | q.text("%#x" % self.status) |
| 7205 | q.breakable() |
| 7206 | q.text('}') |
| 7207 | |
| 7208 | bsn_header.subtypes[54] = bsn_set_switch_pipeline_reply |
| 7209 | |
| 7210 | class bsn_set_switch_pipeline_request(bsn_header): |
| 7211 | version = 4 |
| 7212 | type = 4 |
| 7213 | experimenter = 6035143 |
| 7214 | subtype = 53 |
| 7215 | |
| 7216 | def __init__(self, xid=None, pipeline=None): |
| 7217 | if xid != None: |
| 7218 | self.xid = xid |
| 7219 | else: |
| 7220 | self.xid = None |
| 7221 | if pipeline != None: |
| 7222 | self.pipeline = pipeline |
| 7223 | else: |
| 7224 | self.pipeline = "" |
| 7225 | return |
| 7226 | |
| 7227 | def pack(self): |
| 7228 | packed = [] |
| 7229 | packed.append(struct.pack("!B", self.version)) |
| 7230 | packed.append(struct.pack("!B", self.type)) |
| 7231 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7232 | packed.append(struct.pack("!L", self.xid)) |
| 7233 | packed.append(struct.pack("!L", self.experimenter)) |
| 7234 | packed.append(struct.pack("!L", self.subtype)) |
| 7235 | packed.append(struct.pack("!256s", self.pipeline)) |
| 7236 | length = sum([len(x) for x in packed]) |
| 7237 | packed[2] = struct.pack("!H", length) |
| 7238 | return ''.join(packed) |
| 7239 | |
| 7240 | @staticmethod |
| 7241 | def unpack(reader): |
| 7242 | obj = bsn_set_switch_pipeline_request() |
| 7243 | _version = reader.read("!B")[0] |
| 7244 | assert(_version == 4) |
| 7245 | _type = reader.read("!B")[0] |
| 7246 | assert(_type == 4) |
| 7247 | _length = reader.read("!H")[0] |
| 7248 | orig_reader = reader |
| 7249 | reader = orig_reader.slice(_length - (2 + 2)) |
| 7250 | obj.xid = reader.read("!L")[0] |
| 7251 | _experimenter = reader.read("!L")[0] |
| 7252 | assert(_experimenter == 6035143) |
| 7253 | _subtype = reader.read("!L")[0] |
| 7254 | assert(_subtype == 53) |
| 7255 | obj.pipeline = reader.read("!256s")[0].rstrip("\x00") |
| 7256 | return obj |
| 7257 | |
| 7258 | def __eq__(self, other): |
| 7259 | if type(self) != type(other): return False |
| 7260 | if self.xid != other.xid: return False |
| 7261 | if self.pipeline != other.pipeline: return False |
| 7262 | return True |
| 7263 | |
| 7264 | def pretty_print(self, q): |
| 7265 | q.text("bsn_set_switch_pipeline_request {") |
| 7266 | with q.group(): |
| 7267 | with q.indent(2): |
| 7268 | q.breakable() |
| 7269 | q.text("xid = "); |
| 7270 | if self.xid != None: |
| 7271 | q.text("%#x" % self.xid) |
| 7272 | else: |
| 7273 | q.text('None') |
| 7274 | q.text(","); q.breakable() |
| 7275 | q.text("pipeline = "); |
| 7276 | q.pp(self.pipeline) |
| 7277 | q.breakable() |
| 7278 | q.text('}') |
| 7279 | |
| 7280 | bsn_header.subtypes[53] = bsn_set_switch_pipeline_request |
| 7281 | |
| 7282 | class bsn_switch_pipeline_stats_reply(bsn_stats_reply): |
| 7283 | version = 4 |
| 7284 | type = 19 |
| 7285 | stats_type = 65535 |
| 7286 | experimenter = 6035143 |
| 7287 | subtype = 6 |
| 7288 | |
| 7289 | def __init__(self, xid=None, flags=None, entries=None): |
| 7290 | if xid != None: |
| 7291 | self.xid = xid |
| 7292 | else: |
| 7293 | self.xid = None |
| 7294 | if flags != None: |
| 7295 | self.flags = flags |
| 7296 | else: |
| 7297 | self.flags = 0 |
| 7298 | if entries != None: |
| 7299 | self.entries = entries |
| 7300 | else: |
| 7301 | self.entries = [] |
| 7302 | return |
| 7303 | |
| 7304 | def pack(self): |
| 7305 | packed = [] |
| 7306 | packed.append(struct.pack("!B", self.version)) |
| 7307 | packed.append(struct.pack("!B", self.type)) |
| 7308 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7309 | packed.append(struct.pack("!L", self.xid)) |
| 7310 | packed.append(struct.pack("!H", self.stats_type)) |
| 7311 | packed.append(struct.pack("!H", self.flags)) |
| 7312 | packed.append('\x00' * 4) |
| 7313 | packed.append(struct.pack("!L", self.experimenter)) |
| 7314 | packed.append(struct.pack("!L", self.subtype)) |
| 7315 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 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_reply() |
| 7323 | _version = reader.read("!B")[0] |
| 7324 | assert(_version == 4) |
| 7325 | _type = reader.read("!B")[0] |
| 7326 | assert(_type == 19) |
| 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 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_switch_pipeline_stats_entry.unpack) |
| 7340 | return obj |
| 7341 | |
| 7342 | def __eq__(self, other): |
| 7343 | if type(self) != type(other): return False |
| 7344 | if self.xid != other.xid: return False |
| 7345 | if self.flags != other.flags: return False |
| 7346 | if self.entries != other.entries: return False |
| 7347 | return True |
| 7348 | |
| 7349 | def pretty_print(self, q): |
| 7350 | q.text("bsn_switch_pipeline_stats_reply {") |
| 7351 | with q.group(): |
| 7352 | with q.indent(2): |
| 7353 | q.breakable() |
| 7354 | q.text("xid = "); |
| 7355 | if self.xid != None: |
| 7356 | q.text("%#x" % self.xid) |
| 7357 | else: |
| 7358 | q.text('None') |
| 7359 | q.text(","); q.breakable() |
| 7360 | q.text("flags = "); |
| 7361 | q.text("%#x" % self.flags) |
| 7362 | q.text(","); q.breakable() |
| 7363 | q.text("entries = "); |
| 7364 | q.pp(self.entries) |
| 7365 | q.breakable() |
| 7366 | q.text('}') |
| 7367 | |
| 7368 | bsn_stats_reply.subtypes[6] = bsn_switch_pipeline_stats_reply |
| 7369 | |
| 7370 | class bsn_switch_pipeline_stats_request(bsn_stats_request): |
| 7371 | version = 4 |
| 7372 | type = 18 |
| 7373 | stats_type = 65535 |
| 7374 | experimenter = 6035143 |
| 7375 | subtype = 6 |
| 7376 | |
| 7377 | def __init__(self, xid=None, flags=None): |
| 7378 | if xid != None: |
| 7379 | self.xid = xid |
| 7380 | else: |
| 7381 | self.xid = None |
| 7382 | if flags != None: |
| 7383 | self.flags = flags |
| 7384 | else: |
| 7385 | self.flags = 0 |
| 7386 | return |
| 7387 | |
| 7388 | def pack(self): |
| 7389 | packed = [] |
| 7390 | packed.append(struct.pack("!B", self.version)) |
| 7391 | packed.append(struct.pack("!B", self.type)) |
| 7392 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7393 | packed.append(struct.pack("!L", self.xid)) |
| 7394 | packed.append(struct.pack("!H", self.stats_type)) |
| 7395 | packed.append(struct.pack("!H", self.flags)) |
| 7396 | packed.append('\x00' * 4) |
| 7397 | packed.append(struct.pack("!L", self.experimenter)) |
| 7398 | packed.append(struct.pack("!L", self.subtype)) |
| 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_switch_pipeline_stats_request() |
| 7406 | _version = reader.read("!B")[0] |
| 7407 | assert(_version == 4) |
| 7408 | _type = reader.read("!B")[0] |
| 7409 | assert(_type == 18) |
| 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 == 6) |
| 7422 | return obj |
| 7423 | |
| 7424 | def __eq__(self, other): |
| 7425 | if type(self) != type(other): return False |
| 7426 | if self.xid != other.xid: return False |
| 7427 | if self.flags != other.flags: return False |
| 7428 | return True |
| 7429 | |
| 7430 | def pretty_print(self, q): |
| 7431 | q.text("bsn_switch_pipeline_stats_request {") |
| 7432 | with q.group(): |
| 7433 | with q.indent(2): |
| 7434 | q.breakable() |
| 7435 | q.text("xid = "); |
| 7436 | if self.xid != None: |
| 7437 | q.text("%#x" % self.xid) |
| 7438 | else: |
| 7439 | q.text('None') |
| 7440 | q.text(","); q.breakable() |
| 7441 | q.text("flags = "); |
| 7442 | q.text("%#x" % self.flags) |
| 7443 | q.breakable() |
| 7444 | q.text('}') |
| 7445 | |
| 7446 | bsn_stats_request.subtypes[6] = bsn_switch_pipeline_stats_request |
| 7447 | |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 7448 | class bsn_table_checksum_stats_reply(bsn_stats_reply): |
| 7449 | version = 4 |
| 7450 | type = 19 |
| 7451 | stats_type = 65535 |
| 7452 | experimenter = 6035143 |
| 7453 | subtype = 11 |
| 7454 | |
| 7455 | def __init__(self, xid=None, flags=None, entries=None): |
| 7456 | if xid != None: |
| 7457 | self.xid = xid |
| 7458 | else: |
| 7459 | self.xid = None |
| 7460 | if flags != None: |
| 7461 | self.flags = flags |
| 7462 | else: |
| 7463 | self.flags = 0 |
| 7464 | if entries != None: |
| 7465 | self.entries = entries |
| 7466 | else: |
| 7467 | self.entries = [] |
| 7468 | return |
| 7469 | |
| 7470 | def pack(self): |
| 7471 | packed = [] |
| 7472 | packed.append(struct.pack("!B", self.version)) |
| 7473 | packed.append(struct.pack("!B", self.type)) |
| 7474 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7475 | packed.append(struct.pack("!L", self.xid)) |
| 7476 | packed.append(struct.pack("!H", self.stats_type)) |
| 7477 | packed.append(struct.pack("!H", self.flags)) |
| 7478 | packed.append('\x00' * 4) |
| 7479 | packed.append(struct.pack("!L", self.experimenter)) |
| 7480 | packed.append(struct.pack("!L", self.subtype)) |
| 7481 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 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_reply() |
| 7489 | _version = reader.read("!B")[0] |
| 7490 | assert(_version == 4) |
| 7491 | _type = reader.read("!B")[0] |
| 7492 | assert(_type == 19) |
| 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 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_table_checksum_stats_entry.unpack) |
| 7506 | return obj |
| 7507 | |
| 7508 | def __eq__(self, other): |
| 7509 | if type(self) != type(other): return False |
| 7510 | if self.xid != other.xid: return False |
| 7511 | if self.flags != other.flags: return False |
| 7512 | if self.entries != other.entries: return False |
| 7513 | return True |
| 7514 | |
| 7515 | def pretty_print(self, q): |
| 7516 | q.text("bsn_table_checksum_stats_reply {") |
| 7517 | with q.group(): |
| 7518 | with q.indent(2): |
| 7519 | q.breakable() |
| 7520 | q.text("xid = "); |
| 7521 | if self.xid != None: |
| 7522 | q.text("%#x" % self.xid) |
| 7523 | else: |
| 7524 | q.text('None') |
| 7525 | q.text(","); q.breakable() |
| 7526 | q.text("flags = "); |
| 7527 | q.text("%#x" % self.flags) |
| 7528 | q.text(","); q.breakable() |
| 7529 | q.text("entries = "); |
| 7530 | q.pp(self.entries) |
| 7531 | q.breakable() |
| 7532 | q.text('}') |
| 7533 | |
| 7534 | bsn_stats_reply.subtypes[11] = bsn_table_checksum_stats_reply |
| 7535 | |
| 7536 | class bsn_table_checksum_stats_request(bsn_stats_request): |
| 7537 | version = 4 |
| 7538 | type = 18 |
| 7539 | stats_type = 65535 |
| 7540 | experimenter = 6035143 |
| 7541 | subtype = 11 |
| 7542 | |
| 7543 | def __init__(self, xid=None, flags=None): |
| 7544 | if xid != None: |
| 7545 | self.xid = xid |
| 7546 | else: |
| 7547 | self.xid = None |
| 7548 | if flags != None: |
| 7549 | self.flags = flags |
| 7550 | else: |
| 7551 | self.flags = 0 |
| 7552 | return |
| 7553 | |
| 7554 | def pack(self): |
| 7555 | packed = [] |
| 7556 | packed.append(struct.pack("!B", self.version)) |
| 7557 | packed.append(struct.pack("!B", self.type)) |
| 7558 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7559 | packed.append(struct.pack("!L", self.xid)) |
| 7560 | packed.append(struct.pack("!H", self.stats_type)) |
| 7561 | packed.append(struct.pack("!H", self.flags)) |
| 7562 | packed.append('\x00' * 4) |
| 7563 | packed.append(struct.pack("!L", self.experimenter)) |
| 7564 | packed.append(struct.pack("!L", self.subtype)) |
| 7565 | length = sum([len(x) for x in packed]) |
| 7566 | packed[2] = struct.pack("!H", length) |
| 7567 | return ''.join(packed) |
| 7568 | |
| 7569 | @staticmethod |
| 7570 | def unpack(reader): |
| 7571 | obj = bsn_table_checksum_stats_request() |
| 7572 | _version = reader.read("!B")[0] |
| 7573 | assert(_version == 4) |
| 7574 | _type = reader.read("!B")[0] |
| 7575 | assert(_type == 18) |
| 7576 | _length = reader.read("!H")[0] |
| 7577 | orig_reader = reader |
| 7578 | reader = orig_reader.slice(_length - (2 + 2)) |
| 7579 | obj.xid = reader.read("!L")[0] |
| 7580 | _stats_type = reader.read("!H")[0] |
| 7581 | assert(_stats_type == 65535) |
| 7582 | obj.flags = reader.read("!H")[0] |
| 7583 | reader.skip(4) |
| 7584 | _experimenter = reader.read("!L")[0] |
| 7585 | assert(_experimenter == 6035143) |
| 7586 | _subtype = reader.read("!L")[0] |
| 7587 | assert(_subtype == 11) |
| 7588 | return obj |
| 7589 | |
| 7590 | def __eq__(self, other): |
| 7591 | if type(self) != type(other): return False |
| 7592 | if self.xid != other.xid: return False |
| 7593 | if self.flags != other.flags: return False |
| 7594 | return True |
| 7595 | |
| 7596 | def pretty_print(self, q): |
| 7597 | q.text("bsn_table_checksum_stats_request {") |
| 7598 | with q.group(): |
| 7599 | with q.indent(2): |
| 7600 | q.breakable() |
| 7601 | q.text("xid = "); |
| 7602 | if self.xid != None: |
| 7603 | q.text("%#x" % self.xid) |
| 7604 | else: |
| 7605 | q.text('None') |
| 7606 | q.text(","); q.breakable() |
| 7607 | q.text("flags = "); |
| 7608 | q.text("%#x" % self.flags) |
| 7609 | q.breakable() |
| 7610 | q.text('}') |
| 7611 | |
| 7612 | bsn_stats_request.subtypes[11] = bsn_table_checksum_stats_request |
| 7613 | |
| 7614 | class bsn_table_set_buckets_size(bsn_header): |
| 7615 | version = 4 |
| 7616 | type = 4 |
| 7617 | experimenter = 6035143 |
| 7618 | subtype = 61 |
| 7619 | |
| 7620 | def __init__(self, xid=None, table_id=None, buckets_size=None): |
| 7621 | if xid != None: |
| 7622 | self.xid = xid |
| 7623 | else: |
| 7624 | self.xid = None |
| 7625 | if table_id != None: |
| 7626 | self.table_id = table_id |
| 7627 | else: |
| 7628 | self.table_id = 0 |
| 7629 | if buckets_size != None: |
| 7630 | self.buckets_size = buckets_size |
| 7631 | else: |
| 7632 | self.buckets_size = 0 |
| 7633 | return |
| 7634 | |
| 7635 | def pack(self): |
| 7636 | packed = [] |
| 7637 | packed.append(struct.pack("!B", self.version)) |
| 7638 | packed.append(struct.pack("!B", self.type)) |
| 7639 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7640 | packed.append(struct.pack("!L", self.xid)) |
| 7641 | packed.append(struct.pack("!L", self.experimenter)) |
| 7642 | packed.append(struct.pack("!L", self.subtype)) |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 7643 | packed.append('\x00' * 1) |
| 7644 | packed.append(struct.pack("!B", self.table_id)) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 7645 | packed.append('\x00' * 2) |
| 7646 | packed.append(struct.pack("!L", self.buckets_size)) |
| 7647 | length = sum([len(x) for x in packed]) |
| 7648 | packed[2] = struct.pack("!H", length) |
| 7649 | return ''.join(packed) |
| 7650 | |
| 7651 | @staticmethod |
| 7652 | def unpack(reader): |
| 7653 | obj = bsn_table_set_buckets_size() |
| 7654 | _version = reader.read("!B")[0] |
| 7655 | assert(_version == 4) |
| 7656 | _type = reader.read("!B")[0] |
| 7657 | assert(_type == 4) |
| 7658 | _length = reader.read("!H")[0] |
| 7659 | orig_reader = reader |
| 7660 | reader = orig_reader.slice(_length - (2 + 2)) |
| 7661 | obj.xid = reader.read("!L")[0] |
| 7662 | _experimenter = reader.read("!L")[0] |
| 7663 | assert(_experimenter == 6035143) |
| 7664 | _subtype = reader.read("!L")[0] |
| 7665 | assert(_subtype == 61) |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 7666 | reader.skip(1) |
| 7667 | obj.table_id = reader.read("!B")[0] |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 7668 | reader.skip(2) |
| 7669 | obj.buckets_size = reader.read("!L")[0] |
| 7670 | return obj |
| 7671 | |
| 7672 | def __eq__(self, other): |
| 7673 | if type(self) != type(other): return False |
| 7674 | if self.xid != other.xid: return False |
| 7675 | if self.table_id != other.table_id: return False |
| 7676 | if self.buckets_size != other.buckets_size: return False |
| 7677 | return True |
| 7678 | |
| 7679 | def pretty_print(self, q): |
| 7680 | q.text("bsn_table_set_buckets_size {") |
| 7681 | with q.group(): |
| 7682 | with q.indent(2): |
| 7683 | q.breakable() |
| 7684 | q.text("xid = "); |
| 7685 | if self.xid != None: |
| 7686 | q.text("%#x" % self.xid) |
| 7687 | else: |
| 7688 | q.text('None') |
| 7689 | q.text(","); q.breakable() |
| 7690 | q.text("table_id = "); |
| 7691 | q.text("%#x" % self.table_id) |
| 7692 | q.text(","); q.breakable() |
| 7693 | q.text("buckets_size = "); |
| 7694 | q.text("%#x" % self.buckets_size) |
| 7695 | q.breakable() |
| 7696 | q.text('}') |
| 7697 | |
| 7698 | bsn_header.subtypes[61] = bsn_table_set_buckets_size |
| 7699 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7700 | class bsn_time_reply(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7701 | version = 4 |
| 7702 | type = 4 |
| 7703 | experimenter = 6035143 |
| 7704 | subtype = 45 |
| 7705 | |
| 7706 | def __init__(self, xid=None, time_ms=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7707 | if xid != None: |
| 7708 | self.xid = xid |
| 7709 | else: |
| 7710 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7711 | if time_ms != None: |
| 7712 | self.time_ms = time_ms |
| 7713 | else: |
| 7714 | self.time_ms = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7715 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7716 | |
| 7717 | def pack(self): |
| 7718 | packed = [] |
| 7719 | packed.append(struct.pack("!B", self.version)) |
| 7720 | packed.append(struct.pack("!B", self.type)) |
| 7721 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7722 | packed.append(struct.pack("!L", self.xid)) |
| 7723 | packed.append(struct.pack("!L", self.experimenter)) |
| 7724 | packed.append(struct.pack("!L", self.subtype)) |
| 7725 | packed.append(struct.pack("!Q", self.time_ms)) |
| 7726 | length = sum([len(x) for x in packed]) |
| 7727 | packed[2] = struct.pack("!H", length) |
| 7728 | return ''.join(packed) |
| 7729 | |
| 7730 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7731 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7732 | obj = bsn_time_reply() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7733 | _version = reader.read("!B")[0] |
| 7734 | assert(_version == 4) |
| 7735 | _type = reader.read("!B")[0] |
| 7736 | assert(_type == 4) |
| 7737 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7738 | orig_reader = reader |
| 7739 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7740 | obj.xid = reader.read("!L")[0] |
| 7741 | _experimenter = reader.read("!L")[0] |
| 7742 | assert(_experimenter == 6035143) |
| 7743 | _subtype = reader.read("!L")[0] |
| 7744 | assert(_subtype == 45) |
| 7745 | obj.time_ms = reader.read("!Q")[0] |
| 7746 | return obj |
| 7747 | |
| 7748 | def __eq__(self, other): |
| 7749 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7750 | if self.xid != other.xid: return False |
| 7751 | if self.time_ms != other.time_ms: return False |
| 7752 | return True |
| 7753 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7754 | def pretty_print(self, q): |
| 7755 | q.text("bsn_time_reply {") |
| 7756 | with q.group(): |
| 7757 | with q.indent(2): |
| 7758 | q.breakable() |
| 7759 | q.text("xid = "); |
| 7760 | if self.xid != None: |
| 7761 | q.text("%#x" % self.xid) |
| 7762 | else: |
| 7763 | q.text('None') |
| 7764 | q.text(","); q.breakable() |
| 7765 | q.text("time_ms = "); |
| 7766 | q.text("%#x" % self.time_ms) |
| 7767 | q.breakable() |
| 7768 | q.text('}') |
| 7769 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7770 | bsn_header.subtypes[45] = bsn_time_reply |
| 7771 | |
| 7772 | class bsn_time_request(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7773 | version = 4 |
| 7774 | type = 4 |
| 7775 | experimenter = 6035143 |
| 7776 | subtype = 44 |
| 7777 | |
| 7778 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7779 | if xid != None: |
| 7780 | self.xid = xid |
| 7781 | else: |
| 7782 | self.xid = None |
| 7783 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7784 | |
| 7785 | def pack(self): |
| 7786 | packed = [] |
| 7787 | packed.append(struct.pack("!B", self.version)) |
| 7788 | packed.append(struct.pack("!B", self.type)) |
| 7789 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7790 | packed.append(struct.pack("!L", self.xid)) |
| 7791 | packed.append(struct.pack("!L", self.experimenter)) |
| 7792 | packed.append(struct.pack("!L", self.subtype)) |
| 7793 | length = sum([len(x) for x in packed]) |
| 7794 | packed[2] = struct.pack("!H", length) |
| 7795 | return ''.join(packed) |
| 7796 | |
| 7797 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7798 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7799 | obj = bsn_time_request() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7800 | _version = reader.read("!B")[0] |
| 7801 | assert(_version == 4) |
| 7802 | _type = reader.read("!B")[0] |
| 7803 | assert(_type == 4) |
| 7804 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7805 | orig_reader = reader |
| 7806 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7807 | obj.xid = reader.read("!L")[0] |
| 7808 | _experimenter = reader.read("!L")[0] |
| 7809 | assert(_experimenter == 6035143) |
| 7810 | _subtype = reader.read("!L")[0] |
| 7811 | assert(_subtype == 44) |
| 7812 | return obj |
| 7813 | |
| 7814 | def __eq__(self, other): |
| 7815 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7816 | if self.xid != other.xid: return False |
| 7817 | return True |
| 7818 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7819 | def pretty_print(self, q): |
| 7820 | q.text("bsn_time_request {") |
| 7821 | with q.group(): |
| 7822 | with q.indent(2): |
| 7823 | q.breakable() |
| 7824 | q.text("xid = "); |
| 7825 | if self.xid != None: |
| 7826 | q.text("%#x" % self.xid) |
| 7827 | else: |
| 7828 | q.text('None') |
| 7829 | q.breakable() |
| 7830 | q.text('}') |
| 7831 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7832 | bsn_header.subtypes[44] = bsn_time_request |
| 7833 | |
| 7834 | class bsn_virtual_port_create_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7835 | version = 4 |
| 7836 | type = 4 |
| 7837 | experimenter = 6035143 |
| 7838 | subtype = 16 |
| 7839 | |
| 7840 | def __init__(self, xid=None, status=None, vport_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7841 | if xid != None: |
| 7842 | self.xid = xid |
| 7843 | else: |
| 7844 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7845 | if status != None: |
| 7846 | self.status = status |
| 7847 | else: |
| 7848 | self.status = 0 |
| 7849 | if vport_no != None: |
| 7850 | self.vport_no = vport_no |
| 7851 | else: |
| 7852 | self.vport_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7853 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7854 | |
| 7855 | def pack(self): |
| 7856 | packed = [] |
| 7857 | packed.append(struct.pack("!B", self.version)) |
| 7858 | packed.append(struct.pack("!B", self.type)) |
| 7859 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7860 | packed.append(struct.pack("!L", self.xid)) |
| 7861 | packed.append(struct.pack("!L", self.experimenter)) |
| 7862 | packed.append(struct.pack("!L", self.subtype)) |
| 7863 | packed.append(struct.pack("!L", self.status)) |
| 7864 | packed.append(struct.pack("!L", self.vport_no)) |
| 7865 | length = sum([len(x) for x in packed]) |
| 7866 | packed[2] = struct.pack("!H", length) |
| 7867 | return ''.join(packed) |
| 7868 | |
| 7869 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7870 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7871 | obj = bsn_virtual_port_create_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7872 | _version = reader.read("!B")[0] |
| 7873 | assert(_version == 4) |
| 7874 | _type = reader.read("!B")[0] |
| 7875 | assert(_type == 4) |
| 7876 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7877 | orig_reader = reader |
| 7878 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7879 | obj.xid = reader.read("!L")[0] |
| 7880 | _experimenter = reader.read("!L")[0] |
| 7881 | assert(_experimenter == 6035143) |
| 7882 | _subtype = reader.read("!L")[0] |
| 7883 | assert(_subtype == 16) |
| 7884 | obj.status = reader.read("!L")[0] |
| 7885 | obj.vport_no = reader.read("!L")[0] |
| 7886 | return obj |
| 7887 | |
| 7888 | def __eq__(self, other): |
| 7889 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7890 | if self.xid != other.xid: return False |
| 7891 | if self.status != other.status: return False |
| 7892 | if self.vport_no != other.vport_no: return False |
| 7893 | return True |
| 7894 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7895 | def pretty_print(self, q): |
| 7896 | q.text("bsn_virtual_port_create_reply {") |
| 7897 | with q.group(): |
| 7898 | with q.indent(2): |
| 7899 | q.breakable() |
| 7900 | q.text("xid = "); |
| 7901 | if self.xid != None: |
| 7902 | q.text("%#x" % self.xid) |
| 7903 | else: |
| 7904 | q.text('None') |
| 7905 | q.text(","); q.breakable() |
| 7906 | q.text("status = "); |
| 7907 | q.text("%#x" % self.status) |
| 7908 | q.text(","); q.breakable() |
| 7909 | q.text("vport_no = "); |
| 7910 | q.text("%#x" % self.vport_no) |
| 7911 | q.breakable() |
| 7912 | q.text('}') |
| 7913 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7914 | bsn_header.subtypes[16] = bsn_virtual_port_create_reply |
| 7915 | |
| 7916 | class bsn_virtual_port_create_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7917 | version = 4 |
| 7918 | type = 4 |
| 7919 | experimenter = 6035143 |
| 7920 | subtype = 15 |
| 7921 | |
| 7922 | def __init__(self, xid=None, vport=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7923 | if xid != None: |
| 7924 | self.xid = xid |
| 7925 | else: |
| 7926 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7927 | if vport != None: |
| 7928 | self.vport = vport |
| 7929 | else: |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 7930 | self.vport = common.bsn_vport() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7931 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7932 | |
| 7933 | def pack(self): |
| 7934 | packed = [] |
| 7935 | packed.append(struct.pack("!B", self.version)) |
| 7936 | packed.append(struct.pack("!B", self.type)) |
| 7937 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7938 | packed.append(struct.pack("!L", self.xid)) |
| 7939 | packed.append(struct.pack("!L", self.experimenter)) |
| 7940 | packed.append(struct.pack("!L", self.subtype)) |
| 7941 | packed.append(self.vport.pack()) |
| 7942 | length = sum([len(x) for x in packed]) |
| 7943 | packed[2] = struct.pack("!H", length) |
| 7944 | return ''.join(packed) |
| 7945 | |
| 7946 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7947 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7948 | obj = bsn_virtual_port_create_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7949 | _version = reader.read("!B")[0] |
| 7950 | assert(_version == 4) |
| 7951 | _type = reader.read("!B")[0] |
| 7952 | assert(_type == 4) |
| 7953 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7954 | orig_reader = reader |
| 7955 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7956 | obj.xid = reader.read("!L")[0] |
| 7957 | _experimenter = reader.read("!L")[0] |
| 7958 | assert(_experimenter == 6035143) |
| 7959 | _subtype = reader.read("!L")[0] |
| 7960 | assert(_subtype == 15) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 7961 | obj.vport = common.bsn_vport.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7962 | return obj |
| 7963 | |
| 7964 | def __eq__(self, other): |
| 7965 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7966 | if self.xid != other.xid: return False |
| 7967 | if self.vport != other.vport: return False |
| 7968 | return True |
| 7969 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7970 | def pretty_print(self, q): |
| 7971 | q.text("bsn_virtual_port_create_request {") |
| 7972 | with q.group(): |
| 7973 | with q.indent(2): |
| 7974 | q.breakable() |
| 7975 | q.text("xid = "); |
| 7976 | if self.xid != None: |
| 7977 | q.text("%#x" % self.xid) |
| 7978 | else: |
| 7979 | q.text('None') |
| 7980 | q.text(","); q.breakable() |
| 7981 | q.text("vport = "); |
| 7982 | q.pp(self.vport) |
| 7983 | q.breakable() |
| 7984 | q.text('}') |
| 7985 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7986 | bsn_header.subtypes[15] = bsn_virtual_port_create_request |
| 7987 | |
| 7988 | class bsn_virtual_port_remove_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7989 | version = 4 |
| 7990 | type = 4 |
| 7991 | experimenter = 6035143 |
| 7992 | subtype = 26 |
| 7993 | |
| 7994 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7995 | if xid != None: |
| 7996 | self.xid = xid |
| 7997 | else: |
| 7998 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7999 | if status != None: |
| 8000 | self.status = status |
| 8001 | else: |
| 8002 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8003 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8004 | |
| 8005 | def pack(self): |
| 8006 | packed = [] |
| 8007 | packed.append(struct.pack("!B", self.version)) |
| 8008 | packed.append(struct.pack("!B", self.type)) |
| 8009 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8010 | packed.append(struct.pack("!L", self.xid)) |
| 8011 | packed.append(struct.pack("!L", self.experimenter)) |
| 8012 | packed.append(struct.pack("!L", self.subtype)) |
| 8013 | packed.append(struct.pack("!L", self.status)) |
| 8014 | length = sum([len(x) for x in packed]) |
| 8015 | packed[2] = struct.pack("!H", length) |
| 8016 | return ''.join(packed) |
| 8017 | |
| 8018 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8019 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8020 | obj = bsn_virtual_port_remove_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8021 | _version = reader.read("!B")[0] |
| 8022 | assert(_version == 4) |
| 8023 | _type = reader.read("!B")[0] |
| 8024 | assert(_type == 4) |
| 8025 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8026 | orig_reader = reader |
| 8027 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8028 | obj.xid = reader.read("!L")[0] |
| 8029 | _experimenter = reader.read("!L")[0] |
| 8030 | assert(_experimenter == 6035143) |
| 8031 | _subtype = reader.read("!L")[0] |
| 8032 | assert(_subtype == 26) |
| 8033 | obj.status = reader.read("!L")[0] |
| 8034 | return obj |
| 8035 | |
| 8036 | def __eq__(self, other): |
| 8037 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8038 | if self.xid != other.xid: return False |
| 8039 | if self.status != other.status: return False |
| 8040 | return True |
| 8041 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8042 | def pretty_print(self, q): |
| 8043 | q.text("bsn_virtual_port_remove_reply {") |
| 8044 | with q.group(): |
| 8045 | with q.indent(2): |
| 8046 | q.breakable() |
| 8047 | q.text("xid = "); |
| 8048 | if self.xid != None: |
| 8049 | q.text("%#x" % self.xid) |
| 8050 | else: |
| 8051 | q.text('None') |
| 8052 | q.text(","); q.breakable() |
| 8053 | q.text("status = "); |
| 8054 | q.text("%#x" % self.status) |
| 8055 | q.breakable() |
| 8056 | q.text('}') |
| 8057 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8058 | bsn_header.subtypes[26] = bsn_virtual_port_remove_reply |
| 8059 | |
| 8060 | class bsn_virtual_port_remove_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8061 | version = 4 |
| 8062 | type = 4 |
| 8063 | experimenter = 6035143 |
| 8064 | subtype = 17 |
| 8065 | |
| 8066 | def __init__(self, xid=None, vport_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8067 | if xid != None: |
| 8068 | self.xid = xid |
| 8069 | else: |
| 8070 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8071 | if vport_no != None: |
| 8072 | self.vport_no = vport_no |
| 8073 | else: |
| 8074 | self.vport_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8075 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8076 | |
| 8077 | def pack(self): |
| 8078 | packed = [] |
| 8079 | packed.append(struct.pack("!B", self.version)) |
| 8080 | packed.append(struct.pack("!B", self.type)) |
| 8081 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8082 | packed.append(struct.pack("!L", self.xid)) |
| 8083 | packed.append(struct.pack("!L", self.experimenter)) |
| 8084 | packed.append(struct.pack("!L", self.subtype)) |
| 8085 | packed.append(struct.pack("!L", self.vport_no)) |
| 8086 | length = sum([len(x) for x in packed]) |
| 8087 | packed[2] = struct.pack("!H", length) |
| 8088 | return ''.join(packed) |
| 8089 | |
| 8090 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8091 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8092 | obj = bsn_virtual_port_remove_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8093 | _version = reader.read("!B")[0] |
| 8094 | assert(_version == 4) |
| 8095 | _type = reader.read("!B")[0] |
| 8096 | assert(_type == 4) |
| 8097 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8098 | orig_reader = reader |
| 8099 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8100 | obj.xid = reader.read("!L")[0] |
| 8101 | _experimenter = reader.read("!L")[0] |
| 8102 | assert(_experimenter == 6035143) |
| 8103 | _subtype = reader.read("!L")[0] |
| 8104 | assert(_subtype == 17) |
| 8105 | obj.vport_no = reader.read("!L")[0] |
| 8106 | return obj |
| 8107 | |
| 8108 | def __eq__(self, other): |
| 8109 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8110 | if self.xid != other.xid: return False |
| 8111 | if self.vport_no != other.vport_no: return False |
| 8112 | return True |
| 8113 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8114 | def pretty_print(self, q): |
| 8115 | q.text("bsn_virtual_port_remove_request {") |
| 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("vport_no = "); |
| 8126 | q.text("%#x" % self.vport_no) |
| 8127 | q.breakable() |
| 8128 | q.text('}') |
| 8129 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8130 | bsn_header.subtypes[17] = bsn_virtual_port_remove_request |
| 8131 | |
| 8132 | class bsn_vlan_counter_stats_reply(bsn_stats_reply): |
| 8133 | version = 4 |
| 8134 | type = 19 |
| 8135 | stats_type = 65535 |
| 8136 | experimenter = 6035143 |
| 8137 | subtype = 9 |
| 8138 | |
| 8139 | def __init__(self, xid=None, flags=None, entries=None): |
| 8140 | if xid != None: |
| 8141 | self.xid = xid |
| 8142 | else: |
| 8143 | self.xid = None |
| 8144 | if flags != None: |
| 8145 | self.flags = flags |
| 8146 | else: |
| 8147 | self.flags = 0 |
| 8148 | if entries != None: |
| 8149 | self.entries = entries |
| 8150 | else: |
| 8151 | self.entries = [] |
| 8152 | return |
| 8153 | |
| 8154 | def pack(self): |
| 8155 | packed = [] |
| 8156 | packed.append(struct.pack("!B", self.version)) |
| 8157 | packed.append(struct.pack("!B", self.type)) |
| 8158 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8159 | packed.append(struct.pack("!L", self.xid)) |
| 8160 | packed.append(struct.pack("!H", self.stats_type)) |
| 8161 | packed.append(struct.pack("!H", self.flags)) |
| 8162 | packed.append('\x00' * 4) |
| 8163 | packed.append(struct.pack("!L", self.experimenter)) |
| 8164 | packed.append(struct.pack("!L", self.subtype)) |
| 8165 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 8166 | length = sum([len(x) for x in packed]) |
| 8167 | packed[2] = struct.pack("!H", length) |
| 8168 | return ''.join(packed) |
| 8169 | |
| 8170 | @staticmethod |
| 8171 | def unpack(reader): |
| 8172 | obj = bsn_vlan_counter_stats_reply() |
| 8173 | _version = reader.read("!B")[0] |
| 8174 | assert(_version == 4) |
| 8175 | _type = reader.read("!B")[0] |
| 8176 | assert(_type == 19) |
| 8177 | _length = reader.read("!H")[0] |
| 8178 | orig_reader = reader |
| 8179 | reader = orig_reader.slice(_length - (2 + 2)) |
| 8180 | obj.xid = reader.read("!L")[0] |
| 8181 | _stats_type = reader.read("!H")[0] |
| 8182 | assert(_stats_type == 65535) |
| 8183 | obj.flags = reader.read("!H")[0] |
| 8184 | reader.skip(4) |
| 8185 | _experimenter = reader.read("!L")[0] |
| 8186 | assert(_experimenter == 6035143) |
| 8187 | _subtype = reader.read("!L")[0] |
| 8188 | assert(_subtype == 9) |
| 8189 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_vlan_counter_stats_entry.unpack) |
| 8190 | return obj |
| 8191 | |
| 8192 | def __eq__(self, other): |
| 8193 | if type(self) != type(other): return False |
| 8194 | if self.xid != other.xid: return False |
| 8195 | if self.flags != other.flags: return False |
| 8196 | if self.entries != other.entries: return False |
| 8197 | return True |
| 8198 | |
| 8199 | def pretty_print(self, q): |
| 8200 | q.text("bsn_vlan_counter_stats_reply {") |
| 8201 | with q.group(): |
| 8202 | with q.indent(2): |
| 8203 | q.breakable() |
| 8204 | q.text("xid = "); |
| 8205 | if self.xid != None: |
| 8206 | q.text("%#x" % self.xid) |
| 8207 | else: |
| 8208 | q.text('None') |
| 8209 | q.text(","); q.breakable() |
| 8210 | q.text("flags = "); |
| 8211 | q.text("%#x" % self.flags) |
| 8212 | q.text(","); q.breakable() |
| 8213 | q.text("entries = "); |
| 8214 | q.pp(self.entries) |
| 8215 | q.breakable() |
| 8216 | q.text('}') |
| 8217 | |
| 8218 | bsn_stats_reply.subtypes[9] = bsn_vlan_counter_stats_reply |
| 8219 | |
| 8220 | class bsn_vlan_counter_stats_request(bsn_stats_request): |
| 8221 | version = 4 |
| 8222 | type = 18 |
| 8223 | stats_type = 65535 |
| 8224 | experimenter = 6035143 |
| 8225 | subtype = 9 |
| 8226 | |
| 8227 | def __init__(self, xid=None, flags=None, vlan_vid=None): |
| 8228 | if xid != None: |
| 8229 | self.xid = xid |
| 8230 | else: |
| 8231 | self.xid = None |
| 8232 | if flags != None: |
| 8233 | self.flags = flags |
| 8234 | else: |
| 8235 | self.flags = 0 |
| 8236 | if vlan_vid != None: |
| 8237 | self.vlan_vid = vlan_vid |
| 8238 | else: |
| 8239 | self.vlan_vid = 0 |
| 8240 | return |
| 8241 | |
| 8242 | def pack(self): |
| 8243 | packed = [] |
| 8244 | packed.append(struct.pack("!B", self.version)) |
| 8245 | packed.append(struct.pack("!B", self.type)) |
| 8246 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8247 | packed.append(struct.pack("!L", self.xid)) |
| 8248 | packed.append(struct.pack("!H", self.stats_type)) |
| 8249 | packed.append(struct.pack("!H", self.flags)) |
| 8250 | packed.append('\x00' * 4) |
| 8251 | packed.append(struct.pack("!L", self.experimenter)) |
| 8252 | packed.append(struct.pack("!L", self.subtype)) |
| 8253 | packed.append(struct.pack("!H", self.vlan_vid)) |
| 8254 | length = sum([len(x) for x in packed]) |
| 8255 | packed[2] = struct.pack("!H", length) |
| 8256 | return ''.join(packed) |
| 8257 | |
| 8258 | @staticmethod |
| 8259 | def unpack(reader): |
| 8260 | obj = bsn_vlan_counter_stats_request() |
| 8261 | _version = reader.read("!B")[0] |
| 8262 | assert(_version == 4) |
| 8263 | _type = reader.read("!B")[0] |
| 8264 | assert(_type == 18) |
| 8265 | _length = reader.read("!H")[0] |
| 8266 | orig_reader = reader |
| 8267 | reader = orig_reader.slice(_length - (2 + 2)) |
| 8268 | obj.xid = reader.read("!L")[0] |
| 8269 | _stats_type = reader.read("!H")[0] |
| 8270 | assert(_stats_type == 65535) |
| 8271 | obj.flags = reader.read("!H")[0] |
| 8272 | reader.skip(4) |
| 8273 | _experimenter = reader.read("!L")[0] |
| 8274 | assert(_experimenter == 6035143) |
| 8275 | _subtype = reader.read("!L")[0] |
| 8276 | assert(_subtype == 9) |
| 8277 | obj.vlan_vid = reader.read("!H")[0] |
| 8278 | return obj |
| 8279 | |
| 8280 | def __eq__(self, other): |
| 8281 | if type(self) != type(other): return False |
| 8282 | if self.xid != other.xid: return False |
| 8283 | if self.flags != other.flags: return False |
| 8284 | if self.vlan_vid != other.vlan_vid: return False |
| 8285 | return True |
| 8286 | |
| 8287 | def pretty_print(self, q): |
| 8288 | q.text("bsn_vlan_counter_stats_request {") |
| 8289 | with q.group(): |
| 8290 | with q.indent(2): |
| 8291 | q.breakable() |
| 8292 | q.text("xid = "); |
| 8293 | if self.xid != None: |
| 8294 | q.text("%#x" % self.xid) |
| 8295 | else: |
| 8296 | q.text('None') |
| 8297 | q.text(","); q.breakable() |
| 8298 | q.text("flags = "); |
| 8299 | q.text("%#x" % self.flags) |
| 8300 | q.text(","); q.breakable() |
| 8301 | q.text("vlan_vid = "); |
| 8302 | q.text("%#x" % self.vlan_vid) |
| 8303 | q.breakable() |
| 8304 | q.text('}') |
| 8305 | |
| 8306 | bsn_stats_request.subtypes[9] = bsn_vlan_counter_stats_request |
| 8307 | |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 8308 | class bsn_vrf_counter_stats_reply(bsn_stats_reply): |
| 8309 | version = 4 |
| 8310 | type = 19 |
| 8311 | stats_type = 65535 |
| 8312 | experimenter = 6035143 |
| 8313 | subtype = 15 |
| 8314 | |
| 8315 | def __init__(self, xid=None, flags=None, entries=None): |
| 8316 | if xid != None: |
| 8317 | self.xid = xid |
| 8318 | else: |
| 8319 | self.xid = None |
| 8320 | if flags != None: |
| 8321 | self.flags = flags |
| 8322 | else: |
| 8323 | self.flags = 0 |
| 8324 | if entries != None: |
| 8325 | self.entries = entries |
| 8326 | else: |
| 8327 | self.entries = [] |
| 8328 | return |
| 8329 | |
| 8330 | def pack(self): |
| 8331 | packed = [] |
| 8332 | packed.append(struct.pack("!B", self.version)) |
| 8333 | packed.append(struct.pack("!B", self.type)) |
| 8334 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8335 | packed.append(struct.pack("!L", self.xid)) |
| 8336 | packed.append(struct.pack("!H", self.stats_type)) |
| 8337 | packed.append(struct.pack("!H", self.flags)) |
| 8338 | packed.append('\x00' * 4) |
| 8339 | packed.append(struct.pack("!L", self.experimenter)) |
| 8340 | packed.append(struct.pack("!L", self.subtype)) |
| 8341 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 8342 | length = sum([len(x) for x in packed]) |
| 8343 | packed[2] = struct.pack("!H", length) |
| 8344 | return ''.join(packed) |
| 8345 | |
| 8346 | @staticmethod |
| 8347 | def unpack(reader): |
| 8348 | obj = bsn_vrf_counter_stats_reply() |
| 8349 | _version = reader.read("!B")[0] |
| 8350 | assert(_version == 4) |
| 8351 | _type = reader.read("!B")[0] |
| 8352 | assert(_type == 19) |
| 8353 | _length = reader.read("!H")[0] |
| 8354 | orig_reader = reader |
| 8355 | reader = orig_reader.slice(_length - (2 + 2)) |
| 8356 | obj.xid = reader.read("!L")[0] |
| 8357 | _stats_type = reader.read("!H")[0] |
| 8358 | assert(_stats_type == 65535) |
| 8359 | obj.flags = reader.read("!H")[0] |
| 8360 | reader.skip(4) |
| 8361 | _experimenter = reader.read("!L")[0] |
| 8362 | assert(_experimenter == 6035143) |
| 8363 | _subtype = reader.read("!L")[0] |
| 8364 | assert(_subtype == 15) |
| 8365 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_vrf_counter_stats_entry.unpack) |
| 8366 | return obj |
| 8367 | |
| 8368 | def __eq__(self, other): |
| 8369 | if type(self) != type(other): return False |
| 8370 | if self.xid != other.xid: return False |
| 8371 | if self.flags != other.flags: return False |
| 8372 | if self.entries != other.entries: return False |
| 8373 | return True |
| 8374 | |
| 8375 | def pretty_print(self, q): |
| 8376 | q.text("bsn_vrf_counter_stats_reply {") |
| 8377 | with q.group(): |
| 8378 | with q.indent(2): |
| 8379 | q.breakable() |
| 8380 | q.text("xid = "); |
| 8381 | if self.xid != None: |
| 8382 | q.text("%#x" % self.xid) |
| 8383 | else: |
| 8384 | q.text('None') |
| 8385 | q.text(","); q.breakable() |
| 8386 | q.text("flags = "); |
| 8387 | q.text("%#x" % self.flags) |
| 8388 | q.text(","); q.breakable() |
| 8389 | q.text("entries = "); |
| 8390 | q.pp(self.entries) |
| 8391 | q.breakable() |
| 8392 | q.text('}') |
| 8393 | |
| 8394 | bsn_stats_reply.subtypes[15] = bsn_vrf_counter_stats_reply |
| 8395 | |
| 8396 | class bsn_vrf_counter_stats_request(bsn_stats_request): |
| 8397 | version = 4 |
| 8398 | type = 18 |
| 8399 | stats_type = 65535 |
| 8400 | experimenter = 6035143 |
| 8401 | subtype = 15 |
| 8402 | |
| 8403 | def __init__(self, xid=None, flags=None, vrf=None): |
| 8404 | if xid != None: |
| 8405 | self.xid = xid |
| 8406 | else: |
| 8407 | self.xid = None |
| 8408 | if flags != None: |
| 8409 | self.flags = flags |
| 8410 | else: |
| 8411 | self.flags = 0 |
| 8412 | if vrf != None: |
| 8413 | self.vrf = vrf |
| 8414 | else: |
| 8415 | self.vrf = 0 |
| 8416 | return |
| 8417 | |
| 8418 | def pack(self): |
| 8419 | packed = [] |
| 8420 | packed.append(struct.pack("!B", self.version)) |
| 8421 | packed.append(struct.pack("!B", self.type)) |
| 8422 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8423 | packed.append(struct.pack("!L", self.xid)) |
| 8424 | packed.append(struct.pack("!H", self.stats_type)) |
| 8425 | packed.append(struct.pack("!H", self.flags)) |
| 8426 | packed.append('\x00' * 4) |
| 8427 | packed.append(struct.pack("!L", self.experimenter)) |
| 8428 | packed.append(struct.pack("!L", self.subtype)) |
| 8429 | packed.append(struct.pack("!L", self.vrf)) |
| 8430 | length = sum([len(x) for x in packed]) |
| 8431 | packed[2] = struct.pack("!H", length) |
| 8432 | return ''.join(packed) |
| 8433 | |
| 8434 | @staticmethod |
| 8435 | def unpack(reader): |
| 8436 | obj = bsn_vrf_counter_stats_request() |
| 8437 | _version = reader.read("!B")[0] |
| 8438 | assert(_version == 4) |
| 8439 | _type = reader.read("!B")[0] |
| 8440 | assert(_type == 18) |
| 8441 | _length = reader.read("!H")[0] |
| 8442 | orig_reader = reader |
| 8443 | reader = orig_reader.slice(_length - (2 + 2)) |
| 8444 | obj.xid = reader.read("!L")[0] |
| 8445 | _stats_type = reader.read("!H")[0] |
| 8446 | assert(_stats_type == 65535) |
| 8447 | obj.flags = reader.read("!H")[0] |
| 8448 | reader.skip(4) |
| 8449 | _experimenter = reader.read("!L")[0] |
| 8450 | assert(_experimenter == 6035143) |
| 8451 | _subtype = reader.read("!L")[0] |
| 8452 | assert(_subtype == 15) |
| 8453 | obj.vrf = reader.read("!L")[0] |
| 8454 | return obj |
| 8455 | |
| 8456 | def __eq__(self, other): |
| 8457 | if type(self) != type(other): return False |
| 8458 | if self.xid != other.xid: return False |
| 8459 | if self.flags != other.flags: return False |
| 8460 | if self.vrf != other.vrf: return False |
| 8461 | return True |
| 8462 | |
| 8463 | def pretty_print(self, q): |
| 8464 | q.text("bsn_vrf_counter_stats_request {") |
| 8465 | with q.group(): |
| 8466 | with q.indent(2): |
| 8467 | q.breakable() |
| 8468 | q.text("xid = "); |
| 8469 | if self.xid != None: |
| 8470 | q.text("%#x" % self.xid) |
| 8471 | else: |
| 8472 | q.text('None') |
| 8473 | q.text(","); q.breakable() |
| 8474 | q.text("flags = "); |
| 8475 | q.text("%#x" % self.flags) |
| 8476 | q.text(","); q.breakable() |
| 8477 | q.text("vrf = "); |
| 8478 | q.text("%#x" % self.vrf) |
| 8479 | q.breakable() |
| 8480 | q.text('}') |
| 8481 | |
| 8482 | bsn_stats_request.subtypes[15] = bsn_vrf_counter_stats_request |
| 8483 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8484 | class desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8485 | version = 4 |
| 8486 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8487 | stats_type = 0 |
| 8488 | |
| 8489 | 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] | 8490 | if xid != None: |
| 8491 | self.xid = xid |
| 8492 | else: |
| 8493 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8494 | if flags != None: |
| 8495 | self.flags = flags |
| 8496 | else: |
| 8497 | self.flags = 0 |
| 8498 | if mfr_desc != None: |
| 8499 | self.mfr_desc = mfr_desc |
| 8500 | else: |
| 8501 | self.mfr_desc = "" |
| 8502 | if hw_desc != None: |
| 8503 | self.hw_desc = hw_desc |
| 8504 | else: |
| 8505 | self.hw_desc = "" |
| 8506 | if sw_desc != None: |
| 8507 | self.sw_desc = sw_desc |
| 8508 | else: |
| 8509 | self.sw_desc = "" |
| 8510 | if serial_num != None: |
| 8511 | self.serial_num = serial_num |
| 8512 | else: |
| 8513 | self.serial_num = "" |
| 8514 | if dp_desc != None: |
| 8515 | self.dp_desc = dp_desc |
| 8516 | else: |
| 8517 | self.dp_desc = "" |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8518 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8519 | |
| 8520 | def pack(self): |
| 8521 | packed = [] |
| 8522 | packed.append(struct.pack("!B", self.version)) |
| 8523 | packed.append(struct.pack("!B", self.type)) |
| 8524 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8525 | packed.append(struct.pack("!L", self.xid)) |
| 8526 | packed.append(struct.pack("!H", self.stats_type)) |
| 8527 | packed.append(struct.pack("!H", self.flags)) |
| 8528 | packed.append('\x00' * 4) |
| 8529 | packed.append(struct.pack("!256s", self.mfr_desc)) |
| 8530 | packed.append(struct.pack("!256s", self.hw_desc)) |
| 8531 | packed.append(struct.pack("!256s", self.sw_desc)) |
| 8532 | packed.append(struct.pack("!32s", self.serial_num)) |
| 8533 | packed.append(struct.pack("!256s", self.dp_desc)) |
| 8534 | length = sum([len(x) for x in packed]) |
| 8535 | packed[2] = struct.pack("!H", length) |
| 8536 | return ''.join(packed) |
| 8537 | |
| 8538 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8539 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8540 | obj = desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8541 | _version = reader.read("!B")[0] |
| 8542 | assert(_version == 4) |
| 8543 | _type = reader.read("!B")[0] |
| 8544 | assert(_type == 19) |
| 8545 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8546 | orig_reader = reader |
| 8547 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8548 | obj.xid = reader.read("!L")[0] |
| 8549 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8550 | assert(_stats_type == 0) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8551 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8552 | reader.skip(4) |
| 8553 | obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00") |
| 8554 | obj.hw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 8555 | obj.sw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 8556 | obj.serial_num = reader.read("!32s")[0].rstrip("\x00") |
| 8557 | obj.dp_desc = reader.read("!256s")[0].rstrip("\x00") |
| 8558 | return obj |
| 8559 | |
| 8560 | def __eq__(self, other): |
| 8561 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8562 | if self.xid != other.xid: return False |
| 8563 | if self.flags != other.flags: return False |
| 8564 | if self.mfr_desc != other.mfr_desc: return False |
| 8565 | if self.hw_desc != other.hw_desc: return False |
| 8566 | if self.sw_desc != other.sw_desc: return False |
| 8567 | if self.serial_num != other.serial_num: return False |
| 8568 | if self.dp_desc != other.dp_desc: return False |
| 8569 | return True |
| 8570 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8571 | def pretty_print(self, q): |
| 8572 | q.text("desc_stats_reply {") |
| 8573 | with q.group(): |
| 8574 | with q.indent(2): |
| 8575 | q.breakable() |
| 8576 | q.text("xid = "); |
| 8577 | if self.xid != None: |
| 8578 | q.text("%#x" % self.xid) |
| 8579 | else: |
| 8580 | q.text('None') |
| 8581 | q.text(","); q.breakable() |
| 8582 | q.text("flags = "); |
| 8583 | q.text("%#x" % self.flags) |
| 8584 | q.text(","); q.breakable() |
| 8585 | q.text("mfr_desc = "); |
| 8586 | q.pp(self.mfr_desc) |
| 8587 | q.text(","); q.breakable() |
| 8588 | q.text("hw_desc = "); |
| 8589 | q.pp(self.hw_desc) |
| 8590 | q.text(","); q.breakable() |
| 8591 | q.text("sw_desc = "); |
| 8592 | q.pp(self.sw_desc) |
| 8593 | q.text(","); q.breakable() |
| 8594 | q.text("serial_num = "); |
| 8595 | q.pp(self.serial_num) |
| 8596 | q.text(","); q.breakable() |
| 8597 | q.text("dp_desc = "); |
| 8598 | q.pp(self.dp_desc) |
| 8599 | q.breakable() |
| 8600 | q.text('}') |
| 8601 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8602 | stats_reply.subtypes[0] = desc_stats_reply |
| 8603 | |
| 8604 | class desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8605 | version = 4 |
| 8606 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8607 | stats_type = 0 |
| 8608 | |
| 8609 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8610 | if xid != None: |
| 8611 | self.xid = xid |
| 8612 | else: |
| 8613 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8614 | if flags != None: |
| 8615 | self.flags = flags |
| 8616 | else: |
| 8617 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8618 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8619 | |
| 8620 | def pack(self): |
| 8621 | packed = [] |
| 8622 | packed.append(struct.pack("!B", self.version)) |
| 8623 | packed.append(struct.pack("!B", self.type)) |
| 8624 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8625 | packed.append(struct.pack("!L", self.xid)) |
| 8626 | packed.append(struct.pack("!H", self.stats_type)) |
| 8627 | packed.append(struct.pack("!H", self.flags)) |
| 8628 | packed.append('\x00' * 4) |
| 8629 | length = sum([len(x) for x in packed]) |
| 8630 | packed[2] = struct.pack("!H", length) |
| 8631 | return ''.join(packed) |
| 8632 | |
| 8633 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8634 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8635 | obj = desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8636 | _version = reader.read("!B")[0] |
| 8637 | assert(_version == 4) |
| 8638 | _type = reader.read("!B")[0] |
| 8639 | assert(_type == 18) |
| 8640 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8641 | orig_reader = reader |
| 8642 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8643 | obj.xid = reader.read("!L")[0] |
| 8644 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8645 | assert(_stats_type == 0) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8646 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8647 | reader.skip(4) |
| 8648 | return obj |
| 8649 | |
| 8650 | def __eq__(self, other): |
| 8651 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8652 | if self.xid != other.xid: return False |
| 8653 | if self.flags != other.flags: return False |
| 8654 | return True |
| 8655 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8656 | def pretty_print(self, q): |
| 8657 | q.text("desc_stats_request {") |
| 8658 | with q.group(): |
| 8659 | with q.indent(2): |
| 8660 | q.breakable() |
| 8661 | q.text("xid = "); |
| 8662 | if self.xid != None: |
| 8663 | q.text("%#x" % self.xid) |
| 8664 | else: |
| 8665 | q.text('None') |
| 8666 | q.text(","); q.breakable() |
| 8667 | q.text("flags = "); |
| 8668 | q.text("%#x" % self.flags) |
| 8669 | q.breakable() |
| 8670 | q.text('}') |
| 8671 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8672 | stats_request.subtypes[0] = desc_stats_request |
| 8673 | |
| 8674 | class echo_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8675 | version = 4 |
| 8676 | type = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8677 | |
| 8678 | def __init__(self, xid=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8679 | if xid != None: |
| 8680 | self.xid = xid |
| 8681 | else: |
| 8682 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8683 | if data != None: |
| 8684 | self.data = data |
| 8685 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8686 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8687 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8688 | |
| 8689 | def pack(self): |
| 8690 | packed = [] |
| 8691 | packed.append(struct.pack("!B", self.version)) |
| 8692 | packed.append(struct.pack("!B", self.type)) |
| 8693 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8694 | packed.append(struct.pack("!L", self.xid)) |
| 8695 | packed.append(self.data) |
| 8696 | length = sum([len(x) for x in packed]) |
| 8697 | packed[2] = struct.pack("!H", length) |
| 8698 | return ''.join(packed) |
| 8699 | |
| 8700 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8701 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8702 | obj = echo_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8703 | _version = reader.read("!B")[0] |
| 8704 | assert(_version == 4) |
| 8705 | _type = reader.read("!B")[0] |
| 8706 | assert(_type == 3) |
| 8707 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8708 | orig_reader = reader |
| 8709 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8710 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8711 | obj.data = str(reader.read_all()) |
| 8712 | return obj |
| 8713 | |
| 8714 | def __eq__(self, other): |
| 8715 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8716 | if self.xid != other.xid: return False |
| 8717 | if self.data != other.data: return False |
| 8718 | return True |
| 8719 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8720 | def pretty_print(self, q): |
| 8721 | q.text("echo_reply {") |
| 8722 | with q.group(): |
| 8723 | with q.indent(2): |
| 8724 | q.breakable() |
| 8725 | q.text("xid = "); |
| 8726 | if self.xid != None: |
| 8727 | q.text("%#x" % self.xid) |
| 8728 | else: |
| 8729 | q.text('None') |
| 8730 | q.text(","); q.breakable() |
| 8731 | q.text("data = "); |
| 8732 | q.pp(self.data) |
| 8733 | q.breakable() |
| 8734 | q.text('}') |
| 8735 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8736 | message.subtypes[3] = echo_reply |
| 8737 | |
| 8738 | class echo_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8739 | version = 4 |
| 8740 | type = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8741 | |
| 8742 | def __init__(self, xid=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8743 | if xid != None: |
| 8744 | self.xid = xid |
| 8745 | else: |
| 8746 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8747 | if data != None: |
| 8748 | self.data = data |
| 8749 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8750 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8751 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8752 | |
| 8753 | def pack(self): |
| 8754 | packed = [] |
| 8755 | packed.append(struct.pack("!B", self.version)) |
| 8756 | packed.append(struct.pack("!B", self.type)) |
| 8757 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8758 | packed.append(struct.pack("!L", self.xid)) |
| 8759 | packed.append(self.data) |
| 8760 | length = sum([len(x) for x in packed]) |
| 8761 | packed[2] = struct.pack("!H", length) |
| 8762 | return ''.join(packed) |
| 8763 | |
| 8764 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8765 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8766 | obj = echo_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8767 | _version = reader.read("!B")[0] |
| 8768 | assert(_version == 4) |
| 8769 | _type = reader.read("!B")[0] |
| 8770 | assert(_type == 2) |
| 8771 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8772 | orig_reader = reader |
| 8773 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8774 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8775 | obj.data = str(reader.read_all()) |
| 8776 | return obj |
| 8777 | |
| 8778 | def __eq__(self, other): |
| 8779 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8780 | if self.xid != other.xid: return False |
| 8781 | if self.data != other.data: 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("echo_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.text(","); q.breakable() |
| 8795 | q.text("data = "); |
| 8796 | q.pp(self.data) |
| 8797 | q.breakable() |
| 8798 | q.text('}') |
| 8799 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8800 | message.subtypes[2] = echo_request |
| 8801 | |
| 8802 | class experimenter_error_msg(error_msg): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8803 | version = 4 |
| 8804 | type = 1 |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8805 | err_type = 65535 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8806 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8807 | def __init__(self, xid=None, subtype=None, experimenter=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8808 | if xid != None: |
| 8809 | self.xid = xid |
| 8810 | else: |
| 8811 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8812 | if subtype != None: |
| 8813 | self.subtype = subtype |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8814 | else: |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8815 | self.subtype = 0 |
| 8816 | if experimenter != None: |
| 8817 | self.experimenter = experimenter |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8818 | else: |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8819 | self.experimenter = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8820 | if data != None: |
| 8821 | self.data = data |
| 8822 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8823 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8824 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8825 | |
| 8826 | def pack(self): |
| 8827 | packed = [] |
| 8828 | packed.append(struct.pack("!B", self.version)) |
| 8829 | packed.append(struct.pack("!B", self.type)) |
| 8830 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8831 | packed.append(struct.pack("!L", self.xid)) |
| 8832 | packed.append(struct.pack("!H", self.err_type)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8833 | packed.append(struct.pack("!H", self.subtype)) |
| 8834 | packed.append(struct.pack("!L", self.experimenter)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8835 | packed.append(self.data) |
| 8836 | length = sum([len(x) for x in packed]) |
| 8837 | packed[2] = struct.pack("!H", length) |
| 8838 | return ''.join(packed) |
| 8839 | |
| 8840 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8841 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8842 | obj = experimenter_error_msg() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8843 | _version = reader.read("!B")[0] |
| 8844 | assert(_version == 4) |
| 8845 | _type = reader.read("!B")[0] |
| 8846 | assert(_type == 1) |
| 8847 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8848 | orig_reader = reader |
| 8849 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8850 | obj.xid = reader.read("!L")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8851 | _err_type = reader.read("!H")[0] |
| 8852 | assert(_err_type == 65535) |
| 8853 | obj.subtype = reader.read("!H")[0] |
| 8854 | obj.experimenter = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8855 | obj.data = str(reader.read_all()) |
| 8856 | return obj |
| 8857 | |
| 8858 | def __eq__(self, other): |
| 8859 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8860 | if self.xid != other.xid: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8861 | if self.subtype != other.subtype: return False |
| 8862 | if self.experimenter != other.experimenter: return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8863 | if self.data != other.data: return False |
| 8864 | return True |
| 8865 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8866 | def pretty_print(self, q): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8867 | q.text("experimenter_error_msg {") |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8868 | with q.group(): |
| 8869 | with q.indent(2): |
| 8870 | q.breakable() |
| 8871 | q.text("xid = "); |
| 8872 | if self.xid != None: |
| 8873 | q.text("%#x" % self.xid) |
| 8874 | else: |
| 8875 | q.text('None') |
| 8876 | q.text(","); q.breakable() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8877 | q.text("subtype = "); |
| 8878 | q.text("%#x" % self.subtype) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8879 | q.text(","); q.breakable() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8880 | q.text("experimenter = "); |
| 8881 | q.text("%#x" % self.experimenter) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8882 | q.text(","); q.breakable() |
| 8883 | q.text("data = "); |
| 8884 | q.pp(self.data) |
| 8885 | q.breakable() |
| 8886 | q.text('}') |
| 8887 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8888 | error_msg.subtypes[65535] = experimenter_error_msg |
| 8889 | |
| 8890 | class features_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8891 | version = 4 |
| 8892 | type = 6 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8893 | |
| 8894 | 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] | 8895 | if xid != None: |
| 8896 | self.xid = xid |
| 8897 | else: |
| 8898 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8899 | if datapath_id != None: |
| 8900 | self.datapath_id = datapath_id |
| 8901 | else: |
| 8902 | self.datapath_id = 0 |
| 8903 | if n_buffers != None: |
| 8904 | self.n_buffers = n_buffers |
| 8905 | else: |
| 8906 | self.n_buffers = 0 |
| 8907 | if n_tables != None: |
| 8908 | self.n_tables = n_tables |
| 8909 | else: |
| 8910 | self.n_tables = 0 |
| 8911 | if auxiliary_id != None: |
| 8912 | self.auxiliary_id = auxiliary_id |
| 8913 | else: |
| 8914 | self.auxiliary_id = 0 |
| 8915 | if capabilities != None: |
| 8916 | self.capabilities = capabilities |
| 8917 | else: |
| 8918 | self.capabilities = 0 |
| 8919 | if reserved != None: |
| 8920 | self.reserved = reserved |
| 8921 | else: |
| 8922 | self.reserved = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8923 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8924 | |
| 8925 | def pack(self): |
| 8926 | packed = [] |
| 8927 | packed.append(struct.pack("!B", self.version)) |
| 8928 | packed.append(struct.pack("!B", self.type)) |
| 8929 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8930 | packed.append(struct.pack("!L", self.xid)) |
| 8931 | packed.append(struct.pack("!Q", self.datapath_id)) |
| 8932 | packed.append(struct.pack("!L", self.n_buffers)) |
| 8933 | packed.append(struct.pack("!B", self.n_tables)) |
| 8934 | packed.append(struct.pack("!B", self.auxiliary_id)) |
| 8935 | packed.append('\x00' * 2) |
| 8936 | packed.append(struct.pack("!L", self.capabilities)) |
| 8937 | packed.append(struct.pack("!L", self.reserved)) |
| 8938 | length = sum([len(x) for x in packed]) |
| 8939 | packed[2] = struct.pack("!H", length) |
| 8940 | return ''.join(packed) |
| 8941 | |
| 8942 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8943 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8944 | obj = features_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8945 | _version = reader.read("!B")[0] |
| 8946 | assert(_version == 4) |
| 8947 | _type = reader.read("!B")[0] |
| 8948 | assert(_type == 6) |
| 8949 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8950 | orig_reader = reader |
| 8951 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8952 | obj.xid = reader.read("!L")[0] |
| 8953 | obj.datapath_id = reader.read("!Q")[0] |
| 8954 | obj.n_buffers = reader.read("!L")[0] |
| 8955 | obj.n_tables = reader.read("!B")[0] |
| 8956 | obj.auxiliary_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8957 | reader.skip(2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8958 | obj.capabilities = reader.read("!L")[0] |
| 8959 | obj.reserved = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8960 | return obj |
| 8961 | |
| 8962 | def __eq__(self, other): |
| 8963 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8964 | if self.xid != other.xid: return False |
| 8965 | if self.datapath_id != other.datapath_id: return False |
| 8966 | if self.n_buffers != other.n_buffers: return False |
| 8967 | if self.n_tables != other.n_tables: return False |
| 8968 | if self.auxiliary_id != other.auxiliary_id: return False |
| 8969 | if self.capabilities != other.capabilities: return False |
| 8970 | if self.reserved != other.reserved: return False |
| 8971 | return True |
| 8972 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8973 | def pretty_print(self, q): |
| 8974 | q.text("features_reply {") |
| 8975 | with q.group(): |
| 8976 | with q.indent(2): |
| 8977 | q.breakable() |
| 8978 | q.text("xid = "); |
| 8979 | if self.xid != None: |
| 8980 | q.text("%#x" % self.xid) |
| 8981 | else: |
| 8982 | q.text('None') |
| 8983 | q.text(","); q.breakable() |
| 8984 | q.text("datapath_id = "); |
| 8985 | q.text("%#x" % self.datapath_id) |
| 8986 | q.text(","); q.breakable() |
| 8987 | q.text("n_buffers = "); |
| 8988 | q.text("%#x" % self.n_buffers) |
| 8989 | q.text(","); q.breakable() |
| 8990 | q.text("n_tables = "); |
| 8991 | q.text("%#x" % self.n_tables) |
| 8992 | q.text(","); q.breakable() |
| 8993 | q.text("auxiliary_id = "); |
| 8994 | q.text("%#x" % self.auxiliary_id) |
| 8995 | q.text(","); q.breakable() |
| 8996 | q.text("capabilities = "); |
| 8997 | q.text("%#x" % self.capabilities) |
| 8998 | q.text(","); q.breakable() |
| 8999 | q.text("reserved = "); |
| 9000 | q.text("%#x" % self.reserved) |
| 9001 | q.breakable() |
| 9002 | q.text('}') |
| 9003 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9004 | message.subtypes[6] = features_reply |
| 9005 | |
| 9006 | class features_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9007 | version = 4 |
| 9008 | type = 5 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9009 | |
| 9010 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9011 | if xid != None: |
| 9012 | self.xid = xid |
| 9013 | else: |
| 9014 | self.xid = None |
| 9015 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9016 | |
| 9017 | def pack(self): |
| 9018 | packed = [] |
| 9019 | packed.append(struct.pack("!B", self.version)) |
| 9020 | packed.append(struct.pack("!B", self.type)) |
| 9021 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9022 | packed.append(struct.pack("!L", self.xid)) |
| 9023 | length = sum([len(x) for x in packed]) |
| 9024 | packed[2] = struct.pack("!H", length) |
| 9025 | return ''.join(packed) |
| 9026 | |
| 9027 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9028 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9029 | obj = features_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9030 | _version = reader.read("!B")[0] |
| 9031 | assert(_version == 4) |
| 9032 | _type = reader.read("!B")[0] |
| 9033 | assert(_type == 5) |
| 9034 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9035 | orig_reader = reader |
| 9036 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9037 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9038 | return obj |
| 9039 | |
| 9040 | def __eq__(self, other): |
| 9041 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9042 | if self.xid != other.xid: return False |
| 9043 | return True |
| 9044 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9045 | def pretty_print(self, q): |
| 9046 | q.text("features_request {") |
| 9047 | with q.group(): |
| 9048 | with q.indent(2): |
| 9049 | q.breakable() |
| 9050 | q.text("xid = "); |
| 9051 | if self.xid != None: |
| 9052 | q.text("%#x" % self.xid) |
| 9053 | else: |
| 9054 | q.text('None') |
| 9055 | q.breakable() |
| 9056 | q.text('}') |
| 9057 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9058 | message.subtypes[5] = features_request |
| 9059 | |
| 9060 | class flow_mod(message): |
| 9061 | subtypes = {} |
| 9062 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 9063 | version = 4 |
| 9064 | type = 14 |
| 9065 | |
| 9066 | 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): |
| 9067 | if xid != None: |
| 9068 | self.xid = xid |
| 9069 | else: |
| 9070 | self.xid = None |
| 9071 | if cookie != None: |
| 9072 | self.cookie = cookie |
| 9073 | else: |
| 9074 | self.cookie = 0 |
| 9075 | if cookie_mask != None: |
| 9076 | self.cookie_mask = cookie_mask |
| 9077 | else: |
| 9078 | self.cookie_mask = 0 |
| 9079 | if table_id != None: |
| 9080 | self.table_id = table_id |
| 9081 | else: |
| 9082 | self.table_id = 0 |
| 9083 | if _command != None: |
| 9084 | self._command = _command |
| 9085 | else: |
| 9086 | self._command = 0 |
| 9087 | if idle_timeout != None: |
| 9088 | self.idle_timeout = idle_timeout |
| 9089 | else: |
| 9090 | self.idle_timeout = 0 |
| 9091 | if hard_timeout != None: |
| 9092 | self.hard_timeout = hard_timeout |
| 9093 | else: |
| 9094 | self.hard_timeout = 0 |
| 9095 | if priority != None: |
| 9096 | self.priority = priority |
| 9097 | else: |
| 9098 | self.priority = 0 |
| 9099 | if buffer_id != None: |
| 9100 | self.buffer_id = buffer_id |
| 9101 | else: |
| 9102 | self.buffer_id = 0 |
| 9103 | if out_port != None: |
| 9104 | self.out_port = out_port |
| 9105 | else: |
| 9106 | self.out_port = 0 |
| 9107 | if out_group != None: |
| 9108 | self.out_group = out_group |
| 9109 | else: |
| 9110 | self.out_group = 0 |
| 9111 | if flags != None: |
| 9112 | self.flags = flags |
| 9113 | else: |
| 9114 | self.flags = 0 |
| 9115 | if match != None: |
| 9116 | self.match = match |
| 9117 | else: |
| 9118 | self.match = common.match() |
| 9119 | if instructions != None: |
| 9120 | self.instructions = instructions |
| 9121 | else: |
| 9122 | self.instructions = [] |
| 9123 | return |
| 9124 | |
| 9125 | def pack(self): |
| 9126 | packed = [] |
| 9127 | packed.append(struct.pack("!B", self.version)) |
| 9128 | packed.append(struct.pack("!B", self.type)) |
| 9129 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9130 | packed.append(struct.pack("!L", self.xid)) |
| 9131 | packed.append(struct.pack("!Q", self.cookie)) |
| 9132 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 9133 | packed.append(struct.pack("!B", self.table_id)) |
| 9134 | packed.append(util.pack_fm_cmd(self._command)) |
| 9135 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 9136 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 9137 | packed.append(struct.pack("!H", self.priority)) |
| 9138 | packed.append(struct.pack("!L", self.buffer_id)) |
| 9139 | packed.append(util.pack_port_no(self.out_port)) |
| 9140 | packed.append(struct.pack("!L", self.out_group)) |
| 9141 | packed.append(struct.pack("!H", self.flags)) |
| 9142 | packed.append('\x00' * 2) |
| 9143 | packed.append(self.match.pack()) |
| 9144 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
| 9145 | length = sum([len(x) for x in packed]) |
| 9146 | packed[2] = struct.pack("!H", length) |
| 9147 | return ''.join(packed) |
| 9148 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9149 | @staticmethod |
| 9150 | def unpack(reader): |
| 9151 | subtype, = reader.peek('B', 25) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 9152 | subclass = flow_mod.subtypes.get(subtype) |
| 9153 | if subclass: |
| 9154 | return subclass.unpack(reader) |
| 9155 | |
| 9156 | obj = flow_mod() |
| 9157 | _version = reader.read("!B")[0] |
| 9158 | assert(_version == 4) |
| 9159 | _type = reader.read("!B")[0] |
| 9160 | assert(_type == 14) |
| 9161 | _length = reader.read("!H")[0] |
| 9162 | orig_reader = reader |
| 9163 | reader = orig_reader.slice(_length - (2 + 2)) |
| 9164 | obj.xid = reader.read("!L")[0] |
| 9165 | obj.cookie = reader.read("!Q")[0] |
| 9166 | obj.cookie_mask = reader.read("!Q")[0] |
| 9167 | obj.table_id = reader.read("!B")[0] |
| 9168 | obj._command = util.unpack_fm_cmd(reader) |
| 9169 | obj.idle_timeout = reader.read("!H")[0] |
| 9170 | obj.hard_timeout = reader.read("!H")[0] |
| 9171 | obj.priority = reader.read("!H")[0] |
| 9172 | obj.buffer_id = reader.read("!L")[0] |
| 9173 | obj.out_port = util.unpack_port_no(reader) |
| 9174 | obj.out_group = reader.read("!L")[0] |
| 9175 | obj.flags = reader.read("!H")[0] |
| 9176 | reader.skip(2) |
| 9177 | obj.match = common.match.unpack(reader) |
| 9178 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
| 9179 | return obj |
| 9180 | |
| 9181 | def __eq__(self, other): |
| 9182 | if type(self) != type(other): return False |
| 9183 | if self.xid != other.xid: return False |
| 9184 | if self.cookie != other.cookie: return False |
| 9185 | if self.cookie_mask != other.cookie_mask: return False |
| 9186 | if self.table_id != other.table_id: return False |
| 9187 | if self._command != other._command: return False |
| 9188 | if self.idle_timeout != other.idle_timeout: return False |
| 9189 | if self.hard_timeout != other.hard_timeout: return False |
| 9190 | if self.priority != other.priority: return False |
| 9191 | if self.buffer_id != other.buffer_id: return False |
| 9192 | if self.out_port != other.out_port: return False |
| 9193 | if self.out_group != other.out_group: return False |
| 9194 | if self.flags != other.flags: return False |
| 9195 | if self.match != other.match: return False |
| 9196 | if self.instructions != other.instructions: return False |
| 9197 | return True |
| 9198 | |
| 9199 | def pretty_print(self, q): |
| 9200 | q.text("flow_mod {") |
| 9201 | with q.group(): |
| 9202 | with q.indent(2): |
| 9203 | q.breakable() |
| 9204 | q.text("xid = "); |
| 9205 | if self.xid != None: |
| 9206 | q.text("%#x" % self.xid) |
| 9207 | else: |
| 9208 | q.text('None') |
| 9209 | q.text(","); q.breakable() |
| 9210 | q.text("cookie = "); |
| 9211 | q.text("%#x" % self.cookie) |
| 9212 | q.text(","); q.breakable() |
| 9213 | q.text("cookie_mask = "); |
| 9214 | q.text("%#x" % self.cookie_mask) |
| 9215 | q.text(","); q.breakable() |
| 9216 | q.text("table_id = "); |
| 9217 | q.text("%#x" % self.table_id) |
| 9218 | q.text(","); q.breakable() |
| 9219 | q.text("idle_timeout = "); |
| 9220 | q.text("%#x" % self.idle_timeout) |
| 9221 | q.text(","); q.breakable() |
| 9222 | q.text("hard_timeout = "); |
| 9223 | q.text("%#x" % self.hard_timeout) |
| 9224 | q.text(","); q.breakable() |
| 9225 | q.text("priority = "); |
| 9226 | q.text("%#x" % self.priority) |
| 9227 | q.text(","); q.breakable() |
| 9228 | q.text("buffer_id = "); |
| 9229 | q.text("%#x" % self.buffer_id) |
| 9230 | q.text(","); q.breakable() |
| 9231 | q.text("out_port = "); |
| 9232 | q.text(util.pretty_port(self.out_port)) |
| 9233 | q.text(","); q.breakable() |
| 9234 | q.text("out_group = "); |
| 9235 | q.text("%#x" % self.out_group) |
| 9236 | q.text(","); q.breakable() |
| 9237 | q.text("flags = "); |
| 9238 | q.text("%#x" % self.flags) |
| 9239 | q.text(","); q.breakable() |
| 9240 | q.text("match = "); |
| 9241 | q.pp(self.match) |
| 9242 | q.text(","); q.breakable() |
| 9243 | q.text("instructions = "); |
| 9244 | q.pp(self.instructions) |
| 9245 | q.breakable() |
| 9246 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9247 | |
| 9248 | message.subtypes[14] = flow_mod |
| 9249 | |
| 9250 | class flow_add(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9251 | version = 4 |
| 9252 | type = 14 |
| 9253 | _command = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9254 | |
| 9255 | 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] | 9256 | if xid != None: |
| 9257 | self.xid = xid |
| 9258 | else: |
| 9259 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9260 | if cookie != None: |
| 9261 | self.cookie = cookie |
| 9262 | else: |
| 9263 | self.cookie = 0 |
| 9264 | if cookie_mask != None: |
| 9265 | self.cookie_mask = cookie_mask |
| 9266 | else: |
| 9267 | self.cookie_mask = 0 |
| 9268 | if table_id != None: |
| 9269 | self.table_id = table_id |
| 9270 | else: |
| 9271 | self.table_id = 0 |
| 9272 | if idle_timeout != None: |
| 9273 | self.idle_timeout = idle_timeout |
| 9274 | else: |
| 9275 | self.idle_timeout = 0 |
| 9276 | if hard_timeout != None: |
| 9277 | self.hard_timeout = hard_timeout |
| 9278 | else: |
| 9279 | self.hard_timeout = 0 |
| 9280 | if priority != None: |
| 9281 | self.priority = priority |
| 9282 | else: |
| 9283 | self.priority = 0 |
| 9284 | if buffer_id != None: |
| 9285 | self.buffer_id = buffer_id |
| 9286 | else: |
| 9287 | self.buffer_id = 0 |
| 9288 | if out_port != None: |
| 9289 | self.out_port = out_port |
| 9290 | else: |
| 9291 | self.out_port = 0 |
| 9292 | if out_group != None: |
| 9293 | self.out_group = out_group |
| 9294 | else: |
| 9295 | self.out_group = 0 |
| 9296 | if flags != None: |
| 9297 | self.flags = flags |
| 9298 | else: |
| 9299 | self.flags = 0 |
| 9300 | if match != None: |
| 9301 | self.match = match |
| 9302 | else: |
| 9303 | self.match = common.match() |
| 9304 | if instructions != None: |
| 9305 | self.instructions = instructions |
| 9306 | else: |
| 9307 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9308 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9309 | |
| 9310 | def pack(self): |
| 9311 | packed = [] |
| 9312 | packed.append(struct.pack("!B", self.version)) |
| 9313 | packed.append(struct.pack("!B", self.type)) |
| 9314 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9315 | packed.append(struct.pack("!L", self.xid)) |
| 9316 | packed.append(struct.pack("!Q", self.cookie)) |
| 9317 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 9318 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9319 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9320 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 9321 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 9322 | packed.append(struct.pack("!H", self.priority)) |
| 9323 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9324 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9325 | packed.append(struct.pack("!L", self.out_group)) |
| 9326 | packed.append(struct.pack("!H", self.flags)) |
| 9327 | packed.append('\x00' * 2) |
| 9328 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9329 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9330 | length = sum([len(x) for x in packed]) |
| 9331 | packed[2] = struct.pack("!H", length) |
| 9332 | return ''.join(packed) |
| 9333 | |
| 9334 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9335 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9336 | obj = flow_add() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9337 | _version = reader.read("!B")[0] |
| 9338 | assert(_version == 4) |
| 9339 | _type = reader.read("!B")[0] |
| 9340 | assert(_type == 14) |
| 9341 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9342 | orig_reader = reader |
| 9343 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9344 | obj.xid = reader.read("!L")[0] |
| 9345 | obj.cookie = reader.read("!Q")[0] |
| 9346 | obj.cookie_mask = reader.read("!Q")[0] |
| 9347 | obj.table_id = reader.read("!B")[0] |
| 9348 | __command = util.unpack_fm_cmd(reader) |
| 9349 | assert(__command == 0) |
| 9350 | obj.idle_timeout = reader.read("!H")[0] |
| 9351 | obj.hard_timeout = reader.read("!H")[0] |
| 9352 | obj.priority = reader.read("!H")[0] |
| 9353 | obj.buffer_id = reader.read("!L")[0] |
| 9354 | obj.out_port = util.unpack_port_no(reader) |
| 9355 | obj.out_group = reader.read("!L")[0] |
| 9356 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9357 | reader.skip(2) |
| 9358 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9359 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9360 | return obj |
| 9361 | |
| 9362 | def __eq__(self, other): |
| 9363 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9364 | if self.xid != other.xid: return False |
| 9365 | if self.cookie != other.cookie: return False |
| 9366 | if self.cookie_mask != other.cookie_mask: return False |
| 9367 | if self.table_id != other.table_id: return False |
| 9368 | if self.idle_timeout != other.idle_timeout: return False |
| 9369 | if self.hard_timeout != other.hard_timeout: return False |
| 9370 | if self.priority != other.priority: return False |
| 9371 | if self.buffer_id != other.buffer_id: return False |
| 9372 | if self.out_port != other.out_port: return False |
| 9373 | if self.out_group != other.out_group: return False |
| 9374 | if self.flags != other.flags: return False |
| 9375 | if self.match != other.match: return False |
| 9376 | if self.instructions != other.instructions: return False |
| 9377 | return True |
| 9378 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9379 | def pretty_print(self, q): |
| 9380 | q.text("flow_add {") |
| 9381 | with q.group(): |
| 9382 | with q.indent(2): |
| 9383 | q.breakable() |
| 9384 | q.text("xid = "); |
| 9385 | if self.xid != None: |
| 9386 | q.text("%#x" % self.xid) |
| 9387 | else: |
| 9388 | q.text('None') |
| 9389 | q.text(","); q.breakable() |
| 9390 | q.text("cookie = "); |
| 9391 | q.text("%#x" % self.cookie) |
| 9392 | q.text(","); q.breakable() |
| 9393 | q.text("cookie_mask = "); |
| 9394 | q.text("%#x" % self.cookie_mask) |
| 9395 | q.text(","); q.breakable() |
| 9396 | q.text("table_id = "); |
| 9397 | q.text("%#x" % self.table_id) |
| 9398 | q.text(","); q.breakable() |
| 9399 | q.text("idle_timeout = "); |
| 9400 | q.text("%#x" % self.idle_timeout) |
| 9401 | q.text(","); q.breakable() |
| 9402 | q.text("hard_timeout = "); |
| 9403 | q.text("%#x" % self.hard_timeout) |
| 9404 | q.text(","); q.breakable() |
| 9405 | q.text("priority = "); |
| 9406 | q.text("%#x" % self.priority) |
| 9407 | q.text(","); q.breakable() |
| 9408 | q.text("buffer_id = "); |
| 9409 | q.text("%#x" % self.buffer_id) |
| 9410 | q.text(","); q.breakable() |
| 9411 | q.text("out_port = "); |
| 9412 | q.text(util.pretty_port(self.out_port)) |
| 9413 | q.text(","); q.breakable() |
| 9414 | q.text("out_group = "); |
| 9415 | q.text("%#x" % self.out_group) |
| 9416 | q.text(","); q.breakable() |
| 9417 | q.text("flags = "); |
| 9418 | q.text("%#x" % self.flags) |
| 9419 | q.text(","); q.breakable() |
| 9420 | q.text("match = "); |
| 9421 | q.pp(self.match) |
| 9422 | q.text(","); q.breakable() |
| 9423 | q.text("instructions = "); |
| 9424 | q.pp(self.instructions) |
| 9425 | q.breakable() |
| 9426 | q.text('}') |
| 9427 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9428 | flow_mod.subtypes[0] = flow_add |
| 9429 | |
| 9430 | class flow_delete(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9431 | version = 4 |
| 9432 | type = 14 |
| 9433 | _command = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9434 | |
| 9435 | 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] | 9436 | if xid != None: |
| 9437 | self.xid = xid |
| 9438 | else: |
| 9439 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9440 | if cookie != None: |
| 9441 | self.cookie = cookie |
| 9442 | else: |
| 9443 | self.cookie = 0 |
| 9444 | if cookie_mask != None: |
| 9445 | self.cookie_mask = cookie_mask |
| 9446 | else: |
| 9447 | self.cookie_mask = 0 |
| 9448 | if table_id != None: |
| 9449 | self.table_id = table_id |
| 9450 | else: |
| 9451 | self.table_id = 0 |
| 9452 | if idle_timeout != None: |
| 9453 | self.idle_timeout = idle_timeout |
| 9454 | else: |
| 9455 | self.idle_timeout = 0 |
| 9456 | if hard_timeout != None: |
| 9457 | self.hard_timeout = hard_timeout |
| 9458 | else: |
| 9459 | self.hard_timeout = 0 |
| 9460 | if priority != None: |
| 9461 | self.priority = priority |
| 9462 | else: |
| 9463 | self.priority = 0 |
| 9464 | if buffer_id != None: |
| 9465 | self.buffer_id = buffer_id |
| 9466 | else: |
| 9467 | self.buffer_id = 0 |
| 9468 | if out_port != None: |
| 9469 | self.out_port = out_port |
| 9470 | else: |
| 9471 | self.out_port = 0 |
| 9472 | if out_group != None: |
| 9473 | self.out_group = out_group |
| 9474 | else: |
| 9475 | self.out_group = 0 |
| 9476 | if flags != None: |
| 9477 | self.flags = flags |
| 9478 | else: |
| 9479 | self.flags = 0 |
| 9480 | if match != None: |
| 9481 | self.match = match |
| 9482 | else: |
| 9483 | self.match = common.match() |
| 9484 | if instructions != None: |
| 9485 | self.instructions = instructions |
| 9486 | else: |
| 9487 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9488 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9489 | |
| 9490 | def pack(self): |
| 9491 | packed = [] |
| 9492 | packed.append(struct.pack("!B", self.version)) |
| 9493 | packed.append(struct.pack("!B", self.type)) |
| 9494 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9495 | packed.append(struct.pack("!L", self.xid)) |
| 9496 | packed.append(struct.pack("!Q", self.cookie)) |
| 9497 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 9498 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9499 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9500 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 9501 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 9502 | packed.append(struct.pack("!H", self.priority)) |
| 9503 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9504 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9505 | packed.append(struct.pack("!L", self.out_group)) |
| 9506 | packed.append(struct.pack("!H", self.flags)) |
| 9507 | packed.append('\x00' * 2) |
| 9508 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9509 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9510 | length = sum([len(x) for x in packed]) |
| 9511 | packed[2] = struct.pack("!H", length) |
| 9512 | return ''.join(packed) |
| 9513 | |
| 9514 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9515 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9516 | obj = flow_delete() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9517 | _version = reader.read("!B")[0] |
| 9518 | assert(_version == 4) |
| 9519 | _type = reader.read("!B")[0] |
| 9520 | assert(_type == 14) |
| 9521 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9522 | orig_reader = reader |
| 9523 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9524 | obj.xid = reader.read("!L")[0] |
| 9525 | obj.cookie = reader.read("!Q")[0] |
| 9526 | obj.cookie_mask = reader.read("!Q")[0] |
| 9527 | obj.table_id = reader.read("!B")[0] |
| 9528 | __command = util.unpack_fm_cmd(reader) |
| 9529 | assert(__command == 3) |
| 9530 | obj.idle_timeout = reader.read("!H")[0] |
| 9531 | obj.hard_timeout = reader.read("!H")[0] |
| 9532 | obj.priority = reader.read("!H")[0] |
| 9533 | obj.buffer_id = reader.read("!L")[0] |
| 9534 | obj.out_port = util.unpack_port_no(reader) |
| 9535 | obj.out_group = reader.read("!L")[0] |
| 9536 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9537 | reader.skip(2) |
| 9538 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9539 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9540 | return obj |
| 9541 | |
| 9542 | def __eq__(self, other): |
| 9543 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9544 | if self.xid != other.xid: return False |
| 9545 | if self.cookie != other.cookie: return False |
| 9546 | if self.cookie_mask != other.cookie_mask: return False |
| 9547 | if self.table_id != other.table_id: return False |
| 9548 | if self.idle_timeout != other.idle_timeout: return False |
| 9549 | if self.hard_timeout != other.hard_timeout: return False |
| 9550 | if self.priority != other.priority: return False |
| 9551 | if self.buffer_id != other.buffer_id: return False |
| 9552 | if self.out_port != other.out_port: return False |
| 9553 | if self.out_group != other.out_group: return False |
| 9554 | if self.flags != other.flags: return False |
| 9555 | if self.match != other.match: return False |
| 9556 | if self.instructions != other.instructions: return False |
| 9557 | return True |
| 9558 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9559 | def pretty_print(self, q): |
| 9560 | q.text("flow_delete {") |
| 9561 | with q.group(): |
| 9562 | with q.indent(2): |
| 9563 | q.breakable() |
| 9564 | q.text("xid = "); |
| 9565 | if self.xid != None: |
| 9566 | q.text("%#x" % self.xid) |
| 9567 | else: |
| 9568 | q.text('None') |
| 9569 | q.text(","); q.breakable() |
| 9570 | q.text("cookie = "); |
| 9571 | q.text("%#x" % self.cookie) |
| 9572 | q.text(","); q.breakable() |
| 9573 | q.text("cookie_mask = "); |
| 9574 | q.text("%#x" % self.cookie_mask) |
| 9575 | q.text(","); q.breakable() |
| 9576 | q.text("table_id = "); |
| 9577 | q.text("%#x" % self.table_id) |
| 9578 | q.text(","); q.breakable() |
| 9579 | q.text("idle_timeout = "); |
| 9580 | q.text("%#x" % self.idle_timeout) |
| 9581 | q.text(","); q.breakable() |
| 9582 | q.text("hard_timeout = "); |
| 9583 | q.text("%#x" % self.hard_timeout) |
| 9584 | q.text(","); q.breakable() |
| 9585 | q.text("priority = "); |
| 9586 | q.text("%#x" % self.priority) |
| 9587 | q.text(","); q.breakable() |
| 9588 | q.text("buffer_id = "); |
| 9589 | q.text("%#x" % self.buffer_id) |
| 9590 | q.text(","); q.breakable() |
| 9591 | q.text("out_port = "); |
| 9592 | q.text(util.pretty_port(self.out_port)) |
| 9593 | q.text(","); q.breakable() |
| 9594 | q.text("out_group = "); |
| 9595 | q.text("%#x" % self.out_group) |
| 9596 | q.text(","); q.breakable() |
| 9597 | q.text("flags = "); |
| 9598 | q.text("%#x" % self.flags) |
| 9599 | q.text(","); q.breakable() |
| 9600 | q.text("match = "); |
| 9601 | q.pp(self.match) |
| 9602 | q.text(","); q.breakable() |
| 9603 | q.text("instructions = "); |
| 9604 | q.pp(self.instructions) |
| 9605 | q.breakable() |
| 9606 | q.text('}') |
| 9607 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9608 | flow_mod.subtypes[3] = flow_delete |
| 9609 | |
| 9610 | class flow_delete_strict(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9611 | version = 4 |
| 9612 | type = 14 |
| 9613 | _command = 4 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9614 | |
| 9615 | 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] | 9616 | if xid != None: |
| 9617 | self.xid = xid |
| 9618 | else: |
| 9619 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9620 | if cookie != None: |
| 9621 | self.cookie = cookie |
| 9622 | else: |
| 9623 | self.cookie = 0 |
| 9624 | if cookie_mask != None: |
| 9625 | self.cookie_mask = cookie_mask |
| 9626 | else: |
| 9627 | self.cookie_mask = 0 |
| 9628 | if table_id != None: |
| 9629 | self.table_id = table_id |
| 9630 | else: |
| 9631 | self.table_id = 0 |
| 9632 | if idle_timeout != None: |
| 9633 | self.idle_timeout = idle_timeout |
| 9634 | else: |
| 9635 | self.idle_timeout = 0 |
| 9636 | if hard_timeout != None: |
| 9637 | self.hard_timeout = hard_timeout |
| 9638 | else: |
| 9639 | self.hard_timeout = 0 |
| 9640 | if priority != None: |
| 9641 | self.priority = priority |
| 9642 | else: |
| 9643 | self.priority = 0 |
| 9644 | if buffer_id != None: |
| 9645 | self.buffer_id = buffer_id |
| 9646 | else: |
| 9647 | self.buffer_id = 0 |
| 9648 | if out_port != None: |
| 9649 | self.out_port = out_port |
| 9650 | else: |
| 9651 | self.out_port = 0 |
| 9652 | if out_group != None: |
| 9653 | self.out_group = out_group |
| 9654 | else: |
| 9655 | self.out_group = 0 |
| 9656 | if flags != None: |
| 9657 | self.flags = flags |
| 9658 | else: |
| 9659 | self.flags = 0 |
| 9660 | if match != None: |
| 9661 | self.match = match |
| 9662 | else: |
| 9663 | self.match = common.match() |
| 9664 | if instructions != None: |
| 9665 | self.instructions = instructions |
| 9666 | else: |
| 9667 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9668 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9669 | |
| 9670 | def pack(self): |
| 9671 | packed = [] |
| 9672 | packed.append(struct.pack("!B", self.version)) |
| 9673 | packed.append(struct.pack("!B", self.type)) |
| 9674 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9675 | packed.append(struct.pack("!L", self.xid)) |
| 9676 | packed.append(struct.pack("!Q", self.cookie)) |
| 9677 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 9678 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9679 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9680 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 9681 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 9682 | packed.append(struct.pack("!H", self.priority)) |
| 9683 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9684 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9685 | packed.append(struct.pack("!L", self.out_group)) |
| 9686 | packed.append(struct.pack("!H", self.flags)) |
| 9687 | packed.append('\x00' * 2) |
| 9688 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9689 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9690 | length = sum([len(x) for x in packed]) |
| 9691 | packed[2] = struct.pack("!H", length) |
| 9692 | return ''.join(packed) |
| 9693 | |
| 9694 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9695 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9696 | obj = flow_delete_strict() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9697 | _version = reader.read("!B")[0] |
| 9698 | assert(_version == 4) |
| 9699 | _type = reader.read("!B")[0] |
| 9700 | assert(_type == 14) |
| 9701 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9702 | orig_reader = reader |
| 9703 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9704 | obj.xid = reader.read("!L")[0] |
| 9705 | obj.cookie = reader.read("!Q")[0] |
| 9706 | obj.cookie_mask = reader.read("!Q")[0] |
| 9707 | obj.table_id = reader.read("!B")[0] |
| 9708 | __command = util.unpack_fm_cmd(reader) |
| 9709 | assert(__command == 4) |
| 9710 | obj.idle_timeout = reader.read("!H")[0] |
| 9711 | obj.hard_timeout = reader.read("!H")[0] |
| 9712 | obj.priority = reader.read("!H")[0] |
| 9713 | obj.buffer_id = reader.read("!L")[0] |
| 9714 | obj.out_port = util.unpack_port_no(reader) |
| 9715 | obj.out_group = reader.read("!L")[0] |
| 9716 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9717 | reader.skip(2) |
| 9718 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9719 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9720 | return obj |
| 9721 | |
| 9722 | def __eq__(self, other): |
| 9723 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9724 | if self.xid != other.xid: return False |
| 9725 | if self.cookie != other.cookie: return False |
| 9726 | if self.cookie_mask != other.cookie_mask: return False |
| 9727 | if self.table_id != other.table_id: return False |
| 9728 | if self.idle_timeout != other.idle_timeout: return False |
| 9729 | if self.hard_timeout != other.hard_timeout: return False |
| 9730 | if self.priority != other.priority: return False |
| 9731 | if self.buffer_id != other.buffer_id: return False |
| 9732 | if self.out_port != other.out_port: return False |
| 9733 | if self.out_group != other.out_group: return False |
| 9734 | if self.flags != other.flags: return False |
| 9735 | if self.match != other.match: return False |
| 9736 | if self.instructions != other.instructions: return False |
| 9737 | return True |
| 9738 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9739 | def pretty_print(self, q): |
| 9740 | q.text("flow_delete_strict {") |
| 9741 | with q.group(): |
| 9742 | with q.indent(2): |
| 9743 | q.breakable() |
| 9744 | q.text("xid = "); |
| 9745 | if self.xid != None: |
| 9746 | q.text("%#x" % self.xid) |
| 9747 | else: |
| 9748 | q.text('None') |
| 9749 | q.text(","); q.breakable() |
| 9750 | q.text("cookie = "); |
| 9751 | q.text("%#x" % self.cookie) |
| 9752 | q.text(","); q.breakable() |
| 9753 | q.text("cookie_mask = "); |
| 9754 | q.text("%#x" % self.cookie_mask) |
| 9755 | q.text(","); q.breakable() |
| 9756 | q.text("table_id = "); |
| 9757 | q.text("%#x" % self.table_id) |
| 9758 | q.text(","); q.breakable() |
| 9759 | q.text("idle_timeout = "); |
| 9760 | q.text("%#x" % self.idle_timeout) |
| 9761 | q.text(","); q.breakable() |
| 9762 | q.text("hard_timeout = "); |
| 9763 | q.text("%#x" % self.hard_timeout) |
| 9764 | q.text(","); q.breakable() |
| 9765 | q.text("priority = "); |
| 9766 | q.text("%#x" % self.priority) |
| 9767 | q.text(","); q.breakable() |
| 9768 | q.text("buffer_id = "); |
| 9769 | q.text("%#x" % self.buffer_id) |
| 9770 | q.text(","); q.breakable() |
| 9771 | q.text("out_port = "); |
| 9772 | q.text(util.pretty_port(self.out_port)) |
| 9773 | q.text(","); q.breakable() |
| 9774 | q.text("out_group = "); |
| 9775 | q.text("%#x" % self.out_group) |
| 9776 | q.text(","); q.breakable() |
| 9777 | q.text("flags = "); |
| 9778 | q.text("%#x" % self.flags) |
| 9779 | q.text(","); q.breakable() |
| 9780 | q.text("match = "); |
| 9781 | q.pp(self.match) |
| 9782 | q.text(","); q.breakable() |
| 9783 | q.text("instructions = "); |
| 9784 | q.pp(self.instructions) |
| 9785 | q.breakable() |
| 9786 | q.text('}') |
| 9787 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9788 | flow_mod.subtypes[4] = flow_delete_strict |
| 9789 | |
| 9790 | class flow_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9791 | version = 4 |
| 9792 | type = 1 |
| 9793 | err_type = 5 |
| 9794 | |
| 9795 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9796 | if xid != None: |
| 9797 | self.xid = xid |
| 9798 | else: |
| 9799 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9800 | if code != None: |
| 9801 | self.code = code |
| 9802 | else: |
| 9803 | self.code = 0 |
| 9804 | if data != None: |
| 9805 | self.data = data |
| 9806 | else: |
| 9807 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9808 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9809 | |
| 9810 | def pack(self): |
| 9811 | packed = [] |
| 9812 | packed.append(struct.pack("!B", self.version)) |
| 9813 | packed.append(struct.pack("!B", self.type)) |
| 9814 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9815 | packed.append(struct.pack("!L", self.xid)) |
| 9816 | packed.append(struct.pack("!H", self.err_type)) |
| 9817 | packed.append(struct.pack("!H", self.code)) |
| 9818 | packed.append(self.data) |
| 9819 | length = sum([len(x) for x in packed]) |
| 9820 | packed[2] = struct.pack("!H", length) |
| 9821 | return ''.join(packed) |
| 9822 | |
| 9823 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9824 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9825 | obj = flow_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9826 | _version = reader.read("!B")[0] |
| 9827 | assert(_version == 4) |
| 9828 | _type = reader.read("!B")[0] |
| 9829 | assert(_type == 1) |
| 9830 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9831 | orig_reader = reader |
| 9832 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9833 | obj.xid = reader.read("!L")[0] |
| 9834 | _err_type = reader.read("!H")[0] |
| 9835 | assert(_err_type == 5) |
| 9836 | obj.code = reader.read("!H")[0] |
| 9837 | obj.data = str(reader.read_all()) |
| 9838 | return obj |
| 9839 | |
| 9840 | def __eq__(self, other): |
| 9841 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9842 | if self.xid != other.xid: return False |
| 9843 | if self.code != other.code: return False |
| 9844 | if self.data != other.data: return False |
| 9845 | return True |
| 9846 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9847 | def pretty_print(self, q): |
| 9848 | q.text("flow_mod_failed_error_msg {") |
| 9849 | with q.group(): |
| 9850 | with q.indent(2): |
| 9851 | q.breakable() |
| 9852 | q.text("xid = "); |
| 9853 | if self.xid != None: |
| 9854 | q.text("%#x" % self.xid) |
| 9855 | else: |
| 9856 | q.text('None') |
| 9857 | q.text(","); q.breakable() |
| 9858 | q.text("code = "); |
| 9859 | q.text("%#x" % self.code) |
| 9860 | q.text(","); q.breakable() |
| 9861 | q.text("data = "); |
| 9862 | q.pp(self.data) |
| 9863 | q.breakable() |
| 9864 | q.text('}') |
| 9865 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9866 | error_msg.subtypes[5] = flow_mod_failed_error_msg |
| 9867 | |
| 9868 | class flow_modify(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9869 | version = 4 |
| 9870 | type = 14 |
| 9871 | _command = 1 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9872 | |
| 9873 | 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] | 9874 | if xid != None: |
| 9875 | self.xid = xid |
| 9876 | else: |
| 9877 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9878 | if cookie != None: |
| 9879 | self.cookie = cookie |
| 9880 | else: |
| 9881 | self.cookie = 0 |
| 9882 | if cookie_mask != None: |
| 9883 | self.cookie_mask = cookie_mask |
| 9884 | else: |
| 9885 | self.cookie_mask = 0 |
| 9886 | if table_id != None: |
| 9887 | self.table_id = table_id |
| 9888 | else: |
| 9889 | self.table_id = 0 |
| 9890 | if idle_timeout != None: |
| 9891 | self.idle_timeout = idle_timeout |
| 9892 | else: |
| 9893 | self.idle_timeout = 0 |
| 9894 | if hard_timeout != None: |
| 9895 | self.hard_timeout = hard_timeout |
| 9896 | else: |
| 9897 | self.hard_timeout = 0 |
| 9898 | if priority != None: |
| 9899 | self.priority = priority |
| 9900 | else: |
| 9901 | self.priority = 0 |
| 9902 | if buffer_id != None: |
| 9903 | self.buffer_id = buffer_id |
| 9904 | else: |
| 9905 | self.buffer_id = 0 |
| 9906 | if out_port != None: |
| 9907 | self.out_port = out_port |
| 9908 | else: |
| 9909 | self.out_port = 0 |
| 9910 | if out_group != None: |
| 9911 | self.out_group = out_group |
| 9912 | else: |
| 9913 | self.out_group = 0 |
| 9914 | if flags != None: |
| 9915 | self.flags = flags |
| 9916 | else: |
| 9917 | self.flags = 0 |
| 9918 | if match != None: |
| 9919 | self.match = match |
| 9920 | else: |
| 9921 | self.match = common.match() |
| 9922 | if instructions != None: |
| 9923 | self.instructions = instructions |
| 9924 | else: |
| 9925 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9926 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9927 | |
| 9928 | def pack(self): |
| 9929 | packed = [] |
| 9930 | packed.append(struct.pack("!B", self.version)) |
| 9931 | packed.append(struct.pack("!B", self.type)) |
| 9932 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9933 | packed.append(struct.pack("!L", self.xid)) |
| 9934 | packed.append(struct.pack("!Q", self.cookie)) |
| 9935 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 9936 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9937 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9938 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 9939 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 9940 | packed.append(struct.pack("!H", self.priority)) |
| 9941 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9942 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9943 | packed.append(struct.pack("!L", self.out_group)) |
| 9944 | packed.append(struct.pack("!H", self.flags)) |
| 9945 | packed.append('\x00' * 2) |
| 9946 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9947 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9948 | length = sum([len(x) for x in packed]) |
| 9949 | packed[2] = struct.pack("!H", length) |
| 9950 | return ''.join(packed) |
| 9951 | |
| 9952 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9953 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9954 | obj = flow_modify() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9955 | _version = reader.read("!B")[0] |
| 9956 | assert(_version == 4) |
| 9957 | _type = reader.read("!B")[0] |
| 9958 | assert(_type == 14) |
| 9959 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9960 | orig_reader = reader |
| 9961 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9962 | obj.xid = reader.read("!L")[0] |
| 9963 | obj.cookie = reader.read("!Q")[0] |
| 9964 | obj.cookie_mask = reader.read("!Q")[0] |
| 9965 | obj.table_id = reader.read("!B")[0] |
| 9966 | __command = util.unpack_fm_cmd(reader) |
| 9967 | assert(__command == 1) |
| 9968 | obj.idle_timeout = reader.read("!H")[0] |
| 9969 | obj.hard_timeout = reader.read("!H")[0] |
| 9970 | obj.priority = reader.read("!H")[0] |
| 9971 | obj.buffer_id = reader.read("!L")[0] |
| 9972 | obj.out_port = util.unpack_port_no(reader) |
| 9973 | obj.out_group = reader.read("!L")[0] |
| 9974 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9975 | reader.skip(2) |
| 9976 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9977 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9978 | return obj |
| 9979 | |
| 9980 | def __eq__(self, other): |
| 9981 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9982 | if self.xid != other.xid: return False |
| 9983 | if self.cookie != other.cookie: return False |
| 9984 | if self.cookie_mask != other.cookie_mask: return False |
| 9985 | if self.table_id != other.table_id: return False |
| 9986 | if self.idle_timeout != other.idle_timeout: return False |
| 9987 | if self.hard_timeout != other.hard_timeout: return False |
| 9988 | if self.priority != other.priority: return False |
| 9989 | if self.buffer_id != other.buffer_id: return False |
| 9990 | if self.out_port != other.out_port: return False |
| 9991 | if self.out_group != other.out_group: return False |
| 9992 | if self.flags != other.flags: return False |
| 9993 | if self.match != other.match: return False |
| 9994 | if self.instructions != other.instructions: return False |
| 9995 | return True |
| 9996 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9997 | def pretty_print(self, q): |
| 9998 | q.text("flow_modify {") |
| 9999 | with q.group(): |
| 10000 | with q.indent(2): |
| 10001 | q.breakable() |
| 10002 | q.text("xid = "); |
| 10003 | if self.xid != None: |
| 10004 | q.text("%#x" % self.xid) |
| 10005 | else: |
| 10006 | q.text('None') |
| 10007 | q.text(","); q.breakable() |
| 10008 | q.text("cookie = "); |
| 10009 | q.text("%#x" % self.cookie) |
| 10010 | q.text(","); q.breakable() |
| 10011 | q.text("cookie_mask = "); |
| 10012 | q.text("%#x" % self.cookie_mask) |
| 10013 | q.text(","); q.breakable() |
| 10014 | q.text("table_id = "); |
| 10015 | q.text("%#x" % self.table_id) |
| 10016 | q.text(","); q.breakable() |
| 10017 | q.text("idle_timeout = "); |
| 10018 | q.text("%#x" % self.idle_timeout) |
| 10019 | q.text(","); q.breakable() |
| 10020 | q.text("hard_timeout = "); |
| 10021 | q.text("%#x" % self.hard_timeout) |
| 10022 | q.text(","); q.breakable() |
| 10023 | q.text("priority = "); |
| 10024 | q.text("%#x" % self.priority) |
| 10025 | q.text(","); q.breakable() |
| 10026 | q.text("buffer_id = "); |
| 10027 | q.text("%#x" % self.buffer_id) |
| 10028 | q.text(","); q.breakable() |
| 10029 | q.text("out_port = "); |
| 10030 | q.text(util.pretty_port(self.out_port)) |
| 10031 | q.text(","); q.breakable() |
| 10032 | q.text("out_group = "); |
| 10033 | q.text("%#x" % self.out_group) |
| 10034 | q.text(","); q.breakable() |
| 10035 | q.text("flags = "); |
| 10036 | q.text("%#x" % self.flags) |
| 10037 | q.text(","); q.breakable() |
| 10038 | q.text("match = "); |
| 10039 | q.pp(self.match) |
| 10040 | q.text(","); q.breakable() |
| 10041 | q.text("instructions = "); |
| 10042 | q.pp(self.instructions) |
| 10043 | q.breakable() |
| 10044 | q.text('}') |
| 10045 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10046 | flow_mod.subtypes[1] = flow_modify |
| 10047 | |
| 10048 | class flow_modify_strict(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10049 | version = 4 |
| 10050 | type = 14 |
| 10051 | _command = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10052 | |
| 10053 | 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] | 10054 | if xid != None: |
| 10055 | self.xid = xid |
| 10056 | else: |
| 10057 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10058 | if cookie != None: |
| 10059 | self.cookie = cookie |
| 10060 | else: |
| 10061 | self.cookie = 0 |
| 10062 | if cookie_mask != None: |
| 10063 | self.cookie_mask = cookie_mask |
| 10064 | else: |
| 10065 | self.cookie_mask = 0 |
| 10066 | if table_id != None: |
| 10067 | self.table_id = table_id |
| 10068 | else: |
| 10069 | self.table_id = 0 |
| 10070 | if idle_timeout != None: |
| 10071 | self.idle_timeout = idle_timeout |
| 10072 | else: |
| 10073 | self.idle_timeout = 0 |
| 10074 | if hard_timeout != None: |
| 10075 | self.hard_timeout = hard_timeout |
| 10076 | else: |
| 10077 | self.hard_timeout = 0 |
| 10078 | if priority != None: |
| 10079 | self.priority = priority |
| 10080 | else: |
| 10081 | self.priority = 0 |
| 10082 | if buffer_id != None: |
| 10083 | self.buffer_id = buffer_id |
| 10084 | else: |
| 10085 | self.buffer_id = 0 |
| 10086 | if out_port != None: |
| 10087 | self.out_port = out_port |
| 10088 | else: |
| 10089 | self.out_port = 0 |
| 10090 | if out_group != None: |
| 10091 | self.out_group = out_group |
| 10092 | else: |
| 10093 | self.out_group = 0 |
| 10094 | if flags != None: |
| 10095 | self.flags = flags |
| 10096 | else: |
| 10097 | self.flags = 0 |
| 10098 | if match != None: |
| 10099 | self.match = match |
| 10100 | else: |
| 10101 | self.match = common.match() |
| 10102 | if instructions != None: |
| 10103 | self.instructions = instructions |
| 10104 | else: |
| 10105 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10106 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10107 | |
| 10108 | def pack(self): |
| 10109 | packed = [] |
| 10110 | packed.append(struct.pack("!B", self.version)) |
| 10111 | packed.append(struct.pack("!B", self.type)) |
| 10112 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10113 | packed.append(struct.pack("!L", self.xid)) |
| 10114 | packed.append(struct.pack("!Q", self.cookie)) |
| 10115 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 10116 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10117 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10118 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 10119 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 10120 | packed.append(struct.pack("!H", self.priority)) |
| 10121 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10122 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10123 | packed.append(struct.pack("!L", self.out_group)) |
| 10124 | packed.append(struct.pack("!H", self.flags)) |
| 10125 | packed.append('\x00' * 2) |
| 10126 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10127 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10128 | length = sum([len(x) for x in packed]) |
| 10129 | packed[2] = struct.pack("!H", length) |
| 10130 | return ''.join(packed) |
| 10131 | |
| 10132 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10133 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10134 | obj = flow_modify_strict() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10135 | _version = reader.read("!B")[0] |
| 10136 | assert(_version == 4) |
| 10137 | _type = reader.read("!B")[0] |
| 10138 | assert(_type == 14) |
| 10139 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10140 | orig_reader = reader |
| 10141 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10142 | obj.xid = reader.read("!L")[0] |
| 10143 | obj.cookie = reader.read("!Q")[0] |
| 10144 | obj.cookie_mask = reader.read("!Q")[0] |
| 10145 | obj.table_id = reader.read("!B")[0] |
| 10146 | __command = util.unpack_fm_cmd(reader) |
| 10147 | assert(__command == 2) |
| 10148 | obj.idle_timeout = reader.read("!H")[0] |
| 10149 | obj.hard_timeout = reader.read("!H")[0] |
| 10150 | obj.priority = reader.read("!H")[0] |
| 10151 | obj.buffer_id = reader.read("!L")[0] |
| 10152 | obj.out_port = util.unpack_port_no(reader) |
| 10153 | obj.out_group = reader.read("!L")[0] |
| 10154 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10155 | reader.skip(2) |
| 10156 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10157 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10158 | return obj |
| 10159 | |
| 10160 | def __eq__(self, other): |
| 10161 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10162 | if self.xid != other.xid: return False |
| 10163 | if self.cookie != other.cookie: return False |
| 10164 | if self.cookie_mask != other.cookie_mask: return False |
| 10165 | if self.table_id != other.table_id: return False |
| 10166 | if self.idle_timeout != other.idle_timeout: return False |
| 10167 | if self.hard_timeout != other.hard_timeout: return False |
| 10168 | if self.priority != other.priority: return False |
| 10169 | if self.buffer_id != other.buffer_id: return False |
| 10170 | if self.out_port != other.out_port: return False |
| 10171 | if self.out_group != other.out_group: return False |
| 10172 | if self.flags != other.flags: return False |
| 10173 | if self.match != other.match: return False |
| 10174 | if self.instructions != other.instructions: return False |
| 10175 | return True |
| 10176 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10177 | def pretty_print(self, q): |
| 10178 | q.text("flow_modify_strict {") |
| 10179 | with q.group(): |
| 10180 | with q.indent(2): |
| 10181 | q.breakable() |
| 10182 | q.text("xid = "); |
| 10183 | if self.xid != None: |
| 10184 | q.text("%#x" % self.xid) |
| 10185 | else: |
| 10186 | q.text('None') |
| 10187 | q.text(","); q.breakable() |
| 10188 | q.text("cookie = "); |
| 10189 | q.text("%#x" % self.cookie) |
| 10190 | q.text(","); q.breakable() |
| 10191 | q.text("cookie_mask = "); |
| 10192 | q.text("%#x" % self.cookie_mask) |
| 10193 | q.text(","); q.breakable() |
| 10194 | q.text("table_id = "); |
| 10195 | q.text("%#x" % self.table_id) |
| 10196 | q.text(","); q.breakable() |
| 10197 | q.text("idle_timeout = "); |
| 10198 | q.text("%#x" % self.idle_timeout) |
| 10199 | q.text(","); q.breakable() |
| 10200 | q.text("hard_timeout = "); |
| 10201 | q.text("%#x" % self.hard_timeout) |
| 10202 | q.text(","); q.breakable() |
| 10203 | q.text("priority = "); |
| 10204 | q.text("%#x" % self.priority) |
| 10205 | q.text(","); q.breakable() |
| 10206 | q.text("buffer_id = "); |
| 10207 | q.text("%#x" % self.buffer_id) |
| 10208 | q.text(","); q.breakable() |
| 10209 | q.text("out_port = "); |
| 10210 | q.text(util.pretty_port(self.out_port)) |
| 10211 | q.text(","); q.breakable() |
| 10212 | q.text("out_group = "); |
| 10213 | q.text("%#x" % self.out_group) |
| 10214 | q.text(","); q.breakable() |
| 10215 | q.text("flags = "); |
| 10216 | q.text("%#x" % self.flags) |
| 10217 | q.text(","); q.breakable() |
| 10218 | q.text("match = "); |
| 10219 | q.pp(self.match) |
| 10220 | q.text(","); q.breakable() |
| 10221 | q.text("instructions = "); |
| 10222 | q.pp(self.instructions) |
| 10223 | q.breakable() |
| 10224 | q.text('}') |
| 10225 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10226 | flow_mod.subtypes[2] = flow_modify_strict |
| 10227 | |
| 10228 | class flow_removed(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10229 | version = 4 |
| 10230 | type = 11 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10231 | |
| 10232 | 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] | 10233 | if xid != None: |
| 10234 | self.xid = xid |
| 10235 | else: |
| 10236 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10237 | if cookie != None: |
| 10238 | self.cookie = cookie |
| 10239 | else: |
| 10240 | self.cookie = 0 |
| 10241 | if priority != None: |
| 10242 | self.priority = priority |
| 10243 | else: |
| 10244 | self.priority = 0 |
| 10245 | if reason != None: |
| 10246 | self.reason = reason |
| 10247 | else: |
| 10248 | self.reason = 0 |
| 10249 | if table_id != None: |
| 10250 | self.table_id = table_id |
| 10251 | else: |
| 10252 | self.table_id = 0 |
| 10253 | if duration_sec != None: |
| 10254 | self.duration_sec = duration_sec |
| 10255 | else: |
| 10256 | self.duration_sec = 0 |
| 10257 | if duration_nsec != None: |
| 10258 | self.duration_nsec = duration_nsec |
| 10259 | else: |
| 10260 | self.duration_nsec = 0 |
| 10261 | if idle_timeout != None: |
| 10262 | self.idle_timeout = idle_timeout |
| 10263 | else: |
| 10264 | self.idle_timeout = 0 |
| 10265 | if hard_timeout != None: |
| 10266 | self.hard_timeout = hard_timeout |
| 10267 | else: |
| 10268 | self.hard_timeout = 0 |
| 10269 | if packet_count != None: |
| 10270 | self.packet_count = packet_count |
| 10271 | else: |
| 10272 | self.packet_count = 0 |
| 10273 | if byte_count != None: |
| 10274 | self.byte_count = byte_count |
| 10275 | else: |
| 10276 | self.byte_count = 0 |
| 10277 | if match != None: |
| 10278 | self.match = match |
| 10279 | else: |
| 10280 | self.match = common.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10281 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10282 | |
| 10283 | def pack(self): |
| 10284 | packed = [] |
| 10285 | packed.append(struct.pack("!B", self.version)) |
| 10286 | packed.append(struct.pack("!B", self.type)) |
| 10287 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10288 | packed.append(struct.pack("!L", self.xid)) |
| 10289 | packed.append(struct.pack("!Q", self.cookie)) |
| 10290 | packed.append(struct.pack("!H", self.priority)) |
| 10291 | packed.append(struct.pack("!B", self.reason)) |
| 10292 | packed.append(struct.pack("!B", self.table_id)) |
| 10293 | packed.append(struct.pack("!L", self.duration_sec)) |
| 10294 | packed.append(struct.pack("!L", self.duration_nsec)) |
| 10295 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 10296 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 10297 | packed.append(struct.pack("!Q", self.packet_count)) |
| 10298 | packed.append(struct.pack("!Q", self.byte_count)) |
| 10299 | packed.append(self.match.pack()) |
| 10300 | length = sum([len(x) for x in packed]) |
| 10301 | packed[2] = struct.pack("!H", length) |
| 10302 | return ''.join(packed) |
| 10303 | |
| 10304 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10305 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10306 | obj = flow_removed() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10307 | _version = reader.read("!B")[0] |
| 10308 | assert(_version == 4) |
| 10309 | _type = reader.read("!B")[0] |
| 10310 | assert(_type == 11) |
| 10311 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10312 | orig_reader = reader |
| 10313 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10314 | obj.xid = reader.read("!L")[0] |
| 10315 | obj.cookie = reader.read("!Q")[0] |
| 10316 | obj.priority = reader.read("!H")[0] |
| 10317 | obj.reason = reader.read("!B")[0] |
| 10318 | obj.table_id = reader.read("!B")[0] |
| 10319 | obj.duration_sec = reader.read("!L")[0] |
| 10320 | obj.duration_nsec = reader.read("!L")[0] |
| 10321 | obj.idle_timeout = reader.read("!H")[0] |
| 10322 | obj.hard_timeout = reader.read("!H")[0] |
| 10323 | obj.packet_count = reader.read("!Q")[0] |
| 10324 | obj.byte_count = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10325 | obj.match = common.match.unpack(reader) |
| 10326 | return obj |
| 10327 | |
| 10328 | def __eq__(self, other): |
| 10329 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10330 | if self.xid != other.xid: return False |
| 10331 | if self.cookie != other.cookie: return False |
| 10332 | if self.priority != other.priority: return False |
| 10333 | if self.reason != other.reason: return False |
| 10334 | if self.table_id != other.table_id: return False |
| 10335 | if self.duration_sec != other.duration_sec: return False |
| 10336 | if self.duration_nsec != other.duration_nsec: return False |
| 10337 | if self.idle_timeout != other.idle_timeout: return False |
| 10338 | if self.hard_timeout != other.hard_timeout: return False |
| 10339 | if self.packet_count != other.packet_count: return False |
| 10340 | if self.byte_count != other.byte_count: return False |
| 10341 | if self.match != other.match: return False |
| 10342 | return True |
| 10343 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10344 | def pretty_print(self, q): |
| 10345 | q.text("flow_removed {") |
| 10346 | with q.group(): |
| 10347 | with q.indent(2): |
| 10348 | q.breakable() |
| 10349 | q.text("xid = "); |
| 10350 | if self.xid != None: |
| 10351 | q.text("%#x" % self.xid) |
| 10352 | else: |
| 10353 | q.text('None') |
| 10354 | q.text(","); q.breakable() |
| 10355 | q.text("cookie = "); |
| 10356 | q.text("%#x" % self.cookie) |
| 10357 | q.text(","); q.breakable() |
| 10358 | q.text("priority = "); |
| 10359 | q.text("%#x" % self.priority) |
| 10360 | q.text(","); q.breakable() |
| 10361 | q.text("reason = "); |
| 10362 | q.text("%#x" % self.reason) |
| 10363 | q.text(","); q.breakable() |
| 10364 | q.text("table_id = "); |
| 10365 | q.text("%#x" % self.table_id) |
| 10366 | q.text(","); q.breakable() |
| 10367 | q.text("duration_sec = "); |
| 10368 | q.text("%#x" % self.duration_sec) |
| 10369 | q.text(","); q.breakable() |
| 10370 | q.text("duration_nsec = "); |
| 10371 | q.text("%#x" % self.duration_nsec) |
| 10372 | q.text(","); q.breakable() |
| 10373 | q.text("idle_timeout = "); |
| 10374 | q.text("%#x" % self.idle_timeout) |
| 10375 | q.text(","); q.breakable() |
| 10376 | q.text("hard_timeout = "); |
| 10377 | q.text("%#x" % self.hard_timeout) |
| 10378 | q.text(","); q.breakable() |
| 10379 | q.text("packet_count = "); |
| 10380 | q.text("%#x" % self.packet_count) |
| 10381 | q.text(","); q.breakable() |
| 10382 | q.text("byte_count = "); |
| 10383 | q.text("%#x" % self.byte_count) |
| 10384 | q.text(","); q.breakable() |
| 10385 | q.text("match = "); |
| 10386 | q.pp(self.match) |
| 10387 | q.breakable() |
| 10388 | q.text('}') |
| 10389 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10390 | message.subtypes[11] = flow_removed |
| 10391 | |
| 10392 | class flow_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10393 | version = 4 |
| 10394 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10395 | stats_type = 1 |
| 10396 | |
| 10397 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10398 | if xid != None: |
| 10399 | self.xid = xid |
| 10400 | else: |
| 10401 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10402 | if flags != None: |
| 10403 | self.flags = flags |
| 10404 | else: |
| 10405 | self.flags = 0 |
| 10406 | if entries != None: |
| 10407 | self.entries = entries |
| 10408 | else: |
| 10409 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10410 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10411 | |
| 10412 | def pack(self): |
| 10413 | packed = [] |
| 10414 | packed.append(struct.pack("!B", self.version)) |
| 10415 | packed.append(struct.pack("!B", self.type)) |
| 10416 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10417 | packed.append(struct.pack("!L", self.xid)) |
| 10418 | packed.append(struct.pack("!H", self.stats_type)) |
| 10419 | packed.append(struct.pack("!H", self.flags)) |
| 10420 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10421 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10422 | length = sum([len(x) for x in packed]) |
| 10423 | packed[2] = struct.pack("!H", length) |
| 10424 | return ''.join(packed) |
| 10425 | |
| 10426 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10427 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10428 | obj = flow_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10429 | _version = reader.read("!B")[0] |
| 10430 | assert(_version == 4) |
| 10431 | _type = reader.read("!B")[0] |
| 10432 | assert(_type == 19) |
| 10433 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10434 | orig_reader = reader |
| 10435 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10436 | obj.xid = reader.read("!L")[0] |
| 10437 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10438 | assert(_stats_type == 1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10439 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10440 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10441 | 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] | 10442 | return obj |
| 10443 | |
| 10444 | def __eq__(self, other): |
| 10445 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10446 | if self.xid != other.xid: return False |
| 10447 | if self.flags != other.flags: return False |
| 10448 | if self.entries != other.entries: return False |
| 10449 | return True |
| 10450 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10451 | def pretty_print(self, q): |
| 10452 | q.text("flow_stats_reply {") |
| 10453 | with q.group(): |
| 10454 | with q.indent(2): |
| 10455 | q.breakable() |
| 10456 | q.text("xid = "); |
| 10457 | if self.xid != None: |
| 10458 | q.text("%#x" % self.xid) |
| 10459 | else: |
| 10460 | q.text('None') |
| 10461 | q.text(","); q.breakable() |
| 10462 | q.text("flags = "); |
| 10463 | q.text("%#x" % self.flags) |
| 10464 | q.text(","); q.breakable() |
| 10465 | q.text("entries = "); |
| 10466 | q.pp(self.entries) |
| 10467 | q.breakable() |
| 10468 | q.text('}') |
| 10469 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10470 | stats_reply.subtypes[1] = flow_stats_reply |
| 10471 | |
| 10472 | class flow_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10473 | version = 4 |
| 10474 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10475 | stats_type = 1 |
| 10476 | |
| 10477 | 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] | 10478 | if xid != None: |
| 10479 | self.xid = xid |
| 10480 | else: |
| 10481 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10482 | if flags != None: |
| 10483 | self.flags = flags |
| 10484 | else: |
| 10485 | self.flags = 0 |
| 10486 | if table_id != None: |
| 10487 | self.table_id = table_id |
| 10488 | else: |
| 10489 | self.table_id = 0 |
| 10490 | if out_port != None: |
| 10491 | self.out_port = out_port |
| 10492 | else: |
| 10493 | self.out_port = 0 |
| 10494 | if out_group != None: |
| 10495 | self.out_group = out_group |
| 10496 | else: |
| 10497 | self.out_group = 0 |
| 10498 | if cookie != None: |
| 10499 | self.cookie = cookie |
| 10500 | else: |
| 10501 | self.cookie = 0 |
| 10502 | if cookie_mask != None: |
| 10503 | self.cookie_mask = cookie_mask |
| 10504 | else: |
| 10505 | self.cookie_mask = 0 |
| 10506 | if match != None: |
| 10507 | self.match = match |
| 10508 | else: |
| 10509 | self.match = common.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10510 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10511 | |
| 10512 | def pack(self): |
| 10513 | packed = [] |
| 10514 | packed.append(struct.pack("!B", self.version)) |
| 10515 | packed.append(struct.pack("!B", self.type)) |
| 10516 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10517 | packed.append(struct.pack("!L", self.xid)) |
| 10518 | packed.append(struct.pack("!H", self.stats_type)) |
| 10519 | packed.append(struct.pack("!H", self.flags)) |
| 10520 | packed.append('\x00' * 4) |
| 10521 | packed.append(struct.pack("!B", self.table_id)) |
| 10522 | packed.append('\x00' * 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10523 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10524 | packed.append(struct.pack("!L", self.out_group)) |
| 10525 | packed.append('\x00' * 4) |
| 10526 | packed.append(struct.pack("!Q", self.cookie)) |
| 10527 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 10528 | packed.append(self.match.pack()) |
| 10529 | length = sum([len(x) for x in packed]) |
| 10530 | packed[2] = struct.pack("!H", length) |
| 10531 | return ''.join(packed) |
| 10532 | |
| 10533 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10534 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10535 | obj = flow_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10536 | _version = reader.read("!B")[0] |
| 10537 | assert(_version == 4) |
| 10538 | _type = reader.read("!B")[0] |
| 10539 | assert(_type == 18) |
| 10540 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10541 | orig_reader = reader |
| 10542 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10543 | obj.xid = reader.read("!L")[0] |
| 10544 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10545 | assert(_stats_type == 1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10546 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10547 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10548 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10549 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10550 | obj.out_port = util.unpack_port_no(reader) |
| 10551 | obj.out_group = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10552 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10553 | obj.cookie = reader.read("!Q")[0] |
| 10554 | obj.cookie_mask = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10555 | obj.match = common.match.unpack(reader) |
| 10556 | return obj |
| 10557 | |
| 10558 | def __eq__(self, other): |
| 10559 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10560 | if self.xid != other.xid: return False |
| 10561 | if self.flags != other.flags: return False |
| 10562 | if self.table_id != other.table_id: return False |
| 10563 | if self.out_port != other.out_port: return False |
| 10564 | if self.out_group != other.out_group: return False |
| 10565 | if self.cookie != other.cookie: return False |
| 10566 | if self.cookie_mask != other.cookie_mask: return False |
| 10567 | if self.match != other.match: return False |
| 10568 | return True |
| 10569 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10570 | def pretty_print(self, q): |
| 10571 | q.text("flow_stats_request {") |
| 10572 | with q.group(): |
| 10573 | with q.indent(2): |
| 10574 | q.breakable() |
| 10575 | q.text("xid = "); |
| 10576 | if self.xid != None: |
| 10577 | q.text("%#x" % self.xid) |
| 10578 | else: |
| 10579 | q.text('None') |
| 10580 | q.text(","); q.breakable() |
| 10581 | q.text("flags = "); |
| 10582 | q.text("%#x" % self.flags) |
| 10583 | q.text(","); q.breakable() |
| 10584 | q.text("table_id = "); |
| 10585 | q.text("%#x" % self.table_id) |
| 10586 | q.text(","); q.breakable() |
| 10587 | q.text("out_port = "); |
| 10588 | q.text(util.pretty_port(self.out_port)) |
| 10589 | q.text(","); q.breakable() |
| 10590 | q.text("out_group = "); |
| 10591 | q.text("%#x" % self.out_group) |
| 10592 | q.text(","); q.breakable() |
| 10593 | q.text("cookie = "); |
| 10594 | q.text("%#x" % self.cookie) |
| 10595 | q.text(","); q.breakable() |
| 10596 | q.text("cookie_mask = "); |
| 10597 | q.text("%#x" % self.cookie_mask) |
| 10598 | q.text(","); q.breakable() |
| 10599 | q.text("match = "); |
| 10600 | q.pp(self.match) |
| 10601 | q.breakable() |
| 10602 | q.text('}') |
| 10603 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10604 | stats_request.subtypes[1] = flow_stats_request |
| 10605 | |
| 10606 | class get_config_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10607 | version = 4 |
| 10608 | type = 8 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10609 | |
| 10610 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10611 | if xid != None: |
| 10612 | self.xid = xid |
| 10613 | else: |
| 10614 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10615 | if flags != None: |
| 10616 | self.flags = flags |
| 10617 | else: |
| 10618 | self.flags = 0 |
| 10619 | if miss_send_len != None: |
| 10620 | self.miss_send_len = miss_send_len |
| 10621 | else: |
| 10622 | self.miss_send_len = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10623 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10624 | |
| 10625 | def pack(self): |
| 10626 | packed = [] |
| 10627 | packed.append(struct.pack("!B", self.version)) |
| 10628 | packed.append(struct.pack("!B", self.type)) |
| 10629 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10630 | packed.append(struct.pack("!L", self.xid)) |
| 10631 | packed.append(struct.pack("!H", self.flags)) |
| 10632 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 10633 | length = sum([len(x) for x in packed]) |
| 10634 | packed[2] = struct.pack("!H", length) |
| 10635 | return ''.join(packed) |
| 10636 | |
| 10637 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10638 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10639 | obj = get_config_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10640 | _version = reader.read("!B")[0] |
| 10641 | assert(_version == 4) |
| 10642 | _type = reader.read("!B")[0] |
| 10643 | assert(_type == 8) |
| 10644 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10645 | orig_reader = reader |
| 10646 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10647 | obj.xid = reader.read("!L")[0] |
| 10648 | obj.flags = reader.read("!H")[0] |
| 10649 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10650 | return obj |
| 10651 | |
| 10652 | def __eq__(self, other): |
| 10653 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10654 | if self.xid != other.xid: return False |
| 10655 | if self.flags != other.flags: return False |
| 10656 | if self.miss_send_len != other.miss_send_len: return False |
| 10657 | return True |
| 10658 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10659 | def pretty_print(self, q): |
| 10660 | q.text("get_config_reply {") |
| 10661 | with q.group(): |
| 10662 | with q.indent(2): |
| 10663 | q.breakable() |
| 10664 | q.text("xid = "); |
| 10665 | if self.xid != None: |
| 10666 | q.text("%#x" % self.xid) |
| 10667 | else: |
| 10668 | q.text('None') |
| 10669 | q.text(","); q.breakable() |
| 10670 | q.text("flags = "); |
| 10671 | q.text("%#x" % self.flags) |
| 10672 | q.text(","); q.breakable() |
| 10673 | q.text("miss_send_len = "); |
| 10674 | q.text("%#x" % self.miss_send_len) |
| 10675 | q.breakable() |
| 10676 | q.text('}') |
| 10677 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10678 | message.subtypes[8] = get_config_reply |
| 10679 | |
| 10680 | class get_config_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10681 | version = 4 |
| 10682 | type = 7 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10683 | |
| 10684 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10685 | if xid != None: |
| 10686 | self.xid = xid |
| 10687 | else: |
| 10688 | self.xid = None |
| 10689 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10690 | |
| 10691 | def pack(self): |
| 10692 | packed = [] |
| 10693 | packed.append(struct.pack("!B", self.version)) |
| 10694 | packed.append(struct.pack("!B", self.type)) |
| 10695 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10696 | packed.append(struct.pack("!L", self.xid)) |
| 10697 | length = sum([len(x) for x in packed]) |
| 10698 | packed[2] = struct.pack("!H", length) |
| 10699 | return ''.join(packed) |
| 10700 | |
| 10701 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10702 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10703 | obj = get_config_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10704 | _version = reader.read("!B")[0] |
| 10705 | assert(_version == 4) |
| 10706 | _type = reader.read("!B")[0] |
| 10707 | assert(_type == 7) |
| 10708 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10709 | orig_reader = reader |
| 10710 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10711 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10712 | return obj |
| 10713 | |
| 10714 | def __eq__(self, other): |
| 10715 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10716 | if self.xid != other.xid: return False |
| 10717 | return True |
| 10718 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10719 | def pretty_print(self, q): |
| 10720 | q.text("get_config_request {") |
| 10721 | with q.group(): |
| 10722 | with q.indent(2): |
| 10723 | q.breakable() |
| 10724 | q.text("xid = "); |
| 10725 | if self.xid != None: |
| 10726 | q.text("%#x" % self.xid) |
| 10727 | else: |
| 10728 | q.text('None') |
| 10729 | q.breakable() |
| 10730 | q.text('}') |
| 10731 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10732 | message.subtypes[7] = get_config_request |
| 10733 | |
| 10734 | class group_mod(message): |
| 10735 | subtypes = {} |
| 10736 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 10737 | version = 4 |
| 10738 | type = 15 |
| 10739 | |
| 10740 | def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None): |
| 10741 | if xid != None: |
| 10742 | self.xid = xid |
| 10743 | else: |
| 10744 | self.xid = None |
| 10745 | if command != None: |
| 10746 | self.command = command |
| 10747 | else: |
| 10748 | self.command = 0 |
| 10749 | if group_type != None: |
| 10750 | self.group_type = group_type |
| 10751 | else: |
| 10752 | self.group_type = 0 |
| 10753 | if group_id != None: |
| 10754 | self.group_id = group_id |
| 10755 | else: |
| 10756 | self.group_id = 0 |
| 10757 | if buckets != None: |
| 10758 | self.buckets = buckets |
| 10759 | else: |
| 10760 | self.buckets = [] |
| 10761 | return |
| 10762 | |
| 10763 | def pack(self): |
| 10764 | packed = [] |
| 10765 | packed.append(struct.pack("!B", self.version)) |
| 10766 | packed.append(struct.pack("!B", self.type)) |
| 10767 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10768 | packed.append(struct.pack("!L", self.xid)) |
| 10769 | packed.append(struct.pack("!H", self.command)) |
| 10770 | packed.append(struct.pack("!B", self.group_type)) |
| 10771 | packed.append('\x00' * 1) |
| 10772 | packed.append(struct.pack("!L", self.group_id)) |
| 10773 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
| 10774 | length = sum([len(x) for x in packed]) |
| 10775 | packed[2] = struct.pack("!H", length) |
| 10776 | return ''.join(packed) |
| 10777 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10778 | @staticmethod |
| 10779 | def unpack(reader): |
| 10780 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 10781 | subclass = group_mod.subtypes.get(subtype) |
| 10782 | if subclass: |
| 10783 | return subclass.unpack(reader) |
| 10784 | |
| 10785 | obj = group_mod() |
| 10786 | _version = reader.read("!B")[0] |
| 10787 | assert(_version == 4) |
| 10788 | _type = reader.read("!B")[0] |
| 10789 | assert(_type == 15) |
| 10790 | _length = reader.read("!H")[0] |
| 10791 | orig_reader = reader |
| 10792 | reader = orig_reader.slice(_length - (2 + 2)) |
| 10793 | obj.xid = reader.read("!L")[0] |
| 10794 | obj.command = reader.read("!H")[0] |
| 10795 | obj.group_type = reader.read("!B")[0] |
| 10796 | reader.skip(1) |
| 10797 | obj.group_id = reader.read("!L")[0] |
| 10798 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
| 10799 | return obj |
| 10800 | |
| 10801 | def __eq__(self, other): |
| 10802 | if type(self) != type(other): return False |
| 10803 | if self.xid != other.xid: return False |
| 10804 | if self.command != other.command: return False |
| 10805 | if self.group_type != other.group_type: return False |
| 10806 | if self.group_id != other.group_id: return False |
| 10807 | if self.buckets != other.buckets: return False |
| 10808 | return True |
| 10809 | |
| 10810 | def pretty_print(self, q): |
| 10811 | q.text("group_mod {") |
| 10812 | with q.group(): |
| 10813 | with q.indent(2): |
| 10814 | q.breakable() |
| 10815 | q.text("xid = "); |
| 10816 | if self.xid != None: |
| 10817 | q.text("%#x" % self.xid) |
| 10818 | else: |
| 10819 | q.text('None') |
| 10820 | q.text(","); q.breakable() |
| 10821 | q.text("group_type = "); |
| 10822 | q.text("%#x" % self.group_type) |
| 10823 | q.text(","); q.breakable() |
| 10824 | q.text("group_id = "); |
| 10825 | q.text("%#x" % self.group_id) |
| 10826 | q.text(","); q.breakable() |
| 10827 | q.text("buckets = "); |
| 10828 | q.pp(self.buckets) |
| 10829 | q.breakable() |
| 10830 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10831 | |
| 10832 | message.subtypes[15] = group_mod |
| 10833 | |
| 10834 | class group_add(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10835 | version = 4 |
| 10836 | type = 15 |
| 10837 | command = 0 |
| 10838 | |
| 10839 | 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] | 10840 | if xid != None: |
| 10841 | self.xid = xid |
| 10842 | else: |
| 10843 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10844 | if group_type != None: |
| 10845 | self.group_type = group_type |
| 10846 | else: |
| 10847 | self.group_type = 0 |
| 10848 | if group_id != None: |
| 10849 | self.group_id = group_id |
| 10850 | else: |
| 10851 | self.group_id = 0 |
| 10852 | if buckets != None: |
| 10853 | self.buckets = buckets |
| 10854 | else: |
| 10855 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10856 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10857 | |
| 10858 | def pack(self): |
| 10859 | packed = [] |
| 10860 | packed.append(struct.pack("!B", self.version)) |
| 10861 | packed.append(struct.pack("!B", self.type)) |
| 10862 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10863 | packed.append(struct.pack("!L", self.xid)) |
| 10864 | packed.append(struct.pack("!H", self.command)) |
| 10865 | packed.append(struct.pack("!B", self.group_type)) |
| 10866 | packed.append('\x00' * 1) |
| 10867 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10868 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10869 | length = sum([len(x) for x in packed]) |
| 10870 | packed[2] = struct.pack("!H", length) |
| 10871 | return ''.join(packed) |
| 10872 | |
| 10873 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10874 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10875 | obj = group_add() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10876 | _version = reader.read("!B")[0] |
| 10877 | assert(_version == 4) |
| 10878 | _type = reader.read("!B")[0] |
| 10879 | assert(_type == 15) |
| 10880 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10881 | orig_reader = reader |
| 10882 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10883 | obj.xid = reader.read("!L")[0] |
| 10884 | _command = reader.read("!H")[0] |
| 10885 | assert(_command == 0) |
| 10886 | obj.group_type = reader.read("!B")[0] |
| 10887 | reader.skip(1) |
| 10888 | obj.group_id = reader.read("!L")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10889 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10890 | return obj |
| 10891 | |
| 10892 | def __eq__(self, other): |
| 10893 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10894 | if self.xid != other.xid: return False |
| 10895 | if self.group_type != other.group_type: return False |
| 10896 | if self.group_id != other.group_id: return False |
| 10897 | if self.buckets != other.buckets: return False |
| 10898 | return True |
| 10899 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10900 | def pretty_print(self, q): |
| 10901 | q.text("group_add {") |
| 10902 | with q.group(): |
| 10903 | with q.indent(2): |
| 10904 | q.breakable() |
| 10905 | q.text("xid = "); |
| 10906 | if self.xid != None: |
| 10907 | q.text("%#x" % self.xid) |
| 10908 | else: |
| 10909 | q.text('None') |
| 10910 | q.text(","); q.breakable() |
| 10911 | q.text("group_type = "); |
| 10912 | q.text("%#x" % self.group_type) |
| 10913 | q.text(","); q.breakable() |
| 10914 | q.text("group_id = "); |
| 10915 | q.text("%#x" % self.group_id) |
| 10916 | q.text(","); q.breakable() |
| 10917 | q.text("buckets = "); |
| 10918 | q.pp(self.buckets) |
| 10919 | q.breakable() |
| 10920 | q.text('}') |
| 10921 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10922 | group_mod.subtypes[0] = group_add |
| 10923 | |
| 10924 | class group_delete(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10925 | version = 4 |
| 10926 | type = 15 |
| 10927 | command = 2 |
| 10928 | |
| 10929 | 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] | 10930 | if xid != None: |
| 10931 | self.xid = xid |
| 10932 | else: |
| 10933 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10934 | if group_type != None: |
| 10935 | self.group_type = group_type |
| 10936 | else: |
| 10937 | self.group_type = 0 |
| 10938 | if group_id != None: |
| 10939 | self.group_id = group_id |
| 10940 | else: |
| 10941 | self.group_id = 0 |
| 10942 | if buckets != None: |
| 10943 | self.buckets = buckets |
| 10944 | else: |
| 10945 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10946 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10947 | |
| 10948 | def pack(self): |
| 10949 | packed = [] |
| 10950 | packed.append(struct.pack("!B", self.version)) |
| 10951 | packed.append(struct.pack("!B", self.type)) |
| 10952 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10953 | packed.append(struct.pack("!L", self.xid)) |
| 10954 | packed.append(struct.pack("!H", self.command)) |
| 10955 | packed.append(struct.pack("!B", self.group_type)) |
| 10956 | packed.append('\x00' * 1) |
| 10957 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10958 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10959 | length = sum([len(x) for x in packed]) |
| 10960 | packed[2] = struct.pack("!H", length) |
| 10961 | return ''.join(packed) |
| 10962 | |
| 10963 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10964 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10965 | obj = group_delete() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10966 | _version = reader.read("!B")[0] |
| 10967 | assert(_version == 4) |
| 10968 | _type = reader.read("!B")[0] |
| 10969 | assert(_type == 15) |
| 10970 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10971 | orig_reader = reader |
| 10972 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10973 | obj.xid = reader.read("!L")[0] |
| 10974 | _command = reader.read("!H")[0] |
| 10975 | assert(_command == 2) |
| 10976 | obj.group_type = reader.read("!B")[0] |
| 10977 | reader.skip(1) |
| 10978 | obj.group_id = reader.read("!L")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10979 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10980 | return obj |
| 10981 | |
| 10982 | def __eq__(self, other): |
| 10983 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10984 | if self.xid != other.xid: return False |
| 10985 | if self.group_type != other.group_type: return False |
| 10986 | if self.group_id != other.group_id: return False |
| 10987 | if self.buckets != other.buckets: return False |
| 10988 | return True |
| 10989 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 10990 | def pretty_print(self, q): |
| 10991 | q.text("group_delete {") |
| 10992 | with q.group(): |
| 10993 | with q.indent(2): |
| 10994 | q.breakable() |
| 10995 | q.text("xid = "); |
| 10996 | if self.xid != None: |
| 10997 | q.text("%#x" % self.xid) |
| 10998 | else: |
| 10999 | q.text('None') |
| 11000 | q.text(","); q.breakable() |
| 11001 | q.text("group_type = "); |
| 11002 | q.text("%#x" % self.group_type) |
| 11003 | q.text(","); q.breakable() |
| 11004 | q.text("group_id = "); |
| 11005 | q.text("%#x" % self.group_id) |
| 11006 | q.text(","); q.breakable() |
| 11007 | q.text("buckets = "); |
| 11008 | q.pp(self.buckets) |
| 11009 | q.breakable() |
| 11010 | q.text('}') |
| 11011 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11012 | group_mod.subtypes[2] = group_delete |
| 11013 | |
| 11014 | class group_desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11015 | version = 4 |
| 11016 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11017 | stats_type = 7 |
| 11018 | |
| 11019 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11020 | if xid != None: |
| 11021 | self.xid = xid |
| 11022 | else: |
| 11023 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11024 | if flags != None: |
| 11025 | self.flags = flags |
| 11026 | else: |
| 11027 | self.flags = 0 |
| 11028 | if entries != None: |
| 11029 | self.entries = entries |
| 11030 | else: |
| 11031 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11032 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11033 | |
| 11034 | def pack(self): |
| 11035 | packed = [] |
| 11036 | packed.append(struct.pack("!B", self.version)) |
| 11037 | packed.append(struct.pack("!B", self.type)) |
| 11038 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11039 | packed.append(struct.pack("!L", self.xid)) |
| 11040 | packed.append(struct.pack("!H", self.stats_type)) |
| 11041 | packed.append(struct.pack("!H", self.flags)) |
| 11042 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11043 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11044 | length = sum([len(x) for x in packed]) |
| 11045 | packed[2] = struct.pack("!H", length) |
| 11046 | return ''.join(packed) |
| 11047 | |
| 11048 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11049 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11050 | obj = group_desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11051 | _version = reader.read("!B")[0] |
| 11052 | assert(_version == 4) |
| 11053 | _type = reader.read("!B")[0] |
| 11054 | assert(_type == 19) |
| 11055 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11056 | orig_reader = reader |
| 11057 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11058 | obj.xid = reader.read("!L")[0] |
| 11059 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11060 | assert(_stats_type == 7) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11061 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11062 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11063 | 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] | 11064 | return obj |
| 11065 | |
| 11066 | def __eq__(self, other): |
| 11067 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11068 | if self.xid != other.xid: return False |
| 11069 | if self.flags != other.flags: return False |
| 11070 | if self.entries != other.entries: return False |
| 11071 | return True |
| 11072 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11073 | def pretty_print(self, q): |
| 11074 | q.text("group_desc_stats_reply {") |
| 11075 | with q.group(): |
| 11076 | with q.indent(2): |
| 11077 | q.breakable() |
| 11078 | q.text("xid = "); |
| 11079 | if self.xid != None: |
| 11080 | q.text("%#x" % self.xid) |
| 11081 | else: |
| 11082 | q.text('None') |
| 11083 | q.text(","); q.breakable() |
| 11084 | q.text("flags = "); |
| 11085 | q.text("%#x" % self.flags) |
| 11086 | q.text(","); q.breakable() |
| 11087 | q.text("entries = "); |
| 11088 | q.pp(self.entries) |
| 11089 | q.breakable() |
| 11090 | q.text('}') |
| 11091 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11092 | stats_reply.subtypes[7] = group_desc_stats_reply |
| 11093 | |
| 11094 | class group_desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11095 | version = 4 |
| 11096 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11097 | stats_type = 7 |
| 11098 | |
| 11099 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11100 | if xid != None: |
| 11101 | self.xid = xid |
| 11102 | else: |
| 11103 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11104 | if flags != None: |
| 11105 | self.flags = flags |
| 11106 | else: |
| 11107 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11108 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11109 | |
| 11110 | def pack(self): |
| 11111 | packed = [] |
| 11112 | packed.append(struct.pack("!B", self.version)) |
| 11113 | packed.append(struct.pack("!B", self.type)) |
| 11114 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11115 | packed.append(struct.pack("!L", self.xid)) |
| 11116 | packed.append(struct.pack("!H", self.stats_type)) |
| 11117 | packed.append(struct.pack("!H", self.flags)) |
| 11118 | packed.append('\x00' * 4) |
| 11119 | length = sum([len(x) for x in packed]) |
| 11120 | packed[2] = struct.pack("!H", length) |
| 11121 | return ''.join(packed) |
| 11122 | |
| 11123 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11124 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11125 | obj = group_desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11126 | _version = reader.read("!B")[0] |
| 11127 | assert(_version == 4) |
| 11128 | _type = reader.read("!B")[0] |
| 11129 | assert(_type == 18) |
| 11130 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11131 | orig_reader = reader |
| 11132 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11133 | obj.xid = reader.read("!L")[0] |
| 11134 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11135 | assert(_stats_type == 7) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11136 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11137 | reader.skip(4) |
| 11138 | return obj |
| 11139 | |
| 11140 | def __eq__(self, other): |
| 11141 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11142 | if self.xid != other.xid: return False |
| 11143 | if self.flags != other.flags: return False |
| 11144 | return True |
| 11145 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11146 | def pretty_print(self, q): |
| 11147 | q.text("group_desc_stats_request {") |
| 11148 | with q.group(): |
| 11149 | with q.indent(2): |
| 11150 | q.breakable() |
| 11151 | q.text("xid = "); |
| 11152 | if self.xid != None: |
| 11153 | q.text("%#x" % self.xid) |
| 11154 | else: |
| 11155 | q.text('None') |
| 11156 | q.text(","); q.breakable() |
| 11157 | q.text("flags = "); |
| 11158 | q.text("%#x" % self.flags) |
| 11159 | q.breakable() |
| 11160 | q.text('}') |
| 11161 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11162 | stats_request.subtypes[7] = group_desc_stats_request |
| 11163 | |
| 11164 | class group_features_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11165 | version = 4 |
| 11166 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11167 | stats_type = 8 |
| 11168 | |
| 11169 | 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] | 11170 | if xid != None: |
| 11171 | self.xid = xid |
| 11172 | else: |
| 11173 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11174 | if flags != None: |
| 11175 | self.flags = flags |
| 11176 | else: |
| 11177 | self.flags = 0 |
| 11178 | if types != None: |
| 11179 | self.types = types |
| 11180 | else: |
| 11181 | self.types = 0 |
| 11182 | if capabilities != None: |
| 11183 | self.capabilities = capabilities |
| 11184 | else: |
| 11185 | self.capabilities = 0 |
| 11186 | if max_groups_all != None: |
| 11187 | self.max_groups_all = max_groups_all |
| 11188 | else: |
| 11189 | self.max_groups_all = 0 |
| 11190 | if max_groups_select != None: |
| 11191 | self.max_groups_select = max_groups_select |
| 11192 | else: |
| 11193 | self.max_groups_select = 0 |
| 11194 | if max_groups_indirect != None: |
| 11195 | self.max_groups_indirect = max_groups_indirect |
| 11196 | else: |
| 11197 | self.max_groups_indirect = 0 |
| 11198 | if max_groups_ff != None: |
| 11199 | self.max_groups_ff = max_groups_ff |
| 11200 | else: |
| 11201 | self.max_groups_ff = 0 |
| 11202 | if actions_all != None: |
| 11203 | self.actions_all = actions_all |
| 11204 | else: |
| 11205 | self.actions_all = 0 |
| 11206 | if actions_select != None: |
| 11207 | self.actions_select = actions_select |
| 11208 | else: |
| 11209 | self.actions_select = 0 |
| 11210 | if actions_indirect != None: |
| 11211 | self.actions_indirect = actions_indirect |
| 11212 | else: |
| 11213 | self.actions_indirect = 0 |
| 11214 | if actions_ff != None: |
| 11215 | self.actions_ff = actions_ff |
| 11216 | else: |
| 11217 | self.actions_ff = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11218 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11219 | |
| 11220 | def pack(self): |
| 11221 | packed = [] |
| 11222 | packed.append(struct.pack("!B", self.version)) |
| 11223 | packed.append(struct.pack("!B", self.type)) |
| 11224 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11225 | packed.append(struct.pack("!L", self.xid)) |
| 11226 | packed.append(struct.pack("!H", self.stats_type)) |
| 11227 | packed.append(struct.pack("!H", self.flags)) |
| 11228 | packed.append('\x00' * 4) |
| 11229 | packed.append(struct.pack("!L", self.types)) |
| 11230 | packed.append(struct.pack("!L", self.capabilities)) |
| 11231 | packed.append(struct.pack("!L", self.max_groups_all)) |
| 11232 | packed.append(struct.pack("!L", self.max_groups_select)) |
| 11233 | packed.append(struct.pack("!L", self.max_groups_indirect)) |
| 11234 | packed.append(struct.pack("!L", self.max_groups_ff)) |
| 11235 | packed.append(struct.pack("!L", self.actions_all)) |
| 11236 | packed.append(struct.pack("!L", self.actions_select)) |
| 11237 | packed.append(struct.pack("!L", self.actions_indirect)) |
| 11238 | packed.append(struct.pack("!L", self.actions_ff)) |
| 11239 | length = sum([len(x) for x in packed]) |
| 11240 | packed[2] = struct.pack("!H", length) |
| 11241 | return ''.join(packed) |
| 11242 | |
| 11243 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11244 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11245 | obj = group_features_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11246 | _version = reader.read("!B")[0] |
| 11247 | assert(_version == 4) |
| 11248 | _type = reader.read("!B")[0] |
| 11249 | assert(_type == 19) |
| 11250 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11251 | orig_reader = reader |
| 11252 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11253 | obj.xid = reader.read("!L")[0] |
| 11254 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11255 | assert(_stats_type == 8) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11256 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11257 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11258 | obj.types = reader.read("!L")[0] |
| 11259 | obj.capabilities = reader.read("!L")[0] |
| 11260 | obj.max_groups_all = reader.read("!L")[0] |
| 11261 | obj.max_groups_select = reader.read("!L")[0] |
| 11262 | obj.max_groups_indirect = reader.read("!L")[0] |
| 11263 | obj.max_groups_ff = reader.read("!L")[0] |
| 11264 | obj.actions_all = reader.read("!L")[0] |
| 11265 | obj.actions_select = reader.read("!L")[0] |
| 11266 | obj.actions_indirect = reader.read("!L")[0] |
| 11267 | obj.actions_ff = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11268 | return obj |
| 11269 | |
| 11270 | def __eq__(self, other): |
| 11271 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11272 | if self.xid != other.xid: return False |
| 11273 | if self.flags != other.flags: return False |
| 11274 | if self.types != other.types: return False |
| 11275 | if self.capabilities != other.capabilities: return False |
| 11276 | if self.max_groups_all != other.max_groups_all: return False |
| 11277 | if self.max_groups_select != other.max_groups_select: return False |
| 11278 | if self.max_groups_indirect != other.max_groups_indirect: return False |
| 11279 | if self.max_groups_ff != other.max_groups_ff: return False |
| 11280 | if self.actions_all != other.actions_all: return False |
| 11281 | if self.actions_select != other.actions_select: return False |
| 11282 | if self.actions_indirect != other.actions_indirect: return False |
| 11283 | if self.actions_ff != other.actions_ff: return False |
| 11284 | return True |
| 11285 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11286 | def pretty_print(self, q): |
| 11287 | q.text("group_features_stats_reply {") |
| 11288 | with q.group(): |
| 11289 | with q.indent(2): |
| 11290 | q.breakable() |
| 11291 | q.text("xid = "); |
| 11292 | if self.xid != None: |
| 11293 | q.text("%#x" % self.xid) |
| 11294 | else: |
| 11295 | q.text('None') |
| 11296 | q.text(","); q.breakable() |
| 11297 | q.text("flags = "); |
| 11298 | q.text("%#x" % self.flags) |
| 11299 | q.text(","); q.breakable() |
| 11300 | q.text("types = "); |
| 11301 | q.text("%#x" % self.types) |
| 11302 | q.text(","); q.breakable() |
| 11303 | q.text("capabilities = "); |
| 11304 | q.text("%#x" % self.capabilities) |
| 11305 | q.text(","); q.breakable() |
| 11306 | q.text("max_groups_all = "); |
| 11307 | q.text("%#x" % self.max_groups_all) |
| 11308 | q.text(","); q.breakable() |
| 11309 | q.text("max_groups_select = "); |
| 11310 | q.text("%#x" % self.max_groups_select) |
| 11311 | q.text(","); q.breakable() |
| 11312 | q.text("max_groups_indirect = "); |
| 11313 | q.text("%#x" % self.max_groups_indirect) |
| 11314 | q.text(","); q.breakable() |
| 11315 | q.text("max_groups_ff = "); |
| 11316 | q.text("%#x" % self.max_groups_ff) |
| 11317 | q.text(","); q.breakable() |
| 11318 | q.text("actions_all = "); |
| 11319 | q.text("%#x" % self.actions_all) |
| 11320 | q.text(","); q.breakable() |
| 11321 | q.text("actions_select = "); |
| 11322 | q.text("%#x" % self.actions_select) |
| 11323 | q.text(","); q.breakable() |
| 11324 | q.text("actions_indirect = "); |
| 11325 | q.text("%#x" % self.actions_indirect) |
| 11326 | q.text(","); q.breakable() |
| 11327 | q.text("actions_ff = "); |
| 11328 | q.text("%#x" % self.actions_ff) |
| 11329 | q.breakable() |
| 11330 | q.text('}') |
| 11331 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11332 | stats_reply.subtypes[8] = group_features_stats_reply |
| 11333 | |
| 11334 | class group_features_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11335 | version = 4 |
| 11336 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11337 | stats_type = 8 |
| 11338 | |
| 11339 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11340 | if xid != None: |
| 11341 | self.xid = xid |
| 11342 | else: |
| 11343 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11344 | if flags != None: |
| 11345 | self.flags = flags |
| 11346 | else: |
| 11347 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11348 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11349 | |
| 11350 | def pack(self): |
| 11351 | packed = [] |
| 11352 | packed.append(struct.pack("!B", self.version)) |
| 11353 | packed.append(struct.pack("!B", self.type)) |
| 11354 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11355 | packed.append(struct.pack("!L", self.xid)) |
| 11356 | packed.append(struct.pack("!H", self.stats_type)) |
| 11357 | packed.append(struct.pack("!H", self.flags)) |
| 11358 | packed.append('\x00' * 4) |
| 11359 | length = sum([len(x) for x in packed]) |
| 11360 | packed[2] = struct.pack("!H", length) |
| 11361 | return ''.join(packed) |
| 11362 | |
| 11363 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11364 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11365 | obj = group_features_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11366 | _version = reader.read("!B")[0] |
| 11367 | assert(_version == 4) |
| 11368 | _type = reader.read("!B")[0] |
| 11369 | assert(_type == 18) |
| 11370 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11371 | orig_reader = reader |
| 11372 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11373 | obj.xid = reader.read("!L")[0] |
| 11374 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11375 | assert(_stats_type == 8) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11376 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11377 | reader.skip(4) |
| 11378 | return obj |
| 11379 | |
| 11380 | def __eq__(self, other): |
| 11381 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11382 | if self.xid != other.xid: return False |
| 11383 | if self.flags != other.flags: return False |
| 11384 | return True |
| 11385 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11386 | def pretty_print(self, q): |
| 11387 | q.text("group_features_stats_request {") |
| 11388 | with q.group(): |
| 11389 | with q.indent(2): |
| 11390 | q.breakable() |
| 11391 | q.text("xid = "); |
| 11392 | if self.xid != None: |
| 11393 | q.text("%#x" % self.xid) |
| 11394 | else: |
| 11395 | q.text('None') |
| 11396 | q.text(","); q.breakable() |
| 11397 | q.text("flags = "); |
| 11398 | q.text("%#x" % self.flags) |
| 11399 | q.breakable() |
| 11400 | q.text('}') |
| 11401 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11402 | stats_request.subtypes[8] = group_features_stats_request |
| 11403 | |
| 11404 | class group_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11405 | version = 4 |
| 11406 | type = 1 |
| 11407 | err_type = 6 |
| 11408 | |
| 11409 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11410 | if xid != None: |
| 11411 | self.xid = xid |
| 11412 | else: |
| 11413 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11414 | if code != None: |
| 11415 | self.code = code |
| 11416 | else: |
| 11417 | self.code = 0 |
| 11418 | if data != None: |
| 11419 | self.data = data |
| 11420 | else: |
| 11421 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11422 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11423 | |
| 11424 | def pack(self): |
| 11425 | packed = [] |
| 11426 | packed.append(struct.pack("!B", self.version)) |
| 11427 | packed.append(struct.pack("!B", self.type)) |
| 11428 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11429 | packed.append(struct.pack("!L", self.xid)) |
| 11430 | packed.append(struct.pack("!H", self.err_type)) |
| 11431 | packed.append(struct.pack("!H", self.code)) |
| 11432 | packed.append(self.data) |
| 11433 | length = sum([len(x) for x in packed]) |
| 11434 | packed[2] = struct.pack("!H", length) |
| 11435 | return ''.join(packed) |
| 11436 | |
| 11437 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11438 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11439 | obj = group_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11440 | _version = reader.read("!B")[0] |
| 11441 | assert(_version == 4) |
| 11442 | _type = reader.read("!B")[0] |
| 11443 | assert(_type == 1) |
| 11444 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11445 | orig_reader = reader |
| 11446 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11447 | obj.xid = reader.read("!L")[0] |
| 11448 | _err_type = reader.read("!H")[0] |
| 11449 | assert(_err_type == 6) |
| 11450 | obj.code = reader.read("!H")[0] |
| 11451 | obj.data = str(reader.read_all()) |
| 11452 | return obj |
| 11453 | |
| 11454 | def __eq__(self, other): |
| 11455 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11456 | if self.xid != other.xid: return False |
| 11457 | if self.code != other.code: return False |
| 11458 | if self.data != other.data: return False |
| 11459 | return True |
| 11460 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11461 | def pretty_print(self, q): |
| 11462 | q.text("group_mod_failed_error_msg {") |
| 11463 | with q.group(): |
| 11464 | with q.indent(2): |
| 11465 | q.breakable() |
| 11466 | q.text("xid = "); |
| 11467 | if self.xid != None: |
| 11468 | q.text("%#x" % self.xid) |
| 11469 | else: |
| 11470 | q.text('None') |
| 11471 | q.text(","); q.breakable() |
| 11472 | q.text("code = "); |
| 11473 | q.text("%#x" % self.code) |
| 11474 | q.text(","); q.breakable() |
| 11475 | q.text("data = "); |
| 11476 | q.pp(self.data) |
| 11477 | q.breakable() |
| 11478 | q.text('}') |
| 11479 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11480 | error_msg.subtypes[6] = group_mod_failed_error_msg |
| 11481 | |
| 11482 | class group_modify(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11483 | version = 4 |
| 11484 | type = 15 |
| 11485 | command = 1 |
| 11486 | |
| 11487 | 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] | 11488 | if xid != None: |
| 11489 | self.xid = xid |
| 11490 | else: |
| 11491 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11492 | if group_type != None: |
| 11493 | self.group_type = group_type |
| 11494 | else: |
| 11495 | self.group_type = 0 |
| 11496 | if group_id != None: |
| 11497 | self.group_id = group_id |
| 11498 | else: |
| 11499 | self.group_id = 0 |
| 11500 | if buckets != None: |
| 11501 | self.buckets = buckets |
| 11502 | else: |
| 11503 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11504 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11505 | |
| 11506 | def pack(self): |
| 11507 | packed = [] |
| 11508 | packed.append(struct.pack("!B", self.version)) |
| 11509 | packed.append(struct.pack("!B", self.type)) |
| 11510 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11511 | packed.append(struct.pack("!L", self.xid)) |
| 11512 | packed.append(struct.pack("!H", self.command)) |
| 11513 | packed.append(struct.pack("!B", self.group_type)) |
| 11514 | packed.append('\x00' * 1) |
| 11515 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11516 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11517 | length = sum([len(x) for x in packed]) |
| 11518 | packed[2] = struct.pack("!H", length) |
| 11519 | return ''.join(packed) |
| 11520 | |
| 11521 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11522 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11523 | obj = group_modify() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11524 | _version = reader.read("!B")[0] |
| 11525 | assert(_version == 4) |
| 11526 | _type = reader.read("!B")[0] |
| 11527 | assert(_type == 15) |
| 11528 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11529 | orig_reader = reader |
| 11530 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11531 | obj.xid = reader.read("!L")[0] |
| 11532 | _command = reader.read("!H")[0] |
| 11533 | assert(_command == 1) |
| 11534 | obj.group_type = reader.read("!B")[0] |
| 11535 | reader.skip(1) |
| 11536 | obj.group_id = reader.read("!L")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11537 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11538 | return obj |
| 11539 | |
| 11540 | def __eq__(self, other): |
| 11541 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11542 | if self.xid != other.xid: return False |
| 11543 | if self.group_type != other.group_type: return False |
| 11544 | if self.group_id != other.group_id: return False |
| 11545 | if self.buckets != other.buckets: return False |
| 11546 | return True |
| 11547 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11548 | def pretty_print(self, q): |
| 11549 | q.text("group_modify {") |
| 11550 | with q.group(): |
| 11551 | with q.indent(2): |
| 11552 | q.breakable() |
| 11553 | q.text("xid = "); |
| 11554 | if self.xid != None: |
| 11555 | q.text("%#x" % self.xid) |
| 11556 | else: |
| 11557 | q.text('None') |
| 11558 | q.text(","); q.breakable() |
| 11559 | q.text("group_type = "); |
| 11560 | q.text("%#x" % self.group_type) |
| 11561 | q.text(","); q.breakable() |
| 11562 | q.text("group_id = "); |
| 11563 | q.text("%#x" % self.group_id) |
| 11564 | q.text(","); q.breakable() |
| 11565 | q.text("buckets = "); |
| 11566 | q.pp(self.buckets) |
| 11567 | q.breakable() |
| 11568 | q.text('}') |
| 11569 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11570 | group_mod.subtypes[1] = group_modify |
| 11571 | |
| 11572 | class group_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11573 | version = 4 |
| 11574 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11575 | stats_type = 6 |
| 11576 | |
| 11577 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11578 | if xid != None: |
| 11579 | self.xid = xid |
| 11580 | else: |
| 11581 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11582 | if flags != None: |
| 11583 | self.flags = flags |
| 11584 | else: |
| 11585 | self.flags = 0 |
| 11586 | if entries != None: |
| 11587 | self.entries = entries |
| 11588 | else: |
| 11589 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11590 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11591 | |
| 11592 | def pack(self): |
| 11593 | packed = [] |
| 11594 | packed.append(struct.pack("!B", self.version)) |
| 11595 | packed.append(struct.pack("!B", self.type)) |
| 11596 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11597 | packed.append(struct.pack("!L", self.xid)) |
| 11598 | packed.append(struct.pack("!H", self.stats_type)) |
| 11599 | packed.append(struct.pack("!H", self.flags)) |
| 11600 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11601 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11602 | length = sum([len(x) for x in packed]) |
| 11603 | packed[2] = struct.pack("!H", length) |
| 11604 | return ''.join(packed) |
| 11605 | |
| 11606 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11607 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11608 | obj = group_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11609 | _version = reader.read("!B")[0] |
| 11610 | assert(_version == 4) |
| 11611 | _type = reader.read("!B")[0] |
| 11612 | assert(_type == 19) |
| 11613 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11614 | orig_reader = reader |
| 11615 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11616 | obj.xid = reader.read("!L")[0] |
| 11617 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11618 | assert(_stats_type == 6) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11619 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11620 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11621 | 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] | 11622 | return obj |
| 11623 | |
| 11624 | def __eq__(self, other): |
| 11625 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11626 | if self.xid != other.xid: return False |
| 11627 | if self.flags != other.flags: return False |
| 11628 | if self.entries != other.entries: return False |
| 11629 | return True |
| 11630 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11631 | def pretty_print(self, q): |
| 11632 | q.text("group_stats_reply {") |
| 11633 | with q.group(): |
| 11634 | with q.indent(2): |
| 11635 | q.breakable() |
| 11636 | q.text("xid = "); |
| 11637 | if self.xid != None: |
| 11638 | q.text("%#x" % self.xid) |
| 11639 | else: |
| 11640 | q.text('None') |
| 11641 | q.text(","); q.breakable() |
| 11642 | q.text("flags = "); |
| 11643 | q.text("%#x" % self.flags) |
| 11644 | q.text(","); q.breakable() |
| 11645 | q.text("entries = "); |
| 11646 | q.pp(self.entries) |
| 11647 | q.breakable() |
| 11648 | q.text('}') |
| 11649 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11650 | stats_reply.subtypes[6] = group_stats_reply |
| 11651 | |
| 11652 | class group_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11653 | version = 4 |
| 11654 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11655 | stats_type = 6 |
| 11656 | |
| 11657 | def __init__(self, xid=None, flags=None, group_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11658 | if xid != None: |
| 11659 | self.xid = xid |
| 11660 | else: |
| 11661 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11662 | if flags != None: |
| 11663 | self.flags = flags |
| 11664 | else: |
| 11665 | self.flags = 0 |
| 11666 | if group_id != None: |
| 11667 | self.group_id = group_id |
| 11668 | else: |
| 11669 | self.group_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11670 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11671 | |
| 11672 | def pack(self): |
| 11673 | packed = [] |
| 11674 | packed.append(struct.pack("!B", self.version)) |
| 11675 | packed.append(struct.pack("!B", self.type)) |
| 11676 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11677 | packed.append(struct.pack("!L", self.xid)) |
| 11678 | packed.append(struct.pack("!H", self.stats_type)) |
| 11679 | packed.append(struct.pack("!H", self.flags)) |
| 11680 | packed.append('\x00' * 4) |
| 11681 | packed.append(struct.pack("!L", self.group_id)) |
| 11682 | packed.append('\x00' * 4) |
| 11683 | length = sum([len(x) for x in packed]) |
| 11684 | packed[2] = struct.pack("!H", length) |
| 11685 | return ''.join(packed) |
| 11686 | |
| 11687 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11688 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11689 | obj = group_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11690 | _version = reader.read("!B")[0] |
| 11691 | assert(_version == 4) |
| 11692 | _type = reader.read("!B")[0] |
| 11693 | assert(_type == 18) |
| 11694 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11695 | orig_reader = reader |
| 11696 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11697 | obj.xid = reader.read("!L")[0] |
| 11698 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11699 | assert(_stats_type == 6) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11700 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11701 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11702 | obj.group_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11703 | reader.skip(4) |
| 11704 | return obj |
| 11705 | |
| 11706 | def __eq__(self, other): |
| 11707 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11708 | if self.xid != other.xid: return False |
| 11709 | if self.flags != other.flags: return False |
| 11710 | if self.group_id != other.group_id: return False |
| 11711 | return True |
| 11712 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11713 | def pretty_print(self, q): |
| 11714 | q.text("group_stats_request {") |
| 11715 | with q.group(): |
| 11716 | with q.indent(2): |
| 11717 | q.breakable() |
| 11718 | q.text("xid = "); |
| 11719 | if self.xid != None: |
| 11720 | q.text("%#x" % self.xid) |
| 11721 | else: |
| 11722 | q.text('None') |
| 11723 | q.text(","); q.breakable() |
| 11724 | q.text("flags = "); |
| 11725 | q.text("%#x" % self.flags) |
| 11726 | q.text(","); q.breakable() |
| 11727 | q.text("group_id = "); |
| 11728 | q.text("%#x" % self.group_id) |
| 11729 | q.breakable() |
| 11730 | q.text('}') |
| 11731 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11732 | stats_request.subtypes[6] = group_stats_request |
| 11733 | |
| 11734 | class hello(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11735 | version = 4 |
| 11736 | type = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11737 | |
| 11738 | def __init__(self, xid=None, elements=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11739 | if xid != None: |
| 11740 | self.xid = xid |
| 11741 | else: |
| 11742 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11743 | if elements != None: |
| 11744 | self.elements = elements |
| 11745 | else: |
| 11746 | self.elements = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11747 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11748 | |
| 11749 | def pack(self): |
| 11750 | packed = [] |
| 11751 | packed.append(struct.pack("!B", self.version)) |
| 11752 | packed.append(struct.pack("!B", self.type)) |
| 11753 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11754 | packed.append(struct.pack("!L", self.xid)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11755 | packed.append(loxi.generic_util.pack_list(self.elements)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11756 | length = sum([len(x) for x in packed]) |
| 11757 | packed[2] = struct.pack("!H", length) |
| 11758 | return ''.join(packed) |
| 11759 | |
| 11760 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11761 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11762 | obj = hello() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11763 | _version = reader.read("!B")[0] |
| 11764 | assert(_version == 4) |
| 11765 | _type = reader.read("!B")[0] |
| 11766 | assert(_type == 0) |
| 11767 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11768 | orig_reader = reader |
| 11769 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11770 | obj.xid = reader.read("!L")[0] |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 11771 | obj.elements = loxi.generic_util.unpack_list(reader, common.hello_elem.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11772 | return obj |
| 11773 | |
| 11774 | def __eq__(self, other): |
| 11775 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11776 | if self.xid != other.xid: return False |
| 11777 | if self.elements != other.elements: return False |
| 11778 | return True |
| 11779 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11780 | def pretty_print(self, q): |
| 11781 | q.text("hello {") |
| 11782 | with q.group(): |
| 11783 | with q.indent(2): |
| 11784 | q.breakable() |
| 11785 | q.text("xid = "); |
| 11786 | if self.xid != None: |
| 11787 | q.text("%#x" % self.xid) |
| 11788 | else: |
| 11789 | q.text('None') |
| 11790 | q.text(","); q.breakable() |
| 11791 | q.text("elements = "); |
| 11792 | q.pp(self.elements) |
| 11793 | q.breakable() |
| 11794 | q.text('}') |
| 11795 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11796 | message.subtypes[0] = hello |
| 11797 | |
| 11798 | class hello_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11799 | version = 4 |
| 11800 | type = 1 |
| 11801 | err_type = 0 |
| 11802 | |
| 11803 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11804 | if xid != None: |
| 11805 | self.xid = xid |
| 11806 | else: |
| 11807 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11808 | if code != None: |
| 11809 | self.code = code |
| 11810 | else: |
| 11811 | self.code = 0 |
| 11812 | if data != None: |
| 11813 | self.data = data |
| 11814 | else: |
| 11815 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11816 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11817 | |
| 11818 | def pack(self): |
| 11819 | packed = [] |
| 11820 | packed.append(struct.pack("!B", self.version)) |
| 11821 | packed.append(struct.pack("!B", self.type)) |
| 11822 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11823 | packed.append(struct.pack("!L", self.xid)) |
| 11824 | packed.append(struct.pack("!H", self.err_type)) |
| 11825 | packed.append(struct.pack("!H", self.code)) |
| 11826 | packed.append(self.data) |
| 11827 | length = sum([len(x) for x in packed]) |
| 11828 | packed[2] = struct.pack("!H", length) |
| 11829 | return ''.join(packed) |
| 11830 | |
| 11831 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11832 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11833 | obj = hello_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11834 | _version = reader.read("!B")[0] |
| 11835 | assert(_version == 4) |
| 11836 | _type = reader.read("!B")[0] |
| 11837 | assert(_type == 1) |
| 11838 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11839 | orig_reader = reader |
| 11840 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11841 | obj.xid = reader.read("!L")[0] |
| 11842 | _err_type = reader.read("!H")[0] |
| 11843 | assert(_err_type == 0) |
| 11844 | obj.code = reader.read("!H")[0] |
| 11845 | obj.data = str(reader.read_all()) |
| 11846 | return obj |
| 11847 | |
| 11848 | def __eq__(self, other): |
| 11849 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11850 | if self.xid != other.xid: return False |
| 11851 | if self.code != other.code: return False |
| 11852 | if self.data != other.data: return False |
| 11853 | return True |
| 11854 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11855 | def pretty_print(self, q): |
| 11856 | q.text("hello_failed_error_msg {") |
| 11857 | with q.group(): |
| 11858 | with q.indent(2): |
| 11859 | q.breakable() |
| 11860 | q.text("xid = "); |
| 11861 | if self.xid != None: |
| 11862 | q.text("%#x" % self.xid) |
| 11863 | else: |
| 11864 | q.text('None') |
| 11865 | q.text(","); q.breakable() |
| 11866 | q.text("code = "); |
| 11867 | q.text("%#x" % self.code) |
| 11868 | q.text(","); q.breakable() |
| 11869 | q.text("data = "); |
| 11870 | q.pp(self.data) |
| 11871 | q.breakable() |
| 11872 | q.text('}') |
| 11873 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11874 | error_msg.subtypes[0] = hello_failed_error_msg |
| 11875 | |
| 11876 | class meter_config_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11877 | version = 4 |
| 11878 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11879 | stats_type = 10 |
| 11880 | |
| 11881 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11882 | if xid != None: |
| 11883 | self.xid = xid |
| 11884 | else: |
| 11885 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11886 | if flags != None: |
| 11887 | self.flags = flags |
| 11888 | else: |
| 11889 | self.flags = 0 |
| 11890 | if entries != None: |
| 11891 | self.entries = entries |
| 11892 | else: |
| 11893 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11894 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11895 | |
| 11896 | def pack(self): |
| 11897 | packed = [] |
| 11898 | packed.append(struct.pack("!B", self.version)) |
| 11899 | packed.append(struct.pack("!B", self.type)) |
| 11900 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11901 | packed.append(struct.pack("!L", self.xid)) |
| 11902 | packed.append(struct.pack("!H", self.stats_type)) |
| 11903 | packed.append(struct.pack("!H", self.flags)) |
| 11904 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11905 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11906 | length = sum([len(x) for x in packed]) |
| 11907 | packed[2] = struct.pack("!H", length) |
| 11908 | return ''.join(packed) |
| 11909 | |
| 11910 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11911 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11912 | obj = meter_config_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11913 | _version = reader.read("!B")[0] |
| 11914 | assert(_version == 4) |
| 11915 | _type = reader.read("!B")[0] |
| 11916 | assert(_type == 19) |
| 11917 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11918 | orig_reader = reader |
| 11919 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11920 | obj.xid = reader.read("!L")[0] |
| 11921 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11922 | assert(_stats_type == 10) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11923 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11924 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11925 | 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] | 11926 | return obj |
| 11927 | |
| 11928 | def __eq__(self, other): |
| 11929 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11930 | if self.xid != other.xid: return False |
| 11931 | if self.flags != other.flags: return False |
| 11932 | if self.entries != other.entries: return False |
| 11933 | return True |
| 11934 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11935 | def pretty_print(self, q): |
| 11936 | q.text("meter_config_stats_reply {") |
| 11937 | with q.group(): |
| 11938 | with q.indent(2): |
| 11939 | q.breakable() |
| 11940 | q.text("xid = "); |
| 11941 | if self.xid != None: |
| 11942 | q.text("%#x" % self.xid) |
| 11943 | else: |
| 11944 | q.text('None') |
| 11945 | q.text(","); q.breakable() |
| 11946 | q.text("flags = "); |
| 11947 | q.text("%#x" % self.flags) |
| 11948 | q.text(","); q.breakable() |
| 11949 | q.text("entries = "); |
| 11950 | q.pp(self.entries) |
| 11951 | q.breakable() |
| 11952 | q.text('}') |
| 11953 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11954 | stats_reply.subtypes[10] = meter_config_stats_reply |
| 11955 | |
| 11956 | class meter_config_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11957 | version = 4 |
| 11958 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11959 | stats_type = 10 |
| 11960 | |
| 11961 | def __init__(self, xid=None, flags=None, meter_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11962 | if xid != None: |
| 11963 | self.xid = xid |
| 11964 | else: |
| 11965 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11966 | if flags != None: |
| 11967 | self.flags = flags |
| 11968 | else: |
| 11969 | self.flags = 0 |
| 11970 | if meter_id != None: |
| 11971 | self.meter_id = meter_id |
| 11972 | else: |
| 11973 | self.meter_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11974 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11975 | |
| 11976 | def pack(self): |
| 11977 | packed = [] |
| 11978 | packed.append(struct.pack("!B", self.version)) |
| 11979 | packed.append(struct.pack("!B", self.type)) |
| 11980 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11981 | packed.append(struct.pack("!L", self.xid)) |
| 11982 | packed.append(struct.pack("!H", self.stats_type)) |
| 11983 | packed.append(struct.pack("!H", self.flags)) |
| 11984 | packed.append('\x00' * 4) |
| 11985 | packed.append(struct.pack("!L", self.meter_id)) |
| 11986 | packed.append('\x00' * 4) |
| 11987 | length = sum([len(x) for x in packed]) |
| 11988 | packed[2] = struct.pack("!H", length) |
| 11989 | return ''.join(packed) |
| 11990 | |
| 11991 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11992 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11993 | obj = meter_config_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11994 | _version = reader.read("!B")[0] |
| 11995 | assert(_version == 4) |
| 11996 | _type = reader.read("!B")[0] |
| 11997 | assert(_type == 18) |
| 11998 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11999 | orig_reader = reader |
| 12000 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12001 | obj.xid = reader.read("!L")[0] |
| 12002 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12003 | assert(_stats_type == 10) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12004 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12005 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12006 | obj.meter_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12007 | reader.skip(4) |
| 12008 | return obj |
| 12009 | |
| 12010 | def __eq__(self, other): |
| 12011 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12012 | if self.xid != other.xid: return False |
| 12013 | if self.flags != other.flags: return False |
| 12014 | if self.meter_id != other.meter_id: return False |
| 12015 | return True |
| 12016 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12017 | def pretty_print(self, q): |
| 12018 | q.text("meter_config_stats_request {") |
| 12019 | with q.group(): |
| 12020 | with q.indent(2): |
| 12021 | q.breakable() |
| 12022 | q.text("xid = "); |
| 12023 | if self.xid != None: |
| 12024 | q.text("%#x" % self.xid) |
| 12025 | else: |
| 12026 | q.text('None') |
| 12027 | q.text(","); q.breakable() |
| 12028 | q.text("flags = "); |
| 12029 | q.text("%#x" % self.flags) |
| 12030 | q.text(","); q.breakable() |
| 12031 | q.text("meter_id = "); |
| 12032 | q.text("%#x" % self.meter_id) |
| 12033 | q.breakable() |
| 12034 | q.text('}') |
| 12035 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12036 | stats_request.subtypes[10] = meter_config_stats_request |
| 12037 | |
| 12038 | class meter_features_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12039 | version = 4 |
| 12040 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12041 | stats_type = 11 |
| 12042 | |
| 12043 | def __init__(self, xid=None, flags=None, features=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12044 | if xid != None: |
| 12045 | self.xid = xid |
| 12046 | else: |
| 12047 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12048 | if flags != None: |
| 12049 | self.flags = flags |
| 12050 | else: |
| 12051 | self.flags = 0 |
| 12052 | if features != None: |
| 12053 | self.features = features |
| 12054 | else: |
| 12055 | self.features = common.meter_features() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12056 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12057 | |
| 12058 | def pack(self): |
| 12059 | packed = [] |
| 12060 | packed.append(struct.pack("!B", self.version)) |
| 12061 | packed.append(struct.pack("!B", self.type)) |
| 12062 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12063 | packed.append(struct.pack("!L", self.xid)) |
| 12064 | packed.append(struct.pack("!H", self.stats_type)) |
| 12065 | packed.append(struct.pack("!H", self.flags)) |
| 12066 | packed.append('\x00' * 4) |
| 12067 | packed.append(self.features.pack()) |
| 12068 | length = sum([len(x) for x in packed]) |
| 12069 | packed[2] = struct.pack("!H", length) |
| 12070 | return ''.join(packed) |
| 12071 | |
| 12072 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12073 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12074 | obj = meter_features_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12075 | _version = reader.read("!B")[0] |
| 12076 | assert(_version == 4) |
| 12077 | _type = reader.read("!B")[0] |
| 12078 | assert(_type == 19) |
| 12079 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12080 | orig_reader = reader |
| 12081 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12082 | obj.xid = reader.read("!L")[0] |
| 12083 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12084 | assert(_stats_type == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12085 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12086 | reader.skip(4) |
| 12087 | obj.features = common.meter_features.unpack(reader) |
| 12088 | return obj |
| 12089 | |
| 12090 | def __eq__(self, other): |
| 12091 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12092 | if self.xid != other.xid: return False |
| 12093 | if self.flags != other.flags: return False |
| 12094 | if self.features != other.features: return False |
| 12095 | return True |
| 12096 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12097 | def pretty_print(self, q): |
| 12098 | q.text("meter_features_stats_reply {") |
| 12099 | with q.group(): |
| 12100 | with q.indent(2): |
| 12101 | q.breakable() |
| 12102 | q.text("xid = "); |
| 12103 | if self.xid != None: |
| 12104 | q.text("%#x" % self.xid) |
| 12105 | else: |
| 12106 | q.text('None') |
| 12107 | q.text(","); q.breakable() |
| 12108 | q.text("flags = "); |
| 12109 | q.text("%#x" % self.flags) |
| 12110 | q.text(","); q.breakable() |
| 12111 | q.text("features = "); |
| 12112 | q.pp(self.features) |
| 12113 | q.breakable() |
| 12114 | q.text('}') |
| 12115 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12116 | stats_reply.subtypes[11] = meter_features_stats_reply |
| 12117 | |
| 12118 | class meter_features_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12119 | version = 4 |
| 12120 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12121 | stats_type = 11 |
| 12122 | |
| 12123 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12124 | if xid != None: |
| 12125 | self.xid = xid |
| 12126 | else: |
| 12127 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12128 | if flags != None: |
| 12129 | self.flags = flags |
| 12130 | else: |
| 12131 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12132 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12133 | |
| 12134 | def pack(self): |
| 12135 | packed = [] |
| 12136 | packed.append(struct.pack("!B", self.version)) |
| 12137 | packed.append(struct.pack("!B", self.type)) |
| 12138 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12139 | packed.append(struct.pack("!L", self.xid)) |
| 12140 | packed.append(struct.pack("!H", self.stats_type)) |
| 12141 | packed.append(struct.pack("!H", self.flags)) |
| 12142 | packed.append('\x00' * 4) |
| 12143 | length = sum([len(x) for x in packed]) |
| 12144 | packed[2] = struct.pack("!H", length) |
| 12145 | return ''.join(packed) |
| 12146 | |
| 12147 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12148 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12149 | obj = meter_features_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12150 | _version = reader.read("!B")[0] |
| 12151 | assert(_version == 4) |
| 12152 | _type = reader.read("!B")[0] |
| 12153 | assert(_type == 18) |
| 12154 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12155 | orig_reader = reader |
| 12156 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12157 | obj.xid = reader.read("!L")[0] |
| 12158 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12159 | assert(_stats_type == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12160 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12161 | reader.skip(4) |
| 12162 | return obj |
| 12163 | |
| 12164 | def __eq__(self, other): |
| 12165 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12166 | if self.xid != other.xid: return False |
| 12167 | if self.flags != other.flags: return False |
| 12168 | return True |
| 12169 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12170 | def pretty_print(self, q): |
| 12171 | q.text("meter_features_stats_request {") |
| 12172 | with q.group(): |
| 12173 | with q.indent(2): |
| 12174 | q.breakable() |
| 12175 | q.text("xid = "); |
| 12176 | if self.xid != None: |
| 12177 | q.text("%#x" % self.xid) |
| 12178 | else: |
| 12179 | q.text('None') |
| 12180 | q.text(","); q.breakable() |
| 12181 | q.text("flags = "); |
| 12182 | q.text("%#x" % self.flags) |
| 12183 | q.breakable() |
| 12184 | q.text('}') |
| 12185 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12186 | stats_request.subtypes[11] = meter_features_stats_request |
| 12187 | |
| 12188 | class meter_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12189 | version = 4 |
| 12190 | type = 29 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12191 | |
| 12192 | 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] | 12193 | if xid != None: |
| 12194 | self.xid = xid |
| 12195 | else: |
| 12196 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12197 | if command != None: |
| 12198 | self.command = command |
| 12199 | else: |
| 12200 | self.command = 0 |
| 12201 | if flags != None: |
| 12202 | self.flags = flags |
| 12203 | else: |
| 12204 | self.flags = 0 |
| 12205 | if meter_id != None: |
| 12206 | self.meter_id = meter_id |
| 12207 | else: |
| 12208 | self.meter_id = 0 |
| 12209 | if meters != None: |
| 12210 | self.meters = meters |
| 12211 | else: |
| 12212 | self.meters = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12213 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12214 | |
| 12215 | def pack(self): |
| 12216 | packed = [] |
| 12217 | packed.append(struct.pack("!B", self.version)) |
| 12218 | packed.append(struct.pack("!B", self.type)) |
| 12219 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12220 | packed.append(struct.pack("!L", self.xid)) |
| 12221 | packed.append(struct.pack("!H", self.command)) |
| 12222 | packed.append(struct.pack("!H", self.flags)) |
| 12223 | packed.append(struct.pack("!L", self.meter_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12224 | packed.append(loxi.generic_util.pack_list(self.meters)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12225 | length = sum([len(x) for x in packed]) |
| 12226 | packed[2] = struct.pack("!H", length) |
| 12227 | return ''.join(packed) |
| 12228 | |
| 12229 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12230 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12231 | obj = meter_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12232 | _version = reader.read("!B")[0] |
| 12233 | assert(_version == 4) |
| 12234 | _type = reader.read("!B")[0] |
| 12235 | assert(_type == 29) |
| 12236 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12237 | orig_reader = reader |
| 12238 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12239 | obj.xid = reader.read("!L")[0] |
| 12240 | obj.command = reader.read("!H")[0] |
| 12241 | obj.flags = reader.read("!H")[0] |
| 12242 | obj.meter_id = reader.read("!L")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12243 | 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] | 12244 | return obj |
| 12245 | |
| 12246 | def __eq__(self, other): |
| 12247 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12248 | if self.xid != other.xid: return False |
| 12249 | if self.command != other.command: return False |
| 12250 | if self.flags != other.flags: return False |
| 12251 | if self.meter_id != other.meter_id: return False |
| 12252 | if self.meters != other.meters: return False |
| 12253 | return True |
| 12254 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12255 | def pretty_print(self, q): |
| 12256 | q.text("meter_mod {") |
| 12257 | with q.group(): |
| 12258 | with q.indent(2): |
| 12259 | q.breakable() |
| 12260 | q.text("xid = "); |
| 12261 | if self.xid != None: |
| 12262 | q.text("%#x" % self.xid) |
| 12263 | else: |
| 12264 | q.text('None') |
| 12265 | q.text(","); q.breakable() |
| 12266 | q.text("command = "); |
| 12267 | q.text("%#x" % self.command) |
| 12268 | q.text(","); q.breakable() |
| 12269 | q.text("flags = "); |
| 12270 | q.text("%#x" % self.flags) |
| 12271 | q.text(","); q.breakable() |
| 12272 | q.text("meter_id = "); |
| 12273 | q.text("%#x" % self.meter_id) |
| 12274 | q.text(","); q.breakable() |
| 12275 | q.text("meters = "); |
| 12276 | q.pp(self.meters) |
| 12277 | q.breakable() |
| 12278 | q.text('}') |
| 12279 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12280 | message.subtypes[29] = meter_mod |
| 12281 | |
| 12282 | class meter_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12283 | version = 4 |
| 12284 | type = 1 |
| 12285 | err_type = 12 |
| 12286 | |
| 12287 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12288 | if xid != None: |
| 12289 | self.xid = xid |
| 12290 | else: |
| 12291 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12292 | if code != None: |
| 12293 | self.code = code |
| 12294 | else: |
| 12295 | self.code = 0 |
| 12296 | if data != None: |
| 12297 | self.data = data |
| 12298 | else: |
| 12299 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12300 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12301 | |
| 12302 | def pack(self): |
| 12303 | packed = [] |
| 12304 | packed.append(struct.pack("!B", self.version)) |
| 12305 | packed.append(struct.pack("!B", self.type)) |
| 12306 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12307 | packed.append(struct.pack("!L", self.xid)) |
| 12308 | packed.append(struct.pack("!H", self.err_type)) |
| 12309 | packed.append(struct.pack("!H", self.code)) |
| 12310 | packed.append(self.data) |
| 12311 | length = sum([len(x) for x in packed]) |
| 12312 | packed[2] = struct.pack("!H", length) |
| 12313 | return ''.join(packed) |
| 12314 | |
| 12315 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12316 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12317 | obj = meter_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12318 | _version = reader.read("!B")[0] |
| 12319 | assert(_version == 4) |
| 12320 | _type = reader.read("!B")[0] |
| 12321 | assert(_type == 1) |
| 12322 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12323 | orig_reader = reader |
| 12324 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12325 | obj.xid = reader.read("!L")[0] |
| 12326 | _err_type = reader.read("!H")[0] |
| 12327 | assert(_err_type == 12) |
| 12328 | obj.code = reader.read("!H")[0] |
| 12329 | obj.data = str(reader.read_all()) |
| 12330 | return obj |
| 12331 | |
| 12332 | def __eq__(self, other): |
| 12333 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12334 | if self.xid != other.xid: return False |
| 12335 | if self.code != other.code: return False |
| 12336 | if self.data != other.data: return False |
| 12337 | return True |
| 12338 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12339 | def pretty_print(self, q): |
| 12340 | q.text("meter_mod_failed_error_msg {") |
| 12341 | with q.group(): |
| 12342 | with q.indent(2): |
| 12343 | q.breakable() |
| 12344 | q.text("xid = "); |
| 12345 | if self.xid != None: |
| 12346 | q.text("%#x" % self.xid) |
| 12347 | else: |
| 12348 | q.text('None') |
| 12349 | q.text(","); q.breakable() |
| 12350 | q.text("code = "); |
| 12351 | q.text("%#x" % self.code) |
| 12352 | q.text(","); q.breakable() |
| 12353 | q.text("data = "); |
| 12354 | q.pp(self.data) |
| 12355 | q.breakable() |
| 12356 | q.text('}') |
| 12357 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12358 | error_msg.subtypes[12] = meter_mod_failed_error_msg |
| 12359 | |
| 12360 | class meter_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12361 | version = 4 |
| 12362 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12363 | stats_type = 9 |
| 12364 | |
| 12365 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12366 | if xid != None: |
| 12367 | self.xid = xid |
| 12368 | else: |
| 12369 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12370 | if flags != None: |
| 12371 | self.flags = flags |
| 12372 | else: |
| 12373 | self.flags = 0 |
| 12374 | if entries != None: |
| 12375 | self.entries = entries |
| 12376 | else: |
| 12377 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12378 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12379 | |
| 12380 | def pack(self): |
| 12381 | packed = [] |
| 12382 | packed.append(struct.pack("!B", self.version)) |
| 12383 | packed.append(struct.pack("!B", self.type)) |
| 12384 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12385 | packed.append(struct.pack("!L", self.xid)) |
| 12386 | packed.append(struct.pack("!H", self.stats_type)) |
| 12387 | packed.append(struct.pack("!H", self.flags)) |
| 12388 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12389 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12390 | length = sum([len(x) for x in packed]) |
| 12391 | packed[2] = struct.pack("!H", length) |
| 12392 | return ''.join(packed) |
| 12393 | |
| 12394 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12395 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12396 | obj = meter_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12397 | _version = reader.read("!B")[0] |
| 12398 | assert(_version == 4) |
| 12399 | _type = reader.read("!B")[0] |
| 12400 | assert(_type == 19) |
| 12401 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12402 | orig_reader = reader |
| 12403 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12404 | obj.xid = reader.read("!L")[0] |
| 12405 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12406 | assert(_stats_type == 9) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12407 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12408 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12409 | obj.entries = loxi.generic_util.unpack_list(reader, common.meter_stats.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12410 | return obj |
| 12411 | |
| 12412 | def __eq__(self, other): |
| 12413 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12414 | if self.xid != other.xid: return False |
| 12415 | if self.flags != other.flags: return False |
| 12416 | if self.entries != other.entries: return False |
| 12417 | return True |
| 12418 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12419 | def pretty_print(self, q): |
| 12420 | q.text("meter_stats_reply {") |
| 12421 | with q.group(): |
| 12422 | with q.indent(2): |
| 12423 | q.breakable() |
| 12424 | q.text("xid = "); |
| 12425 | if self.xid != None: |
| 12426 | q.text("%#x" % self.xid) |
| 12427 | else: |
| 12428 | q.text('None') |
| 12429 | q.text(","); q.breakable() |
| 12430 | q.text("flags = "); |
| 12431 | q.text("%#x" % self.flags) |
| 12432 | q.text(","); q.breakable() |
| 12433 | q.text("entries = "); |
| 12434 | q.pp(self.entries) |
| 12435 | q.breakable() |
| 12436 | q.text('}') |
| 12437 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12438 | stats_reply.subtypes[9] = meter_stats_reply |
| 12439 | |
| 12440 | class meter_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12441 | version = 4 |
| 12442 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12443 | stats_type = 9 |
| 12444 | |
| 12445 | def __init__(self, xid=None, flags=None, meter_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12446 | if xid != None: |
| 12447 | self.xid = xid |
| 12448 | else: |
| 12449 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12450 | if flags != None: |
| 12451 | self.flags = flags |
| 12452 | else: |
| 12453 | self.flags = 0 |
| 12454 | if meter_id != None: |
| 12455 | self.meter_id = meter_id |
| 12456 | else: |
| 12457 | self.meter_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12458 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12459 | |
| 12460 | def pack(self): |
| 12461 | packed = [] |
| 12462 | packed.append(struct.pack("!B", self.version)) |
| 12463 | packed.append(struct.pack("!B", self.type)) |
| 12464 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12465 | packed.append(struct.pack("!L", self.xid)) |
| 12466 | packed.append(struct.pack("!H", self.stats_type)) |
| 12467 | packed.append(struct.pack("!H", self.flags)) |
| 12468 | packed.append('\x00' * 4) |
| 12469 | packed.append(struct.pack("!L", self.meter_id)) |
| 12470 | packed.append('\x00' * 4) |
| 12471 | length = sum([len(x) for x in packed]) |
| 12472 | packed[2] = struct.pack("!H", length) |
| 12473 | return ''.join(packed) |
| 12474 | |
| 12475 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12476 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12477 | obj = meter_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12478 | _version = reader.read("!B")[0] |
| 12479 | assert(_version == 4) |
| 12480 | _type = reader.read("!B")[0] |
| 12481 | assert(_type == 18) |
| 12482 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12483 | orig_reader = reader |
| 12484 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12485 | obj.xid = reader.read("!L")[0] |
| 12486 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12487 | assert(_stats_type == 9) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12488 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12489 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12490 | obj.meter_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12491 | reader.skip(4) |
| 12492 | return obj |
| 12493 | |
| 12494 | def __eq__(self, other): |
| 12495 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12496 | if self.xid != other.xid: return False |
| 12497 | if self.flags != other.flags: return False |
| 12498 | if self.meter_id != other.meter_id: return False |
| 12499 | return True |
| 12500 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12501 | def pretty_print(self, q): |
| 12502 | q.text("meter_stats_request {") |
| 12503 | with q.group(): |
| 12504 | with q.indent(2): |
| 12505 | q.breakable() |
| 12506 | q.text("xid = "); |
| 12507 | if self.xid != None: |
| 12508 | q.text("%#x" % self.xid) |
| 12509 | else: |
| 12510 | q.text('None') |
| 12511 | q.text(","); q.breakable() |
| 12512 | q.text("flags = "); |
| 12513 | q.text("%#x" % self.flags) |
| 12514 | q.text(","); q.breakable() |
| 12515 | q.text("meter_id = "); |
| 12516 | q.text("%#x" % self.meter_id) |
| 12517 | q.breakable() |
| 12518 | q.text('}') |
| 12519 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12520 | stats_request.subtypes[9] = meter_stats_request |
| 12521 | |
| 12522 | class nicira_header(experimenter): |
| 12523 | subtypes = {} |
| 12524 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 12525 | version = 4 |
| 12526 | type = 4 |
| 12527 | experimenter = 8992 |
| 12528 | |
| 12529 | def __init__(self, xid=None, subtype=None): |
| 12530 | if xid != None: |
| 12531 | self.xid = xid |
| 12532 | else: |
| 12533 | self.xid = None |
| 12534 | if subtype != None: |
| 12535 | self.subtype = subtype |
| 12536 | else: |
| 12537 | self.subtype = 0 |
| 12538 | return |
| 12539 | |
| 12540 | def pack(self): |
| 12541 | packed = [] |
| 12542 | packed.append(struct.pack("!B", self.version)) |
| 12543 | packed.append(struct.pack("!B", self.type)) |
| 12544 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12545 | packed.append(struct.pack("!L", self.xid)) |
| 12546 | packed.append(struct.pack("!L", self.experimenter)) |
| 12547 | packed.append(struct.pack("!L", self.subtype)) |
| 12548 | length = sum([len(x) for x in packed]) |
| 12549 | packed[2] = struct.pack("!H", length) |
| 12550 | return ''.join(packed) |
| 12551 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12552 | @staticmethod |
| 12553 | def unpack(reader): |
| 12554 | subtype, = reader.peek('!L', 12) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 12555 | subclass = nicira_header.subtypes.get(subtype) |
| 12556 | if subclass: |
| 12557 | return subclass.unpack(reader) |
| 12558 | |
| 12559 | obj = nicira_header() |
| 12560 | _version = reader.read("!B")[0] |
| 12561 | assert(_version == 4) |
| 12562 | _type = reader.read("!B")[0] |
| 12563 | assert(_type == 4) |
| 12564 | _length = reader.read("!H")[0] |
| 12565 | orig_reader = reader |
| 12566 | reader = orig_reader.slice(_length - (2 + 2)) |
| 12567 | obj.xid = reader.read("!L")[0] |
| 12568 | _experimenter = reader.read("!L")[0] |
| 12569 | assert(_experimenter == 8992) |
| 12570 | obj.subtype = reader.read("!L")[0] |
| 12571 | return obj |
| 12572 | |
| 12573 | def __eq__(self, other): |
| 12574 | if type(self) != type(other): return False |
| 12575 | if self.xid != other.xid: return False |
| 12576 | if self.subtype != other.subtype: return False |
| 12577 | return True |
| 12578 | |
| 12579 | def pretty_print(self, q): |
| 12580 | q.text("nicira_header {") |
| 12581 | with q.group(): |
| 12582 | with q.indent(2): |
| 12583 | q.breakable() |
| 12584 | q.text("xid = "); |
| 12585 | if self.xid != None: |
| 12586 | q.text("%#x" % self.xid) |
| 12587 | else: |
| 12588 | q.text('None') |
| 12589 | q.breakable() |
| 12590 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12591 | |
| 12592 | experimenter.subtypes[8992] = nicira_header |
| 12593 | |
| 12594 | class packet_in(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12595 | version = 4 |
| 12596 | type = 10 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12597 | |
| 12598 | 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] | 12599 | if xid != None: |
| 12600 | self.xid = xid |
| 12601 | else: |
| 12602 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12603 | if buffer_id != None: |
| 12604 | self.buffer_id = buffer_id |
| 12605 | else: |
| 12606 | self.buffer_id = 0 |
| 12607 | if total_len != None: |
| 12608 | self.total_len = total_len |
| 12609 | else: |
| 12610 | self.total_len = 0 |
| 12611 | if reason != None: |
| 12612 | self.reason = reason |
| 12613 | else: |
| 12614 | self.reason = 0 |
| 12615 | if table_id != None: |
| 12616 | self.table_id = table_id |
| 12617 | else: |
| 12618 | self.table_id = 0 |
| 12619 | if cookie != None: |
| 12620 | self.cookie = cookie |
| 12621 | else: |
| 12622 | self.cookie = 0 |
| 12623 | if match != None: |
| 12624 | self.match = match |
| 12625 | else: |
| 12626 | self.match = common.match() |
| 12627 | if data != None: |
| 12628 | self.data = data |
| 12629 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12630 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12631 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12632 | |
| 12633 | def pack(self): |
| 12634 | packed = [] |
| 12635 | packed.append(struct.pack("!B", self.version)) |
| 12636 | packed.append(struct.pack("!B", self.type)) |
| 12637 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12638 | packed.append(struct.pack("!L", self.xid)) |
| 12639 | packed.append(struct.pack("!L", self.buffer_id)) |
| 12640 | packed.append(struct.pack("!H", self.total_len)) |
| 12641 | packed.append(struct.pack("!B", self.reason)) |
| 12642 | packed.append(struct.pack("!B", self.table_id)) |
| 12643 | packed.append(struct.pack("!Q", self.cookie)) |
| 12644 | packed.append(self.match.pack()) |
| 12645 | packed.append('\x00' * 2) |
| 12646 | packed.append(self.data) |
| 12647 | length = sum([len(x) for x in packed]) |
| 12648 | packed[2] = struct.pack("!H", length) |
| 12649 | return ''.join(packed) |
| 12650 | |
| 12651 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12652 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12653 | obj = packet_in() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12654 | _version = reader.read("!B")[0] |
| 12655 | assert(_version == 4) |
| 12656 | _type = reader.read("!B")[0] |
| 12657 | assert(_type == 10) |
| 12658 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12659 | orig_reader = reader |
| 12660 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12661 | obj.xid = reader.read("!L")[0] |
| 12662 | obj.buffer_id = reader.read("!L")[0] |
| 12663 | obj.total_len = reader.read("!H")[0] |
| 12664 | obj.reason = reader.read("!B")[0] |
| 12665 | obj.table_id = reader.read("!B")[0] |
| 12666 | obj.cookie = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12667 | obj.match = common.match.unpack(reader) |
| 12668 | reader.skip(2) |
| 12669 | obj.data = str(reader.read_all()) |
| 12670 | return obj |
| 12671 | |
| 12672 | def __eq__(self, other): |
| 12673 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12674 | if self.xid != other.xid: return False |
| 12675 | if self.buffer_id != other.buffer_id: return False |
| 12676 | if self.total_len != other.total_len: return False |
| 12677 | if self.reason != other.reason: return False |
| 12678 | if self.table_id != other.table_id: return False |
| 12679 | if self.cookie != other.cookie: return False |
| 12680 | if self.match != other.match: return False |
| 12681 | if self.data != other.data: return False |
| 12682 | return True |
| 12683 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12684 | def pretty_print(self, q): |
| 12685 | q.text("packet_in {") |
| 12686 | with q.group(): |
| 12687 | with q.indent(2): |
| 12688 | q.breakable() |
| 12689 | q.text("xid = "); |
| 12690 | if self.xid != None: |
| 12691 | q.text("%#x" % self.xid) |
| 12692 | else: |
| 12693 | q.text('None') |
| 12694 | q.text(","); q.breakable() |
| 12695 | q.text("buffer_id = "); |
| 12696 | q.text("%#x" % self.buffer_id) |
| 12697 | q.text(","); q.breakable() |
| 12698 | q.text("total_len = "); |
| 12699 | q.text("%#x" % self.total_len) |
| 12700 | q.text(","); q.breakable() |
| 12701 | q.text("reason = "); |
| 12702 | q.text("%#x" % self.reason) |
| 12703 | q.text(","); q.breakable() |
| 12704 | q.text("table_id = "); |
| 12705 | q.text("%#x" % self.table_id) |
| 12706 | q.text(","); q.breakable() |
| 12707 | q.text("cookie = "); |
| 12708 | q.text("%#x" % self.cookie) |
| 12709 | q.text(","); q.breakable() |
| 12710 | q.text("match = "); |
| 12711 | q.pp(self.match) |
| 12712 | q.text(","); q.breakable() |
| 12713 | q.text("data = "); |
| 12714 | q.pp(self.data) |
| 12715 | q.breakable() |
| 12716 | q.text('}') |
| 12717 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12718 | message.subtypes[10] = packet_in |
| 12719 | |
| 12720 | class packet_out(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12721 | version = 4 |
| 12722 | type = 13 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12723 | |
| 12724 | 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] | 12725 | if xid != None: |
| 12726 | self.xid = xid |
| 12727 | else: |
| 12728 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12729 | if buffer_id != None: |
| 12730 | self.buffer_id = buffer_id |
| 12731 | else: |
| 12732 | self.buffer_id = 0 |
| 12733 | if in_port != None: |
| 12734 | self.in_port = in_port |
| 12735 | else: |
| 12736 | self.in_port = 0 |
| 12737 | if actions != None: |
| 12738 | self.actions = actions |
| 12739 | else: |
| 12740 | self.actions = [] |
| 12741 | if data != None: |
| 12742 | self.data = data |
| 12743 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12744 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12745 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12746 | |
| 12747 | def pack(self): |
| 12748 | packed = [] |
| 12749 | packed.append(struct.pack("!B", self.version)) |
| 12750 | packed.append(struct.pack("!B", self.type)) |
| 12751 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12752 | packed.append(struct.pack("!L", self.xid)) |
| 12753 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12754 | packed.append(util.pack_port_no(self.in_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12755 | packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6 |
| 12756 | packed.append('\x00' * 6) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12757 | packed.append(loxi.generic_util.pack_list(self.actions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12758 | packed[6] = struct.pack("!H", len(packed[-1])) |
| 12759 | packed.append(self.data) |
| 12760 | length = sum([len(x) for x in packed]) |
| 12761 | packed[2] = struct.pack("!H", length) |
| 12762 | return ''.join(packed) |
| 12763 | |
| 12764 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12765 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12766 | obj = packet_out() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12767 | _version = reader.read("!B")[0] |
| 12768 | assert(_version == 4) |
| 12769 | _type = reader.read("!B")[0] |
| 12770 | assert(_type == 13) |
| 12771 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12772 | orig_reader = reader |
| 12773 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12774 | obj.xid = reader.read("!L")[0] |
| 12775 | obj.buffer_id = reader.read("!L")[0] |
| 12776 | obj.in_port = util.unpack_port_no(reader) |
| 12777 | _actions_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12778 | reader.skip(6) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12779 | 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] | 12780 | obj.data = str(reader.read_all()) |
| 12781 | return obj |
| 12782 | |
| 12783 | def __eq__(self, other): |
| 12784 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12785 | if self.xid != other.xid: return False |
| 12786 | if self.buffer_id != other.buffer_id: return False |
| 12787 | if self.in_port != other.in_port: return False |
| 12788 | if self.actions != other.actions: return False |
| 12789 | if self.data != other.data: return False |
| 12790 | return True |
| 12791 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12792 | def pretty_print(self, q): |
| 12793 | q.text("packet_out {") |
| 12794 | with q.group(): |
| 12795 | with q.indent(2): |
| 12796 | q.breakable() |
| 12797 | q.text("xid = "); |
| 12798 | if self.xid != None: |
| 12799 | q.text("%#x" % self.xid) |
| 12800 | else: |
| 12801 | q.text('None') |
| 12802 | q.text(","); q.breakable() |
| 12803 | q.text("buffer_id = "); |
| 12804 | q.text("%#x" % self.buffer_id) |
| 12805 | q.text(","); q.breakable() |
| 12806 | q.text("in_port = "); |
| 12807 | q.text(util.pretty_port(self.in_port)) |
| 12808 | q.text(","); q.breakable() |
| 12809 | q.text("actions = "); |
| 12810 | q.pp(self.actions) |
| 12811 | q.text(","); q.breakable() |
| 12812 | q.text("data = "); |
| 12813 | q.pp(self.data) |
| 12814 | q.breakable() |
| 12815 | q.text('}') |
| 12816 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12817 | message.subtypes[13] = packet_out |
| 12818 | |
| 12819 | class port_desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12820 | version = 4 |
| 12821 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12822 | stats_type = 13 |
| 12823 | |
| 12824 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12825 | if xid != None: |
| 12826 | self.xid = xid |
| 12827 | else: |
| 12828 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12829 | if flags != None: |
| 12830 | self.flags = flags |
| 12831 | else: |
| 12832 | self.flags = 0 |
| 12833 | if entries != None: |
| 12834 | self.entries = entries |
| 12835 | else: |
| 12836 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12837 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12838 | |
| 12839 | def pack(self): |
| 12840 | packed = [] |
| 12841 | packed.append(struct.pack("!B", self.version)) |
| 12842 | packed.append(struct.pack("!B", self.type)) |
| 12843 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12844 | packed.append(struct.pack("!L", self.xid)) |
| 12845 | packed.append(struct.pack("!H", self.stats_type)) |
| 12846 | packed.append(struct.pack("!H", self.flags)) |
| 12847 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12848 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12849 | length = sum([len(x) for x in packed]) |
| 12850 | packed[2] = struct.pack("!H", length) |
| 12851 | return ''.join(packed) |
| 12852 | |
| 12853 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12854 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12855 | obj = port_desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12856 | _version = reader.read("!B")[0] |
| 12857 | assert(_version == 4) |
| 12858 | _type = reader.read("!B")[0] |
| 12859 | assert(_type == 19) |
| 12860 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12861 | orig_reader = reader |
| 12862 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12863 | obj.xid = reader.read("!L")[0] |
| 12864 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12865 | assert(_stats_type == 13) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12866 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12867 | reader.skip(4) |
| 12868 | obj.entries = loxi.generic_util.unpack_list(reader, common.port_desc.unpack) |
| 12869 | return obj |
| 12870 | |
| 12871 | def __eq__(self, other): |
| 12872 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12873 | if self.xid != other.xid: return False |
| 12874 | if self.flags != other.flags: return False |
| 12875 | if self.entries != other.entries: return False |
| 12876 | return True |
| 12877 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12878 | def pretty_print(self, q): |
| 12879 | q.text("port_desc_stats_reply {") |
| 12880 | with q.group(): |
| 12881 | with q.indent(2): |
| 12882 | q.breakable() |
| 12883 | q.text("xid = "); |
| 12884 | if self.xid != None: |
| 12885 | q.text("%#x" % self.xid) |
| 12886 | else: |
| 12887 | q.text('None') |
| 12888 | q.text(","); q.breakable() |
| 12889 | q.text("flags = "); |
| 12890 | q.text("%#x" % self.flags) |
| 12891 | q.text(","); q.breakable() |
| 12892 | q.text("entries = "); |
| 12893 | q.pp(self.entries) |
| 12894 | q.breakable() |
| 12895 | q.text('}') |
| 12896 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12897 | stats_reply.subtypes[13] = port_desc_stats_reply |
| 12898 | |
| 12899 | class port_desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12900 | version = 4 |
| 12901 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12902 | stats_type = 13 |
| 12903 | |
| 12904 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12905 | if xid != None: |
| 12906 | self.xid = xid |
| 12907 | else: |
| 12908 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12909 | if flags != None: |
| 12910 | self.flags = flags |
| 12911 | else: |
| 12912 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12913 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12914 | |
| 12915 | def pack(self): |
| 12916 | packed = [] |
| 12917 | packed.append(struct.pack("!B", self.version)) |
| 12918 | packed.append(struct.pack("!B", self.type)) |
| 12919 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12920 | packed.append(struct.pack("!L", self.xid)) |
| 12921 | packed.append(struct.pack("!H", self.stats_type)) |
| 12922 | packed.append(struct.pack("!H", self.flags)) |
| 12923 | packed.append('\x00' * 4) |
| 12924 | length = sum([len(x) for x in packed]) |
| 12925 | packed[2] = struct.pack("!H", length) |
| 12926 | return ''.join(packed) |
| 12927 | |
| 12928 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12929 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12930 | obj = port_desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12931 | _version = reader.read("!B")[0] |
| 12932 | assert(_version == 4) |
| 12933 | _type = reader.read("!B")[0] |
| 12934 | assert(_type == 18) |
| 12935 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12936 | orig_reader = reader |
| 12937 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12938 | obj.xid = reader.read("!L")[0] |
| 12939 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12940 | assert(_stats_type == 13) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12941 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12942 | reader.skip(4) |
| 12943 | return obj |
| 12944 | |
| 12945 | def __eq__(self, other): |
| 12946 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12947 | if self.xid != other.xid: return False |
| 12948 | if self.flags != other.flags: return False |
| 12949 | return True |
| 12950 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12951 | def pretty_print(self, q): |
| 12952 | q.text("port_desc_stats_request {") |
| 12953 | with q.group(): |
| 12954 | with q.indent(2): |
| 12955 | q.breakable() |
| 12956 | q.text("xid = "); |
| 12957 | if self.xid != None: |
| 12958 | q.text("%#x" % self.xid) |
| 12959 | else: |
| 12960 | q.text('None') |
| 12961 | q.text(","); q.breakable() |
| 12962 | q.text("flags = "); |
| 12963 | q.text("%#x" % self.flags) |
| 12964 | q.breakable() |
| 12965 | q.text('}') |
| 12966 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12967 | stats_request.subtypes[13] = port_desc_stats_request |
| 12968 | |
| 12969 | class port_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12970 | version = 4 |
| 12971 | type = 16 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12972 | |
| 12973 | 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] | 12974 | if xid != None: |
| 12975 | self.xid = xid |
| 12976 | else: |
| 12977 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12978 | if port_no != None: |
| 12979 | self.port_no = port_no |
| 12980 | else: |
| 12981 | self.port_no = 0 |
| 12982 | if hw_addr != None: |
| 12983 | self.hw_addr = hw_addr |
| 12984 | else: |
| 12985 | self.hw_addr = [0,0,0,0,0,0] |
| 12986 | if config != None: |
| 12987 | self.config = config |
| 12988 | else: |
| 12989 | self.config = 0 |
| 12990 | if mask != None: |
| 12991 | self.mask = mask |
| 12992 | else: |
| 12993 | self.mask = 0 |
| 12994 | if advertise != None: |
| 12995 | self.advertise = advertise |
| 12996 | else: |
| 12997 | self.advertise = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12998 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12999 | |
| 13000 | def pack(self): |
| 13001 | packed = [] |
| 13002 | packed.append(struct.pack("!B", self.version)) |
| 13003 | packed.append(struct.pack("!B", self.type)) |
| 13004 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13005 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13006 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13007 | packed.append('\x00' * 4) |
| 13008 | packed.append(struct.pack("!6B", *self.hw_addr)) |
| 13009 | packed.append('\x00' * 2) |
| 13010 | packed.append(struct.pack("!L", self.config)) |
| 13011 | packed.append(struct.pack("!L", self.mask)) |
| 13012 | packed.append(struct.pack("!L", self.advertise)) |
| 13013 | packed.append('\x00' * 4) |
| 13014 | length = sum([len(x) for x in packed]) |
| 13015 | packed[2] = struct.pack("!H", length) |
| 13016 | return ''.join(packed) |
| 13017 | |
| 13018 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13019 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13020 | obj = port_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13021 | _version = reader.read("!B")[0] |
| 13022 | assert(_version == 4) |
| 13023 | _type = reader.read("!B")[0] |
| 13024 | assert(_type == 16) |
| 13025 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13026 | orig_reader = reader |
| 13027 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13028 | obj.xid = reader.read("!L")[0] |
| 13029 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13030 | reader.skip(4) |
| 13031 | obj.hw_addr = list(reader.read('!6B')) |
| 13032 | reader.skip(2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13033 | obj.config = reader.read("!L")[0] |
| 13034 | obj.mask = reader.read("!L")[0] |
| 13035 | obj.advertise = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13036 | reader.skip(4) |
| 13037 | return obj |
| 13038 | |
| 13039 | def __eq__(self, other): |
| 13040 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13041 | if self.xid != other.xid: return False |
| 13042 | if self.port_no != other.port_no: return False |
| 13043 | if self.hw_addr != other.hw_addr: return False |
| 13044 | if self.config != other.config: return False |
| 13045 | if self.mask != other.mask: return False |
| 13046 | if self.advertise != other.advertise: return False |
| 13047 | return True |
| 13048 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13049 | def pretty_print(self, q): |
| 13050 | q.text("port_mod {") |
| 13051 | with q.group(): |
| 13052 | with q.indent(2): |
| 13053 | q.breakable() |
| 13054 | q.text("xid = "); |
| 13055 | if self.xid != None: |
| 13056 | q.text("%#x" % self.xid) |
| 13057 | else: |
| 13058 | q.text('None') |
| 13059 | q.text(","); q.breakable() |
| 13060 | q.text("port_no = "); |
| 13061 | q.text(util.pretty_port(self.port_no)) |
| 13062 | q.text(","); q.breakable() |
| 13063 | q.text("hw_addr = "); |
| 13064 | q.text(util.pretty_mac(self.hw_addr)) |
| 13065 | q.text(","); q.breakable() |
| 13066 | q.text("config = "); |
| 13067 | q.text("%#x" % self.config) |
| 13068 | q.text(","); q.breakable() |
| 13069 | q.text("mask = "); |
| 13070 | q.text("%#x" % self.mask) |
| 13071 | q.text(","); q.breakable() |
| 13072 | q.text("advertise = "); |
| 13073 | q.text("%#x" % self.advertise) |
| 13074 | q.breakable() |
| 13075 | q.text('}') |
| 13076 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13077 | message.subtypes[16] = port_mod |
| 13078 | |
| 13079 | class port_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13080 | version = 4 |
| 13081 | type = 1 |
| 13082 | err_type = 7 |
| 13083 | |
| 13084 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13085 | if xid != None: |
| 13086 | self.xid = xid |
| 13087 | else: |
| 13088 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13089 | if code != None: |
| 13090 | self.code = code |
| 13091 | else: |
| 13092 | self.code = 0 |
| 13093 | if data != None: |
| 13094 | self.data = data |
| 13095 | else: |
| 13096 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13097 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13098 | |
| 13099 | def pack(self): |
| 13100 | packed = [] |
| 13101 | packed.append(struct.pack("!B", self.version)) |
| 13102 | packed.append(struct.pack("!B", self.type)) |
| 13103 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13104 | packed.append(struct.pack("!L", self.xid)) |
| 13105 | packed.append(struct.pack("!H", self.err_type)) |
| 13106 | packed.append(struct.pack("!H", self.code)) |
| 13107 | packed.append(self.data) |
| 13108 | length = sum([len(x) for x in packed]) |
| 13109 | packed[2] = struct.pack("!H", length) |
| 13110 | return ''.join(packed) |
| 13111 | |
| 13112 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13113 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13114 | obj = port_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13115 | _version = reader.read("!B")[0] |
| 13116 | assert(_version == 4) |
| 13117 | _type = reader.read("!B")[0] |
| 13118 | assert(_type == 1) |
| 13119 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13120 | orig_reader = reader |
| 13121 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13122 | obj.xid = reader.read("!L")[0] |
| 13123 | _err_type = reader.read("!H")[0] |
| 13124 | assert(_err_type == 7) |
| 13125 | obj.code = reader.read("!H")[0] |
| 13126 | obj.data = str(reader.read_all()) |
| 13127 | return obj |
| 13128 | |
| 13129 | def __eq__(self, other): |
| 13130 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13131 | if self.xid != other.xid: return False |
| 13132 | if self.code != other.code: return False |
| 13133 | if self.data != other.data: return False |
| 13134 | return True |
| 13135 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13136 | def pretty_print(self, q): |
| 13137 | q.text("port_mod_failed_error_msg {") |
| 13138 | with q.group(): |
| 13139 | with q.indent(2): |
| 13140 | q.breakable() |
| 13141 | q.text("xid = "); |
| 13142 | if self.xid != None: |
| 13143 | q.text("%#x" % self.xid) |
| 13144 | else: |
| 13145 | q.text('None') |
| 13146 | q.text(","); q.breakable() |
| 13147 | q.text("code = "); |
| 13148 | q.text("%#x" % self.code) |
| 13149 | q.text(","); q.breakable() |
| 13150 | q.text("data = "); |
| 13151 | q.pp(self.data) |
| 13152 | q.breakable() |
| 13153 | q.text('}') |
| 13154 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13155 | error_msg.subtypes[7] = port_mod_failed_error_msg |
| 13156 | |
| 13157 | class port_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13158 | version = 4 |
| 13159 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13160 | stats_type = 4 |
| 13161 | |
| 13162 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13163 | if xid != None: |
| 13164 | self.xid = xid |
| 13165 | else: |
| 13166 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13167 | if flags != None: |
| 13168 | self.flags = flags |
| 13169 | else: |
| 13170 | self.flags = 0 |
| 13171 | if entries != None: |
| 13172 | self.entries = entries |
| 13173 | else: |
| 13174 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13175 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13176 | |
| 13177 | def pack(self): |
| 13178 | packed = [] |
| 13179 | packed.append(struct.pack("!B", self.version)) |
| 13180 | packed.append(struct.pack("!B", self.type)) |
| 13181 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13182 | packed.append(struct.pack("!L", self.xid)) |
| 13183 | packed.append(struct.pack("!H", self.stats_type)) |
| 13184 | packed.append(struct.pack("!H", self.flags)) |
| 13185 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13186 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13187 | length = sum([len(x) for x in packed]) |
| 13188 | packed[2] = struct.pack("!H", length) |
| 13189 | return ''.join(packed) |
| 13190 | |
| 13191 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13192 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13193 | obj = port_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13194 | _version = reader.read("!B")[0] |
| 13195 | assert(_version == 4) |
| 13196 | _type = reader.read("!B")[0] |
| 13197 | assert(_type == 19) |
| 13198 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13199 | orig_reader = reader |
| 13200 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13201 | obj.xid = reader.read("!L")[0] |
| 13202 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13203 | assert(_stats_type == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13204 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13205 | reader.skip(4) |
| 13206 | obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack) |
| 13207 | return obj |
| 13208 | |
| 13209 | def __eq__(self, other): |
| 13210 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13211 | if self.xid != other.xid: return False |
| 13212 | if self.flags != other.flags: return False |
| 13213 | if self.entries != other.entries: return False |
| 13214 | return True |
| 13215 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13216 | def pretty_print(self, q): |
| 13217 | q.text("port_stats_reply {") |
| 13218 | with q.group(): |
| 13219 | with q.indent(2): |
| 13220 | q.breakable() |
| 13221 | q.text("xid = "); |
| 13222 | if self.xid != None: |
| 13223 | q.text("%#x" % self.xid) |
| 13224 | else: |
| 13225 | q.text('None') |
| 13226 | q.text(","); q.breakable() |
| 13227 | q.text("flags = "); |
| 13228 | q.text("%#x" % self.flags) |
| 13229 | q.text(","); q.breakable() |
| 13230 | q.text("entries = "); |
| 13231 | q.pp(self.entries) |
| 13232 | q.breakable() |
| 13233 | q.text('}') |
| 13234 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13235 | stats_reply.subtypes[4] = port_stats_reply |
| 13236 | |
| 13237 | class port_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13238 | version = 4 |
| 13239 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13240 | stats_type = 4 |
| 13241 | |
| 13242 | def __init__(self, xid=None, flags=None, port_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13243 | if xid != None: |
| 13244 | self.xid = xid |
| 13245 | else: |
| 13246 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13247 | if flags != None: |
| 13248 | self.flags = flags |
| 13249 | else: |
| 13250 | self.flags = 0 |
| 13251 | if port_no != None: |
| 13252 | self.port_no = port_no |
| 13253 | else: |
| 13254 | self.port_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13255 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13256 | |
| 13257 | def pack(self): |
| 13258 | packed = [] |
| 13259 | packed.append(struct.pack("!B", self.version)) |
| 13260 | packed.append(struct.pack("!B", self.type)) |
| 13261 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13262 | packed.append(struct.pack("!L", self.xid)) |
| 13263 | packed.append(struct.pack("!H", self.stats_type)) |
| 13264 | packed.append(struct.pack("!H", self.flags)) |
| 13265 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13266 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13267 | packed.append('\x00' * 4) |
| 13268 | length = sum([len(x) for x in packed]) |
| 13269 | packed[2] = struct.pack("!H", length) |
| 13270 | return ''.join(packed) |
| 13271 | |
| 13272 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13273 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13274 | obj = port_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13275 | _version = reader.read("!B")[0] |
| 13276 | assert(_version == 4) |
| 13277 | _type = reader.read("!B")[0] |
| 13278 | assert(_type == 18) |
| 13279 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13280 | orig_reader = reader |
| 13281 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13282 | obj.xid = reader.read("!L")[0] |
| 13283 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13284 | assert(_stats_type == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13285 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13286 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13287 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13288 | reader.skip(4) |
| 13289 | return obj |
| 13290 | |
| 13291 | def __eq__(self, other): |
| 13292 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13293 | if self.xid != other.xid: return False |
| 13294 | if self.flags != other.flags: return False |
| 13295 | if self.port_no != other.port_no: return False |
| 13296 | return True |
| 13297 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13298 | def pretty_print(self, q): |
| 13299 | q.text("port_stats_request {") |
| 13300 | with q.group(): |
| 13301 | with q.indent(2): |
| 13302 | q.breakable() |
| 13303 | q.text("xid = "); |
| 13304 | if self.xid != None: |
| 13305 | q.text("%#x" % self.xid) |
| 13306 | else: |
| 13307 | q.text('None') |
| 13308 | q.text(","); q.breakable() |
| 13309 | q.text("flags = "); |
| 13310 | q.text("%#x" % self.flags) |
| 13311 | q.text(","); q.breakable() |
| 13312 | q.text("port_no = "); |
| 13313 | q.text(util.pretty_port(self.port_no)) |
| 13314 | q.breakable() |
| 13315 | q.text('}') |
| 13316 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13317 | stats_request.subtypes[4] = port_stats_request |
| 13318 | |
| 13319 | class port_status(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13320 | version = 4 |
| 13321 | type = 12 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13322 | |
| 13323 | def __init__(self, xid=None, reason=None, desc=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13324 | if xid != None: |
| 13325 | self.xid = xid |
| 13326 | else: |
| 13327 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13328 | if reason != None: |
| 13329 | self.reason = reason |
| 13330 | else: |
| 13331 | self.reason = 0 |
| 13332 | if desc != None: |
| 13333 | self.desc = desc |
| 13334 | else: |
| 13335 | self.desc = common.port_desc() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13336 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13337 | |
| 13338 | def pack(self): |
| 13339 | packed = [] |
| 13340 | packed.append(struct.pack("!B", self.version)) |
| 13341 | packed.append(struct.pack("!B", self.type)) |
| 13342 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13343 | packed.append(struct.pack("!L", self.xid)) |
| 13344 | packed.append(struct.pack("!B", self.reason)) |
| 13345 | packed.append('\x00' * 7) |
| 13346 | packed.append(self.desc.pack()) |
| 13347 | length = sum([len(x) for x in packed]) |
| 13348 | packed[2] = struct.pack("!H", length) |
| 13349 | return ''.join(packed) |
| 13350 | |
| 13351 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13352 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13353 | obj = port_status() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13354 | _version = reader.read("!B")[0] |
| 13355 | assert(_version == 4) |
| 13356 | _type = reader.read("!B")[0] |
| 13357 | assert(_type == 12) |
| 13358 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13359 | orig_reader = reader |
| 13360 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13361 | obj.xid = reader.read("!L")[0] |
| 13362 | obj.reason = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13363 | reader.skip(7) |
| 13364 | obj.desc = common.port_desc.unpack(reader) |
| 13365 | return obj |
| 13366 | |
| 13367 | def __eq__(self, other): |
| 13368 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13369 | if self.xid != other.xid: return False |
| 13370 | if self.reason != other.reason: return False |
| 13371 | if self.desc != other.desc: return False |
| 13372 | return True |
| 13373 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13374 | def pretty_print(self, q): |
| 13375 | q.text("port_status {") |
| 13376 | with q.group(): |
| 13377 | with q.indent(2): |
| 13378 | q.breakable() |
| 13379 | q.text("xid = "); |
| 13380 | if self.xid != None: |
| 13381 | q.text("%#x" % self.xid) |
| 13382 | else: |
| 13383 | q.text('None') |
| 13384 | q.text(","); q.breakable() |
| 13385 | q.text("reason = "); |
| 13386 | q.text("%#x" % self.reason) |
| 13387 | q.text(","); q.breakable() |
| 13388 | q.text("desc = "); |
| 13389 | q.pp(self.desc) |
| 13390 | q.breakable() |
| 13391 | q.text('}') |
| 13392 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13393 | message.subtypes[12] = port_status |
| 13394 | |
| 13395 | class queue_get_config_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13396 | version = 4 |
| 13397 | type = 23 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13398 | |
| 13399 | def __init__(self, xid=None, port=None, queues=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13400 | if xid != None: |
| 13401 | self.xid = xid |
| 13402 | else: |
| 13403 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13404 | if port != None: |
| 13405 | self.port = port |
| 13406 | else: |
| 13407 | self.port = 0 |
| 13408 | if queues != None: |
| 13409 | self.queues = queues |
| 13410 | else: |
| 13411 | self.queues = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13412 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13413 | |
| 13414 | def pack(self): |
| 13415 | packed = [] |
| 13416 | packed.append(struct.pack("!B", self.version)) |
| 13417 | packed.append(struct.pack("!B", self.type)) |
| 13418 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13419 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13420 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13421 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13422 | packed.append(loxi.generic_util.pack_list(self.queues)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13423 | length = sum([len(x) for x in packed]) |
| 13424 | packed[2] = struct.pack("!H", length) |
| 13425 | return ''.join(packed) |
| 13426 | |
| 13427 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13428 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13429 | obj = queue_get_config_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13430 | _version = reader.read("!B")[0] |
| 13431 | assert(_version == 4) |
| 13432 | _type = reader.read("!B")[0] |
| 13433 | assert(_type == 23) |
| 13434 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13435 | orig_reader = reader |
| 13436 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13437 | obj.xid = reader.read("!L")[0] |
| 13438 | obj.port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13439 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13440 | obj.queues = loxi.generic_util.unpack_list(reader, common.packet_queue.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13441 | return obj |
| 13442 | |
| 13443 | def __eq__(self, other): |
| 13444 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13445 | if self.xid != other.xid: return False |
| 13446 | if self.port != other.port: return False |
| 13447 | if self.queues != other.queues: return False |
| 13448 | return True |
| 13449 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13450 | def pretty_print(self, q): |
| 13451 | q.text("queue_get_config_reply {") |
| 13452 | with q.group(): |
| 13453 | with q.indent(2): |
| 13454 | q.breakable() |
| 13455 | q.text("xid = "); |
| 13456 | if self.xid != None: |
| 13457 | q.text("%#x" % self.xid) |
| 13458 | else: |
| 13459 | q.text('None') |
| 13460 | q.text(","); q.breakable() |
| 13461 | q.text("port = "); |
| 13462 | q.text(util.pretty_port(self.port)) |
| 13463 | q.text(","); q.breakable() |
| 13464 | q.text("queues = "); |
| 13465 | q.pp(self.queues) |
| 13466 | q.breakable() |
| 13467 | q.text('}') |
| 13468 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13469 | message.subtypes[23] = queue_get_config_reply |
| 13470 | |
| 13471 | class queue_get_config_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13472 | version = 4 |
| 13473 | type = 22 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13474 | |
| 13475 | def __init__(self, xid=None, port=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13476 | if xid != None: |
| 13477 | self.xid = xid |
| 13478 | else: |
| 13479 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13480 | if port != None: |
| 13481 | self.port = port |
| 13482 | else: |
| 13483 | self.port = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13484 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13485 | |
| 13486 | def pack(self): |
| 13487 | packed = [] |
| 13488 | packed.append(struct.pack("!B", self.version)) |
| 13489 | packed.append(struct.pack("!B", self.type)) |
| 13490 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13491 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13492 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13493 | packed.append('\x00' * 4) |
| 13494 | length = sum([len(x) for x in packed]) |
| 13495 | packed[2] = struct.pack("!H", length) |
| 13496 | return ''.join(packed) |
| 13497 | |
| 13498 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13499 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13500 | obj = queue_get_config_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13501 | _version = reader.read("!B")[0] |
| 13502 | assert(_version == 4) |
| 13503 | _type = reader.read("!B")[0] |
| 13504 | assert(_type == 22) |
| 13505 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13506 | orig_reader = reader |
| 13507 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13508 | obj.xid = reader.read("!L")[0] |
| 13509 | obj.port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13510 | reader.skip(4) |
| 13511 | return obj |
| 13512 | |
| 13513 | def __eq__(self, other): |
| 13514 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13515 | if self.xid != other.xid: return False |
| 13516 | if self.port != other.port: return False |
| 13517 | return True |
| 13518 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13519 | def pretty_print(self, q): |
| 13520 | q.text("queue_get_config_request {") |
| 13521 | with q.group(): |
| 13522 | with q.indent(2): |
| 13523 | q.breakable() |
| 13524 | q.text("xid = "); |
| 13525 | if self.xid != None: |
| 13526 | q.text("%#x" % self.xid) |
| 13527 | else: |
| 13528 | q.text('None') |
| 13529 | q.text(","); q.breakable() |
| 13530 | q.text("port = "); |
| 13531 | q.text(util.pretty_port(self.port)) |
| 13532 | q.breakable() |
| 13533 | q.text('}') |
| 13534 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13535 | message.subtypes[22] = queue_get_config_request |
| 13536 | |
| 13537 | class queue_op_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13538 | version = 4 |
| 13539 | type = 1 |
| 13540 | err_type = 9 |
| 13541 | |
| 13542 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13543 | if xid != None: |
| 13544 | self.xid = xid |
| 13545 | else: |
| 13546 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13547 | if code != None: |
| 13548 | self.code = code |
| 13549 | else: |
| 13550 | self.code = 0 |
| 13551 | if data != None: |
| 13552 | self.data = data |
| 13553 | else: |
| 13554 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13555 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13556 | |
| 13557 | def pack(self): |
| 13558 | packed = [] |
| 13559 | packed.append(struct.pack("!B", self.version)) |
| 13560 | packed.append(struct.pack("!B", self.type)) |
| 13561 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13562 | packed.append(struct.pack("!L", self.xid)) |
| 13563 | packed.append(struct.pack("!H", self.err_type)) |
| 13564 | packed.append(struct.pack("!H", self.code)) |
| 13565 | packed.append(self.data) |
| 13566 | length = sum([len(x) for x in packed]) |
| 13567 | packed[2] = struct.pack("!H", length) |
| 13568 | return ''.join(packed) |
| 13569 | |
| 13570 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13571 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13572 | obj = queue_op_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13573 | _version = reader.read("!B")[0] |
| 13574 | assert(_version == 4) |
| 13575 | _type = reader.read("!B")[0] |
| 13576 | assert(_type == 1) |
| 13577 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13578 | orig_reader = reader |
| 13579 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13580 | obj.xid = reader.read("!L")[0] |
| 13581 | _err_type = reader.read("!H")[0] |
| 13582 | assert(_err_type == 9) |
| 13583 | obj.code = reader.read("!H")[0] |
| 13584 | obj.data = str(reader.read_all()) |
| 13585 | return obj |
| 13586 | |
| 13587 | def __eq__(self, other): |
| 13588 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13589 | if self.xid != other.xid: return False |
| 13590 | if self.code != other.code: return False |
| 13591 | if self.data != other.data: return False |
| 13592 | return True |
| 13593 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13594 | def pretty_print(self, q): |
| 13595 | q.text("queue_op_failed_error_msg {") |
| 13596 | with q.group(): |
| 13597 | with q.indent(2): |
| 13598 | q.breakable() |
| 13599 | q.text("xid = "); |
| 13600 | if self.xid != None: |
| 13601 | q.text("%#x" % self.xid) |
| 13602 | else: |
| 13603 | q.text('None') |
| 13604 | q.text(","); q.breakable() |
| 13605 | q.text("code = "); |
| 13606 | q.text("%#x" % self.code) |
| 13607 | q.text(","); q.breakable() |
| 13608 | q.text("data = "); |
| 13609 | q.pp(self.data) |
| 13610 | q.breakable() |
| 13611 | q.text('}') |
| 13612 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13613 | error_msg.subtypes[9] = queue_op_failed_error_msg |
| 13614 | |
| 13615 | class queue_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13616 | version = 4 |
| 13617 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13618 | stats_type = 5 |
| 13619 | |
| 13620 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13621 | if xid != None: |
| 13622 | self.xid = xid |
| 13623 | else: |
| 13624 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13625 | if flags != None: |
| 13626 | self.flags = flags |
| 13627 | else: |
| 13628 | self.flags = 0 |
| 13629 | if entries != None: |
| 13630 | self.entries = entries |
| 13631 | else: |
| 13632 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13633 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13634 | |
| 13635 | def pack(self): |
| 13636 | packed = [] |
| 13637 | packed.append(struct.pack("!B", self.version)) |
| 13638 | packed.append(struct.pack("!B", self.type)) |
| 13639 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13640 | packed.append(struct.pack("!L", self.xid)) |
| 13641 | packed.append(struct.pack("!H", self.stats_type)) |
| 13642 | packed.append(struct.pack("!H", self.flags)) |
| 13643 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13644 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13645 | length = sum([len(x) for x in packed]) |
| 13646 | packed[2] = struct.pack("!H", length) |
| 13647 | return ''.join(packed) |
| 13648 | |
| 13649 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13650 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13651 | obj = queue_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13652 | _version = reader.read("!B")[0] |
| 13653 | assert(_version == 4) |
| 13654 | _type = reader.read("!B")[0] |
| 13655 | assert(_type == 19) |
| 13656 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13657 | orig_reader = reader |
| 13658 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13659 | obj.xid = reader.read("!L")[0] |
| 13660 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13661 | assert(_stats_type == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13662 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13663 | reader.skip(4) |
| 13664 | obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack) |
| 13665 | return obj |
| 13666 | |
| 13667 | def __eq__(self, other): |
| 13668 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13669 | if self.xid != other.xid: return False |
| 13670 | if self.flags != other.flags: return False |
| 13671 | if self.entries != other.entries: return False |
| 13672 | return True |
| 13673 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13674 | def pretty_print(self, q): |
| 13675 | q.text("queue_stats_reply {") |
| 13676 | with q.group(): |
| 13677 | with q.indent(2): |
| 13678 | q.breakable() |
| 13679 | q.text("xid = "); |
| 13680 | if self.xid != None: |
| 13681 | q.text("%#x" % self.xid) |
| 13682 | else: |
| 13683 | q.text('None') |
| 13684 | q.text(","); q.breakable() |
| 13685 | q.text("flags = "); |
| 13686 | q.text("%#x" % self.flags) |
| 13687 | q.text(","); q.breakable() |
| 13688 | q.text("entries = "); |
| 13689 | q.pp(self.entries) |
| 13690 | q.breakable() |
| 13691 | q.text('}') |
| 13692 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13693 | stats_reply.subtypes[5] = queue_stats_reply |
| 13694 | |
| 13695 | class queue_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13696 | version = 4 |
| 13697 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13698 | stats_type = 5 |
| 13699 | |
| 13700 | 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] | 13701 | if xid != None: |
| 13702 | self.xid = xid |
| 13703 | else: |
| 13704 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13705 | if flags != None: |
| 13706 | self.flags = flags |
| 13707 | else: |
| 13708 | self.flags = 0 |
| 13709 | if port_no != None: |
| 13710 | self.port_no = port_no |
| 13711 | else: |
| 13712 | self.port_no = 0 |
| 13713 | if queue_id != None: |
| 13714 | self.queue_id = queue_id |
| 13715 | else: |
| 13716 | self.queue_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13717 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13718 | |
| 13719 | def pack(self): |
| 13720 | packed = [] |
| 13721 | packed.append(struct.pack("!B", self.version)) |
| 13722 | packed.append(struct.pack("!B", self.type)) |
| 13723 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13724 | packed.append(struct.pack("!L", self.xid)) |
| 13725 | packed.append(struct.pack("!H", self.stats_type)) |
| 13726 | packed.append(struct.pack("!H", self.flags)) |
| 13727 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13728 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13729 | packed.append(struct.pack("!L", self.queue_id)) |
| 13730 | length = sum([len(x) for x in packed]) |
| 13731 | packed[2] = struct.pack("!H", length) |
| 13732 | return ''.join(packed) |
| 13733 | |
| 13734 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13735 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13736 | obj = queue_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13737 | _version = reader.read("!B")[0] |
| 13738 | assert(_version == 4) |
| 13739 | _type = reader.read("!B")[0] |
| 13740 | assert(_type == 18) |
| 13741 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13742 | orig_reader = reader |
| 13743 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13744 | obj.xid = reader.read("!L")[0] |
| 13745 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13746 | assert(_stats_type == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13747 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13748 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13749 | obj.port_no = util.unpack_port_no(reader) |
| 13750 | obj.queue_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13751 | return obj |
| 13752 | |
| 13753 | def __eq__(self, other): |
| 13754 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13755 | if self.xid != other.xid: return False |
| 13756 | if self.flags != other.flags: return False |
| 13757 | if self.port_no != other.port_no: return False |
| 13758 | if self.queue_id != other.queue_id: return False |
| 13759 | return True |
| 13760 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13761 | def pretty_print(self, q): |
| 13762 | q.text("queue_stats_request {") |
| 13763 | with q.group(): |
| 13764 | with q.indent(2): |
| 13765 | q.breakable() |
| 13766 | q.text("xid = "); |
| 13767 | if self.xid != None: |
| 13768 | q.text("%#x" % self.xid) |
| 13769 | else: |
| 13770 | q.text('None') |
| 13771 | q.text(","); q.breakable() |
| 13772 | q.text("flags = "); |
| 13773 | q.text("%#x" % self.flags) |
| 13774 | q.text(","); q.breakable() |
| 13775 | q.text("port_no = "); |
| 13776 | q.text(util.pretty_port(self.port_no)) |
| 13777 | q.text(","); q.breakable() |
| 13778 | q.text("queue_id = "); |
| 13779 | q.text("%#x" % self.queue_id) |
| 13780 | q.breakable() |
| 13781 | q.text('}') |
| 13782 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13783 | stats_request.subtypes[5] = queue_stats_request |
| 13784 | |
| 13785 | class role_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13786 | version = 4 |
| 13787 | type = 25 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13788 | |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 13789 | def __init__(self, xid=None, role=None, generation_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13790 | if xid != None: |
| 13791 | self.xid = xid |
| 13792 | else: |
| 13793 | self.xid = None |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 13794 | if role != None: |
| 13795 | self.role = role |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13796 | else: |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 13797 | self.role = 0 |
| 13798 | if generation_id != None: |
| 13799 | self.generation_id = generation_id |
| 13800 | else: |
| 13801 | self.generation_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13802 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13803 | |
| 13804 | def pack(self): |
| 13805 | packed = [] |
| 13806 | packed.append(struct.pack("!B", self.version)) |
| 13807 | packed.append(struct.pack("!B", self.type)) |
| 13808 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13809 | packed.append(struct.pack("!L", self.xid)) |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 13810 | packed.append(struct.pack("!L", self.role)) |
| 13811 | packed.append('\x00' * 4) |
| 13812 | packed.append(struct.pack("!Q", self.generation_id)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13813 | length = sum([len(x) for x in packed]) |
| 13814 | packed[2] = struct.pack("!H", length) |
| 13815 | return ''.join(packed) |
| 13816 | |
| 13817 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13818 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13819 | obj = role_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13820 | _version = reader.read("!B")[0] |
| 13821 | assert(_version == 4) |
| 13822 | _type = reader.read("!B")[0] |
| 13823 | assert(_type == 25) |
| 13824 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13825 | orig_reader = reader |
| 13826 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13827 | obj.xid = reader.read("!L")[0] |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 13828 | obj.role = reader.read("!L")[0] |
| 13829 | reader.skip(4) |
| 13830 | obj.generation_id = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13831 | return obj |
| 13832 | |
| 13833 | def __eq__(self, other): |
| 13834 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13835 | if self.xid != other.xid: return False |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 13836 | if self.role != other.role: return False |
| 13837 | if self.generation_id != other.generation_id: return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13838 | return True |
| 13839 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13840 | def pretty_print(self, q): |
| 13841 | q.text("role_reply {") |
| 13842 | with q.group(): |
| 13843 | with q.indent(2): |
| 13844 | q.breakable() |
| 13845 | q.text("xid = "); |
| 13846 | if self.xid != None: |
| 13847 | q.text("%#x" % self.xid) |
| 13848 | else: |
| 13849 | q.text('None') |
| 13850 | q.text(","); q.breakable() |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 13851 | q.text("role = "); |
| 13852 | q.text("%#x" % self.role) |
| 13853 | q.text(","); q.breakable() |
| 13854 | q.text("generation_id = "); |
| 13855 | q.text("%#x" % self.generation_id) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13856 | q.breakable() |
| 13857 | q.text('}') |
| 13858 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13859 | message.subtypes[25] = role_reply |
| 13860 | |
| 13861 | class role_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13862 | version = 4 |
| 13863 | type = 24 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13864 | |
| 13865 | def __init__(self, xid=None, role=None, generation_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13866 | if xid != None: |
| 13867 | self.xid = xid |
| 13868 | else: |
| 13869 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13870 | if role != None: |
| 13871 | self.role = role |
| 13872 | else: |
| 13873 | self.role = 0 |
| 13874 | if generation_id != None: |
| 13875 | self.generation_id = generation_id |
| 13876 | else: |
| 13877 | self.generation_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13878 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13879 | |
| 13880 | def pack(self): |
| 13881 | packed = [] |
| 13882 | packed.append(struct.pack("!B", self.version)) |
| 13883 | packed.append(struct.pack("!B", self.type)) |
| 13884 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13885 | packed.append(struct.pack("!L", self.xid)) |
| 13886 | packed.append(struct.pack("!L", self.role)) |
| 13887 | packed.append('\x00' * 4) |
| 13888 | packed.append(struct.pack("!Q", self.generation_id)) |
| 13889 | length = sum([len(x) for x in packed]) |
| 13890 | packed[2] = struct.pack("!H", length) |
| 13891 | return ''.join(packed) |
| 13892 | |
| 13893 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13894 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13895 | obj = role_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13896 | _version = reader.read("!B")[0] |
| 13897 | assert(_version == 4) |
| 13898 | _type = reader.read("!B")[0] |
| 13899 | assert(_type == 24) |
| 13900 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13901 | orig_reader = reader |
| 13902 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13903 | obj.xid = reader.read("!L")[0] |
| 13904 | obj.role = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13905 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13906 | obj.generation_id = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13907 | return obj |
| 13908 | |
| 13909 | def __eq__(self, other): |
| 13910 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13911 | if self.xid != other.xid: return False |
| 13912 | if self.role != other.role: return False |
| 13913 | if self.generation_id != other.generation_id: return False |
| 13914 | return True |
| 13915 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13916 | def pretty_print(self, q): |
| 13917 | q.text("role_request {") |
| 13918 | with q.group(): |
| 13919 | with q.indent(2): |
| 13920 | q.breakable() |
| 13921 | q.text("xid = "); |
| 13922 | if self.xid != None: |
| 13923 | q.text("%#x" % self.xid) |
| 13924 | else: |
| 13925 | q.text('None') |
| 13926 | q.text(","); q.breakable() |
| 13927 | q.text("role = "); |
| 13928 | q.text("%#x" % self.role) |
| 13929 | q.text(","); q.breakable() |
| 13930 | q.text("generation_id = "); |
| 13931 | q.text("%#x" % self.generation_id) |
| 13932 | q.breakable() |
| 13933 | q.text('}') |
| 13934 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13935 | message.subtypes[24] = role_request |
| 13936 | |
| 13937 | class role_request_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13938 | version = 4 |
| 13939 | type = 1 |
| 13940 | err_type = 11 |
| 13941 | |
| 13942 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13943 | if xid != None: |
| 13944 | self.xid = xid |
| 13945 | else: |
| 13946 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13947 | if code != None: |
| 13948 | self.code = code |
| 13949 | else: |
| 13950 | self.code = 0 |
| 13951 | if data != None: |
| 13952 | self.data = data |
| 13953 | else: |
| 13954 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13955 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13956 | |
| 13957 | def pack(self): |
| 13958 | packed = [] |
| 13959 | packed.append(struct.pack("!B", self.version)) |
| 13960 | packed.append(struct.pack("!B", self.type)) |
| 13961 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13962 | packed.append(struct.pack("!L", self.xid)) |
| 13963 | packed.append(struct.pack("!H", self.err_type)) |
| 13964 | packed.append(struct.pack("!H", self.code)) |
| 13965 | packed.append(self.data) |
| 13966 | length = sum([len(x) for x in packed]) |
| 13967 | packed[2] = struct.pack("!H", length) |
| 13968 | return ''.join(packed) |
| 13969 | |
| 13970 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13971 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13972 | obj = role_request_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13973 | _version = reader.read("!B")[0] |
| 13974 | assert(_version == 4) |
| 13975 | _type = reader.read("!B")[0] |
| 13976 | assert(_type == 1) |
| 13977 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13978 | orig_reader = reader |
| 13979 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13980 | obj.xid = reader.read("!L")[0] |
| 13981 | _err_type = reader.read("!H")[0] |
| 13982 | assert(_err_type == 11) |
| 13983 | obj.code = reader.read("!H")[0] |
| 13984 | obj.data = str(reader.read_all()) |
| 13985 | return obj |
| 13986 | |
| 13987 | def __eq__(self, other): |
| 13988 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13989 | if self.xid != other.xid: return False |
| 13990 | if self.code != other.code: return False |
| 13991 | if self.data != other.data: return False |
| 13992 | return True |
| 13993 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13994 | def pretty_print(self, q): |
| 13995 | q.text("role_request_failed_error_msg {") |
| 13996 | with q.group(): |
| 13997 | with q.indent(2): |
| 13998 | q.breakable() |
| 13999 | q.text("xid = "); |
| 14000 | if self.xid != None: |
| 14001 | q.text("%#x" % self.xid) |
| 14002 | else: |
| 14003 | q.text('None') |
| 14004 | q.text(","); q.breakable() |
| 14005 | q.text("code = "); |
| 14006 | q.text("%#x" % self.code) |
| 14007 | q.text(","); q.breakable() |
| 14008 | q.text("data = "); |
| 14009 | q.pp(self.data) |
| 14010 | q.breakable() |
| 14011 | q.text('}') |
| 14012 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14013 | error_msg.subtypes[11] = role_request_failed_error_msg |
| 14014 | |
| 14015 | class set_config(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14016 | version = 4 |
| 14017 | type = 9 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14018 | |
| 14019 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14020 | if xid != None: |
| 14021 | self.xid = xid |
| 14022 | else: |
| 14023 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14024 | if flags != None: |
| 14025 | self.flags = flags |
| 14026 | else: |
| 14027 | self.flags = 0 |
| 14028 | if miss_send_len != None: |
| 14029 | self.miss_send_len = miss_send_len |
| 14030 | else: |
| 14031 | self.miss_send_len = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14032 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14033 | |
| 14034 | def pack(self): |
| 14035 | packed = [] |
| 14036 | packed.append(struct.pack("!B", self.version)) |
| 14037 | packed.append(struct.pack("!B", self.type)) |
| 14038 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14039 | packed.append(struct.pack("!L", self.xid)) |
| 14040 | packed.append(struct.pack("!H", self.flags)) |
| 14041 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 14042 | length = sum([len(x) for x in packed]) |
| 14043 | packed[2] = struct.pack("!H", length) |
| 14044 | return ''.join(packed) |
| 14045 | |
| 14046 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14047 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14048 | obj = set_config() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14049 | _version = reader.read("!B")[0] |
| 14050 | assert(_version == 4) |
| 14051 | _type = reader.read("!B")[0] |
| 14052 | assert(_type == 9) |
| 14053 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14054 | orig_reader = reader |
| 14055 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14056 | obj.xid = reader.read("!L")[0] |
| 14057 | obj.flags = reader.read("!H")[0] |
| 14058 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14059 | return obj |
| 14060 | |
| 14061 | def __eq__(self, other): |
| 14062 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14063 | if self.xid != other.xid: return False |
| 14064 | if self.flags != other.flags: return False |
| 14065 | if self.miss_send_len != other.miss_send_len: return False |
| 14066 | return True |
| 14067 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14068 | def pretty_print(self, q): |
| 14069 | q.text("set_config {") |
| 14070 | with q.group(): |
| 14071 | with q.indent(2): |
| 14072 | q.breakable() |
| 14073 | q.text("xid = "); |
| 14074 | if self.xid != None: |
| 14075 | q.text("%#x" % self.xid) |
| 14076 | else: |
| 14077 | q.text('None') |
| 14078 | q.text(","); q.breakable() |
| 14079 | q.text("flags = "); |
| 14080 | q.text("%#x" % self.flags) |
| 14081 | q.text(","); q.breakable() |
| 14082 | q.text("miss_send_len = "); |
| 14083 | q.text("%#x" % self.miss_send_len) |
| 14084 | q.breakable() |
| 14085 | q.text('}') |
| 14086 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14087 | message.subtypes[9] = set_config |
| 14088 | |
| 14089 | class switch_config_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14090 | version = 4 |
| 14091 | type = 1 |
| 14092 | err_type = 10 |
| 14093 | |
| 14094 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14095 | if xid != None: |
| 14096 | self.xid = xid |
| 14097 | else: |
| 14098 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14099 | if code != None: |
| 14100 | self.code = code |
| 14101 | else: |
| 14102 | self.code = 0 |
| 14103 | if data != None: |
| 14104 | self.data = data |
| 14105 | else: |
| 14106 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14107 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14108 | |
| 14109 | def pack(self): |
| 14110 | packed = [] |
| 14111 | packed.append(struct.pack("!B", self.version)) |
| 14112 | packed.append(struct.pack("!B", self.type)) |
| 14113 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14114 | packed.append(struct.pack("!L", self.xid)) |
| 14115 | packed.append(struct.pack("!H", self.err_type)) |
| 14116 | packed.append(struct.pack("!H", self.code)) |
| 14117 | packed.append(self.data) |
| 14118 | length = sum([len(x) for x in packed]) |
| 14119 | packed[2] = struct.pack("!H", length) |
| 14120 | return ''.join(packed) |
| 14121 | |
| 14122 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14123 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14124 | obj = switch_config_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14125 | _version = reader.read("!B")[0] |
| 14126 | assert(_version == 4) |
| 14127 | _type = reader.read("!B")[0] |
| 14128 | assert(_type == 1) |
| 14129 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14130 | orig_reader = reader |
| 14131 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14132 | obj.xid = reader.read("!L")[0] |
| 14133 | _err_type = reader.read("!H")[0] |
| 14134 | assert(_err_type == 10) |
| 14135 | obj.code = reader.read("!H")[0] |
| 14136 | obj.data = str(reader.read_all()) |
| 14137 | return obj |
| 14138 | |
| 14139 | def __eq__(self, other): |
| 14140 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14141 | if self.xid != other.xid: return False |
| 14142 | if self.code != other.code: return False |
| 14143 | if self.data != other.data: return False |
| 14144 | return True |
| 14145 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14146 | def pretty_print(self, q): |
| 14147 | q.text("switch_config_failed_error_msg {") |
| 14148 | with q.group(): |
| 14149 | with q.indent(2): |
| 14150 | q.breakable() |
| 14151 | q.text("xid = "); |
| 14152 | if self.xid != None: |
| 14153 | q.text("%#x" % self.xid) |
| 14154 | else: |
| 14155 | q.text('None') |
| 14156 | q.text(","); q.breakable() |
| 14157 | q.text("code = "); |
| 14158 | q.text("%#x" % self.code) |
| 14159 | q.text(","); q.breakable() |
| 14160 | q.text("data = "); |
| 14161 | q.pp(self.data) |
| 14162 | q.breakable() |
| 14163 | q.text('}') |
| 14164 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14165 | error_msg.subtypes[10] = switch_config_failed_error_msg |
| 14166 | |
| 14167 | class table_features_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14168 | version = 4 |
| 14169 | type = 1 |
| 14170 | err_type = 13 |
| 14171 | |
| 14172 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14173 | if xid != None: |
| 14174 | self.xid = xid |
| 14175 | else: |
| 14176 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14177 | if code != None: |
| 14178 | self.code = code |
| 14179 | else: |
| 14180 | self.code = 0 |
| 14181 | if data != None: |
| 14182 | self.data = data |
| 14183 | else: |
| 14184 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14185 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14186 | |
| 14187 | def pack(self): |
| 14188 | packed = [] |
| 14189 | packed.append(struct.pack("!B", self.version)) |
| 14190 | packed.append(struct.pack("!B", self.type)) |
| 14191 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14192 | packed.append(struct.pack("!L", self.xid)) |
| 14193 | packed.append(struct.pack("!H", self.err_type)) |
| 14194 | packed.append(struct.pack("!H", self.code)) |
| 14195 | packed.append(self.data) |
| 14196 | length = sum([len(x) for x in packed]) |
| 14197 | packed[2] = struct.pack("!H", length) |
| 14198 | return ''.join(packed) |
| 14199 | |
| 14200 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14201 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14202 | obj = table_features_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14203 | _version = reader.read("!B")[0] |
| 14204 | assert(_version == 4) |
| 14205 | _type = reader.read("!B")[0] |
| 14206 | assert(_type == 1) |
| 14207 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14208 | orig_reader = reader |
| 14209 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14210 | obj.xid = reader.read("!L")[0] |
| 14211 | _err_type = reader.read("!H")[0] |
| 14212 | assert(_err_type == 13) |
| 14213 | obj.code = reader.read("!H")[0] |
| 14214 | obj.data = str(reader.read_all()) |
| 14215 | return obj |
| 14216 | |
| 14217 | def __eq__(self, other): |
| 14218 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14219 | if self.xid != other.xid: return False |
| 14220 | if self.code != other.code: return False |
| 14221 | if self.data != other.data: return False |
| 14222 | return True |
| 14223 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14224 | def pretty_print(self, q): |
| 14225 | q.text("table_features_failed_error_msg {") |
| 14226 | with q.group(): |
| 14227 | with q.indent(2): |
| 14228 | q.breakable() |
| 14229 | q.text("xid = "); |
| 14230 | if self.xid != None: |
| 14231 | q.text("%#x" % self.xid) |
| 14232 | else: |
| 14233 | q.text('None') |
| 14234 | q.text(","); q.breakable() |
| 14235 | q.text("code = "); |
| 14236 | q.text("%#x" % self.code) |
| 14237 | q.text(","); q.breakable() |
| 14238 | q.text("data = "); |
| 14239 | q.pp(self.data) |
| 14240 | q.breakable() |
| 14241 | q.text('}') |
| 14242 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14243 | error_msg.subtypes[13] = table_features_failed_error_msg |
| 14244 | |
| 14245 | class table_features_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14246 | version = 4 |
| 14247 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14248 | stats_type = 12 |
| 14249 | |
| 14250 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14251 | if xid != None: |
| 14252 | self.xid = xid |
| 14253 | else: |
| 14254 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14255 | if flags != None: |
| 14256 | self.flags = flags |
| 14257 | else: |
| 14258 | self.flags = 0 |
| 14259 | if entries != None: |
| 14260 | self.entries = entries |
| 14261 | else: |
| 14262 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14263 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14264 | |
| 14265 | def pack(self): |
| 14266 | packed = [] |
| 14267 | packed.append(struct.pack("!B", self.version)) |
| 14268 | packed.append(struct.pack("!B", self.type)) |
| 14269 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14270 | packed.append(struct.pack("!L", self.xid)) |
| 14271 | packed.append(struct.pack("!H", self.stats_type)) |
| 14272 | packed.append(struct.pack("!H", self.flags)) |
| 14273 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14274 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14275 | length = sum([len(x) for x in packed]) |
| 14276 | packed[2] = struct.pack("!H", length) |
| 14277 | return ''.join(packed) |
| 14278 | |
| 14279 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14280 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14281 | obj = table_features_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14282 | _version = reader.read("!B")[0] |
| 14283 | assert(_version == 4) |
| 14284 | _type = reader.read("!B")[0] |
| 14285 | assert(_type == 19) |
| 14286 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14287 | orig_reader = reader |
| 14288 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14289 | obj.xid = reader.read("!L")[0] |
| 14290 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14291 | assert(_stats_type == 12) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14292 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14293 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14294 | obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14295 | return obj |
| 14296 | |
| 14297 | def __eq__(self, other): |
| 14298 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14299 | if self.xid != other.xid: return False |
| 14300 | if self.flags != other.flags: return False |
| 14301 | if self.entries != other.entries: return False |
| 14302 | return True |
| 14303 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14304 | def pretty_print(self, q): |
| 14305 | q.text("table_features_stats_reply {") |
| 14306 | with q.group(): |
| 14307 | with q.indent(2): |
| 14308 | q.breakable() |
| 14309 | q.text("xid = "); |
| 14310 | if self.xid != None: |
| 14311 | q.text("%#x" % self.xid) |
| 14312 | else: |
| 14313 | q.text('None') |
| 14314 | q.text(","); q.breakable() |
| 14315 | q.text("flags = "); |
| 14316 | q.text("%#x" % self.flags) |
| 14317 | q.text(","); q.breakable() |
| 14318 | q.text("entries = "); |
| 14319 | q.pp(self.entries) |
| 14320 | q.breakable() |
| 14321 | q.text('}') |
| 14322 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14323 | stats_reply.subtypes[12] = table_features_stats_reply |
| 14324 | |
| 14325 | class table_features_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14326 | version = 4 |
| 14327 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14328 | stats_type = 12 |
| 14329 | |
| 14330 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14331 | if xid != None: |
| 14332 | self.xid = xid |
| 14333 | else: |
| 14334 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14335 | if flags != None: |
| 14336 | self.flags = flags |
| 14337 | else: |
| 14338 | self.flags = 0 |
| 14339 | if entries != None: |
| 14340 | self.entries = entries |
| 14341 | else: |
| 14342 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14343 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14344 | |
| 14345 | def pack(self): |
| 14346 | packed = [] |
| 14347 | packed.append(struct.pack("!B", self.version)) |
| 14348 | packed.append(struct.pack("!B", self.type)) |
| 14349 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14350 | packed.append(struct.pack("!L", self.xid)) |
| 14351 | packed.append(struct.pack("!H", self.stats_type)) |
| 14352 | packed.append(struct.pack("!H", self.flags)) |
| 14353 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14354 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14355 | length = sum([len(x) for x in packed]) |
| 14356 | packed[2] = struct.pack("!H", length) |
| 14357 | return ''.join(packed) |
| 14358 | |
| 14359 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14360 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14361 | obj = table_features_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14362 | _version = reader.read("!B")[0] |
| 14363 | assert(_version == 4) |
| 14364 | _type = reader.read("!B")[0] |
| 14365 | assert(_type == 18) |
| 14366 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14367 | orig_reader = reader |
| 14368 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14369 | obj.xid = reader.read("!L")[0] |
| 14370 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14371 | assert(_stats_type == 12) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14372 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14373 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14374 | obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14375 | return obj |
| 14376 | |
| 14377 | def __eq__(self, other): |
| 14378 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14379 | if self.xid != other.xid: return False |
| 14380 | if self.flags != other.flags: return False |
| 14381 | if self.entries != other.entries: return False |
| 14382 | return True |
| 14383 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14384 | def pretty_print(self, q): |
| 14385 | q.text("table_features_stats_request {") |
| 14386 | with q.group(): |
| 14387 | with q.indent(2): |
| 14388 | q.breakable() |
| 14389 | q.text("xid = "); |
| 14390 | if self.xid != None: |
| 14391 | q.text("%#x" % self.xid) |
| 14392 | else: |
| 14393 | q.text('None') |
| 14394 | q.text(","); q.breakable() |
| 14395 | q.text("flags = "); |
| 14396 | q.text("%#x" % self.flags) |
| 14397 | q.text(","); q.breakable() |
| 14398 | q.text("entries = "); |
| 14399 | q.pp(self.entries) |
| 14400 | q.breakable() |
| 14401 | q.text('}') |
| 14402 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14403 | stats_request.subtypes[12] = table_features_stats_request |
| 14404 | |
| 14405 | class table_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14406 | version = 4 |
| 14407 | type = 17 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14408 | |
| 14409 | def __init__(self, xid=None, table_id=None, config=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14410 | if xid != None: |
| 14411 | self.xid = xid |
| 14412 | else: |
| 14413 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14414 | if table_id != None: |
| 14415 | self.table_id = table_id |
| 14416 | else: |
| 14417 | self.table_id = 0 |
| 14418 | if config != None: |
| 14419 | self.config = config |
| 14420 | else: |
| 14421 | self.config = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14422 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14423 | |
| 14424 | def pack(self): |
| 14425 | packed = [] |
| 14426 | packed.append(struct.pack("!B", self.version)) |
| 14427 | packed.append(struct.pack("!B", self.type)) |
| 14428 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14429 | packed.append(struct.pack("!L", self.xid)) |
| 14430 | packed.append(struct.pack("!B", self.table_id)) |
| 14431 | packed.append('\x00' * 3) |
| 14432 | packed.append(struct.pack("!L", self.config)) |
| 14433 | length = sum([len(x) for x in packed]) |
| 14434 | packed[2] = struct.pack("!H", length) |
| 14435 | return ''.join(packed) |
| 14436 | |
| 14437 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14438 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14439 | obj = table_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14440 | _version = reader.read("!B")[0] |
| 14441 | assert(_version == 4) |
| 14442 | _type = reader.read("!B")[0] |
| 14443 | assert(_type == 17) |
| 14444 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14445 | orig_reader = reader |
| 14446 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14447 | obj.xid = reader.read("!L")[0] |
| 14448 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14449 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14450 | obj.config = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14451 | return obj |
| 14452 | |
| 14453 | def __eq__(self, other): |
| 14454 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14455 | if self.xid != other.xid: return False |
| 14456 | if self.table_id != other.table_id: return False |
| 14457 | if self.config != other.config: return False |
| 14458 | return True |
| 14459 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14460 | def pretty_print(self, q): |
| 14461 | q.text("table_mod {") |
| 14462 | with q.group(): |
| 14463 | with q.indent(2): |
| 14464 | q.breakable() |
| 14465 | q.text("xid = "); |
| 14466 | if self.xid != None: |
| 14467 | q.text("%#x" % self.xid) |
| 14468 | else: |
| 14469 | q.text('None') |
| 14470 | q.text(","); q.breakable() |
| 14471 | q.text("table_id = "); |
| 14472 | q.text("%#x" % self.table_id) |
| 14473 | q.text(","); q.breakable() |
| 14474 | q.text("config = "); |
| 14475 | q.text("%#x" % self.config) |
| 14476 | q.breakable() |
| 14477 | q.text('}') |
| 14478 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14479 | message.subtypes[17] = table_mod |
| 14480 | |
| 14481 | class table_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14482 | version = 4 |
| 14483 | type = 1 |
| 14484 | err_type = 8 |
| 14485 | |
| 14486 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14487 | if xid != None: |
| 14488 | self.xid = xid |
| 14489 | else: |
| 14490 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14491 | if code != None: |
| 14492 | self.code = code |
| 14493 | else: |
| 14494 | self.code = 0 |
| 14495 | if data != None: |
| 14496 | self.data = data |
| 14497 | else: |
| 14498 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14499 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14500 | |
| 14501 | def pack(self): |
| 14502 | packed = [] |
| 14503 | packed.append(struct.pack("!B", self.version)) |
| 14504 | packed.append(struct.pack("!B", self.type)) |
| 14505 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14506 | packed.append(struct.pack("!L", self.xid)) |
| 14507 | packed.append(struct.pack("!H", self.err_type)) |
| 14508 | packed.append(struct.pack("!H", self.code)) |
| 14509 | packed.append(self.data) |
| 14510 | length = sum([len(x) for x in packed]) |
| 14511 | packed[2] = struct.pack("!H", length) |
| 14512 | return ''.join(packed) |
| 14513 | |
| 14514 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14515 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14516 | obj = table_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14517 | _version = reader.read("!B")[0] |
| 14518 | assert(_version == 4) |
| 14519 | _type = reader.read("!B")[0] |
| 14520 | assert(_type == 1) |
| 14521 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14522 | orig_reader = reader |
| 14523 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14524 | obj.xid = reader.read("!L")[0] |
| 14525 | _err_type = reader.read("!H")[0] |
| 14526 | assert(_err_type == 8) |
| 14527 | obj.code = reader.read("!H")[0] |
| 14528 | obj.data = str(reader.read_all()) |
| 14529 | return obj |
| 14530 | |
| 14531 | def __eq__(self, other): |
| 14532 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14533 | if self.xid != other.xid: return False |
| 14534 | if self.code != other.code: return False |
| 14535 | if self.data != other.data: return False |
| 14536 | return True |
| 14537 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14538 | def pretty_print(self, q): |
| 14539 | q.text("table_mod_failed_error_msg {") |
| 14540 | with q.group(): |
| 14541 | with q.indent(2): |
| 14542 | q.breakable() |
| 14543 | q.text("xid = "); |
| 14544 | if self.xid != None: |
| 14545 | q.text("%#x" % self.xid) |
| 14546 | else: |
| 14547 | q.text('None') |
| 14548 | q.text(","); q.breakable() |
| 14549 | q.text("code = "); |
| 14550 | q.text("%#x" % self.code) |
| 14551 | q.text(","); q.breakable() |
| 14552 | q.text("data = "); |
| 14553 | q.pp(self.data) |
| 14554 | q.breakable() |
| 14555 | q.text('}') |
| 14556 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14557 | error_msg.subtypes[8] = table_mod_failed_error_msg |
| 14558 | |
| 14559 | class table_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14560 | version = 4 |
| 14561 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14562 | stats_type = 3 |
| 14563 | |
| 14564 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14565 | if xid != None: |
| 14566 | self.xid = xid |
| 14567 | else: |
| 14568 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14569 | if flags != None: |
| 14570 | self.flags = flags |
| 14571 | else: |
| 14572 | self.flags = 0 |
| 14573 | if entries != None: |
| 14574 | self.entries = entries |
| 14575 | else: |
| 14576 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14577 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14578 | |
| 14579 | def pack(self): |
| 14580 | packed = [] |
| 14581 | packed.append(struct.pack("!B", self.version)) |
| 14582 | packed.append(struct.pack("!B", self.type)) |
| 14583 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14584 | packed.append(struct.pack("!L", self.xid)) |
| 14585 | packed.append(struct.pack("!H", self.stats_type)) |
| 14586 | packed.append(struct.pack("!H", self.flags)) |
| 14587 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14588 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14589 | length = sum([len(x) for x in packed]) |
| 14590 | packed[2] = struct.pack("!H", length) |
| 14591 | return ''.join(packed) |
| 14592 | |
| 14593 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14594 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14595 | obj = table_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14596 | _version = reader.read("!B")[0] |
| 14597 | assert(_version == 4) |
| 14598 | _type = reader.read("!B")[0] |
| 14599 | assert(_type == 19) |
| 14600 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14601 | orig_reader = reader |
| 14602 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14603 | obj.xid = reader.read("!L")[0] |
| 14604 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14605 | assert(_stats_type == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14606 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14607 | reader.skip(4) |
| 14608 | obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack) |
| 14609 | return obj |
| 14610 | |
| 14611 | def __eq__(self, other): |
| 14612 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14613 | if self.xid != other.xid: return False |
| 14614 | if self.flags != other.flags: return False |
| 14615 | if self.entries != other.entries: return False |
| 14616 | return True |
| 14617 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14618 | def pretty_print(self, q): |
| 14619 | q.text("table_stats_reply {") |
| 14620 | with q.group(): |
| 14621 | with q.indent(2): |
| 14622 | q.breakable() |
| 14623 | q.text("xid = "); |
| 14624 | if self.xid != None: |
| 14625 | q.text("%#x" % self.xid) |
| 14626 | else: |
| 14627 | q.text('None') |
| 14628 | q.text(","); q.breakable() |
| 14629 | q.text("flags = "); |
| 14630 | q.text("%#x" % self.flags) |
| 14631 | q.text(","); q.breakable() |
| 14632 | q.text("entries = "); |
| 14633 | q.pp(self.entries) |
| 14634 | q.breakable() |
| 14635 | q.text('}') |
| 14636 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14637 | stats_reply.subtypes[3] = table_stats_reply |
| 14638 | |
| 14639 | class table_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14640 | version = 4 |
| 14641 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14642 | stats_type = 3 |
| 14643 | |
| 14644 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14645 | if xid != None: |
| 14646 | self.xid = xid |
| 14647 | else: |
| 14648 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14649 | if flags != None: |
| 14650 | self.flags = flags |
| 14651 | else: |
| 14652 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14653 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14654 | |
| 14655 | def pack(self): |
| 14656 | packed = [] |
| 14657 | packed.append(struct.pack("!B", self.version)) |
| 14658 | packed.append(struct.pack("!B", self.type)) |
| 14659 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14660 | packed.append(struct.pack("!L", self.xid)) |
| 14661 | packed.append(struct.pack("!H", self.stats_type)) |
| 14662 | packed.append(struct.pack("!H", self.flags)) |
| 14663 | packed.append('\x00' * 4) |
| 14664 | length = sum([len(x) for x in packed]) |
| 14665 | packed[2] = struct.pack("!H", length) |
| 14666 | return ''.join(packed) |
| 14667 | |
| 14668 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14669 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14670 | obj = table_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14671 | _version = reader.read("!B")[0] |
| 14672 | assert(_version == 4) |
| 14673 | _type = reader.read("!B")[0] |
| 14674 | assert(_type == 18) |
| 14675 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14676 | orig_reader = reader |
| 14677 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14678 | obj.xid = reader.read("!L")[0] |
| 14679 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14680 | assert(_stats_type == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14681 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14682 | reader.skip(4) |
| 14683 | return obj |
| 14684 | |
| 14685 | def __eq__(self, other): |
| 14686 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14687 | if self.xid != other.xid: return False |
| 14688 | if self.flags != other.flags: return False |
| 14689 | return True |
| 14690 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14691 | def pretty_print(self, q): |
| 14692 | q.text("table_stats_request {") |
| 14693 | with q.group(): |
| 14694 | with q.indent(2): |
| 14695 | q.breakable() |
| 14696 | q.text("xid = "); |
| 14697 | if self.xid != None: |
| 14698 | q.text("%#x" % self.xid) |
| 14699 | else: |
| 14700 | q.text('None') |
| 14701 | q.text(","); q.breakable() |
| 14702 | q.text("flags = "); |
| 14703 | q.text("%#x" % self.flags) |
| 14704 | q.breakable() |
| 14705 | q.text('}') |
| 14706 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14707 | stats_request.subtypes[3] = table_stats_request |
| 14708 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14709 | |
| 14710 | def parse_header(buf): |
| 14711 | if len(buf) < 8: |
| 14712 | raise loxi.ProtocolError("too short to be an OpenFlow message") |
| 14713 | return struct.unpack_from("!BBHL", buf) |
| 14714 | |
| 14715 | def parse_message(buf): |
| 14716 | msg_ver, msg_type, msg_len, msg_xid = parse_header(buf) |
Rich Lane | fe600f5 | 2013-07-09 13:22:32 -0700 | [diff] [blame] | 14717 | if msg_ver != const.OFP_VERSION and msg_type != const.OFPT_HELLO: |
| 14718 | 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] | 14719 | if len(buf) != msg_len: |
| 14720 | raise loxi.ProtocolError("incorrect message size") |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14721 | return message.unpack(loxi.generic_util.OFReader(buf)) |