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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 63 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 135 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 221 | reader = orig_reader.slice(_length, 4) |
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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 317 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 419 | reader = orig_reader.slice(_length, 4) |
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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 543 | reader = orig_reader.slice(_length, 4) |
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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 657 | reader = orig_reader.slice(_length, 4) |
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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 771 | reader = orig_reader.slice(_length, 4) |
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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 867 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 935 | reader = orig_reader.slice(_length, 4) |
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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 1013 | reader = orig_reader.slice(_length, 4) |
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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 1091 | reader = orig_reader.slice(_length, 4) |
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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 1169 | reader = orig_reader.slice(_length, 4) |
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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 1235 | reader = orig_reader.slice(_length, 4) |
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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 1289 | reader = orig_reader.slice(_length, 4) |
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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 1365 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 1445 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 1518 | reader = orig_reader.slice(_length, 4) |
Rich Lane | a61048f | 2014-01-30 16:14:00 -0800 | [diff] [blame] | 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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 1596 | reader = orig_reader.slice(_length, 4) |
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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 1663 | reader = orig_reader.slice(_length, 4) |
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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 1730 | reader = orig_reader.slice(_length, 4) |
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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 1797 | reader = orig_reader.slice(_length, 4) |
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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 1869 | reader = orig_reader.slice(_length, 4) |
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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 1946 | reader = orig_reader.slice(_length, 4) |
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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 2018 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 2085 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 2168 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 2259 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 2342 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 2438 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 2529 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 2607 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 2690 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 2773 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 2856 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 2944 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 3040 | reader = orig_reader.slice(_length, 4) |
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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 3128 | reader = orig_reader.slice(_length, 4) |
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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 3195 | reader = orig_reader.slice(_length, 4) |
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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 3267 | reader = orig_reader.slice(_length, 4) |
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 |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 3344 | reader = orig_reader.slice(_length, 4) |
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 | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 3377 | class bsn_generic_stats_reply(bsn_stats_reply): |
| 3378 | version = 4 |
| 3379 | type = 19 |
| 3380 | stats_type = 65535 |
| 3381 | experimenter = 6035143 |
| 3382 | subtype = 16 |
| 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_generic_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, 4) |
| 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 == 16) |
| 3434 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_generic_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_generic_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[16] = bsn_generic_stats_reply |
| 3464 | |
| 3465 | class bsn_generic_stats_request(bsn_stats_request): |
| 3466 | version = 4 |
| 3467 | type = 18 |
| 3468 | stats_type = 65535 |
| 3469 | experimenter = 6035143 |
| 3470 | subtype = 16 |
| 3471 | |
| 3472 | def __init__(self, xid=None, flags=None, name=None, tlvs=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 name != None: |
| 3482 | self.name = name |
| 3483 | else: |
| 3484 | self.name = "" |
| 3485 | if tlvs != None: |
| 3486 | self.tlvs = tlvs |
| 3487 | else: |
| 3488 | self.tlvs = [] |
| 3489 | return |
| 3490 | |
| 3491 | def pack(self): |
| 3492 | packed = [] |
| 3493 | packed.append(struct.pack("!B", self.version)) |
| 3494 | packed.append(struct.pack("!B", self.type)) |
| 3495 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3496 | packed.append(struct.pack("!L", self.xid)) |
| 3497 | packed.append(struct.pack("!H", self.stats_type)) |
| 3498 | packed.append(struct.pack("!H", self.flags)) |
| 3499 | packed.append('\x00' * 4) |
| 3500 | packed.append(struct.pack("!L", self.experimenter)) |
| 3501 | packed.append(struct.pack("!L", self.subtype)) |
| 3502 | packed.append(struct.pack("!64s", self.name)) |
| 3503 | packed.append(loxi.generic_util.pack_list(self.tlvs)) |
| 3504 | length = sum([len(x) for x in packed]) |
| 3505 | packed[2] = struct.pack("!H", length) |
| 3506 | return ''.join(packed) |
| 3507 | |
| 3508 | @staticmethod |
| 3509 | def unpack(reader): |
| 3510 | obj = bsn_generic_stats_request() |
| 3511 | _version = reader.read("!B")[0] |
| 3512 | assert(_version == 4) |
| 3513 | _type = reader.read("!B")[0] |
| 3514 | assert(_type == 18) |
| 3515 | _length = reader.read("!H")[0] |
| 3516 | orig_reader = reader |
| 3517 | reader = orig_reader.slice(_length, 4) |
| 3518 | obj.xid = reader.read("!L")[0] |
| 3519 | _stats_type = reader.read("!H")[0] |
| 3520 | assert(_stats_type == 65535) |
| 3521 | obj.flags = reader.read("!H")[0] |
| 3522 | reader.skip(4) |
| 3523 | _experimenter = reader.read("!L")[0] |
| 3524 | assert(_experimenter == 6035143) |
| 3525 | _subtype = reader.read("!L")[0] |
| 3526 | assert(_subtype == 16) |
| 3527 | obj.name = reader.read("!64s")[0].rstrip("\x00") |
| 3528 | obj.tlvs = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack) |
| 3529 | return obj |
| 3530 | |
| 3531 | def __eq__(self, other): |
| 3532 | if type(self) != type(other): return False |
| 3533 | if self.xid != other.xid: return False |
| 3534 | if self.flags != other.flags: return False |
| 3535 | if self.name != other.name: return False |
| 3536 | if self.tlvs != other.tlvs: return False |
| 3537 | return True |
| 3538 | |
| 3539 | def pretty_print(self, q): |
| 3540 | q.text("bsn_generic_stats_request {") |
| 3541 | with q.group(): |
| 3542 | with q.indent(2): |
| 3543 | q.breakable() |
| 3544 | q.text("xid = "); |
| 3545 | if self.xid != None: |
| 3546 | q.text("%#x" % self.xid) |
| 3547 | else: |
| 3548 | q.text('None') |
| 3549 | q.text(","); q.breakable() |
| 3550 | q.text("flags = "); |
| 3551 | q.text("%#x" % self.flags) |
| 3552 | q.text(","); q.breakable() |
| 3553 | q.text("name = "); |
| 3554 | q.pp(self.name) |
| 3555 | q.text(","); q.breakable() |
| 3556 | q.text("tlvs = "); |
| 3557 | q.pp(self.tlvs) |
| 3558 | q.breakable() |
| 3559 | q.text('}') |
| 3560 | |
| 3561 | bsn_stats_request.subtypes[16] = bsn_generic_stats_request |
| 3562 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3563 | class bsn_gentable_bucket_stats_reply(bsn_stats_reply): |
| 3564 | version = 4 |
| 3565 | type = 19 |
| 3566 | stats_type = 65535 |
| 3567 | experimenter = 6035143 |
| 3568 | subtype = 5 |
| 3569 | |
| 3570 | def __init__(self, xid=None, flags=None, entries=None): |
| 3571 | if xid != None: |
| 3572 | self.xid = xid |
| 3573 | else: |
| 3574 | self.xid = None |
| 3575 | if flags != None: |
| 3576 | self.flags = flags |
| 3577 | else: |
| 3578 | self.flags = 0 |
| 3579 | if entries != None: |
| 3580 | self.entries = entries |
| 3581 | else: |
| 3582 | self.entries = [] |
| 3583 | return |
| 3584 | |
| 3585 | def pack(self): |
| 3586 | packed = [] |
| 3587 | packed.append(struct.pack("!B", self.version)) |
| 3588 | packed.append(struct.pack("!B", self.type)) |
| 3589 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3590 | packed.append(struct.pack("!L", self.xid)) |
| 3591 | packed.append(struct.pack("!H", self.stats_type)) |
| 3592 | packed.append(struct.pack("!H", self.flags)) |
| 3593 | packed.append('\x00' * 4) |
| 3594 | packed.append(struct.pack("!L", self.experimenter)) |
| 3595 | packed.append(struct.pack("!L", self.subtype)) |
| 3596 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 3597 | length = sum([len(x) for x in packed]) |
| 3598 | packed[2] = struct.pack("!H", length) |
| 3599 | return ''.join(packed) |
| 3600 | |
| 3601 | @staticmethod |
| 3602 | def unpack(reader): |
| 3603 | obj = bsn_gentable_bucket_stats_reply() |
| 3604 | _version = reader.read("!B")[0] |
| 3605 | assert(_version == 4) |
| 3606 | _type = reader.read("!B")[0] |
| 3607 | assert(_type == 19) |
| 3608 | _length = reader.read("!H")[0] |
| 3609 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 3610 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3611 | obj.xid = reader.read("!L")[0] |
| 3612 | _stats_type = reader.read("!H")[0] |
| 3613 | assert(_stats_type == 65535) |
| 3614 | obj.flags = reader.read("!H")[0] |
| 3615 | reader.skip(4) |
| 3616 | _experimenter = reader.read("!L")[0] |
| 3617 | assert(_experimenter == 6035143) |
| 3618 | _subtype = reader.read("!L")[0] |
| 3619 | assert(_subtype == 5) |
| 3620 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_bucket_stats_entry.unpack) |
| 3621 | return obj |
| 3622 | |
| 3623 | def __eq__(self, other): |
| 3624 | if type(self) != type(other): return False |
| 3625 | if self.xid != other.xid: return False |
| 3626 | if self.flags != other.flags: return False |
| 3627 | if self.entries != other.entries: return False |
| 3628 | return True |
| 3629 | |
| 3630 | def pretty_print(self, q): |
| 3631 | q.text("bsn_gentable_bucket_stats_reply {") |
| 3632 | with q.group(): |
| 3633 | with q.indent(2): |
| 3634 | q.breakable() |
| 3635 | q.text("xid = "); |
| 3636 | if self.xid != None: |
| 3637 | q.text("%#x" % self.xid) |
| 3638 | else: |
| 3639 | q.text('None') |
| 3640 | q.text(","); q.breakable() |
| 3641 | q.text("flags = "); |
| 3642 | q.text("%#x" % self.flags) |
| 3643 | q.text(","); q.breakable() |
| 3644 | q.text("entries = "); |
| 3645 | q.pp(self.entries) |
| 3646 | q.breakable() |
| 3647 | q.text('}') |
| 3648 | |
| 3649 | bsn_stats_reply.subtypes[5] = bsn_gentable_bucket_stats_reply |
| 3650 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3651 | class bsn_gentable_bucket_stats_request(bsn_stats_request): |
| 3652 | version = 4 |
| 3653 | type = 18 |
| 3654 | stats_type = 65535 |
| 3655 | experimenter = 6035143 |
| 3656 | subtype = 5 |
| 3657 | |
| 3658 | def __init__(self, xid=None, flags=None, table_id=None): |
| 3659 | if xid != None: |
| 3660 | self.xid = xid |
| 3661 | else: |
| 3662 | self.xid = None |
| 3663 | if flags != None: |
| 3664 | self.flags = flags |
| 3665 | else: |
| 3666 | self.flags = 0 |
| 3667 | if table_id != None: |
| 3668 | self.table_id = table_id |
| 3669 | else: |
| 3670 | self.table_id = 0 |
| 3671 | return |
| 3672 | |
| 3673 | def pack(self): |
| 3674 | packed = [] |
| 3675 | packed.append(struct.pack("!B", self.version)) |
| 3676 | packed.append(struct.pack("!B", self.type)) |
| 3677 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3678 | packed.append(struct.pack("!L", self.xid)) |
| 3679 | packed.append(struct.pack("!H", self.stats_type)) |
| 3680 | packed.append(struct.pack("!H", self.flags)) |
| 3681 | packed.append('\x00' * 4) |
| 3682 | packed.append(struct.pack("!L", self.experimenter)) |
| 3683 | packed.append(struct.pack("!L", self.subtype)) |
| 3684 | packed.append(struct.pack("!H", self.table_id)) |
| 3685 | length = sum([len(x) for x in packed]) |
| 3686 | packed[2] = struct.pack("!H", length) |
| 3687 | return ''.join(packed) |
| 3688 | |
| 3689 | @staticmethod |
| 3690 | def unpack(reader): |
| 3691 | obj = bsn_gentable_bucket_stats_request() |
| 3692 | _version = reader.read("!B")[0] |
| 3693 | assert(_version == 4) |
| 3694 | _type = reader.read("!B")[0] |
| 3695 | assert(_type == 18) |
| 3696 | _length = reader.read("!H")[0] |
| 3697 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 3698 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3699 | obj.xid = reader.read("!L")[0] |
| 3700 | _stats_type = reader.read("!H")[0] |
| 3701 | assert(_stats_type == 65535) |
| 3702 | obj.flags = reader.read("!H")[0] |
| 3703 | reader.skip(4) |
| 3704 | _experimenter = reader.read("!L")[0] |
| 3705 | assert(_experimenter == 6035143) |
| 3706 | _subtype = reader.read("!L")[0] |
| 3707 | assert(_subtype == 5) |
| 3708 | obj.table_id = reader.read("!H")[0] |
| 3709 | return obj |
| 3710 | |
| 3711 | def __eq__(self, other): |
| 3712 | if type(self) != type(other): return False |
| 3713 | if self.xid != other.xid: return False |
| 3714 | if self.flags != other.flags: return False |
| 3715 | if self.table_id != other.table_id: return False |
| 3716 | return True |
| 3717 | |
| 3718 | def pretty_print(self, q): |
| 3719 | q.text("bsn_gentable_bucket_stats_request {") |
| 3720 | with q.group(): |
| 3721 | with q.indent(2): |
| 3722 | q.breakable() |
| 3723 | q.text("xid = "); |
| 3724 | if self.xid != None: |
| 3725 | q.text("%#x" % self.xid) |
| 3726 | else: |
| 3727 | q.text('None') |
| 3728 | q.text(","); q.breakable() |
| 3729 | q.text("flags = "); |
| 3730 | q.text("%#x" % self.flags) |
| 3731 | q.text(","); q.breakable() |
| 3732 | q.text("table_id = "); |
| 3733 | q.text("%#x" % self.table_id) |
| 3734 | q.breakable() |
| 3735 | q.text('}') |
| 3736 | |
| 3737 | bsn_stats_request.subtypes[5] = bsn_gentable_bucket_stats_request |
| 3738 | |
| 3739 | class bsn_gentable_clear_reply(bsn_header): |
| 3740 | version = 4 |
| 3741 | type = 4 |
| 3742 | experimenter = 6035143 |
| 3743 | subtype = 49 |
| 3744 | |
| 3745 | def __init__(self, xid=None, table_id=None, deleted_count=None, error_count=None): |
| 3746 | if xid != None: |
| 3747 | self.xid = xid |
| 3748 | else: |
| 3749 | self.xid = None |
| 3750 | if table_id != None: |
| 3751 | self.table_id = table_id |
| 3752 | else: |
| 3753 | self.table_id = 0 |
| 3754 | if deleted_count != None: |
| 3755 | self.deleted_count = deleted_count |
| 3756 | else: |
| 3757 | self.deleted_count = 0 |
| 3758 | if error_count != None: |
| 3759 | self.error_count = error_count |
| 3760 | else: |
| 3761 | self.error_count = 0 |
| 3762 | return |
| 3763 | |
| 3764 | def pack(self): |
| 3765 | packed = [] |
| 3766 | packed.append(struct.pack("!B", self.version)) |
| 3767 | packed.append(struct.pack("!B", self.type)) |
| 3768 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3769 | packed.append(struct.pack("!L", self.xid)) |
| 3770 | packed.append(struct.pack("!L", self.experimenter)) |
| 3771 | packed.append(struct.pack("!L", self.subtype)) |
| 3772 | packed.append(struct.pack("!H", self.table_id)) |
| 3773 | packed.append('\x00' * 2) |
| 3774 | packed.append(struct.pack("!L", self.deleted_count)) |
| 3775 | packed.append(struct.pack("!L", self.error_count)) |
| 3776 | length = sum([len(x) for x in packed]) |
| 3777 | packed[2] = struct.pack("!H", length) |
| 3778 | return ''.join(packed) |
| 3779 | |
| 3780 | @staticmethod |
| 3781 | def unpack(reader): |
| 3782 | obj = bsn_gentable_clear_reply() |
| 3783 | _version = reader.read("!B")[0] |
| 3784 | assert(_version == 4) |
| 3785 | _type = reader.read("!B")[0] |
| 3786 | assert(_type == 4) |
| 3787 | _length = reader.read("!H")[0] |
| 3788 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 3789 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3790 | obj.xid = reader.read("!L")[0] |
| 3791 | _experimenter = reader.read("!L")[0] |
| 3792 | assert(_experimenter == 6035143) |
| 3793 | _subtype = reader.read("!L")[0] |
| 3794 | assert(_subtype == 49) |
| 3795 | obj.table_id = reader.read("!H")[0] |
| 3796 | reader.skip(2) |
| 3797 | obj.deleted_count = reader.read("!L")[0] |
| 3798 | obj.error_count = reader.read("!L")[0] |
| 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.table_id != other.table_id: return False |
| 3805 | if self.deleted_count != other.deleted_count: return False |
| 3806 | if self.error_count != other.error_count: return False |
| 3807 | return True |
| 3808 | |
| 3809 | def pretty_print(self, q): |
| 3810 | q.text("bsn_gentable_clear_reply {") |
| 3811 | with q.group(): |
| 3812 | with q.indent(2): |
| 3813 | q.breakable() |
| 3814 | q.text("xid = "); |
| 3815 | if self.xid != None: |
| 3816 | q.text("%#x" % self.xid) |
| 3817 | else: |
| 3818 | q.text('None') |
| 3819 | q.text(","); q.breakable() |
| 3820 | q.text("table_id = "); |
| 3821 | q.text("%#x" % self.table_id) |
| 3822 | q.text(","); q.breakable() |
| 3823 | q.text("deleted_count = "); |
| 3824 | q.text("%#x" % self.deleted_count) |
| 3825 | q.text(","); q.breakable() |
| 3826 | q.text("error_count = "); |
| 3827 | q.text("%#x" % self.error_count) |
| 3828 | q.breakable() |
| 3829 | q.text('}') |
| 3830 | |
| 3831 | bsn_header.subtypes[49] = bsn_gentable_clear_reply |
| 3832 | |
| 3833 | class bsn_gentable_clear_request(bsn_header): |
| 3834 | version = 4 |
| 3835 | type = 4 |
| 3836 | experimenter = 6035143 |
| 3837 | subtype = 48 |
| 3838 | |
| 3839 | def __init__(self, xid=None, table_id=None, checksum=None, checksum_mask=None): |
| 3840 | if xid != None: |
| 3841 | self.xid = xid |
| 3842 | else: |
| 3843 | self.xid = None |
| 3844 | if table_id != None: |
| 3845 | self.table_id = table_id |
| 3846 | else: |
| 3847 | self.table_id = 0 |
| 3848 | if checksum != None: |
| 3849 | self.checksum = checksum |
| 3850 | else: |
| 3851 | self.checksum = 0 |
| 3852 | if checksum_mask != None: |
| 3853 | self.checksum_mask = checksum_mask |
| 3854 | else: |
| 3855 | self.checksum_mask = 0 |
| 3856 | return |
| 3857 | |
| 3858 | def pack(self): |
| 3859 | packed = [] |
| 3860 | packed.append(struct.pack("!B", self.version)) |
| 3861 | packed.append(struct.pack("!B", self.type)) |
| 3862 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3863 | packed.append(struct.pack("!L", self.xid)) |
| 3864 | packed.append(struct.pack("!L", self.experimenter)) |
| 3865 | packed.append(struct.pack("!L", self.subtype)) |
| 3866 | packed.append(struct.pack("!H", self.table_id)) |
| 3867 | packed.append('\x00' * 2) |
| 3868 | packed.append(util.pack_checksum_128(self.checksum)) |
| 3869 | packed.append(util.pack_checksum_128(self.checksum_mask)) |
| 3870 | length = sum([len(x) for x in packed]) |
| 3871 | packed[2] = struct.pack("!H", length) |
| 3872 | return ''.join(packed) |
| 3873 | |
| 3874 | @staticmethod |
| 3875 | def unpack(reader): |
| 3876 | obj = bsn_gentable_clear_request() |
| 3877 | _version = reader.read("!B")[0] |
| 3878 | assert(_version == 4) |
| 3879 | _type = reader.read("!B")[0] |
| 3880 | assert(_type == 4) |
| 3881 | _length = reader.read("!H")[0] |
| 3882 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 3883 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3884 | obj.xid = reader.read("!L")[0] |
| 3885 | _experimenter = reader.read("!L")[0] |
| 3886 | assert(_experimenter == 6035143) |
| 3887 | _subtype = reader.read("!L")[0] |
| 3888 | assert(_subtype == 48) |
| 3889 | obj.table_id = reader.read("!H")[0] |
| 3890 | reader.skip(2) |
| 3891 | obj.checksum = util.unpack_checksum_128(reader) |
| 3892 | obj.checksum_mask = util.unpack_checksum_128(reader) |
| 3893 | return obj |
| 3894 | |
| 3895 | def __eq__(self, other): |
| 3896 | if type(self) != type(other): return False |
| 3897 | if self.xid != other.xid: return False |
| 3898 | if self.table_id != other.table_id: return False |
| 3899 | if self.checksum != other.checksum: return False |
| 3900 | if self.checksum_mask != other.checksum_mask: return False |
| 3901 | return True |
| 3902 | |
| 3903 | def pretty_print(self, q): |
| 3904 | q.text("bsn_gentable_clear_request {") |
| 3905 | with q.group(): |
| 3906 | with q.indent(2): |
| 3907 | q.breakable() |
| 3908 | q.text("xid = "); |
| 3909 | if self.xid != None: |
| 3910 | q.text("%#x" % self.xid) |
| 3911 | else: |
| 3912 | q.text('None') |
| 3913 | q.text(","); q.breakable() |
| 3914 | q.text("table_id = "); |
| 3915 | q.text("%#x" % self.table_id) |
| 3916 | q.text(","); q.breakable() |
| 3917 | q.text("checksum = "); |
| 3918 | q.pp(self.checksum) |
| 3919 | q.text(","); q.breakable() |
| 3920 | q.text("checksum_mask = "); |
| 3921 | q.pp(self.checksum_mask) |
| 3922 | q.breakable() |
| 3923 | q.text('}') |
| 3924 | |
| 3925 | bsn_header.subtypes[48] = bsn_gentable_clear_request |
| 3926 | |
| 3927 | class bsn_gentable_desc_stats_reply(bsn_stats_reply): |
| 3928 | version = 4 |
| 3929 | type = 19 |
| 3930 | stats_type = 65535 |
| 3931 | experimenter = 6035143 |
| 3932 | subtype = 4 |
| 3933 | |
| 3934 | def __init__(self, xid=None, flags=None, entries=None): |
| 3935 | if xid != None: |
| 3936 | self.xid = xid |
| 3937 | else: |
| 3938 | self.xid = None |
| 3939 | if flags != None: |
| 3940 | self.flags = flags |
| 3941 | else: |
| 3942 | self.flags = 0 |
| 3943 | if entries != None: |
| 3944 | self.entries = entries |
| 3945 | else: |
| 3946 | self.entries = [] |
| 3947 | return |
| 3948 | |
| 3949 | def pack(self): |
| 3950 | packed = [] |
| 3951 | packed.append(struct.pack("!B", self.version)) |
| 3952 | packed.append(struct.pack("!B", self.type)) |
| 3953 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3954 | packed.append(struct.pack("!L", self.xid)) |
| 3955 | packed.append(struct.pack("!H", self.stats_type)) |
| 3956 | packed.append(struct.pack("!H", self.flags)) |
| 3957 | packed.append('\x00' * 4) |
| 3958 | packed.append(struct.pack("!L", self.experimenter)) |
| 3959 | packed.append(struct.pack("!L", self.subtype)) |
| 3960 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 3961 | length = sum([len(x) for x in packed]) |
| 3962 | packed[2] = struct.pack("!H", length) |
| 3963 | return ''.join(packed) |
| 3964 | |
| 3965 | @staticmethod |
| 3966 | def unpack(reader): |
| 3967 | obj = bsn_gentable_desc_stats_reply() |
| 3968 | _version = reader.read("!B")[0] |
| 3969 | assert(_version == 4) |
| 3970 | _type = reader.read("!B")[0] |
| 3971 | assert(_type == 19) |
| 3972 | _length = reader.read("!H")[0] |
| 3973 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 3974 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3975 | obj.xid = reader.read("!L")[0] |
| 3976 | _stats_type = reader.read("!H")[0] |
| 3977 | assert(_stats_type == 65535) |
| 3978 | obj.flags = reader.read("!H")[0] |
| 3979 | reader.skip(4) |
| 3980 | _experimenter = reader.read("!L")[0] |
| 3981 | assert(_experimenter == 6035143) |
| 3982 | _subtype = reader.read("!L")[0] |
| 3983 | assert(_subtype == 4) |
| 3984 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_desc_stats_entry.unpack) |
| 3985 | return obj |
| 3986 | |
| 3987 | def __eq__(self, other): |
| 3988 | if type(self) != type(other): return False |
| 3989 | if self.xid != other.xid: return False |
| 3990 | if self.flags != other.flags: return False |
| 3991 | if self.entries != other.entries: return False |
| 3992 | return True |
| 3993 | |
| 3994 | def pretty_print(self, q): |
| 3995 | q.text("bsn_gentable_desc_stats_reply {") |
| 3996 | with q.group(): |
| 3997 | with q.indent(2): |
| 3998 | q.breakable() |
| 3999 | q.text("xid = "); |
| 4000 | if self.xid != None: |
| 4001 | q.text("%#x" % self.xid) |
| 4002 | else: |
| 4003 | q.text('None') |
| 4004 | q.text(","); q.breakable() |
| 4005 | q.text("flags = "); |
| 4006 | q.text("%#x" % self.flags) |
| 4007 | q.text(","); q.breakable() |
| 4008 | q.text("entries = "); |
| 4009 | q.pp(self.entries) |
| 4010 | q.breakable() |
| 4011 | q.text('}') |
| 4012 | |
| 4013 | bsn_stats_reply.subtypes[4] = bsn_gentable_desc_stats_reply |
| 4014 | |
| 4015 | class bsn_gentable_desc_stats_request(bsn_stats_request): |
| 4016 | version = 4 |
| 4017 | type = 18 |
| 4018 | stats_type = 65535 |
| 4019 | experimenter = 6035143 |
| 4020 | subtype = 4 |
| 4021 | |
| 4022 | def __init__(self, xid=None, flags=None): |
| 4023 | if xid != None: |
| 4024 | self.xid = xid |
| 4025 | else: |
| 4026 | self.xid = None |
| 4027 | if flags != None: |
| 4028 | self.flags = flags |
| 4029 | else: |
| 4030 | self.flags = 0 |
| 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("!H", self.stats_type)) |
| 4040 | packed.append(struct.pack("!H", self.flags)) |
| 4041 | packed.append('\x00' * 4) |
| 4042 | packed.append(struct.pack("!L", self.experimenter)) |
| 4043 | packed.append(struct.pack("!L", self.subtype)) |
| 4044 | length = sum([len(x) for x in packed]) |
| 4045 | packed[2] = struct.pack("!H", length) |
| 4046 | return ''.join(packed) |
| 4047 | |
| 4048 | @staticmethod |
| 4049 | def unpack(reader): |
| 4050 | obj = bsn_gentable_desc_stats_request() |
| 4051 | _version = reader.read("!B")[0] |
| 4052 | assert(_version == 4) |
| 4053 | _type = reader.read("!B")[0] |
| 4054 | assert(_type == 18) |
| 4055 | _length = reader.read("!H")[0] |
| 4056 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 4057 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4058 | obj.xid = reader.read("!L")[0] |
| 4059 | _stats_type = reader.read("!H")[0] |
| 4060 | assert(_stats_type == 65535) |
| 4061 | obj.flags = reader.read("!H")[0] |
| 4062 | reader.skip(4) |
| 4063 | _experimenter = reader.read("!L")[0] |
| 4064 | assert(_experimenter == 6035143) |
| 4065 | _subtype = reader.read("!L")[0] |
| 4066 | assert(_subtype == 4) |
| 4067 | return obj |
| 4068 | |
| 4069 | def __eq__(self, other): |
| 4070 | if type(self) != type(other): return False |
| 4071 | if self.xid != other.xid: return False |
| 4072 | if self.flags != other.flags: return False |
| 4073 | return True |
| 4074 | |
| 4075 | def pretty_print(self, q): |
| 4076 | q.text("bsn_gentable_desc_stats_request {") |
| 4077 | with q.group(): |
| 4078 | with q.indent(2): |
| 4079 | q.breakable() |
| 4080 | q.text("xid = "); |
| 4081 | if self.xid != None: |
| 4082 | q.text("%#x" % self.xid) |
| 4083 | else: |
| 4084 | q.text('None') |
| 4085 | q.text(","); q.breakable() |
| 4086 | q.text("flags = "); |
| 4087 | q.text("%#x" % self.flags) |
| 4088 | q.breakable() |
| 4089 | q.text('}') |
| 4090 | |
| 4091 | bsn_stats_request.subtypes[4] = bsn_gentable_desc_stats_request |
| 4092 | |
| 4093 | class bsn_gentable_entry_add(bsn_header): |
| 4094 | version = 4 |
| 4095 | type = 4 |
| 4096 | experimenter = 6035143 |
| 4097 | subtype = 46 |
| 4098 | |
| 4099 | def __init__(self, xid=None, table_id=None, checksum=None, key=None, value=None): |
| 4100 | if xid != None: |
| 4101 | self.xid = xid |
| 4102 | else: |
| 4103 | self.xid = None |
| 4104 | if table_id != None: |
| 4105 | self.table_id = table_id |
| 4106 | else: |
| 4107 | self.table_id = 0 |
| 4108 | if checksum != None: |
| 4109 | self.checksum = checksum |
| 4110 | else: |
| 4111 | self.checksum = 0 |
| 4112 | if key != None: |
| 4113 | self.key = key |
| 4114 | else: |
| 4115 | self.key = [] |
| 4116 | if value != None: |
| 4117 | self.value = value |
| 4118 | else: |
| 4119 | self.value = [] |
| 4120 | return |
| 4121 | |
| 4122 | def pack(self): |
| 4123 | packed = [] |
| 4124 | packed.append(struct.pack("!B", self.version)) |
| 4125 | packed.append(struct.pack("!B", self.type)) |
| 4126 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4127 | packed.append(struct.pack("!L", self.xid)) |
| 4128 | packed.append(struct.pack("!L", self.experimenter)) |
| 4129 | packed.append(struct.pack("!L", self.subtype)) |
| 4130 | packed.append(struct.pack("!H", self.table_id)) |
| 4131 | packed.append(struct.pack("!H", 0)) # placeholder for key_length at index 7 |
| 4132 | packed.append(util.pack_checksum_128(self.checksum)) |
| 4133 | packed.append(loxi.generic_util.pack_list(self.key)) |
| 4134 | packed[7] = struct.pack("!H", len(packed[-1])) |
| 4135 | packed.append(loxi.generic_util.pack_list(self.value)) |
| 4136 | length = sum([len(x) for x in packed]) |
| 4137 | packed[2] = struct.pack("!H", length) |
| 4138 | return ''.join(packed) |
| 4139 | |
| 4140 | @staticmethod |
| 4141 | def unpack(reader): |
| 4142 | obj = bsn_gentable_entry_add() |
| 4143 | _version = reader.read("!B")[0] |
| 4144 | assert(_version == 4) |
| 4145 | _type = reader.read("!B")[0] |
| 4146 | assert(_type == 4) |
| 4147 | _length = reader.read("!H")[0] |
| 4148 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 4149 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4150 | obj.xid = reader.read("!L")[0] |
| 4151 | _experimenter = reader.read("!L")[0] |
| 4152 | assert(_experimenter == 6035143) |
| 4153 | _subtype = reader.read("!L")[0] |
| 4154 | assert(_subtype == 46) |
| 4155 | obj.table_id = reader.read("!H")[0] |
| 4156 | _key_length = reader.read("!H")[0] |
| 4157 | obj.checksum = util.unpack_checksum_128(reader) |
| 4158 | obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), bsn_tlv.bsn_tlv.unpack) |
| 4159 | obj.value = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack) |
| 4160 | return obj |
| 4161 | |
| 4162 | def __eq__(self, other): |
| 4163 | if type(self) != type(other): return False |
| 4164 | if self.xid != other.xid: return False |
| 4165 | if self.table_id != other.table_id: return False |
| 4166 | if self.checksum != other.checksum: return False |
| 4167 | if self.key != other.key: return False |
| 4168 | if self.value != other.value: return False |
| 4169 | return True |
| 4170 | |
| 4171 | def pretty_print(self, q): |
| 4172 | q.text("bsn_gentable_entry_add {") |
| 4173 | with q.group(): |
| 4174 | with q.indent(2): |
| 4175 | q.breakable() |
| 4176 | q.text("xid = "); |
| 4177 | if self.xid != None: |
| 4178 | q.text("%#x" % self.xid) |
| 4179 | else: |
| 4180 | q.text('None') |
| 4181 | q.text(","); q.breakable() |
| 4182 | q.text("table_id = "); |
| 4183 | q.text("%#x" % self.table_id) |
| 4184 | q.text(","); q.breakable() |
| 4185 | q.text("checksum = "); |
| 4186 | q.pp(self.checksum) |
| 4187 | q.text(","); q.breakable() |
| 4188 | q.text("key = "); |
| 4189 | q.pp(self.key) |
| 4190 | q.text(","); q.breakable() |
| 4191 | q.text("value = "); |
| 4192 | q.pp(self.value) |
| 4193 | q.breakable() |
| 4194 | q.text('}') |
| 4195 | |
| 4196 | bsn_header.subtypes[46] = bsn_gentable_entry_add |
| 4197 | |
| 4198 | class bsn_gentable_entry_delete(bsn_header): |
| 4199 | version = 4 |
| 4200 | type = 4 |
| 4201 | experimenter = 6035143 |
| 4202 | subtype = 47 |
| 4203 | |
| 4204 | def __init__(self, xid=None, table_id=None, key=None): |
| 4205 | if xid != None: |
| 4206 | self.xid = xid |
| 4207 | else: |
| 4208 | self.xid = None |
| 4209 | if table_id != None: |
| 4210 | self.table_id = table_id |
| 4211 | else: |
| 4212 | self.table_id = 0 |
| 4213 | if key != None: |
| 4214 | self.key = key |
| 4215 | else: |
| 4216 | self.key = [] |
| 4217 | return |
| 4218 | |
| 4219 | def pack(self): |
| 4220 | packed = [] |
| 4221 | packed.append(struct.pack("!B", self.version)) |
| 4222 | packed.append(struct.pack("!B", self.type)) |
| 4223 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4224 | packed.append(struct.pack("!L", self.xid)) |
| 4225 | packed.append(struct.pack("!L", self.experimenter)) |
| 4226 | packed.append(struct.pack("!L", self.subtype)) |
| 4227 | packed.append(struct.pack("!H", self.table_id)) |
| 4228 | packed.append(loxi.generic_util.pack_list(self.key)) |
| 4229 | length = sum([len(x) for x in packed]) |
| 4230 | packed[2] = struct.pack("!H", length) |
| 4231 | return ''.join(packed) |
| 4232 | |
| 4233 | @staticmethod |
| 4234 | def unpack(reader): |
| 4235 | obj = bsn_gentable_entry_delete() |
| 4236 | _version = reader.read("!B")[0] |
| 4237 | assert(_version == 4) |
| 4238 | _type = reader.read("!B")[0] |
| 4239 | assert(_type == 4) |
| 4240 | _length = reader.read("!H")[0] |
| 4241 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 4242 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4243 | obj.xid = reader.read("!L")[0] |
| 4244 | _experimenter = reader.read("!L")[0] |
| 4245 | assert(_experimenter == 6035143) |
| 4246 | _subtype = reader.read("!L")[0] |
| 4247 | assert(_subtype == 47) |
| 4248 | obj.table_id = reader.read("!H")[0] |
| 4249 | obj.key = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack) |
| 4250 | return obj |
| 4251 | |
| 4252 | def __eq__(self, other): |
| 4253 | if type(self) != type(other): return False |
| 4254 | if self.xid != other.xid: return False |
| 4255 | if self.table_id != other.table_id: return False |
| 4256 | if self.key != other.key: return False |
| 4257 | return True |
| 4258 | |
| 4259 | def pretty_print(self, q): |
| 4260 | q.text("bsn_gentable_entry_delete {") |
| 4261 | with q.group(): |
| 4262 | with q.indent(2): |
| 4263 | q.breakable() |
| 4264 | q.text("xid = "); |
| 4265 | if self.xid != None: |
| 4266 | q.text("%#x" % self.xid) |
| 4267 | else: |
| 4268 | q.text('None') |
| 4269 | q.text(","); q.breakable() |
| 4270 | q.text("table_id = "); |
| 4271 | q.text("%#x" % self.table_id) |
| 4272 | q.text(","); q.breakable() |
| 4273 | q.text("key = "); |
| 4274 | q.pp(self.key) |
| 4275 | q.breakable() |
| 4276 | q.text('}') |
| 4277 | |
| 4278 | bsn_header.subtypes[47] = bsn_gentable_entry_delete |
| 4279 | |
| 4280 | class bsn_gentable_entry_desc_stats_reply(bsn_stats_reply): |
| 4281 | version = 4 |
| 4282 | type = 19 |
| 4283 | stats_type = 65535 |
| 4284 | experimenter = 6035143 |
| 4285 | subtype = 2 |
| 4286 | |
| 4287 | def __init__(self, xid=None, flags=None, entries=None): |
| 4288 | if xid != None: |
| 4289 | self.xid = xid |
| 4290 | else: |
| 4291 | self.xid = None |
| 4292 | if flags != None: |
| 4293 | self.flags = flags |
| 4294 | else: |
| 4295 | self.flags = 0 |
| 4296 | if entries != None: |
| 4297 | self.entries = entries |
| 4298 | else: |
| 4299 | self.entries = [] |
| 4300 | return |
| 4301 | |
| 4302 | def pack(self): |
| 4303 | packed = [] |
| 4304 | packed.append(struct.pack("!B", self.version)) |
| 4305 | packed.append(struct.pack("!B", self.type)) |
| 4306 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4307 | packed.append(struct.pack("!L", self.xid)) |
| 4308 | packed.append(struct.pack("!H", self.stats_type)) |
| 4309 | packed.append(struct.pack("!H", self.flags)) |
| 4310 | packed.append('\x00' * 4) |
| 4311 | packed.append(struct.pack("!L", self.experimenter)) |
| 4312 | packed.append(struct.pack("!L", self.subtype)) |
| 4313 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 4314 | length = sum([len(x) for x in packed]) |
| 4315 | packed[2] = struct.pack("!H", length) |
| 4316 | return ''.join(packed) |
| 4317 | |
| 4318 | @staticmethod |
| 4319 | def unpack(reader): |
| 4320 | obj = bsn_gentable_entry_desc_stats_reply() |
| 4321 | _version = reader.read("!B")[0] |
| 4322 | assert(_version == 4) |
| 4323 | _type = reader.read("!B")[0] |
| 4324 | assert(_type == 19) |
| 4325 | _length = reader.read("!H")[0] |
| 4326 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 4327 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4328 | obj.xid = reader.read("!L")[0] |
| 4329 | _stats_type = reader.read("!H")[0] |
| 4330 | assert(_stats_type == 65535) |
| 4331 | obj.flags = reader.read("!H")[0] |
| 4332 | reader.skip(4) |
| 4333 | _experimenter = reader.read("!L")[0] |
| 4334 | assert(_experimenter == 6035143) |
| 4335 | _subtype = reader.read("!L")[0] |
| 4336 | assert(_subtype == 2) |
| 4337 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_entry_desc_stats_entry.unpack) |
| 4338 | return obj |
| 4339 | |
| 4340 | def __eq__(self, other): |
| 4341 | if type(self) != type(other): return False |
| 4342 | if self.xid != other.xid: return False |
| 4343 | if self.flags != other.flags: return False |
| 4344 | if self.entries != other.entries: return False |
| 4345 | return True |
| 4346 | |
| 4347 | def pretty_print(self, q): |
| 4348 | q.text("bsn_gentable_entry_desc_stats_reply {") |
| 4349 | with q.group(): |
| 4350 | with q.indent(2): |
| 4351 | q.breakable() |
| 4352 | q.text("xid = "); |
| 4353 | if self.xid != None: |
| 4354 | q.text("%#x" % self.xid) |
| 4355 | else: |
| 4356 | q.text('None') |
| 4357 | q.text(","); q.breakable() |
| 4358 | q.text("flags = "); |
| 4359 | q.text("%#x" % self.flags) |
| 4360 | q.text(","); q.breakable() |
| 4361 | q.text("entries = "); |
| 4362 | q.pp(self.entries) |
| 4363 | q.breakable() |
| 4364 | q.text('}') |
| 4365 | |
| 4366 | bsn_stats_reply.subtypes[2] = bsn_gentable_entry_desc_stats_reply |
| 4367 | |
| 4368 | class bsn_gentable_entry_desc_stats_request(bsn_stats_request): |
| 4369 | version = 4 |
| 4370 | type = 18 |
| 4371 | stats_type = 65535 |
| 4372 | experimenter = 6035143 |
| 4373 | subtype = 2 |
| 4374 | |
| 4375 | def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None): |
| 4376 | if xid != None: |
| 4377 | self.xid = xid |
| 4378 | else: |
| 4379 | self.xid = None |
| 4380 | if flags != None: |
| 4381 | self.flags = flags |
| 4382 | else: |
| 4383 | self.flags = 0 |
| 4384 | if table_id != None: |
| 4385 | self.table_id = table_id |
| 4386 | else: |
| 4387 | self.table_id = 0 |
| 4388 | if checksum != None: |
| 4389 | self.checksum = checksum |
| 4390 | else: |
| 4391 | self.checksum = 0 |
| 4392 | if checksum_mask != None: |
| 4393 | self.checksum_mask = checksum_mask |
| 4394 | else: |
| 4395 | self.checksum_mask = 0 |
| 4396 | return |
| 4397 | |
| 4398 | def pack(self): |
| 4399 | packed = [] |
| 4400 | packed.append(struct.pack("!B", self.version)) |
| 4401 | packed.append(struct.pack("!B", self.type)) |
| 4402 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4403 | packed.append(struct.pack("!L", self.xid)) |
| 4404 | packed.append(struct.pack("!H", self.stats_type)) |
| 4405 | packed.append(struct.pack("!H", self.flags)) |
| 4406 | packed.append('\x00' * 4) |
| 4407 | packed.append(struct.pack("!L", self.experimenter)) |
| 4408 | packed.append(struct.pack("!L", self.subtype)) |
| 4409 | packed.append(struct.pack("!H", self.table_id)) |
| 4410 | packed.append('\x00' * 2) |
| 4411 | packed.append(util.pack_checksum_128(self.checksum)) |
| 4412 | packed.append(util.pack_checksum_128(self.checksum_mask)) |
| 4413 | length = sum([len(x) for x in packed]) |
| 4414 | packed[2] = struct.pack("!H", length) |
| 4415 | return ''.join(packed) |
| 4416 | |
| 4417 | @staticmethod |
| 4418 | def unpack(reader): |
| 4419 | obj = bsn_gentable_entry_desc_stats_request() |
| 4420 | _version = reader.read("!B")[0] |
| 4421 | assert(_version == 4) |
| 4422 | _type = reader.read("!B")[0] |
| 4423 | assert(_type == 18) |
| 4424 | _length = reader.read("!H")[0] |
| 4425 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 4426 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4427 | obj.xid = reader.read("!L")[0] |
| 4428 | _stats_type = reader.read("!H")[0] |
| 4429 | assert(_stats_type == 65535) |
| 4430 | obj.flags = reader.read("!H")[0] |
| 4431 | reader.skip(4) |
| 4432 | _experimenter = reader.read("!L")[0] |
| 4433 | assert(_experimenter == 6035143) |
| 4434 | _subtype = reader.read("!L")[0] |
| 4435 | assert(_subtype == 2) |
| 4436 | obj.table_id = reader.read("!H")[0] |
| 4437 | reader.skip(2) |
| 4438 | obj.checksum = util.unpack_checksum_128(reader) |
| 4439 | obj.checksum_mask = util.unpack_checksum_128(reader) |
| 4440 | return obj |
| 4441 | |
| 4442 | def __eq__(self, other): |
| 4443 | if type(self) != type(other): return False |
| 4444 | if self.xid != other.xid: return False |
| 4445 | if self.flags != other.flags: return False |
| 4446 | if self.table_id != other.table_id: return False |
| 4447 | if self.checksum != other.checksum: return False |
| 4448 | if self.checksum_mask != other.checksum_mask: return False |
| 4449 | return True |
| 4450 | |
| 4451 | def pretty_print(self, q): |
| 4452 | q.text("bsn_gentable_entry_desc_stats_request {") |
| 4453 | with q.group(): |
| 4454 | with q.indent(2): |
| 4455 | q.breakable() |
| 4456 | q.text("xid = "); |
| 4457 | if self.xid != None: |
| 4458 | q.text("%#x" % self.xid) |
| 4459 | else: |
| 4460 | q.text('None') |
| 4461 | q.text(","); q.breakable() |
| 4462 | q.text("flags = "); |
| 4463 | q.text("%#x" % self.flags) |
| 4464 | q.text(","); q.breakable() |
| 4465 | q.text("table_id = "); |
| 4466 | q.text("%#x" % self.table_id) |
| 4467 | q.text(","); q.breakable() |
| 4468 | q.text("checksum = "); |
| 4469 | q.pp(self.checksum) |
| 4470 | q.text(","); q.breakable() |
| 4471 | q.text("checksum_mask = "); |
| 4472 | q.pp(self.checksum_mask) |
| 4473 | q.breakable() |
| 4474 | q.text('}') |
| 4475 | |
| 4476 | bsn_stats_request.subtypes[2] = bsn_gentable_entry_desc_stats_request |
| 4477 | |
| 4478 | class bsn_gentable_entry_stats_reply(bsn_stats_reply): |
| 4479 | version = 4 |
| 4480 | type = 19 |
| 4481 | stats_type = 65535 |
| 4482 | experimenter = 6035143 |
| 4483 | subtype = 3 |
| 4484 | |
| 4485 | def __init__(self, xid=None, flags=None, entries=None): |
| 4486 | if xid != None: |
| 4487 | self.xid = xid |
| 4488 | else: |
| 4489 | self.xid = None |
| 4490 | if flags != None: |
| 4491 | self.flags = flags |
| 4492 | else: |
| 4493 | self.flags = 0 |
| 4494 | if entries != None: |
| 4495 | self.entries = entries |
| 4496 | else: |
| 4497 | self.entries = [] |
| 4498 | return |
| 4499 | |
| 4500 | def pack(self): |
| 4501 | packed = [] |
| 4502 | packed.append(struct.pack("!B", self.version)) |
| 4503 | packed.append(struct.pack("!B", self.type)) |
| 4504 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4505 | packed.append(struct.pack("!L", self.xid)) |
| 4506 | packed.append(struct.pack("!H", self.stats_type)) |
| 4507 | packed.append(struct.pack("!H", self.flags)) |
| 4508 | packed.append('\x00' * 4) |
| 4509 | packed.append(struct.pack("!L", self.experimenter)) |
| 4510 | packed.append(struct.pack("!L", self.subtype)) |
| 4511 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 4512 | length = sum([len(x) for x in packed]) |
| 4513 | packed[2] = struct.pack("!H", length) |
| 4514 | return ''.join(packed) |
| 4515 | |
| 4516 | @staticmethod |
| 4517 | def unpack(reader): |
| 4518 | obj = bsn_gentable_entry_stats_reply() |
| 4519 | _version = reader.read("!B")[0] |
| 4520 | assert(_version == 4) |
| 4521 | _type = reader.read("!B")[0] |
| 4522 | assert(_type == 19) |
| 4523 | _length = reader.read("!H")[0] |
| 4524 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 4525 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4526 | obj.xid = reader.read("!L")[0] |
| 4527 | _stats_type = reader.read("!H")[0] |
| 4528 | assert(_stats_type == 65535) |
| 4529 | obj.flags = reader.read("!H")[0] |
| 4530 | reader.skip(4) |
| 4531 | _experimenter = reader.read("!L")[0] |
| 4532 | assert(_experimenter == 6035143) |
| 4533 | _subtype = reader.read("!L")[0] |
| 4534 | assert(_subtype == 3) |
| 4535 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_entry_stats_entry.unpack) |
| 4536 | return obj |
| 4537 | |
| 4538 | def __eq__(self, other): |
| 4539 | if type(self) != type(other): return False |
| 4540 | if self.xid != other.xid: return False |
| 4541 | if self.flags != other.flags: return False |
| 4542 | if self.entries != other.entries: return False |
| 4543 | return True |
| 4544 | |
| 4545 | def pretty_print(self, q): |
| 4546 | q.text("bsn_gentable_entry_stats_reply {") |
| 4547 | with q.group(): |
| 4548 | with q.indent(2): |
| 4549 | q.breakable() |
| 4550 | q.text("xid = "); |
| 4551 | if self.xid != None: |
| 4552 | q.text("%#x" % self.xid) |
| 4553 | else: |
| 4554 | q.text('None') |
| 4555 | q.text(","); q.breakable() |
| 4556 | q.text("flags = "); |
| 4557 | q.text("%#x" % self.flags) |
| 4558 | q.text(","); q.breakable() |
| 4559 | q.text("entries = "); |
| 4560 | q.pp(self.entries) |
| 4561 | q.breakable() |
| 4562 | q.text('}') |
| 4563 | |
| 4564 | bsn_stats_reply.subtypes[3] = bsn_gentable_entry_stats_reply |
| 4565 | |
| 4566 | class bsn_gentable_entry_stats_request(bsn_stats_request): |
| 4567 | version = 4 |
| 4568 | type = 18 |
| 4569 | stats_type = 65535 |
| 4570 | experimenter = 6035143 |
| 4571 | subtype = 3 |
| 4572 | |
| 4573 | def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None): |
| 4574 | if xid != None: |
| 4575 | self.xid = xid |
| 4576 | else: |
| 4577 | self.xid = None |
| 4578 | if flags != None: |
| 4579 | self.flags = flags |
| 4580 | else: |
| 4581 | self.flags = 0 |
| 4582 | if table_id != None: |
| 4583 | self.table_id = table_id |
| 4584 | else: |
| 4585 | self.table_id = 0 |
| 4586 | if checksum != None: |
| 4587 | self.checksum = checksum |
| 4588 | else: |
| 4589 | self.checksum = 0 |
| 4590 | if checksum_mask != None: |
| 4591 | self.checksum_mask = checksum_mask |
| 4592 | else: |
| 4593 | self.checksum_mask = 0 |
| 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(struct.pack("!H", self.table_id)) |
| 4608 | packed.append('\x00' * 2) |
| 4609 | packed.append(util.pack_checksum_128(self.checksum)) |
| 4610 | packed.append(util.pack_checksum_128(self.checksum_mask)) |
| 4611 | length = sum([len(x) for x in packed]) |
| 4612 | packed[2] = struct.pack("!H", length) |
| 4613 | return ''.join(packed) |
| 4614 | |
| 4615 | @staticmethod |
| 4616 | def unpack(reader): |
| 4617 | obj = bsn_gentable_entry_stats_request() |
| 4618 | _version = reader.read("!B")[0] |
| 4619 | assert(_version == 4) |
| 4620 | _type = reader.read("!B")[0] |
| 4621 | assert(_type == 18) |
| 4622 | _length = reader.read("!H")[0] |
| 4623 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 4624 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4625 | obj.xid = reader.read("!L")[0] |
| 4626 | _stats_type = reader.read("!H")[0] |
| 4627 | assert(_stats_type == 65535) |
| 4628 | obj.flags = reader.read("!H")[0] |
| 4629 | reader.skip(4) |
| 4630 | _experimenter = reader.read("!L")[0] |
| 4631 | assert(_experimenter == 6035143) |
| 4632 | _subtype = reader.read("!L")[0] |
| 4633 | assert(_subtype == 3) |
| 4634 | obj.table_id = reader.read("!H")[0] |
| 4635 | reader.skip(2) |
| 4636 | obj.checksum = util.unpack_checksum_128(reader) |
| 4637 | obj.checksum_mask = util.unpack_checksum_128(reader) |
| 4638 | return obj |
| 4639 | |
| 4640 | def __eq__(self, other): |
| 4641 | if type(self) != type(other): return False |
| 4642 | if self.xid != other.xid: return False |
| 4643 | if self.flags != other.flags: return False |
| 4644 | if self.table_id != other.table_id: return False |
| 4645 | if self.checksum != other.checksum: return False |
| 4646 | if self.checksum_mask != other.checksum_mask: return False |
| 4647 | return True |
| 4648 | |
| 4649 | def pretty_print(self, q): |
| 4650 | q.text("bsn_gentable_entry_stats_request {") |
| 4651 | with q.group(): |
| 4652 | with q.indent(2): |
| 4653 | q.breakable() |
| 4654 | q.text("xid = "); |
| 4655 | if self.xid != None: |
| 4656 | q.text("%#x" % self.xid) |
| 4657 | else: |
| 4658 | q.text('None') |
| 4659 | q.text(","); q.breakable() |
| 4660 | q.text("flags = "); |
| 4661 | q.text("%#x" % self.flags) |
| 4662 | q.text(","); q.breakable() |
| 4663 | q.text("table_id = "); |
| 4664 | q.text("%#x" % self.table_id) |
| 4665 | q.text(","); q.breakable() |
| 4666 | q.text("checksum = "); |
| 4667 | q.pp(self.checksum) |
| 4668 | q.text(","); q.breakable() |
| 4669 | q.text("checksum_mask = "); |
| 4670 | q.pp(self.checksum_mask) |
| 4671 | q.breakable() |
| 4672 | q.text('}') |
| 4673 | |
| 4674 | bsn_stats_request.subtypes[3] = bsn_gentable_entry_stats_request |
| 4675 | |
| 4676 | class bsn_gentable_set_buckets_size(bsn_header): |
| 4677 | version = 4 |
| 4678 | type = 4 |
| 4679 | experimenter = 6035143 |
| 4680 | subtype = 50 |
| 4681 | |
| 4682 | def __init__(self, xid=None, table_id=None, buckets_size=None): |
| 4683 | if xid != None: |
| 4684 | self.xid = xid |
| 4685 | else: |
| 4686 | self.xid = None |
| 4687 | if table_id != None: |
| 4688 | self.table_id = table_id |
| 4689 | else: |
| 4690 | self.table_id = 0 |
| 4691 | if buckets_size != None: |
| 4692 | self.buckets_size = buckets_size |
| 4693 | else: |
| 4694 | self.buckets_size = 0 |
| 4695 | return |
| 4696 | |
| 4697 | def pack(self): |
| 4698 | packed = [] |
| 4699 | packed.append(struct.pack("!B", self.version)) |
| 4700 | packed.append(struct.pack("!B", self.type)) |
| 4701 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4702 | packed.append(struct.pack("!L", self.xid)) |
| 4703 | packed.append(struct.pack("!L", self.experimenter)) |
| 4704 | packed.append(struct.pack("!L", self.subtype)) |
| 4705 | packed.append(struct.pack("!H", self.table_id)) |
| 4706 | packed.append('\x00' * 2) |
| 4707 | packed.append(struct.pack("!L", self.buckets_size)) |
| 4708 | length = sum([len(x) for x in packed]) |
| 4709 | packed[2] = struct.pack("!H", length) |
| 4710 | return ''.join(packed) |
| 4711 | |
| 4712 | @staticmethod |
| 4713 | def unpack(reader): |
| 4714 | obj = bsn_gentable_set_buckets_size() |
| 4715 | _version = reader.read("!B")[0] |
| 4716 | assert(_version == 4) |
| 4717 | _type = reader.read("!B")[0] |
| 4718 | assert(_type == 4) |
| 4719 | _length = reader.read("!H")[0] |
| 4720 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 4721 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4722 | obj.xid = reader.read("!L")[0] |
| 4723 | _experimenter = reader.read("!L")[0] |
| 4724 | assert(_experimenter == 6035143) |
| 4725 | _subtype = reader.read("!L")[0] |
| 4726 | assert(_subtype == 50) |
| 4727 | obj.table_id = reader.read("!H")[0] |
| 4728 | reader.skip(2) |
| 4729 | obj.buckets_size = reader.read("!L")[0] |
| 4730 | return obj |
| 4731 | |
| 4732 | def __eq__(self, other): |
| 4733 | if type(self) != type(other): return False |
| 4734 | if self.xid != other.xid: return False |
| 4735 | if self.table_id != other.table_id: return False |
| 4736 | if self.buckets_size != other.buckets_size: return False |
| 4737 | return True |
| 4738 | |
| 4739 | def pretty_print(self, q): |
| 4740 | q.text("bsn_gentable_set_buckets_size {") |
| 4741 | with q.group(): |
| 4742 | with q.indent(2): |
| 4743 | q.breakable() |
| 4744 | q.text("xid = "); |
| 4745 | if self.xid != None: |
| 4746 | q.text("%#x" % self.xid) |
| 4747 | else: |
| 4748 | q.text('None') |
| 4749 | q.text(","); q.breakable() |
| 4750 | q.text("table_id = "); |
| 4751 | q.text("%#x" % self.table_id) |
| 4752 | q.text(","); q.breakable() |
| 4753 | q.text("buckets_size = "); |
| 4754 | q.text("%#x" % self.buckets_size) |
| 4755 | q.breakable() |
| 4756 | q.text('}') |
| 4757 | |
| 4758 | bsn_header.subtypes[50] = bsn_gentable_set_buckets_size |
| 4759 | |
| 4760 | class bsn_gentable_stats_reply(bsn_stats_reply): |
| 4761 | version = 4 |
| 4762 | type = 19 |
| 4763 | stats_type = 65535 |
| 4764 | experimenter = 6035143 |
| 4765 | subtype = 7 |
| 4766 | |
| 4767 | def __init__(self, xid=None, flags=None, entries=None): |
| 4768 | if xid != None: |
| 4769 | self.xid = xid |
| 4770 | else: |
| 4771 | self.xid = None |
| 4772 | if flags != None: |
| 4773 | self.flags = flags |
| 4774 | else: |
| 4775 | self.flags = 0 |
| 4776 | if entries != None: |
| 4777 | self.entries = entries |
| 4778 | else: |
| 4779 | self.entries = [] |
| 4780 | return |
| 4781 | |
| 4782 | def pack(self): |
| 4783 | packed = [] |
| 4784 | packed.append(struct.pack("!B", self.version)) |
| 4785 | packed.append(struct.pack("!B", self.type)) |
| 4786 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4787 | packed.append(struct.pack("!L", self.xid)) |
| 4788 | packed.append(struct.pack("!H", self.stats_type)) |
| 4789 | packed.append(struct.pack("!H", self.flags)) |
| 4790 | packed.append('\x00' * 4) |
| 4791 | packed.append(struct.pack("!L", self.experimenter)) |
| 4792 | packed.append(struct.pack("!L", self.subtype)) |
| 4793 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 4794 | length = sum([len(x) for x in packed]) |
| 4795 | packed[2] = struct.pack("!H", length) |
| 4796 | return ''.join(packed) |
| 4797 | |
| 4798 | @staticmethod |
| 4799 | def unpack(reader): |
| 4800 | obj = bsn_gentable_stats_reply() |
| 4801 | _version = reader.read("!B")[0] |
| 4802 | assert(_version == 4) |
| 4803 | _type = reader.read("!B")[0] |
| 4804 | assert(_type == 19) |
| 4805 | _length = reader.read("!H")[0] |
| 4806 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 4807 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4808 | obj.xid = reader.read("!L")[0] |
| 4809 | _stats_type = reader.read("!H")[0] |
| 4810 | assert(_stats_type == 65535) |
| 4811 | obj.flags = reader.read("!H")[0] |
| 4812 | reader.skip(4) |
| 4813 | _experimenter = reader.read("!L")[0] |
| 4814 | assert(_experimenter == 6035143) |
| 4815 | _subtype = reader.read("!L")[0] |
| 4816 | assert(_subtype == 7) |
| 4817 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_stats_entry.unpack) |
| 4818 | return obj |
| 4819 | |
| 4820 | def __eq__(self, other): |
| 4821 | if type(self) != type(other): return False |
| 4822 | if self.xid != other.xid: return False |
| 4823 | if self.flags != other.flags: return False |
| 4824 | if self.entries != other.entries: return False |
| 4825 | return True |
| 4826 | |
| 4827 | def pretty_print(self, q): |
| 4828 | q.text("bsn_gentable_stats_reply {") |
| 4829 | with q.group(): |
| 4830 | with q.indent(2): |
| 4831 | q.breakable() |
| 4832 | q.text("xid = "); |
| 4833 | if self.xid != None: |
| 4834 | q.text("%#x" % self.xid) |
| 4835 | else: |
| 4836 | q.text('None') |
| 4837 | q.text(","); q.breakable() |
| 4838 | q.text("flags = "); |
| 4839 | q.text("%#x" % self.flags) |
| 4840 | q.text(","); q.breakable() |
| 4841 | q.text("entries = "); |
| 4842 | q.pp(self.entries) |
| 4843 | q.breakable() |
| 4844 | q.text('}') |
| 4845 | |
| 4846 | bsn_stats_reply.subtypes[7] = bsn_gentable_stats_reply |
| 4847 | |
| 4848 | class bsn_gentable_stats_request(bsn_stats_request): |
| 4849 | version = 4 |
| 4850 | type = 18 |
| 4851 | stats_type = 65535 |
| 4852 | experimenter = 6035143 |
| 4853 | subtype = 7 |
| 4854 | |
| 4855 | def __init__(self, xid=None, flags=None): |
| 4856 | if xid != None: |
| 4857 | self.xid = xid |
| 4858 | else: |
| 4859 | self.xid = None |
| 4860 | if flags != None: |
| 4861 | self.flags = flags |
| 4862 | else: |
| 4863 | self.flags = 0 |
| 4864 | return |
| 4865 | |
| 4866 | def pack(self): |
| 4867 | packed = [] |
| 4868 | packed.append(struct.pack("!B", self.version)) |
| 4869 | packed.append(struct.pack("!B", self.type)) |
| 4870 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4871 | packed.append(struct.pack("!L", self.xid)) |
| 4872 | packed.append(struct.pack("!H", self.stats_type)) |
| 4873 | packed.append(struct.pack("!H", self.flags)) |
| 4874 | packed.append('\x00' * 4) |
| 4875 | packed.append(struct.pack("!L", self.experimenter)) |
| 4876 | packed.append(struct.pack("!L", self.subtype)) |
| 4877 | length = sum([len(x) for x in packed]) |
| 4878 | packed[2] = struct.pack("!H", length) |
| 4879 | return ''.join(packed) |
| 4880 | |
| 4881 | @staticmethod |
| 4882 | def unpack(reader): |
| 4883 | obj = bsn_gentable_stats_request() |
| 4884 | _version = reader.read("!B")[0] |
| 4885 | assert(_version == 4) |
| 4886 | _type = reader.read("!B")[0] |
| 4887 | assert(_type == 18) |
| 4888 | _length = reader.read("!H")[0] |
| 4889 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 4890 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4891 | obj.xid = reader.read("!L")[0] |
| 4892 | _stats_type = reader.read("!H")[0] |
| 4893 | assert(_stats_type == 65535) |
| 4894 | obj.flags = reader.read("!H")[0] |
| 4895 | reader.skip(4) |
| 4896 | _experimenter = reader.read("!L")[0] |
| 4897 | assert(_experimenter == 6035143) |
| 4898 | _subtype = reader.read("!L")[0] |
| 4899 | assert(_subtype == 7) |
| 4900 | return obj |
| 4901 | |
| 4902 | def __eq__(self, other): |
| 4903 | if type(self) != type(other): return False |
| 4904 | if self.xid != other.xid: return False |
| 4905 | if self.flags != other.flags: return False |
| 4906 | return True |
| 4907 | |
| 4908 | def pretty_print(self, q): |
| 4909 | q.text("bsn_gentable_stats_request {") |
| 4910 | with q.group(): |
| 4911 | with q.indent(2): |
| 4912 | q.breakable() |
| 4913 | q.text("xid = "); |
| 4914 | if self.xid != None: |
| 4915 | q.text("%#x" % self.xid) |
| 4916 | else: |
| 4917 | q.text('None') |
| 4918 | q.text(","); q.breakable() |
| 4919 | q.text("flags = "); |
| 4920 | q.text("%#x" % self.flags) |
| 4921 | q.breakable() |
| 4922 | q.text('}') |
| 4923 | |
| 4924 | bsn_stats_request.subtypes[7] = bsn_gentable_stats_request |
| 4925 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4926 | class bsn_get_interfaces_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4927 | version = 4 |
| 4928 | type = 4 |
| 4929 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4930 | subtype = 10 |
| 4931 | |
| 4932 | def __init__(self, xid=None, interfaces=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4933 | if xid != None: |
| 4934 | self.xid = xid |
| 4935 | else: |
| 4936 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4937 | if interfaces != None: |
| 4938 | self.interfaces = interfaces |
| 4939 | else: |
| 4940 | self.interfaces = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4941 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4942 | |
| 4943 | def pack(self): |
| 4944 | packed = [] |
| 4945 | packed.append(struct.pack("!B", self.version)) |
| 4946 | packed.append(struct.pack("!B", self.type)) |
| 4947 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4948 | packed.append(struct.pack("!L", self.xid)) |
| 4949 | packed.append(struct.pack("!L", self.experimenter)) |
| 4950 | packed.append(struct.pack("!L", self.subtype)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4951 | packed.append(loxi.generic_util.pack_list(self.interfaces)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4952 | length = sum([len(x) for x in packed]) |
| 4953 | packed[2] = struct.pack("!H", length) |
| 4954 | return ''.join(packed) |
| 4955 | |
| 4956 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4957 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4958 | obj = bsn_get_interfaces_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4959 | _version = reader.read("!B")[0] |
| 4960 | assert(_version == 4) |
| 4961 | _type = reader.read("!B")[0] |
| 4962 | assert(_type == 4) |
| 4963 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4964 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 4965 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4966 | obj.xid = reader.read("!L")[0] |
| 4967 | _experimenter = reader.read("!L")[0] |
| 4968 | assert(_experimenter == 6035143) |
| 4969 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4970 | assert(_subtype == 10) |
| 4971 | obj.interfaces = loxi.generic_util.unpack_list(reader, common.bsn_interface.unpack) |
| 4972 | return obj |
| 4973 | |
| 4974 | def __eq__(self, other): |
| 4975 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4976 | if self.xid != other.xid: return False |
| 4977 | if self.interfaces != other.interfaces: return False |
| 4978 | return True |
| 4979 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4980 | def pretty_print(self, q): |
| 4981 | q.text("bsn_get_interfaces_reply {") |
| 4982 | with q.group(): |
| 4983 | with q.indent(2): |
| 4984 | q.breakable() |
| 4985 | q.text("xid = "); |
| 4986 | if self.xid != None: |
| 4987 | q.text("%#x" % self.xid) |
| 4988 | else: |
| 4989 | q.text('None') |
| 4990 | q.text(","); q.breakable() |
| 4991 | q.text("interfaces = "); |
| 4992 | q.pp(self.interfaces) |
| 4993 | q.breakable() |
| 4994 | q.text('}') |
| 4995 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4996 | bsn_header.subtypes[10] = bsn_get_interfaces_reply |
| 4997 | |
| 4998 | class bsn_get_interfaces_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4999 | version = 4 |
| 5000 | type = 4 |
| 5001 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5002 | subtype = 9 |
| 5003 | |
| 5004 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5005 | if xid != None: |
| 5006 | self.xid = xid |
| 5007 | else: |
| 5008 | self.xid = None |
| 5009 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5010 | |
| 5011 | def pack(self): |
| 5012 | packed = [] |
| 5013 | packed.append(struct.pack("!B", self.version)) |
| 5014 | packed.append(struct.pack("!B", self.type)) |
| 5015 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5016 | packed.append(struct.pack("!L", self.xid)) |
| 5017 | packed.append(struct.pack("!L", self.experimenter)) |
| 5018 | packed.append(struct.pack("!L", self.subtype)) |
| 5019 | length = sum([len(x) for x in packed]) |
| 5020 | packed[2] = struct.pack("!H", length) |
| 5021 | return ''.join(packed) |
| 5022 | |
| 5023 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5024 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5025 | obj = bsn_get_interfaces_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5026 | _version = reader.read("!B")[0] |
| 5027 | assert(_version == 4) |
| 5028 | _type = reader.read("!B")[0] |
| 5029 | assert(_type == 4) |
| 5030 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5031 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 5032 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5033 | obj.xid = reader.read("!L")[0] |
| 5034 | _experimenter = reader.read("!L")[0] |
| 5035 | assert(_experimenter == 6035143) |
| 5036 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5037 | assert(_subtype == 9) |
| 5038 | return obj |
| 5039 | |
| 5040 | def __eq__(self, other): |
| 5041 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5042 | if self.xid != other.xid: return False |
| 5043 | return True |
| 5044 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5045 | def pretty_print(self, q): |
| 5046 | q.text("bsn_get_interfaces_request {") |
| 5047 | with q.group(): |
| 5048 | with q.indent(2): |
| 5049 | q.breakable() |
| 5050 | q.text("xid = "); |
| 5051 | if self.xid != None: |
| 5052 | q.text("%#x" % self.xid) |
| 5053 | else: |
| 5054 | q.text('None') |
| 5055 | q.breakable() |
| 5056 | q.text('}') |
| 5057 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5058 | bsn_header.subtypes[9] = bsn_get_interfaces_request |
| 5059 | |
| 5060 | class bsn_get_mirroring_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5061 | version = 4 |
| 5062 | type = 4 |
| 5063 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5064 | subtype = 5 |
| 5065 | |
| 5066 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5067 | if xid != None: |
| 5068 | self.xid = xid |
| 5069 | else: |
| 5070 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5071 | if report_mirror_ports != None: |
| 5072 | self.report_mirror_ports = report_mirror_ports |
| 5073 | else: |
| 5074 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5075 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5076 | |
| 5077 | def pack(self): |
| 5078 | packed = [] |
| 5079 | packed.append(struct.pack("!B", self.version)) |
| 5080 | packed.append(struct.pack("!B", self.type)) |
| 5081 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5082 | packed.append(struct.pack("!L", self.xid)) |
| 5083 | packed.append(struct.pack("!L", self.experimenter)) |
| 5084 | packed.append(struct.pack("!L", self.subtype)) |
| 5085 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 5086 | packed.append('\x00' * 3) |
| 5087 | length = sum([len(x) for x in packed]) |
| 5088 | packed[2] = struct.pack("!H", length) |
| 5089 | return ''.join(packed) |
| 5090 | |
| 5091 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5092 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5093 | obj = bsn_get_mirroring_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5094 | _version = reader.read("!B")[0] |
| 5095 | assert(_version == 4) |
| 5096 | _type = reader.read("!B")[0] |
| 5097 | assert(_type == 4) |
| 5098 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5099 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 5100 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5101 | obj.xid = reader.read("!L")[0] |
| 5102 | _experimenter = reader.read("!L")[0] |
| 5103 | assert(_experimenter == 6035143) |
| 5104 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5105 | assert(_subtype == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5106 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5107 | reader.skip(3) |
| 5108 | return obj |
| 5109 | |
| 5110 | def __eq__(self, other): |
| 5111 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5112 | if self.xid != other.xid: return False |
| 5113 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 5114 | return True |
| 5115 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5116 | def pretty_print(self, q): |
| 5117 | q.text("bsn_get_mirroring_reply {") |
| 5118 | with q.group(): |
| 5119 | with q.indent(2): |
| 5120 | q.breakable() |
| 5121 | q.text("xid = "); |
| 5122 | if self.xid != None: |
| 5123 | q.text("%#x" % self.xid) |
| 5124 | else: |
| 5125 | q.text('None') |
| 5126 | q.text(","); q.breakable() |
| 5127 | q.text("report_mirror_ports = "); |
| 5128 | q.text("%#x" % self.report_mirror_ports) |
| 5129 | q.breakable() |
| 5130 | q.text('}') |
| 5131 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5132 | bsn_header.subtypes[5] = bsn_get_mirroring_reply |
| 5133 | |
| 5134 | class bsn_get_mirroring_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5135 | version = 4 |
| 5136 | type = 4 |
| 5137 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5138 | subtype = 4 |
| 5139 | |
| 5140 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5141 | if xid != None: |
| 5142 | self.xid = xid |
| 5143 | else: |
| 5144 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5145 | if report_mirror_ports != None: |
| 5146 | self.report_mirror_ports = report_mirror_ports |
| 5147 | else: |
| 5148 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5149 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5150 | |
| 5151 | def pack(self): |
| 5152 | packed = [] |
| 5153 | packed.append(struct.pack("!B", self.version)) |
| 5154 | packed.append(struct.pack("!B", self.type)) |
| 5155 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5156 | packed.append(struct.pack("!L", self.xid)) |
| 5157 | packed.append(struct.pack("!L", self.experimenter)) |
| 5158 | packed.append(struct.pack("!L", self.subtype)) |
| 5159 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 5160 | packed.append('\x00' * 3) |
| 5161 | length = sum([len(x) for x in packed]) |
| 5162 | packed[2] = struct.pack("!H", length) |
| 5163 | return ''.join(packed) |
| 5164 | |
| 5165 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5166 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5167 | obj = bsn_get_mirroring_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5168 | _version = reader.read("!B")[0] |
| 5169 | assert(_version == 4) |
| 5170 | _type = reader.read("!B")[0] |
| 5171 | assert(_type == 4) |
| 5172 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5173 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 5174 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5175 | obj.xid = reader.read("!L")[0] |
| 5176 | _experimenter = reader.read("!L")[0] |
| 5177 | assert(_experimenter == 6035143) |
| 5178 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5179 | assert(_subtype == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5180 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5181 | reader.skip(3) |
| 5182 | return obj |
| 5183 | |
| 5184 | def __eq__(self, other): |
| 5185 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5186 | if self.xid != other.xid: return False |
| 5187 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 5188 | return True |
| 5189 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5190 | def pretty_print(self, q): |
| 5191 | q.text("bsn_get_mirroring_request {") |
| 5192 | with q.group(): |
| 5193 | with q.indent(2): |
| 5194 | q.breakable() |
| 5195 | q.text("xid = "); |
| 5196 | if self.xid != None: |
| 5197 | q.text("%#x" % self.xid) |
| 5198 | else: |
| 5199 | q.text('None') |
| 5200 | q.text(","); q.breakable() |
| 5201 | q.text("report_mirror_ports = "); |
| 5202 | q.text("%#x" % self.report_mirror_ports) |
| 5203 | q.breakable() |
| 5204 | q.text('}') |
| 5205 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5206 | bsn_header.subtypes[4] = bsn_get_mirroring_request |
| 5207 | |
| 5208 | class bsn_get_switch_pipeline_reply(bsn_header): |
| 5209 | version = 4 |
| 5210 | type = 4 |
| 5211 | experimenter = 6035143 |
| 5212 | subtype = 52 |
| 5213 | |
| 5214 | def __init__(self, xid=None, pipeline=None): |
| 5215 | if xid != None: |
| 5216 | self.xid = xid |
| 5217 | else: |
| 5218 | self.xid = None |
| 5219 | if pipeline != None: |
| 5220 | self.pipeline = pipeline |
| 5221 | else: |
| 5222 | self.pipeline = "" |
| 5223 | return |
| 5224 | |
| 5225 | def pack(self): |
| 5226 | packed = [] |
| 5227 | packed.append(struct.pack("!B", self.version)) |
| 5228 | packed.append(struct.pack("!B", self.type)) |
| 5229 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5230 | packed.append(struct.pack("!L", self.xid)) |
| 5231 | packed.append(struct.pack("!L", self.experimenter)) |
| 5232 | packed.append(struct.pack("!L", self.subtype)) |
| 5233 | packed.append(struct.pack("!256s", self.pipeline)) |
| 5234 | length = sum([len(x) for x in packed]) |
| 5235 | packed[2] = struct.pack("!H", length) |
| 5236 | return ''.join(packed) |
| 5237 | |
| 5238 | @staticmethod |
| 5239 | def unpack(reader): |
| 5240 | obj = bsn_get_switch_pipeline_reply() |
| 5241 | _version = reader.read("!B")[0] |
| 5242 | assert(_version == 4) |
| 5243 | _type = reader.read("!B")[0] |
| 5244 | assert(_type == 4) |
| 5245 | _length = reader.read("!H")[0] |
| 5246 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 5247 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5248 | obj.xid = reader.read("!L")[0] |
| 5249 | _experimenter = reader.read("!L")[0] |
| 5250 | assert(_experimenter == 6035143) |
| 5251 | _subtype = reader.read("!L")[0] |
| 5252 | assert(_subtype == 52) |
| 5253 | obj.pipeline = reader.read("!256s")[0].rstrip("\x00") |
| 5254 | return obj |
| 5255 | |
| 5256 | def __eq__(self, other): |
| 5257 | if type(self) != type(other): return False |
| 5258 | if self.xid != other.xid: return False |
| 5259 | if self.pipeline != other.pipeline: return False |
| 5260 | return True |
| 5261 | |
| 5262 | def pretty_print(self, q): |
| 5263 | q.text("bsn_get_switch_pipeline_reply {") |
| 5264 | with q.group(): |
| 5265 | with q.indent(2): |
| 5266 | q.breakable() |
| 5267 | q.text("xid = "); |
| 5268 | if self.xid != None: |
| 5269 | q.text("%#x" % self.xid) |
| 5270 | else: |
| 5271 | q.text('None') |
| 5272 | q.text(","); q.breakable() |
| 5273 | q.text("pipeline = "); |
| 5274 | q.pp(self.pipeline) |
| 5275 | q.breakable() |
| 5276 | q.text('}') |
| 5277 | |
| 5278 | bsn_header.subtypes[52] = bsn_get_switch_pipeline_reply |
| 5279 | |
| 5280 | class bsn_get_switch_pipeline_request(bsn_header): |
| 5281 | version = 4 |
| 5282 | type = 4 |
| 5283 | experimenter = 6035143 |
| 5284 | subtype = 51 |
| 5285 | |
| 5286 | def __init__(self, xid=None): |
| 5287 | if xid != None: |
| 5288 | self.xid = xid |
| 5289 | else: |
| 5290 | self.xid = None |
| 5291 | return |
| 5292 | |
| 5293 | def pack(self): |
| 5294 | packed = [] |
| 5295 | packed.append(struct.pack("!B", self.version)) |
| 5296 | packed.append(struct.pack("!B", self.type)) |
| 5297 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5298 | packed.append(struct.pack("!L", self.xid)) |
| 5299 | packed.append(struct.pack("!L", self.experimenter)) |
| 5300 | packed.append(struct.pack("!L", self.subtype)) |
| 5301 | length = sum([len(x) for x in packed]) |
| 5302 | packed[2] = struct.pack("!H", length) |
| 5303 | return ''.join(packed) |
| 5304 | |
| 5305 | @staticmethod |
| 5306 | def unpack(reader): |
| 5307 | obj = bsn_get_switch_pipeline_request() |
| 5308 | _version = reader.read("!B")[0] |
| 5309 | assert(_version == 4) |
| 5310 | _type = reader.read("!B")[0] |
| 5311 | assert(_type == 4) |
| 5312 | _length = reader.read("!H")[0] |
| 5313 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 5314 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5315 | obj.xid = reader.read("!L")[0] |
| 5316 | _experimenter = reader.read("!L")[0] |
| 5317 | assert(_experimenter == 6035143) |
| 5318 | _subtype = reader.read("!L")[0] |
| 5319 | assert(_subtype == 51) |
| 5320 | return obj |
| 5321 | |
| 5322 | def __eq__(self, other): |
| 5323 | if type(self) != type(other): return False |
| 5324 | if self.xid != other.xid: return False |
| 5325 | return True |
| 5326 | |
| 5327 | def pretty_print(self, q): |
| 5328 | q.text("bsn_get_switch_pipeline_request {") |
| 5329 | with q.group(): |
| 5330 | with q.indent(2): |
| 5331 | q.breakable() |
| 5332 | q.text("xid = "); |
| 5333 | if self.xid != None: |
| 5334 | q.text("%#x" % self.xid) |
| 5335 | else: |
| 5336 | q.text('None') |
| 5337 | q.breakable() |
| 5338 | q.text('}') |
| 5339 | |
| 5340 | bsn_header.subtypes[51] = bsn_get_switch_pipeline_request |
| 5341 | |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 5342 | class bsn_image_desc_stats_reply(bsn_stats_reply): |
| 5343 | version = 4 |
| 5344 | type = 19 |
| 5345 | stats_type = 65535 |
| 5346 | experimenter = 6035143 |
| 5347 | subtype = 14 |
| 5348 | |
| 5349 | def __init__(self, xid=None, flags=None, image_checksum=None, startup_config_checksum=None): |
| 5350 | if xid != None: |
| 5351 | self.xid = xid |
| 5352 | else: |
| 5353 | self.xid = None |
| 5354 | if flags != None: |
| 5355 | self.flags = flags |
| 5356 | else: |
| 5357 | self.flags = 0 |
| 5358 | if image_checksum != None: |
| 5359 | self.image_checksum = image_checksum |
| 5360 | else: |
| 5361 | self.image_checksum = "" |
| 5362 | if startup_config_checksum != None: |
| 5363 | self.startup_config_checksum = startup_config_checksum |
| 5364 | else: |
| 5365 | self.startup_config_checksum = "" |
| 5366 | return |
| 5367 | |
| 5368 | def pack(self): |
| 5369 | packed = [] |
| 5370 | packed.append(struct.pack("!B", self.version)) |
| 5371 | packed.append(struct.pack("!B", self.type)) |
| 5372 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5373 | packed.append(struct.pack("!L", self.xid)) |
| 5374 | packed.append(struct.pack("!H", self.stats_type)) |
| 5375 | packed.append(struct.pack("!H", self.flags)) |
| 5376 | packed.append('\x00' * 4) |
| 5377 | packed.append(struct.pack("!L", self.experimenter)) |
| 5378 | packed.append(struct.pack("!L", self.subtype)) |
| 5379 | packed.append(struct.pack("!256s", self.image_checksum)) |
| 5380 | packed.append(struct.pack("!256s", self.startup_config_checksum)) |
| 5381 | length = sum([len(x) for x in packed]) |
| 5382 | packed[2] = struct.pack("!H", length) |
| 5383 | return ''.join(packed) |
| 5384 | |
| 5385 | @staticmethod |
| 5386 | def unpack(reader): |
| 5387 | obj = bsn_image_desc_stats_reply() |
| 5388 | _version = reader.read("!B")[0] |
| 5389 | assert(_version == 4) |
| 5390 | _type = reader.read("!B")[0] |
| 5391 | assert(_type == 19) |
| 5392 | _length = reader.read("!H")[0] |
| 5393 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 5394 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 5395 | obj.xid = reader.read("!L")[0] |
| 5396 | _stats_type = reader.read("!H")[0] |
| 5397 | assert(_stats_type == 65535) |
| 5398 | obj.flags = reader.read("!H")[0] |
| 5399 | reader.skip(4) |
| 5400 | _experimenter = reader.read("!L")[0] |
| 5401 | assert(_experimenter == 6035143) |
| 5402 | _subtype = reader.read("!L")[0] |
| 5403 | assert(_subtype == 14) |
| 5404 | obj.image_checksum = reader.read("!256s")[0].rstrip("\x00") |
| 5405 | obj.startup_config_checksum = reader.read("!256s")[0].rstrip("\x00") |
| 5406 | return obj |
| 5407 | |
| 5408 | def __eq__(self, other): |
| 5409 | if type(self) != type(other): return False |
| 5410 | if self.xid != other.xid: return False |
| 5411 | if self.flags != other.flags: return False |
| 5412 | if self.image_checksum != other.image_checksum: return False |
| 5413 | if self.startup_config_checksum != other.startup_config_checksum: return False |
| 5414 | return True |
| 5415 | |
| 5416 | def pretty_print(self, q): |
| 5417 | q.text("bsn_image_desc_stats_reply {") |
| 5418 | with q.group(): |
| 5419 | with q.indent(2): |
| 5420 | q.breakable() |
| 5421 | q.text("xid = "); |
| 5422 | if self.xid != None: |
| 5423 | q.text("%#x" % self.xid) |
| 5424 | else: |
| 5425 | q.text('None') |
| 5426 | q.text(","); q.breakable() |
| 5427 | q.text("flags = "); |
| 5428 | q.text("%#x" % self.flags) |
| 5429 | q.text(","); q.breakable() |
| 5430 | q.text("image_checksum = "); |
| 5431 | q.pp(self.image_checksum) |
| 5432 | q.text(","); q.breakable() |
| 5433 | q.text("startup_config_checksum = "); |
| 5434 | q.pp(self.startup_config_checksum) |
| 5435 | q.breakable() |
| 5436 | q.text('}') |
| 5437 | |
| 5438 | bsn_stats_reply.subtypes[14] = bsn_image_desc_stats_reply |
| 5439 | |
| 5440 | class bsn_image_desc_stats_request(bsn_stats_request): |
| 5441 | version = 4 |
| 5442 | type = 18 |
| 5443 | stats_type = 65535 |
| 5444 | experimenter = 6035143 |
| 5445 | subtype = 14 |
| 5446 | |
| 5447 | def __init__(self, xid=None, flags=None): |
| 5448 | if xid != None: |
| 5449 | self.xid = xid |
| 5450 | else: |
| 5451 | self.xid = None |
| 5452 | if flags != None: |
| 5453 | self.flags = flags |
| 5454 | else: |
| 5455 | self.flags = 0 |
| 5456 | return |
| 5457 | |
| 5458 | def pack(self): |
| 5459 | packed = [] |
| 5460 | packed.append(struct.pack("!B", self.version)) |
| 5461 | packed.append(struct.pack("!B", self.type)) |
| 5462 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5463 | packed.append(struct.pack("!L", self.xid)) |
| 5464 | packed.append(struct.pack("!H", self.stats_type)) |
| 5465 | packed.append(struct.pack("!H", self.flags)) |
| 5466 | packed.append('\x00' * 4) |
| 5467 | packed.append(struct.pack("!L", self.experimenter)) |
| 5468 | packed.append(struct.pack("!L", self.subtype)) |
| 5469 | length = sum([len(x) for x in packed]) |
| 5470 | packed[2] = struct.pack("!H", length) |
| 5471 | return ''.join(packed) |
| 5472 | |
| 5473 | @staticmethod |
| 5474 | def unpack(reader): |
| 5475 | obj = bsn_image_desc_stats_request() |
| 5476 | _version = reader.read("!B")[0] |
| 5477 | assert(_version == 4) |
| 5478 | _type = reader.read("!B")[0] |
| 5479 | assert(_type == 18) |
| 5480 | _length = reader.read("!H")[0] |
| 5481 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 5482 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 5483 | obj.xid = reader.read("!L")[0] |
| 5484 | _stats_type = reader.read("!H")[0] |
| 5485 | assert(_stats_type == 65535) |
| 5486 | obj.flags = reader.read("!H")[0] |
| 5487 | reader.skip(4) |
| 5488 | _experimenter = reader.read("!L")[0] |
| 5489 | assert(_experimenter == 6035143) |
| 5490 | _subtype = reader.read("!L")[0] |
| 5491 | assert(_subtype == 14) |
| 5492 | return obj |
| 5493 | |
| 5494 | def __eq__(self, other): |
| 5495 | if type(self) != type(other): return False |
| 5496 | if self.xid != other.xid: return False |
| 5497 | if self.flags != other.flags: return False |
| 5498 | return True |
| 5499 | |
| 5500 | def pretty_print(self, q): |
| 5501 | q.text("bsn_image_desc_stats_request {") |
| 5502 | with q.group(): |
| 5503 | with q.indent(2): |
| 5504 | q.breakable() |
| 5505 | q.text("xid = "); |
| 5506 | if self.xid != None: |
| 5507 | q.text("%#x" % self.xid) |
| 5508 | else: |
| 5509 | q.text('None') |
| 5510 | q.text(","); q.breakable() |
| 5511 | q.text("flags = "); |
| 5512 | q.text("%#x" % self.flags) |
| 5513 | q.breakable() |
| 5514 | q.text('}') |
| 5515 | |
| 5516 | bsn_stats_request.subtypes[14] = bsn_image_desc_stats_request |
| 5517 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5518 | class bsn_lacp_convergence_notif(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5519 | version = 4 |
| 5520 | type = 4 |
| 5521 | experimenter = 6035143 |
| 5522 | subtype = 43 |
| 5523 | |
| 5524 | 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] | 5525 | if xid != None: |
| 5526 | self.xid = xid |
| 5527 | else: |
| 5528 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5529 | if convergence_status != None: |
| 5530 | self.convergence_status = convergence_status |
| 5531 | else: |
| 5532 | self.convergence_status = 0 |
| 5533 | if port_no != None: |
| 5534 | self.port_no = port_no |
| 5535 | else: |
| 5536 | self.port_no = 0 |
| 5537 | if actor_sys_priority != None: |
| 5538 | self.actor_sys_priority = actor_sys_priority |
| 5539 | else: |
| 5540 | self.actor_sys_priority = 0 |
| 5541 | if actor_sys_mac != None: |
| 5542 | self.actor_sys_mac = actor_sys_mac |
| 5543 | else: |
| 5544 | self.actor_sys_mac = [0,0,0,0,0,0] |
| 5545 | if actor_port_priority != None: |
| 5546 | self.actor_port_priority = actor_port_priority |
| 5547 | else: |
| 5548 | self.actor_port_priority = 0 |
| 5549 | if actor_port_num != None: |
| 5550 | self.actor_port_num = actor_port_num |
| 5551 | else: |
| 5552 | self.actor_port_num = 0 |
| 5553 | if actor_key != None: |
| 5554 | self.actor_key = actor_key |
| 5555 | else: |
| 5556 | self.actor_key = 0 |
| 5557 | if partner_sys_priority != None: |
| 5558 | self.partner_sys_priority = partner_sys_priority |
| 5559 | else: |
| 5560 | self.partner_sys_priority = 0 |
| 5561 | if partner_sys_mac != None: |
| 5562 | self.partner_sys_mac = partner_sys_mac |
| 5563 | else: |
| 5564 | self.partner_sys_mac = [0,0,0,0,0,0] |
| 5565 | if partner_port_priority != None: |
| 5566 | self.partner_port_priority = partner_port_priority |
| 5567 | else: |
| 5568 | self.partner_port_priority = 0 |
| 5569 | if partner_port_num != None: |
| 5570 | self.partner_port_num = partner_port_num |
| 5571 | else: |
| 5572 | self.partner_port_num = 0 |
| 5573 | if partner_key != None: |
| 5574 | self.partner_key = partner_key |
| 5575 | else: |
| 5576 | self.partner_key = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5577 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5578 | |
| 5579 | def pack(self): |
| 5580 | packed = [] |
| 5581 | packed.append(struct.pack("!B", self.version)) |
| 5582 | packed.append(struct.pack("!B", self.type)) |
| 5583 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5584 | packed.append(struct.pack("!L", self.xid)) |
| 5585 | packed.append(struct.pack("!L", self.experimenter)) |
| 5586 | packed.append(struct.pack("!L", self.subtype)) |
| 5587 | packed.append(struct.pack("!B", self.convergence_status)) |
| 5588 | packed.append('\x00' * 3) |
| 5589 | packed.append(util.pack_port_no(self.port_no)) |
| 5590 | packed.append(struct.pack("!H", self.actor_sys_priority)) |
| 5591 | packed.append(struct.pack("!6B", *self.actor_sys_mac)) |
| 5592 | packed.append(struct.pack("!H", self.actor_port_priority)) |
| 5593 | packed.append(struct.pack("!H", self.actor_port_num)) |
| 5594 | packed.append(struct.pack("!H", self.actor_key)) |
| 5595 | packed.append(struct.pack("!H", self.partner_sys_priority)) |
| 5596 | packed.append(struct.pack("!6B", *self.partner_sys_mac)) |
| 5597 | packed.append(struct.pack("!H", self.partner_port_priority)) |
| 5598 | packed.append(struct.pack("!H", self.partner_port_num)) |
| 5599 | packed.append(struct.pack("!H", self.partner_key)) |
| 5600 | length = sum([len(x) for x in packed]) |
| 5601 | packed[2] = struct.pack("!H", length) |
| 5602 | return ''.join(packed) |
| 5603 | |
| 5604 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5605 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5606 | obj = bsn_lacp_convergence_notif() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5607 | _version = reader.read("!B")[0] |
| 5608 | assert(_version == 4) |
| 5609 | _type = reader.read("!B")[0] |
| 5610 | assert(_type == 4) |
| 5611 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5612 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 5613 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5614 | obj.xid = reader.read("!L")[0] |
| 5615 | _experimenter = reader.read("!L")[0] |
| 5616 | assert(_experimenter == 6035143) |
| 5617 | _subtype = reader.read("!L")[0] |
| 5618 | assert(_subtype == 43) |
| 5619 | obj.convergence_status = reader.read("!B")[0] |
| 5620 | reader.skip(3) |
| 5621 | obj.port_no = util.unpack_port_no(reader) |
| 5622 | obj.actor_sys_priority = reader.read("!H")[0] |
| 5623 | obj.actor_sys_mac = list(reader.read('!6B')) |
| 5624 | obj.actor_port_priority = reader.read("!H")[0] |
| 5625 | obj.actor_port_num = reader.read("!H")[0] |
| 5626 | obj.actor_key = reader.read("!H")[0] |
| 5627 | obj.partner_sys_priority = reader.read("!H")[0] |
| 5628 | obj.partner_sys_mac = list(reader.read('!6B')) |
| 5629 | obj.partner_port_priority = reader.read("!H")[0] |
| 5630 | obj.partner_port_num = reader.read("!H")[0] |
| 5631 | obj.partner_key = reader.read("!H")[0] |
| 5632 | return obj |
| 5633 | |
| 5634 | def __eq__(self, other): |
| 5635 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5636 | if self.xid != other.xid: return False |
| 5637 | if self.convergence_status != other.convergence_status: return False |
| 5638 | if self.port_no != other.port_no: return False |
| 5639 | if self.actor_sys_priority != other.actor_sys_priority: return False |
| 5640 | if self.actor_sys_mac != other.actor_sys_mac: return False |
| 5641 | if self.actor_port_priority != other.actor_port_priority: return False |
| 5642 | if self.actor_port_num != other.actor_port_num: return False |
| 5643 | if self.actor_key != other.actor_key: return False |
| 5644 | if self.partner_sys_priority != other.partner_sys_priority: return False |
| 5645 | if self.partner_sys_mac != other.partner_sys_mac: return False |
| 5646 | if self.partner_port_priority != other.partner_port_priority: return False |
| 5647 | if self.partner_port_num != other.partner_port_num: return False |
| 5648 | if self.partner_key != other.partner_key: return False |
| 5649 | return True |
| 5650 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5651 | def pretty_print(self, q): |
| 5652 | q.text("bsn_lacp_convergence_notif {") |
| 5653 | with q.group(): |
| 5654 | with q.indent(2): |
| 5655 | q.breakable() |
| 5656 | q.text("xid = "); |
| 5657 | if self.xid != None: |
| 5658 | q.text("%#x" % self.xid) |
| 5659 | else: |
| 5660 | q.text('None') |
| 5661 | q.text(","); q.breakable() |
| 5662 | q.text("convergence_status = "); |
| 5663 | q.text("%#x" % self.convergence_status) |
| 5664 | q.text(","); q.breakable() |
| 5665 | q.text("port_no = "); |
| 5666 | q.text(util.pretty_port(self.port_no)) |
| 5667 | q.text(","); q.breakable() |
| 5668 | q.text("actor_sys_priority = "); |
| 5669 | q.text("%#x" % self.actor_sys_priority) |
| 5670 | q.text(","); q.breakable() |
| 5671 | q.text("actor_sys_mac = "); |
| 5672 | q.text(util.pretty_mac(self.actor_sys_mac)) |
| 5673 | q.text(","); q.breakable() |
| 5674 | q.text("actor_port_priority = "); |
| 5675 | q.text("%#x" % self.actor_port_priority) |
| 5676 | q.text(","); q.breakable() |
| 5677 | q.text("actor_port_num = "); |
| 5678 | q.text("%#x" % self.actor_port_num) |
| 5679 | q.text(","); q.breakable() |
| 5680 | q.text("actor_key = "); |
| 5681 | q.text("%#x" % self.actor_key) |
| 5682 | q.text(","); q.breakable() |
| 5683 | q.text("partner_sys_priority = "); |
| 5684 | q.text("%#x" % self.partner_sys_priority) |
| 5685 | q.text(","); q.breakable() |
| 5686 | q.text("partner_sys_mac = "); |
| 5687 | q.text(util.pretty_mac(self.partner_sys_mac)) |
| 5688 | q.text(","); q.breakable() |
| 5689 | q.text("partner_port_priority = "); |
| 5690 | q.text("%#x" % self.partner_port_priority) |
| 5691 | q.text(","); q.breakable() |
| 5692 | q.text("partner_port_num = "); |
| 5693 | q.text("%#x" % self.partner_port_num) |
| 5694 | q.text(","); q.breakable() |
| 5695 | q.text("partner_key = "); |
| 5696 | q.text("%#x" % self.partner_key) |
| 5697 | q.breakable() |
| 5698 | q.text('}') |
| 5699 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5700 | bsn_header.subtypes[43] = bsn_lacp_convergence_notif |
| 5701 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5702 | class bsn_lacp_stats_reply(bsn_stats_reply): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5703 | version = 4 |
| 5704 | type = 19 |
| 5705 | stats_type = 65535 |
| 5706 | experimenter = 6035143 |
| 5707 | subtype = 1 |
| 5708 | |
| 5709 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5710 | if xid != None: |
| 5711 | self.xid = xid |
| 5712 | else: |
| 5713 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5714 | if flags != None: |
| 5715 | self.flags = flags |
| 5716 | else: |
| 5717 | self.flags = 0 |
| 5718 | if entries != None: |
| 5719 | self.entries = entries |
| 5720 | else: |
| 5721 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5722 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5723 | |
| 5724 | def pack(self): |
| 5725 | packed = [] |
| 5726 | packed.append(struct.pack("!B", self.version)) |
| 5727 | packed.append(struct.pack("!B", self.type)) |
| 5728 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5729 | packed.append(struct.pack("!L", self.xid)) |
| 5730 | packed.append(struct.pack("!H", self.stats_type)) |
| 5731 | packed.append(struct.pack("!H", self.flags)) |
| 5732 | packed.append('\x00' * 4) |
| 5733 | packed.append(struct.pack("!L", self.experimenter)) |
| 5734 | packed.append(struct.pack("!L", self.subtype)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5735 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5736 | length = sum([len(x) for x in packed]) |
| 5737 | packed[2] = struct.pack("!H", length) |
| 5738 | return ''.join(packed) |
| 5739 | |
| 5740 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5741 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5742 | obj = bsn_lacp_stats_reply() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5743 | _version = reader.read("!B")[0] |
| 5744 | assert(_version == 4) |
| 5745 | _type = reader.read("!B")[0] |
| 5746 | assert(_type == 19) |
| 5747 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5748 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 5749 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5750 | obj.xid = reader.read("!L")[0] |
| 5751 | _stats_type = reader.read("!H")[0] |
| 5752 | assert(_stats_type == 65535) |
| 5753 | obj.flags = reader.read("!H")[0] |
| 5754 | reader.skip(4) |
| 5755 | _experimenter = reader.read("!L")[0] |
| 5756 | assert(_experimenter == 6035143) |
| 5757 | _subtype = reader.read("!L")[0] |
| 5758 | assert(_subtype == 1) |
| 5759 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_lacp_stats_entry.unpack) |
| 5760 | return obj |
| 5761 | |
| 5762 | def __eq__(self, other): |
| 5763 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5764 | if self.xid != other.xid: return False |
| 5765 | if self.flags != other.flags: return False |
| 5766 | if self.entries != other.entries: return False |
| 5767 | return True |
| 5768 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5769 | def pretty_print(self, q): |
| 5770 | q.text("bsn_lacp_stats_reply {") |
| 5771 | with q.group(): |
| 5772 | with q.indent(2): |
| 5773 | q.breakable() |
| 5774 | q.text("xid = "); |
| 5775 | if self.xid != None: |
| 5776 | q.text("%#x" % self.xid) |
| 5777 | else: |
| 5778 | q.text('None') |
| 5779 | q.text(","); q.breakable() |
| 5780 | q.text("flags = "); |
| 5781 | q.text("%#x" % self.flags) |
| 5782 | q.text(","); q.breakable() |
| 5783 | q.text("entries = "); |
| 5784 | q.pp(self.entries) |
| 5785 | q.breakable() |
| 5786 | q.text('}') |
| 5787 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5788 | bsn_stats_reply.subtypes[1] = bsn_lacp_stats_reply |
| 5789 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5790 | class bsn_lacp_stats_request(bsn_stats_request): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5791 | version = 4 |
| 5792 | type = 18 |
| 5793 | stats_type = 65535 |
| 5794 | experimenter = 6035143 |
| 5795 | subtype = 1 |
| 5796 | |
| 5797 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5798 | if xid != None: |
| 5799 | self.xid = xid |
| 5800 | else: |
| 5801 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5802 | if flags != None: |
| 5803 | self.flags = flags |
| 5804 | else: |
| 5805 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5806 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5807 | |
| 5808 | def pack(self): |
| 5809 | packed = [] |
| 5810 | packed.append(struct.pack("!B", self.version)) |
| 5811 | packed.append(struct.pack("!B", self.type)) |
| 5812 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5813 | packed.append(struct.pack("!L", self.xid)) |
| 5814 | packed.append(struct.pack("!H", self.stats_type)) |
| 5815 | packed.append(struct.pack("!H", self.flags)) |
| 5816 | packed.append('\x00' * 4) |
| 5817 | packed.append(struct.pack("!L", self.experimenter)) |
| 5818 | packed.append(struct.pack("!L", self.subtype)) |
| 5819 | length = sum([len(x) for x in packed]) |
| 5820 | packed[2] = struct.pack("!H", length) |
| 5821 | return ''.join(packed) |
| 5822 | |
| 5823 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5824 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5825 | obj = bsn_lacp_stats_request() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5826 | _version = reader.read("!B")[0] |
| 5827 | assert(_version == 4) |
| 5828 | _type = reader.read("!B")[0] |
| 5829 | assert(_type == 18) |
| 5830 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5831 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 5832 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5833 | obj.xid = reader.read("!L")[0] |
| 5834 | _stats_type = reader.read("!H")[0] |
| 5835 | assert(_stats_type == 65535) |
| 5836 | obj.flags = reader.read("!H")[0] |
| 5837 | reader.skip(4) |
| 5838 | _experimenter = reader.read("!L")[0] |
| 5839 | assert(_experimenter == 6035143) |
| 5840 | _subtype = reader.read("!L")[0] |
| 5841 | assert(_subtype == 1) |
| 5842 | return obj |
| 5843 | |
| 5844 | def __eq__(self, other): |
| 5845 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5846 | if self.xid != other.xid: return False |
| 5847 | if self.flags != other.flags: return False |
| 5848 | return True |
| 5849 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5850 | def pretty_print(self, q): |
| 5851 | q.text("bsn_lacp_stats_request {") |
| 5852 | with q.group(): |
| 5853 | with q.indent(2): |
| 5854 | q.breakable() |
| 5855 | q.text("xid = "); |
| 5856 | if self.xid != None: |
| 5857 | q.text("%#x" % self.xid) |
| 5858 | else: |
| 5859 | q.text('None') |
| 5860 | q.text(","); q.breakable() |
| 5861 | q.text("flags = "); |
| 5862 | q.text("%#x" % self.flags) |
| 5863 | q.breakable() |
| 5864 | q.text('}') |
| 5865 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5866 | bsn_stats_request.subtypes[1] = bsn_lacp_stats_request |
| 5867 | |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 5868 | class bsn_log(bsn_header): |
| 5869 | version = 4 |
| 5870 | type = 4 |
| 5871 | experimenter = 6035143 |
| 5872 | subtype = 63 |
| 5873 | |
| 5874 | def __init__(self, xid=None, loglevel=None, data=None): |
| 5875 | if xid != None: |
| 5876 | self.xid = xid |
| 5877 | else: |
| 5878 | self.xid = None |
| 5879 | if loglevel != None: |
| 5880 | self.loglevel = loglevel |
| 5881 | else: |
| 5882 | self.loglevel = 0 |
| 5883 | if data != None: |
| 5884 | self.data = data |
| 5885 | else: |
| 5886 | self.data = '' |
| 5887 | return |
| 5888 | |
| 5889 | def pack(self): |
| 5890 | packed = [] |
| 5891 | packed.append(struct.pack("!B", self.version)) |
| 5892 | packed.append(struct.pack("!B", self.type)) |
| 5893 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5894 | packed.append(struct.pack("!L", self.xid)) |
| 5895 | packed.append(struct.pack("!L", self.experimenter)) |
| 5896 | packed.append(struct.pack("!L", self.subtype)) |
| 5897 | packed.append(struct.pack("!B", self.loglevel)) |
| 5898 | packed.append(self.data) |
| 5899 | length = sum([len(x) for x in packed]) |
| 5900 | packed[2] = struct.pack("!H", length) |
| 5901 | return ''.join(packed) |
| 5902 | |
| 5903 | @staticmethod |
| 5904 | def unpack(reader): |
| 5905 | obj = bsn_log() |
| 5906 | _version = reader.read("!B")[0] |
| 5907 | assert(_version == 4) |
| 5908 | _type = reader.read("!B")[0] |
| 5909 | assert(_type == 4) |
| 5910 | _length = reader.read("!H")[0] |
| 5911 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 5912 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 5913 | obj.xid = reader.read("!L")[0] |
| 5914 | _experimenter = reader.read("!L")[0] |
| 5915 | assert(_experimenter == 6035143) |
| 5916 | _subtype = reader.read("!L")[0] |
| 5917 | assert(_subtype == 63) |
| 5918 | obj.loglevel = reader.read("!B")[0] |
| 5919 | obj.data = str(reader.read_all()) |
| 5920 | return obj |
| 5921 | |
| 5922 | def __eq__(self, other): |
| 5923 | if type(self) != type(other): return False |
| 5924 | if self.xid != other.xid: return False |
| 5925 | if self.loglevel != other.loglevel: return False |
| 5926 | if self.data != other.data: return False |
| 5927 | return True |
| 5928 | |
| 5929 | def pretty_print(self, q): |
| 5930 | q.text("bsn_log {") |
| 5931 | with q.group(): |
| 5932 | with q.indent(2): |
| 5933 | q.breakable() |
| 5934 | q.text("xid = "); |
| 5935 | if self.xid != None: |
| 5936 | q.text("%#x" % self.xid) |
| 5937 | else: |
| 5938 | q.text('None') |
| 5939 | q.text(","); q.breakable() |
| 5940 | q.text("loglevel = "); |
| 5941 | q.text("%#x" % self.loglevel) |
| 5942 | q.text(","); q.breakable() |
| 5943 | q.text("data = "); |
| 5944 | q.pp(self.data) |
| 5945 | q.breakable() |
| 5946 | q.text('}') |
| 5947 | |
| 5948 | bsn_header.subtypes[63] = bsn_log |
| 5949 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5950 | class bsn_pdu_rx_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5951 | version = 4 |
| 5952 | type = 4 |
| 5953 | experimenter = 6035143 |
| 5954 | subtype = 34 |
| 5955 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5956 | 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] | 5957 | if xid != None: |
| 5958 | self.xid = xid |
| 5959 | else: |
| 5960 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5961 | if status != None: |
| 5962 | self.status = status |
| 5963 | else: |
| 5964 | self.status = 0 |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5965 | if port_no != None: |
| 5966 | self.port_no = port_no |
| 5967 | else: |
| 5968 | self.port_no = 0 |
| 5969 | if slot_num != None: |
| 5970 | self.slot_num = slot_num |
| 5971 | else: |
| 5972 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5973 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5974 | |
| 5975 | def pack(self): |
| 5976 | packed = [] |
| 5977 | packed.append(struct.pack("!B", self.version)) |
| 5978 | packed.append(struct.pack("!B", self.type)) |
| 5979 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5980 | packed.append(struct.pack("!L", self.xid)) |
| 5981 | packed.append(struct.pack("!L", self.experimenter)) |
| 5982 | packed.append(struct.pack("!L", self.subtype)) |
| 5983 | packed.append(struct.pack("!L", self.status)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5984 | packed.append(util.pack_port_no(self.port_no)) |
| 5985 | packed.append(struct.pack("!B", self.slot_num)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5986 | length = sum([len(x) for x in packed]) |
| 5987 | packed[2] = struct.pack("!H", length) |
| 5988 | return ''.join(packed) |
| 5989 | |
| 5990 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5991 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5992 | obj = bsn_pdu_rx_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5993 | _version = reader.read("!B")[0] |
| 5994 | assert(_version == 4) |
| 5995 | _type = reader.read("!B")[0] |
| 5996 | assert(_type == 4) |
| 5997 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5998 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 5999 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6000 | obj.xid = reader.read("!L")[0] |
| 6001 | _experimenter = reader.read("!L")[0] |
| 6002 | assert(_experimenter == 6035143) |
| 6003 | _subtype = reader.read("!L")[0] |
| 6004 | assert(_subtype == 34) |
| 6005 | obj.status = reader.read("!L")[0] |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6006 | obj.port_no = util.unpack_port_no(reader) |
| 6007 | obj.slot_num = reader.read("!B")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6008 | return obj |
| 6009 | |
| 6010 | def __eq__(self, other): |
| 6011 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6012 | if self.xid != other.xid: return False |
| 6013 | if self.status != other.status: return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6014 | if self.port_no != other.port_no: return False |
| 6015 | if self.slot_num != other.slot_num: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6016 | return True |
| 6017 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6018 | def pretty_print(self, q): |
| 6019 | q.text("bsn_pdu_rx_reply {") |
| 6020 | with q.group(): |
| 6021 | with q.indent(2): |
| 6022 | q.breakable() |
| 6023 | q.text("xid = "); |
| 6024 | if self.xid != None: |
| 6025 | q.text("%#x" % self.xid) |
| 6026 | else: |
| 6027 | q.text('None') |
| 6028 | q.text(","); q.breakable() |
| 6029 | q.text("status = "); |
| 6030 | q.text("%#x" % self.status) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 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) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6037 | q.breakable() |
| 6038 | q.text('}') |
| 6039 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6040 | bsn_header.subtypes[34] = bsn_pdu_rx_reply |
| 6041 | |
| 6042 | class bsn_pdu_rx_request(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 = 33 |
| 6047 | |
| 6048 | 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] | 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 timeout_ms != None: |
| 6054 | self.timeout_ms = timeout_ms |
| 6055 | else: |
| 6056 | self.timeout_ms = 0 |
| 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 |
| 6065 | if data != None: |
| 6066 | self.data = data |
| 6067 | else: |
| 6068 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6069 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6070 | |
| 6071 | def pack(self): |
| 6072 | packed = [] |
| 6073 | packed.append(struct.pack("!B", self.version)) |
| 6074 | packed.append(struct.pack("!B", self.type)) |
| 6075 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6076 | packed.append(struct.pack("!L", self.xid)) |
| 6077 | packed.append(struct.pack("!L", self.experimenter)) |
| 6078 | packed.append(struct.pack("!L", self.subtype)) |
| 6079 | packed.append(struct.pack("!L", self.timeout_ms)) |
| 6080 | packed.append(util.pack_port_no(self.port_no)) |
| 6081 | packed.append(struct.pack("!B", self.slot_num)) |
| 6082 | packed.append('\x00' * 3) |
| 6083 | packed.append(self.data) |
| 6084 | length = sum([len(x) for x in packed]) |
| 6085 | packed[2] = struct.pack("!H", length) |
| 6086 | return ''.join(packed) |
| 6087 | |
| 6088 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6089 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6090 | obj = bsn_pdu_rx_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6091 | _version = reader.read("!B")[0] |
| 6092 | assert(_version == 4) |
| 6093 | _type = reader.read("!B")[0] |
| 6094 | assert(_type == 4) |
| 6095 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6096 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 6097 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6098 | obj.xid = reader.read("!L")[0] |
| 6099 | _experimenter = reader.read("!L")[0] |
| 6100 | assert(_experimenter == 6035143) |
| 6101 | _subtype = reader.read("!L")[0] |
| 6102 | assert(_subtype == 33) |
| 6103 | obj.timeout_ms = reader.read("!L")[0] |
| 6104 | obj.port_no = util.unpack_port_no(reader) |
| 6105 | obj.slot_num = reader.read("!B")[0] |
| 6106 | reader.skip(3) |
| 6107 | obj.data = str(reader.read_all()) |
| 6108 | return obj |
| 6109 | |
| 6110 | def __eq__(self, other): |
| 6111 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6112 | if self.xid != other.xid: return False |
| 6113 | if self.timeout_ms != other.timeout_ms: return False |
| 6114 | if self.port_no != other.port_no: return False |
| 6115 | if self.slot_num != other.slot_num: return False |
| 6116 | if self.data != other.data: return False |
| 6117 | return True |
| 6118 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6119 | def pretty_print(self, q): |
| 6120 | q.text("bsn_pdu_rx_request {") |
| 6121 | with q.group(): |
| 6122 | with q.indent(2): |
| 6123 | q.breakable() |
| 6124 | q.text("xid = "); |
| 6125 | if self.xid != None: |
| 6126 | q.text("%#x" % self.xid) |
| 6127 | else: |
| 6128 | q.text('None') |
| 6129 | q.text(","); q.breakable() |
| 6130 | q.text("timeout_ms = "); |
| 6131 | q.text("%#x" % self.timeout_ms) |
| 6132 | q.text(","); q.breakable() |
| 6133 | q.text("port_no = "); |
| 6134 | q.text(util.pretty_port(self.port_no)) |
| 6135 | q.text(","); q.breakable() |
| 6136 | q.text("slot_num = "); |
| 6137 | q.text("%#x" % self.slot_num) |
| 6138 | q.text(","); q.breakable() |
| 6139 | q.text("data = "); |
| 6140 | q.pp(self.data) |
| 6141 | q.breakable() |
| 6142 | q.text('}') |
| 6143 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6144 | bsn_header.subtypes[33] = bsn_pdu_rx_request |
| 6145 | |
| 6146 | class bsn_pdu_rx_timeout(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6147 | version = 4 |
| 6148 | type = 4 |
| 6149 | experimenter = 6035143 |
| 6150 | subtype = 35 |
| 6151 | |
| 6152 | def __init__(self, xid=None, port_no=None, slot_num=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6153 | if xid != None: |
| 6154 | self.xid = xid |
| 6155 | else: |
| 6156 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6157 | if port_no != None: |
| 6158 | self.port_no = port_no |
| 6159 | else: |
| 6160 | self.port_no = 0 |
| 6161 | if slot_num != None: |
| 6162 | self.slot_num = slot_num |
| 6163 | else: |
| 6164 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6165 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6166 | |
| 6167 | def pack(self): |
| 6168 | packed = [] |
| 6169 | packed.append(struct.pack("!B", self.version)) |
| 6170 | packed.append(struct.pack("!B", self.type)) |
| 6171 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6172 | packed.append(struct.pack("!L", self.xid)) |
| 6173 | packed.append(struct.pack("!L", self.experimenter)) |
| 6174 | packed.append(struct.pack("!L", self.subtype)) |
| 6175 | packed.append(util.pack_port_no(self.port_no)) |
| 6176 | packed.append(struct.pack("!B", self.slot_num)) |
| 6177 | length = sum([len(x) for x in packed]) |
| 6178 | packed[2] = struct.pack("!H", length) |
| 6179 | return ''.join(packed) |
| 6180 | |
| 6181 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6182 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6183 | obj = bsn_pdu_rx_timeout() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6184 | _version = reader.read("!B")[0] |
| 6185 | assert(_version == 4) |
| 6186 | _type = reader.read("!B")[0] |
| 6187 | assert(_type == 4) |
| 6188 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6189 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 6190 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6191 | obj.xid = reader.read("!L")[0] |
| 6192 | _experimenter = reader.read("!L")[0] |
| 6193 | assert(_experimenter == 6035143) |
| 6194 | _subtype = reader.read("!L")[0] |
| 6195 | assert(_subtype == 35) |
| 6196 | obj.port_no = util.unpack_port_no(reader) |
| 6197 | obj.slot_num = reader.read("!B")[0] |
| 6198 | return obj |
| 6199 | |
| 6200 | def __eq__(self, other): |
| 6201 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6202 | if self.xid != other.xid: return False |
| 6203 | if self.port_no != other.port_no: return False |
| 6204 | if self.slot_num != other.slot_num: return False |
| 6205 | return True |
| 6206 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6207 | def pretty_print(self, q): |
| 6208 | q.text("bsn_pdu_rx_timeout {") |
| 6209 | with q.group(): |
| 6210 | with q.indent(2): |
| 6211 | q.breakable() |
| 6212 | q.text("xid = "); |
| 6213 | if self.xid != None: |
| 6214 | q.text("%#x" % self.xid) |
| 6215 | else: |
| 6216 | q.text('None') |
| 6217 | q.text(","); q.breakable() |
| 6218 | q.text("port_no = "); |
| 6219 | q.text(util.pretty_port(self.port_no)) |
| 6220 | q.text(","); q.breakable() |
| 6221 | q.text("slot_num = "); |
| 6222 | q.text("%#x" % self.slot_num) |
| 6223 | q.breakable() |
| 6224 | q.text('}') |
| 6225 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6226 | bsn_header.subtypes[35] = bsn_pdu_rx_timeout |
| 6227 | |
| 6228 | class bsn_pdu_tx_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6229 | version = 4 |
| 6230 | type = 4 |
| 6231 | experimenter = 6035143 |
| 6232 | subtype = 32 |
| 6233 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6234 | 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] | 6235 | if xid != None: |
| 6236 | self.xid = xid |
| 6237 | else: |
| 6238 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6239 | if status != None: |
| 6240 | self.status = status |
| 6241 | else: |
| 6242 | self.status = 0 |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6243 | if port_no != None: |
| 6244 | self.port_no = port_no |
| 6245 | else: |
| 6246 | self.port_no = 0 |
| 6247 | if slot_num != None: |
| 6248 | self.slot_num = slot_num |
| 6249 | else: |
| 6250 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6251 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6252 | |
| 6253 | def pack(self): |
| 6254 | packed = [] |
| 6255 | packed.append(struct.pack("!B", self.version)) |
| 6256 | packed.append(struct.pack("!B", self.type)) |
| 6257 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6258 | packed.append(struct.pack("!L", self.xid)) |
| 6259 | packed.append(struct.pack("!L", self.experimenter)) |
| 6260 | packed.append(struct.pack("!L", self.subtype)) |
| 6261 | packed.append(struct.pack("!L", self.status)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6262 | packed.append(util.pack_port_no(self.port_no)) |
| 6263 | packed.append(struct.pack("!B", self.slot_num)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6264 | length = sum([len(x) for x in packed]) |
| 6265 | packed[2] = struct.pack("!H", length) |
| 6266 | return ''.join(packed) |
| 6267 | |
| 6268 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6269 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6270 | obj = bsn_pdu_tx_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6271 | _version = reader.read("!B")[0] |
| 6272 | assert(_version == 4) |
| 6273 | _type = reader.read("!B")[0] |
| 6274 | assert(_type == 4) |
| 6275 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6276 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 6277 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6278 | obj.xid = reader.read("!L")[0] |
| 6279 | _experimenter = reader.read("!L")[0] |
| 6280 | assert(_experimenter == 6035143) |
| 6281 | _subtype = reader.read("!L")[0] |
| 6282 | assert(_subtype == 32) |
| 6283 | obj.status = reader.read("!L")[0] |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6284 | obj.port_no = util.unpack_port_no(reader) |
| 6285 | obj.slot_num = reader.read("!B")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6286 | return obj |
| 6287 | |
| 6288 | def __eq__(self, other): |
| 6289 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6290 | if self.xid != other.xid: return False |
| 6291 | if self.status != other.status: return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6292 | if self.port_no != other.port_no: return False |
| 6293 | if self.slot_num != other.slot_num: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6294 | return True |
| 6295 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6296 | def pretty_print(self, q): |
| 6297 | q.text("bsn_pdu_tx_reply {") |
| 6298 | with q.group(): |
| 6299 | with q.indent(2): |
| 6300 | q.breakable() |
| 6301 | q.text("xid = "); |
| 6302 | if self.xid != None: |
| 6303 | q.text("%#x" % self.xid) |
| 6304 | else: |
| 6305 | q.text('None') |
| 6306 | q.text(","); q.breakable() |
| 6307 | q.text("status = "); |
| 6308 | q.text("%#x" % self.status) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6309 | q.text(","); q.breakable() |
| 6310 | q.text("port_no = "); |
| 6311 | q.text(util.pretty_port(self.port_no)) |
| 6312 | q.text(","); q.breakable() |
| 6313 | q.text("slot_num = "); |
| 6314 | q.text("%#x" % self.slot_num) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6315 | q.breakable() |
| 6316 | q.text('}') |
| 6317 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6318 | bsn_header.subtypes[32] = bsn_pdu_tx_reply |
| 6319 | |
| 6320 | class bsn_pdu_tx_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6321 | version = 4 |
| 6322 | type = 4 |
| 6323 | experimenter = 6035143 |
| 6324 | subtype = 31 |
| 6325 | |
| 6326 | 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] | 6327 | if xid != None: |
| 6328 | self.xid = xid |
| 6329 | else: |
| 6330 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6331 | if tx_interval_ms != None: |
| 6332 | self.tx_interval_ms = tx_interval_ms |
| 6333 | else: |
| 6334 | self.tx_interval_ms = 0 |
| 6335 | if port_no != None: |
| 6336 | self.port_no = port_no |
| 6337 | else: |
| 6338 | self.port_no = 0 |
| 6339 | if slot_num != None: |
| 6340 | self.slot_num = slot_num |
| 6341 | else: |
| 6342 | self.slot_num = 0 |
| 6343 | if data != None: |
| 6344 | self.data = data |
| 6345 | else: |
| 6346 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6347 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6348 | |
| 6349 | def pack(self): |
| 6350 | packed = [] |
| 6351 | packed.append(struct.pack("!B", self.version)) |
| 6352 | packed.append(struct.pack("!B", self.type)) |
| 6353 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6354 | packed.append(struct.pack("!L", self.xid)) |
| 6355 | packed.append(struct.pack("!L", self.experimenter)) |
| 6356 | packed.append(struct.pack("!L", self.subtype)) |
| 6357 | packed.append(struct.pack("!L", self.tx_interval_ms)) |
| 6358 | packed.append(util.pack_port_no(self.port_no)) |
| 6359 | packed.append(struct.pack("!B", self.slot_num)) |
| 6360 | packed.append('\x00' * 3) |
| 6361 | packed.append(self.data) |
| 6362 | length = sum([len(x) for x in packed]) |
| 6363 | packed[2] = struct.pack("!H", length) |
| 6364 | return ''.join(packed) |
| 6365 | |
| 6366 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6367 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6368 | obj = bsn_pdu_tx_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6369 | _version = reader.read("!B")[0] |
| 6370 | assert(_version == 4) |
| 6371 | _type = reader.read("!B")[0] |
| 6372 | assert(_type == 4) |
| 6373 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6374 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 6375 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6376 | obj.xid = reader.read("!L")[0] |
| 6377 | _experimenter = reader.read("!L")[0] |
| 6378 | assert(_experimenter == 6035143) |
| 6379 | _subtype = reader.read("!L")[0] |
| 6380 | assert(_subtype == 31) |
| 6381 | obj.tx_interval_ms = reader.read("!L")[0] |
| 6382 | obj.port_no = util.unpack_port_no(reader) |
| 6383 | obj.slot_num = reader.read("!B")[0] |
| 6384 | reader.skip(3) |
| 6385 | obj.data = str(reader.read_all()) |
| 6386 | return obj |
| 6387 | |
| 6388 | def __eq__(self, other): |
| 6389 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6390 | if self.xid != other.xid: return False |
| 6391 | if self.tx_interval_ms != other.tx_interval_ms: return False |
| 6392 | if self.port_no != other.port_no: return False |
| 6393 | if self.slot_num != other.slot_num: return False |
| 6394 | if self.data != other.data: return False |
| 6395 | return True |
| 6396 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6397 | def pretty_print(self, q): |
| 6398 | q.text("bsn_pdu_tx_request {") |
| 6399 | with q.group(): |
| 6400 | with q.indent(2): |
| 6401 | q.breakable() |
| 6402 | q.text("xid = "); |
| 6403 | if self.xid != None: |
| 6404 | q.text("%#x" % self.xid) |
| 6405 | else: |
| 6406 | q.text('None') |
| 6407 | q.text(","); q.breakable() |
| 6408 | q.text("tx_interval_ms = "); |
| 6409 | q.text("%#x" % self.tx_interval_ms) |
| 6410 | q.text(","); q.breakable() |
| 6411 | q.text("port_no = "); |
| 6412 | q.text(util.pretty_port(self.port_no)) |
| 6413 | q.text(","); q.breakable() |
| 6414 | q.text("slot_num = "); |
| 6415 | q.text("%#x" % self.slot_num) |
| 6416 | q.text(","); q.breakable() |
| 6417 | q.text("data = "); |
| 6418 | q.pp(self.data) |
| 6419 | q.breakable() |
| 6420 | q.text('}') |
| 6421 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6422 | bsn_header.subtypes[31] = bsn_pdu_tx_request |
| 6423 | |
| 6424 | class bsn_port_counter_stats_reply(bsn_stats_reply): |
| 6425 | version = 4 |
| 6426 | type = 19 |
| 6427 | stats_type = 65535 |
| 6428 | experimenter = 6035143 |
| 6429 | subtype = 8 |
| 6430 | |
| 6431 | def __init__(self, xid=None, flags=None, entries=None): |
| 6432 | if xid != None: |
| 6433 | self.xid = xid |
| 6434 | else: |
| 6435 | self.xid = None |
| 6436 | if flags != None: |
| 6437 | self.flags = flags |
| 6438 | else: |
| 6439 | self.flags = 0 |
| 6440 | if entries != None: |
| 6441 | self.entries = entries |
| 6442 | else: |
| 6443 | self.entries = [] |
| 6444 | return |
| 6445 | |
| 6446 | def pack(self): |
| 6447 | packed = [] |
| 6448 | packed.append(struct.pack("!B", self.version)) |
| 6449 | packed.append(struct.pack("!B", self.type)) |
| 6450 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6451 | packed.append(struct.pack("!L", self.xid)) |
| 6452 | packed.append(struct.pack("!H", self.stats_type)) |
| 6453 | packed.append(struct.pack("!H", self.flags)) |
| 6454 | packed.append('\x00' * 4) |
| 6455 | packed.append(struct.pack("!L", self.experimenter)) |
| 6456 | packed.append(struct.pack("!L", self.subtype)) |
| 6457 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 6458 | length = sum([len(x) for x in packed]) |
| 6459 | packed[2] = struct.pack("!H", length) |
| 6460 | return ''.join(packed) |
| 6461 | |
| 6462 | @staticmethod |
| 6463 | def unpack(reader): |
| 6464 | obj = bsn_port_counter_stats_reply() |
| 6465 | _version = reader.read("!B")[0] |
| 6466 | assert(_version == 4) |
| 6467 | _type = reader.read("!B")[0] |
| 6468 | assert(_type == 19) |
| 6469 | _length = reader.read("!H")[0] |
| 6470 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 6471 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6472 | obj.xid = reader.read("!L")[0] |
| 6473 | _stats_type = reader.read("!H")[0] |
| 6474 | assert(_stats_type == 65535) |
| 6475 | obj.flags = reader.read("!H")[0] |
| 6476 | reader.skip(4) |
| 6477 | _experimenter = reader.read("!L")[0] |
| 6478 | assert(_experimenter == 6035143) |
| 6479 | _subtype = reader.read("!L")[0] |
| 6480 | assert(_subtype == 8) |
| 6481 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_port_counter_stats_entry.unpack) |
| 6482 | return obj |
| 6483 | |
| 6484 | def __eq__(self, other): |
| 6485 | if type(self) != type(other): return False |
| 6486 | if self.xid != other.xid: return False |
| 6487 | if self.flags != other.flags: return False |
| 6488 | if self.entries != other.entries: return False |
| 6489 | return True |
| 6490 | |
| 6491 | def pretty_print(self, q): |
| 6492 | q.text("bsn_port_counter_stats_reply {") |
| 6493 | with q.group(): |
| 6494 | with q.indent(2): |
| 6495 | q.breakable() |
| 6496 | q.text("xid = "); |
| 6497 | if self.xid != None: |
| 6498 | q.text("%#x" % self.xid) |
| 6499 | else: |
| 6500 | q.text('None') |
| 6501 | q.text(","); q.breakable() |
| 6502 | q.text("flags = "); |
| 6503 | q.text("%#x" % self.flags) |
| 6504 | q.text(","); q.breakable() |
| 6505 | q.text("entries = "); |
| 6506 | q.pp(self.entries) |
| 6507 | q.breakable() |
| 6508 | q.text('}') |
| 6509 | |
| 6510 | bsn_stats_reply.subtypes[8] = bsn_port_counter_stats_reply |
| 6511 | |
| 6512 | class bsn_port_counter_stats_request(bsn_stats_request): |
| 6513 | version = 4 |
| 6514 | type = 18 |
| 6515 | stats_type = 65535 |
| 6516 | experimenter = 6035143 |
| 6517 | subtype = 8 |
| 6518 | |
| 6519 | def __init__(self, xid=None, flags=None, port_no=None): |
| 6520 | if xid != None: |
| 6521 | self.xid = xid |
| 6522 | else: |
| 6523 | self.xid = None |
| 6524 | if flags != None: |
| 6525 | self.flags = flags |
| 6526 | else: |
| 6527 | self.flags = 0 |
| 6528 | if port_no != None: |
| 6529 | self.port_no = port_no |
| 6530 | else: |
| 6531 | self.port_no = 0 |
| 6532 | return |
| 6533 | |
| 6534 | def pack(self): |
| 6535 | packed = [] |
| 6536 | packed.append(struct.pack("!B", self.version)) |
| 6537 | packed.append(struct.pack("!B", self.type)) |
| 6538 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6539 | packed.append(struct.pack("!L", self.xid)) |
| 6540 | packed.append(struct.pack("!H", self.stats_type)) |
| 6541 | packed.append(struct.pack("!H", self.flags)) |
| 6542 | packed.append('\x00' * 4) |
| 6543 | packed.append(struct.pack("!L", self.experimenter)) |
| 6544 | packed.append(struct.pack("!L", self.subtype)) |
| 6545 | packed.append(util.pack_port_no(self.port_no)) |
| 6546 | length = sum([len(x) for x in packed]) |
| 6547 | packed[2] = struct.pack("!H", length) |
| 6548 | return ''.join(packed) |
| 6549 | |
| 6550 | @staticmethod |
| 6551 | def unpack(reader): |
| 6552 | obj = bsn_port_counter_stats_request() |
| 6553 | _version = reader.read("!B")[0] |
| 6554 | assert(_version == 4) |
| 6555 | _type = reader.read("!B")[0] |
| 6556 | assert(_type == 18) |
| 6557 | _length = reader.read("!H")[0] |
| 6558 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 6559 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6560 | obj.xid = reader.read("!L")[0] |
| 6561 | _stats_type = reader.read("!H")[0] |
| 6562 | assert(_stats_type == 65535) |
| 6563 | obj.flags = reader.read("!H")[0] |
| 6564 | reader.skip(4) |
| 6565 | _experimenter = reader.read("!L")[0] |
| 6566 | assert(_experimenter == 6035143) |
| 6567 | _subtype = reader.read("!L")[0] |
| 6568 | assert(_subtype == 8) |
| 6569 | obj.port_no = util.unpack_port_no(reader) |
| 6570 | return obj |
| 6571 | |
| 6572 | def __eq__(self, other): |
| 6573 | if type(self) != type(other): return False |
| 6574 | if self.xid != other.xid: return False |
| 6575 | if self.flags != other.flags: return False |
| 6576 | if self.port_no != other.port_no: return False |
| 6577 | return True |
| 6578 | |
| 6579 | def pretty_print(self, q): |
| 6580 | q.text("bsn_port_counter_stats_request {") |
| 6581 | with q.group(): |
| 6582 | with q.indent(2): |
| 6583 | q.breakable() |
| 6584 | q.text("xid = "); |
| 6585 | if self.xid != None: |
| 6586 | q.text("%#x" % self.xid) |
| 6587 | else: |
| 6588 | q.text('None') |
| 6589 | q.text(","); q.breakable() |
| 6590 | q.text("flags = "); |
| 6591 | q.text("%#x" % self.flags) |
| 6592 | q.text(","); q.breakable() |
| 6593 | q.text("port_no = "); |
| 6594 | q.text(util.pretty_port(self.port_no)) |
| 6595 | q.breakable() |
| 6596 | q.text('}') |
| 6597 | |
| 6598 | bsn_stats_request.subtypes[8] = bsn_port_counter_stats_request |
| 6599 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 6600 | class bsn_role_status(bsn_header): |
| 6601 | version = 4 |
| 6602 | type = 4 |
| 6603 | experimenter = 6035143 |
| 6604 | subtype = 55 |
| 6605 | |
| 6606 | def __init__(self, xid=None, role=None, reason=None, generation_id=None): |
| 6607 | if xid != None: |
| 6608 | self.xid = xid |
| 6609 | else: |
| 6610 | self.xid = None |
| 6611 | if role != None: |
| 6612 | self.role = role |
| 6613 | else: |
| 6614 | self.role = 0 |
| 6615 | if reason != None: |
| 6616 | self.reason = reason |
| 6617 | else: |
| 6618 | self.reason = 0 |
| 6619 | if generation_id != None: |
| 6620 | self.generation_id = generation_id |
| 6621 | else: |
| 6622 | self.generation_id = 0 |
| 6623 | return |
| 6624 | |
| 6625 | def pack(self): |
| 6626 | packed = [] |
| 6627 | packed.append(struct.pack("!B", self.version)) |
| 6628 | packed.append(struct.pack("!B", self.type)) |
| 6629 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6630 | packed.append(struct.pack("!L", self.xid)) |
| 6631 | packed.append(struct.pack("!L", self.experimenter)) |
| 6632 | packed.append(struct.pack("!L", self.subtype)) |
| 6633 | packed.append(struct.pack("!L", self.role)) |
| 6634 | packed.append(struct.pack("!B", self.reason)) |
| 6635 | packed.append('\x00' * 3) |
| 6636 | packed.append(struct.pack("!Q", self.generation_id)) |
| 6637 | length = sum([len(x) for x in packed]) |
| 6638 | packed[2] = struct.pack("!H", length) |
| 6639 | return ''.join(packed) |
| 6640 | |
| 6641 | @staticmethod |
| 6642 | def unpack(reader): |
| 6643 | obj = bsn_role_status() |
| 6644 | _version = reader.read("!B")[0] |
| 6645 | assert(_version == 4) |
| 6646 | _type = reader.read("!B")[0] |
| 6647 | assert(_type == 4) |
| 6648 | _length = reader.read("!H")[0] |
| 6649 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 6650 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 6651 | obj.xid = reader.read("!L")[0] |
| 6652 | _experimenter = reader.read("!L")[0] |
| 6653 | assert(_experimenter == 6035143) |
| 6654 | _subtype = reader.read("!L")[0] |
| 6655 | assert(_subtype == 55) |
| 6656 | obj.role = reader.read("!L")[0] |
| 6657 | obj.reason = reader.read("!B")[0] |
| 6658 | reader.skip(3) |
| 6659 | obj.generation_id = reader.read("!Q")[0] |
| 6660 | return obj |
| 6661 | |
| 6662 | def __eq__(self, other): |
| 6663 | if type(self) != type(other): return False |
| 6664 | if self.xid != other.xid: return False |
| 6665 | if self.role != other.role: return False |
| 6666 | if self.reason != other.reason: return False |
| 6667 | if self.generation_id != other.generation_id: return False |
| 6668 | return True |
| 6669 | |
| 6670 | def pretty_print(self, q): |
| 6671 | q.text("bsn_role_status {") |
| 6672 | with q.group(): |
| 6673 | with q.indent(2): |
| 6674 | q.breakable() |
| 6675 | q.text("xid = "); |
| 6676 | if self.xid != None: |
| 6677 | q.text("%#x" % self.xid) |
| 6678 | else: |
| 6679 | q.text('None') |
| 6680 | q.text(","); q.breakable() |
| 6681 | q.text("role = "); |
| 6682 | q.text("%#x" % self.role) |
| 6683 | q.text(","); q.breakable() |
| 6684 | q.text("reason = "); |
| 6685 | q.text("%#x" % self.reason) |
| 6686 | q.text(","); q.breakable() |
| 6687 | q.text("generation_id = "); |
| 6688 | q.text("%#x" % self.generation_id) |
| 6689 | q.breakable() |
| 6690 | q.text('}') |
| 6691 | |
| 6692 | bsn_header.subtypes[55] = bsn_role_status |
| 6693 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 6694 | class bsn_set_aux_cxns_reply(bsn_header): |
| 6695 | version = 4 |
| 6696 | type = 4 |
| 6697 | experimenter = 6035143 |
| 6698 | subtype = 59 |
| 6699 | |
| 6700 | def __init__(self, xid=None, num_aux=None, status=None): |
| 6701 | if xid != None: |
| 6702 | self.xid = xid |
| 6703 | else: |
| 6704 | self.xid = None |
| 6705 | if num_aux != None: |
| 6706 | self.num_aux = num_aux |
| 6707 | else: |
| 6708 | self.num_aux = 0 |
| 6709 | if status != None: |
| 6710 | self.status = status |
| 6711 | else: |
| 6712 | self.status = 0 |
| 6713 | return |
| 6714 | |
| 6715 | def pack(self): |
| 6716 | packed = [] |
| 6717 | packed.append(struct.pack("!B", self.version)) |
| 6718 | packed.append(struct.pack("!B", self.type)) |
| 6719 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6720 | packed.append(struct.pack("!L", self.xid)) |
| 6721 | packed.append(struct.pack("!L", self.experimenter)) |
| 6722 | packed.append(struct.pack("!L", self.subtype)) |
| 6723 | packed.append(struct.pack("!L", self.num_aux)) |
| 6724 | packed.append(struct.pack("!L", self.status)) |
| 6725 | length = sum([len(x) for x in packed]) |
| 6726 | packed[2] = struct.pack("!H", length) |
| 6727 | return ''.join(packed) |
| 6728 | |
| 6729 | @staticmethod |
| 6730 | def unpack(reader): |
| 6731 | obj = bsn_set_aux_cxns_reply() |
| 6732 | _version = reader.read("!B")[0] |
| 6733 | assert(_version == 4) |
| 6734 | _type = reader.read("!B")[0] |
| 6735 | assert(_type == 4) |
| 6736 | _length = reader.read("!H")[0] |
| 6737 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 6738 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 6739 | obj.xid = reader.read("!L")[0] |
| 6740 | _experimenter = reader.read("!L")[0] |
| 6741 | assert(_experimenter == 6035143) |
| 6742 | _subtype = reader.read("!L")[0] |
| 6743 | assert(_subtype == 59) |
| 6744 | obj.num_aux = reader.read("!L")[0] |
| 6745 | obj.status = reader.read("!L")[0] |
| 6746 | return obj |
| 6747 | |
| 6748 | def __eq__(self, other): |
| 6749 | if type(self) != type(other): return False |
| 6750 | if self.xid != other.xid: return False |
| 6751 | if self.num_aux != other.num_aux: return False |
| 6752 | if self.status != other.status: return False |
| 6753 | return True |
| 6754 | |
| 6755 | def pretty_print(self, q): |
| 6756 | q.text("bsn_set_aux_cxns_reply {") |
| 6757 | with q.group(): |
| 6758 | with q.indent(2): |
| 6759 | q.breakable() |
| 6760 | q.text("xid = "); |
| 6761 | if self.xid != None: |
| 6762 | q.text("%#x" % self.xid) |
| 6763 | else: |
| 6764 | q.text('None') |
| 6765 | q.text(","); q.breakable() |
| 6766 | q.text("num_aux = "); |
| 6767 | q.text("%#x" % self.num_aux) |
| 6768 | q.text(","); q.breakable() |
| 6769 | q.text("status = "); |
| 6770 | q.text("%#x" % self.status) |
| 6771 | q.breakable() |
| 6772 | q.text('}') |
| 6773 | |
| 6774 | bsn_header.subtypes[59] = bsn_set_aux_cxns_reply |
| 6775 | |
| 6776 | class bsn_set_aux_cxns_request(bsn_header): |
| 6777 | version = 4 |
| 6778 | type = 4 |
| 6779 | experimenter = 6035143 |
| 6780 | subtype = 58 |
| 6781 | |
| 6782 | def __init__(self, xid=None, num_aux=None): |
| 6783 | if xid != None: |
| 6784 | self.xid = xid |
| 6785 | else: |
| 6786 | self.xid = None |
| 6787 | if num_aux != None: |
| 6788 | self.num_aux = num_aux |
| 6789 | else: |
| 6790 | self.num_aux = 0 |
| 6791 | return |
| 6792 | |
| 6793 | def pack(self): |
| 6794 | packed = [] |
| 6795 | packed.append(struct.pack("!B", self.version)) |
| 6796 | packed.append(struct.pack("!B", self.type)) |
| 6797 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6798 | packed.append(struct.pack("!L", self.xid)) |
| 6799 | packed.append(struct.pack("!L", self.experimenter)) |
| 6800 | packed.append(struct.pack("!L", self.subtype)) |
| 6801 | packed.append(struct.pack("!L", self.num_aux)) |
| 6802 | length = sum([len(x) for x in packed]) |
| 6803 | packed[2] = struct.pack("!H", length) |
| 6804 | return ''.join(packed) |
| 6805 | |
| 6806 | @staticmethod |
| 6807 | def unpack(reader): |
| 6808 | obj = bsn_set_aux_cxns_request() |
| 6809 | _version = reader.read("!B")[0] |
| 6810 | assert(_version == 4) |
| 6811 | _type = reader.read("!B")[0] |
| 6812 | assert(_type == 4) |
| 6813 | _length = reader.read("!H")[0] |
| 6814 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 6815 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 6816 | obj.xid = reader.read("!L")[0] |
| 6817 | _experimenter = reader.read("!L")[0] |
| 6818 | assert(_experimenter == 6035143) |
| 6819 | _subtype = reader.read("!L")[0] |
| 6820 | assert(_subtype == 58) |
| 6821 | obj.num_aux = reader.read("!L")[0] |
| 6822 | return obj |
| 6823 | |
| 6824 | def __eq__(self, other): |
| 6825 | if type(self) != type(other): return False |
| 6826 | if self.xid != other.xid: return False |
| 6827 | if self.num_aux != other.num_aux: return False |
| 6828 | return True |
| 6829 | |
| 6830 | def pretty_print(self, q): |
| 6831 | q.text("bsn_set_aux_cxns_request {") |
| 6832 | with q.group(): |
| 6833 | with q.indent(2): |
| 6834 | q.breakable() |
| 6835 | q.text("xid = "); |
| 6836 | if self.xid != None: |
| 6837 | q.text("%#x" % self.xid) |
| 6838 | else: |
| 6839 | q.text('None') |
| 6840 | q.text(","); q.breakable() |
| 6841 | q.text("num_aux = "); |
| 6842 | q.text("%#x" % self.num_aux) |
| 6843 | q.breakable() |
| 6844 | q.text('}') |
| 6845 | |
| 6846 | bsn_header.subtypes[58] = bsn_set_aux_cxns_request |
| 6847 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6848 | class bsn_set_lacp_reply(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6849 | version = 4 |
| 6850 | type = 4 |
| 6851 | experimenter = 6035143 |
| 6852 | subtype = 42 |
| 6853 | |
| 6854 | def __init__(self, xid=None, status=None, port_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6855 | if xid != None: |
| 6856 | self.xid = xid |
| 6857 | else: |
| 6858 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6859 | if status != None: |
| 6860 | self.status = status |
| 6861 | else: |
| 6862 | self.status = 0 |
| 6863 | if port_no != None: |
| 6864 | self.port_no = port_no |
| 6865 | else: |
| 6866 | self.port_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6867 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6868 | |
| 6869 | def pack(self): |
| 6870 | packed = [] |
| 6871 | packed.append(struct.pack("!B", self.version)) |
| 6872 | packed.append(struct.pack("!B", self.type)) |
| 6873 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6874 | packed.append(struct.pack("!L", self.xid)) |
| 6875 | packed.append(struct.pack("!L", self.experimenter)) |
| 6876 | packed.append(struct.pack("!L", self.subtype)) |
| 6877 | packed.append(struct.pack("!L", self.status)) |
| 6878 | packed.append(util.pack_port_no(self.port_no)) |
| 6879 | length = sum([len(x) for x in packed]) |
| 6880 | packed[2] = struct.pack("!H", length) |
| 6881 | return ''.join(packed) |
| 6882 | |
| 6883 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6884 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6885 | obj = bsn_set_lacp_reply() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6886 | _version = reader.read("!B")[0] |
| 6887 | assert(_version == 4) |
| 6888 | _type = reader.read("!B")[0] |
| 6889 | assert(_type == 4) |
| 6890 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6891 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 6892 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6893 | obj.xid = reader.read("!L")[0] |
| 6894 | _experimenter = reader.read("!L")[0] |
| 6895 | assert(_experimenter == 6035143) |
| 6896 | _subtype = reader.read("!L")[0] |
| 6897 | assert(_subtype == 42) |
| 6898 | obj.status = reader.read("!L")[0] |
| 6899 | obj.port_no = util.unpack_port_no(reader) |
| 6900 | return obj |
| 6901 | |
| 6902 | def __eq__(self, other): |
| 6903 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6904 | if self.xid != other.xid: return False |
| 6905 | if self.status != other.status: return False |
| 6906 | if self.port_no != other.port_no: return False |
| 6907 | return True |
| 6908 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6909 | def pretty_print(self, q): |
| 6910 | q.text("bsn_set_lacp_reply {") |
| 6911 | with q.group(): |
| 6912 | with q.indent(2): |
| 6913 | q.breakable() |
| 6914 | q.text("xid = "); |
| 6915 | if self.xid != None: |
| 6916 | q.text("%#x" % self.xid) |
| 6917 | else: |
| 6918 | q.text('None') |
| 6919 | q.text(","); q.breakable() |
| 6920 | q.text("status = "); |
| 6921 | q.text("%#x" % self.status) |
| 6922 | q.text(","); q.breakable() |
| 6923 | q.text("port_no = "); |
| 6924 | q.text(util.pretty_port(self.port_no)) |
| 6925 | q.breakable() |
| 6926 | q.text('}') |
| 6927 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6928 | bsn_header.subtypes[42] = bsn_set_lacp_reply |
| 6929 | |
| 6930 | class bsn_set_lacp_request(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6931 | version = 4 |
| 6932 | type = 4 |
| 6933 | experimenter = 6035143 |
| 6934 | subtype = 41 |
| 6935 | |
| 6936 | 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] | 6937 | if xid != None: |
| 6938 | self.xid = xid |
| 6939 | else: |
| 6940 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6941 | if enabled != None: |
| 6942 | self.enabled = enabled |
| 6943 | else: |
| 6944 | self.enabled = 0 |
| 6945 | if port_no != None: |
| 6946 | self.port_no = port_no |
| 6947 | else: |
| 6948 | self.port_no = 0 |
| 6949 | if actor_sys_priority != None: |
| 6950 | self.actor_sys_priority = actor_sys_priority |
| 6951 | else: |
| 6952 | self.actor_sys_priority = 0 |
| 6953 | if actor_sys_mac != None: |
| 6954 | self.actor_sys_mac = actor_sys_mac |
| 6955 | else: |
| 6956 | self.actor_sys_mac = [0,0,0,0,0,0] |
| 6957 | if actor_port_priority != None: |
| 6958 | self.actor_port_priority = actor_port_priority |
| 6959 | else: |
| 6960 | self.actor_port_priority = 0 |
| 6961 | if actor_port_num != None: |
| 6962 | self.actor_port_num = actor_port_num |
| 6963 | else: |
| 6964 | self.actor_port_num = 0 |
| 6965 | if actor_key != None: |
| 6966 | self.actor_key = actor_key |
| 6967 | else: |
| 6968 | self.actor_key = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6969 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6970 | |
| 6971 | def pack(self): |
| 6972 | packed = [] |
| 6973 | packed.append(struct.pack("!B", self.version)) |
| 6974 | packed.append(struct.pack("!B", self.type)) |
| 6975 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6976 | packed.append(struct.pack("!L", self.xid)) |
| 6977 | packed.append(struct.pack("!L", self.experimenter)) |
| 6978 | packed.append(struct.pack("!L", self.subtype)) |
| 6979 | packed.append(struct.pack("!B", self.enabled)) |
| 6980 | packed.append('\x00' * 3) |
| 6981 | packed.append(util.pack_port_no(self.port_no)) |
| 6982 | packed.append(struct.pack("!H", self.actor_sys_priority)) |
| 6983 | packed.append(struct.pack("!6B", *self.actor_sys_mac)) |
| 6984 | packed.append(struct.pack("!H", self.actor_port_priority)) |
| 6985 | packed.append(struct.pack("!H", self.actor_port_num)) |
| 6986 | packed.append(struct.pack("!H", self.actor_key)) |
| 6987 | length = sum([len(x) for x in packed]) |
| 6988 | packed[2] = struct.pack("!H", length) |
| 6989 | return ''.join(packed) |
| 6990 | |
| 6991 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6992 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6993 | obj = bsn_set_lacp_request() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6994 | _version = reader.read("!B")[0] |
| 6995 | assert(_version == 4) |
| 6996 | _type = reader.read("!B")[0] |
| 6997 | assert(_type == 4) |
| 6998 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6999 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 7000 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7001 | obj.xid = reader.read("!L")[0] |
| 7002 | _experimenter = reader.read("!L")[0] |
| 7003 | assert(_experimenter == 6035143) |
| 7004 | _subtype = reader.read("!L")[0] |
| 7005 | assert(_subtype == 41) |
| 7006 | obj.enabled = reader.read("!B")[0] |
| 7007 | reader.skip(3) |
| 7008 | obj.port_no = util.unpack_port_no(reader) |
| 7009 | obj.actor_sys_priority = reader.read("!H")[0] |
| 7010 | obj.actor_sys_mac = list(reader.read('!6B')) |
| 7011 | obj.actor_port_priority = reader.read("!H")[0] |
| 7012 | obj.actor_port_num = reader.read("!H")[0] |
| 7013 | obj.actor_key = reader.read("!H")[0] |
| 7014 | return obj |
| 7015 | |
| 7016 | def __eq__(self, other): |
| 7017 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7018 | if self.xid != other.xid: return False |
| 7019 | if self.enabled != other.enabled: return False |
| 7020 | if self.port_no != other.port_no: return False |
| 7021 | if self.actor_sys_priority != other.actor_sys_priority: return False |
| 7022 | if self.actor_sys_mac != other.actor_sys_mac: return False |
| 7023 | if self.actor_port_priority != other.actor_port_priority: return False |
| 7024 | if self.actor_port_num != other.actor_port_num: return False |
| 7025 | if self.actor_key != other.actor_key: return False |
| 7026 | return True |
| 7027 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7028 | def pretty_print(self, q): |
| 7029 | q.text("bsn_set_lacp_request {") |
| 7030 | with q.group(): |
| 7031 | with q.indent(2): |
| 7032 | q.breakable() |
| 7033 | q.text("xid = "); |
| 7034 | if self.xid != None: |
| 7035 | q.text("%#x" % self.xid) |
| 7036 | else: |
| 7037 | q.text('None') |
| 7038 | q.text(","); q.breakable() |
| 7039 | q.text("enabled = "); |
| 7040 | q.text("%#x" % self.enabled) |
| 7041 | q.text(","); q.breakable() |
| 7042 | q.text("port_no = "); |
| 7043 | q.text(util.pretty_port(self.port_no)) |
| 7044 | q.text(","); q.breakable() |
| 7045 | q.text("actor_sys_priority = "); |
| 7046 | q.text("%#x" % self.actor_sys_priority) |
| 7047 | q.text(","); q.breakable() |
| 7048 | q.text("actor_sys_mac = "); |
| 7049 | q.text(util.pretty_mac(self.actor_sys_mac)) |
| 7050 | q.text(","); q.breakable() |
| 7051 | q.text("actor_port_priority = "); |
| 7052 | q.text("%#x" % self.actor_port_priority) |
| 7053 | q.text(","); q.breakable() |
| 7054 | q.text("actor_port_num = "); |
| 7055 | q.text("%#x" % self.actor_port_num) |
| 7056 | q.text(","); q.breakable() |
| 7057 | q.text("actor_key = "); |
| 7058 | q.text("%#x" % self.actor_key) |
| 7059 | q.breakable() |
| 7060 | q.text('}') |
| 7061 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7062 | bsn_header.subtypes[41] = bsn_set_lacp_request |
| 7063 | |
| 7064 | class bsn_set_mirroring(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7065 | version = 4 |
| 7066 | type = 4 |
| 7067 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7068 | subtype = 3 |
| 7069 | |
| 7070 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7071 | if xid != None: |
| 7072 | self.xid = xid |
| 7073 | else: |
| 7074 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7075 | if report_mirror_ports != None: |
| 7076 | self.report_mirror_ports = report_mirror_ports |
| 7077 | else: |
| 7078 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7079 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7080 | |
| 7081 | def pack(self): |
| 7082 | packed = [] |
| 7083 | packed.append(struct.pack("!B", self.version)) |
| 7084 | packed.append(struct.pack("!B", self.type)) |
| 7085 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7086 | packed.append(struct.pack("!L", self.xid)) |
| 7087 | packed.append(struct.pack("!L", self.experimenter)) |
| 7088 | packed.append(struct.pack("!L", self.subtype)) |
| 7089 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 7090 | packed.append('\x00' * 3) |
| 7091 | length = sum([len(x) for x in packed]) |
| 7092 | packed[2] = struct.pack("!H", length) |
| 7093 | return ''.join(packed) |
| 7094 | |
| 7095 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7096 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7097 | obj = bsn_set_mirroring() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7098 | _version = reader.read("!B")[0] |
| 7099 | assert(_version == 4) |
| 7100 | _type = reader.read("!B")[0] |
| 7101 | assert(_type == 4) |
| 7102 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7103 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 7104 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7105 | obj.xid = reader.read("!L")[0] |
| 7106 | _experimenter = reader.read("!L")[0] |
| 7107 | assert(_experimenter == 6035143) |
| 7108 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7109 | assert(_subtype == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7110 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7111 | reader.skip(3) |
| 7112 | return obj |
| 7113 | |
| 7114 | def __eq__(self, other): |
| 7115 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7116 | if self.xid != other.xid: return False |
| 7117 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 7118 | return True |
| 7119 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7120 | def pretty_print(self, q): |
| 7121 | q.text("bsn_set_mirroring {") |
| 7122 | with q.group(): |
| 7123 | with q.indent(2): |
| 7124 | q.breakable() |
| 7125 | q.text("xid = "); |
| 7126 | if self.xid != None: |
| 7127 | q.text("%#x" % self.xid) |
| 7128 | else: |
| 7129 | q.text('None') |
| 7130 | q.text(","); q.breakable() |
| 7131 | q.text("report_mirror_ports = "); |
| 7132 | q.text("%#x" % self.report_mirror_ports) |
| 7133 | q.breakable() |
| 7134 | q.text('}') |
| 7135 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7136 | bsn_header.subtypes[3] = bsn_set_mirroring |
| 7137 | |
| 7138 | class bsn_set_pktin_suppression_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7139 | version = 4 |
| 7140 | type = 4 |
| 7141 | experimenter = 6035143 |
| 7142 | subtype = 25 |
| 7143 | |
| 7144 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7145 | if xid != None: |
| 7146 | self.xid = xid |
| 7147 | else: |
| 7148 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7149 | if status != None: |
| 7150 | self.status = status |
| 7151 | else: |
| 7152 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7153 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 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 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7169 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7170 | obj = bsn_set_pktin_suppression_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 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] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7176 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 7177 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 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 == 25) |
| 7183 | obj.status = reader.read("!L")[0] |
| 7184 | return obj |
| 7185 | |
| 7186 | def __eq__(self, other): |
| 7187 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7188 | if self.xid != other.xid: return False |
| 7189 | if self.status != other.status: return False |
| 7190 | return True |
| 7191 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7192 | def pretty_print(self, q): |
| 7193 | q.text("bsn_set_pktin_suppression_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 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7208 | bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply |
| 7209 | |
| 7210 | class bsn_set_pktin_suppression_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7211 | version = 4 |
| 7212 | type = 4 |
| 7213 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7214 | subtype = 11 |
| 7215 | |
| 7216 | 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] | 7217 | if xid != None: |
| 7218 | self.xid = xid |
| 7219 | else: |
| 7220 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7221 | if enabled != None: |
| 7222 | self.enabled = enabled |
| 7223 | else: |
| 7224 | self.enabled = 0 |
| 7225 | if idle_timeout != None: |
| 7226 | self.idle_timeout = idle_timeout |
| 7227 | else: |
| 7228 | self.idle_timeout = 0 |
| 7229 | if hard_timeout != None: |
| 7230 | self.hard_timeout = hard_timeout |
| 7231 | else: |
| 7232 | self.hard_timeout = 0 |
| 7233 | if priority != None: |
| 7234 | self.priority = priority |
| 7235 | else: |
| 7236 | self.priority = 0 |
| 7237 | if cookie != None: |
| 7238 | self.cookie = cookie |
| 7239 | else: |
| 7240 | self.cookie = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7241 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7242 | |
| 7243 | def pack(self): |
| 7244 | packed = [] |
| 7245 | packed.append(struct.pack("!B", self.version)) |
| 7246 | packed.append(struct.pack("!B", self.type)) |
| 7247 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7248 | packed.append(struct.pack("!L", self.xid)) |
| 7249 | packed.append(struct.pack("!L", self.experimenter)) |
| 7250 | packed.append(struct.pack("!L", self.subtype)) |
| 7251 | packed.append(struct.pack("!B", self.enabled)) |
| 7252 | packed.append('\x00' * 1) |
| 7253 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 7254 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 7255 | packed.append(struct.pack("!H", self.priority)) |
| 7256 | packed.append(struct.pack("!Q", self.cookie)) |
| 7257 | length = sum([len(x) for x in packed]) |
| 7258 | packed[2] = struct.pack("!H", length) |
| 7259 | return ''.join(packed) |
| 7260 | |
| 7261 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7262 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7263 | obj = bsn_set_pktin_suppression_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7264 | _version = reader.read("!B")[0] |
| 7265 | assert(_version == 4) |
| 7266 | _type = reader.read("!B")[0] |
| 7267 | assert(_type == 4) |
| 7268 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7269 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 7270 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7271 | obj.xid = reader.read("!L")[0] |
| 7272 | _experimenter = reader.read("!L")[0] |
| 7273 | assert(_experimenter == 6035143) |
| 7274 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7275 | assert(_subtype == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7276 | obj.enabled = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7277 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7278 | obj.idle_timeout = reader.read("!H")[0] |
| 7279 | obj.hard_timeout = reader.read("!H")[0] |
| 7280 | obj.priority = reader.read("!H")[0] |
| 7281 | obj.cookie = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7282 | return obj |
| 7283 | |
| 7284 | def __eq__(self, other): |
| 7285 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7286 | if self.xid != other.xid: return False |
| 7287 | if self.enabled != other.enabled: return False |
| 7288 | if self.idle_timeout != other.idle_timeout: return False |
| 7289 | if self.hard_timeout != other.hard_timeout: return False |
| 7290 | if self.priority != other.priority: return False |
| 7291 | if self.cookie != other.cookie: return False |
| 7292 | return True |
| 7293 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7294 | def pretty_print(self, q): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7295 | q.text("bsn_set_pktin_suppression_request {") |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7296 | with q.group(): |
| 7297 | with q.indent(2): |
| 7298 | q.breakable() |
| 7299 | q.text("xid = "); |
| 7300 | if self.xid != None: |
| 7301 | q.text("%#x" % self.xid) |
| 7302 | else: |
| 7303 | q.text('None') |
| 7304 | q.text(","); q.breakable() |
| 7305 | q.text("enabled = "); |
| 7306 | q.text("%#x" % self.enabled) |
| 7307 | q.text(","); q.breakable() |
| 7308 | q.text("idle_timeout = "); |
| 7309 | q.text("%#x" % self.idle_timeout) |
| 7310 | q.text(","); q.breakable() |
| 7311 | q.text("hard_timeout = "); |
| 7312 | q.text("%#x" % self.hard_timeout) |
| 7313 | q.text(","); q.breakable() |
| 7314 | q.text("priority = "); |
| 7315 | q.text("%#x" % self.priority) |
| 7316 | q.text(","); q.breakable() |
| 7317 | q.text("cookie = "); |
| 7318 | q.text("%#x" % self.cookie) |
| 7319 | q.breakable() |
| 7320 | q.text('}') |
| 7321 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7322 | bsn_header.subtypes[11] = bsn_set_pktin_suppression_request |
| 7323 | |
| 7324 | class bsn_set_switch_pipeline_reply(bsn_header): |
| 7325 | version = 4 |
| 7326 | type = 4 |
| 7327 | experimenter = 6035143 |
| 7328 | subtype = 54 |
| 7329 | |
| 7330 | def __init__(self, xid=None, status=None): |
| 7331 | if xid != None: |
| 7332 | self.xid = xid |
| 7333 | else: |
| 7334 | self.xid = None |
| 7335 | if status != None: |
| 7336 | self.status = status |
| 7337 | else: |
| 7338 | self.status = 0 |
| 7339 | return |
| 7340 | |
| 7341 | def pack(self): |
| 7342 | packed = [] |
| 7343 | packed.append(struct.pack("!B", self.version)) |
| 7344 | packed.append(struct.pack("!B", self.type)) |
| 7345 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7346 | packed.append(struct.pack("!L", self.xid)) |
| 7347 | packed.append(struct.pack("!L", self.experimenter)) |
| 7348 | packed.append(struct.pack("!L", self.subtype)) |
| 7349 | packed.append(struct.pack("!L", self.status)) |
| 7350 | length = sum([len(x) for x in packed]) |
| 7351 | packed[2] = struct.pack("!H", length) |
| 7352 | return ''.join(packed) |
| 7353 | |
| 7354 | @staticmethod |
| 7355 | def unpack(reader): |
| 7356 | obj = bsn_set_switch_pipeline_reply() |
| 7357 | _version = reader.read("!B")[0] |
| 7358 | assert(_version == 4) |
| 7359 | _type = reader.read("!B")[0] |
| 7360 | assert(_type == 4) |
| 7361 | _length = reader.read("!H")[0] |
| 7362 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 7363 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7364 | obj.xid = reader.read("!L")[0] |
| 7365 | _experimenter = reader.read("!L")[0] |
| 7366 | assert(_experimenter == 6035143) |
| 7367 | _subtype = reader.read("!L")[0] |
| 7368 | assert(_subtype == 54) |
| 7369 | obj.status = reader.read("!L")[0] |
| 7370 | return obj |
| 7371 | |
| 7372 | def __eq__(self, other): |
| 7373 | if type(self) != type(other): return False |
| 7374 | if self.xid != other.xid: return False |
| 7375 | if self.status != other.status: return False |
| 7376 | return True |
| 7377 | |
| 7378 | def pretty_print(self, q): |
| 7379 | q.text("bsn_set_switch_pipeline_reply {") |
| 7380 | with q.group(): |
| 7381 | with q.indent(2): |
| 7382 | q.breakable() |
| 7383 | q.text("xid = "); |
| 7384 | if self.xid != None: |
| 7385 | q.text("%#x" % self.xid) |
| 7386 | else: |
| 7387 | q.text('None') |
| 7388 | q.text(","); q.breakable() |
| 7389 | q.text("status = "); |
| 7390 | q.text("%#x" % self.status) |
| 7391 | q.breakable() |
| 7392 | q.text('}') |
| 7393 | |
| 7394 | bsn_header.subtypes[54] = bsn_set_switch_pipeline_reply |
| 7395 | |
| 7396 | class bsn_set_switch_pipeline_request(bsn_header): |
| 7397 | version = 4 |
| 7398 | type = 4 |
| 7399 | experimenter = 6035143 |
| 7400 | subtype = 53 |
| 7401 | |
| 7402 | def __init__(self, xid=None, pipeline=None): |
| 7403 | if xid != None: |
| 7404 | self.xid = xid |
| 7405 | else: |
| 7406 | self.xid = None |
| 7407 | if pipeline != None: |
| 7408 | self.pipeline = pipeline |
| 7409 | else: |
| 7410 | self.pipeline = "" |
| 7411 | return |
| 7412 | |
| 7413 | def pack(self): |
| 7414 | packed = [] |
| 7415 | packed.append(struct.pack("!B", self.version)) |
| 7416 | packed.append(struct.pack("!B", self.type)) |
| 7417 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7418 | packed.append(struct.pack("!L", self.xid)) |
| 7419 | packed.append(struct.pack("!L", self.experimenter)) |
| 7420 | packed.append(struct.pack("!L", self.subtype)) |
| 7421 | packed.append(struct.pack("!256s", self.pipeline)) |
| 7422 | length = sum([len(x) for x in packed]) |
| 7423 | packed[2] = struct.pack("!H", length) |
| 7424 | return ''.join(packed) |
| 7425 | |
| 7426 | @staticmethod |
| 7427 | def unpack(reader): |
| 7428 | obj = bsn_set_switch_pipeline_request() |
| 7429 | _version = reader.read("!B")[0] |
| 7430 | assert(_version == 4) |
| 7431 | _type = reader.read("!B")[0] |
| 7432 | assert(_type == 4) |
| 7433 | _length = reader.read("!H")[0] |
| 7434 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 7435 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7436 | obj.xid = reader.read("!L")[0] |
| 7437 | _experimenter = reader.read("!L")[0] |
| 7438 | assert(_experimenter == 6035143) |
| 7439 | _subtype = reader.read("!L")[0] |
| 7440 | assert(_subtype == 53) |
| 7441 | obj.pipeline = reader.read("!256s")[0].rstrip("\x00") |
| 7442 | return obj |
| 7443 | |
| 7444 | def __eq__(self, other): |
| 7445 | if type(self) != type(other): return False |
| 7446 | if self.xid != other.xid: return False |
| 7447 | if self.pipeline != other.pipeline: return False |
| 7448 | return True |
| 7449 | |
| 7450 | def pretty_print(self, q): |
| 7451 | q.text("bsn_set_switch_pipeline_request {") |
| 7452 | with q.group(): |
| 7453 | with q.indent(2): |
| 7454 | q.breakable() |
| 7455 | q.text("xid = "); |
| 7456 | if self.xid != None: |
| 7457 | q.text("%#x" % self.xid) |
| 7458 | else: |
| 7459 | q.text('None') |
| 7460 | q.text(","); q.breakable() |
| 7461 | q.text("pipeline = "); |
| 7462 | q.pp(self.pipeline) |
| 7463 | q.breakable() |
| 7464 | q.text('}') |
| 7465 | |
| 7466 | bsn_header.subtypes[53] = bsn_set_switch_pipeline_request |
| 7467 | |
| 7468 | class bsn_switch_pipeline_stats_reply(bsn_stats_reply): |
| 7469 | version = 4 |
| 7470 | type = 19 |
| 7471 | stats_type = 65535 |
| 7472 | experimenter = 6035143 |
| 7473 | subtype = 6 |
| 7474 | |
| 7475 | def __init__(self, xid=None, flags=None, entries=None): |
| 7476 | if xid != None: |
| 7477 | self.xid = xid |
| 7478 | else: |
| 7479 | self.xid = None |
| 7480 | if flags != None: |
| 7481 | self.flags = flags |
| 7482 | else: |
| 7483 | self.flags = 0 |
| 7484 | if entries != None: |
| 7485 | self.entries = entries |
| 7486 | else: |
| 7487 | self.entries = [] |
| 7488 | return |
| 7489 | |
| 7490 | def pack(self): |
| 7491 | packed = [] |
| 7492 | packed.append(struct.pack("!B", self.version)) |
| 7493 | packed.append(struct.pack("!B", self.type)) |
| 7494 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7495 | packed.append(struct.pack("!L", self.xid)) |
| 7496 | packed.append(struct.pack("!H", self.stats_type)) |
| 7497 | packed.append(struct.pack("!H", self.flags)) |
| 7498 | packed.append('\x00' * 4) |
| 7499 | packed.append(struct.pack("!L", self.experimenter)) |
| 7500 | packed.append(struct.pack("!L", self.subtype)) |
| 7501 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 7502 | length = sum([len(x) for x in packed]) |
| 7503 | packed[2] = struct.pack("!H", length) |
| 7504 | return ''.join(packed) |
| 7505 | |
| 7506 | @staticmethod |
| 7507 | def unpack(reader): |
| 7508 | obj = bsn_switch_pipeline_stats_reply() |
| 7509 | _version = reader.read("!B")[0] |
| 7510 | assert(_version == 4) |
| 7511 | _type = reader.read("!B")[0] |
| 7512 | assert(_type == 19) |
| 7513 | _length = reader.read("!H")[0] |
| 7514 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 7515 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7516 | obj.xid = reader.read("!L")[0] |
| 7517 | _stats_type = reader.read("!H")[0] |
| 7518 | assert(_stats_type == 65535) |
| 7519 | obj.flags = reader.read("!H")[0] |
| 7520 | reader.skip(4) |
| 7521 | _experimenter = reader.read("!L")[0] |
| 7522 | assert(_experimenter == 6035143) |
| 7523 | _subtype = reader.read("!L")[0] |
| 7524 | assert(_subtype == 6) |
| 7525 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_switch_pipeline_stats_entry.unpack) |
| 7526 | return obj |
| 7527 | |
| 7528 | def __eq__(self, other): |
| 7529 | if type(self) != type(other): return False |
| 7530 | if self.xid != other.xid: return False |
| 7531 | if self.flags != other.flags: return False |
| 7532 | if self.entries != other.entries: return False |
| 7533 | return True |
| 7534 | |
| 7535 | def pretty_print(self, q): |
| 7536 | q.text("bsn_switch_pipeline_stats_reply {") |
| 7537 | with q.group(): |
| 7538 | with q.indent(2): |
| 7539 | q.breakable() |
| 7540 | q.text("xid = "); |
| 7541 | if self.xid != None: |
| 7542 | q.text("%#x" % self.xid) |
| 7543 | else: |
| 7544 | q.text('None') |
| 7545 | q.text(","); q.breakable() |
| 7546 | q.text("flags = "); |
| 7547 | q.text("%#x" % self.flags) |
| 7548 | q.text(","); q.breakable() |
| 7549 | q.text("entries = "); |
| 7550 | q.pp(self.entries) |
| 7551 | q.breakable() |
| 7552 | q.text('}') |
| 7553 | |
| 7554 | bsn_stats_reply.subtypes[6] = bsn_switch_pipeline_stats_reply |
| 7555 | |
| 7556 | class bsn_switch_pipeline_stats_request(bsn_stats_request): |
| 7557 | version = 4 |
| 7558 | type = 18 |
| 7559 | stats_type = 65535 |
| 7560 | experimenter = 6035143 |
| 7561 | subtype = 6 |
| 7562 | |
| 7563 | def __init__(self, xid=None, flags=None): |
| 7564 | if xid != None: |
| 7565 | self.xid = xid |
| 7566 | else: |
| 7567 | self.xid = None |
| 7568 | if flags != None: |
| 7569 | self.flags = flags |
| 7570 | else: |
| 7571 | self.flags = 0 |
| 7572 | return |
| 7573 | |
| 7574 | def pack(self): |
| 7575 | packed = [] |
| 7576 | packed.append(struct.pack("!B", self.version)) |
| 7577 | packed.append(struct.pack("!B", self.type)) |
| 7578 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7579 | packed.append(struct.pack("!L", self.xid)) |
| 7580 | packed.append(struct.pack("!H", self.stats_type)) |
| 7581 | packed.append(struct.pack("!H", self.flags)) |
| 7582 | packed.append('\x00' * 4) |
| 7583 | packed.append(struct.pack("!L", self.experimenter)) |
| 7584 | packed.append(struct.pack("!L", self.subtype)) |
| 7585 | length = sum([len(x) for x in packed]) |
| 7586 | packed[2] = struct.pack("!H", length) |
| 7587 | return ''.join(packed) |
| 7588 | |
| 7589 | @staticmethod |
| 7590 | def unpack(reader): |
| 7591 | obj = bsn_switch_pipeline_stats_request() |
| 7592 | _version = reader.read("!B")[0] |
| 7593 | assert(_version == 4) |
| 7594 | _type = reader.read("!B")[0] |
| 7595 | assert(_type == 18) |
| 7596 | _length = reader.read("!H")[0] |
| 7597 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 7598 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7599 | obj.xid = reader.read("!L")[0] |
| 7600 | _stats_type = reader.read("!H")[0] |
| 7601 | assert(_stats_type == 65535) |
| 7602 | obj.flags = reader.read("!H")[0] |
| 7603 | reader.skip(4) |
| 7604 | _experimenter = reader.read("!L")[0] |
| 7605 | assert(_experimenter == 6035143) |
| 7606 | _subtype = reader.read("!L")[0] |
| 7607 | assert(_subtype == 6) |
| 7608 | return obj |
| 7609 | |
| 7610 | def __eq__(self, other): |
| 7611 | if type(self) != type(other): return False |
| 7612 | if self.xid != other.xid: return False |
| 7613 | if self.flags != other.flags: return False |
| 7614 | return True |
| 7615 | |
| 7616 | def pretty_print(self, q): |
| 7617 | q.text("bsn_switch_pipeline_stats_request {") |
| 7618 | with q.group(): |
| 7619 | with q.indent(2): |
| 7620 | q.breakable() |
| 7621 | q.text("xid = "); |
| 7622 | if self.xid != None: |
| 7623 | q.text("%#x" % self.xid) |
| 7624 | else: |
| 7625 | q.text('None') |
| 7626 | q.text(","); q.breakable() |
| 7627 | q.text("flags = "); |
| 7628 | q.text("%#x" % self.flags) |
| 7629 | q.breakable() |
| 7630 | q.text('}') |
| 7631 | |
| 7632 | bsn_stats_request.subtypes[6] = bsn_switch_pipeline_stats_request |
| 7633 | |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 7634 | class bsn_table_checksum_stats_reply(bsn_stats_reply): |
| 7635 | version = 4 |
| 7636 | type = 19 |
| 7637 | stats_type = 65535 |
| 7638 | experimenter = 6035143 |
| 7639 | subtype = 11 |
| 7640 | |
| 7641 | def __init__(self, xid=None, flags=None, entries=None): |
| 7642 | if xid != None: |
| 7643 | self.xid = xid |
| 7644 | else: |
| 7645 | self.xid = None |
| 7646 | if flags != None: |
| 7647 | self.flags = flags |
| 7648 | else: |
| 7649 | self.flags = 0 |
| 7650 | if entries != None: |
| 7651 | self.entries = entries |
| 7652 | else: |
| 7653 | self.entries = [] |
| 7654 | return |
| 7655 | |
| 7656 | def pack(self): |
| 7657 | packed = [] |
| 7658 | packed.append(struct.pack("!B", self.version)) |
| 7659 | packed.append(struct.pack("!B", self.type)) |
| 7660 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7661 | packed.append(struct.pack("!L", self.xid)) |
| 7662 | packed.append(struct.pack("!H", self.stats_type)) |
| 7663 | packed.append(struct.pack("!H", self.flags)) |
| 7664 | packed.append('\x00' * 4) |
| 7665 | packed.append(struct.pack("!L", self.experimenter)) |
| 7666 | packed.append(struct.pack("!L", self.subtype)) |
| 7667 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 7668 | length = sum([len(x) for x in packed]) |
| 7669 | packed[2] = struct.pack("!H", length) |
| 7670 | return ''.join(packed) |
| 7671 | |
| 7672 | @staticmethod |
| 7673 | def unpack(reader): |
| 7674 | obj = bsn_table_checksum_stats_reply() |
| 7675 | _version = reader.read("!B")[0] |
| 7676 | assert(_version == 4) |
| 7677 | _type = reader.read("!B")[0] |
| 7678 | assert(_type == 19) |
| 7679 | _length = reader.read("!H")[0] |
| 7680 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 7681 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 7682 | obj.xid = reader.read("!L")[0] |
| 7683 | _stats_type = reader.read("!H")[0] |
| 7684 | assert(_stats_type == 65535) |
| 7685 | obj.flags = reader.read("!H")[0] |
| 7686 | reader.skip(4) |
| 7687 | _experimenter = reader.read("!L")[0] |
| 7688 | assert(_experimenter == 6035143) |
| 7689 | _subtype = reader.read("!L")[0] |
| 7690 | assert(_subtype == 11) |
| 7691 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_table_checksum_stats_entry.unpack) |
| 7692 | return obj |
| 7693 | |
| 7694 | def __eq__(self, other): |
| 7695 | if type(self) != type(other): return False |
| 7696 | if self.xid != other.xid: return False |
| 7697 | if self.flags != other.flags: return False |
| 7698 | if self.entries != other.entries: return False |
| 7699 | return True |
| 7700 | |
| 7701 | def pretty_print(self, q): |
| 7702 | q.text("bsn_table_checksum_stats_reply {") |
| 7703 | with q.group(): |
| 7704 | with q.indent(2): |
| 7705 | q.breakable() |
| 7706 | q.text("xid = "); |
| 7707 | if self.xid != None: |
| 7708 | q.text("%#x" % self.xid) |
| 7709 | else: |
| 7710 | q.text('None') |
| 7711 | q.text(","); q.breakable() |
| 7712 | q.text("flags = "); |
| 7713 | q.text("%#x" % self.flags) |
| 7714 | q.text(","); q.breakable() |
| 7715 | q.text("entries = "); |
| 7716 | q.pp(self.entries) |
| 7717 | q.breakable() |
| 7718 | q.text('}') |
| 7719 | |
| 7720 | bsn_stats_reply.subtypes[11] = bsn_table_checksum_stats_reply |
| 7721 | |
| 7722 | class bsn_table_checksum_stats_request(bsn_stats_request): |
| 7723 | version = 4 |
| 7724 | type = 18 |
| 7725 | stats_type = 65535 |
| 7726 | experimenter = 6035143 |
| 7727 | subtype = 11 |
| 7728 | |
| 7729 | def __init__(self, xid=None, flags=None): |
| 7730 | if xid != None: |
| 7731 | self.xid = xid |
| 7732 | else: |
| 7733 | self.xid = None |
| 7734 | if flags != None: |
| 7735 | self.flags = flags |
| 7736 | else: |
| 7737 | self.flags = 0 |
| 7738 | return |
| 7739 | |
| 7740 | def pack(self): |
| 7741 | packed = [] |
| 7742 | packed.append(struct.pack("!B", self.version)) |
| 7743 | packed.append(struct.pack("!B", self.type)) |
| 7744 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7745 | packed.append(struct.pack("!L", self.xid)) |
| 7746 | packed.append(struct.pack("!H", self.stats_type)) |
| 7747 | packed.append(struct.pack("!H", self.flags)) |
| 7748 | packed.append('\x00' * 4) |
| 7749 | packed.append(struct.pack("!L", self.experimenter)) |
| 7750 | packed.append(struct.pack("!L", self.subtype)) |
| 7751 | length = sum([len(x) for x in packed]) |
| 7752 | packed[2] = struct.pack("!H", length) |
| 7753 | return ''.join(packed) |
| 7754 | |
| 7755 | @staticmethod |
| 7756 | def unpack(reader): |
| 7757 | obj = bsn_table_checksum_stats_request() |
| 7758 | _version = reader.read("!B")[0] |
| 7759 | assert(_version == 4) |
| 7760 | _type = reader.read("!B")[0] |
| 7761 | assert(_type == 18) |
| 7762 | _length = reader.read("!H")[0] |
| 7763 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 7764 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 7765 | obj.xid = reader.read("!L")[0] |
| 7766 | _stats_type = reader.read("!H")[0] |
| 7767 | assert(_stats_type == 65535) |
| 7768 | obj.flags = reader.read("!H")[0] |
| 7769 | reader.skip(4) |
| 7770 | _experimenter = reader.read("!L")[0] |
| 7771 | assert(_experimenter == 6035143) |
| 7772 | _subtype = reader.read("!L")[0] |
| 7773 | assert(_subtype == 11) |
| 7774 | return obj |
| 7775 | |
| 7776 | def __eq__(self, other): |
| 7777 | if type(self) != type(other): return False |
| 7778 | if self.xid != other.xid: return False |
| 7779 | if self.flags != other.flags: return False |
| 7780 | return True |
| 7781 | |
| 7782 | def pretty_print(self, q): |
| 7783 | q.text("bsn_table_checksum_stats_request {") |
| 7784 | with q.group(): |
| 7785 | with q.indent(2): |
| 7786 | q.breakable() |
| 7787 | q.text("xid = "); |
| 7788 | if self.xid != None: |
| 7789 | q.text("%#x" % self.xid) |
| 7790 | else: |
| 7791 | q.text('None') |
| 7792 | q.text(","); q.breakable() |
| 7793 | q.text("flags = "); |
| 7794 | q.text("%#x" % self.flags) |
| 7795 | q.breakable() |
| 7796 | q.text('}') |
| 7797 | |
| 7798 | bsn_stats_request.subtypes[11] = bsn_table_checksum_stats_request |
| 7799 | |
| 7800 | class bsn_table_set_buckets_size(bsn_header): |
| 7801 | version = 4 |
| 7802 | type = 4 |
| 7803 | experimenter = 6035143 |
| 7804 | subtype = 61 |
| 7805 | |
| 7806 | def __init__(self, xid=None, table_id=None, buckets_size=None): |
| 7807 | if xid != None: |
| 7808 | self.xid = xid |
| 7809 | else: |
| 7810 | self.xid = None |
| 7811 | if table_id != None: |
| 7812 | self.table_id = table_id |
| 7813 | else: |
| 7814 | self.table_id = 0 |
| 7815 | if buckets_size != None: |
| 7816 | self.buckets_size = buckets_size |
| 7817 | else: |
| 7818 | self.buckets_size = 0 |
| 7819 | return |
| 7820 | |
| 7821 | def pack(self): |
| 7822 | packed = [] |
| 7823 | packed.append(struct.pack("!B", self.version)) |
| 7824 | packed.append(struct.pack("!B", self.type)) |
| 7825 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7826 | packed.append(struct.pack("!L", self.xid)) |
| 7827 | packed.append(struct.pack("!L", self.experimenter)) |
| 7828 | packed.append(struct.pack("!L", self.subtype)) |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 7829 | packed.append('\x00' * 1) |
| 7830 | packed.append(struct.pack("!B", self.table_id)) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 7831 | packed.append('\x00' * 2) |
| 7832 | packed.append(struct.pack("!L", self.buckets_size)) |
| 7833 | length = sum([len(x) for x in packed]) |
| 7834 | packed[2] = struct.pack("!H", length) |
| 7835 | return ''.join(packed) |
| 7836 | |
| 7837 | @staticmethod |
| 7838 | def unpack(reader): |
| 7839 | obj = bsn_table_set_buckets_size() |
| 7840 | _version = reader.read("!B")[0] |
| 7841 | assert(_version == 4) |
| 7842 | _type = reader.read("!B")[0] |
| 7843 | assert(_type == 4) |
| 7844 | _length = reader.read("!H")[0] |
| 7845 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 7846 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 7847 | obj.xid = reader.read("!L")[0] |
| 7848 | _experimenter = reader.read("!L")[0] |
| 7849 | assert(_experimenter == 6035143) |
| 7850 | _subtype = reader.read("!L")[0] |
| 7851 | assert(_subtype == 61) |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 7852 | reader.skip(1) |
| 7853 | obj.table_id = reader.read("!B")[0] |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 7854 | reader.skip(2) |
| 7855 | obj.buckets_size = reader.read("!L")[0] |
| 7856 | return obj |
| 7857 | |
| 7858 | def __eq__(self, other): |
| 7859 | if type(self) != type(other): return False |
| 7860 | if self.xid != other.xid: return False |
| 7861 | if self.table_id != other.table_id: return False |
| 7862 | if self.buckets_size != other.buckets_size: return False |
| 7863 | return True |
| 7864 | |
| 7865 | def pretty_print(self, q): |
| 7866 | q.text("bsn_table_set_buckets_size {") |
| 7867 | with q.group(): |
| 7868 | with q.indent(2): |
| 7869 | q.breakable() |
| 7870 | q.text("xid = "); |
| 7871 | if self.xid != None: |
| 7872 | q.text("%#x" % self.xid) |
| 7873 | else: |
| 7874 | q.text('None') |
| 7875 | q.text(","); q.breakable() |
| 7876 | q.text("table_id = "); |
| 7877 | q.text("%#x" % self.table_id) |
| 7878 | q.text(","); q.breakable() |
| 7879 | q.text("buckets_size = "); |
| 7880 | q.text("%#x" % self.buckets_size) |
| 7881 | q.breakable() |
| 7882 | q.text('}') |
| 7883 | |
| 7884 | bsn_header.subtypes[61] = bsn_table_set_buckets_size |
| 7885 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7886 | class bsn_time_reply(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7887 | version = 4 |
| 7888 | type = 4 |
| 7889 | experimenter = 6035143 |
| 7890 | subtype = 45 |
| 7891 | |
| 7892 | def __init__(self, xid=None, time_ms=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7893 | if xid != None: |
| 7894 | self.xid = xid |
| 7895 | else: |
| 7896 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7897 | if time_ms != None: |
| 7898 | self.time_ms = time_ms |
| 7899 | else: |
| 7900 | self.time_ms = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7901 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7902 | |
| 7903 | def pack(self): |
| 7904 | packed = [] |
| 7905 | packed.append(struct.pack("!B", self.version)) |
| 7906 | packed.append(struct.pack("!B", self.type)) |
| 7907 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7908 | packed.append(struct.pack("!L", self.xid)) |
| 7909 | packed.append(struct.pack("!L", self.experimenter)) |
| 7910 | packed.append(struct.pack("!L", self.subtype)) |
| 7911 | packed.append(struct.pack("!Q", self.time_ms)) |
| 7912 | length = sum([len(x) for x in packed]) |
| 7913 | packed[2] = struct.pack("!H", length) |
| 7914 | return ''.join(packed) |
| 7915 | |
| 7916 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7917 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7918 | obj = bsn_time_reply() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7919 | _version = reader.read("!B")[0] |
| 7920 | assert(_version == 4) |
| 7921 | _type = reader.read("!B")[0] |
| 7922 | assert(_type == 4) |
| 7923 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7924 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 7925 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7926 | obj.xid = reader.read("!L")[0] |
| 7927 | _experimenter = reader.read("!L")[0] |
| 7928 | assert(_experimenter == 6035143) |
| 7929 | _subtype = reader.read("!L")[0] |
| 7930 | assert(_subtype == 45) |
| 7931 | obj.time_ms = reader.read("!Q")[0] |
| 7932 | return obj |
| 7933 | |
| 7934 | def __eq__(self, other): |
| 7935 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7936 | if self.xid != other.xid: return False |
| 7937 | if self.time_ms != other.time_ms: return False |
| 7938 | return True |
| 7939 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7940 | def pretty_print(self, q): |
| 7941 | q.text("bsn_time_reply {") |
| 7942 | with q.group(): |
| 7943 | with q.indent(2): |
| 7944 | q.breakable() |
| 7945 | q.text("xid = "); |
| 7946 | if self.xid != None: |
| 7947 | q.text("%#x" % self.xid) |
| 7948 | else: |
| 7949 | q.text('None') |
| 7950 | q.text(","); q.breakable() |
| 7951 | q.text("time_ms = "); |
| 7952 | q.text("%#x" % self.time_ms) |
| 7953 | q.breakable() |
| 7954 | q.text('}') |
| 7955 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7956 | bsn_header.subtypes[45] = bsn_time_reply |
| 7957 | |
| 7958 | class bsn_time_request(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7959 | version = 4 |
| 7960 | type = 4 |
| 7961 | experimenter = 6035143 |
| 7962 | subtype = 44 |
| 7963 | |
| 7964 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7965 | if xid != None: |
| 7966 | self.xid = xid |
| 7967 | else: |
| 7968 | self.xid = None |
| 7969 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7970 | |
| 7971 | def pack(self): |
| 7972 | packed = [] |
| 7973 | packed.append(struct.pack("!B", self.version)) |
| 7974 | packed.append(struct.pack("!B", self.type)) |
| 7975 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7976 | packed.append(struct.pack("!L", self.xid)) |
| 7977 | packed.append(struct.pack("!L", self.experimenter)) |
| 7978 | packed.append(struct.pack("!L", self.subtype)) |
| 7979 | length = sum([len(x) for x in packed]) |
| 7980 | packed[2] = struct.pack("!H", length) |
| 7981 | return ''.join(packed) |
| 7982 | |
| 7983 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7984 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7985 | obj = bsn_time_request() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7986 | _version = reader.read("!B")[0] |
| 7987 | assert(_version == 4) |
| 7988 | _type = reader.read("!B")[0] |
| 7989 | assert(_type == 4) |
| 7990 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7991 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 7992 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7993 | obj.xid = reader.read("!L")[0] |
| 7994 | _experimenter = reader.read("!L")[0] |
| 7995 | assert(_experimenter == 6035143) |
| 7996 | _subtype = reader.read("!L")[0] |
| 7997 | assert(_subtype == 44) |
| 7998 | return obj |
| 7999 | |
| 8000 | def __eq__(self, other): |
| 8001 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8002 | if self.xid != other.xid: return False |
| 8003 | return True |
| 8004 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8005 | def pretty_print(self, q): |
| 8006 | q.text("bsn_time_request {") |
| 8007 | with q.group(): |
| 8008 | with q.indent(2): |
| 8009 | q.breakable() |
| 8010 | q.text("xid = "); |
| 8011 | if self.xid != None: |
| 8012 | q.text("%#x" % self.xid) |
| 8013 | else: |
| 8014 | q.text('None') |
| 8015 | q.breakable() |
| 8016 | q.text('}') |
| 8017 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8018 | bsn_header.subtypes[44] = bsn_time_request |
| 8019 | |
| 8020 | class bsn_virtual_port_create_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8021 | version = 4 |
| 8022 | type = 4 |
| 8023 | experimenter = 6035143 |
| 8024 | subtype = 16 |
| 8025 | |
| 8026 | def __init__(self, xid=None, status=None, vport_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8027 | if xid != None: |
| 8028 | self.xid = xid |
| 8029 | else: |
| 8030 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8031 | if status != None: |
| 8032 | self.status = status |
| 8033 | else: |
| 8034 | self.status = 0 |
| 8035 | if vport_no != None: |
| 8036 | self.vport_no = vport_no |
| 8037 | else: |
| 8038 | self.vport_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8039 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8040 | |
| 8041 | def pack(self): |
| 8042 | packed = [] |
| 8043 | packed.append(struct.pack("!B", self.version)) |
| 8044 | packed.append(struct.pack("!B", self.type)) |
| 8045 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8046 | packed.append(struct.pack("!L", self.xid)) |
| 8047 | packed.append(struct.pack("!L", self.experimenter)) |
| 8048 | packed.append(struct.pack("!L", self.subtype)) |
| 8049 | packed.append(struct.pack("!L", self.status)) |
| 8050 | packed.append(struct.pack("!L", self.vport_no)) |
| 8051 | length = sum([len(x) for x in packed]) |
| 8052 | packed[2] = struct.pack("!H", length) |
| 8053 | return ''.join(packed) |
| 8054 | |
| 8055 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8056 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8057 | obj = bsn_virtual_port_create_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8058 | _version = reader.read("!B")[0] |
| 8059 | assert(_version == 4) |
| 8060 | _type = reader.read("!B")[0] |
| 8061 | assert(_type == 4) |
| 8062 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8063 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 8064 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8065 | obj.xid = reader.read("!L")[0] |
| 8066 | _experimenter = reader.read("!L")[0] |
| 8067 | assert(_experimenter == 6035143) |
| 8068 | _subtype = reader.read("!L")[0] |
| 8069 | assert(_subtype == 16) |
| 8070 | obj.status = reader.read("!L")[0] |
| 8071 | obj.vport_no = reader.read("!L")[0] |
| 8072 | return obj |
| 8073 | |
| 8074 | def __eq__(self, other): |
| 8075 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8076 | if self.xid != other.xid: return False |
| 8077 | if self.status != other.status: return False |
| 8078 | if self.vport_no != other.vport_no: return False |
| 8079 | return True |
| 8080 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8081 | def pretty_print(self, q): |
| 8082 | q.text("bsn_virtual_port_create_reply {") |
| 8083 | with q.group(): |
| 8084 | with q.indent(2): |
| 8085 | q.breakable() |
| 8086 | q.text("xid = "); |
| 8087 | if self.xid != None: |
| 8088 | q.text("%#x" % self.xid) |
| 8089 | else: |
| 8090 | q.text('None') |
| 8091 | q.text(","); q.breakable() |
| 8092 | q.text("status = "); |
| 8093 | q.text("%#x" % self.status) |
| 8094 | q.text(","); q.breakable() |
| 8095 | q.text("vport_no = "); |
| 8096 | q.text("%#x" % self.vport_no) |
| 8097 | q.breakable() |
| 8098 | q.text('}') |
| 8099 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8100 | bsn_header.subtypes[16] = bsn_virtual_port_create_reply |
| 8101 | |
| 8102 | class bsn_virtual_port_create_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8103 | version = 4 |
| 8104 | type = 4 |
| 8105 | experimenter = 6035143 |
| 8106 | subtype = 15 |
| 8107 | |
| 8108 | def __init__(self, xid=None, vport=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8109 | if xid != None: |
| 8110 | self.xid = xid |
| 8111 | else: |
| 8112 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8113 | if vport != None: |
| 8114 | self.vport = vport |
| 8115 | else: |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 8116 | self.vport = common.bsn_vport() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8117 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8118 | |
| 8119 | def pack(self): |
| 8120 | packed = [] |
| 8121 | packed.append(struct.pack("!B", self.version)) |
| 8122 | packed.append(struct.pack("!B", self.type)) |
| 8123 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8124 | packed.append(struct.pack("!L", self.xid)) |
| 8125 | packed.append(struct.pack("!L", self.experimenter)) |
| 8126 | packed.append(struct.pack("!L", self.subtype)) |
| 8127 | packed.append(self.vport.pack()) |
| 8128 | length = sum([len(x) for x in packed]) |
| 8129 | packed[2] = struct.pack("!H", length) |
| 8130 | return ''.join(packed) |
| 8131 | |
| 8132 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8133 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8134 | obj = bsn_virtual_port_create_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8135 | _version = reader.read("!B")[0] |
| 8136 | assert(_version == 4) |
| 8137 | _type = reader.read("!B")[0] |
| 8138 | assert(_type == 4) |
| 8139 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8140 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 8141 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8142 | obj.xid = reader.read("!L")[0] |
| 8143 | _experimenter = reader.read("!L")[0] |
| 8144 | assert(_experimenter == 6035143) |
| 8145 | _subtype = reader.read("!L")[0] |
| 8146 | assert(_subtype == 15) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 8147 | obj.vport = common.bsn_vport.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8148 | return obj |
| 8149 | |
| 8150 | def __eq__(self, other): |
| 8151 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8152 | if self.xid != other.xid: return False |
| 8153 | if self.vport != other.vport: return False |
| 8154 | return True |
| 8155 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8156 | def pretty_print(self, q): |
| 8157 | q.text("bsn_virtual_port_create_request {") |
| 8158 | with q.group(): |
| 8159 | with q.indent(2): |
| 8160 | q.breakable() |
| 8161 | q.text("xid = "); |
| 8162 | if self.xid != None: |
| 8163 | q.text("%#x" % self.xid) |
| 8164 | else: |
| 8165 | q.text('None') |
| 8166 | q.text(","); q.breakable() |
| 8167 | q.text("vport = "); |
| 8168 | q.pp(self.vport) |
| 8169 | q.breakable() |
| 8170 | q.text('}') |
| 8171 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8172 | bsn_header.subtypes[15] = bsn_virtual_port_create_request |
| 8173 | |
| 8174 | class bsn_virtual_port_remove_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8175 | version = 4 |
| 8176 | type = 4 |
| 8177 | experimenter = 6035143 |
| 8178 | subtype = 26 |
| 8179 | |
| 8180 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8181 | if xid != None: |
| 8182 | self.xid = xid |
| 8183 | else: |
| 8184 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8185 | if status != None: |
| 8186 | self.status = status |
| 8187 | else: |
| 8188 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8189 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8190 | |
| 8191 | def pack(self): |
| 8192 | packed = [] |
| 8193 | packed.append(struct.pack("!B", self.version)) |
| 8194 | packed.append(struct.pack("!B", self.type)) |
| 8195 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8196 | packed.append(struct.pack("!L", self.xid)) |
| 8197 | packed.append(struct.pack("!L", self.experimenter)) |
| 8198 | packed.append(struct.pack("!L", self.subtype)) |
| 8199 | packed.append(struct.pack("!L", self.status)) |
| 8200 | length = sum([len(x) for x in packed]) |
| 8201 | packed[2] = struct.pack("!H", length) |
| 8202 | return ''.join(packed) |
| 8203 | |
| 8204 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8205 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8206 | obj = bsn_virtual_port_remove_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8207 | _version = reader.read("!B")[0] |
| 8208 | assert(_version == 4) |
| 8209 | _type = reader.read("!B")[0] |
| 8210 | assert(_type == 4) |
| 8211 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8212 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 8213 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8214 | obj.xid = reader.read("!L")[0] |
| 8215 | _experimenter = reader.read("!L")[0] |
| 8216 | assert(_experimenter == 6035143) |
| 8217 | _subtype = reader.read("!L")[0] |
| 8218 | assert(_subtype == 26) |
| 8219 | obj.status = reader.read("!L")[0] |
| 8220 | return obj |
| 8221 | |
| 8222 | def __eq__(self, other): |
| 8223 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8224 | if self.xid != other.xid: return False |
| 8225 | if self.status != other.status: return False |
| 8226 | return True |
| 8227 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8228 | def pretty_print(self, q): |
| 8229 | q.text("bsn_virtual_port_remove_reply {") |
| 8230 | with q.group(): |
| 8231 | with q.indent(2): |
| 8232 | q.breakable() |
| 8233 | q.text("xid = "); |
| 8234 | if self.xid != None: |
| 8235 | q.text("%#x" % self.xid) |
| 8236 | else: |
| 8237 | q.text('None') |
| 8238 | q.text(","); q.breakable() |
| 8239 | q.text("status = "); |
| 8240 | q.text("%#x" % self.status) |
| 8241 | q.breakable() |
| 8242 | q.text('}') |
| 8243 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8244 | bsn_header.subtypes[26] = bsn_virtual_port_remove_reply |
| 8245 | |
| 8246 | class bsn_virtual_port_remove_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8247 | version = 4 |
| 8248 | type = 4 |
| 8249 | experimenter = 6035143 |
| 8250 | subtype = 17 |
| 8251 | |
| 8252 | def __init__(self, xid=None, vport_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8253 | if xid != None: |
| 8254 | self.xid = xid |
| 8255 | else: |
| 8256 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8257 | if vport_no != None: |
| 8258 | self.vport_no = vport_no |
| 8259 | else: |
| 8260 | self.vport_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8261 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8262 | |
| 8263 | def pack(self): |
| 8264 | packed = [] |
| 8265 | packed.append(struct.pack("!B", self.version)) |
| 8266 | packed.append(struct.pack("!B", self.type)) |
| 8267 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8268 | packed.append(struct.pack("!L", self.xid)) |
| 8269 | packed.append(struct.pack("!L", self.experimenter)) |
| 8270 | packed.append(struct.pack("!L", self.subtype)) |
| 8271 | packed.append(struct.pack("!L", self.vport_no)) |
| 8272 | length = sum([len(x) for x in packed]) |
| 8273 | packed[2] = struct.pack("!H", length) |
| 8274 | return ''.join(packed) |
| 8275 | |
| 8276 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8277 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8278 | obj = bsn_virtual_port_remove_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8279 | _version = reader.read("!B")[0] |
| 8280 | assert(_version == 4) |
| 8281 | _type = reader.read("!B")[0] |
| 8282 | assert(_type == 4) |
| 8283 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8284 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 8285 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8286 | obj.xid = reader.read("!L")[0] |
| 8287 | _experimenter = reader.read("!L")[0] |
| 8288 | assert(_experimenter == 6035143) |
| 8289 | _subtype = reader.read("!L")[0] |
| 8290 | assert(_subtype == 17) |
| 8291 | obj.vport_no = reader.read("!L")[0] |
| 8292 | return obj |
| 8293 | |
| 8294 | def __eq__(self, other): |
| 8295 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8296 | if self.xid != other.xid: return False |
| 8297 | if self.vport_no != other.vport_no: return False |
| 8298 | return True |
| 8299 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8300 | def pretty_print(self, q): |
| 8301 | q.text("bsn_virtual_port_remove_request {") |
| 8302 | with q.group(): |
| 8303 | with q.indent(2): |
| 8304 | q.breakable() |
| 8305 | q.text("xid = "); |
| 8306 | if self.xid != None: |
| 8307 | q.text("%#x" % self.xid) |
| 8308 | else: |
| 8309 | q.text('None') |
| 8310 | q.text(","); q.breakable() |
| 8311 | q.text("vport_no = "); |
| 8312 | q.text("%#x" % self.vport_no) |
| 8313 | q.breakable() |
| 8314 | q.text('}') |
| 8315 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8316 | bsn_header.subtypes[17] = bsn_virtual_port_remove_request |
| 8317 | |
| 8318 | class bsn_vlan_counter_stats_reply(bsn_stats_reply): |
| 8319 | version = 4 |
| 8320 | type = 19 |
| 8321 | stats_type = 65535 |
| 8322 | experimenter = 6035143 |
| 8323 | subtype = 9 |
| 8324 | |
| 8325 | def __init__(self, xid=None, flags=None, entries=None): |
| 8326 | if xid != None: |
| 8327 | self.xid = xid |
| 8328 | else: |
| 8329 | self.xid = None |
| 8330 | if flags != None: |
| 8331 | self.flags = flags |
| 8332 | else: |
| 8333 | self.flags = 0 |
| 8334 | if entries != None: |
| 8335 | self.entries = entries |
| 8336 | else: |
| 8337 | self.entries = [] |
| 8338 | return |
| 8339 | |
| 8340 | def pack(self): |
| 8341 | packed = [] |
| 8342 | packed.append(struct.pack("!B", self.version)) |
| 8343 | packed.append(struct.pack("!B", self.type)) |
| 8344 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8345 | packed.append(struct.pack("!L", self.xid)) |
| 8346 | packed.append(struct.pack("!H", self.stats_type)) |
| 8347 | packed.append(struct.pack("!H", self.flags)) |
| 8348 | packed.append('\x00' * 4) |
| 8349 | packed.append(struct.pack("!L", self.experimenter)) |
| 8350 | packed.append(struct.pack("!L", self.subtype)) |
| 8351 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 8352 | length = sum([len(x) for x in packed]) |
| 8353 | packed[2] = struct.pack("!H", length) |
| 8354 | return ''.join(packed) |
| 8355 | |
| 8356 | @staticmethod |
| 8357 | def unpack(reader): |
| 8358 | obj = bsn_vlan_counter_stats_reply() |
| 8359 | _version = reader.read("!B")[0] |
| 8360 | assert(_version == 4) |
| 8361 | _type = reader.read("!B")[0] |
| 8362 | assert(_type == 19) |
| 8363 | _length = reader.read("!H")[0] |
| 8364 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 8365 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8366 | obj.xid = reader.read("!L")[0] |
| 8367 | _stats_type = reader.read("!H")[0] |
| 8368 | assert(_stats_type == 65535) |
| 8369 | obj.flags = reader.read("!H")[0] |
| 8370 | reader.skip(4) |
| 8371 | _experimenter = reader.read("!L")[0] |
| 8372 | assert(_experimenter == 6035143) |
| 8373 | _subtype = reader.read("!L")[0] |
| 8374 | assert(_subtype == 9) |
| 8375 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_vlan_counter_stats_entry.unpack) |
| 8376 | return obj |
| 8377 | |
| 8378 | def __eq__(self, other): |
| 8379 | if type(self) != type(other): return False |
| 8380 | if self.xid != other.xid: return False |
| 8381 | if self.flags != other.flags: return False |
| 8382 | if self.entries != other.entries: return False |
| 8383 | return True |
| 8384 | |
| 8385 | def pretty_print(self, q): |
| 8386 | q.text("bsn_vlan_counter_stats_reply {") |
| 8387 | with q.group(): |
| 8388 | with q.indent(2): |
| 8389 | q.breakable() |
| 8390 | q.text("xid = "); |
| 8391 | if self.xid != None: |
| 8392 | q.text("%#x" % self.xid) |
| 8393 | else: |
| 8394 | q.text('None') |
| 8395 | q.text(","); q.breakable() |
| 8396 | q.text("flags = "); |
| 8397 | q.text("%#x" % self.flags) |
| 8398 | q.text(","); q.breakable() |
| 8399 | q.text("entries = "); |
| 8400 | q.pp(self.entries) |
| 8401 | q.breakable() |
| 8402 | q.text('}') |
| 8403 | |
| 8404 | bsn_stats_reply.subtypes[9] = bsn_vlan_counter_stats_reply |
| 8405 | |
| 8406 | class bsn_vlan_counter_stats_request(bsn_stats_request): |
| 8407 | version = 4 |
| 8408 | type = 18 |
| 8409 | stats_type = 65535 |
| 8410 | experimenter = 6035143 |
| 8411 | subtype = 9 |
| 8412 | |
| 8413 | def __init__(self, xid=None, flags=None, vlan_vid=None): |
| 8414 | if xid != None: |
| 8415 | self.xid = xid |
| 8416 | else: |
| 8417 | self.xid = None |
| 8418 | if flags != None: |
| 8419 | self.flags = flags |
| 8420 | else: |
| 8421 | self.flags = 0 |
| 8422 | if vlan_vid != None: |
| 8423 | self.vlan_vid = vlan_vid |
| 8424 | else: |
| 8425 | self.vlan_vid = 0 |
| 8426 | return |
| 8427 | |
| 8428 | def pack(self): |
| 8429 | packed = [] |
| 8430 | packed.append(struct.pack("!B", self.version)) |
| 8431 | packed.append(struct.pack("!B", self.type)) |
| 8432 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8433 | packed.append(struct.pack("!L", self.xid)) |
| 8434 | packed.append(struct.pack("!H", self.stats_type)) |
| 8435 | packed.append(struct.pack("!H", self.flags)) |
| 8436 | packed.append('\x00' * 4) |
| 8437 | packed.append(struct.pack("!L", self.experimenter)) |
| 8438 | packed.append(struct.pack("!L", self.subtype)) |
| 8439 | packed.append(struct.pack("!H", self.vlan_vid)) |
| 8440 | length = sum([len(x) for x in packed]) |
| 8441 | packed[2] = struct.pack("!H", length) |
| 8442 | return ''.join(packed) |
| 8443 | |
| 8444 | @staticmethod |
| 8445 | def unpack(reader): |
| 8446 | obj = bsn_vlan_counter_stats_request() |
| 8447 | _version = reader.read("!B")[0] |
| 8448 | assert(_version == 4) |
| 8449 | _type = reader.read("!B")[0] |
| 8450 | assert(_type == 18) |
| 8451 | _length = reader.read("!H")[0] |
| 8452 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 8453 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8454 | obj.xid = reader.read("!L")[0] |
| 8455 | _stats_type = reader.read("!H")[0] |
| 8456 | assert(_stats_type == 65535) |
| 8457 | obj.flags = reader.read("!H")[0] |
| 8458 | reader.skip(4) |
| 8459 | _experimenter = reader.read("!L")[0] |
| 8460 | assert(_experimenter == 6035143) |
| 8461 | _subtype = reader.read("!L")[0] |
| 8462 | assert(_subtype == 9) |
| 8463 | obj.vlan_vid = reader.read("!H")[0] |
| 8464 | return obj |
| 8465 | |
| 8466 | def __eq__(self, other): |
| 8467 | if type(self) != type(other): return False |
| 8468 | if self.xid != other.xid: return False |
| 8469 | if self.flags != other.flags: return False |
| 8470 | if self.vlan_vid != other.vlan_vid: return False |
| 8471 | return True |
| 8472 | |
| 8473 | def pretty_print(self, q): |
| 8474 | q.text("bsn_vlan_counter_stats_request {") |
| 8475 | with q.group(): |
| 8476 | with q.indent(2): |
| 8477 | q.breakable() |
| 8478 | q.text("xid = "); |
| 8479 | if self.xid != None: |
| 8480 | q.text("%#x" % self.xid) |
| 8481 | else: |
| 8482 | q.text('None') |
| 8483 | q.text(","); q.breakable() |
| 8484 | q.text("flags = "); |
| 8485 | q.text("%#x" % self.flags) |
| 8486 | q.text(","); q.breakable() |
| 8487 | q.text("vlan_vid = "); |
| 8488 | q.text("%#x" % self.vlan_vid) |
| 8489 | q.breakable() |
| 8490 | q.text('}') |
| 8491 | |
| 8492 | bsn_stats_request.subtypes[9] = bsn_vlan_counter_stats_request |
| 8493 | |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 8494 | class bsn_vrf_counter_stats_reply(bsn_stats_reply): |
| 8495 | version = 4 |
| 8496 | type = 19 |
| 8497 | stats_type = 65535 |
| 8498 | experimenter = 6035143 |
| 8499 | subtype = 15 |
| 8500 | |
| 8501 | def __init__(self, xid=None, flags=None, entries=None): |
| 8502 | if xid != None: |
| 8503 | self.xid = xid |
| 8504 | else: |
| 8505 | self.xid = None |
| 8506 | if flags != None: |
| 8507 | self.flags = flags |
| 8508 | else: |
| 8509 | self.flags = 0 |
| 8510 | if entries != None: |
| 8511 | self.entries = entries |
| 8512 | else: |
| 8513 | self.entries = [] |
| 8514 | return |
| 8515 | |
| 8516 | def pack(self): |
| 8517 | packed = [] |
| 8518 | packed.append(struct.pack("!B", self.version)) |
| 8519 | packed.append(struct.pack("!B", self.type)) |
| 8520 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8521 | packed.append(struct.pack("!L", self.xid)) |
| 8522 | packed.append(struct.pack("!H", self.stats_type)) |
| 8523 | packed.append(struct.pack("!H", self.flags)) |
| 8524 | packed.append('\x00' * 4) |
| 8525 | packed.append(struct.pack("!L", self.experimenter)) |
| 8526 | packed.append(struct.pack("!L", self.subtype)) |
| 8527 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 8528 | length = sum([len(x) for x in packed]) |
| 8529 | packed[2] = struct.pack("!H", length) |
| 8530 | return ''.join(packed) |
| 8531 | |
| 8532 | @staticmethod |
| 8533 | def unpack(reader): |
| 8534 | obj = bsn_vrf_counter_stats_reply() |
| 8535 | _version = reader.read("!B")[0] |
| 8536 | assert(_version == 4) |
| 8537 | _type = reader.read("!B")[0] |
| 8538 | assert(_type == 19) |
| 8539 | _length = reader.read("!H")[0] |
| 8540 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 8541 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 8542 | obj.xid = reader.read("!L")[0] |
| 8543 | _stats_type = reader.read("!H")[0] |
| 8544 | assert(_stats_type == 65535) |
| 8545 | obj.flags = reader.read("!H")[0] |
| 8546 | reader.skip(4) |
| 8547 | _experimenter = reader.read("!L")[0] |
| 8548 | assert(_experimenter == 6035143) |
| 8549 | _subtype = reader.read("!L")[0] |
| 8550 | assert(_subtype == 15) |
| 8551 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_vrf_counter_stats_entry.unpack) |
| 8552 | return obj |
| 8553 | |
| 8554 | def __eq__(self, other): |
| 8555 | if type(self) != type(other): return False |
| 8556 | if self.xid != other.xid: return False |
| 8557 | if self.flags != other.flags: return False |
| 8558 | if self.entries != other.entries: return False |
| 8559 | return True |
| 8560 | |
| 8561 | def pretty_print(self, q): |
| 8562 | q.text("bsn_vrf_counter_stats_reply {") |
| 8563 | with q.group(): |
| 8564 | with q.indent(2): |
| 8565 | q.breakable() |
| 8566 | q.text("xid = "); |
| 8567 | if self.xid != None: |
| 8568 | q.text("%#x" % self.xid) |
| 8569 | else: |
| 8570 | q.text('None') |
| 8571 | q.text(","); q.breakable() |
| 8572 | q.text("flags = "); |
| 8573 | q.text("%#x" % self.flags) |
| 8574 | q.text(","); q.breakable() |
| 8575 | q.text("entries = "); |
| 8576 | q.pp(self.entries) |
| 8577 | q.breakable() |
| 8578 | q.text('}') |
| 8579 | |
| 8580 | bsn_stats_reply.subtypes[15] = bsn_vrf_counter_stats_reply |
| 8581 | |
| 8582 | class bsn_vrf_counter_stats_request(bsn_stats_request): |
| 8583 | version = 4 |
| 8584 | type = 18 |
| 8585 | stats_type = 65535 |
| 8586 | experimenter = 6035143 |
| 8587 | subtype = 15 |
| 8588 | |
| 8589 | def __init__(self, xid=None, flags=None, vrf=None): |
| 8590 | if xid != None: |
| 8591 | self.xid = xid |
| 8592 | else: |
| 8593 | self.xid = None |
| 8594 | if flags != None: |
| 8595 | self.flags = flags |
| 8596 | else: |
| 8597 | self.flags = 0 |
| 8598 | if vrf != None: |
| 8599 | self.vrf = vrf |
| 8600 | else: |
| 8601 | self.vrf = 0 |
| 8602 | return |
| 8603 | |
| 8604 | def pack(self): |
| 8605 | packed = [] |
| 8606 | packed.append(struct.pack("!B", self.version)) |
| 8607 | packed.append(struct.pack("!B", self.type)) |
| 8608 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8609 | packed.append(struct.pack("!L", self.xid)) |
| 8610 | packed.append(struct.pack("!H", self.stats_type)) |
| 8611 | packed.append(struct.pack("!H", self.flags)) |
| 8612 | packed.append('\x00' * 4) |
| 8613 | packed.append(struct.pack("!L", self.experimenter)) |
| 8614 | packed.append(struct.pack("!L", self.subtype)) |
| 8615 | packed.append(struct.pack("!L", self.vrf)) |
| 8616 | length = sum([len(x) for x in packed]) |
| 8617 | packed[2] = struct.pack("!H", length) |
| 8618 | return ''.join(packed) |
| 8619 | |
| 8620 | @staticmethod |
| 8621 | def unpack(reader): |
| 8622 | obj = bsn_vrf_counter_stats_request() |
| 8623 | _version = reader.read("!B")[0] |
| 8624 | assert(_version == 4) |
| 8625 | _type = reader.read("!B")[0] |
| 8626 | assert(_type == 18) |
| 8627 | _length = reader.read("!H")[0] |
| 8628 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 8629 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 8630 | obj.xid = reader.read("!L")[0] |
| 8631 | _stats_type = reader.read("!H")[0] |
| 8632 | assert(_stats_type == 65535) |
| 8633 | obj.flags = reader.read("!H")[0] |
| 8634 | reader.skip(4) |
| 8635 | _experimenter = reader.read("!L")[0] |
| 8636 | assert(_experimenter == 6035143) |
| 8637 | _subtype = reader.read("!L")[0] |
| 8638 | assert(_subtype == 15) |
| 8639 | obj.vrf = reader.read("!L")[0] |
| 8640 | return obj |
| 8641 | |
| 8642 | def __eq__(self, other): |
| 8643 | if type(self) != type(other): return False |
| 8644 | if self.xid != other.xid: return False |
| 8645 | if self.flags != other.flags: return False |
| 8646 | if self.vrf != other.vrf: return False |
| 8647 | return True |
| 8648 | |
| 8649 | def pretty_print(self, q): |
| 8650 | q.text("bsn_vrf_counter_stats_request {") |
| 8651 | with q.group(): |
| 8652 | with q.indent(2): |
| 8653 | q.breakable() |
| 8654 | q.text("xid = "); |
| 8655 | if self.xid != None: |
| 8656 | q.text("%#x" % self.xid) |
| 8657 | else: |
| 8658 | q.text('None') |
| 8659 | q.text(","); q.breakable() |
| 8660 | q.text("flags = "); |
| 8661 | q.text("%#x" % self.flags) |
| 8662 | q.text(","); q.breakable() |
| 8663 | q.text("vrf = "); |
| 8664 | q.text("%#x" % self.vrf) |
| 8665 | q.breakable() |
| 8666 | q.text('}') |
| 8667 | |
| 8668 | bsn_stats_request.subtypes[15] = bsn_vrf_counter_stats_request |
| 8669 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8670 | class desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8671 | version = 4 |
| 8672 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8673 | stats_type = 0 |
| 8674 | |
| 8675 | 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] | 8676 | if xid != None: |
| 8677 | self.xid = xid |
| 8678 | else: |
| 8679 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8680 | if flags != None: |
| 8681 | self.flags = flags |
| 8682 | else: |
| 8683 | self.flags = 0 |
| 8684 | if mfr_desc != None: |
| 8685 | self.mfr_desc = mfr_desc |
| 8686 | else: |
| 8687 | self.mfr_desc = "" |
| 8688 | if hw_desc != None: |
| 8689 | self.hw_desc = hw_desc |
| 8690 | else: |
| 8691 | self.hw_desc = "" |
| 8692 | if sw_desc != None: |
| 8693 | self.sw_desc = sw_desc |
| 8694 | else: |
| 8695 | self.sw_desc = "" |
| 8696 | if serial_num != None: |
| 8697 | self.serial_num = serial_num |
| 8698 | else: |
| 8699 | self.serial_num = "" |
| 8700 | if dp_desc != None: |
| 8701 | self.dp_desc = dp_desc |
| 8702 | else: |
| 8703 | self.dp_desc = "" |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8704 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8705 | |
| 8706 | def pack(self): |
| 8707 | packed = [] |
| 8708 | packed.append(struct.pack("!B", self.version)) |
| 8709 | packed.append(struct.pack("!B", self.type)) |
| 8710 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8711 | packed.append(struct.pack("!L", self.xid)) |
| 8712 | packed.append(struct.pack("!H", self.stats_type)) |
| 8713 | packed.append(struct.pack("!H", self.flags)) |
| 8714 | packed.append('\x00' * 4) |
| 8715 | packed.append(struct.pack("!256s", self.mfr_desc)) |
| 8716 | packed.append(struct.pack("!256s", self.hw_desc)) |
| 8717 | packed.append(struct.pack("!256s", self.sw_desc)) |
| 8718 | packed.append(struct.pack("!32s", self.serial_num)) |
| 8719 | packed.append(struct.pack("!256s", self.dp_desc)) |
| 8720 | length = sum([len(x) for x in packed]) |
| 8721 | packed[2] = struct.pack("!H", length) |
| 8722 | return ''.join(packed) |
| 8723 | |
| 8724 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8725 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8726 | obj = desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8727 | _version = reader.read("!B")[0] |
| 8728 | assert(_version == 4) |
| 8729 | _type = reader.read("!B")[0] |
| 8730 | assert(_type == 19) |
| 8731 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8732 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 8733 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8734 | obj.xid = reader.read("!L")[0] |
| 8735 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8736 | assert(_stats_type == 0) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8737 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8738 | reader.skip(4) |
| 8739 | obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00") |
| 8740 | obj.hw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 8741 | obj.sw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 8742 | obj.serial_num = reader.read("!32s")[0].rstrip("\x00") |
| 8743 | obj.dp_desc = reader.read("!256s")[0].rstrip("\x00") |
| 8744 | return obj |
| 8745 | |
| 8746 | def __eq__(self, other): |
| 8747 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8748 | if self.xid != other.xid: return False |
| 8749 | if self.flags != other.flags: return False |
| 8750 | if self.mfr_desc != other.mfr_desc: return False |
| 8751 | if self.hw_desc != other.hw_desc: return False |
| 8752 | if self.sw_desc != other.sw_desc: return False |
| 8753 | if self.serial_num != other.serial_num: return False |
| 8754 | if self.dp_desc != other.dp_desc: return False |
| 8755 | return True |
| 8756 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8757 | def pretty_print(self, q): |
| 8758 | q.text("desc_stats_reply {") |
| 8759 | with q.group(): |
| 8760 | with q.indent(2): |
| 8761 | q.breakable() |
| 8762 | q.text("xid = "); |
| 8763 | if self.xid != None: |
| 8764 | q.text("%#x" % self.xid) |
| 8765 | else: |
| 8766 | q.text('None') |
| 8767 | q.text(","); q.breakable() |
| 8768 | q.text("flags = "); |
| 8769 | q.text("%#x" % self.flags) |
| 8770 | q.text(","); q.breakable() |
| 8771 | q.text("mfr_desc = "); |
| 8772 | q.pp(self.mfr_desc) |
| 8773 | q.text(","); q.breakable() |
| 8774 | q.text("hw_desc = "); |
| 8775 | q.pp(self.hw_desc) |
| 8776 | q.text(","); q.breakable() |
| 8777 | q.text("sw_desc = "); |
| 8778 | q.pp(self.sw_desc) |
| 8779 | q.text(","); q.breakable() |
| 8780 | q.text("serial_num = "); |
| 8781 | q.pp(self.serial_num) |
| 8782 | q.text(","); q.breakable() |
| 8783 | q.text("dp_desc = "); |
| 8784 | q.pp(self.dp_desc) |
| 8785 | q.breakable() |
| 8786 | q.text('}') |
| 8787 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8788 | stats_reply.subtypes[0] = desc_stats_reply |
| 8789 | |
| 8790 | class desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8791 | version = 4 |
| 8792 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8793 | stats_type = 0 |
| 8794 | |
| 8795 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8796 | if xid != None: |
| 8797 | self.xid = xid |
| 8798 | else: |
| 8799 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8800 | if flags != None: |
| 8801 | self.flags = flags |
| 8802 | else: |
| 8803 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8804 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8805 | |
| 8806 | def pack(self): |
| 8807 | packed = [] |
| 8808 | packed.append(struct.pack("!B", self.version)) |
| 8809 | packed.append(struct.pack("!B", self.type)) |
| 8810 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8811 | packed.append(struct.pack("!L", self.xid)) |
| 8812 | packed.append(struct.pack("!H", self.stats_type)) |
| 8813 | packed.append(struct.pack("!H", self.flags)) |
| 8814 | packed.append('\x00' * 4) |
| 8815 | length = sum([len(x) for x in packed]) |
| 8816 | packed[2] = struct.pack("!H", length) |
| 8817 | return ''.join(packed) |
| 8818 | |
| 8819 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8820 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8821 | obj = desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8822 | _version = reader.read("!B")[0] |
| 8823 | assert(_version == 4) |
| 8824 | _type = reader.read("!B")[0] |
| 8825 | assert(_type == 18) |
| 8826 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8827 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 8828 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8829 | obj.xid = reader.read("!L")[0] |
| 8830 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8831 | assert(_stats_type == 0) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8832 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8833 | reader.skip(4) |
| 8834 | return obj |
| 8835 | |
| 8836 | def __eq__(self, other): |
| 8837 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8838 | if self.xid != other.xid: return False |
| 8839 | if self.flags != other.flags: return False |
| 8840 | return True |
| 8841 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8842 | def pretty_print(self, q): |
| 8843 | q.text("desc_stats_request {") |
| 8844 | with q.group(): |
| 8845 | with q.indent(2): |
| 8846 | q.breakable() |
| 8847 | q.text("xid = "); |
| 8848 | if self.xid != None: |
| 8849 | q.text("%#x" % self.xid) |
| 8850 | else: |
| 8851 | q.text('None') |
| 8852 | q.text(","); q.breakable() |
| 8853 | q.text("flags = "); |
| 8854 | q.text("%#x" % self.flags) |
| 8855 | q.breakable() |
| 8856 | q.text('}') |
| 8857 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8858 | stats_request.subtypes[0] = desc_stats_request |
| 8859 | |
| 8860 | class echo_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8861 | version = 4 |
| 8862 | type = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8863 | |
| 8864 | def __init__(self, xid=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8865 | if xid != None: |
| 8866 | self.xid = xid |
| 8867 | else: |
| 8868 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8869 | if data != None: |
| 8870 | self.data = data |
| 8871 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8872 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8873 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8874 | |
| 8875 | def pack(self): |
| 8876 | packed = [] |
| 8877 | packed.append(struct.pack("!B", self.version)) |
| 8878 | packed.append(struct.pack("!B", self.type)) |
| 8879 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8880 | packed.append(struct.pack("!L", self.xid)) |
| 8881 | packed.append(self.data) |
| 8882 | length = sum([len(x) for x in packed]) |
| 8883 | packed[2] = struct.pack("!H", length) |
| 8884 | return ''.join(packed) |
| 8885 | |
| 8886 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8887 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8888 | obj = echo_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8889 | _version = reader.read("!B")[0] |
| 8890 | assert(_version == 4) |
| 8891 | _type = reader.read("!B")[0] |
| 8892 | assert(_type == 3) |
| 8893 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8894 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 8895 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8896 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8897 | obj.data = str(reader.read_all()) |
| 8898 | return obj |
| 8899 | |
| 8900 | def __eq__(self, other): |
| 8901 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8902 | if self.xid != other.xid: return False |
| 8903 | if self.data != other.data: return False |
| 8904 | return True |
| 8905 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8906 | def pretty_print(self, q): |
| 8907 | q.text("echo_reply {") |
| 8908 | with q.group(): |
| 8909 | with q.indent(2): |
| 8910 | q.breakable() |
| 8911 | q.text("xid = "); |
| 8912 | if self.xid != None: |
| 8913 | q.text("%#x" % self.xid) |
| 8914 | else: |
| 8915 | q.text('None') |
| 8916 | q.text(","); q.breakable() |
| 8917 | q.text("data = "); |
| 8918 | q.pp(self.data) |
| 8919 | q.breakable() |
| 8920 | q.text('}') |
| 8921 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8922 | message.subtypes[3] = echo_reply |
| 8923 | |
| 8924 | class echo_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8925 | version = 4 |
| 8926 | type = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8927 | |
| 8928 | def __init__(self, xid=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8929 | if xid != None: |
| 8930 | self.xid = xid |
| 8931 | else: |
| 8932 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8933 | if data != None: |
| 8934 | self.data = data |
| 8935 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8936 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8937 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8938 | |
| 8939 | def pack(self): |
| 8940 | packed = [] |
| 8941 | packed.append(struct.pack("!B", self.version)) |
| 8942 | packed.append(struct.pack("!B", self.type)) |
| 8943 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8944 | packed.append(struct.pack("!L", self.xid)) |
| 8945 | packed.append(self.data) |
| 8946 | length = sum([len(x) for x in packed]) |
| 8947 | packed[2] = struct.pack("!H", length) |
| 8948 | return ''.join(packed) |
| 8949 | |
| 8950 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8951 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8952 | obj = echo_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8953 | _version = reader.read("!B")[0] |
| 8954 | assert(_version == 4) |
| 8955 | _type = reader.read("!B")[0] |
| 8956 | assert(_type == 2) |
| 8957 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8958 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 8959 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8960 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8961 | obj.data = str(reader.read_all()) |
| 8962 | return obj |
| 8963 | |
| 8964 | def __eq__(self, other): |
| 8965 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8966 | if self.xid != other.xid: return False |
| 8967 | if self.data != other.data: return False |
| 8968 | return True |
| 8969 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8970 | def pretty_print(self, q): |
| 8971 | q.text("echo_request {") |
| 8972 | with q.group(): |
| 8973 | with q.indent(2): |
| 8974 | q.breakable() |
| 8975 | q.text("xid = "); |
| 8976 | if self.xid != None: |
| 8977 | q.text("%#x" % self.xid) |
| 8978 | else: |
| 8979 | q.text('None') |
| 8980 | q.text(","); q.breakable() |
| 8981 | q.text("data = "); |
| 8982 | q.pp(self.data) |
| 8983 | q.breakable() |
| 8984 | q.text('}') |
| 8985 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8986 | message.subtypes[2] = echo_request |
| 8987 | |
| 8988 | class experimenter_error_msg(error_msg): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8989 | version = 4 |
| 8990 | type = 1 |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8991 | err_type = 65535 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8992 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8993 | def __init__(self, xid=None, subtype=None, experimenter=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8994 | if xid != None: |
| 8995 | self.xid = xid |
| 8996 | else: |
| 8997 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8998 | if subtype != None: |
| 8999 | self.subtype = subtype |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9000 | else: |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9001 | self.subtype = 0 |
| 9002 | if experimenter != None: |
| 9003 | self.experimenter = experimenter |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9004 | else: |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9005 | self.experimenter = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9006 | if data != None: |
| 9007 | self.data = data |
| 9008 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9009 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9010 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9011 | |
| 9012 | def pack(self): |
| 9013 | packed = [] |
| 9014 | packed.append(struct.pack("!B", self.version)) |
| 9015 | packed.append(struct.pack("!B", self.type)) |
| 9016 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9017 | packed.append(struct.pack("!L", self.xid)) |
| 9018 | packed.append(struct.pack("!H", self.err_type)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9019 | packed.append(struct.pack("!H", self.subtype)) |
| 9020 | packed.append(struct.pack("!L", self.experimenter)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9021 | packed.append(self.data) |
| 9022 | length = sum([len(x) for x in packed]) |
| 9023 | packed[2] = struct.pack("!H", length) |
| 9024 | return ''.join(packed) |
| 9025 | |
| 9026 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9027 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9028 | obj = experimenter_error_msg() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9029 | _version = reader.read("!B")[0] |
| 9030 | assert(_version == 4) |
| 9031 | _type = reader.read("!B")[0] |
| 9032 | assert(_type == 1) |
| 9033 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9034 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 9035 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9036 | obj.xid = reader.read("!L")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9037 | _err_type = reader.read("!H")[0] |
| 9038 | assert(_err_type == 65535) |
| 9039 | obj.subtype = reader.read("!H")[0] |
| 9040 | obj.experimenter = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9041 | obj.data = str(reader.read_all()) |
| 9042 | return obj |
| 9043 | |
| 9044 | def __eq__(self, other): |
| 9045 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9046 | if self.xid != other.xid: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9047 | if self.subtype != other.subtype: return False |
| 9048 | if self.experimenter != other.experimenter: return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9049 | if self.data != other.data: return False |
| 9050 | return True |
| 9051 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9052 | def pretty_print(self, q): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9053 | q.text("experimenter_error_msg {") |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9054 | with q.group(): |
| 9055 | with q.indent(2): |
| 9056 | q.breakable() |
| 9057 | q.text("xid = "); |
| 9058 | if self.xid != None: |
| 9059 | q.text("%#x" % self.xid) |
| 9060 | else: |
| 9061 | q.text('None') |
| 9062 | q.text(","); q.breakable() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9063 | q.text("subtype = "); |
| 9064 | q.text("%#x" % self.subtype) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9065 | q.text(","); q.breakable() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9066 | q.text("experimenter = "); |
| 9067 | q.text("%#x" % self.experimenter) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9068 | q.text(","); q.breakable() |
| 9069 | q.text("data = "); |
| 9070 | q.pp(self.data) |
| 9071 | q.breakable() |
| 9072 | q.text('}') |
| 9073 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9074 | error_msg.subtypes[65535] = experimenter_error_msg |
| 9075 | |
| 9076 | class features_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9077 | version = 4 |
| 9078 | type = 6 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9079 | |
| 9080 | 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] | 9081 | if xid != None: |
| 9082 | self.xid = xid |
| 9083 | else: |
| 9084 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9085 | if datapath_id != None: |
| 9086 | self.datapath_id = datapath_id |
| 9087 | else: |
| 9088 | self.datapath_id = 0 |
| 9089 | if n_buffers != None: |
| 9090 | self.n_buffers = n_buffers |
| 9091 | else: |
| 9092 | self.n_buffers = 0 |
| 9093 | if n_tables != None: |
| 9094 | self.n_tables = n_tables |
| 9095 | else: |
| 9096 | self.n_tables = 0 |
| 9097 | if auxiliary_id != None: |
| 9098 | self.auxiliary_id = auxiliary_id |
| 9099 | else: |
| 9100 | self.auxiliary_id = 0 |
| 9101 | if capabilities != None: |
| 9102 | self.capabilities = capabilities |
| 9103 | else: |
| 9104 | self.capabilities = 0 |
| 9105 | if reserved != None: |
| 9106 | self.reserved = reserved |
| 9107 | else: |
| 9108 | self.reserved = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9109 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9110 | |
| 9111 | def pack(self): |
| 9112 | packed = [] |
| 9113 | packed.append(struct.pack("!B", self.version)) |
| 9114 | packed.append(struct.pack("!B", self.type)) |
| 9115 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9116 | packed.append(struct.pack("!L", self.xid)) |
| 9117 | packed.append(struct.pack("!Q", self.datapath_id)) |
| 9118 | packed.append(struct.pack("!L", self.n_buffers)) |
| 9119 | packed.append(struct.pack("!B", self.n_tables)) |
| 9120 | packed.append(struct.pack("!B", self.auxiliary_id)) |
| 9121 | packed.append('\x00' * 2) |
| 9122 | packed.append(struct.pack("!L", self.capabilities)) |
| 9123 | packed.append(struct.pack("!L", self.reserved)) |
| 9124 | length = sum([len(x) for x in packed]) |
| 9125 | packed[2] = struct.pack("!H", length) |
| 9126 | return ''.join(packed) |
| 9127 | |
| 9128 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9129 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9130 | obj = features_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9131 | _version = reader.read("!B")[0] |
| 9132 | assert(_version == 4) |
| 9133 | _type = reader.read("!B")[0] |
| 9134 | assert(_type == 6) |
| 9135 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9136 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 9137 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9138 | obj.xid = reader.read("!L")[0] |
| 9139 | obj.datapath_id = reader.read("!Q")[0] |
| 9140 | obj.n_buffers = reader.read("!L")[0] |
| 9141 | obj.n_tables = reader.read("!B")[0] |
| 9142 | obj.auxiliary_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9143 | reader.skip(2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9144 | obj.capabilities = reader.read("!L")[0] |
| 9145 | obj.reserved = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9146 | return obj |
| 9147 | |
| 9148 | def __eq__(self, other): |
| 9149 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9150 | if self.xid != other.xid: return False |
| 9151 | if self.datapath_id != other.datapath_id: return False |
| 9152 | if self.n_buffers != other.n_buffers: return False |
| 9153 | if self.n_tables != other.n_tables: return False |
| 9154 | if self.auxiliary_id != other.auxiliary_id: return False |
| 9155 | if self.capabilities != other.capabilities: return False |
| 9156 | if self.reserved != other.reserved: return False |
| 9157 | return True |
| 9158 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9159 | def pretty_print(self, q): |
| 9160 | q.text("features_reply {") |
| 9161 | with q.group(): |
| 9162 | with q.indent(2): |
| 9163 | q.breakable() |
| 9164 | q.text("xid = "); |
| 9165 | if self.xid != None: |
| 9166 | q.text("%#x" % self.xid) |
| 9167 | else: |
| 9168 | q.text('None') |
| 9169 | q.text(","); q.breakable() |
| 9170 | q.text("datapath_id = "); |
| 9171 | q.text("%#x" % self.datapath_id) |
| 9172 | q.text(","); q.breakable() |
| 9173 | q.text("n_buffers = "); |
| 9174 | q.text("%#x" % self.n_buffers) |
| 9175 | q.text(","); q.breakable() |
| 9176 | q.text("n_tables = "); |
| 9177 | q.text("%#x" % self.n_tables) |
| 9178 | q.text(","); q.breakable() |
| 9179 | q.text("auxiliary_id = "); |
| 9180 | q.text("%#x" % self.auxiliary_id) |
| 9181 | q.text(","); q.breakable() |
| 9182 | q.text("capabilities = "); |
| 9183 | q.text("%#x" % self.capabilities) |
| 9184 | q.text(","); q.breakable() |
| 9185 | q.text("reserved = "); |
| 9186 | q.text("%#x" % self.reserved) |
| 9187 | q.breakable() |
| 9188 | q.text('}') |
| 9189 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9190 | message.subtypes[6] = features_reply |
| 9191 | |
| 9192 | class features_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9193 | version = 4 |
| 9194 | type = 5 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9195 | |
| 9196 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9197 | if xid != None: |
| 9198 | self.xid = xid |
| 9199 | else: |
| 9200 | self.xid = None |
| 9201 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9202 | |
| 9203 | def pack(self): |
| 9204 | packed = [] |
| 9205 | packed.append(struct.pack("!B", self.version)) |
| 9206 | packed.append(struct.pack("!B", self.type)) |
| 9207 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9208 | packed.append(struct.pack("!L", self.xid)) |
| 9209 | length = sum([len(x) for x in packed]) |
| 9210 | packed[2] = struct.pack("!H", length) |
| 9211 | return ''.join(packed) |
| 9212 | |
| 9213 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9214 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9215 | obj = features_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9216 | _version = reader.read("!B")[0] |
| 9217 | assert(_version == 4) |
| 9218 | _type = reader.read("!B")[0] |
| 9219 | assert(_type == 5) |
| 9220 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9221 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 9222 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9223 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9224 | return obj |
| 9225 | |
| 9226 | def __eq__(self, other): |
| 9227 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9228 | if self.xid != other.xid: return False |
| 9229 | return True |
| 9230 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9231 | def pretty_print(self, q): |
| 9232 | q.text("features_request {") |
| 9233 | with q.group(): |
| 9234 | with q.indent(2): |
| 9235 | q.breakable() |
| 9236 | q.text("xid = "); |
| 9237 | if self.xid != None: |
| 9238 | q.text("%#x" % self.xid) |
| 9239 | else: |
| 9240 | q.text('None') |
| 9241 | q.breakable() |
| 9242 | q.text('}') |
| 9243 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9244 | message.subtypes[5] = features_request |
| 9245 | |
| 9246 | class flow_mod(message): |
| 9247 | subtypes = {} |
| 9248 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 9249 | version = 4 |
| 9250 | type = 14 |
| 9251 | |
| 9252 | 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): |
| 9253 | if xid != None: |
| 9254 | self.xid = xid |
| 9255 | else: |
| 9256 | self.xid = None |
| 9257 | if cookie != None: |
| 9258 | self.cookie = cookie |
| 9259 | else: |
| 9260 | self.cookie = 0 |
| 9261 | if cookie_mask != None: |
| 9262 | self.cookie_mask = cookie_mask |
| 9263 | else: |
| 9264 | self.cookie_mask = 0 |
| 9265 | if table_id != None: |
| 9266 | self.table_id = table_id |
| 9267 | else: |
| 9268 | self.table_id = 0 |
| 9269 | if _command != None: |
| 9270 | self._command = _command |
| 9271 | else: |
| 9272 | self._command = 0 |
| 9273 | if idle_timeout != None: |
| 9274 | self.idle_timeout = idle_timeout |
| 9275 | else: |
| 9276 | self.idle_timeout = 0 |
| 9277 | if hard_timeout != None: |
| 9278 | self.hard_timeout = hard_timeout |
| 9279 | else: |
| 9280 | self.hard_timeout = 0 |
| 9281 | if priority != None: |
| 9282 | self.priority = priority |
| 9283 | else: |
| 9284 | self.priority = 0 |
| 9285 | if buffer_id != None: |
| 9286 | self.buffer_id = buffer_id |
| 9287 | else: |
| 9288 | self.buffer_id = 0 |
| 9289 | if out_port != None: |
| 9290 | self.out_port = out_port |
| 9291 | else: |
| 9292 | self.out_port = 0 |
| 9293 | if out_group != None: |
| 9294 | self.out_group = out_group |
| 9295 | else: |
| 9296 | self.out_group = 0 |
| 9297 | if flags != None: |
| 9298 | self.flags = flags |
| 9299 | else: |
| 9300 | self.flags = 0 |
| 9301 | if match != None: |
| 9302 | self.match = match |
| 9303 | else: |
| 9304 | self.match = common.match() |
| 9305 | if instructions != None: |
| 9306 | self.instructions = instructions |
| 9307 | else: |
| 9308 | self.instructions = [] |
| 9309 | return |
| 9310 | |
| 9311 | def pack(self): |
| 9312 | packed = [] |
| 9313 | packed.append(struct.pack("!B", self.version)) |
| 9314 | packed.append(struct.pack("!B", self.type)) |
| 9315 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9316 | packed.append(struct.pack("!L", self.xid)) |
| 9317 | packed.append(struct.pack("!Q", self.cookie)) |
| 9318 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 9319 | packed.append(struct.pack("!B", self.table_id)) |
| 9320 | packed.append(util.pack_fm_cmd(self._command)) |
| 9321 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 9322 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 9323 | packed.append(struct.pack("!H", self.priority)) |
| 9324 | packed.append(struct.pack("!L", self.buffer_id)) |
| 9325 | packed.append(util.pack_port_no(self.out_port)) |
| 9326 | packed.append(struct.pack("!L", self.out_group)) |
| 9327 | packed.append(struct.pack("!H", self.flags)) |
| 9328 | packed.append('\x00' * 2) |
| 9329 | packed.append(self.match.pack()) |
| 9330 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
| 9331 | length = sum([len(x) for x in packed]) |
| 9332 | packed[2] = struct.pack("!H", length) |
| 9333 | return ''.join(packed) |
| 9334 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9335 | @staticmethod |
| 9336 | def unpack(reader): |
| 9337 | subtype, = reader.peek('B', 25) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 9338 | subclass = flow_mod.subtypes.get(subtype) |
| 9339 | if subclass: |
| 9340 | return subclass.unpack(reader) |
| 9341 | |
| 9342 | obj = flow_mod() |
| 9343 | _version = reader.read("!B")[0] |
| 9344 | assert(_version == 4) |
| 9345 | _type = reader.read("!B")[0] |
| 9346 | assert(_type == 14) |
| 9347 | _length = reader.read("!H")[0] |
| 9348 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 9349 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 9350 | obj.xid = reader.read("!L")[0] |
| 9351 | obj.cookie = reader.read("!Q")[0] |
| 9352 | obj.cookie_mask = reader.read("!Q")[0] |
| 9353 | obj.table_id = reader.read("!B")[0] |
| 9354 | obj._command = util.unpack_fm_cmd(reader) |
| 9355 | obj.idle_timeout = reader.read("!H")[0] |
| 9356 | obj.hard_timeout = reader.read("!H")[0] |
| 9357 | obj.priority = reader.read("!H")[0] |
| 9358 | obj.buffer_id = reader.read("!L")[0] |
| 9359 | obj.out_port = util.unpack_port_no(reader) |
| 9360 | obj.out_group = reader.read("!L")[0] |
| 9361 | obj.flags = reader.read("!H")[0] |
| 9362 | reader.skip(2) |
| 9363 | obj.match = common.match.unpack(reader) |
| 9364 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
| 9365 | return obj |
| 9366 | |
| 9367 | def __eq__(self, other): |
| 9368 | if type(self) != type(other): return False |
| 9369 | if self.xid != other.xid: return False |
| 9370 | if self.cookie != other.cookie: return False |
| 9371 | if self.cookie_mask != other.cookie_mask: return False |
| 9372 | if self.table_id != other.table_id: return False |
| 9373 | if self._command != other._command: return False |
| 9374 | if self.idle_timeout != other.idle_timeout: return False |
| 9375 | if self.hard_timeout != other.hard_timeout: return False |
| 9376 | if self.priority != other.priority: return False |
| 9377 | if self.buffer_id != other.buffer_id: return False |
| 9378 | if self.out_port != other.out_port: return False |
| 9379 | if self.out_group != other.out_group: return False |
| 9380 | if self.flags != other.flags: return False |
| 9381 | if self.match != other.match: return False |
| 9382 | if self.instructions != other.instructions: return False |
| 9383 | return True |
| 9384 | |
| 9385 | def pretty_print(self, q): |
| 9386 | q.text("flow_mod {") |
| 9387 | with q.group(): |
| 9388 | with q.indent(2): |
| 9389 | q.breakable() |
| 9390 | q.text("xid = "); |
| 9391 | if self.xid != None: |
| 9392 | q.text("%#x" % self.xid) |
| 9393 | else: |
| 9394 | q.text('None') |
| 9395 | q.text(","); q.breakable() |
| 9396 | q.text("cookie = "); |
| 9397 | q.text("%#x" % self.cookie) |
| 9398 | q.text(","); q.breakable() |
| 9399 | q.text("cookie_mask = "); |
| 9400 | q.text("%#x" % self.cookie_mask) |
| 9401 | q.text(","); q.breakable() |
| 9402 | q.text("table_id = "); |
| 9403 | q.text("%#x" % self.table_id) |
| 9404 | q.text(","); q.breakable() |
| 9405 | q.text("idle_timeout = "); |
| 9406 | q.text("%#x" % self.idle_timeout) |
| 9407 | q.text(","); q.breakable() |
| 9408 | q.text("hard_timeout = "); |
| 9409 | q.text("%#x" % self.hard_timeout) |
| 9410 | q.text(","); q.breakable() |
| 9411 | q.text("priority = "); |
| 9412 | q.text("%#x" % self.priority) |
| 9413 | q.text(","); q.breakable() |
| 9414 | q.text("buffer_id = "); |
| 9415 | q.text("%#x" % self.buffer_id) |
| 9416 | q.text(","); q.breakable() |
| 9417 | q.text("out_port = "); |
| 9418 | q.text(util.pretty_port(self.out_port)) |
| 9419 | q.text(","); q.breakable() |
| 9420 | q.text("out_group = "); |
| 9421 | q.text("%#x" % self.out_group) |
| 9422 | q.text(","); q.breakable() |
| 9423 | q.text("flags = "); |
| 9424 | q.text("%#x" % self.flags) |
| 9425 | q.text(","); q.breakable() |
| 9426 | q.text("match = "); |
| 9427 | q.pp(self.match) |
| 9428 | q.text(","); q.breakable() |
| 9429 | q.text("instructions = "); |
| 9430 | q.pp(self.instructions) |
| 9431 | q.breakable() |
| 9432 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9433 | |
| 9434 | message.subtypes[14] = flow_mod |
| 9435 | |
| 9436 | class flow_add(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9437 | version = 4 |
| 9438 | type = 14 |
| 9439 | _command = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9440 | |
| 9441 | 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] | 9442 | if xid != None: |
| 9443 | self.xid = xid |
| 9444 | else: |
| 9445 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9446 | if cookie != None: |
| 9447 | self.cookie = cookie |
| 9448 | else: |
| 9449 | self.cookie = 0 |
| 9450 | if cookie_mask != None: |
| 9451 | self.cookie_mask = cookie_mask |
| 9452 | else: |
| 9453 | self.cookie_mask = 0 |
| 9454 | if table_id != None: |
| 9455 | self.table_id = table_id |
| 9456 | else: |
| 9457 | self.table_id = 0 |
| 9458 | if idle_timeout != None: |
| 9459 | self.idle_timeout = idle_timeout |
| 9460 | else: |
| 9461 | self.idle_timeout = 0 |
| 9462 | if hard_timeout != None: |
| 9463 | self.hard_timeout = hard_timeout |
| 9464 | else: |
| 9465 | self.hard_timeout = 0 |
| 9466 | if priority != None: |
| 9467 | self.priority = priority |
| 9468 | else: |
| 9469 | self.priority = 0 |
| 9470 | if buffer_id != None: |
| 9471 | self.buffer_id = buffer_id |
| 9472 | else: |
| 9473 | self.buffer_id = 0 |
| 9474 | if out_port != None: |
| 9475 | self.out_port = out_port |
| 9476 | else: |
| 9477 | self.out_port = 0 |
| 9478 | if out_group != None: |
| 9479 | self.out_group = out_group |
| 9480 | else: |
| 9481 | self.out_group = 0 |
| 9482 | if flags != None: |
| 9483 | self.flags = flags |
| 9484 | else: |
| 9485 | self.flags = 0 |
| 9486 | if match != None: |
| 9487 | self.match = match |
| 9488 | else: |
| 9489 | self.match = common.match() |
| 9490 | if instructions != None: |
| 9491 | self.instructions = instructions |
| 9492 | else: |
| 9493 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9494 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9495 | |
| 9496 | def pack(self): |
| 9497 | packed = [] |
| 9498 | packed.append(struct.pack("!B", self.version)) |
| 9499 | packed.append(struct.pack("!B", self.type)) |
| 9500 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9501 | packed.append(struct.pack("!L", self.xid)) |
| 9502 | packed.append(struct.pack("!Q", self.cookie)) |
| 9503 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 9504 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9505 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9506 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 9507 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 9508 | packed.append(struct.pack("!H", self.priority)) |
| 9509 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9510 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9511 | packed.append(struct.pack("!L", self.out_group)) |
| 9512 | packed.append(struct.pack("!H", self.flags)) |
| 9513 | packed.append('\x00' * 2) |
| 9514 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9515 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9516 | length = sum([len(x) for x in packed]) |
| 9517 | packed[2] = struct.pack("!H", length) |
| 9518 | return ''.join(packed) |
| 9519 | |
| 9520 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9521 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9522 | obj = flow_add() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9523 | _version = reader.read("!B")[0] |
| 9524 | assert(_version == 4) |
| 9525 | _type = reader.read("!B")[0] |
| 9526 | assert(_type == 14) |
| 9527 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9528 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 9529 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9530 | obj.xid = reader.read("!L")[0] |
| 9531 | obj.cookie = reader.read("!Q")[0] |
| 9532 | obj.cookie_mask = reader.read("!Q")[0] |
| 9533 | obj.table_id = reader.read("!B")[0] |
| 9534 | __command = util.unpack_fm_cmd(reader) |
| 9535 | assert(__command == 0) |
| 9536 | obj.idle_timeout = reader.read("!H")[0] |
| 9537 | obj.hard_timeout = reader.read("!H")[0] |
| 9538 | obj.priority = reader.read("!H")[0] |
| 9539 | obj.buffer_id = reader.read("!L")[0] |
| 9540 | obj.out_port = util.unpack_port_no(reader) |
| 9541 | obj.out_group = reader.read("!L")[0] |
| 9542 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9543 | reader.skip(2) |
| 9544 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9545 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9546 | return obj |
| 9547 | |
| 9548 | def __eq__(self, other): |
| 9549 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9550 | if self.xid != other.xid: return False |
| 9551 | if self.cookie != other.cookie: return False |
| 9552 | if self.cookie_mask != other.cookie_mask: return False |
| 9553 | if self.table_id != other.table_id: return False |
| 9554 | if self.idle_timeout != other.idle_timeout: return False |
| 9555 | if self.hard_timeout != other.hard_timeout: return False |
| 9556 | if self.priority != other.priority: return False |
| 9557 | if self.buffer_id != other.buffer_id: return False |
| 9558 | if self.out_port != other.out_port: return False |
| 9559 | if self.out_group != other.out_group: return False |
| 9560 | if self.flags != other.flags: return False |
| 9561 | if self.match != other.match: return False |
| 9562 | if self.instructions != other.instructions: return False |
| 9563 | return True |
| 9564 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9565 | def pretty_print(self, q): |
| 9566 | q.text("flow_add {") |
| 9567 | with q.group(): |
| 9568 | with q.indent(2): |
| 9569 | q.breakable() |
| 9570 | q.text("xid = "); |
| 9571 | if self.xid != None: |
| 9572 | q.text("%#x" % self.xid) |
| 9573 | else: |
| 9574 | q.text('None') |
| 9575 | q.text(","); q.breakable() |
| 9576 | q.text("cookie = "); |
| 9577 | q.text("%#x" % self.cookie) |
| 9578 | q.text(","); q.breakable() |
| 9579 | q.text("cookie_mask = "); |
| 9580 | q.text("%#x" % self.cookie_mask) |
| 9581 | q.text(","); q.breakable() |
| 9582 | q.text("table_id = "); |
| 9583 | q.text("%#x" % self.table_id) |
| 9584 | q.text(","); q.breakable() |
| 9585 | q.text("idle_timeout = "); |
| 9586 | q.text("%#x" % self.idle_timeout) |
| 9587 | q.text(","); q.breakable() |
| 9588 | q.text("hard_timeout = "); |
| 9589 | q.text("%#x" % self.hard_timeout) |
| 9590 | q.text(","); q.breakable() |
| 9591 | q.text("priority = "); |
| 9592 | q.text("%#x" % self.priority) |
| 9593 | q.text(","); q.breakable() |
| 9594 | q.text("buffer_id = "); |
| 9595 | q.text("%#x" % self.buffer_id) |
| 9596 | q.text(","); q.breakable() |
| 9597 | q.text("out_port = "); |
| 9598 | q.text(util.pretty_port(self.out_port)) |
| 9599 | q.text(","); q.breakable() |
| 9600 | q.text("out_group = "); |
| 9601 | q.text("%#x" % self.out_group) |
| 9602 | q.text(","); q.breakable() |
| 9603 | q.text("flags = "); |
| 9604 | q.text("%#x" % self.flags) |
| 9605 | q.text(","); q.breakable() |
| 9606 | q.text("match = "); |
| 9607 | q.pp(self.match) |
| 9608 | q.text(","); q.breakable() |
| 9609 | q.text("instructions = "); |
| 9610 | q.pp(self.instructions) |
| 9611 | q.breakable() |
| 9612 | q.text('}') |
| 9613 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9614 | flow_mod.subtypes[0] = flow_add |
| 9615 | |
| 9616 | class flow_delete(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9617 | version = 4 |
| 9618 | type = 14 |
| 9619 | _command = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9620 | |
| 9621 | 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] | 9622 | if xid != None: |
| 9623 | self.xid = xid |
| 9624 | else: |
| 9625 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9626 | if cookie != None: |
| 9627 | self.cookie = cookie |
| 9628 | else: |
| 9629 | self.cookie = 0 |
| 9630 | if cookie_mask != None: |
| 9631 | self.cookie_mask = cookie_mask |
| 9632 | else: |
| 9633 | self.cookie_mask = 0 |
| 9634 | if table_id != None: |
| 9635 | self.table_id = table_id |
| 9636 | else: |
| 9637 | self.table_id = 0 |
| 9638 | if idle_timeout != None: |
| 9639 | self.idle_timeout = idle_timeout |
| 9640 | else: |
| 9641 | self.idle_timeout = 0 |
| 9642 | if hard_timeout != None: |
| 9643 | self.hard_timeout = hard_timeout |
| 9644 | else: |
| 9645 | self.hard_timeout = 0 |
| 9646 | if priority != None: |
| 9647 | self.priority = priority |
| 9648 | else: |
| 9649 | self.priority = 0 |
| 9650 | if buffer_id != None: |
| 9651 | self.buffer_id = buffer_id |
| 9652 | else: |
| 9653 | self.buffer_id = 0 |
| 9654 | if out_port != None: |
| 9655 | self.out_port = out_port |
| 9656 | else: |
| 9657 | self.out_port = 0 |
| 9658 | if out_group != None: |
| 9659 | self.out_group = out_group |
| 9660 | else: |
| 9661 | self.out_group = 0 |
| 9662 | if flags != None: |
| 9663 | self.flags = flags |
| 9664 | else: |
| 9665 | self.flags = 0 |
| 9666 | if match != None: |
| 9667 | self.match = match |
| 9668 | else: |
| 9669 | self.match = common.match() |
| 9670 | if instructions != None: |
| 9671 | self.instructions = instructions |
| 9672 | else: |
| 9673 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9674 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9675 | |
| 9676 | def pack(self): |
| 9677 | packed = [] |
| 9678 | packed.append(struct.pack("!B", self.version)) |
| 9679 | packed.append(struct.pack("!B", self.type)) |
| 9680 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9681 | packed.append(struct.pack("!L", self.xid)) |
| 9682 | packed.append(struct.pack("!Q", self.cookie)) |
| 9683 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 9684 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9685 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9686 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 9687 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 9688 | packed.append(struct.pack("!H", self.priority)) |
| 9689 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9690 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9691 | packed.append(struct.pack("!L", self.out_group)) |
| 9692 | packed.append(struct.pack("!H", self.flags)) |
| 9693 | packed.append('\x00' * 2) |
| 9694 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9695 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9696 | length = sum([len(x) for x in packed]) |
| 9697 | packed[2] = struct.pack("!H", length) |
| 9698 | return ''.join(packed) |
| 9699 | |
| 9700 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9701 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9702 | obj = flow_delete() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9703 | _version = reader.read("!B")[0] |
| 9704 | assert(_version == 4) |
| 9705 | _type = reader.read("!B")[0] |
| 9706 | assert(_type == 14) |
| 9707 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9708 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 9709 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9710 | obj.xid = reader.read("!L")[0] |
| 9711 | obj.cookie = reader.read("!Q")[0] |
| 9712 | obj.cookie_mask = reader.read("!Q")[0] |
| 9713 | obj.table_id = reader.read("!B")[0] |
| 9714 | __command = util.unpack_fm_cmd(reader) |
| 9715 | assert(__command == 3) |
| 9716 | obj.idle_timeout = reader.read("!H")[0] |
| 9717 | obj.hard_timeout = reader.read("!H")[0] |
| 9718 | obj.priority = reader.read("!H")[0] |
| 9719 | obj.buffer_id = reader.read("!L")[0] |
| 9720 | obj.out_port = util.unpack_port_no(reader) |
| 9721 | obj.out_group = reader.read("!L")[0] |
| 9722 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9723 | reader.skip(2) |
| 9724 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9725 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9726 | return obj |
| 9727 | |
| 9728 | def __eq__(self, other): |
| 9729 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9730 | if self.xid != other.xid: return False |
| 9731 | if self.cookie != other.cookie: return False |
| 9732 | if self.cookie_mask != other.cookie_mask: return False |
| 9733 | if self.table_id != other.table_id: return False |
| 9734 | if self.idle_timeout != other.idle_timeout: return False |
| 9735 | if self.hard_timeout != other.hard_timeout: return False |
| 9736 | if self.priority != other.priority: return False |
| 9737 | if self.buffer_id != other.buffer_id: return False |
| 9738 | if self.out_port != other.out_port: return False |
| 9739 | if self.out_group != other.out_group: return False |
| 9740 | if self.flags != other.flags: return False |
| 9741 | if self.match != other.match: return False |
| 9742 | if self.instructions != other.instructions: return False |
| 9743 | return True |
| 9744 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9745 | def pretty_print(self, q): |
| 9746 | q.text("flow_delete {") |
| 9747 | with q.group(): |
| 9748 | with q.indent(2): |
| 9749 | q.breakable() |
| 9750 | q.text("xid = "); |
| 9751 | if self.xid != None: |
| 9752 | q.text("%#x" % self.xid) |
| 9753 | else: |
| 9754 | q.text('None') |
| 9755 | q.text(","); q.breakable() |
| 9756 | q.text("cookie = "); |
| 9757 | q.text("%#x" % self.cookie) |
| 9758 | q.text(","); q.breakable() |
| 9759 | q.text("cookie_mask = "); |
| 9760 | q.text("%#x" % self.cookie_mask) |
| 9761 | q.text(","); q.breakable() |
| 9762 | q.text("table_id = "); |
| 9763 | q.text("%#x" % self.table_id) |
| 9764 | q.text(","); q.breakable() |
| 9765 | q.text("idle_timeout = "); |
| 9766 | q.text("%#x" % self.idle_timeout) |
| 9767 | q.text(","); q.breakable() |
| 9768 | q.text("hard_timeout = "); |
| 9769 | q.text("%#x" % self.hard_timeout) |
| 9770 | q.text(","); q.breakable() |
| 9771 | q.text("priority = "); |
| 9772 | q.text("%#x" % self.priority) |
| 9773 | q.text(","); q.breakable() |
| 9774 | q.text("buffer_id = "); |
| 9775 | q.text("%#x" % self.buffer_id) |
| 9776 | q.text(","); q.breakable() |
| 9777 | q.text("out_port = "); |
| 9778 | q.text(util.pretty_port(self.out_port)) |
| 9779 | q.text(","); q.breakable() |
| 9780 | q.text("out_group = "); |
| 9781 | q.text("%#x" % self.out_group) |
| 9782 | q.text(","); q.breakable() |
| 9783 | q.text("flags = "); |
| 9784 | q.text("%#x" % self.flags) |
| 9785 | q.text(","); q.breakable() |
| 9786 | q.text("match = "); |
| 9787 | q.pp(self.match) |
| 9788 | q.text(","); q.breakable() |
| 9789 | q.text("instructions = "); |
| 9790 | q.pp(self.instructions) |
| 9791 | q.breakable() |
| 9792 | q.text('}') |
| 9793 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9794 | flow_mod.subtypes[3] = flow_delete |
| 9795 | |
| 9796 | class flow_delete_strict(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9797 | version = 4 |
| 9798 | type = 14 |
| 9799 | _command = 4 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9800 | |
| 9801 | 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] | 9802 | if xid != None: |
| 9803 | self.xid = xid |
| 9804 | else: |
| 9805 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9806 | if cookie != None: |
| 9807 | self.cookie = cookie |
| 9808 | else: |
| 9809 | self.cookie = 0 |
| 9810 | if cookie_mask != None: |
| 9811 | self.cookie_mask = cookie_mask |
| 9812 | else: |
| 9813 | self.cookie_mask = 0 |
| 9814 | if table_id != None: |
| 9815 | self.table_id = table_id |
| 9816 | else: |
| 9817 | self.table_id = 0 |
| 9818 | if idle_timeout != None: |
| 9819 | self.idle_timeout = idle_timeout |
| 9820 | else: |
| 9821 | self.idle_timeout = 0 |
| 9822 | if hard_timeout != None: |
| 9823 | self.hard_timeout = hard_timeout |
| 9824 | else: |
| 9825 | self.hard_timeout = 0 |
| 9826 | if priority != None: |
| 9827 | self.priority = priority |
| 9828 | else: |
| 9829 | self.priority = 0 |
| 9830 | if buffer_id != None: |
| 9831 | self.buffer_id = buffer_id |
| 9832 | else: |
| 9833 | self.buffer_id = 0 |
| 9834 | if out_port != None: |
| 9835 | self.out_port = out_port |
| 9836 | else: |
| 9837 | self.out_port = 0 |
| 9838 | if out_group != None: |
| 9839 | self.out_group = out_group |
| 9840 | else: |
| 9841 | self.out_group = 0 |
| 9842 | if flags != None: |
| 9843 | self.flags = flags |
| 9844 | else: |
| 9845 | self.flags = 0 |
| 9846 | if match != None: |
| 9847 | self.match = match |
| 9848 | else: |
| 9849 | self.match = common.match() |
| 9850 | if instructions != None: |
| 9851 | self.instructions = instructions |
| 9852 | else: |
| 9853 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9854 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9855 | |
| 9856 | def pack(self): |
| 9857 | packed = [] |
| 9858 | packed.append(struct.pack("!B", self.version)) |
| 9859 | packed.append(struct.pack("!B", self.type)) |
| 9860 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9861 | packed.append(struct.pack("!L", self.xid)) |
| 9862 | packed.append(struct.pack("!Q", self.cookie)) |
| 9863 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 9864 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9865 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9866 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 9867 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 9868 | packed.append(struct.pack("!H", self.priority)) |
| 9869 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9870 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9871 | packed.append(struct.pack("!L", self.out_group)) |
| 9872 | packed.append(struct.pack("!H", self.flags)) |
| 9873 | packed.append('\x00' * 2) |
| 9874 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9875 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9876 | length = sum([len(x) for x in packed]) |
| 9877 | packed[2] = struct.pack("!H", length) |
| 9878 | return ''.join(packed) |
| 9879 | |
| 9880 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9881 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9882 | obj = flow_delete_strict() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9883 | _version = reader.read("!B")[0] |
| 9884 | assert(_version == 4) |
| 9885 | _type = reader.read("!B")[0] |
| 9886 | assert(_type == 14) |
| 9887 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9888 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 9889 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9890 | obj.xid = reader.read("!L")[0] |
| 9891 | obj.cookie = reader.read("!Q")[0] |
| 9892 | obj.cookie_mask = reader.read("!Q")[0] |
| 9893 | obj.table_id = reader.read("!B")[0] |
| 9894 | __command = util.unpack_fm_cmd(reader) |
| 9895 | assert(__command == 4) |
| 9896 | obj.idle_timeout = reader.read("!H")[0] |
| 9897 | obj.hard_timeout = reader.read("!H")[0] |
| 9898 | obj.priority = reader.read("!H")[0] |
| 9899 | obj.buffer_id = reader.read("!L")[0] |
| 9900 | obj.out_port = util.unpack_port_no(reader) |
| 9901 | obj.out_group = reader.read("!L")[0] |
| 9902 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9903 | reader.skip(2) |
| 9904 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9905 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9906 | return obj |
| 9907 | |
| 9908 | def __eq__(self, other): |
| 9909 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9910 | if self.xid != other.xid: return False |
| 9911 | if self.cookie != other.cookie: return False |
| 9912 | if self.cookie_mask != other.cookie_mask: return False |
| 9913 | if self.table_id != other.table_id: return False |
| 9914 | if self.idle_timeout != other.idle_timeout: return False |
| 9915 | if self.hard_timeout != other.hard_timeout: return False |
| 9916 | if self.priority != other.priority: return False |
| 9917 | if self.buffer_id != other.buffer_id: return False |
| 9918 | if self.out_port != other.out_port: return False |
| 9919 | if self.out_group != other.out_group: return False |
| 9920 | if self.flags != other.flags: return False |
| 9921 | if self.match != other.match: return False |
| 9922 | if self.instructions != other.instructions: return False |
| 9923 | return True |
| 9924 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9925 | def pretty_print(self, q): |
| 9926 | q.text("flow_delete_strict {") |
| 9927 | with q.group(): |
| 9928 | with q.indent(2): |
| 9929 | q.breakable() |
| 9930 | q.text("xid = "); |
| 9931 | if self.xid != None: |
| 9932 | q.text("%#x" % self.xid) |
| 9933 | else: |
| 9934 | q.text('None') |
| 9935 | q.text(","); q.breakable() |
| 9936 | q.text("cookie = "); |
| 9937 | q.text("%#x" % self.cookie) |
| 9938 | q.text(","); q.breakable() |
| 9939 | q.text("cookie_mask = "); |
| 9940 | q.text("%#x" % self.cookie_mask) |
| 9941 | q.text(","); q.breakable() |
| 9942 | q.text("table_id = "); |
| 9943 | q.text("%#x" % self.table_id) |
| 9944 | q.text(","); q.breakable() |
| 9945 | q.text("idle_timeout = "); |
| 9946 | q.text("%#x" % self.idle_timeout) |
| 9947 | q.text(","); q.breakable() |
| 9948 | q.text("hard_timeout = "); |
| 9949 | q.text("%#x" % self.hard_timeout) |
| 9950 | q.text(","); q.breakable() |
| 9951 | q.text("priority = "); |
| 9952 | q.text("%#x" % self.priority) |
| 9953 | q.text(","); q.breakable() |
| 9954 | q.text("buffer_id = "); |
| 9955 | q.text("%#x" % self.buffer_id) |
| 9956 | q.text(","); q.breakable() |
| 9957 | q.text("out_port = "); |
| 9958 | q.text(util.pretty_port(self.out_port)) |
| 9959 | q.text(","); q.breakable() |
| 9960 | q.text("out_group = "); |
| 9961 | q.text("%#x" % self.out_group) |
| 9962 | q.text(","); q.breakable() |
| 9963 | q.text("flags = "); |
| 9964 | q.text("%#x" % self.flags) |
| 9965 | q.text(","); q.breakable() |
| 9966 | q.text("match = "); |
| 9967 | q.pp(self.match) |
| 9968 | q.text(","); q.breakable() |
| 9969 | q.text("instructions = "); |
| 9970 | q.pp(self.instructions) |
| 9971 | q.breakable() |
| 9972 | q.text('}') |
| 9973 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9974 | flow_mod.subtypes[4] = flow_delete_strict |
| 9975 | |
| 9976 | class flow_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9977 | version = 4 |
| 9978 | type = 1 |
| 9979 | err_type = 5 |
| 9980 | |
| 9981 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9982 | if xid != None: |
| 9983 | self.xid = xid |
| 9984 | else: |
| 9985 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9986 | if code != None: |
| 9987 | self.code = code |
| 9988 | else: |
| 9989 | self.code = 0 |
| 9990 | if data != None: |
| 9991 | self.data = data |
| 9992 | else: |
| 9993 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9994 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9995 | |
| 9996 | def pack(self): |
| 9997 | packed = [] |
| 9998 | packed.append(struct.pack("!B", self.version)) |
| 9999 | packed.append(struct.pack("!B", self.type)) |
| 10000 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10001 | packed.append(struct.pack("!L", self.xid)) |
| 10002 | packed.append(struct.pack("!H", self.err_type)) |
| 10003 | packed.append(struct.pack("!H", self.code)) |
| 10004 | packed.append(self.data) |
| 10005 | length = sum([len(x) for x in packed]) |
| 10006 | packed[2] = struct.pack("!H", length) |
| 10007 | return ''.join(packed) |
| 10008 | |
| 10009 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10010 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10011 | obj = flow_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10012 | _version = reader.read("!B")[0] |
| 10013 | assert(_version == 4) |
| 10014 | _type = reader.read("!B")[0] |
| 10015 | assert(_type == 1) |
| 10016 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10017 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 10018 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10019 | obj.xid = reader.read("!L")[0] |
| 10020 | _err_type = reader.read("!H")[0] |
| 10021 | assert(_err_type == 5) |
| 10022 | obj.code = reader.read("!H")[0] |
| 10023 | obj.data = str(reader.read_all()) |
| 10024 | return obj |
| 10025 | |
| 10026 | def __eq__(self, other): |
| 10027 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10028 | if self.xid != other.xid: return False |
| 10029 | if self.code != other.code: return False |
| 10030 | if self.data != other.data: return False |
| 10031 | return True |
| 10032 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10033 | def pretty_print(self, q): |
| 10034 | q.text("flow_mod_failed_error_msg {") |
| 10035 | with q.group(): |
| 10036 | with q.indent(2): |
| 10037 | q.breakable() |
| 10038 | q.text("xid = "); |
| 10039 | if self.xid != None: |
| 10040 | q.text("%#x" % self.xid) |
| 10041 | else: |
| 10042 | q.text('None') |
| 10043 | q.text(","); q.breakable() |
| 10044 | q.text("code = "); |
| 10045 | q.text("%#x" % self.code) |
| 10046 | q.text(","); q.breakable() |
| 10047 | q.text("data = "); |
| 10048 | q.pp(self.data) |
| 10049 | q.breakable() |
| 10050 | q.text('}') |
| 10051 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10052 | error_msg.subtypes[5] = flow_mod_failed_error_msg |
| 10053 | |
| 10054 | class flow_modify(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10055 | version = 4 |
| 10056 | type = 14 |
| 10057 | _command = 1 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10058 | |
| 10059 | 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] | 10060 | if xid != None: |
| 10061 | self.xid = xid |
| 10062 | else: |
| 10063 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10064 | if cookie != None: |
| 10065 | self.cookie = cookie |
| 10066 | else: |
| 10067 | self.cookie = 0 |
| 10068 | if cookie_mask != None: |
| 10069 | self.cookie_mask = cookie_mask |
| 10070 | else: |
| 10071 | self.cookie_mask = 0 |
| 10072 | if table_id != None: |
| 10073 | self.table_id = table_id |
| 10074 | else: |
| 10075 | self.table_id = 0 |
| 10076 | if idle_timeout != None: |
| 10077 | self.idle_timeout = idle_timeout |
| 10078 | else: |
| 10079 | self.idle_timeout = 0 |
| 10080 | if hard_timeout != None: |
| 10081 | self.hard_timeout = hard_timeout |
| 10082 | else: |
| 10083 | self.hard_timeout = 0 |
| 10084 | if priority != None: |
| 10085 | self.priority = priority |
| 10086 | else: |
| 10087 | self.priority = 0 |
| 10088 | if buffer_id != None: |
| 10089 | self.buffer_id = buffer_id |
| 10090 | else: |
| 10091 | self.buffer_id = 0 |
| 10092 | if out_port != None: |
| 10093 | self.out_port = out_port |
| 10094 | else: |
| 10095 | self.out_port = 0 |
| 10096 | if out_group != None: |
| 10097 | self.out_group = out_group |
| 10098 | else: |
| 10099 | self.out_group = 0 |
| 10100 | if flags != None: |
| 10101 | self.flags = flags |
| 10102 | else: |
| 10103 | self.flags = 0 |
| 10104 | if match != None: |
| 10105 | self.match = match |
| 10106 | else: |
| 10107 | self.match = common.match() |
| 10108 | if instructions != None: |
| 10109 | self.instructions = instructions |
| 10110 | else: |
| 10111 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10112 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10113 | |
| 10114 | def pack(self): |
| 10115 | packed = [] |
| 10116 | packed.append(struct.pack("!B", self.version)) |
| 10117 | packed.append(struct.pack("!B", self.type)) |
| 10118 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10119 | packed.append(struct.pack("!L", self.xid)) |
| 10120 | packed.append(struct.pack("!Q", self.cookie)) |
| 10121 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 10122 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10123 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10124 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 10125 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 10126 | packed.append(struct.pack("!H", self.priority)) |
| 10127 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10128 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10129 | packed.append(struct.pack("!L", self.out_group)) |
| 10130 | packed.append(struct.pack("!H", self.flags)) |
| 10131 | packed.append('\x00' * 2) |
| 10132 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10133 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10134 | length = sum([len(x) for x in packed]) |
| 10135 | packed[2] = struct.pack("!H", length) |
| 10136 | return ''.join(packed) |
| 10137 | |
| 10138 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10139 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10140 | obj = flow_modify() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10141 | _version = reader.read("!B")[0] |
| 10142 | assert(_version == 4) |
| 10143 | _type = reader.read("!B")[0] |
| 10144 | assert(_type == 14) |
| 10145 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10146 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 10147 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10148 | obj.xid = reader.read("!L")[0] |
| 10149 | obj.cookie = reader.read("!Q")[0] |
| 10150 | obj.cookie_mask = reader.read("!Q")[0] |
| 10151 | obj.table_id = reader.read("!B")[0] |
| 10152 | __command = util.unpack_fm_cmd(reader) |
| 10153 | assert(__command == 1) |
| 10154 | obj.idle_timeout = reader.read("!H")[0] |
| 10155 | obj.hard_timeout = reader.read("!H")[0] |
| 10156 | obj.priority = reader.read("!H")[0] |
| 10157 | obj.buffer_id = reader.read("!L")[0] |
| 10158 | obj.out_port = util.unpack_port_no(reader) |
| 10159 | obj.out_group = reader.read("!L")[0] |
| 10160 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10161 | reader.skip(2) |
| 10162 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10163 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10164 | return obj |
| 10165 | |
| 10166 | def __eq__(self, other): |
| 10167 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10168 | if self.xid != other.xid: return False |
| 10169 | if self.cookie != other.cookie: return False |
| 10170 | if self.cookie_mask != other.cookie_mask: return False |
| 10171 | if self.table_id != other.table_id: return False |
| 10172 | if self.idle_timeout != other.idle_timeout: return False |
| 10173 | if self.hard_timeout != other.hard_timeout: return False |
| 10174 | if self.priority != other.priority: return False |
| 10175 | if self.buffer_id != other.buffer_id: return False |
| 10176 | if self.out_port != other.out_port: return False |
| 10177 | if self.out_group != other.out_group: return False |
| 10178 | if self.flags != other.flags: return False |
| 10179 | if self.match != other.match: return False |
| 10180 | if self.instructions != other.instructions: return False |
| 10181 | return True |
| 10182 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10183 | def pretty_print(self, q): |
| 10184 | q.text("flow_modify {") |
| 10185 | with q.group(): |
| 10186 | with q.indent(2): |
| 10187 | q.breakable() |
| 10188 | q.text("xid = "); |
| 10189 | if self.xid != None: |
| 10190 | q.text("%#x" % self.xid) |
| 10191 | else: |
| 10192 | q.text('None') |
| 10193 | q.text(","); q.breakable() |
| 10194 | q.text("cookie = "); |
| 10195 | q.text("%#x" % self.cookie) |
| 10196 | q.text(","); q.breakable() |
| 10197 | q.text("cookie_mask = "); |
| 10198 | q.text("%#x" % self.cookie_mask) |
| 10199 | q.text(","); q.breakable() |
| 10200 | q.text("table_id = "); |
| 10201 | q.text("%#x" % self.table_id) |
| 10202 | q.text(","); q.breakable() |
| 10203 | q.text("idle_timeout = "); |
| 10204 | q.text("%#x" % self.idle_timeout) |
| 10205 | q.text(","); q.breakable() |
| 10206 | q.text("hard_timeout = "); |
| 10207 | q.text("%#x" % self.hard_timeout) |
| 10208 | q.text(","); q.breakable() |
| 10209 | q.text("priority = "); |
| 10210 | q.text("%#x" % self.priority) |
| 10211 | q.text(","); q.breakable() |
| 10212 | q.text("buffer_id = "); |
| 10213 | q.text("%#x" % self.buffer_id) |
| 10214 | q.text(","); q.breakable() |
| 10215 | q.text("out_port = "); |
| 10216 | q.text(util.pretty_port(self.out_port)) |
| 10217 | q.text(","); q.breakable() |
| 10218 | q.text("out_group = "); |
| 10219 | q.text("%#x" % self.out_group) |
| 10220 | q.text(","); q.breakable() |
| 10221 | q.text("flags = "); |
| 10222 | q.text("%#x" % self.flags) |
| 10223 | q.text(","); q.breakable() |
| 10224 | q.text("match = "); |
| 10225 | q.pp(self.match) |
| 10226 | q.text(","); q.breakable() |
| 10227 | q.text("instructions = "); |
| 10228 | q.pp(self.instructions) |
| 10229 | q.breakable() |
| 10230 | q.text('}') |
| 10231 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10232 | flow_mod.subtypes[1] = flow_modify |
| 10233 | |
| 10234 | class flow_modify_strict(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10235 | version = 4 |
| 10236 | type = 14 |
| 10237 | _command = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10238 | |
| 10239 | 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] | 10240 | if xid != None: |
| 10241 | self.xid = xid |
| 10242 | else: |
| 10243 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10244 | if cookie != None: |
| 10245 | self.cookie = cookie |
| 10246 | else: |
| 10247 | self.cookie = 0 |
| 10248 | if cookie_mask != None: |
| 10249 | self.cookie_mask = cookie_mask |
| 10250 | else: |
| 10251 | self.cookie_mask = 0 |
| 10252 | if table_id != None: |
| 10253 | self.table_id = table_id |
| 10254 | else: |
| 10255 | self.table_id = 0 |
| 10256 | if idle_timeout != None: |
| 10257 | self.idle_timeout = idle_timeout |
| 10258 | else: |
| 10259 | self.idle_timeout = 0 |
| 10260 | if hard_timeout != None: |
| 10261 | self.hard_timeout = hard_timeout |
| 10262 | else: |
| 10263 | self.hard_timeout = 0 |
| 10264 | if priority != None: |
| 10265 | self.priority = priority |
| 10266 | else: |
| 10267 | self.priority = 0 |
| 10268 | if buffer_id != None: |
| 10269 | self.buffer_id = buffer_id |
| 10270 | else: |
| 10271 | self.buffer_id = 0 |
| 10272 | if out_port != None: |
| 10273 | self.out_port = out_port |
| 10274 | else: |
| 10275 | self.out_port = 0 |
| 10276 | if out_group != None: |
| 10277 | self.out_group = out_group |
| 10278 | else: |
| 10279 | self.out_group = 0 |
| 10280 | if flags != None: |
| 10281 | self.flags = flags |
| 10282 | else: |
| 10283 | self.flags = 0 |
| 10284 | if match != None: |
| 10285 | self.match = match |
| 10286 | else: |
| 10287 | self.match = common.match() |
| 10288 | if instructions != None: |
| 10289 | self.instructions = instructions |
| 10290 | else: |
| 10291 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10292 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10293 | |
| 10294 | def pack(self): |
| 10295 | packed = [] |
| 10296 | packed.append(struct.pack("!B", self.version)) |
| 10297 | packed.append(struct.pack("!B", self.type)) |
| 10298 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10299 | packed.append(struct.pack("!L", self.xid)) |
| 10300 | packed.append(struct.pack("!Q", self.cookie)) |
| 10301 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 10302 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10303 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10304 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 10305 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 10306 | packed.append(struct.pack("!H", self.priority)) |
| 10307 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10308 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10309 | packed.append(struct.pack("!L", self.out_group)) |
| 10310 | packed.append(struct.pack("!H", self.flags)) |
| 10311 | packed.append('\x00' * 2) |
| 10312 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10313 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10314 | length = sum([len(x) for x in packed]) |
| 10315 | packed[2] = struct.pack("!H", length) |
| 10316 | return ''.join(packed) |
| 10317 | |
| 10318 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10319 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10320 | obj = flow_modify_strict() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10321 | _version = reader.read("!B")[0] |
| 10322 | assert(_version == 4) |
| 10323 | _type = reader.read("!B")[0] |
| 10324 | assert(_type == 14) |
| 10325 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10326 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 10327 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10328 | obj.xid = reader.read("!L")[0] |
| 10329 | obj.cookie = reader.read("!Q")[0] |
| 10330 | obj.cookie_mask = reader.read("!Q")[0] |
| 10331 | obj.table_id = reader.read("!B")[0] |
| 10332 | __command = util.unpack_fm_cmd(reader) |
| 10333 | assert(__command == 2) |
| 10334 | obj.idle_timeout = reader.read("!H")[0] |
| 10335 | obj.hard_timeout = reader.read("!H")[0] |
| 10336 | obj.priority = reader.read("!H")[0] |
| 10337 | obj.buffer_id = reader.read("!L")[0] |
| 10338 | obj.out_port = util.unpack_port_no(reader) |
| 10339 | obj.out_group = reader.read("!L")[0] |
| 10340 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10341 | reader.skip(2) |
| 10342 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10343 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10344 | return obj |
| 10345 | |
| 10346 | def __eq__(self, other): |
| 10347 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10348 | if self.xid != other.xid: return False |
| 10349 | if self.cookie != other.cookie: return False |
| 10350 | if self.cookie_mask != other.cookie_mask: return False |
| 10351 | if self.table_id != other.table_id: return False |
| 10352 | if self.idle_timeout != other.idle_timeout: return False |
| 10353 | if self.hard_timeout != other.hard_timeout: return False |
| 10354 | if self.priority != other.priority: return False |
| 10355 | if self.buffer_id != other.buffer_id: return False |
| 10356 | if self.out_port != other.out_port: return False |
| 10357 | if self.out_group != other.out_group: return False |
| 10358 | if self.flags != other.flags: return False |
| 10359 | if self.match != other.match: return False |
| 10360 | if self.instructions != other.instructions: return False |
| 10361 | return True |
| 10362 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10363 | def pretty_print(self, q): |
| 10364 | q.text("flow_modify_strict {") |
| 10365 | with q.group(): |
| 10366 | with q.indent(2): |
| 10367 | q.breakable() |
| 10368 | q.text("xid = "); |
| 10369 | if self.xid != None: |
| 10370 | q.text("%#x" % self.xid) |
| 10371 | else: |
| 10372 | q.text('None') |
| 10373 | q.text(","); q.breakable() |
| 10374 | q.text("cookie = "); |
| 10375 | q.text("%#x" % self.cookie) |
| 10376 | q.text(","); q.breakable() |
| 10377 | q.text("cookie_mask = "); |
| 10378 | q.text("%#x" % self.cookie_mask) |
| 10379 | q.text(","); q.breakable() |
| 10380 | q.text("table_id = "); |
| 10381 | q.text("%#x" % self.table_id) |
| 10382 | q.text(","); q.breakable() |
| 10383 | q.text("idle_timeout = "); |
| 10384 | q.text("%#x" % self.idle_timeout) |
| 10385 | q.text(","); q.breakable() |
| 10386 | q.text("hard_timeout = "); |
| 10387 | q.text("%#x" % self.hard_timeout) |
| 10388 | q.text(","); q.breakable() |
| 10389 | q.text("priority = "); |
| 10390 | q.text("%#x" % self.priority) |
| 10391 | q.text(","); q.breakable() |
| 10392 | q.text("buffer_id = "); |
| 10393 | q.text("%#x" % self.buffer_id) |
| 10394 | q.text(","); q.breakable() |
| 10395 | q.text("out_port = "); |
| 10396 | q.text(util.pretty_port(self.out_port)) |
| 10397 | q.text(","); q.breakable() |
| 10398 | q.text("out_group = "); |
| 10399 | q.text("%#x" % self.out_group) |
| 10400 | q.text(","); q.breakable() |
| 10401 | q.text("flags = "); |
| 10402 | q.text("%#x" % self.flags) |
| 10403 | q.text(","); q.breakable() |
| 10404 | q.text("match = "); |
| 10405 | q.pp(self.match) |
| 10406 | q.text(","); q.breakable() |
| 10407 | q.text("instructions = "); |
| 10408 | q.pp(self.instructions) |
| 10409 | q.breakable() |
| 10410 | q.text('}') |
| 10411 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10412 | flow_mod.subtypes[2] = flow_modify_strict |
| 10413 | |
| 10414 | class flow_removed(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10415 | version = 4 |
| 10416 | type = 11 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10417 | |
| 10418 | 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] | 10419 | if xid != None: |
| 10420 | self.xid = xid |
| 10421 | else: |
| 10422 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10423 | if cookie != None: |
| 10424 | self.cookie = cookie |
| 10425 | else: |
| 10426 | self.cookie = 0 |
| 10427 | if priority != None: |
| 10428 | self.priority = priority |
| 10429 | else: |
| 10430 | self.priority = 0 |
| 10431 | if reason != None: |
| 10432 | self.reason = reason |
| 10433 | else: |
| 10434 | self.reason = 0 |
| 10435 | if table_id != None: |
| 10436 | self.table_id = table_id |
| 10437 | else: |
| 10438 | self.table_id = 0 |
| 10439 | if duration_sec != None: |
| 10440 | self.duration_sec = duration_sec |
| 10441 | else: |
| 10442 | self.duration_sec = 0 |
| 10443 | if duration_nsec != None: |
| 10444 | self.duration_nsec = duration_nsec |
| 10445 | else: |
| 10446 | self.duration_nsec = 0 |
| 10447 | if idle_timeout != None: |
| 10448 | self.idle_timeout = idle_timeout |
| 10449 | else: |
| 10450 | self.idle_timeout = 0 |
| 10451 | if hard_timeout != None: |
| 10452 | self.hard_timeout = hard_timeout |
| 10453 | else: |
| 10454 | self.hard_timeout = 0 |
| 10455 | if packet_count != None: |
| 10456 | self.packet_count = packet_count |
| 10457 | else: |
| 10458 | self.packet_count = 0 |
| 10459 | if byte_count != None: |
| 10460 | self.byte_count = byte_count |
| 10461 | else: |
| 10462 | self.byte_count = 0 |
| 10463 | if match != None: |
| 10464 | self.match = match |
| 10465 | else: |
| 10466 | self.match = common.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10467 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10468 | |
| 10469 | def pack(self): |
| 10470 | packed = [] |
| 10471 | packed.append(struct.pack("!B", self.version)) |
| 10472 | packed.append(struct.pack("!B", self.type)) |
| 10473 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10474 | packed.append(struct.pack("!L", self.xid)) |
| 10475 | packed.append(struct.pack("!Q", self.cookie)) |
| 10476 | packed.append(struct.pack("!H", self.priority)) |
| 10477 | packed.append(struct.pack("!B", self.reason)) |
| 10478 | packed.append(struct.pack("!B", self.table_id)) |
| 10479 | packed.append(struct.pack("!L", self.duration_sec)) |
| 10480 | packed.append(struct.pack("!L", self.duration_nsec)) |
| 10481 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 10482 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 10483 | packed.append(struct.pack("!Q", self.packet_count)) |
| 10484 | packed.append(struct.pack("!Q", self.byte_count)) |
| 10485 | packed.append(self.match.pack()) |
| 10486 | length = sum([len(x) for x in packed]) |
| 10487 | packed[2] = struct.pack("!H", length) |
| 10488 | return ''.join(packed) |
| 10489 | |
| 10490 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10491 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10492 | obj = flow_removed() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10493 | _version = reader.read("!B")[0] |
| 10494 | assert(_version == 4) |
| 10495 | _type = reader.read("!B")[0] |
| 10496 | assert(_type == 11) |
| 10497 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10498 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 10499 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10500 | obj.xid = reader.read("!L")[0] |
| 10501 | obj.cookie = reader.read("!Q")[0] |
| 10502 | obj.priority = reader.read("!H")[0] |
| 10503 | obj.reason = reader.read("!B")[0] |
| 10504 | obj.table_id = reader.read("!B")[0] |
| 10505 | obj.duration_sec = reader.read("!L")[0] |
| 10506 | obj.duration_nsec = reader.read("!L")[0] |
| 10507 | obj.idle_timeout = reader.read("!H")[0] |
| 10508 | obj.hard_timeout = reader.read("!H")[0] |
| 10509 | obj.packet_count = reader.read("!Q")[0] |
| 10510 | obj.byte_count = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10511 | obj.match = common.match.unpack(reader) |
| 10512 | return obj |
| 10513 | |
| 10514 | def __eq__(self, other): |
| 10515 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10516 | if self.xid != other.xid: return False |
| 10517 | if self.cookie != other.cookie: return False |
| 10518 | if self.priority != other.priority: return False |
| 10519 | if self.reason != other.reason: return False |
| 10520 | if self.table_id != other.table_id: return False |
| 10521 | if self.duration_sec != other.duration_sec: return False |
| 10522 | if self.duration_nsec != other.duration_nsec: return False |
| 10523 | if self.idle_timeout != other.idle_timeout: return False |
| 10524 | if self.hard_timeout != other.hard_timeout: return False |
| 10525 | if self.packet_count != other.packet_count: return False |
| 10526 | if self.byte_count != other.byte_count: return False |
| 10527 | if self.match != other.match: return False |
| 10528 | return True |
| 10529 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10530 | def pretty_print(self, q): |
| 10531 | q.text("flow_removed {") |
| 10532 | with q.group(): |
| 10533 | with q.indent(2): |
| 10534 | q.breakable() |
| 10535 | q.text("xid = "); |
| 10536 | if self.xid != None: |
| 10537 | q.text("%#x" % self.xid) |
| 10538 | else: |
| 10539 | q.text('None') |
| 10540 | q.text(","); q.breakable() |
| 10541 | q.text("cookie = "); |
| 10542 | q.text("%#x" % self.cookie) |
| 10543 | q.text(","); q.breakable() |
| 10544 | q.text("priority = "); |
| 10545 | q.text("%#x" % self.priority) |
| 10546 | q.text(","); q.breakable() |
| 10547 | q.text("reason = "); |
| 10548 | q.text("%#x" % self.reason) |
| 10549 | q.text(","); q.breakable() |
| 10550 | q.text("table_id = "); |
| 10551 | q.text("%#x" % self.table_id) |
| 10552 | q.text(","); q.breakable() |
| 10553 | q.text("duration_sec = "); |
| 10554 | q.text("%#x" % self.duration_sec) |
| 10555 | q.text(","); q.breakable() |
| 10556 | q.text("duration_nsec = "); |
| 10557 | q.text("%#x" % self.duration_nsec) |
| 10558 | q.text(","); q.breakable() |
| 10559 | q.text("idle_timeout = "); |
| 10560 | q.text("%#x" % self.idle_timeout) |
| 10561 | q.text(","); q.breakable() |
| 10562 | q.text("hard_timeout = "); |
| 10563 | q.text("%#x" % self.hard_timeout) |
| 10564 | q.text(","); q.breakable() |
| 10565 | q.text("packet_count = "); |
| 10566 | q.text("%#x" % self.packet_count) |
| 10567 | q.text(","); q.breakable() |
| 10568 | q.text("byte_count = "); |
| 10569 | q.text("%#x" % self.byte_count) |
| 10570 | q.text(","); q.breakable() |
| 10571 | q.text("match = "); |
| 10572 | q.pp(self.match) |
| 10573 | q.breakable() |
| 10574 | q.text('}') |
| 10575 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10576 | message.subtypes[11] = flow_removed |
| 10577 | |
| 10578 | class flow_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10579 | version = 4 |
| 10580 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10581 | stats_type = 1 |
| 10582 | |
| 10583 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10584 | if xid != None: |
| 10585 | self.xid = xid |
| 10586 | else: |
| 10587 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10588 | if flags != None: |
| 10589 | self.flags = flags |
| 10590 | else: |
| 10591 | self.flags = 0 |
| 10592 | if entries != None: |
| 10593 | self.entries = entries |
| 10594 | else: |
| 10595 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10596 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10597 | |
| 10598 | def pack(self): |
| 10599 | packed = [] |
| 10600 | packed.append(struct.pack("!B", self.version)) |
| 10601 | packed.append(struct.pack("!B", self.type)) |
| 10602 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10603 | packed.append(struct.pack("!L", self.xid)) |
| 10604 | packed.append(struct.pack("!H", self.stats_type)) |
| 10605 | packed.append(struct.pack("!H", self.flags)) |
| 10606 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10607 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10608 | length = sum([len(x) for x in packed]) |
| 10609 | packed[2] = struct.pack("!H", length) |
| 10610 | return ''.join(packed) |
| 10611 | |
| 10612 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10613 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10614 | obj = flow_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10615 | _version = reader.read("!B")[0] |
| 10616 | assert(_version == 4) |
| 10617 | _type = reader.read("!B")[0] |
| 10618 | assert(_type == 19) |
| 10619 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10620 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 10621 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10622 | obj.xid = reader.read("!L")[0] |
| 10623 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10624 | assert(_stats_type == 1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10625 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10626 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10627 | 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] | 10628 | return obj |
| 10629 | |
| 10630 | def __eq__(self, other): |
| 10631 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10632 | if self.xid != other.xid: return False |
| 10633 | if self.flags != other.flags: return False |
| 10634 | if self.entries != other.entries: return False |
| 10635 | return True |
| 10636 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10637 | def pretty_print(self, q): |
| 10638 | q.text("flow_stats_reply {") |
| 10639 | with q.group(): |
| 10640 | with q.indent(2): |
| 10641 | q.breakable() |
| 10642 | q.text("xid = "); |
| 10643 | if self.xid != None: |
| 10644 | q.text("%#x" % self.xid) |
| 10645 | else: |
| 10646 | q.text('None') |
| 10647 | q.text(","); q.breakable() |
| 10648 | q.text("flags = "); |
| 10649 | q.text("%#x" % self.flags) |
| 10650 | q.text(","); q.breakable() |
| 10651 | q.text("entries = "); |
| 10652 | q.pp(self.entries) |
| 10653 | q.breakable() |
| 10654 | q.text('}') |
| 10655 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10656 | stats_reply.subtypes[1] = flow_stats_reply |
| 10657 | |
| 10658 | class flow_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10659 | version = 4 |
| 10660 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10661 | stats_type = 1 |
| 10662 | |
| 10663 | 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] | 10664 | if xid != None: |
| 10665 | self.xid = xid |
| 10666 | else: |
| 10667 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10668 | if flags != None: |
| 10669 | self.flags = flags |
| 10670 | else: |
| 10671 | self.flags = 0 |
| 10672 | if table_id != None: |
| 10673 | self.table_id = table_id |
| 10674 | else: |
| 10675 | self.table_id = 0 |
| 10676 | if out_port != None: |
| 10677 | self.out_port = out_port |
| 10678 | else: |
| 10679 | self.out_port = 0 |
| 10680 | if out_group != None: |
| 10681 | self.out_group = out_group |
| 10682 | else: |
| 10683 | self.out_group = 0 |
| 10684 | if cookie != None: |
| 10685 | self.cookie = cookie |
| 10686 | else: |
| 10687 | self.cookie = 0 |
| 10688 | if cookie_mask != None: |
| 10689 | self.cookie_mask = cookie_mask |
| 10690 | else: |
| 10691 | self.cookie_mask = 0 |
| 10692 | if match != None: |
| 10693 | self.match = match |
| 10694 | else: |
| 10695 | self.match = common.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10696 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10697 | |
| 10698 | def pack(self): |
| 10699 | packed = [] |
| 10700 | packed.append(struct.pack("!B", self.version)) |
| 10701 | packed.append(struct.pack("!B", self.type)) |
| 10702 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10703 | packed.append(struct.pack("!L", self.xid)) |
| 10704 | packed.append(struct.pack("!H", self.stats_type)) |
| 10705 | packed.append(struct.pack("!H", self.flags)) |
| 10706 | packed.append('\x00' * 4) |
| 10707 | packed.append(struct.pack("!B", self.table_id)) |
| 10708 | packed.append('\x00' * 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10709 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10710 | packed.append(struct.pack("!L", self.out_group)) |
| 10711 | packed.append('\x00' * 4) |
| 10712 | packed.append(struct.pack("!Q", self.cookie)) |
| 10713 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 10714 | packed.append(self.match.pack()) |
| 10715 | length = sum([len(x) for x in packed]) |
| 10716 | packed[2] = struct.pack("!H", length) |
| 10717 | return ''.join(packed) |
| 10718 | |
| 10719 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10720 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10721 | obj = flow_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10722 | _version = reader.read("!B")[0] |
| 10723 | assert(_version == 4) |
| 10724 | _type = reader.read("!B")[0] |
| 10725 | assert(_type == 18) |
| 10726 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10727 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 10728 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10729 | obj.xid = reader.read("!L")[0] |
| 10730 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10731 | assert(_stats_type == 1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10732 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10733 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10734 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10735 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10736 | obj.out_port = util.unpack_port_no(reader) |
| 10737 | obj.out_group = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10738 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10739 | obj.cookie = reader.read("!Q")[0] |
| 10740 | obj.cookie_mask = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10741 | obj.match = common.match.unpack(reader) |
| 10742 | return obj |
| 10743 | |
| 10744 | def __eq__(self, other): |
| 10745 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10746 | if self.xid != other.xid: return False |
| 10747 | if self.flags != other.flags: return False |
| 10748 | if self.table_id != other.table_id: return False |
| 10749 | if self.out_port != other.out_port: return False |
| 10750 | if self.out_group != other.out_group: return False |
| 10751 | if self.cookie != other.cookie: return False |
| 10752 | if self.cookie_mask != other.cookie_mask: return False |
| 10753 | if self.match != other.match: return False |
| 10754 | return True |
| 10755 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10756 | def pretty_print(self, q): |
| 10757 | q.text("flow_stats_request {") |
| 10758 | with q.group(): |
| 10759 | with q.indent(2): |
| 10760 | q.breakable() |
| 10761 | q.text("xid = "); |
| 10762 | if self.xid != None: |
| 10763 | q.text("%#x" % self.xid) |
| 10764 | else: |
| 10765 | q.text('None') |
| 10766 | q.text(","); q.breakable() |
| 10767 | q.text("flags = "); |
| 10768 | q.text("%#x" % self.flags) |
| 10769 | q.text(","); q.breakable() |
| 10770 | q.text("table_id = "); |
| 10771 | q.text("%#x" % self.table_id) |
| 10772 | q.text(","); q.breakable() |
| 10773 | q.text("out_port = "); |
| 10774 | q.text(util.pretty_port(self.out_port)) |
| 10775 | q.text(","); q.breakable() |
| 10776 | q.text("out_group = "); |
| 10777 | q.text("%#x" % self.out_group) |
| 10778 | q.text(","); q.breakable() |
| 10779 | q.text("cookie = "); |
| 10780 | q.text("%#x" % self.cookie) |
| 10781 | q.text(","); q.breakable() |
| 10782 | q.text("cookie_mask = "); |
| 10783 | q.text("%#x" % self.cookie_mask) |
| 10784 | q.text(","); q.breakable() |
| 10785 | q.text("match = "); |
| 10786 | q.pp(self.match) |
| 10787 | q.breakable() |
| 10788 | q.text('}') |
| 10789 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10790 | stats_request.subtypes[1] = flow_stats_request |
| 10791 | |
| 10792 | class get_config_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10793 | version = 4 |
| 10794 | type = 8 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10795 | |
| 10796 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10797 | if xid != None: |
| 10798 | self.xid = xid |
| 10799 | else: |
| 10800 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10801 | if flags != None: |
| 10802 | self.flags = flags |
| 10803 | else: |
| 10804 | self.flags = 0 |
| 10805 | if miss_send_len != None: |
| 10806 | self.miss_send_len = miss_send_len |
| 10807 | else: |
| 10808 | self.miss_send_len = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10809 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10810 | |
| 10811 | def pack(self): |
| 10812 | packed = [] |
| 10813 | packed.append(struct.pack("!B", self.version)) |
| 10814 | packed.append(struct.pack("!B", self.type)) |
| 10815 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10816 | packed.append(struct.pack("!L", self.xid)) |
| 10817 | packed.append(struct.pack("!H", self.flags)) |
| 10818 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 10819 | length = sum([len(x) for x in packed]) |
| 10820 | packed[2] = struct.pack("!H", length) |
| 10821 | return ''.join(packed) |
| 10822 | |
| 10823 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10824 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10825 | obj = get_config_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10826 | _version = reader.read("!B")[0] |
| 10827 | assert(_version == 4) |
| 10828 | _type = reader.read("!B")[0] |
| 10829 | assert(_type == 8) |
| 10830 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10831 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 10832 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10833 | obj.xid = reader.read("!L")[0] |
| 10834 | obj.flags = reader.read("!H")[0] |
| 10835 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10836 | return obj |
| 10837 | |
| 10838 | def __eq__(self, other): |
| 10839 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10840 | if self.xid != other.xid: return False |
| 10841 | if self.flags != other.flags: return False |
| 10842 | if self.miss_send_len != other.miss_send_len: return False |
| 10843 | return True |
| 10844 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10845 | def pretty_print(self, q): |
| 10846 | q.text("get_config_reply {") |
| 10847 | with q.group(): |
| 10848 | with q.indent(2): |
| 10849 | q.breakable() |
| 10850 | q.text("xid = "); |
| 10851 | if self.xid != None: |
| 10852 | q.text("%#x" % self.xid) |
| 10853 | else: |
| 10854 | q.text('None') |
| 10855 | q.text(","); q.breakable() |
| 10856 | q.text("flags = "); |
| 10857 | q.text("%#x" % self.flags) |
| 10858 | q.text(","); q.breakable() |
| 10859 | q.text("miss_send_len = "); |
| 10860 | q.text("%#x" % self.miss_send_len) |
| 10861 | q.breakable() |
| 10862 | q.text('}') |
| 10863 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10864 | message.subtypes[8] = get_config_reply |
| 10865 | |
| 10866 | class get_config_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10867 | version = 4 |
| 10868 | type = 7 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10869 | |
| 10870 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10871 | if xid != None: |
| 10872 | self.xid = xid |
| 10873 | else: |
| 10874 | self.xid = None |
| 10875 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10876 | |
| 10877 | def pack(self): |
| 10878 | packed = [] |
| 10879 | packed.append(struct.pack("!B", self.version)) |
| 10880 | packed.append(struct.pack("!B", self.type)) |
| 10881 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10882 | packed.append(struct.pack("!L", self.xid)) |
| 10883 | length = sum([len(x) for x in packed]) |
| 10884 | packed[2] = struct.pack("!H", length) |
| 10885 | return ''.join(packed) |
| 10886 | |
| 10887 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10888 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10889 | obj = get_config_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10890 | _version = reader.read("!B")[0] |
| 10891 | assert(_version == 4) |
| 10892 | _type = reader.read("!B")[0] |
| 10893 | assert(_type == 7) |
| 10894 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10895 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 10896 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10897 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10898 | return obj |
| 10899 | |
| 10900 | def __eq__(self, other): |
| 10901 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10902 | if self.xid != other.xid: return False |
| 10903 | return True |
| 10904 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10905 | def pretty_print(self, q): |
| 10906 | q.text("get_config_request {") |
| 10907 | with q.group(): |
| 10908 | with q.indent(2): |
| 10909 | q.breakable() |
| 10910 | q.text("xid = "); |
| 10911 | if self.xid != None: |
| 10912 | q.text("%#x" % self.xid) |
| 10913 | else: |
| 10914 | q.text('None') |
| 10915 | q.breakable() |
| 10916 | q.text('}') |
| 10917 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10918 | message.subtypes[7] = get_config_request |
| 10919 | |
| 10920 | class group_mod(message): |
| 10921 | subtypes = {} |
| 10922 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 10923 | version = 4 |
| 10924 | type = 15 |
| 10925 | |
| 10926 | def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None): |
| 10927 | if xid != None: |
| 10928 | self.xid = xid |
| 10929 | else: |
| 10930 | self.xid = None |
| 10931 | if command != None: |
| 10932 | self.command = command |
| 10933 | else: |
| 10934 | self.command = 0 |
| 10935 | if group_type != None: |
| 10936 | self.group_type = group_type |
| 10937 | else: |
| 10938 | self.group_type = 0 |
| 10939 | if group_id != None: |
| 10940 | self.group_id = group_id |
| 10941 | else: |
| 10942 | self.group_id = 0 |
| 10943 | if buckets != None: |
| 10944 | self.buckets = buckets |
| 10945 | else: |
| 10946 | self.buckets = [] |
| 10947 | return |
| 10948 | |
| 10949 | def pack(self): |
| 10950 | packed = [] |
| 10951 | packed.append(struct.pack("!B", self.version)) |
| 10952 | packed.append(struct.pack("!B", self.type)) |
| 10953 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10954 | packed.append(struct.pack("!L", self.xid)) |
| 10955 | packed.append(struct.pack("!H", self.command)) |
| 10956 | packed.append(struct.pack("!B", self.group_type)) |
| 10957 | packed.append('\x00' * 1) |
| 10958 | packed.append(struct.pack("!L", self.group_id)) |
| 10959 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
| 10960 | length = sum([len(x) for x in packed]) |
| 10961 | packed[2] = struct.pack("!H", length) |
| 10962 | return ''.join(packed) |
| 10963 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10964 | @staticmethod |
| 10965 | def unpack(reader): |
| 10966 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 10967 | subclass = group_mod.subtypes.get(subtype) |
| 10968 | if subclass: |
| 10969 | return subclass.unpack(reader) |
| 10970 | |
| 10971 | obj = group_mod() |
| 10972 | _version = reader.read("!B")[0] |
| 10973 | assert(_version == 4) |
| 10974 | _type = reader.read("!B")[0] |
| 10975 | assert(_type == 15) |
| 10976 | _length = reader.read("!H")[0] |
| 10977 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 10978 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 10979 | obj.xid = reader.read("!L")[0] |
| 10980 | obj.command = reader.read("!H")[0] |
| 10981 | obj.group_type = reader.read("!B")[0] |
| 10982 | reader.skip(1) |
| 10983 | obj.group_id = reader.read("!L")[0] |
| 10984 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
| 10985 | return obj |
| 10986 | |
| 10987 | def __eq__(self, other): |
| 10988 | if type(self) != type(other): return False |
| 10989 | if self.xid != other.xid: return False |
| 10990 | if self.command != other.command: return False |
| 10991 | if self.group_type != other.group_type: return False |
| 10992 | if self.group_id != other.group_id: return False |
| 10993 | if self.buckets != other.buckets: return False |
| 10994 | return True |
| 10995 | |
| 10996 | def pretty_print(self, q): |
| 10997 | q.text("group_mod {") |
| 10998 | with q.group(): |
| 10999 | with q.indent(2): |
| 11000 | q.breakable() |
| 11001 | q.text("xid = "); |
| 11002 | if self.xid != None: |
| 11003 | q.text("%#x" % self.xid) |
| 11004 | else: |
| 11005 | q.text('None') |
| 11006 | q.text(","); q.breakable() |
| 11007 | q.text("group_type = "); |
| 11008 | q.text("%#x" % self.group_type) |
| 11009 | q.text(","); q.breakable() |
| 11010 | q.text("group_id = "); |
| 11011 | q.text("%#x" % self.group_id) |
| 11012 | q.text(","); q.breakable() |
| 11013 | q.text("buckets = "); |
| 11014 | q.pp(self.buckets) |
| 11015 | q.breakable() |
| 11016 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11017 | |
| 11018 | message.subtypes[15] = group_mod |
| 11019 | |
| 11020 | class group_add(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11021 | version = 4 |
| 11022 | type = 15 |
| 11023 | command = 0 |
| 11024 | |
| 11025 | 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] | 11026 | if xid != None: |
| 11027 | self.xid = xid |
| 11028 | else: |
| 11029 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11030 | if group_type != None: |
| 11031 | self.group_type = group_type |
| 11032 | else: |
| 11033 | self.group_type = 0 |
| 11034 | if group_id != None: |
| 11035 | self.group_id = group_id |
| 11036 | else: |
| 11037 | self.group_id = 0 |
| 11038 | if buckets != None: |
| 11039 | self.buckets = buckets |
| 11040 | else: |
| 11041 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11042 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11043 | |
| 11044 | def pack(self): |
| 11045 | packed = [] |
| 11046 | packed.append(struct.pack("!B", self.version)) |
| 11047 | packed.append(struct.pack("!B", self.type)) |
| 11048 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11049 | packed.append(struct.pack("!L", self.xid)) |
| 11050 | packed.append(struct.pack("!H", self.command)) |
| 11051 | packed.append(struct.pack("!B", self.group_type)) |
| 11052 | packed.append('\x00' * 1) |
| 11053 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11054 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11055 | length = sum([len(x) for x in packed]) |
| 11056 | packed[2] = struct.pack("!H", length) |
| 11057 | return ''.join(packed) |
| 11058 | |
| 11059 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11060 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11061 | obj = group_add() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11062 | _version = reader.read("!B")[0] |
| 11063 | assert(_version == 4) |
| 11064 | _type = reader.read("!B")[0] |
| 11065 | assert(_type == 15) |
| 11066 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11067 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 11068 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11069 | obj.xid = reader.read("!L")[0] |
| 11070 | _command = reader.read("!H")[0] |
| 11071 | assert(_command == 0) |
| 11072 | obj.group_type = reader.read("!B")[0] |
| 11073 | reader.skip(1) |
| 11074 | obj.group_id = reader.read("!L")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11075 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11076 | return obj |
| 11077 | |
| 11078 | def __eq__(self, other): |
| 11079 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11080 | if self.xid != other.xid: return False |
| 11081 | if self.group_type != other.group_type: return False |
| 11082 | if self.group_id != other.group_id: return False |
| 11083 | if self.buckets != other.buckets: return False |
| 11084 | return True |
| 11085 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11086 | def pretty_print(self, q): |
| 11087 | q.text("group_add {") |
| 11088 | with q.group(): |
| 11089 | with q.indent(2): |
| 11090 | q.breakable() |
| 11091 | q.text("xid = "); |
| 11092 | if self.xid != None: |
| 11093 | q.text("%#x" % self.xid) |
| 11094 | else: |
| 11095 | q.text('None') |
| 11096 | q.text(","); q.breakable() |
| 11097 | q.text("group_type = "); |
| 11098 | q.text("%#x" % self.group_type) |
| 11099 | q.text(","); q.breakable() |
| 11100 | q.text("group_id = "); |
| 11101 | q.text("%#x" % self.group_id) |
| 11102 | q.text(","); q.breakable() |
| 11103 | q.text("buckets = "); |
| 11104 | q.pp(self.buckets) |
| 11105 | q.breakable() |
| 11106 | q.text('}') |
| 11107 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11108 | group_mod.subtypes[0] = group_add |
| 11109 | |
| 11110 | class group_delete(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11111 | version = 4 |
| 11112 | type = 15 |
| 11113 | command = 2 |
| 11114 | |
| 11115 | 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] | 11116 | if xid != None: |
| 11117 | self.xid = xid |
| 11118 | else: |
| 11119 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11120 | if group_type != None: |
| 11121 | self.group_type = group_type |
| 11122 | else: |
| 11123 | self.group_type = 0 |
| 11124 | if group_id != None: |
| 11125 | self.group_id = group_id |
| 11126 | else: |
| 11127 | self.group_id = 0 |
| 11128 | if buckets != None: |
| 11129 | self.buckets = buckets |
| 11130 | else: |
| 11131 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11132 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11133 | |
| 11134 | def pack(self): |
| 11135 | packed = [] |
| 11136 | packed.append(struct.pack("!B", self.version)) |
| 11137 | packed.append(struct.pack("!B", self.type)) |
| 11138 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11139 | packed.append(struct.pack("!L", self.xid)) |
| 11140 | packed.append(struct.pack("!H", self.command)) |
| 11141 | packed.append(struct.pack("!B", self.group_type)) |
| 11142 | packed.append('\x00' * 1) |
| 11143 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11144 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11145 | length = sum([len(x) for x in packed]) |
| 11146 | packed[2] = struct.pack("!H", length) |
| 11147 | return ''.join(packed) |
| 11148 | |
| 11149 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11150 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11151 | obj = group_delete() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11152 | _version = reader.read("!B")[0] |
| 11153 | assert(_version == 4) |
| 11154 | _type = reader.read("!B")[0] |
| 11155 | assert(_type == 15) |
| 11156 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11157 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 11158 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11159 | obj.xid = reader.read("!L")[0] |
| 11160 | _command = reader.read("!H")[0] |
| 11161 | assert(_command == 2) |
| 11162 | obj.group_type = reader.read("!B")[0] |
| 11163 | reader.skip(1) |
| 11164 | obj.group_id = reader.read("!L")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11165 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11166 | return obj |
| 11167 | |
| 11168 | def __eq__(self, other): |
| 11169 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11170 | if self.xid != other.xid: return False |
| 11171 | if self.group_type != other.group_type: return False |
| 11172 | if self.group_id != other.group_id: return False |
| 11173 | if self.buckets != other.buckets: return False |
| 11174 | return True |
| 11175 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11176 | def pretty_print(self, q): |
| 11177 | q.text("group_delete {") |
| 11178 | with q.group(): |
| 11179 | with q.indent(2): |
| 11180 | q.breakable() |
| 11181 | q.text("xid = "); |
| 11182 | if self.xid != None: |
| 11183 | q.text("%#x" % self.xid) |
| 11184 | else: |
| 11185 | q.text('None') |
| 11186 | q.text(","); q.breakable() |
| 11187 | q.text("group_type = "); |
| 11188 | q.text("%#x" % self.group_type) |
| 11189 | q.text(","); q.breakable() |
| 11190 | q.text("group_id = "); |
| 11191 | q.text("%#x" % self.group_id) |
| 11192 | q.text(","); q.breakable() |
| 11193 | q.text("buckets = "); |
| 11194 | q.pp(self.buckets) |
| 11195 | q.breakable() |
| 11196 | q.text('}') |
| 11197 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11198 | group_mod.subtypes[2] = group_delete |
| 11199 | |
| 11200 | class group_desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11201 | version = 4 |
| 11202 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11203 | stats_type = 7 |
| 11204 | |
| 11205 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11206 | if xid != None: |
| 11207 | self.xid = xid |
| 11208 | else: |
| 11209 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11210 | if flags != None: |
| 11211 | self.flags = flags |
| 11212 | else: |
| 11213 | self.flags = 0 |
| 11214 | if entries != None: |
| 11215 | self.entries = entries |
| 11216 | else: |
| 11217 | self.entries = [] |
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) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11229 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11230 | length = sum([len(x) for x in packed]) |
| 11231 | packed[2] = struct.pack("!H", length) |
| 11232 | return ''.join(packed) |
| 11233 | |
| 11234 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11235 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11236 | obj = group_desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11237 | _version = reader.read("!B")[0] |
| 11238 | assert(_version == 4) |
| 11239 | _type = reader.read("!B")[0] |
| 11240 | assert(_type == 19) |
| 11241 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11242 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 11243 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11244 | obj.xid = reader.read("!L")[0] |
| 11245 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11246 | assert(_stats_type == 7) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11247 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11248 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11249 | 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] | 11250 | return obj |
| 11251 | |
| 11252 | def __eq__(self, other): |
| 11253 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11254 | if self.xid != other.xid: return False |
| 11255 | if self.flags != other.flags: return False |
| 11256 | if self.entries != other.entries: return False |
| 11257 | return True |
| 11258 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11259 | def pretty_print(self, q): |
| 11260 | q.text("group_desc_stats_reply {") |
| 11261 | with q.group(): |
| 11262 | with q.indent(2): |
| 11263 | q.breakable() |
| 11264 | q.text("xid = "); |
| 11265 | if self.xid != None: |
| 11266 | q.text("%#x" % self.xid) |
| 11267 | else: |
| 11268 | q.text('None') |
| 11269 | q.text(","); q.breakable() |
| 11270 | q.text("flags = "); |
| 11271 | q.text("%#x" % self.flags) |
| 11272 | q.text(","); q.breakable() |
| 11273 | q.text("entries = "); |
| 11274 | q.pp(self.entries) |
| 11275 | q.breakable() |
| 11276 | q.text('}') |
| 11277 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11278 | stats_reply.subtypes[7] = group_desc_stats_reply |
| 11279 | |
| 11280 | class group_desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11281 | version = 4 |
| 11282 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11283 | stats_type = 7 |
| 11284 | |
| 11285 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11286 | if xid != None: |
| 11287 | self.xid = xid |
| 11288 | else: |
| 11289 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11290 | if flags != None: |
| 11291 | self.flags = flags |
| 11292 | else: |
| 11293 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11294 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11295 | |
| 11296 | def pack(self): |
| 11297 | packed = [] |
| 11298 | packed.append(struct.pack("!B", self.version)) |
| 11299 | packed.append(struct.pack("!B", self.type)) |
| 11300 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11301 | packed.append(struct.pack("!L", self.xid)) |
| 11302 | packed.append(struct.pack("!H", self.stats_type)) |
| 11303 | packed.append(struct.pack("!H", self.flags)) |
| 11304 | packed.append('\x00' * 4) |
| 11305 | length = sum([len(x) for x in packed]) |
| 11306 | packed[2] = struct.pack("!H", length) |
| 11307 | return ''.join(packed) |
| 11308 | |
| 11309 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11310 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11311 | obj = group_desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11312 | _version = reader.read("!B")[0] |
| 11313 | assert(_version == 4) |
| 11314 | _type = reader.read("!B")[0] |
| 11315 | assert(_type == 18) |
| 11316 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11317 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 11318 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11319 | obj.xid = reader.read("!L")[0] |
| 11320 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11321 | assert(_stats_type == 7) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11322 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11323 | reader.skip(4) |
| 11324 | return obj |
| 11325 | |
| 11326 | def __eq__(self, other): |
| 11327 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11328 | if self.xid != other.xid: return False |
| 11329 | if self.flags != other.flags: return False |
| 11330 | return True |
| 11331 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11332 | def pretty_print(self, q): |
| 11333 | q.text("group_desc_stats_request {") |
| 11334 | with q.group(): |
| 11335 | with q.indent(2): |
| 11336 | q.breakable() |
| 11337 | q.text("xid = "); |
| 11338 | if self.xid != None: |
| 11339 | q.text("%#x" % self.xid) |
| 11340 | else: |
| 11341 | q.text('None') |
| 11342 | q.text(","); q.breakable() |
| 11343 | q.text("flags = "); |
| 11344 | q.text("%#x" % self.flags) |
| 11345 | q.breakable() |
| 11346 | q.text('}') |
| 11347 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11348 | stats_request.subtypes[7] = group_desc_stats_request |
| 11349 | |
| 11350 | class group_features_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11351 | version = 4 |
| 11352 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11353 | stats_type = 8 |
| 11354 | |
| 11355 | 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] | 11356 | if xid != None: |
| 11357 | self.xid = xid |
| 11358 | else: |
| 11359 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11360 | if flags != None: |
| 11361 | self.flags = flags |
| 11362 | else: |
| 11363 | self.flags = 0 |
| 11364 | if types != None: |
| 11365 | self.types = types |
| 11366 | else: |
| 11367 | self.types = 0 |
| 11368 | if capabilities != None: |
| 11369 | self.capabilities = capabilities |
| 11370 | else: |
| 11371 | self.capabilities = 0 |
| 11372 | if max_groups_all != None: |
| 11373 | self.max_groups_all = max_groups_all |
| 11374 | else: |
| 11375 | self.max_groups_all = 0 |
| 11376 | if max_groups_select != None: |
| 11377 | self.max_groups_select = max_groups_select |
| 11378 | else: |
| 11379 | self.max_groups_select = 0 |
| 11380 | if max_groups_indirect != None: |
| 11381 | self.max_groups_indirect = max_groups_indirect |
| 11382 | else: |
| 11383 | self.max_groups_indirect = 0 |
| 11384 | if max_groups_ff != None: |
| 11385 | self.max_groups_ff = max_groups_ff |
| 11386 | else: |
| 11387 | self.max_groups_ff = 0 |
| 11388 | if actions_all != None: |
| 11389 | self.actions_all = actions_all |
| 11390 | else: |
| 11391 | self.actions_all = 0 |
| 11392 | if actions_select != None: |
| 11393 | self.actions_select = actions_select |
| 11394 | else: |
| 11395 | self.actions_select = 0 |
| 11396 | if actions_indirect != None: |
| 11397 | self.actions_indirect = actions_indirect |
| 11398 | else: |
| 11399 | self.actions_indirect = 0 |
| 11400 | if actions_ff != None: |
| 11401 | self.actions_ff = actions_ff |
| 11402 | else: |
| 11403 | self.actions_ff = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11404 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11405 | |
| 11406 | def pack(self): |
| 11407 | packed = [] |
| 11408 | packed.append(struct.pack("!B", self.version)) |
| 11409 | packed.append(struct.pack("!B", self.type)) |
| 11410 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11411 | packed.append(struct.pack("!L", self.xid)) |
| 11412 | packed.append(struct.pack("!H", self.stats_type)) |
| 11413 | packed.append(struct.pack("!H", self.flags)) |
| 11414 | packed.append('\x00' * 4) |
| 11415 | packed.append(struct.pack("!L", self.types)) |
| 11416 | packed.append(struct.pack("!L", self.capabilities)) |
| 11417 | packed.append(struct.pack("!L", self.max_groups_all)) |
| 11418 | packed.append(struct.pack("!L", self.max_groups_select)) |
| 11419 | packed.append(struct.pack("!L", self.max_groups_indirect)) |
| 11420 | packed.append(struct.pack("!L", self.max_groups_ff)) |
| 11421 | packed.append(struct.pack("!L", self.actions_all)) |
| 11422 | packed.append(struct.pack("!L", self.actions_select)) |
| 11423 | packed.append(struct.pack("!L", self.actions_indirect)) |
| 11424 | packed.append(struct.pack("!L", self.actions_ff)) |
| 11425 | length = sum([len(x) for x in packed]) |
| 11426 | packed[2] = struct.pack("!H", length) |
| 11427 | return ''.join(packed) |
| 11428 | |
| 11429 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11430 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11431 | obj = group_features_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11432 | _version = reader.read("!B")[0] |
| 11433 | assert(_version == 4) |
| 11434 | _type = reader.read("!B")[0] |
| 11435 | assert(_type == 19) |
| 11436 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11437 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 11438 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11439 | obj.xid = reader.read("!L")[0] |
| 11440 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11441 | assert(_stats_type == 8) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11442 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11443 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11444 | obj.types = reader.read("!L")[0] |
| 11445 | obj.capabilities = reader.read("!L")[0] |
| 11446 | obj.max_groups_all = reader.read("!L")[0] |
| 11447 | obj.max_groups_select = reader.read("!L")[0] |
| 11448 | obj.max_groups_indirect = reader.read("!L")[0] |
| 11449 | obj.max_groups_ff = reader.read("!L")[0] |
| 11450 | obj.actions_all = reader.read("!L")[0] |
| 11451 | obj.actions_select = reader.read("!L")[0] |
| 11452 | obj.actions_indirect = reader.read("!L")[0] |
| 11453 | obj.actions_ff = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11454 | return obj |
| 11455 | |
| 11456 | def __eq__(self, other): |
| 11457 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11458 | if self.xid != other.xid: return False |
| 11459 | if self.flags != other.flags: return False |
| 11460 | if self.types != other.types: return False |
| 11461 | if self.capabilities != other.capabilities: return False |
| 11462 | if self.max_groups_all != other.max_groups_all: return False |
| 11463 | if self.max_groups_select != other.max_groups_select: return False |
| 11464 | if self.max_groups_indirect != other.max_groups_indirect: return False |
| 11465 | if self.max_groups_ff != other.max_groups_ff: return False |
| 11466 | if self.actions_all != other.actions_all: return False |
| 11467 | if self.actions_select != other.actions_select: return False |
| 11468 | if self.actions_indirect != other.actions_indirect: return False |
| 11469 | if self.actions_ff != other.actions_ff: return False |
| 11470 | return True |
| 11471 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11472 | def pretty_print(self, q): |
| 11473 | q.text("group_features_stats_reply {") |
| 11474 | with q.group(): |
| 11475 | with q.indent(2): |
| 11476 | q.breakable() |
| 11477 | q.text("xid = "); |
| 11478 | if self.xid != None: |
| 11479 | q.text("%#x" % self.xid) |
| 11480 | else: |
| 11481 | q.text('None') |
| 11482 | q.text(","); q.breakable() |
| 11483 | q.text("flags = "); |
| 11484 | q.text("%#x" % self.flags) |
| 11485 | q.text(","); q.breakable() |
| 11486 | q.text("types = "); |
| 11487 | q.text("%#x" % self.types) |
| 11488 | q.text(","); q.breakable() |
| 11489 | q.text("capabilities = "); |
| 11490 | q.text("%#x" % self.capabilities) |
| 11491 | q.text(","); q.breakable() |
| 11492 | q.text("max_groups_all = "); |
| 11493 | q.text("%#x" % self.max_groups_all) |
| 11494 | q.text(","); q.breakable() |
| 11495 | q.text("max_groups_select = "); |
| 11496 | q.text("%#x" % self.max_groups_select) |
| 11497 | q.text(","); q.breakable() |
| 11498 | q.text("max_groups_indirect = "); |
| 11499 | q.text("%#x" % self.max_groups_indirect) |
| 11500 | q.text(","); q.breakable() |
| 11501 | q.text("max_groups_ff = "); |
| 11502 | q.text("%#x" % self.max_groups_ff) |
| 11503 | q.text(","); q.breakable() |
| 11504 | q.text("actions_all = "); |
| 11505 | q.text("%#x" % self.actions_all) |
| 11506 | q.text(","); q.breakable() |
| 11507 | q.text("actions_select = "); |
| 11508 | q.text("%#x" % self.actions_select) |
| 11509 | q.text(","); q.breakable() |
| 11510 | q.text("actions_indirect = "); |
| 11511 | q.text("%#x" % self.actions_indirect) |
| 11512 | q.text(","); q.breakable() |
| 11513 | q.text("actions_ff = "); |
| 11514 | q.text("%#x" % self.actions_ff) |
| 11515 | q.breakable() |
| 11516 | q.text('}') |
| 11517 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11518 | stats_reply.subtypes[8] = group_features_stats_reply |
| 11519 | |
| 11520 | class group_features_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11521 | version = 4 |
| 11522 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11523 | stats_type = 8 |
| 11524 | |
| 11525 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11526 | if xid != None: |
| 11527 | self.xid = xid |
| 11528 | else: |
| 11529 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11530 | if flags != None: |
| 11531 | self.flags = flags |
| 11532 | else: |
| 11533 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11534 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11535 | |
| 11536 | def pack(self): |
| 11537 | packed = [] |
| 11538 | packed.append(struct.pack("!B", self.version)) |
| 11539 | packed.append(struct.pack("!B", self.type)) |
| 11540 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11541 | packed.append(struct.pack("!L", self.xid)) |
| 11542 | packed.append(struct.pack("!H", self.stats_type)) |
| 11543 | packed.append(struct.pack("!H", self.flags)) |
| 11544 | packed.append('\x00' * 4) |
| 11545 | length = sum([len(x) for x in packed]) |
| 11546 | packed[2] = struct.pack("!H", length) |
| 11547 | return ''.join(packed) |
| 11548 | |
| 11549 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11550 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11551 | obj = group_features_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11552 | _version = reader.read("!B")[0] |
| 11553 | assert(_version == 4) |
| 11554 | _type = reader.read("!B")[0] |
| 11555 | assert(_type == 18) |
| 11556 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11557 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 11558 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11559 | obj.xid = reader.read("!L")[0] |
| 11560 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11561 | assert(_stats_type == 8) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11562 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11563 | reader.skip(4) |
| 11564 | return obj |
| 11565 | |
| 11566 | def __eq__(self, other): |
| 11567 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11568 | if self.xid != other.xid: return False |
| 11569 | if self.flags != other.flags: return False |
| 11570 | return True |
| 11571 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11572 | def pretty_print(self, q): |
| 11573 | q.text("group_features_stats_request {") |
| 11574 | with q.group(): |
| 11575 | with q.indent(2): |
| 11576 | q.breakable() |
| 11577 | q.text("xid = "); |
| 11578 | if self.xid != None: |
| 11579 | q.text("%#x" % self.xid) |
| 11580 | else: |
| 11581 | q.text('None') |
| 11582 | q.text(","); q.breakable() |
| 11583 | q.text("flags = "); |
| 11584 | q.text("%#x" % self.flags) |
| 11585 | q.breakable() |
| 11586 | q.text('}') |
| 11587 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11588 | stats_request.subtypes[8] = group_features_stats_request |
| 11589 | |
| 11590 | class group_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11591 | version = 4 |
| 11592 | type = 1 |
| 11593 | err_type = 6 |
| 11594 | |
| 11595 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11596 | if xid != None: |
| 11597 | self.xid = xid |
| 11598 | else: |
| 11599 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11600 | if code != None: |
| 11601 | self.code = code |
| 11602 | else: |
| 11603 | self.code = 0 |
| 11604 | if data != None: |
| 11605 | self.data = data |
| 11606 | else: |
| 11607 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11608 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11609 | |
| 11610 | def pack(self): |
| 11611 | packed = [] |
| 11612 | packed.append(struct.pack("!B", self.version)) |
| 11613 | packed.append(struct.pack("!B", self.type)) |
| 11614 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11615 | packed.append(struct.pack("!L", self.xid)) |
| 11616 | packed.append(struct.pack("!H", self.err_type)) |
| 11617 | packed.append(struct.pack("!H", self.code)) |
| 11618 | packed.append(self.data) |
| 11619 | length = sum([len(x) for x in packed]) |
| 11620 | packed[2] = struct.pack("!H", length) |
| 11621 | return ''.join(packed) |
| 11622 | |
| 11623 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11624 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11625 | obj = group_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11626 | _version = reader.read("!B")[0] |
| 11627 | assert(_version == 4) |
| 11628 | _type = reader.read("!B")[0] |
| 11629 | assert(_type == 1) |
| 11630 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11631 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 11632 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11633 | obj.xid = reader.read("!L")[0] |
| 11634 | _err_type = reader.read("!H")[0] |
| 11635 | assert(_err_type == 6) |
| 11636 | obj.code = reader.read("!H")[0] |
| 11637 | obj.data = str(reader.read_all()) |
| 11638 | return obj |
| 11639 | |
| 11640 | def __eq__(self, other): |
| 11641 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11642 | if self.xid != other.xid: return False |
| 11643 | if self.code != other.code: return False |
| 11644 | if self.data != other.data: return False |
| 11645 | return True |
| 11646 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11647 | def pretty_print(self, q): |
| 11648 | q.text("group_mod_failed_error_msg {") |
| 11649 | with q.group(): |
| 11650 | with q.indent(2): |
| 11651 | q.breakable() |
| 11652 | q.text("xid = "); |
| 11653 | if self.xid != None: |
| 11654 | q.text("%#x" % self.xid) |
| 11655 | else: |
| 11656 | q.text('None') |
| 11657 | q.text(","); q.breakable() |
| 11658 | q.text("code = "); |
| 11659 | q.text("%#x" % self.code) |
| 11660 | q.text(","); q.breakable() |
| 11661 | q.text("data = "); |
| 11662 | q.pp(self.data) |
| 11663 | q.breakable() |
| 11664 | q.text('}') |
| 11665 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11666 | error_msg.subtypes[6] = group_mod_failed_error_msg |
| 11667 | |
| 11668 | class group_modify(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11669 | version = 4 |
| 11670 | type = 15 |
| 11671 | command = 1 |
| 11672 | |
| 11673 | 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] | 11674 | if xid != None: |
| 11675 | self.xid = xid |
| 11676 | else: |
| 11677 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11678 | if group_type != None: |
| 11679 | self.group_type = group_type |
| 11680 | else: |
| 11681 | self.group_type = 0 |
| 11682 | if group_id != None: |
| 11683 | self.group_id = group_id |
| 11684 | else: |
| 11685 | self.group_id = 0 |
| 11686 | if buckets != None: |
| 11687 | self.buckets = buckets |
| 11688 | else: |
| 11689 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11690 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11691 | |
| 11692 | def pack(self): |
| 11693 | packed = [] |
| 11694 | packed.append(struct.pack("!B", self.version)) |
| 11695 | packed.append(struct.pack("!B", self.type)) |
| 11696 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11697 | packed.append(struct.pack("!L", self.xid)) |
| 11698 | packed.append(struct.pack("!H", self.command)) |
| 11699 | packed.append(struct.pack("!B", self.group_type)) |
| 11700 | packed.append('\x00' * 1) |
| 11701 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11702 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11703 | length = sum([len(x) for x in packed]) |
| 11704 | packed[2] = struct.pack("!H", length) |
| 11705 | return ''.join(packed) |
| 11706 | |
| 11707 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11708 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11709 | obj = group_modify() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11710 | _version = reader.read("!B")[0] |
| 11711 | assert(_version == 4) |
| 11712 | _type = reader.read("!B")[0] |
| 11713 | assert(_type == 15) |
| 11714 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11715 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 11716 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11717 | obj.xid = reader.read("!L")[0] |
| 11718 | _command = reader.read("!H")[0] |
| 11719 | assert(_command == 1) |
| 11720 | obj.group_type = reader.read("!B")[0] |
| 11721 | reader.skip(1) |
| 11722 | obj.group_id = reader.read("!L")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11723 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11724 | return obj |
| 11725 | |
| 11726 | def __eq__(self, other): |
| 11727 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11728 | if self.xid != other.xid: return False |
| 11729 | if self.group_type != other.group_type: return False |
| 11730 | if self.group_id != other.group_id: return False |
| 11731 | if self.buckets != other.buckets: return False |
| 11732 | return True |
| 11733 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11734 | def pretty_print(self, q): |
| 11735 | q.text("group_modify {") |
| 11736 | with q.group(): |
| 11737 | with q.indent(2): |
| 11738 | q.breakable() |
| 11739 | q.text("xid = "); |
| 11740 | if self.xid != None: |
| 11741 | q.text("%#x" % self.xid) |
| 11742 | else: |
| 11743 | q.text('None') |
| 11744 | q.text(","); q.breakable() |
| 11745 | q.text("group_type = "); |
| 11746 | q.text("%#x" % self.group_type) |
| 11747 | q.text(","); q.breakable() |
| 11748 | q.text("group_id = "); |
| 11749 | q.text("%#x" % self.group_id) |
| 11750 | q.text(","); q.breakable() |
| 11751 | q.text("buckets = "); |
| 11752 | q.pp(self.buckets) |
| 11753 | q.breakable() |
| 11754 | q.text('}') |
| 11755 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11756 | group_mod.subtypes[1] = group_modify |
| 11757 | |
| 11758 | class group_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11759 | version = 4 |
| 11760 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11761 | stats_type = 6 |
| 11762 | |
| 11763 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11764 | if xid != None: |
| 11765 | self.xid = xid |
| 11766 | else: |
| 11767 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11768 | if flags != None: |
| 11769 | self.flags = flags |
| 11770 | else: |
| 11771 | self.flags = 0 |
| 11772 | if entries != None: |
| 11773 | self.entries = entries |
| 11774 | else: |
| 11775 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11776 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11777 | |
| 11778 | def pack(self): |
| 11779 | packed = [] |
| 11780 | packed.append(struct.pack("!B", self.version)) |
| 11781 | packed.append(struct.pack("!B", self.type)) |
| 11782 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11783 | packed.append(struct.pack("!L", self.xid)) |
| 11784 | packed.append(struct.pack("!H", self.stats_type)) |
| 11785 | packed.append(struct.pack("!H", self.flags)) |
| 11786 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11787 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11788 | length = sum([len(x) for x in packed]) |
| 11789 | packed[2] = struct.pack("!H", length) |
| 11790 | return ''.join(packed) |
| 11791 | |
| 11792 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11793 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11794 | obj = group_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11795 | _version = reader.read("!B")[0] |
| 11796 | assert(_version == 4) |
| 11797 | _type = reader.read("!B")[0] |
| 11798 | assert(_type == 19) |
| 11799 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11800 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 11801 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11802 | obj.xid = reader.read("!L")[0] |
| 11803 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11804 | assert(_stats_type == 6) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11805 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11806 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11807 | 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] | 11808 | return obj |
| 11809 | |
| 11810 | def __eq__(self, other): |
| 11811 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11812 | if self.xid != other.xid: return False |
| 11813 | if self.flags != other.flags: return False |
| 11814 | if self.entries != other.entries: return False |
| 11815 | return True |
| 11816 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11817 | def pretty_print(self, q): |
| 11818 | q.text("group_stats_reply {") |
| 11819 | with q.group(): |
| 11820 | with q.indent(2): |
| 11821 | q.breakable() |
| 11822 | q.text("xid = "); |
| 11823 | if self.xid != None: |
| 11824 | q.text("%#x" % self.xid) |
| 11825 | else: |
| 11826 | q.text('None') |
| 11827 | q.text(","); q.breakable() |
| 11828 | q.text("flags = "); |
| 11829 | q.text("%#x" % self.flags) |
| 11830 | q.text(","); q.breakable() |
| 11831 | q.text("entries = "); |
| 11832 | q.pp(self.entries) |
| 11833 | q.breakable() |
| 11834 | q.text('}') |
| 11835 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11836 | stats_reply.subtypes[6] = group_stats_reply |
| 11837 | |
| 11838 | class group_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11839 | version = 4 |
| 11840 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11841 | stats_type = 6 |
| 11842 | |
| 11843 | def __init__(self, xid=None, flags=None, group_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11844 | if xid != None: |
| 11845 | self.xid = xid |
| 11846 | else: |
| 11847 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11848 | if flags != None: |
| 11849 | self.flags = flags |
| 11850 | else: |
| 11851 | self.flags = 0 |
| 11852 | if group_id != None: |
| 11853 | self.group_id = group_id |
| 11854 | else: |
| 11855 | self.group_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11856 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11857 | |
| 11858 | def pack(self): |
| 11859 | packed = [] |
| 11860 | packed.append(struct.pack("!B", self.version)) |
| 11861 | packed.append(struct.pack("!B", self.type)) |
| 11862 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11863 | packed.append(struct.pack("!L", self.xid)) |
| 11864 | packed.append(struct.pack("!H", self.stats_type)) |
| 11865 | packed.append(struct.pack("!H", self.flags)) |
| 11866 | packed.append('\x00' * 4) |
| 11867 | packed.append(struct.pack("!L", self.group_id)) |
| 11868 | packed.append('\x00' * 4) |
| 11869 | length = sum([len(x) for x in packed]) |
| 11870 | packed[2] = struct.pack("!H", length) |
| 11871 | return ''.join(packed) |
| 11872 | |
| 11873 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11874 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11875 | obj = group_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11876 | _version = reader.read("!B")[0] |
| 11877 | assert(_version == 4) |
| 11878 | _type = reader.read("!B")[0] |
| 11879 | assert(_type == 18) |
| 11880 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11881 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 11882 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11883 | obj.xid = reader.read("!L")[0] |
| 11884 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11885 | assert(_stats_type == 6) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11886 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11887 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11888 | obj.group_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11889 | reader.skip(4) |
| 11890 | return obj |
| 11891 | |
| 11892 | def __eq__(self, other): |
| 11893 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11894 | if self.xid != other.xid: return False |
| 11895 | if self.flags != other.flags: return False |
| 11896 | if self.group_id != other.group_id: return False |
| 11897 | return True |
| 11898 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11899 | def pretty_print(self, q): |
| 11900 | q.text("group_stats_request {") |
| 11901 | with q.group(): |
| 11902 | with q.indent(2): |
| 11903 | q.breakable() |
| 11904 | q.text("xid = "); |
| 11905 | if self.xid != None: |
| 11906 | q.text("%#x" % self.xid) |
| 11907 | else: |
| 11908 | q.text('None') |
| 11909 | q.text(","); q.breakable() |
| 11910 | q.text("flags = "); |
| 11911 | q.text("%#x" % self.flags) |
| 11912 | q.text(","); q.breakable() |
| 11913 | q.text("group_id = "); |
| 11914 | q.text("%#x" % self.group_id) |
| 11915 | q.breakable() |
| 11916 | q.text('}') |
| 11917 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11918 | stats_request.subtypes[6] = group_stats_request |
| 11919 | |
| 11920 | class hello(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11921 | version = 4 |
| 11922 | type = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11923 | |
| 11924 | def __init__(self, xid=None, elements=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11925 | if xid != None: |
| 11926 | self.xid = xid |
| 11927 | else: |
| 11928 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11929 | if elements != None: |
| 11930 | self.elements = elements |
| 11931 | else: |
| 11932 | self.elements = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11933 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11934 | |
| 11935 | def pack(self): |
| 11936 | packed = [] |
| 11937 | packed.append(struct.pack("!B", self.version)) |
| 11938 | packed.append(struct.pack("!B", self.type)) |
| 11939 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11940 | packed.append(struct.pack("!L", self.xid)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11941 | packed.append(loxi.generic_util.pack_list(self.elements)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11942 | length = sum([len(x) for x in packed]) |
| 11943 | packed[2] = struct.pack("!H", length) |
| 11944 | return ''.join(packed) |
| 11945 | |
| 11946 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11947 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11948 | obj = hello() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11949 | _version = reader.read("!B")[0] |
| 11950 | assert(_version == 4) |
| 11951 | _type = reader.read("!B")[0] |
| 11952 | assert(_type == 0) |
| 11953 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11954 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 11955 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11956 | obj.xid = reader.read("!L")[0] |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 11957 | obj.elements = loxi.generic_util.unpack_list(reader, common.hello_elem.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11958 | return obj |
| 11959 | |
| 11960 | def __eq__(self, other): |
| 11961 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11962 | if self.xid != other.xid: return False |
| 11963 | if self.elements != other.elements: return False |
| 11964 | return True |
| 11965 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11966 | def pretty_print(self, q): |
| 11967 | q.text("hello {") |
| 11968 | with q.group(): |
| 11969 | with q.indent(2): |
| 11970 | q.breakable() |
| 11971 | q.text("xid = "); |
| 11972 | if self.xid != None: |
| 11973 | q.text("%#x" % self.xid) |
| 11974 | else: |
| 11975 | q.text('None') |
| 11976 | q.text(","); q.breakable() |
| 11977 | q.text("elements = "); |
| 11978 | q.pp(self.elements) |
| 11979 | q.breakable() |
| 11980 | q.text('}') |
| 11981 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11982 | message.subtypes[0] = hello |
| 11983 | |
| 11984 | class hello_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11985 | version = 4 |
| 11986 | type = 1 |
| 11987 | err_type = 0 |
| 11988 | |
| 11989 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11990 | if xid != None: |
| 11991 | self.xid = xid |
| 11992 | else: |
| 11993 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11994 | if code != None: |
| 11995 | self.code = code |
| 11996 | else: |
| 11997 | self.code = 0 |
| 11998 | if data != None: |
| 11999 | self.data = data |
| 12000 | else: |
| 12001 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12002 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12003 | |
| 12004 | def pack(self): |
| 12005 | packed = [] |
| 12006 | packed.append(struct.pack("!B", self.version)) |
| 12007 | packed.append(struct.pack("!B", self.type)) |
| 12008 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12009 | packed.append(struct.pack("!L", self.xid)) |
| 12010 | packed.append(struct.pack("!H", self.err_type)) |
| 12011 | packed.append(struct.pack("!H", self.code)) |
| 12012 | packed.append(self.data) |
| 12013 | length = sum([len(x) for x in packed]) |
| 12014 | packed[2] = struct.pack("!H", length) |
| 12015 | return ''.join(packed) |
| 12016 | |
| 12017 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12018 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12019 | obj = hello_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12020 | _version = reader.read("!B")[0] |
| 12021 | assert(_version == 4) |
| 12022 | _type = reader.read("!B")[0] |
| 12023 | assert(_type == 1) |
| 12024 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12025 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 12026 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12027 | obj.xid = reader.read("!L")[0] |
| 12028 | _err_type = reader.read("!H")[0] |
| 12029 | assert(_err_type == 0) |
| 12030 | obj.code = reader.read("!H")[0] |
| 12031 | obj.data = str(reader.read_all()) |
| 12032 | return obj |
| 12033 | |
| 12034 | def __eq__(self, other): |
| 12035 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12036 | if self.xid != other.xid: return False |
| 12037 | if self.code != other.code: return False |
| 12038 | if self.data != other.data: return False |
| 12039 | return True |
| 12040 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12041 | def pretty_print(self, q): |
| 12042 | q.text("hello_failed_error_msg {") |
| 12043 | with q.group(): |
| 12044 | with q.indent(2): |
| 12045 | q.breakable() |
| 12046 | q.text("xid = "); |
| 12047 | if self.xid != None: |
| 12048 | q.text("%#x" % self.xid) |
| 12049 | else: |
| 12050 | q.text('None') |
| 12051 | q.text(","); q.breakable() |
| 12052 | q.text("code = "); |
| 12053 | q.text("%#x" % self.code) |
| 12054 | q.text(","); q.breakable() |
| 12055 | q.text("data = "); |
| 12056 | q.pp(self.data) |
| 12057 | q.breakable() |
| 12058 | q.text('}') |
| 12059 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12060 | error_msg.subtypes[0] = hello_failed_error_msg |
| 12061 | |
| 12062 | class meter_config_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12063 | version = 4 |
| 12064 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12065 | stats_type = 10 |
| 12066 | |
| 12067 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12068 | if xid != None: |
| 12069 | self.xid = xid |
| 12070 | else: |
| 12071 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12072 | if flags != None: |
| 12073 | self.flags = flags |
| 12074 | else: |
| 12075 | self.flags = 0 |
| 12076 | if entries != None: |
| 12077 | self.entries = entries |
| 12078 | else: |
| 12079 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12080 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12081 | |
| 12082 | def pack(self): |
| 12083 | packed = [] |
| 12084 | packed.append(struct.pack("!B", self.version)) |
| 12085 | packed.append(struct.pack("!B", self.type)) |
| 12086 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12087 | packed.append(struct.pack("!L", self.xid)) |
| 12088 | packed.append(struct.pack("!H", self.stats_type)) |
| 12089 | packed.append(struct.pack("!H", self.flags)) |
| 12090 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12091 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12092 | length = sum([len(x) for x in packed]) |
| 12093 | packed[2] = struct.pack("!H", length) |
| 12094 | return ''.join(packed) |
| 12095 | |
| 12096 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12097 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12098 | obj = meter_config_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12099 | _version = reader.read("!B")[0] |
| 12100 | assert(_version == 4) |
| 12101 | _type = reader.read("!B")[0] |
| 12102 | assert(_type == 19) |
| 12103 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12104 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 12105 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12106 | obj.xid = reader.read("!L")[0] |
| 12107 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12108 | assert(_stats_type == 10) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12109 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12110 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12111 | 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] | 12112 | return obj |
| 12113 | |
| 12114 | def __eq__(self, other): |
| 12115 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12116 | if self.xid != other.xid: return False |
| 12117 | if self.flags != other.flags: return False |
| 12118 | if self.entries != other.entries: return False |
| 12119 | return True |
| 12120 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12121 | def pretty_print(self, q): |
| 12122 | q.text("meter_config_stats_reply {") |
| 12123 | with q.group(): |
| 12124 | with q.indent(2): |
| 12125 | q.breakable() |
| 12126 | q.text("xid = "); |
| 12127 | if self.xid != None: |
| 12128 | q.text("%#x" % self.xid) |
| 12129 | else: |
| 12130 | q.text('None') |
| 12131 | q.text(","); q.breakable() |
| 12132 | q.text("flags = "); |
| 12133 | q.text("%#x" % self.flags) |
| 12134 | q.text(","); q.breakable() |
| 12135 | q.text("entries = "); |
| 12136 | q.pp(self.entries) |
| 12137 | q.breakable() |
| 12138 | q.text('}') |
| 12139 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12140 | stats_reply.subtypes[10] = meter_config_stats_reply |
| 12141 | |
| 12142 | class meter_config_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12143 | version = 4 |
| 12144 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12145 | stats_type = 10 |
| 12146 | |
| 12147 | def __init__(self, xid=None, flags=None, meter_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12148 | if xid != None: |
| 12149 | self.xid = xid |
| 12150 | else: |
| 12151 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12152 | if flags != None: |
| 12153 | self.flags = flags |
| 12154 | else: |
| 12155 | self.flags = 0 |
| 12156 | if meter_id != None: |
| 12157 | self.meter_id = meter_id |
| 12158 | else: |
| 12159 | self.meter_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12160 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12161 | |
| 12162 | def pack(self): |
| 12163 | packed = [] |
| 12164 | packed.append(struct.pack("!B", self.version)) |
| 12165 | packed.append(struct.pack("!B", self.type)) |
| 12166 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12167 | packed.append(struct.pack("!L", self.xid)) |
| 12168 | packed.append(struct.pack("!H", self.stats_type)) |
| 12169 | packed.append(struct.pack("!H", self.flags)) |
| 12170 | packed.append('\x00' * 4) |
| 12171 | packed.append(struct.pack("!L", self.meter_id)) |
| 12172 | packed.append('\x00' * 4) |
| 12173 | length = sum([len(x) for x in packed]) |
| 12174 | packed[2] = struct.pack("!H", length) |
| 12175 | return ''.join(packed) |
| 12176 | |
| 12177 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12178 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12179 | obj = meter_config_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12180 | _version = reader.read("!B")[0] |
| 12181 | assert(_version == 4) |
| 12182 | _type = reader.read("!B")[0] |
| 12183 | assert(_type == 18) |
| 12184 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12185 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 12186 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12187 | obj.xid = reader.read("!L")[0] |
| 12188 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12189 | assert(_stats_type == 10) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12190 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12191 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12192 | obj.meter_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12193 | reader.skip(4) |
| 12194 | return obj |
| 12195 | |
| 12196 | def __eq__(self, other): |
| 12197 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12198 | if self.xid != other.xid: return False |
| 12199 | if self.flags != other.flags: return False |
| 12200 | if self.meter_id != other.meter_id: return False |
| 12201 | return True |
| 12202 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12203 | def pretty_print(self, q): |
| 12204 | q.text("meter_config_stats_request {") |
| 12205 | with q.group(): |
| 12206 | with q.indent(2): |
| 12207 | q.breakable() |
| 12208 | q.text("xid = "); |
| 12209 | if self.xid != None: |
| 12210 | q.text("%#x" % self.xid) |
| 12211 | else: |
| 12212 | q.text('None') |
| 12213 | q.text(","); q.breakable() |
| 12214 | q.text("flags = "); |
| 12215 | q.text("%#x" % self.flags) |
| 12216 | q.text(","); q.breakable() |
| 12217 | q.text("meter_id = "); |
| 12218 | q.text("%#x" % self.meter_id) |
| 12219 | q.breakable() |
| 12220 | q.text('}') |
| 12221 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12222 | stats_request.subtypes[10] = meter_config_stats_request |
| 12223 | |
| 12224 | class meter_features_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12225 | version = 4 |
| 12226 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12227 | stats_type = 11 |
| 12228 | |
| 12229 | def __init__(self, xid=None, flags=None, features=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12230 | if xid != None: |
| 12231 | self.xid = xid |
| 12232 | else: |
| 12233 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12234 | if flags != None: |
| 12235 | self.flags = flags |
| 12236 | else: |
| 12237 | self.flags = 0 |
| 12238 | if features != None: |
| 12239 | self.features = features |
| 12240 | else: |
| 12241 | self.features = common.meter_features() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12242 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12243 | |
| 12244 | def pack(self): |
| 12245 | packed = [] |
| 12246 | packed.append(struct.pack("!B", self.version)) |
| 12247 | packed.append(struct.pack("!B", self.type)) |
| 12248 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12249 | packed.append(struct.pack("!L", self.xid)) |
| 12250 | packed.append(struct.pack("!H", self.stats_type)) |
| 12251 | packed.append(struct.pack("!H", self.flags)) |
| 12252 | packed.append('\x00' * 4) |
| 12253 | packed.append(self.features.pack()) |
| 12254 | length = sum([len(x) for x in packed]) |
| 12255 | packed[2] = struct.pack("!H", length) |
| 12256 | return ''.join(packed) |
| 12257 | |
| 12258 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12259 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12260 | obj = meter_features_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12261 | _version = reader.read("!B")[0] |
| 12262 | assert(_version == 4) |
| 12263 | _type = reader.read("!B")[0] |
| 12264 | assert(_type == 19) |
| 12265 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12266 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 12267 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12268 | obj.xid = reader.read("!L")[0] |
| 12269 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12270 | assert(_stats_type == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12271 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12272 | reader.skip(4) |
| 12273 | obj.features = common.meter_features.unpack(reader) |
| 12274 | return obj |
| 12275 | |
| 12276 | def __eq__(self, other): |
| 12277 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12278 | if self.xid != other.xid: return False |
| 12279 | if self.flags != other.flags: return False |
| 12280 | if self.features != other.features: return False |
| 12281 | return True |
| 12282 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12283 | def pretty_print(self, q): |
| 12284 | q.text("meter_features_stats_reply {") |
| 12285 | with q.group(): |
| 12286 | with q.indent(2): |
| 12287 | q.breakable() |
| 12288 | q.text("xid = "); |
| 12289 | if self.xid != None: |
| 12290 | q.text("%#x" % self.xid) |
| 12291 | else: |
| 12292 | q.text('None') |
| 12293 | q.text(","); q.breakable() |
| 12294 | q.text("flags = "); |
| 12295 | q.text("%#x" % self.flags) |
| 12296 | q.text(","); q.breakable() |
| 12297 | q.text("features = "); |
| 12298 | q.pp(self.features) |
| 12299 | q.breakable() |
| 12300 | q.text('}') |
| 12301 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12302 | stats_reply.subtypes[11] = meter_features_stats_reply |
| 12303 | |
| 12304 | class meter_features_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12305 | version = 4 |
| 12306 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12307 | stats_type = 11 |
| 12308 | |
| 12309 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12310 | if xid != None: |
| 12311 | self.xid = xid |
| 12312 | else: |
| 12313 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12314 | if flags != None: |
| 12315 | self.flags = flags |
| 12316 | else: |
| 12317 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12318 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12319 | |
| 12320 | def pack(self): |
| 12321 | packed = [] |
| 12322 | packed.append(struct.pack("!B", self.version)) |
| 12323 | packed.append(struct.pack("!B", self.type)) |
| 12324 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12325 | packed.append(struct.pack("!L", self.xid)) |
| 12326 | packed.append(struct.pack("!H", self.stats_type)) |
| 12327 | packed.append(struct.pack("!H", self.flags)) |
| 12328 | packed.append('\x00' * 4) |
| 12329 | length = sum([len(x) for x in packed]) |
| 12330 | packed[2] = struct.pack("!H", length) |
| 12331 | return ''.join(packed) |
| 12332 | |
| 12333 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12334 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12335 | obj = meter_features_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12336 | _version = reader.read("!B")[0] |
| 12337 | assert(_version == 4) |
| 12338 | _type = reader.read("!B")[0] |
| 12339 | assert(_type == 18) |
| 12340 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12341 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 12342 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12343 | obj.xid = reader.read("!L")[0] |
| 12344 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12345 | assert(_stats_type == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12346 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12347 | reader.skip(4) |
| 12348 | return obj |
| 12349 | |
| 12350 | def __eq__(self, other): |
| 12351 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12352 | if self.xid != other.xid: return False |
| 12353 | if self.flags != other.flags: return False |
| 12354 | return True |
| 12355 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12356 | def pretty_print(self, q): |
| 12357 | q.text("meter_features_stats_request {") |
| 12358 | with q.group(): |
| 12359 | with q.indent(2): |
| 12360 | q.breakable() |
| 12361 | q.text("xid = "); |
| 12362 | if self.xid != None: |
| 12363 | q.text("%#x" % self.xid) |
| 12364 | else: |
| 12365 | q.text('None') |
| 12366 | q.text(","); q.breakable() |
| 12367 | q.text("flags = "); |
| 12368 | q.text("%#x" % self.flags) |
| 12369 | q.breakable() |
| 12370 | q.text('}') |
| 12371 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12372 | stats_request.subtypes[11] = meter_features_stats_request |
| 12373 | |
| 12374 | class meter_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12375 | version = 4 |
| 12376 | type = 29 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12377 | |
| 12378 | 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] | 12379 | if xid != None: |
| 12380 | self.xid = xid |
| 12381 | else: |
| 12382 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12383 | if command != None: |
| 12384 | self.command = command |
| 12385 | else: |
| 12386 | self.command = 0 |
| 12387 | if flags != None: |
| 12388 | self.flags = flags |
| 12389 | else: |
| 12390 | self.flags = 0 |
| 12391 | if meter_id != None: |
| 12392 | self.meter_id = meter_id |
| 12393 | else: |
| 12394 | self.meter_id = 0 |
| 12395 | if meters != None: |
| 12396 | self.meters = meters |
| 12397 | else: |
| 12398 | self.meters = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12399 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12400 | |
| 12401 | def pack(self): |
| 12402 | packed = [] |
| 12403 | packed.append(struct.pack("!B", self.version)) |
| 12404 | packed.append(struct.pack("!B", self.type)) |
| 12405 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12406 | packed.append(struct.pack("!L", self.xid)) |
| 12407 | packed.append(struct.pack("!H", self.command)) |
| 12408 | packed.append(struct.pack("!H", self.flags)) |
| 12409 | packed.append(struct.pack("!L", self.meter_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12410 | packed.append(loxi.generic_util.pack_list(self.meters)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12411 | length = sum([len(x) for x in packed]) |
| 12412 | packed[2] = struct.pack("!H", length) |
| 12413 | return ''.join(packed) |
| 12414 | |
| 12415 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12416 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12417 | obj = meter_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12418 | _version = reader.read("!B")[0] |
| 12419 | assert(_version == 4) |
| 12420 | _type = reader.read("!B")[0] |
| 12421 | assert(_type == 29) |
| 12422 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12423 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 12424 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12425 | obj.xid = reader.read("!L")[0] |
| 12426 | obj.command = reader.read("!H")[0] |
| 12427 | obj.flags = reader.read("!H")[0] |
| 12428 | obj.meter_id = reader.read("!L")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12429 | 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] | 12430 | return obj |
| 12431 | |
| 12432 | def __eq__(self, other): |
| 12433 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12434 | if self.xid != other.xid: return False |
| 12435 | if self.command != other.command: return False |
| 12436 | if self.flags != other.flags: return False |
| 12437 | if self.meter_id != other.meter_id: return False |
| 12438 | if self.meters != other.meters: return False |
| 12439 | return True |
| 12440 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12441 | def pretty_print(self, q): |
| 12442 | q.text("meter_mod {") |
| 12443 | with q.group(): |
| 12444 | with q.indent(2): |
| 12445 | q.breakable() |
| 12446 | q.text("xid = "); |
| 12447 | if self.xid != None: |
| 12448 | q.text("%#x" % self.xid) |
| 12449 | else: |
| 12450 | q.text('None') |
| 12451 | q.text(","); q.breakable() |
| 12452 | q.text("command = "); |
| 12453 | q.text("%#x" % self.command) |
| 12454 | q.text(","); q.breakable() |
| 12455 | q.text("flags = "); |
| 12456 | q.text("%#x" % self.flags) |
| 12457 | q.text(","); q.breakable() |
| 12458 | q.text("meter_id = "); |
| 12459 | q.text("%#x" % self.meter_id) |
| 12460 | q.text(","); q.breakable() |
| 12461 | q.text("meters = "); |
| 12462 | q.pp(self.meters) |
| 12463 | q.breakable() |
| 12464 | q.text('}') |
| 12465 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12466 | message.subtypes[29] = meter_mod |
| 12467 | |
| 12468 | class meter_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12469 | version = 4 |
| 12470 | type = 1 |
| 12471 | err_type = 12 |
| 12472 | |
| 12473 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12474 | if xid != None: |
| 12475 | self.xid = xid |
| 12476 | else: |
| 12477 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12478 | if code != None: |
| 12479 | self.code = code |
| 12480 | else: |
| 12481 | self.code = 0 |
| 12482 | if data != None: |
| 12483 | self.data = data |
| 12484 | else: |
| 12485 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12486 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12487 | |
| 12488 | def pack(self): |
| 12489 | packed = [] |
| 12490 | packed.append(struct.pack("!B", self.version)) |
| 12491 | packed.append(struct.pack("!B", self.type)) |
| 12492 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12493 | packed.append(struct.pack("!L", self.xid)) |
| 12494 | packed.append(struct.pack("!H", self.err_type)) |
| 12495 | packed.append(struct.pack("!H", self.code)) |
| 12496 | packed.append(self.data) |
| 12497 | length = sum([len(x) for x in packed]) |
| 12498 | packed[2] = struct.pack("!H", length) |
| 12499 | return ''.join(packed) |
| 12500 | |
| 12501 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12502 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12503 | obj = meter_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12504 | _version = reader.read("!B")[0] |
| 12505 | assert(_version == 4) |
| 12506 | _type = reader.read("!B")[0] |
| 12507 | assert(_type == 1) |
| 12508 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12509 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 12510 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12511 | obj.xid = reader.read("!L")[0] |
| 12512 | _err_type = reader.read("!H")[0] |
| 12513 | assert(_err_type == 12) |
| 12514 | obj.code = reader.read("!H")[0] |
| 12515 | obj.data = str(reader.read_all()) |
| 12516 | return obj |
| 12517 | |
| 12518 | def __eq__(self, other): |
| 12519 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12520 | if self.xid != other.xid: return False |
| 12521 | if self.code != other.code: return False |
| 12522 | if self.data != other.data: return False |
| 12523 | return True |
| 12524 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12525 | def pretty_print(self, q): |
| 12526 | q.text("meter_mod_failed_error_msg {") |
| 12527 | with q.group(): |
| 12528 | with q.indent(2): |
| 12529 | q.breakable() |
| 12530 | q.text("xid = "); |
| 12531 | if self.xid != None: |
| 12532 | q.text("%#x" % self.xid) |
| 12533 | else: |
| 12534 | q.text('None') |
| 12535 | q.text(","); q.breakable() |
| 12536 | q.text("code = "); |
| 12537 | q.text("%#x" % self.code) |
| 12538 | q.text(","); q.breakable() |
| 12539 | q.text("data = "); |
| 12540 | q.pp(self.data) |
| 12541 | q.breakable() |
| 12542 | q.text('}') |
| 12543 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12544 | error_msg.subtypes[12] = meter_mod_failed_error_msg |
| 12545 | |
| 12546 | class meter_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12547 | version = 4 |
| 12548 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12549 | stats_type = 9 |
| 12550 | |
| 12551 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12552 | if xid != None: |
| 12553 | self.xid = xid |
| 12554 | else: |
| 12555 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12556 | if flags != None: |
| 12557 | self.flags = flags |
| 12558 | else: |
| 12559 | self.flags = 0 |
| 12560 | if entries != None: |
| 12561 | self.entries = entries |
| 12562 | else: |
| 12563 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12564 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12565 | |
| 12566 | def pack(self): |
| 12567 | packed = [] |
| 12568 | packed.append(struct.pack("!B", self.version)) |
| 12569 | packed.append(struct.pack("!B", self.type)) |
| 12570 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12571 | packed.append(struct.pack("!L", self.xid)) |
| 12572 | packed.append(struct.pack("!H", self.stats_type)) |
| 12573 | packed.append(struct.pack("!H", self.flags)) |
| 12574 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12575 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12576 | length = sum([len(x) for x in packed]) |
| 12577 | packed[2] = struct.pack("!H", length) |
| 12578 | return ''.join(packed) |
| 12579 | |
| 12580 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12581 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12582 | obj = meter_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12583 | _version = reader.read("!B")[0] |
| 12584 | assert(_version == 4) |
| 12585 | _type = reader.read("!B")[0] |
| 12586 | assert(_type == 19) |
| 12587 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12588 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 12589 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12590 | obj.xid = reader.read("!L")[0] |
| 12591 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12592 | assert(_stats_type == 9) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12593 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12594 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12595 | obj.entries = loxi.generic_util.unpack_list(reader, common.meter_stats.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12596 | return obj |
| 12597 | |
| 12598 | def __eq__(self, other): |
| 12599 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12600 | if self.xid != other.xid: return False |
| 12601 | if self.flags != other.flags: return False |
| 12602 | if self.entries != other.entries: return False |
| 12603 | return True |
| 12604 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12605 | def pretty_print(self, q): |
| 12606 | q.text("meter_stats_reply {") |
| 12607 | with q.group(): |
| 12608 | with q.indent(2): |
| 12609 | q.breakable() |
| 12610 | q.text("xid = "); |
| 12611 | if self.xid != None: |
| 12612 | q.text("%#x" % self.xid) |
| 12613 | else: |
| 12614 | q.text('None') |
| 12615 | q.text(","); q.breakable() |
| 12616 | q.text("flags = "); |
| 12617 | q.text("%#x" % self.flags) |
| 12618 | q.text(","); q.breakable() |
| 12619 | q.text("entries = "); |
| 12620 | q.pp(self.entries) |
| 12621 | q.breakable() |
| 12622 | q.text('}') |
| 12623 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12624 | stats_reply.subtypes[9] = meter_stats_reply |
| 12625 | |
| 12626 | class meter_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12627 | version = 4 |
| 12628 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12629 | stats_type = 9 |
| 12630 | |
| 12631 | def __init__(self, xid=None, flags=None, meter_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12632 | if xid != None: |
| 12633 | self.xid = xid |
| 12634 | else: |
| 12635 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12636 | if flags != None: |
| 12637 | self.flags = flags |
| 12638 | else: |
| 12639 | self.flags = 0 |
| 12640 | if meter_id != None: |
| 12641 | self.meter_id = meter_id |
| 12642 | else: |
| 12643 | self.meter_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12644 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12645 | |
| 12646 | def pack(self): |
| 12647 | packed = [] |
| 12648 | packed.append(struct.pack("!B", self.version)) |
| 12649 | packed.append(struct.pack("!B", self.type)) |
| 12650 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12651 | packed.append(struct.pack("!L", self.xid)) |
| 12652 | packed.append(struct.pack("!H", self.stats_type)) |
| 12653 | packed.append(struct.pack("!H", self.flags)) |
| 12654 | packed.append('\x00' * 4) |
| 12655 | packed.append(struct.pack("!L", self.meter_id)) |
| 12656 | packed.append('\x00' * 4) |
| 12657 | length = sum([len(x) for x in packed]) |
| 12658 | packed[2] = struct.pack("!H", length) |
| 12659 | return ''.join(packed) |
| 12660 | |
| 12661 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12662 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12663 | obj = meter_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12664 | _version = reader.read("!B")[0] |
| 12665 | assert(_version == 4) |
| 12666 | _type = reader.read("!B")[0] |
| 12667 | assert(_type == 18) |
| 12668 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12669 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 12670 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12671 | obj.xid = reader.read("!L")[0] |
| 12672 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12673 | assert(_stats_type == 9) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12674 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12675 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12676 | obj.meter_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12677 | reader.skip(4) |
| 12678 | return obj |
| 12679 | |
| 12680 | def __eq__(self, other): |
| 12681 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12682 | if self.xid != other.xid: return False |
| 12683 | if self.flags != other.flags: return False |
| 12684 | if self.meter_id != other.meter_id: return False |
| 12685 | return True |
| 12686 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12687 | def pretty_print(self, q): |
| 12688 | q.text("meter_stats_request {") |
| 12689 | with q.group(): |
| 12690 | with q.indent(2): |
| 12691 | q.breakable() |
| 12692 | q.text("xid = "); |
| 12693 | if self.xid != None: |
| 12694 | q.text("%#x" % self.xid) |
| 12695 | else: |
| 12696 | q.text('None') |
| 12697 | q.text(","); q.breakable() |
| 12698 | q.text("flags = "); |
| 12699 | q.text("%#x" % self.flags) |
| 12700 | q.text(","); q.breakable() |
| 12701 | q.text("meter_id = "); |
| 12702 | q.text("%#x" % self.meter_id) |
| 12703 | q.breakable() |
| 12704 | q.text('}') |
| 12705 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12706 | stats_request.subtypes[9] = meter_stats_request |
| 12707 | |
| 12708 | class nicira_header(experimenter): |
| 12709 | subtypes = {} |
| 12710 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 12711 | version = 4 |
| 12712 | type = 4 |
| 12713 | experimenter = 8992 |
| 12714 | |
| 12715 | def __init__(self, xid=None, subtype=None): |
| 12716 | if xid != None: |
| 12717 | self.xid = xid |
| 12718 | else: |
| 12719 | self.xid = None |
| 12720 | if subtype != None: |
| 12721 | self.subtype = subtype |
| 12722 | else: |
| 12723 | self.subtype = 0 |
| 12724 | return |
| 12725 | |
| 12726 | def pack(self): |
| 12727 | packed = [] |
| 12728 | packed.append(struct.pack("!B", self.version)) |
| 12729 | packed.append(struct.pack("!B", self.type)) |
| 12730 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12731 | packed.append(struct.pack("!L", self.xid)) |
| 12732 | packed.append(struct.pack("!L", self.experimenter)) |
| 12733 | packed.append(struct.pack("!L", self.subtype)) |
| 12734 | length = sum([len(x) for x in packed]) |
| 12735 | packed[2] = struct.pack("!H", length) |
| 12736 | return ''.join(packed) |
| 12737 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12738 | @staticmethod |
| 12739 | def unpack(reader): |
| 12740 | subtype, = reader.peek('!L', 12) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 12741 | subclass = nicira_header.subtypes.get(subtype) |
| 12742 | if subclass: |
| 12743 | return subclass.unpack(reader) |
| 12744 | |
| 12745 | obj = nicira_header() |
| 12746 | _version = reader.read("!B")[0] |
| 12747 | assert(_version == 4) |
| 12748 | _type = reader.read("!B")[0] |
| 12749 | assert(_type == 4) |
| 12750 | _length = reader.read("!H")[0] |
| 12751 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 12752 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 12753 | obj.xid = reader.read("!L")[0] |
| 12754 | _experimenter = reader.read("!L")[0] |
| 12755 | assert(_experimenter == 8992) |
| 12756 | obj.subtype = reader.read("!L")[0] |
| 12757 | return obj |
| 12758 | |
| 12759 | def __eq__(self, other): |
| 12760 | if type(self) != type(other): return False |
| 12761 | if self.xid != other.xid: return False |
| 12762 | if self.subtype != other.subtype: return False |
| 12763 | return True |
| 12764 | |
| 12765 | def pretty_print(self, q): |
| 12766 | q.text("nicira_header {") |
| 12767 | with q.group(): |
| 12768 | with q.indent(2): |
| 12769 | q.breakable() |
| 12770 | q.text("xid = "); |
| 12771 | if self.xid != None: |
| 12772 | q.text("%#x" % self.xid) |
| 12773 | else: |
| 12774 | q.text('None') |
| 12775 | q.breakable() |
| 12776 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12777 | |
| 12778 | experimenter.subtypes[8992] = nicira_header |
| 12779 | |
| 12780 | class packet_in(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12781 | version = 4 |
| 12782 | type = 10 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12783 | |
| 12784 | 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] | 12785 | if xid != None: |
| 12786 | self.xid = xid |
| 12787 | else: |
| 12788 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12789 | if buffer_id != None: |
| 12790 | self.buffer_id = buffer_id |
| 12791 | else: |
| 12792 | self.buffer_id = 0 |
| 12793 | if total_len != None: |
| 12794 | self.total_len = total_len |
| 12795 | else: |
| 12796 | self.total_len = 0 |
| 12797 | if reason != None: |
| 12798 | self.reason = reason |
| 12799 | else: |
| 12800 | self.reason = 0 |
| 12801 | if table_id != None: |
| 12802 | self.table_id = table_id |
| 12803 | else: |
| 12804 | self.table_id = 0 |
| 12805 | if cookie != None: |
| 12806 | self.cookie = cookie |
| 12807 | else: |
| 12808 | self.cookie = 0 |
| 12809 | if match != None: |
| 12810 | self.match = match |
| 12811 | else: |
| 12812 | self.match = common.match() |
| 12813 | if data != None: |
| 12814 | self.data = data |
| 12815 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12816 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12817 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12818 | |
| 12819 | def pack(self): |
| 12820 | packed = [] |
| 12821 | packed.append(struct.pack("!B", self.version)) |
| 12822 | packed.append(struct.pack("!B", self.type)) |
| 12823 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12824 | packed.append(struct.pack("!L", self.xid)) |
| 12825 | packed.append(struct.pack("!L", self.buffer_id)) |
| 12826 | packed.append(struct.pack("!H", self.total_len)) |
| 12827 | packed.append(struct.pack("!B", self.reason)) |
| 12828 | packed.append(struct.pack("!B", self.table_id)) |
| 12829 | packed.append(struct.pack("!Q", self.cookie)) |
| 12830 | packed.append(self.match.pack()) |
| 12831 | packed.append('\x00' * 2) |
| 12832 | packed.append(self.data) |
| 12833 | length = sum([len(x) for x in packed]) |
| 12834 | packed[2] = struct.pack("!H", length) |
| 12835 | return ''.join(packed) |
| 12836 | |
| 12837 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12838 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12839 | obj = packet_in() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12840 | _version = reader.read("!B")[0] |
| 12841 | assert(_version == 4) |
| 12842 | _type = reader.read("!B")[0] |
| 12843 | assert(_type == 10) |
| 12844 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12845 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 12846 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12847 | obj.xid = reader.read("!L")[0] |
| 12848 | obj.buffer_id = reader.read("!L")[0] |
| 12849 | obj.total_len = reader.read("!H")[0] |
| 12850 | obj.reason = reader.read("!B")[0] |
| 12851 | obj.table_id = reader.read("!B")[0] |
| 12852 | obj.cookie = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12853 | obj.match = common.match.unpack(reader) |
| 12854 | reader.skip(2) |
| 12855 | obj.data = str(reader.read_all()) |
| 12856 | return obj |
| 12857 | |
| 12858 | def __eq__(self, other): |
| 12859 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12860 | if self.xid != other.xid: return False |
| 12861 | if self.buffer_id != other.buffer_id: return False |
| 12862 | if self.total_len != other.total_len: return False |
| 12863 | if self.reason != other.reason: return False |
| 12864 | if self.table_id != other.table_id: return False |
| 12865 | if self.cookie != other.cookie: return False |
| 12866 | if self.match != other.match: return False |
| 12867 | if self.data != other.data: return False |
| 12868 | return True |
| 12869 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12870 | def pretty_print(self, q): |
| 12871 | q.text("packet_in {") |
| 12872 | with q.group(): |
| 12873 | with q.indent(2): |
| 12874 | q.breakable() |
| 12875 | q.text("xid = "); |
| 12876 | if self.xid != None: |
| 12877 | q.text("%#x" % self.xid) |
| 12878 | else: |
| 12879 | q.text('None') |
| 12880 | q.text(","); q.breakable() |
| 12881 | q.text("buffer_id = "); |
| 12882 | q.text("%#x" % self.buffer_id) |
| 12883 | q.text(","); q.breakable() |
| 12884 | q.text("total_len = "); |
| 12885 | q.text("%#x" % self.total_len) |
| 12886 | q.text(","); q.breakable() |
| 12887 | q.text("reason = "); |
| 12888 | q.text("%#x" % self.reason) |
| 12889 | q.text(","); q.breakable() |
| 12890 | q.text("table_id = "); |
| 12891 | q.text("%#x" % self.table_id) |
| 12892 | q.text(","); q.breakable() |
| 12893 | q.text("cookie = "); |
| 12894 | q.text("%#x" % self.cookie) |
| 12895 | q.text(","); q.breakable() |
| 12896 | q.text("match = "); |
| 12897 | q.pp(self.match) |
| 12898 | q.text(","); q.breakable() |
| 12899 | q.text("data = "); |
| 12900 | q.pp(self.data) |
| 12901 | q.breakable() |
| 12902 | q.text('}') |
| 12903 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12904 | message.subtypes[10] = packet_in |
| 12905 | |
| 12906 | class packet_out(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12907 | version = 4 |
| 12908 | type = 13 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12909 | |
| 12910 | 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] | 12911 | if xid != None: |
| 12912 | self.xid = xid |
| 12913 | else: |
| 12914 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12915 | if buffer_id != None: |
| 12916 | self.buffer_id = buffer_id |
| 12917 | else: |
| 12918 | self.buffer_id = 0 |
| 12919 | if in_port != None: |
| 12920 | self.in_port = in_port |
| 12921 | else: |
| 12922 | self.in_port = 0 |
| 12923 | if actions != None: |
| 12924 | self.actions = actions |
| 12925 | else: |
| 12926 | self.actions = [] |
| 12927 | if data != None: |
| 12928 | self.data = data |
| 12929 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12930 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12931 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12932 | |
| 12933 | def pack(self): |
| 12934 | packed = [] |
| 12935 | packed.append(struct.pack("!B", self.version)) |
| 12936 | packed.append(struct.pack("!B", self.type)) |
| 12937 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12938 | packed.append(struct.pack("!L", self.xid)) |
| 12939 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12940 | packed.append(util.pack_port_no(self.in_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12941 | packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6 |
| 12942 | packed.append('\x00' * 6) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12943 | packed.append(loxi.generic_util.pack_list(self.actions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12944 | packed[6] = struct.pack("!H", len(packed[-1])) |
| 12945 | packed.append(self.data) |
| 12946 | length = sum([len(x) for x in packed]) |
| 12947 | packed[2] = struct.pack("!H", length) |
| 12948 | return ''.join(packed) |
| 12949 | |
| 12950 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12951 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12952 | obj = packet_out() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12953 | _version = reader.read("!B")[0] |
| 12954 | assert(_version == 4) |
| 12955 | _type = reader.read("!B")[0] |
| 12956 | assert(_type == 13) |
| 12957 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12958 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 12959 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12960 | obj.xid = reader.read("!L")[0] |
| 12961 | obj.buffer_id = reader.read("!L")[0] |
| 12962 | obj.in_port = util.unpack_port_no(reader) |
| 12963 | _actions_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12964 | reader.skip(6) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12965 | 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] | 12966 | obj.data = str(reader.read_all()) |
| 12967 | return obj |
| 12968 | |
| 12969 | def __eq__(self, other): |
| 12970 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12971 | if self.xid != other.xid: return False |
| 12972 | if self.buffer_id != other.buffer_id: return False |
| 12973 | if self.in_port != other.in_port: return False |
| 12974 | if self.actions != other.actions: return False |
| 12975 | if self.data != other.data: return False |
| 12976 | return True |
| 12977 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12978 | def pretty_print(self, q): |
| 12979 | q.text("packet_out {") |
| 12980 | with q.group(): |
| 12981 | with q.indent(2): |
| 12982 | q.breakable() |
| 12983 | q.text("xid = "); |
| 12984 | if self.xid != None: |
| 12985 | q.text("%#x" % self.xid) |
| 12986 | else: |
| 12987 | q.text('None') |
| 12988 | q.text(","); q.breakable() |
| 12989 | q.text("buffer_id = "); |
| 12990 | q.text("%#x" % self.buffer_id) |
| 12991 | q.text(","); q.breakable() |
| 12992 | q.text("in_port = "); |
| 12993 | q.text(util.pretty_port(self.in_port)) |
| 12994 | q.text(","); q.breakable() |
| 12995 | q.text("actions = "); |
| 12996 | q.pp(self.actions) |
| 12997 | q.text(","); q.breakable() |
| 12998 | q.text("data = "); |
| 12999 | q.pp(self.data) |
| 13000 | q.breakable() |
| 13001 | q.text('}') |
| 13002 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13003 | message.subtypes[13] = packet_out |
| 13004 | |
| 13005 | class port_desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13006 | version = 4 |
| 13007 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13008 | stats_type = 13 |
| 13009 | |
| 13010 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13011 | if xid != None: |
| 13012 | self.xid = xid |
| 13013 | else: |
| 13014 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13015 | if flags != None: |
| 13016 | self.flags = flags |
| 13017 | else: |
| 13018 | self.flags = 0 |
| 13019 | if entries != None: |
| 13020 | self.entries = entries |
| 13021 | else: |
| 13022 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13023 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13024 | |
| 13025 | def pack(self): |
| 13026 | packed = [] |
| 13027 | packed.append(struct.pack("!B", self.version)) |
| 13028 | packed.append(struct.pack("!B", self.type)) |
| 13029 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13030 | packed.append(struct.pack("!L", self.xid)) |
| 13031 | packed.append(struct.pack("!H", self.stats_type)) |
| 13032 | packed.append(struct.pack("!H", self.flags)) |
| 13033 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13034 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13035 | length = sum([len(x) for x in packed]) |
| 13036 | packed[2] = struct.pack("!H", length) |
| 13037 | return ''.join(packed) |
| 13038 | |
| 13039 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13040 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13041 | obj = port_desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13042 | _version = reader.read("!B")[0] |
| 13043 | assert(_version == 4) |
| 13044 | _type = reader.read("!B")[0] |
| 13045 | assert(_type == 19) |
| 13046 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13047 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 13048 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13049 | obj.xid = reader.read("!L")[0] |
| 13050 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13051 | assert(_stats_type == 13) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13052 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13053 | reader.skip(4) |
| 13054 | obj.entries = loxi.generic_util.unpack_list(reader, common.port_desc.unpack) |
| 13055 | return obj |
| 13056 | |
| 13057 | def __eq__(self, other): |
| 13058 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13059 | if self.xid != other.xid: return False |
| 13060 | if self.flags != other.flags: return False |
| 13061 | if self.entries != other.entries: return False |
| 13062 | return True |
| 13063 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13064 | def pretty_print(self, q): |
| 13065 | q.text("port_desc_stats_reply {") |
| 13066 | with q.group(): |
| 13067 | with q.indent(2): |
| 13068 | q.breakable() |
| 13069 | q.text("xid = "); |
| 13070 | if self.xid != None: |
| 13071 | q.text("%#x" % self.xid) |
| 13072 | else: |
| 13073 | q.text('None') |
| 13074 | q.text(","); q.breakable() |
| 13075 | q.text("flags = "); |
| 13076 | q.text("%#x" % self.flags) |
| 13077 | q.text(","); q.breakable() |
| 13078 | q.text("entries = "); |
| 13079 | q.pp(self.entries) |
| 13080 | q.breakable() |
| 13081 | q.text('}') |
| 13082 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13083 | stats_reply.subtypes[13] = port_desc_stats_reply |
| 13084 | |
| 13085 | class port_desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13086 | version = 4 |
| 13087 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13088 | stats_type = 13 |
| 13089 | |
| 13090 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13091 | if xid != None: |
| 13092 | self.xid = xid |
| 13093 | else: |
| 13094 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13095 | if flags != None: |
| 13096 | self.flags = flags |
| 13097 | else: |
| 13098 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13099 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13100 | |
| 13101 | def pack(self): |
| 13102 | packed = [] |
| 13103 | packed.append(struct.pack("!B", self.version)) |
| 13104 | packed.append(struct.pack("!B", self.type)) |
| 13105 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13106 | packed.append(struct.pack("!L", self.xid)) |
| 13107 | packed.append(struct.pack("!H", self.stats_type)) |
| 13108 | packed.append(struct.pack("!H", self.flags)) |
| 13109 | packed.append('\x00' * 4) |
| 13110 | length = sum([len(x) for x in packed]) |
| 13111 | packed[2] = struct.pack("!H", length) |
| 13112 | return ''.join(packed) |
| 13113 | |
| 13114 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13115 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13116 | obj = port_desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13117 | _version = reader.read("!B")[0] |
| 13118 | assert(_version == 4) |
| 13119 | _type = reader.read("!B")[0] |
| 13120 | assert(_type == 18) |
| 13121 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13122 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 13123 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13124 | obj.xid = reader.read("!L")[0] |
| 13125 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13126 | assert(_stats_type == 13) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13127 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13128 | reader.skip(4) |
| 13129 | return obj |
| 13130 | |
| 13131 | def __eq__(self, other): |
| 13132 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13133 | if self.xid != other.xid: return False |
| 13134 | if self.flags != other.flags: return False |
| 13135 | return True |
| 13136 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13137 | def pretty_print(self, q): |
| 13138 | q.text("port_desc_stats_request {") |
| 13139 | with q.group(): |
| 13140 | with q.indent(2): |
| 13141 | q.breakable() |
| 13142 | q.text("xid = "); |
| 13143 | if self.xid != None: |
| 13144 | q.text("%#x" % self.xid) |
| 13145 | else: |
| 13146 | q.text('None') |
| 13147 | q.text(","); q.breakable() |
| 13148 | q.text("flags = "); |
| 13149 | q.text("%#x" % self.flags) |
| 13150 | q.breakable() |
| 13151 | q.text('}') |
| 13152 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13153 | stats_request.subtypes[13] = port_desc_stats_request |
| 13154 | |
| 13155 | class port_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13156 | version = 4 |
| 13157 | type = 16 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13158 | |
| 13159 | 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] | 13160 | if xid != None: |
| 13161 | self.xid = xid |
| 13162 | else: |
| 13163 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13164 | if port_no != None: |
| 13165 | self.port_no = port_no |
| 13166 | else: |
| 13167 | self.port_no = 0 |
| 13168 | if hw_addr != None: |
| 13169 | self.hw_addr = hw_addr |
| 13170 | else: |
| 13171 | self.hw_addr = [0,0,0,0,0,0] |
| 13172 | if config != None: |
| 13173 | self.config = config |
| 13174 | else: |
| 13175 | self.config = 0 |
| 13176 | if mask != None: |
| 13177 | self.mask = mask |
| 13178 | else: |
| 13179 | self.mask = 0 |
| 13180 | if advertise != None: |
| 13181 | self.advertise = advertise |
| 13182 | else: |
| 13183 | self.advertise = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13184 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13185 | |
| 13186 | def pack(self): |
| 13187 | packed = [] |
| 13188 | packed.append(struct.pack("!B", self.version)) |
| 13189 | packed.append(struct.pack("!B", self.type)) |
| 13190 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13191 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13192 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13193 | packed.append('\x00' * 4) |
| 13194 | packed.append(struct.pack("!6B", *self.hw_addr)) |
| 13195 | packed.append('\x00' * 2) |
| 13196 | packed.append(struct.pack("!L", self.config)) |
| 13197 | packed.append(struct.pack("!L", self.mask)) |
| 13198 | packed.append(struct.pack("!L", self.advertise)) |
| 13199 | packed.append('\x00' * 4) |
| 13200 | length = sum([len(x) for x in packed]) |
| 13201 | packed[2] = struct.pack("!H", length) |
| 13202 | return ''.join(packed) |
| 13203 | |
| 13204 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13205 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13206 | obj = port_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13207 | _version = reader.read("!B")[0] |
| 13208 | assert(_version == 4) |
| 13209 | _type = reader.read("!B")[0] |
| 13210 | assert(_type == 16) |
| 13211 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13212 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 13213 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13214 | obj.xid = reader.read("!L")[0] |
| 13215 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13216 | reader.skip(4) |
| 13217 | obj.hw_addr = list(reader.read('!6B')) |
| 13218 | reader.skip(2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13219 | obj.config = reader.read("!L")[0] |
| 13220 | obj.mask = reader.read("!L")[0] |
| 13221 | obj.advertise = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13222 | reader.skip(4) |
| 13223 | return obj |
| 13224 | |
| 13225 | def __eq__(self, other): |
| 13226 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13227 | if self.xid != other.xid: return False |
| 13228 | if self.port_no != other.port_no: return False |
| 13229 | if self.hw_addr != other.hw_addr: return False |
| 13230 | if self.config != other.config: return False |
| 13231 | if self.mask != other.mask: return False |
| 13232 | if self.advertise != other.advertise: return False |
| 13233 | return True |
| 13234 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13235 | def pretty_print(self, q): |
| 13236 | q.text("port_mod {") |
| 13237 | with q.group(): |
| 13238 | with q.indent(2): |
| 13239 | q.breakable() |
| 13240 | q.text("xid = "); |
| 13241 | if self.xid != None: |
| 13242 | q.text("%#x" % self.xid) |
| 13243 | else: |
| 13244 | q.text('None') |
| 13245 | q.text(","); q.breakable() |
| 13246 | q.text("port_no = "); |
| 13247 | q.text(util.pretty_port(self.port_no)) |
| 13248 | q.text(","); q.breakable() |
| 13249 | q.text("hw_addr = "); |
| 13250 | q.text(util.pretty_mac(self.hw_addr)) |
| 13251 | q.text(","); q.breakable() |
| 13252 | q.text("config = "); |
| 13253 | q.text("%#x" % self.config) |
| 13254 | q.text(","); q.breakable() |
| 13255 | q.text("mask = "); |
| 13256 | q.text("%#x" % self.mask) |
| 13257 | q.text(","); q.breakable() |
| 13258 | q.text("advertise = "); |
| 13259 | q.text("%#x" % self.advertise) |
| 13260 | q.breakable() |
| 13261 | q.text('}') |
| 13262 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13263 | message.subtypes[16] = port_mod |
| 13264 | |
| 13265 | class port_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13266 | version = 4 |
| 13267 | type = 1 |
| 13268 | err_type = 7 |
| 13269 | |
| 13270 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13271 | if xid != None: |
| 13272 | self.xid = xid |
| 13273 | else: |
| 13274 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13275 | if code != None: |
| 13276 | self.code = code |
| 13277 | else: |
| 13278 | self.code = 0 |
| 13279 | if data != None: |
| 13280 | self.data = data |
| 13281 | else: |
| 13282 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13283 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13284 | |
| 13285 | def pack(self): |
| 13286 | packed = [] |
| 13287 | packed.append(struct.pack("!B", self.version)) |
| 13288 | packed.append(struct.pack("!B", self.type)) |
| 13289 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13290 | packed.append(struct.pack("!L", self.xid)) |
| 13291 | packed.append(struct.pack("!H", self.err_type)) |
| 13292 | packed.append(struct.pack("!H", self.code)) |
| 13293 | packed.append(self.data) |
| 13294 | length = sum([len(x) for x in packed]) |
| 13295 | packed[2] = struct.pack("!H", length) |
| 13296 | return ''.join(packed) |
| 13297 | |
| 13298 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13299 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13300 | obj = port_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13301 | _version = reader.read("!B")[0] |
| 13302 | assert(_version == 4) |
| 13303 | _type = reader.read("!B")[0] |
| 13304 | assert(_type == 1) |
| 13305 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13306 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 13307 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13308 | obj.xid = reader.read("!L")[0] |
| 13309 | _err_type = reader.read("!H")[0] |
| 13310 | assert(_err_type == 7) |
| 13311 | obj.code = reader.read("!H")[0] |
| 13312 | obj.data = str(reader.read_all()) |
| 13313 | return obj |
| 13314 | |
| 13315 | def __eq__(self, other): |
| 13316 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13317 | if self.xid != other.xid: return False |
| 13318 | if self.code != other.code: return False |
| 13319 | if self.data != other.data: return False |
| 13320 | return True |
| 13321 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13322 | def pretty_print(self, q): |
| 13323 | q.text("port_mod_failed_error_msg {") |
| 13324 | with q.group(): |
| 13325 | with q.indent(2): |
| 13326 | q.breakable() |
| 13327 | q.text("xid = "); |
| 13328 | if self.xid != None: |
| 13329 | q.text("%#x" % self.xid) |
| 13330 | else: |
| 13331 | q.text('None') |
| 13332 | q.text(","); q.breakable() |
| 13333 | q.text("code = "); |
| 13334 | q.text("%#x" % self.code) |
| 13335 | q.text(","); q.breakable() |
| 13336 | q.text("data = "); |
| 13337 | q.pp(self.data) |
| 13338 | q.breakable() |
| 13339 | q.text('}') |
| 13340 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13341 | error_msg.subtypes[7] = port_mod_failed_error_msg |
| 13342 | |
| 13343 | class port_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13344 | version = 4 |
| 13345 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13346 | stats_type = 4 |
| 13347 | |
| 13348 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13349 | if xid != None: |
| 13350 | self.xid = xid |
| 13351 | else: |
| 13352 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13353 | if flags != None: |
| 13354 | self.flags = flags |
| 13355 | else: |
| 13356 | self.flags = 0 |
| 13357 | if entries != None: |
| 13358 | self.entries = entries |
| 13359 | else: |
| 13360 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13361 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13362 | |
| 13363 | def pack(self): |
| 13364 | packed = [] |
| 13365 | packed.append(struct.pack("!B", self.version)) |
| 13366 | packed.append(struct.pack("!B", self.type)) |
| 13367 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13368 | packed.append(struct.pack("!L", self.xid)) |
| 13369 | packed.append(struct.pack("!H", self.stats_type)) |
| 13370 | packed.append(struct.pack("!H", self.flags)) |
| 13371 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13372 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13373 | length = sum([len(x) for x in packed]) |
| 13374 | packed[2] = struct.pack("!H", length) |
| 13375 | return ''.join(packed) |
| 13376 | |
| 13377 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13378 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13379 | obj = port_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13380 | _version = reader.read("!B")[0] |
| 13381 | assert(_version == 4) |
| 13382 | _type = reader.read("!B")[0] |
| 13383 | assert(_type == 19) |
| 13384 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13385 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 13386 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13387 | obj.xid = reader.read("!L")[0] |
| 13388 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13389 | assert(_stats_type == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13390 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13391 | reader.skip(4) |
| 13392 | obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack) |
| 13393 | return obj |
| 13394 | |
| 13395 | def __eq__(self, other): |
| 13396 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13397 | if self.xid != other.xid: return False |
| 13398 | if self.flags != other.flags: return False |
| 13399 | if self.entries != other.entries: return False |
| 13400 | return True |
| 13401 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13402 | def pretty_print(self, q): |
| 13403 | q.text("port_stats_reply {") |
| 13404 | with q.group(): |
| 13405 | with q.indent(2): |
| 13406 | q.breakable() |
| 13407 | q.text("xid = "); |
| 13408 | if self.xid != None: |
| 13409 | q.text("%#x" % self.xid) |
| 13410 | else: |
| 13411 | q.text('None') |
| 13412 | q.text(","); q.breakable() |
| 13413 | q.text("flags = "); |
| 13414 | q.text("%#x" % self.flags) |
| 13415 | q.text(","); q.breakable() |
| 13416 | q.text("entries = "); |
| 13417 | q.pp(self.entries) |
| 13418 | q.breakable() |
| 13419 | q.text('}') |
| 13420 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13421 | stats_reply.subtypes[4] = port_stats_reply |
| 13422 | |
| 13423 | class port_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13424 | version = 4 |
| 13425 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13426 | stats_type = 4 |
| 13427 | |
| 13428 | def __init__(self, xid=None, flags=None, port_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13429 | if xid != None: |
| 13430 | self.xid = xid |
| 13431 | else: |
| 13432 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13433 | if flags != None: |
| 13434 | self.flags = flags |
| 13435 | else: |
| 13436 | self.flags = 0 |
| 13437 | if port_no != None: |
| 13438 | self.port_no = port_no |
| 13439 | else: |
| 13440 | self.port_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13441 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13442 | |
| 13443 | def pack(self): |
| 13444 | packed = [] |
| 13445 | packed.append(struct.pack("!B", self.version)) |
| 13446 | packed.append(struct.pack("!B", self.type)) |
| 13447 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13448 | packed.append(struct.pack("!L", self.xid)) |
| 13449 | packed.append(struct.pack("!H", self.stats_type)) |
| 13450 | packed.append(struct.pack("!H", self.flags)) |
| 13451 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13452 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13453 | packed.append('\x00' * 4) |
| 13454 | length = sum([len(x) for x in packed]) |
| 13455 | packed[2] = struct.pack("!H", length) |
| 13456 | return ''.join(packed) |
| 13457 | |
| 13458 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13459 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13460 | obj = port_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13461 | _version = reader.read("!B")[0] |
| 13462 | assert(_version == 4) |
| 13463 | _type = reader.read("!B")[0] |
| 13464 | assert(_type == 18) |
| 13465 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13466 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 13467 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13468 | obj.xid = reader.read("!L")[0] |
| 13469 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13470 | assert(_stats_type == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13471 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13472 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13473 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13474 | reader.skip(4) |
| 13475 | return obj |
| 13476 | |
| 13477 | def __eq__(self, other): |
| 13478 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13479 | if self.xid != other.xid: return False |
| 13480 | if self.flags != other.flags: return False |
| 13481 | if self.port_no != other.port_no: return False |
| 13482 | return True |
| 13483 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13484 | def pretty_print(self, q): |
| 13485 | q.text("port_stats_request {") |
| 13486 | with q.group(): |
| 13487 | with q.indent(2): |
| 13488 | q.breakable() |
| 13489 | q.text("xid = "); |
| 13490 | if self.xid != None: |
| 13491 | q.text("%#x" % self.xid) |
| 13492 | else: |
| 13493 | q.text('None') |
| 13494 | q.text(","); q.breakable() |
| 13495 | q.text("flags = "); |
| 13496 | q.text("%#x" % self.flags) |
| 13497 | q.text(","); q.breakable() |
| 13498 | q.text("port_no = "); |
| 13499 | q.text(util.pretty_port(self.port_no)) |
| 13500 | q.breakable() |
| 13501 | q.text('}') |
| 13502 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13503 | stats_request.subtypes[4] = port_stats_request |
| 13504 | |
| 13505 | class port_status(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13506 | version = 4 |
| 13507 | type = 12 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13508 | |
| 13509 | def __init__(self, xid=None, reason=None, desc=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13510 | if xid != None: |
| 13511 | self.xid = xid |
| 13512 | else: |
| 13513 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13514 | if reason != None: |
| 13515 | self.reason = reason |
| 13516 | else: |
| 13517 | self.reason = 0 |
| 13518 | if desc != None: |
| 13519 | self.desc = desc |
| 13520 | else: |
| 13521 | self.desc = common.port_desc() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13522 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13523 | |
| 13524 | def pack(self): |
| 13525 | packed = [] |
| 13526 | packed.append(struct.pack("!B", self.version)) |
| 13527 | packed.append(struct.pack("!B", self.type)) |
| 13528 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13529 | packed.append(struct.pack("!L", self.xid)) |
| 13530 | packed.append(struct.pack("!B", self.reason)) |
| 13531 | packed.append('\x00' * 7) |
| 13532 | packed.append(self.desc.pack()) |
| 13533 | length = sum([len(x) for x in packed]) |
| 13534 | packed[2] = struct.pack("!H", length) |
| 13535 | return ''.join(packed) |
| 13536 | |
| 13537 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13538 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13539 | obj = port_status() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13540 | _version = reader.read("!B")[0] |
| 13541 | assert(_version == 4) |
| 13542 | _type = reader.read("!B")[0] |
| 13543 | assert(_type == 12) |
| 13544 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13545 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 13546 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13547 | obj.xid = reader.read("!L")[0] |
| 13548 | obj.reason = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13549 | reader.skip(7) |
| 13550 | obj.desc = common.port_desc.unpack(reader) |
| 13551 | return obj |
| 13552 | |
| 13553 | def __eq__(self, other): |
| 13554 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13555 | if self.xid != other.xid: return False |
| 13556 | if self.reason != other.reason: return False |
| 13557 | if self.desc != other.desc: return False |
| 13558 | return True |
| 13559 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13560 | def pretty_print(self, q): |
| 13561 | q.text("port_status {") |
| 13562 | with q.group(): |
| 13563 | with q.indent(2): |
| 13564 | q.breakable() |
| 13565 | q.text("xid = "); |
| 13566 | if self.xid != None: |
| 13567 | q.text("%#x" % self.xid) |
| 13568 | else: |
| 13569 | q.text('None') |
| 13570 | q.text(","); q.breakable() |
| 13571 | q.text("reason = "); |
| 13572 | q.text("%#x" % self.reason) |
| 13573 | q.text(","); q.breakable() |
| 13574 | q.text("desc = "); |
| 13575 | q.pp(self.desc) |
| 13576 | q.breakable() |
| 13577 | q.text('}') |
| 13578 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13579 | message.subtypes[12] = port_status |
| 13580 | |
| 13581 | class queue_get_config_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13582 | version = 4 |
| 13583 | type = 23 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13584 | |
| 13585 | def __init__(self, xid=None, port=None, queues=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13586 | if xid != None: |
| 13587 | self.xid = xid |
| 13588 | else: |
| 13589 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13590 | if port != None: |
| 13591 | self.port = port |
| 13592 | else: |
| 13593 | self.port = 0 |
| 13594 | if queues != None: |
| 13595 | self.queues = queues |
| 13596 | else: |
| 13597 | self.queues = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13598 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13599 | |
| 13600 | def pack(self): |
| 13601 | packed = [] |
| 13602 | packed.append(struct.pack("!B", self.version)) |
| 13603 | packed.append(struct.pack("!B", self.type)) |
| 13604 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13605 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13606 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13607 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13608 | packed.append(loxi.generic_util.pack_list(self.queues)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13609 | length = sum([len(x) for x in packed]) |
| 13610 | packed[2] = struct.pack("!H", length) |
| 13611 | return ''.join(packed) |
| 13612 | |
| 13613 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13614 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13615 | obj = queue_get_config_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13616 | _version = reader.read("!B")[0] |
| 13617 | assert(_version == 4) |
| 13618 | _type = reader.read("!B")[0] |
| 13619 | assert(_type == 23) |
| 13620 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13621 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 13622 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13623 | obj.xid = reader.read("!L")[0] |
| 13624 | obj.port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13625 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13626 | obj.queues = loxi.generic_util.unpack_list(reader, common.packet_queue.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13627 | return obj |
| 13628 | |
| 13629 | def __eq__(self, other): |
| 13630 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13631 | if self.xid != other.xid: return False |
| 13632 | if self.port != other.port: return False |
| 13633 | if self.queues != other.queues: return False |
| 13634 | return True |
| 13635 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13636 | def pretty_print(self, q): |
| 13637 | q.text("queue_get_config_reply {") |
| 13638 | with q.group(): |
| 13639 | with q.indent(2): |
| 13640 | q.breakable() |
| 13641 | q.text("xid = "); |
| 13642 | if self.xid != None: |
| 13643 | q.text("%#x" % self.xid) |
| 13644 | else: |
| 13645 | q.text('None') |
| 13646 | q.text(","); q.breakable() |
| 13647 | q.text("port = "); |
| 13648 | q.text(util.pretty_port(self.port)) |
| 13649 | q.text(","); q.breakable() |
| 13650 | q.text("queues = "); |
| 13651 | q.pp(self.queues) |
| 13652 | q.breakable() |
| 13653 | q.text('}') |
| 13654 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13655 | message.subtypes[23] = queue_get_config_reply |
| 13656 | |
| 13657 | class queue_get_config_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13658 | version = 4 |
| 13659 | type = 22 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13660 | |
| 13661 | def __init__(self, xid=None, port=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13662 | if xid != None: |
| 13663 | self.xid = xid |
| 13664 | else: |
| 13665 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13666 | if port != None: |
| 13667 | self.port = port |
| 13668 | else: |
| 13669 | self.port = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13670 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13671 | |
| 13672 | def pack(self): |
| 13673 | packed = [] |
| 13674 | packed.append(struct.pack("!B", self.version)) |
| 13675 | packed.append(struct.pack("!B", self.type)) |
| 13676 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13677 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13678 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13679 | packed.append('\x00' * 4) |
| 13680 | length = sum([len(x) for x in packed]) |
| 13681 | packed[2] = struct.pack("!H", length) |
| 13682 | return ''.join(packed) |
| 13683 | |
| 13684 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13685 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13686 | obj = queue_get_config_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13687 | _version = reader.read("!B")[0] |
| 13688 | assert(_version == 4) |
| 13689 | _type = reader.read("!B")[0] |
| 13690 | assert(_type == 22) |
| 13691 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13692 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 13693 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13694 | obj.xid = reader.read("!L")[0] |
| 13695 | obj.port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13696 | reader.skip(4) |
| 13697 | return obj |
| 13698 | |
| 13699 | def __eq__(self, other): |
| 13700 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13701 | if self.xid != other.xid: return False |
| 13702 | if self.port != other.port: return False |
| 13703 | return True |
| 13704 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13705 | def pretty_print(self, q): |
| 13706 | q.text("queue_get_config_request {") |
| 13707 | with q.group(): |
| 13708 | with q.indent(2): |
| 13709 | q.breakable() |
| 13710 | q.text("xid = "); |
| 13711 | if self.xid != None: |
| 13712 | q.text("%#x" % self.xid) |
| 13713 | else: |
| 13714 | q.text('None') |
| 13715 | q.text(","); q.breakable() |
| 13716 | q.text("port = "); |
| 13717 | q.text(util.pretty_port(self.port)) |
| 13718 | q.breakable() |
| 13719 | q.text('}') |
| 13720 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13721 | message.subtypes[22] = queue_get_config_request |
| 13722 | |
| 13723 | class queue_op_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13724 | version = 4 |
| 13725 | type = 1 |
| 13726 | err_type = 9 |
| 13727 | |
| 13728 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13729 | if xid != None: |
| 13730 | self.xid = xid |
| 13731 | else: |
| 13732 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13733 | if code != None: |
| 13734 | self.code = code |
| 13735 | else: |
| 13736 | self.code = 0 |
| 13737 | if data != None: |
| 13738 | self.data = data |
| 13739 | else: |
| 13740 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13741 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13742 | |
| 13743 | def pack(self): |
| 13744 | packed = [] |
| 13745 | packed.append(struct.pack("!B", self.version)) |
| 13746 | packed.append(struct.pack("!B", self.type)) |
| 13747 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13748 | packed.append(struct.pack("!L", self.xid)) |
| 13749 | packed.append(struct.pack("!H", self.err_type)) |
| 13750 | packed.append(struct.pack("!H", self.code)) |
| 13751 | packed.append(self.data) |
| 13752 | length = sum([len(x) for x in packed]) |
| 13753 | packed[2] = struct.pack("!H", length) |
| 13754 | return ''.join(packed) |
| 13755 | |
| 13756 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13757 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13758 | obj = queue_op_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13759 | _version = reader.read("!B")[0] |
| 13760 | assert(_version == 4) |
| 13761 | _type = reader.read("!B")[0] |
| 13762 | assert(_type == 1) |
| 13763 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13764 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 13765 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13766 | obj.xid = reader.read("!L")[0] |
| 13767 | _err_type = reader.read("!H")[0] |
| 13768 | assert(_err_type == 9) |
| 13769 | obj.code = reader.read("!H")[0] |
| 13770 | obj.data = str(reader.read_all()) |
| 13771 | return obj |
| 13772 | |
| 13773 | def __eq__(self, other): |
| 13774 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13775 | if self.xid != other.xid: return False |
| 13776 | if self.code != other.code: return False |
| 13777 | if self.data != other.data: return False |
| 13778 | return True |
| 13779 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13780 | def pretty_print(self, q): |
| 13781 | q.text("queue_op_failed_error_msg {") |
| 13782 | with q.group(): |
| 13783 | with q.indent(2): |
| 13784 | q.breakable() |
| 13785 | q.text("xid = "); |
| 13786 | if self.xid != None: |
| 13787 | q.text("%#x" % self.xid) |
| 13788 | else: |
| 13789 | q.text('None') |
| 13790 | q.text(","); q.breakable() |
| 13791 | q.text("code = "); |
| 13792 | q.text("%#x" % self.code) |
| 13793 | q.text(","); q.breakable() |
| 13794 | q.text("data = "); |
| 13795 | q.pp(self.data) |
| 13796 | q.breakable() |
| 13797 | q.text('}') |
| 13798 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13799 | error_msg.subtypes[9] = queue_op_failed_error_msg |
| 13800 | |
| 13801 | class queue_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13802 | version = 4 |
| 13803 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13804 | stats_type = 5 |
| 13805 | |
| 13806 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13807 | if xid != None: |
| 13808 | self.xid = xid |
| 13809 | else: |
| 13810 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13811 | if flags != None: |
| 13812 | self.flags = flags |
| 13813 | else: |
| 13814 | self.flags = 0 |
| 13815 | if entries != None: |
| 13816 | self.entries = entries |
| 13817 | else: |
| 13818 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13819 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13820 | |
| 13821 | def pack(self): |
| 13822 | packed = [] |
| 13823 | packed.append(struct.pack("!B", self.version)) |
| 13824 | packed.append(struct.pack("!B", self.type)) |
| 13825 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13826 | packed.append(struct.pack("!L", self.xid)) |
| 13827 | packed.append(struct.pack("!H", self.stats_type)) |
| 13828 | packed.append(struct.pack("!H", self.flags)) |
| 13829 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13830 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13831 | length = sum([len(x) for x in packed]) |
| 13832 | packed[2] = struct.pack("!H", length) |
| 13833 | return ''.join(packed) |
| 13834 | |
| 13835 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13836 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13837 | obj = queue_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13838 | _version = reader.read("!B")[0] |
| 13839 | assert(_version == 4) |
| 13840 | _type = reader.read("!B")[0] |
| 13841 | assert(_type == 19) |
| 13842 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13843 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 13844 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13845 | obj.xid = reader.read("!L")[0] |
| 13846 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13847 | assert(_stats_type == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13848 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13849 | reader.skip(4) |
| 13850 | obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack) |
| 13851 | return obj |
| 13852 | |
| 13853 | def __eq__(self, other): |
| 13854 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13855 | if self.xid != other.xid: return False |
| 13856 | if self.flags != other.flags: return False |
| 13857 | if self.entries != other.entries: return False |
| 13858 | return True |
| 13859 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13860 | def pretty_print(self, q): |
| 13861 | q.text("queue_stats_reply {") |
| 13862 | with q.group(): |
| 13863 | with q.indent(2): |
| 13864 | q.breakable() |
| 13865 | q.text("xid = "); |
| 13866 | if self.xid != None: |
| 13867 | q.text("%#x" % self.xid) |
| 13868 | else: |
| 13869 | q.text('None') |
| 13870 | q.text(","); q.breakable() |
| 13871 | q.text("flags = "); |
| 13872 | q.text("%#x" % self.flags) |
| 13873 | q.text(","); q.breakable() |
| 13874 | q.text("entries = "); |
| 13875 | q.pp(self.entries) |
| 13876 | q.breakable() |
| 13877 | q.text('}') |
| 13878 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13879 | stats_reply.subtypes[5] = queue_stats_reply |
| 13880 | |
| 13881 | class queue_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13882 | version = 4 |
| 13883 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13884 | stats_type = 5 |
| 13885 | |
| 13886 | 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] | 13887 | if xid != None: |
| 13888 | self.xid = xid |
| 13889 | else: |
| 13890 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13891 | if flags != None: |
| 13892 | self.flags = flags |
| 13893 | else: |
| 13894 | self.flags = 0 |
| 13895 | if port_no != None: |
| 13896 | self.port_no = port_no |
| 13897 | else: |
| 13898 | self.port_no = 0 |
| 13899 | if queue_id != None: |
| 13900 | self.queue_id = queue_id |
| 13901 | else: |
| 13902 | self.queue_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13903 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13904 | |
| 13905 | def pack(self): |
| 13906 | packed = [] |
| 13907 | packed.append(struct.pack("!B", self.version)) |
| 13908 | packed.append(struct.pack("!B", self.type)) |
| 13909 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13910 | packed.append(struct.pack("!L", self.xid)) |
| 13911 | packed.append(struct.pack("!H", self.stats_type)) |
| 13912 | packed.append(struct.pack("!H", self.flags)) |
| 13913 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13914 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13915 | packed.append(struct.pack("!L", self.queue_id)) |
| 13916 | length = sum([len(x) for x in packed]) |
| 13917 | packed[2] = struct.pack("!H", length) |
| 13918 | return ''.join(packed) |
| 13919 | |
| 13920 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13921 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13922 | obj = queue_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13923 | _version = reader.read("!B")[0] |
| 13924 | assert(_version == 4) |
| 13925 | _type = reader.read("!B")[0] |
| 13926 | assert(_type == 18) |
| 13927 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13928 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 13929 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13930 | obj.xid = reader.read("!L")[0] |
| 13931 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13932 | assert(_stats_type == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13933 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13934 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13935 | obj.port_no = util.unpack_port_no(reader) |
| 13936 | obj.queue_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13937 | return obj |
| 13938 | |
| 13939 | def __eq__(self, other): |
| 13940 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13941 | if self.xid != other.xid: return False |
| 13942 | if self.flags != other.flags: return False |
| 13943 | if self.port_no != other.port_no: return False |
| 13944 | if self.queue_id != other.queue_id: return False |
| 13945 | return True |
| 13946 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13947 | def pretty_print(self, q): |
| 13948 | q.text("queue_stats_request {") |
| 13949 | with q.group(): |
| 13950 | with q.indent(2): |
| 13951 | q.breakable() |
| 13952 | q.text("xid = "); |
| 13953 | if self.xid != None: |
| 13954 | q.text("%#x" % self.xid) |
| 13955 | else: |
| 13956 | q.text('None') |
| 13957 | q.text(","); q.breakable() |
| 13958 | q.text("flags = "); |
| 13959 | q.text("%#x" % self.flags) |
| 13960 | q.text(","); q.breakable() |
| 13961 | q.text("port_no = "); |
| 13962 | q.text(util.pretty_port(self.port_no)) |
| 13963 | q.text(","); q.breakable() |
| 13964 | q.text("queue_id = "); |
| 13965 | q.text("%#x" % self.queue_id) |
| 13966 | q.breakable() |
| 13967 | q.text('}') |
| 13968 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13969 | stats_request.subtypes[5] = queue_stats_request |
| 13970 | |
| 13971 | class role_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13972 | version = 4 |
| 13973 | type = 25 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13974 | |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 13975 | def __init__(self, xid=None, role=None, generation_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13976 | if xid != None: |
| 13977 | self.xid = xid |
| 13978 | else: |
| 13979 | self.xid = None |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 13980 | if role != None: |
| 13981 | self.role = role |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13982 | else: |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 13983 | self.role = 0 |
| 13984 | if generation_id != None: |
| 13985 | self.generation_id = generation_id |
| 13986 | else: |
| 13987 | self.generation_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13988 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13989 | |
| 13990 | def pack(self): |
| 13991 | packed = [] |
| 13992 | packed.append(struct.pack("!B", self.version)) |
| 13993 | packed.append(struct.pack("!B", self.type)) |
| 13994 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13995 | packed.append(struct.pack("!L", self.xid)) |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 13996 | packed.append(struct.pack("!L", self.role)) |
| 13997 | packed.append('\x00' * 4) |
| 13998 | packed.append(struct.pack("!Q", self.generation_id)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13999 | length = sum([len(x) for x in packed]) |
| 14000 | packed[2] = struct.pack("!H", length) |
| 14001 | return ''.join(packed) |
| 14002 | |
| 14003 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14004 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14005 | obj = role_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14006 | _version = reader.read("!B")[0] |
| 14007 | assert(_version == 4) |
| 14008 | _type = reader.read("!B")[0] |
| 14009 | assert(_type == 25) |
| 14010 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14011 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 14012 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14013 | obj.xid = reader.read("!L")[0] |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 14014 | obj.role = reader.read("!L")[0] |
| 14015 | reader.skip(4) |
| 14016 | obj.generation_id = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14017 | return obj |
| 14018 | |
| 14019 | def __eq__(self, other): |
| 14020 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14021 | if self.xid != other.xid: return False |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 14022 | if self.role != other.role: return False |
| 14023 | if self.generation_id != other.generation_id: return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14024 | return True |
| 14025 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14026 | def pretty_print(self, q): |
| 14027 | q.text("role_reply {") |
| 14028 | with q.group(): |
| 14029 | with q.indent(2): |
| 14030 | q.breakable() |
| 14031 | q.text("xid = "); |
| 14032 | if self.xid != None: |
| 14033 | q.text("%#x" % self.xid) |
| 14034 | else: |
| 14035 | q.text('None') |
| 14036 | q.text(","); q.breakable() |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 14037 | q.text("role = "); |
| 14038 | q.text("%#x" % self.role) |
| 14039 | q.text(","); q.breakable() |
| 14040 | q.text("generation_id = "); |
| 14041 | q.text("%#x" % self.generation_id) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14042 | q.breakable() |
| 14043 | q.text('}') |
| 14044 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14045 | message.subtypes[25] = role_reply |
| 14046 | |
| 14047 | class role_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14048 | version = 4 |
| 14049 | type = 24 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14050 | |
| 14051 | def __init__(self, xid=None, role=None, generation_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14052 | if xid != None: |
| 14053 | self.xid = xid |
| 14054 | else: |
| 14055 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14056 | if role != None: |
| 14057 | self.role = role |
| 14058 | else: |
| 14059 | self.role = 0 |
| 14060 | if generation_id != None: |
| 14061 | self.generation_id = generation_id |
| 14062 | else: |
| 14063 | self.generation_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14064 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14065 | |
| 14066 | def pack(self): |
| 14067 | packed = [] |
| 14068 | packed.append(struct.pack("!B", self.version)) |
| 14069 | packed.append(struct.pack("!B", self.type)) |
| 14070 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14071 | packed.append(struct.pack("!L", self.xid)) |
| 14072 | packed.append(struct.pack("!L", self.role)) |
| 14073 | packed.append('\x00' * 4) |
| 14074 | packed.append(struct.pack("!Q", self.generation_id)) |
| 14075 | length = sum([len(x) for x in packed]) |
| 14076 | packed[2] = struct.pack("!H", length) |
| 14077 | return ''.join(packed) |
| 14078 | |
| 14079 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14080 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14081 | obj = role_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14082 | _version = reader.read("!B")[0] |
| 14083 | assert(_version == 4) |
| 14084 | _type = reader.read("!B")[0] |
| 14085 | assert(_type == 24) |
| 14086 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14087 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 14088 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14089 | obj.xid = reader.read("!L")[0] |
| 14090 | obj.role = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14091 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14092 | obj.generation_id = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14093 | return obj |
| 14094 | |
| 14095 | def __eq__(self, other): |
| 14096 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14097 | if self.xid != other.xid: return False |
| 14098 | if self.role != other.role: return False |
| 14099 | if self.generation_id != other.generation_id: return False |
| 14100 | return True |
| 14101 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14102 | def pretty_print(self, q): |
| 14103 | q.text("role_request {") |
| 14104 | with q.group(): |
| 14105 | with q.indent(2): |
| 14106 | q.breakable() |
| 14107 | q.text("xid = "); |
| 14108 | if self.xid != None: |
| 14109 | q.text("%#x" % self.xid) |
| 14110 | else: |
| 14111 | q.text('None') |
| 14112 | q.text(","); q.breakable() |
| 14113 | q.text("role = "); |
| 14114 | q.text("%#x" % self.role) |
| 14115 | q.text(","); q.breakable() |
| 14116 | q.text("generation_id = "); |
| 14117 | q.text("%#x" % self.generation_id) |
| 14118 | q.breakable() |
| 14119 | q.text('}') |
| 14120 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14121 | message.subtypes[24] = role_request |
| 14122 | |
| 14123 | class role_request_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14124 | version = 4 |
| 14125 | type = 1 |
| 14126 | err_type = 11 |
| 14127 | |
| 14128 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14129 | if xid != None: |
| 14130 | self.xid = xid |
| 14131 | else: |
| 14132 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14133 | if code != None: |
| 14134 | self.code = code |
| 14135 | else: |
| 14136 | self.code = 0 |
| 14137 | if data != None: |
| 14138 | self.data = data |
| 14139 | else: |
| 14140 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14141 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14142 | |
| 14143 | def pack(self): |
| 14144 | packed = [] |
| 14145 | packed.append(struct.pack("!B", self.version)) |
| 14146 | packed.append(struct.pack("!B", self.type)) |
| 14147 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14148 | packed.append(struct.pack("!L", self.xid)) |
| 14149 | packed.append(struct.pack("!H", self.err_type)) |
| 14150 | packed.append(struct.pack("!H", self.code)) |
| 14151 | packed.append(self.data) |
| 14152 | length = sum([len(x) for x in packed]) |
| 14153 | packed[2] = struct.pack("!H", length) |
| 14154 | return ''.join(packed) |
| 14155 | |
| 14156 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14157 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14158 | obj = role_request_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14159 | _version = reader.read("!B")[0] |
| 14160 | assert(_version == 4) |
| 14161 | _type = reader.read("!B")[0] |
| 14162 | assert(_type == 1) |
| 14163 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14164 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 14165 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14166 | obj.xid = reader.read("!L")[0] |
| 14167 | _err_type = reader.read("!H")[0] |
| 14168 | assert(_err_type == 11) |
| 14169 | obj.code = reader.read("!H")[0] |
| 14170 | obj.data = str(reader.read_all()) |
| 14171 | return obj |
| 14172 | |
| 14173 | def __eq__(self, other): |
| 14174 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14175 | if self.xid != other.xid: return False |
| 14176 | if self.code != other.code: return False |
| 14177 | if self.data != other.data: return False |
| 14178 | return True |
| 14179 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14180 | def pretty_print(self, q): |
| 14181 | q.text("role_request_failed_error_msg {") |
| 14182 | with q.group(): |
| 14183 | with q.indent(2): |
| 14184 | q.breakable() |
| 14185 | q.text("xid = "); |
| 14186 | if self.xid != None: |
| 14187 | q.text("%#x" % self.xid) |
| 14188 | else: |
| 14189 | q.text('None') |
| 14190 | q.text(","); q.breakable() |
| 14191 | q.text("code = "); |
| 14192 | q.text("%#x" % self.code) |
| 14193 | q.text(","); q.breakable() |
| 14194 | q.text("data = "); |
| 14195 | q.pp(self.data) |
| 14196 | q.breakable() |
| 14197 | q.text('}') |
| 14198 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14199 | error_msg.subtypes[11] = role_request_failed_error_msg |
| 14200 | |
| 14201 | class set_config(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14202 | version = 4 |
| 14203 | type = 9 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14204 | |
| 14205 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14206 | if xid != None: |
| 14207 | self.xid = xid |
| 14208 | else: |
| 14209 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14210 | if flags != None: |
| 14211 | self.flags = flags |
| 14212 | else: |
| 14213 | self.flags = 0 |
| 14214 | if miss_send_len != None: |
| 14215 | self.miss_send_len = miss_send_len |
| 14216 | else: |
| 14217 | self.miss_send_len = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14218 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14219 | |
| 14220 | def pack(self): |
| 14221 | packed = [] |
| 14222 | packed.append(struct.pack("!B", self.version)) |
| 14223 | packed.append(struct.pack("!B", self.type)) |
| 14224 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14225 | packed.append(struct.pack("!L", self.xid)) |
| 14226 | packed.append(struct.pack("!H", self.flags)) |
| 14227 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 14228 | length = sum([len(x) for x in packed]) |
| 14229 | packed[2] = struct.pack("!H", length) |
| 14230 | return ''.join(packed) |
| 14231 | |
| 14232 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14233 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14234 | obj = set_config() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14235 | _version = reader.read("!B")[0] |
| 14236 | assert(_version == 4) |
| 14237 | _type = reader.read("!B")[0] |
| 14238 | assert(_type == 9) |
| 14239 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14240 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 14241 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14242 | obj.xid = reader.read("!L")[0] |
| 14243 | obj.flags = reader.read("!H")[0] |
| 14244 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14245 | return obj |
| 14246 | |
| 14247 | def __eq__(self, other): |
| 14248 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14249 | if self.xid != other.xid: return False |
| 14250 | if self.flags != other.flags: return False |
| 14251 | if self.miss_send_len != other.miss_send_len: return False |
| 14252 | return True |
| 14253 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14254 | def pretty_print(self, q): |
| 14255 | q.text("set_config {") |
| 14256 | with q.group(): |
| 14257 | with q.indent(2): |
| 14258 | q.breakable() |
| 14259 | q.text("xid = "); |
| 14260 | if self.xid != None: |
| 14261 | q.text("%#x" % self.xid) |
| 14262 | else: |
| 14263 | q.text('None') |
| 14264 | q.text(","); q.breakable() |
| 14265 | q.text("flags = "); |
| 14266 | q.text("%#x" % self.flags) |
| 14267 | q.text(","); q.breakable() |
| 14268 | q.text("miss_send_len = "); |
| 14269 | q.text("%#x" % self.miss_send_len) |
| 14270 | q.breakable() |
| 14271 | q.text('}') |
| 14272 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14273 | message.subtypes[9] = set_config |
| 14274 | |
| 14275 | class switch_config_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14276 | version = 4 |
| 14277 | type = 1 |
| 14278 | err_type = 10 |
| 14279 | |
| 14280 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14281 | if xid != None: |
| 14282 | self.xid = xid |
| 14283 | else: |
| 14284 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14285 | if code != None: |
| 14286 | self.code = code |
| 14287 | else: |
| 14288 | self.code = 0 |
| 14289 | if data != None: |
| 14290 | self.data = data |
| 14291 | else: |
| 14292 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14293 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14294 | |
| 14295 | def pack(self): |
| 14296 | packed = [] |
| 14297 | packed.append(struct.pack("!B", self.version)) |
| 14298 | packed.append(struct.pack("!B", self.type)) |
| 14299 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14300 | packed.append(struct.pack("!L", self.xid)) |
| 14301 | packed.append(struct.pack("!H", self.err_type)) |
| 14302 | packed.append(struct.pack("!H", self.code)) |
| 14303 | packed.append(self.data) |
| 14304 | length = sum([len(x) for x in packed]) |
| 14305 | packed[2] = struct.pack("!H", length) |
| 14306 | return ''.join(packed) |
| 14307 | |
| 14308 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14309 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14310 | obj = switch_config_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14311 | _version = reader.read("!B")[0] |
| 14312 | assert(_version == 4) |
| 14313 | _type = reader.read("!B")[0] |
| 14314 | assert(_type == 1) |
| 14315 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14316 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 14317 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14318 | obj.xid = reader.read("!L")[0] |
| 14319 | _err_type = reader.read("!H")[0] |
| 14320 | assert(_err_type == 10) |
| 14321 | obj.code = reader.read("!H")[0] |
| 14322 | obj.data = str(reader.read_all()) |
| 14323 | return obj |
| 14324 | |
| 14325 | def __eq__(self, other): |
| 14326 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14327 | if self.xid != other.xid: return False |
| 14328 | if self.code != other.code: return False |
| 14329 | if self.data != other.data: return False |
| 14330 | return True |
| 14331 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14332 | def pretty_print(self, q): |
| 14333 | q.text("switch_config_failed_error_msg {") |
| 14334 | with q.group(): |
| 14335 | with q.indent(2): |
| 14336 | q.breakable() |
| 14337 | q.text("xid = "); |
| 14338 | if self.xid != None: |
| 14339 | q.text("%#x" % self.xid) |
| 14340 | else: |
| 14341 | q.text('None') |
| 14342 | q.text(","); q.breakable() |
| 14343 | q.text("code = "); |
| 14344 | q.text("%#x" % self.code) |
| 14345 | q.text(","); q.breakable() |
| 14346 | q.text("data = "); |
| 14347 | q.pp(self.data) |
| 14348 | q.breakable() |
| 14349 | q.text('}') |
| 14350 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14351 | error_msg.subtypes[10] = switch_config_failed_error_msg |
| 14352 | |
| 14353 | class table_features_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14354 | version = 4 |
| 14355 | type = 1 |
| 14356 | err_type = 13 |
| 14357 | |
| 14358 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14359 | if xid != None: |
| 14360 | self.xid = xid |
| 14361 | else: |
| 14362 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14363 | if code != None: |
| 14364 | self.code = code |
| 14365 | else: |
| 14366 | self.code = 0 |
| 14367 | if data != None: |
| 14368 | self.data = data |
| 14369 | else: |
| 14370 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14371 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14372 | |
| 14373 | def pack(self): |
| 14374 | packed = [] |
| 14375 | packed.append(struct.pack("!B", self.version)) |
| 14376 | packed.append(struct.pack("!B", self.type)) |
| 14377 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14378 | packed.append(struct.pack("!L", self.xid)) |
| 14379 | packed.append(struct.pack("!H", self.err_type)) |
| 14380 | packed.append(struct.pack("!H", self.code)) |
| 14381 | packed.append(self.data) |
| 14382 | length = sum([len(x) for x in packed]) |
| 14383 | packed[2] = struct.pack("!H", length) |
| 14384 | return ''.join(packed) |
| 14385 | |
| 14386 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14387 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14388 | obj = table_features_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14389 | _version = reader.read("!B")[0] |
| 14390 | assert(_version == 4) |
| 14391 | _type = reader.read("!B")[0] |
| 14392 | assert(_type == 1) |
| 14393 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14394 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 14395 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14396 | obj.xid = reader.read("!L")[0] |
| 14397 | _err_type = reader.read("!H")[0] |
| 14398 | assert(_err_type == 13) |
| 14399 | obj.code = reader.read("!H")[0] |
| 14400 | obj.data = str(reader.read_all()) |
| 14401 | return obj |
| 14402 | |
| 14403 | def __eq__(self, other): |
| 14404 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14405 | if self.xid != other.xid: return False |
| 14406 | if self.code != other.code: return False |
| 14407 | if self.data != other.data: return False |
| 14408 | return True |
| 14409 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14410 | def pretty_print(self, q): |
| 14411 | q.text("table_features_failed_error_msg {") |
| 14412 | with q.group(): |
| 14413 | with q.indent(2): |
| 14414 | q.breakable() |
| 14415 | q.text("xid = "); |
| 14416 | if self.xid != None: |
| 14417 | q.text("%#x" % self.xid) |
| 14418 | else: |
| 14419 | q.text('None') |
| 14420 | q.text(","); q.breakable() |
| 14421 | q.text("code = "); |
| 14422 | q.text("%#x" % self.code) |
| 14423 | q.text(","); q.breakable() |
| 14424 | q.text("data = "); |
| 14425 | q.pp(self.data) |
| 14426 | q.breakable() |
| 14427 | q.text('}') |
| 14428 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14429 | error_msg.subtypes[13] = table_features_failed_error_msg |
| 14430 | |
| 14431 | class table_features_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14432 | version = 4 |
| 14433 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14434 | stats_type = 12 |
| 14435 | |
| 14436 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14437 | if xid != None: |
| 14438 | self.xid = xid |
| 14439 | else: |
| 14440 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14441 | if flags != None: |
| 14442 | self.flags = flags |
| 14443 | else: |
| 14444 | self.flags = 0 |
| 14445 | if entries != None: |
| 14446 | self.entries = entries |
| 14447 | else: |
| 14448 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14449 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14450 | |
| 14451 | def pack(self): |
| 14452 | packed = [] |
| 14453 | packed.append(struct.pack("!B", self.version)) |
| 14454 | packed.append(struct.pack("!B", self.type)) |
| 14455 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14456 | packed.append(struct.pack("!L", self.xid)) |
| 14457 | packed.append(struct.pack("!H", self.stats_type)) |
| 14458 | packed.append(struct.pack("!H", self.flags)) |
| 14459 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14460 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14461 | length = sum([len(x) for x in packed]) |
| 14462 | packed[2] = struct.pack("!H", length) |
| 14463 | return ''.join(packed) |
| 14464 | |
| 14465 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14466 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14467 | obj = table_features_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14468 | _version = reader.read("!B")[0] |
| 14469 | assert(_version == 4) |
| 14470 | _type = reader.read("!B")[0] |
| 14471 | assert(_type == 19) |
| 14472 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14473 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 14474 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14475 | obj.xid = reader.read("!L")[0] |
| 14476 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14477 | assert(_stats_type == 12) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14478 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14479 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14480 | obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14481 | return obj |
| 14482 | |
| 14483 | def __eq__(self, other): |
| 14484 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14485 | if self.xid != other.xid: return False |
| 14486 | if self.flags != other.flags: return False |
| 14487 | if self.entries != other.entries: return False |
| 14488 | return True |
| 14489 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14490 | def pretty_print(self, q): |
| 14491 | q.text("table_features_stats_reply {") |
| 14492 | with q.group(): |
| 14493 | with q.indent(2): |
| 14494 | q.breakable() |
| 14495 | q.text("xid = "); |
| 14496 | if self.xid != None: |
| 14497 | q.text("%#x" % self.xid) |
| 14498 | else: |
| 14499 | q.text('None') |
| 14500 | q.text(","); q.breakable() |
| 14501 | q.text("flags = "); |
| 14502 | q.text("%#x" % self.flags) |
| 14503 | q.text(","); q.breakable() |
| 14504 | q.text("entries = "); |
| 14505 | q.pp(self.entries) |
| 14506 | q.breakable() |
| 14507 | q.text('}') |
| 14508 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14509 | stats_reply.subtypes[12] = table_features_stats_reply |
| 14510 | |
| 14511 | class table_features_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14512 | version = 4 |
| 14513 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14514 | stats_type = 12 |
| 14515 | |
| 14516 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14517 | if xid != None: |
| 14518 | self.xid = xid |
| 14519 | else: |
| 14520 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14521 | if flags != None: |
| 14522 | self.flags = flags |
| 14523 | else: |
| 14524 | self.flags = 0 |
| 14525 | if entries != None: |
| 14526 | self.entries = entries |
| 14527 | else: |
| 14528 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14529 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14530 | |
| 14531 | def pack(self): |
| 14532 | packed = [] |
| 14533 | packed.append(struct.pack("!B", self.version)) |
| 14534 | packed.append(struct.pack("!B", self.type)) |
| 14535 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14536 | packed.append(struct.pack("!L", self.xid)) |
| 14537 | packed.append(struct.pack("!H", self.stats_type)) |
| 14538 | packed.append(struct.pack("!H", self.flags)) |
| 14539 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14540 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14541 | length = sum([len(x) for x in packed]) |
| 14542 | packed[2] = struct.pack("!H", length) |
| 14543 | return ''.join(packed) |
| 14544 | |
| 14545 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14546 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14547 | obj = table_features_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14548 | _version = reader.read("!B")[0] |
| 14549 | assert(_version == 4) |
| 14550 | _type = reader.read("!B")[0] |
| 14551 | assert(_type == 18) |
| 14552 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14553 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 14554 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14555 | obj.xid = reader.read("!L")[0] |
| 14556 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14557 | assert(_stats_type == 12) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14558 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14559 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14560 | obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14561 | return obj |
| 14562 | |
| 14563 | def __eq__(self, other): |
| 14564 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14565 | if self.xid != other.xid: return False |
| 14566 | if self.flags != other.flags: return False |
| 14567 | if self.entries != other.entries: return False |
| 14568 | return True |
| 14569 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14570 | def pretty_print(self, q): |
| 14571 | q.text("table_features_stats_request {") |
| 14572 | with q.group(): |
| 14573 | with q.indent(2): |
| 14574 | q.breakable() |
| 14575 | q.text("xid = "); |
| 14576 | if self.xid != None: |
| 14577 | q.text("%#x" % self.xid) |
| 14578 | else: |
| 14579 | q.text('None') |
| 14580 | q.text(","); q.breakable() |
| 14581 | q.text("flags = "); |
| 14582 | q.text("%#x" % self.flags) |
| 14583 | q.text(","); q.breakable() |
| 14584 | q.text("entries = "); |
| 14585 | q.pp(self.entries) |
| 14586 | q.breakable() |
| 14587 | q.text('}') |
| 14588 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14589 | stats_request.subtypes[12] = table_features_stats_request |
| 14590 | |
| 14591 | class table_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14592 | version = 4 |
| 14593 | type = 17 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14594 | |
| 14595 | def __init__(self, xid=None, table_id=None, config=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14596 | if xid != None: |
| 14597 | self.xid = xid |
| 14598 | else: |
| 14599 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14600 | if table_id != None: |
| 14601 | self.table_id = table_id |
| 14602 | else: |
| 14603 | self.table_id = 0 |
| 14604 | if config != None: |
| 14605 | self.config = config |
| 14606 | else: |
| 14607 | self.config = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14608 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14609 | |
| 14610 | def pack(self): |
| 14611 | packed = [] |
| 14612 | packed.append(struct.pack("!B", self.version)) |
| 14613 | packed.append(struct.pack("!B", self.type)) |
| 14614 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14615 | packed.append(struct.pack("!L", self.xid)) |
| 14616 | packed.append(struct.pack("!B", self.table_id)) |
| 14617 | packed.append('\x00' * 3) |
| 14618 | packed.append(struct.pack("!L", self.config)) |
| 14619 | length = sum([len(x) for x in packed]) |
| 14620 | packed[2] = struct.pack("!H", length) |
| 14621 | return ''.join(packed) |
| 14622 | |
| 14623 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14624 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14625 | obj = table_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14626 | _version = reader.read("!B")[0] |
| 14627 | assert(_version == 4) |
| 14628 | _type = reader.read("!B")[0] |
| 14629 | assert(_type == 17) |
| 14630 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14631 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 14632 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14633 | obj.xid = reader.read("!L")[0] |
| 14634 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14635 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14636 | obj.config = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14637 | return obj |
| 14638 | |
| 14639 | def __eq__(self, other): |
| 14640 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14641 | if self.xid != other.xid: return False |
| 14642 | if self.table_id != other.table_id: return False |
| 14643 | if self.config != other.config: return False |
| 14644 | return True |
| 14645 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14646 | def pretty_print(self, q): |
| 14647 | q.text("table_mod {") |
| 14648 | with q.group(): |
| 14649 | with q.indent(2): |
| 14650 | q.breakable() |
| 14651 | q.text("xid = "); |
| 14652 | if self.xid != None: |
| 14653 | q.text("%#x" % self.xid) |
| 14654 | else: |
| 14655 | q.text('None') |
| 14656 | q.text(","); q.breakable() |
| 14657 | q.text("table_id = "); |
| 14658 | q.text("%#x" % self.table_id) |
| 14659 | q.text(","); q.breakable() |
| 14660 | q.text("config = "); |
| 14661 | q.text("%#x" % self.config) |
| 14662 | q.breakable() |
| 14663 | q.text('}') |
| 14664 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14665 | message.subtypes[17] = table_mod |
| 14666 | |
| 14667 | class table_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14668 | version = 4 |
| 14669 | type = 1 |
| 14670 | err_type = 8 |
| 14671 | |
| 14672 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14673 | if xid != None: |
| 14674 | self.xid = xid |
| 14675 | else: |
| 14676 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14677 | if code != None: |
| 14678 | self.code = code |
| 14679 | else: |
| 14680 | self.code = 0 |
| 14681 | if data != None: |
| 14682 | self.data = data |
| 14683 | else: |
| 14684 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14685 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14686 | |
| 14687 | def pack(self): |
| 14688 | packed = [] |
| 14689 | packed.append(struct.pack("!B", self.version)) |
| 14690 | packed.append(struct.pack("!B", self.type)) |
| 14691 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14692 | packed.append(struct.pack("!L", self.xid)) |
| 14693 | packed.append(struct.pack("!H", self.err_type)) |
| 14694 | packed.append(struct.pack("!H", self.code)) |
| 14695 | packed.append(self.data) |
| 14696 | length = sum([len(x) for x in packed]) |
| 14697 | packed[2] = struct.pack("!H", length) |
| 14698 | return ''.join(packed) |
| 14699 | |
| 14700 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14701 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14702 | obj = table_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14703 | _version = reader.read("!B")[0] |
| 14704 | assert(_version == 4) |
| 14705 | _type = reader.read("!B")[0] |
| 14706 | assert(_type == 1) |
| 14707 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14708 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 14709 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14710 | obj.xid = reader.read("!L")[0] |
| 14711 | _err_type = reader.read("!H")[0] |
| 14712 | assert(_err_type == 8) |
| 14713 | obj.code = reader.read("!H")[0] |
| 14714 | obj.data = str(reader.read_all()) |
| 14715 | return obj |
| 14716 | |
| 14717 | def __eq__(self, other): |
| 14718 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14719 | if self.xid != other.xid: return False |
| 14720 | if self.code != other.code: return False |
| 14721 | if self.data != other.data: return False |
| 14722 | return True |
| 14723 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14724 | def pretty_print(self, q): |
| 14725 | q.text("table_mod_failed_error_msg {") |
| 14726 | with q.group(): |
| 14727 | with q.indent(2): |
| 14728 | q.breakable() |
| 14729 | q.text("xid = "); |
| 14730 | if self.xid != None: |
| 14731 | q.text("%#x" % self.xid) |
| 14732 | else: |
| 14733 | q.text('None') |
| 14734 | q.text(","); q.breakable() |
| 14735 | q.text("code = "); |
| 14736 | q.text("%#x" % self.code) |
| 14737 | q.text(","); q.breakable() |
| 14738 | q.text("data = "); |
| 14739 | q.pp(self.data) |
| 14740 | q.breakable() |
| 14741 | q.text('}') |
| 14742 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14743 | error_msg.subtypes[8] = table_mod_failed_error_msg |
| 14744 | |
| 14745 | class table_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14746 | version = 4 |
| 14747 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14748 | stats_type = 3 |
| 14749 | |
| 14750 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14751 | if xid != None: |
| 14752 | self.xid = xid |
| 14753 | else: |
| 14754 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14755 | if flags != None: |
| 14756 | self.flags = flags |
| 14757 | else: |
| 14758 | self.flags = 0 |
| 14759 | if entries != None: |
| 14760 | self.entries = entries |
| 14761 | else: |
| 14762 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14763 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14764 | |
| 14765 | def pack(self): |
| 14766 | packed = [] |
| 14767 | packed.append(struct.pack("!B", self.version)) |
| 14768 | packed.append(struct.pack("!B", self.type)) |
| 14769 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14770 | packed.append(struct.pack("!L", self.xid)) |
| 14771 | packed.append(struct.pack("!H", self.stats_type)) |
| 14772 | packed.append(struct.pack("!H", self.flags)) |
| 14773 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14774 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14775 | length = sum([len(x) for x in packed]) |
| 14776 | packed[2] = struct.pack("!H", length) |
| 14777 | return ''.join(packed) |
| 14778 | |
| 14779 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14780 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14781 | obj = table_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14782 | _version = reader.read("!B")[0] |
| 14783 | assert(_version == 4) |
| 14784 | _type = reader.read("!B")[0] |
| 14785 | assert(_type == 19) |
| 14786 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14787 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 14788 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14789 | obj.xid = reader.read("!L")[0] |
| 14790 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14791 | assert(_stats_type == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14792 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14793 | reader.skip(4) |
| 14794 | obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack) |
| 14795 | return obj |
| 14796 | |
| 14797 | def __eq__(self, other): |
| 14798 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14799 | if self.xid != other.xid: return False |
| 14800 | if self.flags != other.flags: return False |
| 14801 | if self.entries != other.entries: return False |
| 14802 | return True |
| 14803 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14804 | def pretty_print(self, q): |
| 14805 | q.text("table_stats_reply {") |
| 14806 | with q.group(): |
| 14807 | with q.indent(2): |
| 14808 | q.breakable() |
| 14809 | q.text("xid = "); |
| 14810 | if self.xid != None: |
| 14811 | q.text("%#x" % self.xid) |
| 14812 | else: |
| 14813 | q.text('None') |
| 14814 | q.text(","); q.breakable() |
| 14815 | q.text("flags = "); |
| 14816 | q.text("%#x" % self.flags) |
| 14817 | q.text(","); q.breakable() |
| 14818 | q.text("entries = "); |
| 14819 | q.pp(self.entries) |
| 14820 | q.breakable() |
| 14821 | q.text('}') |
| 14822 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14823 | stats_reply.subtypes[3] = table_stats_reply |
| 14824 | |
| 14825 | class table_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14826 | version = 4 |
| 14827 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14828 | stats_type = 3 |
| 14829 | |
| 14830 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14831 | if xid != None: |
| 14832 | self.xid = xid |
| 14833 | else: |
| 14834 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14835 | if flags != None: |
| 14836 | self.flags = flags |
| 14837 | else: |
| 14838 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14839 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14840 | |
| 14841 | def pack(self): |
| 14842 | packed = [] |
| 14843 | packed.append(struct.pack("!B", self.version)) |
| 14844 | packed.append(struct.pack("!B", self.type)) |
| 14845 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14846 | packed.append(struct.pack("!L", self.xid)) |
| 14847 | packed.append(struct.pack("!H", self.stats_type)) |
| 14848 | packed.append(struct.pack("!H", self.flags)) |
| 14849 | packed.append('\x00' * 4) |
| 14850 | length = sum([len(x) for x in packed]) |
| 14851 | packed[2] = struct.pack("!H", length) |
| 14852 | return ''.join(packed) |
| 14853 | |
| 14854 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14855 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14856 | obj = table_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14857 | _version = reader.read("!B")[0] |
| 14858 | assert(_version == 4) |
| 14859 | _type = reader.read("!B")[0] |
| 14860 | assert(_type == 18) |
| 14861 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14862 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 14863 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14864 | obj.xid = reader.read("!L")[0] |
| 14865 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14866 | assert(_stats_type == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14867 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14868 | reader.skip(4) |
| 14869 | return obj |
| 14870 | |
| 14871 | def __eq__(self, other): |
| 14872 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14873 | if self.xid != other.xid: return False |
| 14874 | if self.flags != other.flags: return False |
| 14875 | return True |
| 14876 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14877 | def pretty_print(self, q): |
| 14878 | q.text("table_stats_request {") |
| 14879 | with q.group(): |
| 14880 | with q.indent(2): |
| 14881 | q.breakable() |
| 14882 | q.text("xid = "); |
| 14883 | if self.xid != None: |
| 14884 | q.text("%#x" % self.xid) |
| 14885 | else: |
| 14886 | q.text('None') |
| 14887 | q.text(","); q.breakable() |
| 14888 | q.text("flags = "); |
| 14889 | q.text("%#x" % self.flags) |
| 14890 | q.breakable() |
| 14891 | q.text('}') |
| 14892 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14893 | stats_request.subtypes[3] = table_stats_request |
| 14894 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14895 | |
| 14896 | def parse_header(buf): |
| 14897 | if len(buf) < 8: |
| 14898 | raise loxi.ProtocolError("too short to be an OpenFlow message") |
| 14899 | return struct.unpack_from("!BBHL", buf) |
| 14900 | |
| 14901 | def parse_message(buf): |
| 14902 | msg_ver, msg_type, msg_len, msg_xid = parse_header(buf) |
Rich Lane | fe600f5 | 2013-07-09 13:22:32 -0700 | [diff] [blame] | 14903 | if msg_ver != const.OFP_VERSION and msg_type != const.OFPT_HELLO: |
| 14904 | 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] | 14905 | if len(buf) != msg_len: |
| 14906 | raise loxi.ProtocolError("incorrect message size") |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14907 | return message.unpack(loxi.generic_util.OFReader(buf)) |